Skip to content

Commit

Permalink
reset animation state in TouchableOpacity and TouchableBounce (#44182)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
sammy-SC authored and cipolleschi committed May 1, 2024
1 parent 0a4d973 commit 165cabb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ class TouchableBounce extends React.Component<Props, State> {

componentWillUnmount(): void {
this.state.pressability.reset();
this.state.scale.resetAnimation();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ class TouchableOpacity extends React.Component<Props, State> {

componentWillUnmount(): void {
this.state.pressability.reset();
this.state.anim.resetAnimation();
}
}

Expand Down

0 comments on commit 165cabb

Please sign in to comment.