Skip to content

Commit

Permalink
Chore: Migrate containers: Loading to Typescript (RocketChat#3915)
Browse files Browse the repository at this point in the history
  • Loading branch information
reinaldonetof authored Mar 18, 2022
1 parent 0f29dec commit cf19b7d
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions app/containers/Loading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit cf19b7d

Please sign in to comment.