react native Animated简单使用方法

import { 
  Animated,
} from 'react-native';

constructor(props){
        super(props)
        this.state={ 
          fadeInOpacity: new Animated.Value(0), // 初始值 
        }
  }
componentDidMount(){ 
  Animated.timing(this.state.fadeInOpacity, {
      toValue: 1, // 目标值
    }).start();
  }
render(){
  return(
  <Animated.View style={{
     opacity: this.state.fadeInOpacity,justifyContent:'center',alignItems:'center',
                      backgroundColor:"#333",width:common.deviceWidth,height:common.deviceWidth*0.055}}>
                  <Text style={{color:"white"}}>123</Text>
    </Animated.View>
  )  
}

  

猜你喜欢

转载自www.cnblogs.com/lgp142332/p/9935266.html