I’m not able to find this anywhere. I have code like this:
const Component = () => {
const handleKeyPress = (event) => {
const key = event.nativeEvent.key.toLowerCase();
console.log({key});
};
return (
<TextInput
onKeyPress={handleKeyPress}
...
/>
)
}
What is the type of event
parameter? In ReactJS I would use KeyboardEvent<HTMLInputElement>
what is the equivalent in React-Native?
2
Answers
Try using NativeSyntheticEvent and TextInputKeyPressEventData
I hope this would help you.