Я заметил, что когда я пытаюсь что-то ввести в поле ввода текста, оно автоматически удаляется. Я сузился до проблемы, связанной с полем значения, и комментирование позволяет мне вводить текст, но я не уверен, в чем может быть проблема.
import React, { useState } from 'react';
import { StyleSheet, Text, View, TextInput, Button } from 'react-native';
export default function App() {
const [enteredGoal, setEnteredGoal] = useState('');
const goalInputHandler = (enteredText) => {
setEnteredGoal(enteredGoal);
};
const addGoalHandler = () => {
console.log(enteredGoal);
};
return (
<View style={styles.screen}>
<View style={styles.inputContainer}>
<TextInput
placeholder="Course Goal"
style={styles.input}
onChangeText={goalInputHandler}
value={enteredGoal}
/>
<Button title='Add' onPress={addGoalHandler} />
</View>
<View />
</View>
);
}