[ReactNative] Fix TouchableOpacity crash when child props are missing

This commit is contained in:
Eric Vicenti 2015-05-07 18:53:41 -07:00
Родитель c76fb40ec4
Коммит 61bd008ea0
1 изменённых файлов: 4 добавлений и 1 удалений

Просмотреть файл

@ -106,7 +106,10 @@ var TouchableOpacity = React.createClass({
}, },
touchableHandleActivePressOut: function() { 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.setOpacityTo(childStyle.opacity === undefined ? 1 : childStyle.opacity);
this.props.onPressOut && this.props.onPressOut(); this.props.onPressOut && this.props.onPressOut();
}, },