Chore: Migrate containers: Loading to Typescript (#3915)
This commit is contained in:
parent
fae46f565b
commit
8af1d1ceb5
|
@ -22,15 +22,20 @@ interface ILoadingProps {
|
||||||
theme?: string;
|
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 = {
|
state = {
|
||||||
scale: new Animated.Value(1),
|
scale: new Animated.Value(1),
|
||||||
opacity: new Animated.Value(0)
|
opacity: new Animated.Value(0)
|
||||||
};
|
};
|
||||||
|
|
||||||
private opacityAnimation: any;
|
private opacityAnimation?: Animated.CompositeAnimation;
|
||||||
|
|
||||||
private scaleAnimation: any;
|
private scaleAnimation?: Animated.CompositeAnimation;
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const { opacity, scale } = this.state;
|
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;
|
const { visible } = this.props;
|
||||||
if (visible && visible !== prevProps.visible) {
|
if (visible && visible !== prevProps.visible) {
|
||||||
this.startAnimations();
|
this.startAnimations();
|
||||||
|
@ -107,8 +112,7 @@ class Loading extends React.PureComponent<ILoadingProps, any> {
|
||||||
<Animated.View
|
<Animated.View
|
||||||
style={[
|
style={[
|
||||||
{
|
{
|
||||||
// @ts-ignore
|
...StyleSheet.absoluteFillObject,
|
||||||
...StyleSheet.absoluteFill,
|
|
||||||
backgroundColor: themes[theme!].backdropColor,
|
backgroundColor: themes[theme!].backdropColor,
|
||||||
opacity: opacityAnimation
|
opacity: opacityAnimation
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue