components#Background TypeScript Examples

The following examples show how to use components#Background. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Overview.tsx    From react-native-crypto-wallet-app with MIT License 6 votes vote down vote up
Overview = () => {
  const alert = useAlert();
  const checkIfNewUser = useCallback(async () => {
    try {
      const isNewUser = Boolean(await AsyncStorage.getItem('isNewUser'));
      if (isNewUser) {
        alert('You are a new user!');
      } else {
        alert('You are an existing user!');
      }
    } catch (error) {}
  }, [alert]);

  useEffect(() => {
    checkIfNewUser();
  }, [checkIfNewUser]);

  const handleSignOut = async () => {
    await auth().signOut();
  };

  return (
    <Background>
      <StyledButton variant="positive" label="Sign out" onPress={handleSignOut} />
    </Background>
  );
}
Example #2
Source File: ChooseDialingCode.tsx    From react-native-crypto-wallet-app with MIT License 6 votes vote down vote up
ChooseDialingCode = () => {
  /*

const [selectedCountry, setSelectedCountry] = useState<ICountry>({
    name: 'unitedStates',
    dialingCode: '+1',
  });

  const { name } = selectedCountry;

  return (
    <Background>
      <Box flex={1} justifyContent="center" paddingHorizontal="l" backgroundColor="bgSecondary">
        <DialingCodeDropdown selectedCountry={name} onPress={() => true} />
      </Box>
    </Background>
  );


 */
  return (
    <Background>
      <StyledText variant="h1">ChooseDialingCode</StyledText>
    </Background>
  );
}
Example #3
Source File: Welcome.tsx    From react-native-crypto-wallet-app with MIT License 6 votes vote down vote up
Welcome = ({ navigation }: StackNavigationProps<PreAuthScreens, 'Welcome'>) => {
  const handleNavigation = (route: 'Login' | 'SignUp') => {
    navigation.navigate(route);
  };

  return (
    <Background isBlue>
      <Box flex={1} alignItems="center">
        <Box style={WelcomeStyle.logo}>
          <Illustration name="logo" />
        </Box>
        <Box alignItems="center">
          <StyledText variant="h3Regular" color="white" opacity={0.5}>
            Welcome to
          </StyledText>
          <StyledText variant="h1Light" color="white">
            WHOLLET
          </StyledText>
        </Box>
        <Box flex={1} justifyContent="flex-end">
          <BottomSection
            mainButtonVariant="secondary"
            mainButtonLabel="Create account"
            lightTextLabel="Already have an account?"
            accentTextLabel="Login"
            onMainButtonPress={() => handleNavigation('SignUp')}
            onAccentTextPress={() => handleNavigation('Login')}
            isWelcomePage
          />
        </Box>
      </Box>
    </Background>
  );
}
Example #4
Source File: Onboarding.tsx    From react-native-crypto-wallet-app with MIT License 6 votes vote down vote up
Onboarding = ({ navigation }: StackNavigationProps<PreAuthScreens, 'Onboarding'>) => {
  const { height } = Dimensions.get('window');

  const handleGetStartedPress = () => navigation.navigate('Welcome');

  return (
    <Background>
      <ContentContainer height={height * 0.54} />
      <OnboardingSlider onGetStartedPress={handleGetStartedPress} />
    </Background>
  );
}
Example #5
Source File: VerifyCode.tsx    From react-native-crypto-wallet-app with MIT License 5 votes vote down vote up
VerifyCode = () => {
  return (
    <Background>
      <StyledText variant="h1">VerifyCode</StyledText>
    </Background>
  );
}
Example #6
Source File: ScanQRCode.tsx    From react-native-crypto-wallet-app with MIT License 5 votes vote down vote up
ScanQRCode = () => {
  return (
    <Background>
      <StyledText variant="h1">ScanQRCode</StyledText>
    </Background>
  );
}
Example #7
Source File: Confirmation.tsx    From react-native-crypto-wallet-app with MIT License 5 votes vote down vote up
Confirmation = () => {
  return (
    <Background>
      <StyledText variant="h1">Confirmation</StyledText>
    </Background>
  );
}
Example #8
Source File: TFA.tsx    From react-native-crypto-wallet-app with MIT License 5 votes vote down vote up
TFA = () => {
  return (
    <Background>
      <StyledText variant="h1">TFA</StyledText>
    </Background>
  );
}
Example #9
Source File: ChangePassword.tsx    From react-native-crypto-wallet-app with MIT License 5 votes vote down vote up
ChangePassword = () => {
  return (
    <Background>
      <StyledText variant="h1">ChangePassword</StyledText>
    </Background>
  );
}
Example #10
Source File: ChangePin.tsx    From react-native-crypto-wallet-app with MIT License 5 votes vote down vote up
ChangePin = () => {
  return (
    <Background>
      <StyledText variant="h1">ChangePin</StyledText>
    </Background>
  );
}
Example #11
Source File: NewPin.tsx    From react-native-crypto-wallet-app with MIT License 5 votes vote down vote up
NewPin = () => {
  return (
    <Background>
      <StyledText variant="h1">NewPin</StyledText>
    </Background>
  );
}
Example #12
Source File: Security.tsx    From react-native-crypto-wallet-app with MIT License 5 votes vote down vote up
Security = () => {
  return (
    <Background>
      <StyledText variant="h1">Security</StyledText>
    </Background>
  );
}
Example #13
Source File: AddMessage.tsx    From react-native-crypto-wallet-app with MIT License 5 votes vote down vote up
AddMessage = () => {
  return (
    <Background>
      <StyledText variant="h1">AddMessage</StyledText>
    </Background>
  );
}
Example #14
Source File: Amount.tsx    From react-native-crypto-wallet-app with MIT License 5 votes vote down vote up
Amount = () => {
  return (
    <Background>
      <StyledText variant="h1">Amount</StyledText>
    </Background>
  );
}
Example #15
Source File: ChooseRecipient.tsx    From react-native-crypto-wallet-app with MIT License 5 votes vote down vote up
ChooseRecipient = () => {
  return (
    <Background>
      <StyledText variant="h1">ChooseRecipient</StyledText>
    </Background>
  );
}
Example #16
Source File: AllAssets.tsx    From react-native-crypto-wallet-app with MIT License 5 votes vote down vote up
AllAssets = () => {
  return (
    <Background>
      <StyledText variant="h1">AllAssets</StyledText>
    </Background>
  );
}
Example #17
Source File: AllTransactions.tsx    From react-native-crypto-wallet-app with MIT License 5 votes vote down vote up
AllTransaction = () => {
  return (
    <Background>
      <StyledText variant="h1">AllTransaction</StyledText>
    </Background>
  );
}
Example #18
Source File: CoinDetails.tsx    From react-native-crypto-wallet-app with MIT License 5 votes vote down vote up
CoinDetails = () => {
  return (
    <Background>
      <StyledText variant="h1">CoinDetails</StyledText>
    </Background>
  );
}
Example #19
Source File: TransactionDetails.tsx    From react-native-crypto-wallet-app with MIT License 5 votes vote down vote up
TransactionDetails = () => {
  return (
    <Background>
      <StyledText variant="h1">TransactionDetails</StyledText>
    </Background>
  );
}
Example #20
Source File: EnterAddress.tsx    From react-native-crypto-wallet-app with MIT License 5 votes vote down vote up
EnterAddress = () => {
  return (
    <Background>
      <StyledText variant="h1">EnterAddress</StyledText>
    </Background>
  );
}
Example #21
Source File: PinLayout.tsx    From react-native-crypto-wallet-app with MIT License 5 votes vote down vote up
PinLayout: React.FC<IPinLayout> = ({
  isLogin,
  isConfirm,
  pinEntry,
  loading,
  onCheckIfPinExists,
  onPinEntryFinished,
  onPinChange,
  onPinDelete,
}) => {
  useEffect(() => {
    onCheckIfPinExists();
  }, [onCheckIfPinExists]);

  useEffect(() => {
    onPinEntryFinished();
  }, [onPinEntryFinished]);

  const title = isLogin || isConfirm ? 'Verification required' : 'Create a PIN';
  const subtitle =
    isLogin || isConfirm
      ? 'Please enter your PIN to proceed'
      : 'Enhance the security of your account by creating a PIN code';

  return (
    <Background>
      {loading && <Loading isFullScreen />}
      <Header {...{ title, subtitle }} />
      <Box position="absolute">
        <TextInput
          value={pinEntry}
          onChangeText={onPinChange}
          maxLength={4}
          style={{ opacity: 0 }}
          keyboardType="numeric"
        />
      </Box>
      <Box alignItems="center" style={PinLayoutStyle.indicator}>
        <Indicator type="pin" pinLength={pinEntry.length} />
      </Box>
      <Box flex={1} justifyContent="center">
        <NumberPad
          onNumberPress={onPinChange}
          onDeletePress={onPinDelete}
          onForgotPress={() => true}
          {...{ isLogin }}
        />
      </Box>
    </Background>
  );
}
Example #22
Source File: EnterPhoneNumber.tsx    From react-native-crypto-wallet-app with MIT License 5 votes vote down vote up
EnterPhoneNumber = () => {
  return (
    <Background>
      <StyledText variant="h1">EnterPhoneNumber</StyledText>
    </Background>
  );
}
Example #23
Source File: Overview.tsx    From react-native-crypto-wallet-app with MIT License 5 votes vote down vote up
Overview = () => {
  return (
    <Background>
      <StyledText variant="h1">Overview</StyledText>
    </Background>
  );
}
Example #24
Source File: ChooseCurrency.tsx    From react-native-crypto-wallet-app with MIT License 5 votes vote down vote up
ChooseCurrency = () => {
  return (
    <Background>
      <StyledText variant="h1">ChooseCurrency</StyledText>
    </Background>
  );
}
Example #25
Source File: SignUp.tsx    From react-native-crypto-wallet-app with MIT License 5 votes vote down vote up
SignUp = ({ navigation }: StackNavigationProps<SignUpScreens, 'SignUp'>) => {
  const [loading, setLoading] = useState<boolean>(false);
  const [email, setEmail] = useState<string>('');
  const [password, setPassword] = useState<string>('');
  const [showPassword, setShowPassword] = useState<boolean>(false);
  const alert = useAlert();

  const { height } = Dimensions.get('window');

  const isEmailValid = email.length > 0 ? validateEmailAddress(email) : undefined;
  const isPasswordValid = password.length > 0 ? validatePassword(password) : undefined;
  const isButtonDisabled = [isEmailValid, isPasswordValid].some(c => !c) || loading;

  const handleNavigationToLogin = () => {
    navigation.navigate('Login');
  };

  const handleSignUp = async () => {
    setLoading(true);
    try {
      const res = await auth().createUserWithEmailAndPassword(email, password);
      if (res) {
        const { additionalUserInfo } = res;
        if (additionalUserInfo) {
          const { isNewUser } = additionalUserInfo;
          await AsyncStorage.setItem('isNewUser', `${isNewUser}`);
        }
      }
    } catch (error) {
      if (error.code === 'auth/email-already-in-use') {
        setLoading(false);
        alert('Error', 'The email address is already in use by another account.', [
          { text: 'Login instead', onPress: handleNavigationToLogin },
        ]);
      }
    }
  };

  return (
    <Background>
      <Header {...{ navigation }} title="Create account" />
      <Box alignItems="center" justifyContent="flex-end" height={height * 0.37}>
        <Illustration name="office" width="308" height="171" />
      </Box>
      <AuthForm
        {...{
          email,
          password,
          isEmailValid,
          isPasswordValid,
          loading,
          isButtonDisabled,
          showPassword,
        }}
        isSignUp
        onEmailChange={v => setEmail(v)}
        onPasswordChange={v => setPassword(v)}
        onShowPasswordPress={() => setShowPassword(s => !s)}
        onNavigationToLoginOrSignUp={handleNavigationToLogin}
        onSignUpPress={handleSignUp}
        submitButtonLabel="Let's get started"
        bottomSectionLightTextLabel="Already have an account?"
        bottomSectionAccentTextLabel="Login"
      />
    </Background>
  );
}
Example #26
Source File: NewPassword.tsx    From react-native-crypto-wallet-app with MIT License 5 votes vote down vote up
NewPassword = () => {
  return (
    <Background>
      <StyledText variant="h1">NewPassword</StyledText>
    </Background>
  );
}
Example #27
Source File: Login.tsx    From react-native-crypto-wallet-app with MIT License 5 votes vote down vote up
SignUp = ({ navigation }: StackNavigationProps<SignUpScreens, 'SignUp'>) => {
  const [loading, setLoading] = useState<boolean>(false);
  const [email, setEmail] = useState<string>('');
  const [password, setPassword] = useState<string>('');
  const [showPassword, setShowPassword] = useState<boolean>(false);
  const alert = useAlert();

  const { height } = Dimensions.get('window');

  const isEmailValid = email.length > 0 ? validateEmailAddress(email) : undefined;
  const isPasswordValid = password.length > 0 ? validatePassword(password) : undefined;
  const isButtonDisabled = [isEmailValid, isPasswordValid].some(c => !c) || loading;

  const handleLogin = async () => {
    setLoading(true);
    try {
      const res = await auth().signInWithEmailAndPassword(email, password);
      if (res) {
        const { additionalUserInfo } = res;
        if (additionalUserInfo) {
          const { isNewUser } = additionalUserInfo;
          await AsyncStorage.setItem('isNewUser', `${isNewUser}`);
        }
      }
    } catch (error) {
      if (error.code === 'auth/user-not-found') {
        setLoading(false);
        alert(
          'Error',
          'The email and password you entered did not match our records. Please double check and try again.',
        );
      }
    }
  };

  return (
    <Background>
      <Header {...{ navigation }} title="Welcome Back!" colorMode="dark" />
      <Box alignItems="center" justifyContent="flex-end" height={height * 0.38}>
        <Illustration name="login" width="308" height={`${(height * 28) / 100}`} />
      </Box>
      <AuthForm
        {...{
          email,
          password,
          isEmailValid,
          isPasswordValid,
          loading,
          isButtonDisabled,
          showPassword,
        }}
        onEmailChange={v => setEmail(v)}
        onPasswordChange={v => setPassword(v)}
        onShowPasswordPress={() => setShowPassword(s => !s)}
        onNavigationToLoginOrSignUp={() => navigation.navigate('SignUp')}
        onSignUpPress={handleLogin}
        onForgotPasswordPress={() => true}
        submitButtonLabel="Login"
        bottomSectionLightTextLabel="Don't have an account?"
        bottomSectionAccentTextLabel="Sign Up"
      />
    </Background>
  );
}
Example #28
Source File: ForgotPassword.tsx    From react-native-crypto-wallet-app with MIT License 5 votes vote down vote up
ForgotPassword = () => {
  return (
    <Background>
      <StyledText variant="h1">ForgotPassword</StyledText>
    </Background>
  );
}
Example #29
Source File: CheckYourEmail.tsx    From react-native-crypto-wallet-app with MIT License 5 votes vote down vote up
CheckYourEmail = () => {
  return (
    <Background>
      <StyledText variant="h1">CheckYourEmail</StyledText>
    </Background>
  );
}