diff --git a/package.json b/package.json index 36df3a51..a8db2e83 100644 --- a/package.json +++ b/package.json @@ -30,16 +30,16 @@ "devDependencies": { "@babel/core": "^7.15.0", "@babel/runtime": "^7.15.3", - "@polkadot/dev": "^0.62.60", - "@polkadot/ts": "^0.4.4", - "@polkadot/x-bundle": "^7.2.1", - "@types/jest": "^26.0.24", + "@polkadot/dev": "^0.62.62", + "@polkadot/ts": "^0.4.6", + "@polkadot/x-bundle": "^7.2.2-5", + "@types/jest": "^27.0.1", "babel-plugin-transform-vue-template": "^0.4.2", "empty": "^0.10.1", "react": "^17.0.2", "react-dom": "^17.0.2", "react-is": "^17.0.2", - "react-native": "^0.64.2", + "react-native": "^0.65.1", "vue-template-compiler": "^2.6.14", "webpack": "^4.46.0", "webpack-cli": "^3.3.12", diff --git a/packages/exampleReactNative/App.tsx b/packages/exampleReactNative/App.tsx index 74403494..0304f697 100644 --- a/packages/exampleReactNative/App.tsx +++ b/packages/exampleReactNative/App.tsx @@ -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(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 { + style={styles.scrollView} + > React-Native Example @@ -144,7 +150,7 @@ export default function App (): React.ReactElement | null { .map(({ text, value }): React.ReactNode => (