2016-07-26 6 views

答えて

4

まず第二は、純粋なJavaScriptであり、より効率的です。もう一つの方法は、ここのように、独自の方法でそれを実装することです:https://github.com/facebook/react-native/issues/9280

それはあなたがアニメーションとレイアウトアニメーションが反応し、ネイティブには提供してチェックアウトすることができ、この

export default class Animation extends Component { 
    constructor(props) { 
     super(props); 
     this.images = [ 
      require('./img_01.png'), 
      require('./img_02.png'), 
      require('./img_03.png'), 
     ]; 
     this.next = this.next.bind(this); 
     this.state = {index: 0}; 
    } 

    componentDidMount() { 
     this.next(); 
    } 

    next() { 
     setTimeout(() => { 
      this.setState({index: (this.state.index+1)%3}); 
      this.next(); 
     }, 300); 
    } 

    render() { 
     return (
      <Image 
       source={this.images[this.state.index]} 
       style={styles.image} 
      /> 
     ) 
    } 
} 
関連する問題