Chore: Migrate containers: Loading to Typescript (#3915)

This commit is contained in:
Reinaldo Neto 2022-03-18 12:02:04 -03:00 committed by GitHub
parent fae46f565b
commit 8af1d1ceb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 6 deletions

View File

@ -22,15 +22,20 @@ interface ILoadingProps {
theme?: string;
}
class Loading extends React.PureComponent<ILoadingProps, any> {
interface ILoadingState {
scale: Animated.Value;
opacity: Animated.Value;
}
class Loading extends React.PureComponent<ILoadingProps, ILoadingState> {
state = {
scale: new Animated.Value(1),
opacity: new Animated.Value(0)
};
private opacityAnimation: any;
private opacityAnimation?: Animated.CompositeAnimation;
private scaleAnimation: any;
private scaleAnimation?: Animated.CompositeAnimation;
componentDidMount() {
const { opacity, scale } = this.state;
@ -61,7 +66,7 @@ class Loading extends React.PureComponent<ILoadingProps, any> {
}
}
componentDidUpdate(prevProps: any) {
componentDidUpdate(prevProps: ILoadingProps) {
const { visible } = this.props;
if (visible && visible !== prevProps.visible) {
this.startAnimations();
@ -107,8 +112,7 @@ class Loading extends React.PureComponent<ILoadingProps, any> {
<Animated.View
style={[
{
// @ts-ignore
...StyleSheet.absoluteFill,
...StyleSheet.absoluteFillObject,
backgroundColor: themes[theme!].backdropColor,
opacity: opacityAnimation
}