import * as React from 'react' import { Animated, Easing, StyleSheet } from 'react-native' interface LoadingViewState { rotateValue: Animated.Value } // eslint-disable-next-line @typescript-eslint/no-empty-interface interface LoadingViewProps { } const styles = StyleSheet.create({ toastLoading: { width: 25, height: 25 } }) class LoadingView extends React.Component { constructor (props: LoadingViewProps) { super(props) this.state = { rotateValue: new Animated.Value(0) // 初始值 } } componentDidMount (): void { this.startAnimation() } startAnimation (): void { this.state.rotateValue.setValue(0) Animated.timing(this.state.rotateValue, { toValue: 1, duration: 2000, easing: Easing.linear, useNativeDriver: true }).start(() => this.startAnimation()) } render () { return ( ) } } export default LoadingView