react-native-windows
react-native-windows copied to clipboard
Touchable* doesn't fire onFocus event
Repro steps
logOnFocus = () => {
console.log("focused");
};
<TouchableWithoutFeedback accessible={true} onFocus={logOnFocus}>
<View>
<Text>Focus this!</Text>
</View>
</TouchableWithoutFeedback>
Focus the TouchableWithoutFeedback (e.g. using tab, or controller on Xbox)
Expected behavior
logOnFocus is called and console log appears
Observed behavior
logOnFocus is never called.
I was able to work around this issue by adding focus listeners to the View itself, and adding the not-well-documented acceptsKeyboardFocus:
<TouchableWithoutFeedback>
<View acceptsKeyboardFocus={true} onFocus={logOnFocus}>
<Text>Focus this!</Text>
</View>
</TouchableWithoutFeedback>
The primary issue here is being tracked through #2107. Closing this to track through that issue.