Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add target-ability to 'Next' button in select crypto scene #4256

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -726,19 +726,19 @@ exports[`CreateWalletSelectCrypto should render with loading props 1`] = `
</RCTScrollView>
</View>
<View
pointerEvents="none"
style={
Object {
"opacity": 0,
"flex": 1,
"justifyContent": "flex-end",
"paddingBottom": 22,
}
}
>
<View
pointerEvents="none"
style={
Object {
"alignSelf": "center",
"bottom": 22,
"position": "absolute",
"opacity": 0,
}
}
>
Expand Down
24 changes: 12 additions & 12 deletions src/components/scenes/CreateWalletSelectCryptoScene.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,19 +202,20 @@ const CreateWalletSelectCryptoComponent = (props: Props) => {

const renderCreateWalletRow: ListRenderItem<WalletCreateItem> = useHandler(item => {
const { key, displayName, pluginId, tokenId } = item.item

const value = selectedItems[key]
const accessibilityHint = sprintf(lstrings.create_wallet_hint, displayName)
const accessibilityState = { checked: value, selected: value }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is selected still necessary here?

const toggle = (
<Switch
accessibilityState={accessibilityState}
accessibilityRole="switch"
accessibilityState={{ selected: selectedItems[key] }}
accessibilityHint={accessibilityHint}
ios_backgroundColor={theme.toggleButtonOff}
trackColor={{
false: theme.toggleButtonOff,
true: theme.toggleButton
}}
value={selectedItems[key]}
value={value}
onValueChange={() => handleCreateWalletToggle(key)}
/>
)
Expand All @@ -223,6 +224,7 @@ const CreateWalletSelectCryptoComponent = (props: Props) => {
<CreateWalletSelectCryptoRow
pluginId={pluginId}
tokenId={tokenId}
key={displayName}
walletName={displayName}
onPress={() => handleCreateWalletToggle(key)}
rightSide={toggle}
Expand All @@ -235,12 +237,10 @@ const CreateWalletSelectCryptoComponent = (props: Props) => {
const renderNextButton = React.useMemo(
() => (
<Fade noFadeIn={defaultSelection.length > 0} visible={numSelected > 0} duration={300}>
<View style={styles.bottomButton}>
<MainButton label={lstrings.string_next_capitalized} type="primary" marginRem={[0, -0.5]} onPress={handleNext} alignSelf="center" />
</View>
<MainButton label={lstrings.string_next_capitalized} type="primary" marginRem={[0, -0.5]} onPress={handleNext} alignSelf="center" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to be a non-functional cleanup. If that's the case it should be in a separate commit at the beginning

</Fade>
),
[defaultSelection, handleNext, numSelected, styles.bottomButton]
[defaultSelection, handleNext, numSelected]
)

return (
Expand Down Expand Up @@ -273,18 +273,18 @@ const CreateWalletSelectCryptoComponent = (props: Props) => {
keyExtractor={keyExtractor}
renderItem={renderCreateWalletRow}
/>
{renderNextButton}
<View style={styles.bottomArea}>{renderNextButton}</View>
</View>
)}
</SceneWrapper>
)
}

const getStyles = cacheStyles((theme: Theme) => ({
bottomButton: {
alignSelf: 'center',
bottom: theme.rem(1),
position: 'absolute'
bottomArea: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

were these changes tested with the keyboard visible?

flex: 1,
justifyContent: 'flex-end',
paddingBottom: theme.rem(1)
},
content: {
flex: 1
Expand Down