Skip to content

Commit 3b2469d

Browse files
committed
Update opacity when disabled prop is changed
fixes #17105 If you render ``` <TouchableOpacity disabled={true} style={{opacity: 0.5}} > ... </TouchableOpacity> ``` and then ``` <TouchableOpacity disabled={false} style={{opacity: 1}} > ... </TouchableOpacity> ``` The content of `TouchableOpacity` will still have opacity = 0.5 because real opacity is controlled by animated property which should be properly updated when `disabled` prop changes.
1 parent f71f4e7 commit 3b2469d

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

Libraries/Components/Touchable/TouchableOpacity.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,12 @@ var TouchableOpacity = createReactClass({
162162
ensurePositiveDelayProps(nextProps);
163163
},
164164

165+
componentDidUpdate: function(prevProps, prevState) {
166+
if (this.props.disabled !== prevProps.disabled) {
167+
this._opacityInactive(250);
168+
}
169+
},
170+
165171
/**
166172
* Animate the touchable to a new opacity.
167173
*/

0 commit comments

Comments
 (0)