我试图动画添加到我的反应本机应用程序。不过,这并不流畅播放Android和IOS我应该做些什么来解决这个问题
我已经尝试过用动画的组件运行的动画。我的反应原生版本是“0.57.8”这里是我的代码:
export default class MainPage extends Component{
constructor(props) {
super(props)
this.moveAnimation = new Animated.ValueXY({ x: 0, y: 0})
}
_openCardContainer = () => {
Animated.spring(this.moveAnimation, {
toValue: {x:0, y: 0},
speed: 5,
}).start()
}
render() {
return(
<Animated.View style={this.moveAnimation.getLayout()}>
<EditorChoiceContainer/>
</Animated.View>
)
}
}
此代码工作正常,但并不顺利,非常laggy
请帮我解决这个问题
Animated.spring(this.moveAnimation, {
toValue: {x:0, y: 0},
speed: 5,
useNativeDriver: true, // <-- Add this
}).start()