【问题标题】:React native tabview configure sliding speedReact Native tabview 配置滑动速度
【发布时间】:2017-08-08 20:21:44
【问题描述】:

我正在使用 react native 选项卡视图https://github.com/react-native-community/react-native-tab-view 来拥有类似轮播的东西。它似乎工作正常,但滑动过渡对我来说太快了。我该如何配置它?文档说有一个 configureTransition 回调应该返回转换配置,但没有说明该配置是什么以及它应该是什么样子:

 configureTransition - optional callback which returns a configuration for 
 the transition, return null to disable animation

请帮我看看如何配置转换速度。

【问题讨论】:

    标签: animation react-native transition tabview


    【解决方案1】:

    转换规范在this 文件中定义。

      import { Animated } from 'react-native';
    
      _configureTransition = () => {
        return {
          timing: Animated.spring,
          tension: 300,
          friction: 100,
        };
      }
    
      render() {
        return (
          <TabViewAnimated
            ....
            configureTransition={this._configureTransition}
          />
        );
      }
    

    【讨论】:

    • 感谢您的回复。我试过{timig: Animated.timing, duration: 900, easing: Easing.inOut(Easing.ease)},但没有效果。我究竟做错了什么?如何实现更慢的滑动?
    • @TristanTzara 你需要使用TabViewPagerPan 才能使用它。为此使用 renderPager 属性 (props =&gt; &lt;TabViewPagerPan {...props} /&gt;)
    猜你喜欢
    • 2017-09-07
    • 1970-01-01
    • 2021-01-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多