'React Native Textinput wont call onchange on iOS
I have a problem with my react-native app. I have simple input for the note, it works as expected on Android, but on iOS onChange/onChangeText method is never called. It is weird because i see correct value in input, but if I console.log in onChange method, its never called. What am I missing here?
const [noteEdit, _setNoteEdit] = useState(note)
const noteRef = React.useRef(noteEdit);
const setNoteEdit = event => {
const note= event.nativeEvent.text;
_setNoteEdit(note);
noteRef.current = note;
}
<TextInput multiline={true}
value={noteEdit} onChange={setNoteEdit} autoCorrect={false} />
Solution 1:[1]
you need to try this below hope it's working
const [noteEdit, _setNoteEdit] = useState('')
<TextInput multiline={true}
value={noteEdit} onChangeText={(text)=>_setNoteEdit(text)} autoCorrect={false} />
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
