Skip to content

Instantly share code, notes, and snippets.

@tanner-west
Created April 27, 2022 20:48
Show Gist options
  • Save tanner-west/7da81734415e7d3382c636a9fadb072a to your computer and use it in GitHub Desktop.
Save tanner-west/7da81734415e7d3382c636a9fadb072a to your computer and use it in GitHub Desktop.
import React, {useState} from 'react';
import {
SafeAreaView,
Text,
View,
TextInput,
} from 'react-native';
const Name = () => {
const [name, setName] = useState('');
return (
<SafeAreaView>
<View style={{padding: 10}}>
{!name ? (
<Text>Please type your name to get started</Text>
) : (
<Text>{`Your name is: ${name}`}</Text>
)}
<TextInput
testID="name-input"
onChangeText={text => setName(text)}
style={{
borderColor: 'black',
borderWidth: 1,
marginTop: 10,
padding: 5,
}}
/>
</View>
</SafeAreaView>
);
};
export default Name;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment