Необязательные анимации в Animated.sequence () - PullRequest
0 голосов
/ 11 апреля 2019

Есть ли способ по желанию сделать анимацию в Animated.sequence():

public state = {
  fadeValue: new Animated.Value(0),
  topValue: new Animated.Value(100)
}

public componentDidMount() {
    const { 
      fadeValue, 
      topValue,
    } = this.state;

    const {
      fade,
      top
    } = this.props

    Animated.sequence([
      // only if fade is true
      Animated.timing(
        fadeValue,
        {
          toValue: 1,
          duration: 1000,
        }
      ),
      // only if top is true
      Animated.timing(
        topValue,
        {
          toValue: 0,
          duration: 1000
        }
      )
    ]).start();
  }
...