mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-01 22:41:28 +08:00
Summary:
Simple fix to avoid thoses flow error when using Touchables with onFocus & onBlur.
```
Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ src/components/HomeMenu/MenuItem.js:32:8
Cannot create TouchableOpacity element because property onFocus is missing in object type [1] but exists in props [2].
src/components/HomeMenu/MenuItem.js
29│ render() {
30│ const { text, style } = this.props
31│ return (
[2] 32│ <TouchableOpacity
33│ hasTVPreferredFocus
34│ style={style.item}
35│ onFocus={() => this.onFocus()}
36│ onPress={() => Alert.alert(`You pressed ${text}`)}
37│ >
38│ <ImageBackground source={separator} style={style.itemBackground}>
39│ <Text style={style.text}>{text}</Text>
40│ </ImageBackground>
41│ </TouchableOpacity>
42│ )
43│ }
44│ }
node_modules/react-native/Libraries/Components/Touchable/TouchableOpacity.js
[1] 286│ }): any): React.ComponentType<Props>);
```
Pull Request resolved: https://github.com/facebook/react-native/pull/21462
Differential Revision: D10179260
Pulled By: TheSavior
fbshipit-source-id: e6c5d1136bdde36c8bcbd4df8897a390dcba8e82