Skip to content

Commit df3f7aa

Browse files
committed
fixup! fixup! Move import options into CreateWalletImportScene
1 parent f0c90cb commit df3f7aa

1 file changed

Lines changed: 54 additions & 20 deletions

File tree

src/components/scenes/CreateWalletImportScene.tsx

Lines changed: 54 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { JsonObject } from 'edge-core-js'
22
import * as React from 'react'
3-
import { Platform, View } from 'react-native'
3+
import { Linking, Platform, View } from 'react-native'
44
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view'
55
import { sprintf } from 'sprintf-js'
66

@@ -19,8 +19,10 @@ import {
1919
import { useSelector } from '../../types/reactRedux'
2020
import type { EdgeAppSceneProps } from '../../types/routerTypes'
2121
import { SceneButtons } from '../buttons/SceneButtons'
22+
import { EdgeTouchableOpacity } from '../common/EdgeTouchableOpacity'
2223
import { SceneWrapper } from '../common/SceneWrapper'
2324
import { CryptoIcon } from '../icons/CryptoIcon'
25+
import { InformationCircleIcon } from '../icons/ThemedIcons'
2426
import { ButtonsModal } from '../modals/ButtonsModal'
2527
import { Airship, showError } from '../services/AirshipInstance'
2628
import { cacheStyles, type Theme, useTheme } from '../services/ThemeContext'
@@ -299,27 +301,52 @@ const CreateWalletImportComponent = (props: Props): React.JSX.Element => {
299301
if (item == null) return null
300302

301303
const { value, error } = item
304+
const { knowledgeBaseUri } = opt.displayDescription ?? {}
305+
306+
const returnKeyType =
307+
opt.inputType === 'number-pad' && Platform.OS === 'ios'
308+
? undefined
309+
: 'done'
302310

303311
return (
304-
<FilledTextInput
305-
key={key}
306-
aroundRem={0.5}
307-
placeholder={`${opt.displayName}${
308-
opt.required ? ` (${lstrings.fragment_required})` : ''
309-
}`}
310-
value={value}
311-
error={
312-
error ? lstrings.create_wallet_invalid_input : undefined
313-
}
314-
keyboardType={opt.inputType}
315-
autoCapitalize="none"
316-
autoCorrect={false}
317-
autoComplete="off"
318-
onChangeText={(text: string) => {
319-
handleOptionChange(text, pluginId, opt)
320-
}}
321-
returnKeyType="done"
322-
/>
312+
<View key={key} style={styles.optionRow}>
313+
<FilledTextInput
314+
aroundRem={0.5}
315+
expand
316+
placeholder={`${opt.displayName}${
317+
opt.required ? ` (${lstrings.fragment_required})` : ''
318+
}`}
319+
value={value}
320+
error={
321+
error ? lstrings.create_wallet_invalid_input : undefined
322+
}
323+
keyboardType={opt.inputType}
324+
autoCapitalize="none"
325+
autoCorrect={false}
326+
autoComplete="off"
327+
onChangeText={(text: string) => {
328+
handleOptionChange(text, pluginId, opt)
329+
}}
330+
returnKeyType={returnKeyType}
331+
/>
332+
{knowledgeBaseUri != null ? (
333+
<EdgeTouchableOpacity
334+
style={styles.infoButton}
335+
onPress={() => {
336+
Linking.openURL(knowledgeBaseUri).catch(
337+
(err: unknown) => {
338+
showError(err)
339+
}
340+
)
341+
}}
342+
>
343+
<InformationCircleIcon
344+
size={theme.rem(1.25)}
345+
color={theme.iconTappable}
346+
/>
347+
</EdgeTouchableOpacity>
348+
) : null}
349+
</View>
323350
)
324351
})}
325352
</View>
@@ -365,6 +392,13 @@ const getStyles = cacheStyles((theme: Theme) => ({
365392
pluginIdText: {
366393
fontSize: theme.rem(1),
367394
marginLeft: theme.rem(0.5)
395+
},
396+
optionRow: {
397+
flexDirection: 'row',
398+
alignItems: 'center'
399+
},
400+
infoButton: {
401+
padding: theme.rem(0.5)
368402
}
369403
}))
370404

0 commit comments

Comments
 (0)