From 61bd008ea03b33b1c2ee8b68dc5d47c6fbabda19 Mon Sep 17 00:00:00 2001 From: Eric Vicenti Date: Thu, 7 May 2015 18:53:41 -0700 Subject: [PATCH] [ReactNative] Fix TouchableOpacity crash when child props are missing --- Libraries/Components/Touchable/TouchableOpacity.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Libraries/Components/Touchable/TouchableOpacity.js b/Libraries/Components/Touchable/TouchableOpacity.js index 8e9a34146..5c673947f 100644 --- a/Libraries/Components/Touchable/TouchableOpacity.js +++ b/Libraries/Components/Touchable/TouchableOpacity.js @@ -106,7 +106,10 @@ var TouchableOpacity = React.createClass({ }, touchableHandleActivePressOut: function() { - var childStyle = flattenStyle(this.refs[CHILD_REF].props.style) || {}; + var childStyle = ( + this.refs[CHILD_REF].props && + flattenStyle(this.refs[CHILD_REF].props.style) + ) || {}; this.setOpacityTo(childStyle.opacity === undefined ? 1 : childStyle.opacity); this.props.onPressOut && this.props.onPressOut(); },