mirror of
https://github.com/pezkuwichain/pezkuwi-ui.git
synced 2026-05-06 15:57:57 +00:00
@@ -3,24 +3,12 @@
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import {
|
||||
SafeAreaView,
|
||||
StyleSheet,
|
||||
ScrollView,
|
||||
View,
|
||||
Text,
|
||||
StatusBar,
|
||||
Button
|
||||
} from 'react-native';
|
||||
|
||||
import {
|
||||
Colors
|
||||
} from 'react-native/Libraries/NewAppScreen';
|
||||
|
||||
import { Button, SafeAreaView, ScrollView, StatusBar, StyleSheet, Text, View } from 'react-native';
|
||||
import { Colors } from 'react-native/Libraries/NewAppScreen';
|
||||
import Identicon from '@polkadot/reactnative-identicon';
|
||||
import keyring from '@polkadot/ui-keyring';
|
||||
import settings from '@polkadot/ui-settings';
|
||||
import { mnemonicGenerate, cryptoWaitReady } from '@polkadot/util-crypto';
|
||||
import keyring from '@polkadot/ui-keyring';
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
scrollView: {
|
||||
@@ -56,9 +44,9 @@ const styles = StyleSheet.create({
|
||||
}
|
||||
});
|
||||
|
||||
const globalAny: any = global;
|
||||
const globalAny = global as unknown as Window;
|
||||
|
||||
const App = () => {
|
||||
export default function App (): React.ReactElement<{}> | null {
|
||||
const [ready, setReady] = useState(false);
|
||||
const [address, setAddress] = useState<string | null>(null);
|
||||
const [phrase, setPhrase] = useState<string | null>(null);
|
||||
@@ -138,7 +126,11 @@ const App = () => {
|
||||
{settings.availablePrefixes
|
||||
.filter((_, index): boolean => index !== 0)
|
||||
.map(({ text, value }): React.ReactNode => (
|
||||
<Button key={value} title={text} onPress={(): void => _onChangeSS58Format(value.toString())} />
|
||||
<Button
|
||||
key={value}
|
||||
title={text}
|
||||
onPress={(): void => _onChangeSS58Format(value.toString())}
|
||||
/>
|
||||
))
|
||||
}
|
||||
</View>
|
||||
@@ -148,6 +140,4 @@ const App = () => {
|
||||
</SafeAreaView>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default App;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
"react-native": "^0.61.2",
|
||||
"react-native-crypto": "^2.2.0",
|
||||
"react-native-randombytes": "^3.5.3",
|
||||
"react-native-svg": "^9.11.1",
|
||||
"react-native-svg": "^9.12.0",
|
||||
"stream-http": "^3.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.6.3",
|
||||
"@polkadot/ui-shared": "^0.46.0-beta.13",
|
||||
"react-native-svg": "^9.11.1"
|
||||
"react-native-svg": "^9.12.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "*",
|
||||
|
||||
@@ -8,25 +8,21 @@ import React from 'react';
|
||||
import { View } from 'react-native';
|
||||
import Svg, { Circle } from 'react-native-svg';
|
||||
|
||||
export default class Empty extends React.PureComponent<Props> {
|
||||
public render (): React.ReactNode {
|
||||
const { size } = this.props;
|
||||
|
||||
return (
|
||||
<View>
|
||||
<Svg
|
||||
height={size}
|
||||
viewBox='0 0 64 64'
|
||||
width={size}
|
||||
>
|
||||
<Circle
|
||||
cx='32'
|
||||
cy='32'
|
||||
r='32'
|
||||
fill='#eee'
|
||||
/>
|
||||
</Svg>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
export default function Empty ({ size }: Props): React.ReactElement<Props> {
|
||||
return (
|
||||
<View>
|
||||
<Svg
|
||||
height={size}
|
||||
viewBox='0 0 64 64'
|
||||
width={size}
|
||||
>
|
||||
<Circle
|
||||
cx='32'
|
||||
cy='32'
|
||||
r='32'
|
||||
fill='#eee'
|
||||
/>
|
||||
</Svg>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -13,33 +13,29 @@ interface Props extends BaseProps {
|
||||
sixPoint?: boolean;
|
||||
}
|
||||
|
||||
export default class Identicon extends React.PureComponent<Props> {
|
||||
public render (): React.ReactNode {
|
||||
const { address, sixPoint, size } = this.props;
|
||||
|
||||
return (
|
||||
<View>
|
||||
<Svg
|
||||
height={size}
|
||||
id={address}
|
||||
width={size}
|
||||
viewBox='0 0 64 64'
|
||||
>
|
||||
{generateIcon(address, sixPoint).map(this.renderCircle)}
|
||||
</Svg>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
private renderCircle = ({ cx, cy, r, fill }: CircleType, key: number): React.ReactNode => {
|
||||
return (
|
||||
<SvgCircle
|
||||
key={key}
|
||||
cx={cx}
|
||||
cy={cy}
|
||||
r={r}
|
||||
fill={fill}
|
||||
/>
|
||||
);
|
||||
}
|
||||
function renderCircle ({ cx, cy, r, fill }: CircleType, key: number): React.ReactNode {
|
||||
return (
|
||||
<SvgCircle
|
||||
key={key}
|
||||
cx={cx}
|
||||
cy={cy}
|
||||
r={r}
|
||||
fill={fill}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export default function Identicon ({ address, sixPoint, size }: Props): React.ReactElement<Props> {
|
||||
return (
|
||||
<View>
|
||||
<Svg
|
||||
height={size}
|
||||
id={address}
|
||||
width={size}
|
||||
viewBox='0 0 64 64'
|
||||
>
|
||||
{generateIcon(address, sixPoint).map(renderCircle)}
|
||||
</Svg>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
// Copyright 2018 @polkadot/reactnative-identicon authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
// NOTE This is not clean since we miss the proper RN typings. However it does
|
||||
// conflict with everything else, so... well, stick with the minimum here
|
||||
|
||||
declare module 'react-native' {
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
interface GestureResponderHandlers {}
|
||||
type ImageProperties = Record<string, string>;
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
interface ViewProperties {}
|
||||
|
||||
export const View: React.ComponentClass;
|
||||
}
|
||||
@@ -18,24 +18,24 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.6.3",
|
||||
"@ledgerhq/hw-transport-u2f": "^4.72.1",
|
||||
"@ledgerhq/hw-transport-webusb": "^4.72.1",
|
||||
"@ledgerhq/hw-transport-u2f": "^4.72.2",
|
||||
"@ledgerhq/hw-transport-webusb": "^4.72.2",
|
||||
"@types/ledgerhq__hw-transport-node-hid": "^4.21.1",
|
||||
"@types/ledgerhq__hw-transport-u2f": "^4.21.1",
|
||||
"@types/mkdirp": "^0.5.2",
|
||||
"@types/store": "^2.0.2",
|
||||
"extensionizer": "^1.0.1",
|
||||
"ledger-polkadot": "^0.5.0",
|
||||
"ledger-polkadot": "^0.5.1",
|
||||
"mkdirp": "^0.5.1",
|
||||
"store": "^2.0.12"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^1.5.1",
|
||||
"@polkadot/types": "^0.95.0-beta.22",
|
||||
"@polkadot/types": "^0.95.0-beta.30",
|
||||
"@polkadot/util": "^1.5.1"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@ledgerhq/hw-transport-node-hid": "^4.72.1"
|
||||
"@ledgerhq/hw-transport-node-hid": "^4.72.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@polkadot/keyring": "*"
|
||||
|
||||
Reference in New Issue
Block a user