I am working on a very simple reminders app as an introduction to using react and javascript. (i am a complete beginner at javascript, but have experience with languages like ruby.) I want to be able to get a user keyboard input from this TextInput component (https://docs.expo.io/versions/v37.0.0/react-native/textinput/#content) without using a class. I just want to store the input as a variable and be able to call it up anywhere else in my code. The {text} variable in the second function is where i want to store the input from the first function. (apologies for bad english) i try to run it, and it says that it couldnt find variable 'text', even though thats what its being assigned to.
function NewReminderScreen({ navigation }) {
const [value, onChangeText] = React.useState('click to add reminder.')
return (
<View style={styles.container}>
<TextInput
style={{height: 40, borderColor: 'white', borderWidth: 0, color:'#595959', fontSize:20, marginHorizontal:5}}
onChangeText={text => onChangeText(text)}
value = {value}
/>
);
}
function HomeScreen({ navigation }) {
return (
<View style={styles.container}>
<Text style={styles.buttontext}>{text}</Text>
<TouchableOpacity
onPress={() => navigation.navigate('NewReminderScreen')}
style={styles.plusbutton}>
<Text style={styles.buttontext}>+</Text>
</TouchableOpacity>
</View>
);
}