Skip to content

Commit

Permalink
Merge pull request #10229 from Expensify/beaman-fixButtonOpacityProblem
Browse files Browse the repository at this point in the history
Fix button opacity problem when saving personal details
  • Loading branch information
Beamanator authored Aug 8, 2022
2 parents 82d14eb + b216e4d commit f6cb210
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions src/components/OpacityView.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class OpacityView extends React.Component {
constructor(props) {
super(props);
this.opacity = new Animated.Value(1);
this.undim = this.undim.bind(this);
}

componentDidUpdate(prevProps) {
Expand All @@ -33,14 +34,26 @@ class OpacityView extends React.Component {
}

if (prevProps.shouldDim && !this.props.shouldDim) {
Animated.timing(this.opacity, {
toValue: 1,
duration: 50,
useNativeDriver: true,
}).start();
this.undim();
}
}

undim() {
Animated.timing(this.opacity, {
toValue: 1,
duration: 50,
useNativeDriver: true,
}).start(({finished}) => {
// If animation doesn't finish because Animation.stop was called
// (e.g. because it was interrupted by a gesture or another animation),
// restart animation so we always make sure the component gets completely shown.
if (finished) {
return;
}
this.undim();
});
}

render() {
return (
<Animated.View
Expand Down

0 comments on commit f6cb210

Please sign in to comment.