Skip to content

Instantly share code, notes, and snippets.

@alyssoncm
Created December 30, 2020 20:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alyssoncm/1a26f132bcc5493c08cc4aeefd45ce75 to your computer and use it in GitHub Desktop.
Save alyssoncm/1a26f132bcc5493c08cc4aeefd45ce75 to your computer and use it in GitHub Desktop.
import React, { useState } from 'react';
import { Button, Text, TextInput, View } from 'react-native';
export default function Application() {
const [text, setText] = useState('');
const [enableSecure, setEnableSecure] = useState(true);
function toggleSecure() {
setEnableSecure(value => !value)
}
return (
<View>
<TextInput
secureTextEntry={enableSecure}
onChangeText={text => setText(text)}
defaultValue={text}
/>
<Text>
{text}
</Text>
<Button onPress={toggleSecure}>
Toggle secure text
</Button>
</View>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment