diff --git a/src/components/UiKit/OfflineBanner.js b/src/components/UiKit/OfflineBanner.js
index 0567805a5f..4b405c2563 100644
--- a/src/components/UiKit/OfflineBanner.js
+++ b/src/components/UiKit/OfflineBanner.js
@@ -2,7 +2,7 @@
import React from 'react'
import {useSelector} from 'react-redux'
-import {injectIntl, defineMessages, type IntlShape} from 'react-intl'
+import {useIntl, defineMessages} from 'react-intl'
import {isOnlineSelector} from '../../selectors'
import Banner from './Banner'
@@ -14,10 +14,11 @@ const messages = defineMessages({
},
})
-const OfflineBanner = ({intl}: {intl: IntlShape}) => {
+const OfflineBanner = () => {
+ const intl = useIntl()
const isOnline = useSelector(isOnlineSelector)
return isOnline ? null :
}
-export default injectIntl(OfflineBanner)
+export default OfflineBanner
diff --git a/src/components/WalletInit/ConnectNanoX/CheckNanoXScreen.js b/src/components/WalletInit/ConnectNanoX/CheckNanoXScreen.js
index 5dba1ec9f3..d9d8713bf4 100644
--- a/src/components/WalletInit/ConnectNanoX/CheckNanoXScreen.js
+++ b/src/components/WalletInit/ConnectNanoX/CheckNanoXScreen.js
@@ -3,7 +3,7 @@
import React from 'react'
import {View, ScrollView, Image, Platform, StyleSheet} from 'react-native'
import {SafeAreaView} from 'react-native-safe-area-context'
-import {injectIntl, defineMessages} from 'react-intl'
+import {useIntl, defineMessages} from 'react-intl'
import {Text, Button, BulletPointItem, ProgressStep, Spacer} from '../../UiKit'
import {confirmationMessages, ledgerMessages} from '../../../../src/i18n/global-messages'
@@ -11,7 +11,6 @@ import {WALLET_INIT_ROUTES} from '../../../RoutesList'
import image from '../../../assets/img/ledger_1.png'
-import type {IntlShape} from 'react-intl'
import {useNavigation, useRoute} from '@react-navigation/native'
import type {NetworkId, WalletImplementationId} from '../../../config/types'
@@ -52,7 +51,8 @@ export type Params = {
useUSB: boolean,
}
-const CheckNanoXScreen = ({intl}: {intl: IntlShape}) => {
+const CheckNanoXScreen = () => {
+ const intl = useIntl()
const route = useRoute()
const {networkId, walletImplementationId, useUSB} = ((route.params: any): Params)
@@ -104,6 +104,6 @@ const CheckNanoXScreen = ({intl}: {intl: IntlShape}) => {
)
}
-export default injectIntl(CheckNanoXScreen)
+export default CheckNanoXScreen
const Actions = (props) =>
diff --git a/src/components/WalletInit/ConnectNanoX/ConnectNanoXScreen.js b/src/components/WalletInit/ConnectNanoX/ConnectNanoXScreen.js
index 0b874de1cd..25199fd1f4 100644
--- a/src/components/WalletInit/ConnectNanoX/ConnectNanoXScreen.js
+++ b/src/components/WalletInit/ConnectNanoX/ConnectNanoXScreen.js
@@ -3,7 +3,7 @@
import React from 'react'
import {StyleSheet} from 'react-native'
import {SafeAreaView} from 'react-native-safe-area-context'
-import {injectIntl, defineMessages, type IntlShape} from 'react-intl'
+import {useIntl, defineMessages} from 'react-intl'
import LedgerConnect from '../../Ledger/LedgerConnect'
import {getHWDeviceInfo} from '../../../crypto/shelley/ledgerUtils'
@@ -34,11 +34,11 @@ const styles = StyleSheet.create({
})
type Props = {
- intl: IntlShape,
defaultDevices: ?Array, // for storybook
}
-const ConnectNanoXScreen = ({intl, defaultDevices}: Props) => {
+const ConnectNanoXScreen = ({defaultDevices}: Props) => {
+ const intl = useIntl()
const navigation = useNavigation()
const route = useRoute()
const walletImplementationId: WalletImplementationId = (route.params?.walletImplementationId: any)
@@ -87,4 +87,4 @@ const ConnectNanoXScreen = ({intl, defaultDevices}: Props) => {
)
}
-export default injectIntl(ConnectNanoXScreen)
+export default ConnectNanoXScreen
diff --git a/src/components/WalletInit/CreateWallet/MnemonicBackupImportanceModal.js b/src/components/WalletInit/CreateWallet/MnemonicBackupImportanceModal.js
index cbce846102..6827d10686 100644
--- a/src/components/WalletInit/CreateWallet/MnemonicBackupImportanceModal.js
+++ b/src/components/WalletInit/CreateWallet/MnemonicBackupImportanceModal.js
@@ -1,7 +1,7 @@
// @flow
import React from 'react'
-import {injectIntl, defineMessages, type IntlShape} from 'react-intl'
+import {useIntl, defineMessages} from 'react-intl'
import {Text, Button, Checkbox, Modal} from '../../UiKit'
import styles from './styles/MnemonicBackupImportanceModal.style'
@@ -31,12 +31,12 @@ const messages = defineMessages({
type Props = {
onConfirm: () => any,
- intl: IntlShape,
visible: boolean,
onRequestClose: () => any,
}
-const MnemonicBackupImportanceModal = ({onConfirm, intl, visible, onRequestClose}: Props) => {
+const MnemonicBackupImportanceModal = ({onConfirm, visible, onRequestClose}: Props) => {
+ const intl = useIntl()
const [acceptedKeyStorage, setAcceptedKeyStorage] = React.useState(false)
const [acceptedNewDeviceRecovery, setAcceptedNewDeviceRecovery] = React.useState(false)
@@ -67,4 +67,4 @@ const MnemonicBackupImportanceModal = ({onConfirm, intl, visible, onRequestClose
)
}
-export default injectIntl(MnemonicBackupImportanceModal)
+export default MnemonicBackupImportanceModal
diff --git a/src/components/WalletInit/CreateWallet/MnemonicCheckScreen.js b/src/components/WalletInit/CreateWallet/MnemonicCheckScreen.js
index 2113f28f82..6cb9b2bc18 100644
--- a/src/components/WalletInit/CreateWallet/MnemonicCheckScreen.js
+++ b/src/components/WalletInit/CreateWallet/MnemonicCheckScreen.js
@@ -3,7 +3,7 @@
import React from 'react'
import {useDispatch} from 'react-redux'
import {SafeAreaView} from 'react-native-safe-area-context'
-import {injectIntl, defineMessages, type IntlShape} from 'react-intl'
+import {useIntl, defineMessages} from 'react-intl'
import {View, ScrollView, TouchableOpacity} from 'react-native'
import {useNavigation, useRoute} from '@react-navigation/native'
@@ -38,7 +38,8 @@ const messages = defineMessages({
},
})
-const MnemonicCheckScreen = ({intl}: {intl: IntlShape}) => {
+const MnemonicCheckScreen = () => {
+ const intl = useIntl()
const navigation = useNavigation()
const route = (useRoute(): any)
const mnemonic: string = route.params.mnemonic
@@ -112,7 +113,7 @@ const MnemonicCheckScreen = ({intl}: {intl: IntlShape}) => {
)
}
-export default injectIntl(MnemonicCheckScreen)
+export default MnemonicCheckScreen
const MnemonicInput = ({
partialPhrase,
@@ -140,19 +141,25 @@ const MnemonicInput = ({
)
}
-const Instructions = injectIntl(({intl}: {intl: IntlShape}) => (
-
- {intl.formatMessage(messages.instructions)}
-
-))
+const Instructions = () => {
+ const intl = useIntl()
+
+ return (
+
+ {intl.formatMessage(messages.instructions)}
+
+ )
+}
+
+const ErrorMessage = ({visible}: {visible: boolean}) => {
+ const intl = useIntl()
-const ErrorMessage = injectIntl(({intl, visible}: {intl: IntlShape, visible: boolean}) => {
return (
{intl.formatMessage(messages.mnemonicWordsInputInvalidPhrase)}
)
-})
+}
const WordBadges = ({
words,
diff --git a/src/components/WalletInit/CreateWallet/MnemonicExplanationModal.js b/src/components/WalletInit/CreateWallet/MnemonicExplanationModal.js
index 8eb1f54db9..d09280c817 100644
--- a/src/components/WalletInit/CreateWallet/MnemonicExplanationModal.js
+++ b/src/components/WalletInit/CreateWallet/MnemonicExplanationModal.js
@@ -2,7 +2,7 @@
import React from 'react'
import {View, Image} from 'react-native'
-import {injectIntl, defineMessages, type IntlShape} from 'react-intl'
+import {useIntl, defineMessages} from 'react-intl'
import Markdown from 'react-native-easy-markdown'
import {Button, Modal} from '../../UiKit'
@@ -29,29 +29,32 @@ const messages = defineMessages({
},
})
-type ExternalProps = {
+type Props = {
onConfirm: () => any,
visible: boolean,
onRequestClose: () => any,
- intl: IntlShape,
}
-const MnemonicExplanationModal = ({onConfirm, intl, onRequestClose, visible}: ExternalProps) => (
-
-
-
-
+const MnemonicExplanationModal = ({onConfirm, onRequestClose, visible}: Props) => {
+ const intl = useIntl()
-
- {intl.formatMessage(messages.paragraph1)}
-
+ return (
+
+
+
+
-
- {intl.formatMessage(messages.paragraph2)}
-
+
+ {intl.formatMessage(messages.paragraph1)}
+
-
-
-)
+
+ {intl.formatMessage(messages.paragraph2)}
+
-export default injectIntl(MnemonicExplanationModal)
+
+
+ )
+}
+
+export default MnemonicExplanationModal
diff --git a/src/components/WalletInit/CreateWallet/MnemonicShowScreen.js b/src/components/WalletInit/CreateWallet/MnemonicShowScreen.js
index 9cda0a60d1..eb25818f65 100644
--- a/src/components/WalletInit/CreateWallet/MnemonicShowScreen.js
+++ b/src/components/WalletInit/CreateWallet/MnemonicShowScreen.js
@@ -3,7 +3,7 @@
import React from 'react'
import {View, Image, ScrollView, Dimensions} from 'react-native'
import {SafeAreaView} from 'react-native-safe-area-context'
-import {injectIntl, defineMessages, type IntlShape} from 'react-intl'
+import {useIntl, defineMessages} from 'react-intl'
import assert from '../../../utils/assert'
import {Text, Button, StatusBar} from '../../UiKit'
@@ -12,6 +12,7 @@ import {WALLET_INIT_ROUTES} from '../../../RoutesList'
import styles from './styles/MnemonicShowScreen.style'
import MnemonicBackupImportanceModal from './MnemonicBackupImportanceModal'
import recoveryPhrase from '../../../assets/img/recovery_phrase.png'
+import {useRoute, useNavigation} from '@react-navigation/native'
const messages = defineMessages({
mnemonicNote: {
@@ -28,12 +29,10 @@ const messages = defineMessages({
},
})
-type RouterProps = {
- route: any,
- navigation: any,
-}
-
-const MnemonicShowScreen = ({intl, route, navigation}: {|intl: IntlShape|} & RouterProps /* TODO: type */) => {
+const MnemonicShowScreen = () => {
+ const navigation = useNavigation()
+ const route = (useRoute(): any)
+ const intl = useIntl()
const mnemonic = route.params.mnemonic
const provider = route.params.provider
const [modal, setModal] = React.useState(false)
@@ -104,4 +103,4 @@ const MnemonicShowScreen = ({intl, route, navigation}: {|intl: IntlShape|} & Rou
)
}
-export default injectIntl(MnemonicShowScreen)
+export default MnemonicShowScreen
diff --git a/src/components/WalletInit/RestoreWallet/ImportReadOnlyWalletScreen.js b/src/components/WalletInit/RestoreWallet/ImportReadOnlyWalletScreen.js
index e85dbb6e4d..0005602cfb 100644
--- a/src/components/WalletInit/RestoreWallet/ImportReadOnlyWalletScreen.js
+++ b/src/components/WalletInit/RestoreWallet/ImportReadOnlyWalletScreen.js
@@ -3,7 +3,7 @@
import React from 'react'
import {View, ScrollView, StyleSheet, StatusBar} from 'react-native'
-import {injectIntl, defineMessages, type IntlShape} from 'react-intl'
+import {useIntl, defineMessages} from 'react-intl'
import {useNavigation, useRoute, useFocusEffect} from '@react-navigation/native'
import QRCodeScanner from 'react-native-qrcode-scanner'
@@ -75,7 +75,8 @@ export type Params = {
walletImplementationId: string,
}
-const ImportReadOnlyWalletScreen = ({intl}: {intl: IntlShape}) => {
+const ImportReadOnlyWalletScreen = () => {
+ const intl = useIntl()
const navigation = useNavigation()
const route = useRoute()
const {networkId, walletImplementationId}: Params = (route.params: any)
@@ -127,7 +128,7 @@ const ImportReadOnlyWalletScreen = ({intl}: {intl: IntlShape}) => {
)
}
-export default injectIntl(ImportReadOnlyWalletScreen)
+export default ImportReadOnlyWalletScreen
const CameraOverlay = () => (
mixed}) => {
- const [mnemonicWords, setMnemonicWords] = React.useState>((Array.from({length}).map(() => ''): any))
+export const MnemonicInput = ({length, onDone}: {length: number, onDone: (phrase: string) => mixed}) => {
+ const intl = useIntl()
+ const [mnemonicWords, setMnemonicWords] = React.useState>((Array.from({length}).map(() => ''): any))
- const mnemonicWordsComplete = mnemonicWords.every(Boolean)
- const isValid: boolean = mnemonicWordsComplete ? validateMnemonic(mnemonicWords.join(' ')) : false
- const errorText = !isValid && mnemonicWordsComplete ? intl.formatMessage(messages.invalidChecksum) : ''
+ const mnemonicWordsComplete = mnemonicWords.every(Boolean)
+ const isValid: boolean = mnemonicWordsComplete ? validateMnemonic(mnemonicWords.join(' ')) : false
+ const errorText = !isValid && mnemonicWordsComplete ? intl.formatMessage(messages.invalidChecksum) : ''
- const onSelect = (index: number, word: string) =>
- setMnemonicWords((words) => {
- const newWords = [...words]
- newWords[index] = word
+ const onSelect = (index: number, word: string) =>
+ setMnemonicWords((words) => {
+ const newWords = [...words]
+ newWords[index] = word
- return newWords
- })
+ return newWords
+ })
- React.useEffect(() => {
- if (mnemonicWordsComplete && isValid) {
- Keyboard.dismiss()
- onDone(mnemonicWords.join(' '))
- }
- }, [mnemonicWordsComplete, isValid, mnemonicWords, onDone])
-
- return (
- (
-
- )}
- />
- )
- },
-)
+ React.useEffect(() => {
+ if (mnemonicWordsComplete && isValid) {
+ Keyboard.dismiss()
+ onDone(mnemonicWords.join(' '))
+ }
+ }, [mnemonicWordsComplete, isValid, mnemonicWords, onDone])
+
+ return (
+ (
+
+ )}
+ />
+ )
+}
type MnemonicWordsInputProps = {
words: Array,
diff --git a/src/components/WalletInit/RestoreWallet/RestoreWalletScreen/RestoreWalletScreen.js b/src/components/WalletInit/RestoreWallet/RestoreWalletScreen/RestoreWalletScreen.js
index 11ee5343ce..20aafc8bb0 100644
--- a/src/components/WalletInit/RestoreWallet/RestoreWalletScreen/RestoreWalletScreen.js
+++ b/src/components/WalletInit/RestoreWallet/RestoreWalletScreen/RestoreWalletScreen.js
@@ -5,7 +5,7 @@
import React from 'react'
import {View, ScrollView} from 'react-native'
import {SafeAreaView} from 'react-native-safe-area-context'
-import {injectIntl, defineMessages, type IntlShape} from 'react-intl'
+import {useIntl, defineMessages} from 'react-intl'
import {useNavigation} from '@react-navigation/native'
import {useParams} from '../../../../navigation'
@@ -49,7 +49,8 @@ type Params = {
provider: string,
}
-export const RestoreWalletScreen = injectIntl(({intl}: {intl: IntlShape}) => {
+export const RestoreWalletScreen = () => {
+ const intl = useIntl()
const navigation = useNavigation()
const {networkId, walletImplementationId, provider} = useParams()
const {MNEMONIC_LEN: mnemonicLength} = getWalletConfigById(walletImplementationId)
@@ -88,7 +89,7 @@ export const RestoreWalletScreen = injectIntl(({intl}: {intl: IntlShape}) => {
)
-})
+}
const Instructions = (props) =>
const Actions = (props) =>
diff --git a/src/components/WalletInit/RestoreWallet/SaveReadOnlyWalletScreen.js b/src/components/WalletInit/RestoreWallet/SaveReadOnlyWalletScreen.js
index 730542677e..f10d330fdf 100644
--- a/src/components/WalletInit/RestoreWallet/SaveReadOnlyWalletScreen.js
+++ b/src/components/WalletInit/RestoreWallet/SaveReadOnlyWalletScreen.js
@@ -4,7 +4,7 @@ import React, {useState, useEffect} from 'react'
// TODO: in the future, prefer SafeAreaView from react-native-safe-area-context,
// current version however doesn't work well on iOS
import {View, SafeAreaView, FlatList, ScrollView} from 'react-native'
-import {injectIntl, type IntlShape, defineMessages} from 'react-intl'
+import {useIntl, defineMessages} from 'react-intl'
import {useDispatch} from 'react-redux'
import {useNavigation, useRoute} from '@react-navigation/native'
@@ -55,7 +55,6 @@ const CheckSumView = ({icon, checksum}: {icon: string, checksum: string}) => (
)
type WalletInfoProps = {|
- intl: IntlShape,
plate: {
accountPlate: {
ImagePart: string,
@@ -68,49 +67,50 @@ type WalletInfoProps = {|
networkId: NetworkId,
|}
-const WalletInfoView = ({intl, plate, normalizedPath, publicKeyHex, networkId}: WalletInfoProps) => (
-
-
-
- {intl.formatMessage(messages.checksumLabel)}
- {!!plate.accountPlate.ImagePart && (
-
- )}
-
-
-
- {intl.formatMessage(messages.walletAddressLabel)}
- item}
- renderItem={({item}) => }
- />
-
-
-
-
-
- {intl.formatMessage(messages.key)}
-
-
- {publicKeyHex}
-
+const WalletInfoView = ({plate, normalizedPath, publicKeyHex, networkId}: WalletInfoProps) => {
+ const intl = useIntl()
+
+ return (
+
+
+
+ {intl.formatMessage(messages.checksumLabel)}
+ {!!plate.accountPlate.ImagePart && (
+
+ )}
- {intl.formatMessage(messages.derivationPath)}
-
- {`m/${normalizedPath[0]}'/${normalizedPath[1]}'/${normalizedPath[2]}`}
-
-
-
-
-)
+
+ {intl.formatMessage(messages.walletAddressLabel)}
+ item}
+ renderItem={({item}) => }
+ />
+
+
+
+
+
+ {intl.formatMessage(messages.key)}
+
+
+ {publicKeyHex}
+
+
-type Props = {
- intl: IntlShape,
+ {intl.formatMessage(messages.derivationPath)}
+
+ {`m/${normalizedPath[0]}'/${normalizedPath[1]}'/${normalizedPath[2]}`}
+
+
+
+
+ )
}
-const SaveReadOnlyWalletScreen = ({intl}: Props) => {
+const SaveReadOnlyWalletScreen = () => {
+ const intl = useIntl()
const navigation = useNavigation()
const route: any = useRoute()
const [isWaiting, setIsWaiting] = React.useState(false)
@@ -197,7 +197,6 @@ const SaveReadOnlyWalletScreen = ({intl}: Props) => {
containerStyle={styles.walletFormStyle}
bottomContent={
{
)
}
-export default injectIntl(SaveReadOnlyWalletScreen)
+export default SaveReadOnlyWalletScreen
diff --git a/src/components/WalletInit/RestoreWallet/VerifyRestoredWallet.js b/src/components/WalletInit/RestoreWallet/VerifyRestoredWallet.js
index a97d782fa7..40530f0290 100644
--- a/src/components/WalletInit/RestoreWallet/VerifyRestoredWallet.js
+++ b/src/components/WalletInit/RestoreWallet/VerifyRestoredWallet.js
@@ -4,7 +4,8 @@
import React, {useState, useEffect} from 'react'
import {ActivityIndicator, View, ScrollView} from 'react-native'
import {SafeAreaView} from 'react-native-safe-area-context'
-import {injectIntl, defineMessages, type IntlShape} from 'react-intl'
+import {useIntl, defineMessages} from 'react-intl'
+import {useNavigation, useRoute} from '@react-navigation/native'
import {Text, Button, StatusBar, BulletPointItem, Spacer} from '../../UiKit'
@@ -95,7 +96,10 @@ const usePlateFromMnemonic = ({
return [plate, addresses]
}
-const VerifyWalletScreen = ({navigation, intl, route}: {intl: IntlShape} & Object /* TODO: type */) => {
+const VerifyWalletScreen = () => {
+ const intl = useIntl()
+ const navigation = useNavigation()
+ const route = (useRoute(): any)
const {formatMessage} = intl
const {phrase, networkId, walletImplementationId} = route.params
const [plate, addresses] = usePlateFromMnemonic({mnemonic: phrase, networkId, walletImplementationId})
@@ -162,7 +166,7 @@ const VerifyWalletScreen = ({navigation, intl, route}: {intl: IntlShape} & Objec
)
}
-export default injectIntl(VerifyWalletScreen)
+export default VerifyWalletScreen
const WalletInfo = (props) =>
const Plate = (props) =>
diff --git a/src/components/WalletInit/RestoreWallet/WalletAddress.js b/src/components/WalletInit/RestoreWallet/WalletAddress.js
index c1a9ed9b6d..3c57b7c577 100644
--- a/src/components/WalletInit/RestoreWallet/WalletAddress.js
+++ b/src/components/WalletInit/RestoreWallet/WalletAddress.js
@@ -3,7 +3,7 @@
import React from 'react'
import {View, Image, TouchableOpacity, Linking} from 'react-native'
import Clipboard from '@react-native-community/clipboard'
-import {injectIntl, defineMessages, type IntlShape} from 'react-intl'
+import {useIntl, defineMessages} from 'react-intl'
import copyIcon from '../../../assets/img/icon/copy.png'
import {Text} from '../../UiKit'
@@ -23,16 +23,15 @@ const messages = defineMessages({
})
const WalletAddress = ({
- intl,
addressHash,
networkId,
style,
}: {
- intl: IntlShape,
addressHash: string,
networkId: NetworkId,
style?: ViewStyleProp,
}) => {
+ const intl = useIntl()
const [showCopyNotification, setShowCopyNotification] = React.useState(false)
const onTapAddress = () => {
@@ -69,4 +68,4 @@ const WalletAddress = ({
)
}
-export default injectIntl(WalletAddress)
+export default WalletAddress
diff --git a/src/components/WalletInit/WalletDescription.js b/src/components/WalletInit/WalletDescription.js
index d2f2ad5b0c..2bc336e18f 100644
--- a/src/components/WalletInit/WalletDescription.js
+++ b/src/components/WalletInit/WalletDescription.js
@@ -2,7 +2,7 @@
import React from 'react'
import {View} from 'react-native'
-import {injectIntl, defineMessages, type IntlShape} from 'react-intl'
+import {useIntl, defineMessages} from 'react-intl'
import YoroiWalletIcon from '../../assets/YoroiWalletIcon'
import {Text} from '../UiKit'
@@ -17,17 +17,17 @@ const messages = defineMessages({
},
})
-type Props = {
- intl: IntlShape,
-}
+const WalletDescription = () => {
+ const intl = useIntl()
-const WalletDescription = ({intl}: Props) => (
-
-
-
- {intl.formatMessage(messages.slogan)}
+ return (
+
+
+
+ {intl.formatMessage(messages.slogan)}
+
-
-)
+ )
+}
-export default injectIntl(WalletDescription)
+export default WalletDescription
diff --git a/src/components/WalletInit/WalletForm.js b/src/components/WalletInit/WalletForm.js
index d352560f04..dbdfb38efb 100644
--- a/src/components/WalletInit/WalletForm.js
+++ b/src/components/WalletInit/WalletForm.js
@@ -4,7 +4,7 @@ import React from 'react'
import {useSelector} from 'react-redux'
import {View, ScrollView} from 'react-native'
import {SafeAreaView} from 'react-native-safe-area-context'
-import {injectIntl, defineMessages, type IntlShape} from 'react-intl'
+import {useIntl, defineMessages} from 'react-intl'
import {Button, TextInput, Spacer} from '../UiKit'
import {
@@ -48,11 +48,11 @@ const messages = defineMessages({
})
type Props = {
- intl: IntlShape,
onSubmit: ({name: string, password: string}) => mixed,
}
-const WalletForm = ({intl, onSubmit}: Props) => {
+const WalletForm = ({onSubmit}: Props) => {
+ const intl = useIntl()
const walletNames = useSelector(walletNamesSelector)
const [name, setName] = React.useState(CONFIG.DEBUG.PREFILL_FORMS ? CONFIG.DEBUG.WALLET_NAME : '')
const nameErrors = validateWalletName(name, null, walletNames)
@@ -146,7 +146,7 @@ const WalletForm = ({intl, onSubmit}: Props) => {
)
}
-export default injectIntl(WalletForm)
+export default WalletForm
const WalletNameInput = TextInput
const PasswordInput = TextInput
diff --git a/src/components/WalletInit/WalletFreshInitScreen.js b/src/components/WalletInit/WalletFreshInitScreen.js
index df3b373809..267029eb82 100644
--- a/src/components/WalletInit/WalletFreshInitScreen.js
+++ b/src/components/WalletInit/WalletFreshInitScreen.js
@@ -3,7 +3,7 @@
import React from 'react'
import {View, StyleSheet} from 'react-native'
import {SafeAreaView} from 'react-native-safe-area-context'
-import {injectIntl, defineMessages, type IntlShape} from 'react-intl'
+import {defineMessages, useIntl} from 'react-intl'
import WalletDescription from './WalletDescription'
import {Button, Spacer, StatusBar} from '../UiKit'
@@ -39,11 +39,9 @@ const styles = StyleSheet.create({
padding: 16,
},
})
-type Props = {
- intl: IntlShape,
-}
-const WalletInitScreen = ({intl}: Props) => {
+const WalletInitScreen = () => {
+ const intl = useIntl()
const navigation = useNavigation()
const navigateInitWallet = (networkId: NetworkId, walletImplementationId: WalletImplementationId) =>
navigation.navigate(WALLET_INIT_ROUTES.CREATE_RESTORE_SWITCH, {
@@ -111,7 +109,7 @@ const WalletInitScreen = ({intl}: Props) => {
)
}
-export default injectIntl(WalletInitScreen)
+export default WalletInitScreen
const Actions = (props) =>
diff --git a/src/components/WalletInit/WalletInitNavigator.js b/src/components/WalletInit/WalletInitNavigator.js
index 0d685e8912..5d6c0be54e 100644
--- a/src/components/WalletInit/WalletInitNavigator.js
+++ b/src/components/WalletInit/WalletInitNavigator.js
@@ -2,7 +2,7 @@
import React from 'react'
import {createStackNavigator} from '@react-navigation/stack'
-import {injectIntl, defineMessages, type IntlShape} from 'react-intl'
+import {defineMessages, useIntl} from 'react-intl'
import WalletFreshInitScreen from './WalletFreshInitScreen'
import WalletInitScreen from './WalletInitScreen'
@@ -91,98 +91,102 @@ type WalletInitRoutes = {
const Stack = createStackNavigator()
-const WalletInitNavigator = injectIntl(({intl}: {intl: IntlShape}) => (
- {
- // note: jormun is currently not supported. If you want to add this
- // jormun style, make sure to pass the networkId as a route param
+const WalletInitNavigator = () => {
+ const intl = useIntl()
- // $FlowFixMe mixed is incompatible with number
- const extraOptions = isJormungandr(route.params?.networkId) ? jormunNavigationOptions : {}
- return {
- cardStyle: {
- backgroundColor: 'transparent',
- },
- title: route.params?.title ?? undefined,
- ...defaultNavigationOptions,
- ...defaultStackNavigatorOptions,
- ...extraOptions,
- }
- }}
- >
-
-
-
-
- {
+ // note: jormun is currently not supported. If you want to add this
+ // jormun style, make sure to pass the networkId as a route param
+
+ // $FlowFixMe mixed is incompatible with number
+ const extraOptions = isJormungandr(route.params?.networkId) ? jormunNavigationOptions : {}
+ return {
+ cardStyle: {
+ backgroundColor: 'transparent',
+ },
+ title: route.params?.title ?? undefined,
+ ...defaultNavigationOptions,
+ ...defaultStackNavigatorOptions,
+ ...extraOptions,
+ }
}}
- />
-
-
-
- {(props) => }
-
-
-
-
-
-
-
-))
+
+
+
+
+
+
+
+
+ {(props) => }
+
+
+
+
+
+
+
+ )
+}
export default WalletInitNavigator
diff --git a/src/components/WalletInit/WalletInitScreen.js b/src/components/WalletInit/WalletInitScreen.js
index 4850055711..2a454d4a91 100644
--- a/src/components/WalletInit/WalletInitScreen.js
+++ b/src/components/WalletInit/WalletInitScreen.js
@@ -3,7 +3,7 @@
import React from 'react'
import {View} from 'react-native'
import {SafeAreaView} from 'react-native-safe-area-context'
-import {injectIntl, defineMessages, type IntlShape} from 'react-intl'
+import {defineMessages, useIntl} from 'react-intl'
import {useNavigation, useRoute} from '@react-navigation/native'
import WalletDescription from './WalletDescription'
@@ -66,11 +66,8 @@ const MODAL_STATES = {
}
type ModalState = $Values
-type Props = {
- intl: IntlShape,
-}
-
-const WalletInitScreen = ({intl}: Props) => {
+const WalletInitScreen = () => {
+ const intl = useIntl()
const navigation = useNavigation()
const route = (useRoute(): any)
const [modalState, _setModalState] = React.useState(MODAL_STATES.CLOSED)
@@ -233,4 +230,4 @@ const WalletInitScreen = ({intl}: Props) => {
)
}
-export default injectIntl(WalletInitScreen)
+export default WalletInitScreen
diff --git a/src/components/WalletInit/WalletNameForm.js b/src/components/WalletInit/WalletNameForm.js
index ea64d8dbf8..4568347908 100644
--- a/src/components/WalletInit/WalletNameForm.js
+++ b/src/components/WalletInit/WalletNameForm.js
@@ -2,7 +2,7 @@
import React from 'react'
import {View, SafeAreaView, Image, ActivityIndicator} from 'react-native'
-import {injectIntl, defineMessages, type IntlShape} from 'react-intl'
+import {defineMessages, useIntl} from 'react-intl'
import {useSelector} from 'react-redux'
import {CONFIG} from '../../config/config'
@@ -29,7 +29,6 @@ const messages = defineMessages({
})
type Props = {|
- intl: IntlShape,
onSubmit: ({name: string}) => any,
defaultWalletName?: string,
image?: ImageSource,
@@ -45,7 +44,6 @@ type Props = {|
|}
const WalletNameForm = ({
- intl,
onSubmit,
image,
progress,
@@ -55,6 +53,7 @@ const WalletNameForm = ({
bottomContent,
isWaiting = false,
}: Props) => {
+ const intl = useIntl()
const [name, setName] = React.useState(CONFIG.HARDWARE_WALLETS.LEDGER_NANO.DEFAULT_WALLET_NAME || '')
const walletNames = useSelector(walletNamesSelector)
const validationErrors = validateWalletName(name, null, walletNames)
@@ -108,4 +107,4 @@ const WalletNameForm = ({
)
}
-export default injectIntl(WalletNameForm)
+export default WalletNameForm