Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Activation extends React.Component {
  2.     constructor(props) {
  3.         super(props)
  4.     }
  5.     componentDidUpdate() {
  6.         const { activationValid, navigation } = this.props;
  7.         if (activationValid) {
  8.             //avigation.navigate('Pin');
  9.         }
  10.     }
  11.  
  12.     onCodeChange(input) {
  13.         const { setActivationCode, validateActivationCode } = this.props;
  14.         setActivationCode(input);
  15.         if (input.length === 5) {
  16.             validateActivationCode(input);
  17.         }
  18.     }
  19.  
  20.     resend() {
  21.         const { resendCode, t } = this.props;
  22.         resendCode();
  23.         Alert.alert(
  24.             t('screens.signup.codeResendTitle'),
  25.             t('screens.signup.codeResendBody'),
  26.         );
  27.     }
  28.  
  29.     render() {
  30.         const {
  31.             activationCode, t, activationValid, validationInProgress,
  32.         } = this.props;
  33.         const lucyMood = (activationValid != null && !activationValid) ? 'happy' : 'demand';
  34.         const lucyTextKey = (activationValid != null && !activationValid) ? 'screens.signup.activationInvalidBubble' : 'screens.signup.activationInfoBubble';
  35.  
  36.         return (
  37.             <View style={{
  38.                 flex: 1, height: Dimensions.get('window').height / 1.65, width: Dimensions.get('window').width / 1.1, marginTop: 50,
  39.             }}
  40.             >
  41.                
  42.                 <ReadyAwareLucy
  43.                     style={{ flex: 5 }}
  44.                     mood={lucyMood}
  45.                     componentPosition="left"
  46.                     unReadyText={t(lucyTextKey)}
  47.                     readyText={t('screens.signup.codeActivated')}
  48.                     text={t(lucyTextKey)}
  49.                     componentSize={102}
  50.                     alignText="center"
  51.                     bubbleWidth="90%"
  52.                 />
  53.                 <ValidationContainer>
  54.                     <ValidatedPin activationCode={activationCode} onChange={textInput => this.onCodeChange(textInput)} activationValid={activationValid}/>
  55.                 </ValidationContainer>
  56.                 <View style={{ flex: 1 }}>
  57.                     <SecondaryButton title={t('screens.signup.noCodeReceived')} onPress={() => this.resend()} fontSize={21 + scaleFactor} />
  58.                 </View>
  59.             </View>
  60.         );
  61.     }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement