Skip to content

Commit 00055f8

Browse files
sammy-SCfacebook-github-bot
authored andcommitted
reset animation state in TouchableOpacity and TouchableBounce (#44182)
Summary: Pull Request resolved: #44182 ## Changelog: [iOS] [Fixed] - Fixed stale state on TouchableOpacity and TouchableBounce When TouchableOpacity and TouchableBounce are unmounted, we need to reset their state. This includes animation state. If we don't do that, view is unmounted on the mounting layer and animation will not be applied. This leaves view in undefined state. In TouchableOpacity, it is view with reduced opacity. TouchableBounce that is view with applied transform. This was reported in #44044 Reviewed By: rubennorte, cipolleschi Differential Revision: D56416571 fbshipit-source-id: 01214ec8a5e07c80a609e082b955a30305ad8396
1 parent d59de54 commit 00055f8

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

packages/react-native/Libraries/Components/Touchable/TouchableBounce.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ class TouchableBounce extends React.Component<Props, State> {
209209

210210
componentWillUnmount(): void {
211211
this.state.pressability.reset();
212+
this.state.scale.resetAnimation();
212213
}
213214
}
214215

packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ class TouchableOpacity extends React.Component<Props, State> {
320320

321321
componentWillUnmount(): void {
322322
this.state.pressability.reset();
323+
this.state.anim.resetAnimation();
323324
}
324325
}
325326

0 commit comments

Comments
 (0)