diff --git a/Libraries/Components/Touchable/TouchableOpacity.js b/Libraries/Components/Touchable/TouchableOpacity.js index 8d3e53312ae0f6..40079f44538f00 100644 --- a/Libraries/Components/Touchable/TouchableOpacity.js +++ b/Libraries/Components/Touchable/TouchableOpacity.js @@ -77,7 +77,7 @@ var TouchableOpacity = React.createClass({ getInitialState: function() { return { ...this.touchableGetInitialState(), - anim: new Animated.Value(1), + anim: new Animated.Value(this._getChildStyleOpacityWithDefault()), }; }, @@ -156,9 +156,8 @@ var TouchableOpacity = React.createClass({ }, _opacityInactive: function(duration: number) { - var childStyle = flattenStyle(this.props.style) || {}; this.setOpacityTo( - childStyle.opacity === undefined ? 1 : childStyle.opacity, + this._getChildStyleOpacityWithDefault(), duration ); }, @@ -166,6 +165,11 @@ var TouchableOpacity = React.createClass({ _opacityFocused: function() { this.setOpacityTo(this.props.focusedOpacity); }, + + _getChildStyleOpacityWithDefault: function() { + var childStyle = flattenStyle(this.props.style) || {}; + return childStyle.opacity == undefined ? 1 : childStyle.opacity; + }, render: function() { return (