mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Opacity in TouchableOpacity properly react to state change (#32956)
Summary: This PR fixes the opacity bug where it fails to properly react to state change. This PR resolves the issue detailed in https://github.com/facebook/react-native/issues/32476 ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [General] [Fixed] - Fixed opacity value in TouchableOpacity Pull Request resolved: https://github.com/facebook/react-native/pull/32956 Test Plan: The code I added in componentDidUpdate does solve the issue and passes all the test cases Reviewed By: ryancat Differential Revision: D33766718 Pulled By: cortinico fbshipit-source-id: 951bedf22619fc12e66156d0a6074cd8adf1d3eb
This commit is contained in:
committed by
Facebook GitHub Bot
parent
113f8257ce
commit
3eddc9abb7
@@ -260,7 +260,12 @@ class TouchableOpacity extends React.Component<Props, State> {
|
||||
|
||||
componentDidUpdate(prevProps: Props, prevState: State) {
|
||||
this.state.pressability.configure(this._createPressabilityConfig());
|
||||
if (this.props.disabled !== prevProps.disabled) {
|
||||
if (
|
||||
this.props.disabled !== prevProps.disabled ||
|
||||
(flattenStyle(prevProps.style)?.opacity !==
|
||||
flattenStyle(this.props.style)?.opacity) !==
|
||||
undefined
|
||||
) {
|
||||
this._opacityInactive(250);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user