Advertisement
Amirul93

React Native Password Input

Mar 15th, 2021
834
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.        <View style={styles.inputGroup}>
  2.               {/* <Text style={styles.inputLabel}>Password</Text> */}
  3.               <TextInput
  4.                 autoCapitalize="none"
  5.                 autoCompleteType="password"
  6.                 placeholder="Password"
  7.                 placeholderTextColor={Theme.colors.white}
  8.                 autoCorrect={false}
  9.                 autoFocus={true}
  10.                 secureTextEntry={form.secureTextEntry}
  11.                 value={form.password}
  12.                 onFocus={() => console.log('hey')}
  13.                 onChangeText={(val) => setForm({...form, password: val})}
  14.                 style={styles.inputField}
  15.               />
  16.               <View style={styles.visibilityToggle}>
  17.                 <TouchableOpacity
  18.                   onPress={() => {
  19.                     setForm({...form, secureTextEntry: !form.secureTextEntry});
  20.                   }}
  21.                   style={{paddingVertical: 4, paddingHorizontal: 10}}>
  22.                   {form.secureTextEntry ? (
  23.                     <Ionicons
  24.                       name="eye-off-outline"
  25.                       size={20}
  26.                       color={Theme.colors.white}
  27.                     />
  28.                   ) : (
  29.                     <Ionicons
  30.                       name="eye-outline"
  31.                       size={20}
  32.                       color={Theme.colors.white}
  33.                     />
  34.                   )}
  35.                 </TouchableOpacity>
  36.               </View>
  37.             </View>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement