Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix button opacity problem when saving personal details #10229

Merged
merged 3 commits into from
Aug 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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