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

Fix seed phrase text cut off on iOS #1299

Merged
merged 3 commits into from
May 9, 2019
Merged
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
67 changes: 35 additions & 32 deletions src/ui/registration/components/seedPhrase.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import { StyleSheet } from 'react-native'
import { StyleSheet, View, Text } from 'react-native'
import { JolocomTheme } from 'src/styles/jolocom-theme'
import { Container, Block, CenteredText } from 'src/ui/structure/'
import { Container } from 'src/ui/structure/'
import I18n from 'src/locales/i18n'

const { Button } = require('react-native-material-ui')
Expand All @@ -16,29 +16,35 @@ const styles = StyleSheet.create({
container: {
backgroundColor: JolocomTheme.primaryColorBlack,
},
phrase: {
paddingLeft: '3%',
paddingRight: '3%',
color: JolocomTheme.primaryColorWhite,
fontSize: 34,
fontFamily: JolocomTheme.contentFontFamily,
lineHeight: 38,
noteSection: {
marginTop: 20,
flex: 0.8,
justifyContent: 'center',
},
sideNote: {
paddingLeft: '5%',
paddingRight: '5%',
note: {
textAlign: 'center',
lineHeight: 26,
color: JolocomTheme.primaryColorSand,
fontSize: JolocomTheme.labelFontSize,
fontFamily: JolocomTheme.contentFontFamily,
},
footerButton: {
position: 'absolute',
bottom: '5%',
phraseSection: {
flex: 1,
},
seedPhrase: {
textAlign: 'center',
color: JolocomTheme.primaryColorWhite,
fontSize: 34,
fontFamily: JolocomTheme.contentFontFamily,
lineHeight: 38,
},
buttonSection: {
marginTop: 'auto',
},
buttonContainer: {
width: 225,
height: 50,
borderRadius: 4,
height: 48,
paddingHorizontal: 25,
backgroundColor: JolocomTheme.primaryColorPurple,
},
buttonText: {
Expand All @@ -52,28 +58,25 @@ const styles = StyleSheet.create({

export const SeedPhrase: React.SFC<Props> = props => (
<Container style={styles.container}>
<Block flex={0.1}>
<CenteredText
style={styles.sideNote}
msg={
I18n.t('Write these words down on an analog and secure place') +
'.\n ' +
<View style={styles.noteSection}>
<Text style={styles.note}>
{I18n.t('Write these words down on an analog and secure place') +
'. ' +
I18n.t('Without these words, you cannot access your wallet again') +
'.'
}
/>
</Block>
<Block flex={0.6}>
<CenteredText style={styles.phrase} msg={props.seedPhrase} />
</Block>
<Block style={styles.footerButton}>
'.'}
</Text>
</View>
<View style={styles.phraseSection}>
<Text style={styles.seedPhrase}>{props.seedPhrase}</Text>
</View>
<View style={styles.buttonSection}>
<Button
style={{ container: styles.buttonContainer, text: styles.buttonText }}
onPress={props.handleButtonTap}
raised
upperCase={false}
text={I18n.t('Yes, I wrote it down')}
/>
</Block>
</View>
</Container>
)
122 changes: 76 additions & 46 deletions tests/ui/components/__snapshots__/seedPhrase.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,46 +8,60 @@ exports[`seedPhrase component matches the snapshot with checkbox checked 1`] = `
}
}
>
<Block
flex={0.1}
<Component
style={
Object {
"flex": 0.8,
"justifyContent": "center",
"marginTop": 20,
}
}
>
<CenteredText
msg="Write these words down on an analog and secure place.
Without these words, you cannot access your wallet again."
<Text
accessible={true}
allowFontScaling={true}
ellipsizeMode="tail"
style={
Object {
"color": "#ffefdf",
"fontFamily": "TT Commons",
"fontSize": 20,
"lineHeight": 26,
"paddingLeft": "5%",
"paddingRight": "5%",
"textAlign": "center",
}
}
/>
</Block>
<Block
flex={0.6}
>
Write these words down on an analog and secure place. Without these words, you cannot access your wallet again.
</Text>
</Component>
<Component
style={
Object {
"flex": 1,
}
}
>
<CenteredText
msg="mock seedPhrase"
<Text
accessible={true}
allowFontScaling={true}
ellipsizeMode="tail"
style={
Object {
"color": "white",
"fontFamily": "TT Commons",
"fontSize": 34,
"lineHeight": 38,
"paddingLeft": "3%",
"paddingRight": "3%",
"textAlign": "center",
}
}
/>
</Block>
<Block
>
mock seedPhrase
</Text>
</Component>
<Component
style={
Object {
"bottom": "5%",
"position": "absolute",
"marginTop": "auto",
}
}
>
Expand All @@ -63,8 +77,9 @@ exports[`seedPhrase component matches the snapshot with checkbox checked 1`] = `
Object {
"container": Object {
"backgroundColor": "#942f51",
"height": 50,
"width": 225,
"borderRadius": 4,
"height": 48,
"paddingHorizontal": 25,
},
"text": Object {
"color": "white",
Expand All @@ -79,7 +94,7 @@ exports[`seedPhrase component matches the snapshot with checkbox checked 1`] = `
text="Yes, I wrote it down"
upperCase={false}
/>
</Block>
</Component>
</Container>
`;

Expand All @@ -91,46 +106,60 @@ exports[`seedPhrase component matches the snapshot with checkbox unchecked 1`] =
}
}
>
<Block
flex={0.1}
<Component
style={
Object {
"flex": 0.8,
"justifyContent": "center",
"marginTop": 20,
}
}
>
<CenteredText
msg="Write these words down on an analog and secure place.
Without these words, you cannot access your wallet again."
<Text
accessible={true}
allowFontScaling={true}
ellipsizeMode="tail"
style={
Object {
"color": "#ffefdf",
"fontFamily": "TT Commons",
"fontSize": 20,
"lineHeight": 26,
"paddingLeft": "5%",
"paddingRight": "5%",
"textAlign": "center",
}
}
/>
</Block>
<Block
flex={0.6}
>
Write these words down on an analog and secure place. Without these words, you cannot access your wallet again.
</Text>
</Component>
<Component
style={
Object {
"flex": 1,
}
}
>
<CenteredText
msg="mock seedPhrase"
<Text
accessible={true}
allowFontScaling={true}
ellipsizeMode="tail"
style={
Object {
"color": "white",
"fontFamily": "TT Commons",
"fontSize": 34,
"lineHeight": 38,
"paddingLeft": "3%",
"paddingRight": "3%",
"textAlign": "center",
}
}
/>
</Block>
<Block
>
mock seedPhrase
</Text>
</Component>
<Component
style={
Object {
"bottom": "5%",
"position": "absolute",
"marginTop": "auto",
}
}
>
Expand All @@ -146,8 +175,9 @@ exports[`seedPhrase component matches the snapshot with checkbox unchecked 1`] =
Object {
"container": Object {
"backgroundColor": "#942f51",
"height": 50,
"width": 225,
"borderRadius": 4,
"height": 48,
"paddingHorizontal": 25,
},
"text": Object {
"color": "white",
Expand All @@ -162,6 +192,6 @@ exports[`seedPhrase component matches the snapshot with checkbox unchecked 1`] =
text="Yes, I wrote it down"
upperCase={false}
/>
</Block>
</Component>
</Container>
`;