From fdfe4220e0af23e4ae18ae4714b7cc3d98529dcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Rit?= Date: Wed, 3 Oct 2018 13:55:56 -0700 Subject: [PATCH] Update flow Props declaration in TouchableWithoutFeedBack for onFocus and onBlur (#21462) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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│ this.onFocus()} 36│ onPress={() => Alert.alert(`You pressed ${text}`)} 37│ > 38│ 39│ {text} 40│ 41│ 42│ ) 43│ } 44│ } node_modules/react-native/Libraries/Components/Touchable/TouchableOpacity.js [1] 286│ }): any): React.ComponentType); ``` Pull Request resolved: https://github.com/facebook/react-native/pull/21462 Differential Revision: D10179260 Pulled By: TheSavior fbshipit-source-id: e6c5d1136bdde36c8bcbd4df8897a390dcba8e82 --- Libraries/Components/Touchable/TouchableWithoutFeedback.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Libraries/Components/Touchable/TouchableWithoutFeedback.js b/Libraries/Components/Touchable/TouchableWithoutFeedback.js index 0b1dc3843c6..3a80684c672 100755 --- a/Libraries/Components/Touchable/TouchableWithoutFeedback.js +++ b/Libraries/Components/Touchable/TouchableWithoutFeedback.js @@ -59,6 +59,8 @@ export type Props = $ReadOnly<{| disabled?: ?boolean, hitSlop?: ?EdgeInsetsProp, nativeID?: ?string, + onBlur?: ?Function, + onFocus?: ?Function, onLayout?: ?Function, onLongPress?: ?Function, onPress?: ?Function,