constructor(props) { super(props); this.state = { //这是动画效果 bounceValue: new Animated.Value(1) //初始值 }; } componentDidMount() { // 动画结束 Animated.timing( this.state.bounceValue, { toValue: 1.2, duration: 1000 } //结束值 ).start(); } ・・・ render() { return ( <Animated.Image style={{ width: width, height: height, transform: [{ scale: this.state.bounceValue }] //绑定到样式属性 }} source={splashImg} /> ); }
文章来源: RN 组件 Animated