与React-Native ViewPager相关

时间:2018-06-13 10:42:01

标签: javascript react-native

"反应":" ^ 16.3.1" " react-native":" ^ 0.55.4"

在我的react-native项目中,我想使用ViewPager但不推荐使用它的库。是否有任何其他库与ViewPager具有相同的道具。

我的代码:

    <ViewPager
      ref={(viewpager) => {this.viewpager = viewpager}}
      style={{flex:1}}
      dataSource={this.state.dataSource}
      initialPage={index}
      renderPage={this._renderPage}
      renderPageIndicator={false}
      isLoop={true}
      easingFunc={Easing.ease}
      animation = {(animatedValue, toValue, gestureState) => {
        var velocity = Math.abs(gestureState.vx);
        var baseDuration = 50;
        var duration = (velocity > 1) ? 1/velocity * baseDuration : baseDuration;
        return Animated.timing(animatedValue,
        {
          toValue: toValue,
          duration: duration,
          easing: Easing.out(Easing.exp)
        });
      }}

    />

0 个答案:

没有答案