Trying my hand at developing an androidTV application using react-native and following the provided documents. However, despite my efforts, it seems like onFocus and onBlur functions are not working correctly for me. Here is the code snippet I am working with:
const App = () => {
return (
<View>
<TouchableHighlight
hasTVPreferredFocus={true}
accessible={true}
onFocus={() => alert('focus')}
onBlur={() => alert('blur')}
onPress={() => alert('press')}>
<Text>This is a text</Text>
</TouchableHighlight>
<Button title="title" />
</View>
);
};
In addition to this, I have also included hasTVPreferredFocus
and accessible
properties to ensure I didn't overlook anything.