import React, {Component} from “react”;
import {
Animated,
Easing,
StyleSheet,
ScrollView,
View
} from “react-native”;
import actionIcon from ‘…/assets/images/img.png’
export default class Index extends Component {
constructor(props) {
super(props)
this.state = {
spinValue: new Animated.Value(0),
};
}
//旋转方法
spin = () => {
this.state.spinValue.setValue(0)
const aniMotion = Animated.timing(this.state.spinValue, {
toValue: 1,
duration: 800,
easing: Easing.linear,
useNativeDriver: true
})
// 循环执行这个动画
Animated.loop(aniMotion).start()
}
async componentDidMount() {
this.spin()
}
render() {
let {spinValue} = this.state
const spin = spinValue.interpolate({
inputRange: [0, 1],//输入值
outputRange: ['0deg', '360deg'] //输出值
})
return (
<ScrollView style={styles.pageStyle}&g