//@ts-nocheck import React, { Component } from 'react' import { View, Text, StyleSheet, ActivityIndicator, Animated, Easing } from 'react-native'; import LottieView from 'lottie-react-native'; import { px2dp, onePx, colors } from './../../utils'; interface Props { iconStyle?: object }; export default class KitLoadingToast extends Component { constructor(props: Props) { super(props); this.state = { text: '' }; this.bgColor = new Animated.Value(0); this.active = false; this.delayHide = null; }; componentWillUnmount() { this.delayHide && clearTimeout(this.delayHide); this.setState = (state, callback) => { return; } } show = () => { this.lottieRef && this.lottieRef.play(); this.toast && this.toast.setNativeProps({ style: { height: '100%', width: '100%', display: 'flex', zIndex: 9999999999, elevation: 2 } }); } hide = () => { this.active = false; this.delayHide = setTimeout(() => { this.lottieRef && this.lottieRef.reset && this.lottieRef.reset(); this.lottieRef && this.lottieRef.pause && this.lottieRef.pause(); this.toast && this.toast.setNativeProps({ style: { height: 0, width: 0, display: 'none', zIndex: -1, elevation: 0 } }) }, 350); } render() { const { iconStyle } = this.props return ( this.toast = c} style={styles.toastContainer}> this.lottieRef = c} style={[{ width: px2dp(120), height: px2dp(120) }, iconStyle]} source={require('./../../animated/loading-toast.json')} autoPlay={false} speed={1.36} /> ) } } const styles = StyleSheet.create({ toastContainer: { position: 'absolute', width: '100%', height: '100%', display: "none", top: 0, left: 0, right: 0, bottom: 0, height: 0, justifyContent: 'center', alignItems: 'center', zIndex: -1, overflow: 'hidden', backgroundColor: 'rgba(0,0,0,0.36)', }, toastContent: { position: 'relative', width: px2dp(106), height: px2dp(106), borderRadius: px2dp(10), justifyContent: 'center', alignItems: 'center', overflow: 'hidden', }, toastInnerContent: { position: 'absolute', top: 0, left: 0, width: '100%', height: '100%', justifyContent: 'center', alignItems: 'center', overflow: 'hidden', zIndex: 999 }, toastBackGround: { position: 'absolute', top: 0, left: 0, width: '100%', height: '100%', // backgroundColor: '#fff', zIndex: 998 }, toastHeader: { width: '100%', justifyContent: 'center', alignItems: 'center', // backgroundColor: '#999', paddingTop: px2dp(18) }, toastBody: { width: '100%', justifyContent: 'flex-start', alignItems: 'center', paddingHorizontal: px2dp(24), paddingTop: px2dp(12), paddingBottom: px2dp(24) // backgroundColor: "red" }, loadingText: { color: '#fff', fontSize: 13, marginTop: px2dp(10), maxWidth: px2dp(96), textAlign: 'center' }, toastFooter: { width: '100%', height: px2dp(52), borderTopColor: '#eee', borderTopWidth: onePx, justifyContent: 'center', alignItems: 'center' } })