const [text, setText] = React.useState("");
const onChangeText = (event) => setText(event); // event는 value 값
const addTodo = () => {
alert(text)
}
return (
<View>
<TextInput
onSubmitEditing={addTodo}
onChangeText={onChangeText}
value={text}
returnKeyType="previous"
/>
</View>
);
▶ Refer to https://reactnative.dev/docs/textinput#returnkeytype
▶ Refer to https://reactnative.dev/docs/textinput#onchangetext
▶ Refer to https://reactnative.dev/docs/textinput#onsubmitediting