Bump dev (w/ jsx linting) (#514)

This commit is contained in:
Jaco
2021-08-26 11:29:23 +03:00
committed by GitHub
parent 28956664cc
commit 9c47628233
11 changed files with 673 additions and 819 deletions
+18 -12
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2021 @polkadot/example-react authors & contributors
// SPDX-License-Identifier: Apache-2.0
import React, { useEffect, useState } from 'react';
import React, { useCallback, useEffect, useState } from 'react';
import { Button, SafeAreaView, ScrollView, StatusBar, StyleSheet, Text, View } from 'react-native';
import { Colors } from 'react-native/Libraries/NewAppScreen';
@@ -57,17 +57,22 @@ export default function App (): React.ReactElement | null {
const [phrase, setPhrase] = useState<string | null>(null);
const [ss58Format, setSS58Format] = useState(42);
const _onClickNew = (): void => {
const phrase = mnemonicGenerate(12);
const { address } = keyring.createFromUri(phrase);
const _onClickNew = useCallback(
(): void => {
const phrase = mnemonicGenerate(12);
const { address } = keyring.createFromUri(phrase);
setAddress(keyring.encodeAddress(address, ss58Format));
setPhrase(phrase);
};
setAddress(keyring.encodeAddress(address, ss58Format));
setPhrase(phrase);
},
[ss58Format]
);
const _onChangeSS58Format = (value: string): void => {
setSS58Format(parseInt(value, 10));
};
const _onChangeSS58Format = useCallback(
(value: string) =>
() => setSS58Format(parseInt(value, 10)),
[]
);
useEffect((): void => {
isReady && _onClickNew();
@@ -108,7 +113,8 @@ export default function App (): React.ReactElement | null {
<SafeAreaView>
<ScrollView
contentInsetAdjustmentBehavior='automatic'
style={styles.scrollView}>
style={styles.scrollView}
>
<View style={styles.body}>
<View style={styles.sectionContainer}>
<Text style={styles.mainTitle}>React-Native Example</Text>
@@ -144,7 +150,7 @@ export default function App (): React.ReactElement | null {
.map(({ text, value }): React.ReactNode => (
<Button
key={value}
onPress={(): void => _onChangeSS58Format(value.toString())}
onPress={_onChangeSS58Format(value.toString())}
title={text}
/>
))
+4 -4
View File
@@ -12,19 +12,19 @@
"test": "jest"
},
"dependencies": {
"@polkadot/keyring": "^7.2.1",
"@polkadot/keyring": "^7.2.2-5",
"@polkadot/reactnative-identicon": "0.85.2-0",
"@polkadot/ui-keyring": "0.85.2-0",
"@polkadot/ui-settings": "0.85.2-0",
"@polkadot/util": "^7.2.1",
"@polkadot/util-crypto": "^7.2.1",
"@polkadot/util": "^7.2.2-5",
"@polkadot/util-crypto": "^7.2.2-5",
"@react-native-community/async-storage": "^1.12.1",
"fast-text-encoding": "^1.0.3",
"get-yarn-workspaces": "^1.0.2",
"os-browserify": "^0.3.0",
"process": "^0.11.10",
"react": "^17.0.2",
"react-native": "^0.64.2",
"react-native": "^0.65.1",
"react-native-crypto": "^2.2.0",
"react-native-randombytes": "^3.6.1",
"stream-http": "^3.2.0"