NativeBase 选项卡强制 RTL 问题 - 修复

2023-12-25

当我执行forceRtl 时,我遇到了本机基本选项卡的问题。一切正常,但只有本机基础在初始加载时不显示任何内容。

所以我有一个临时解决方案


在native-base/src/basic/Tabs/index.js中

  import { I18nManager } from "react-native"
       renderScrollableContent() {
        const scenes = this._composeScenes();
        const isRTLAndroid = I18nManager.isRTL;

        return (
          <ScrollView
            horizontal
            pagingEnabled
            automaticallyAdjustContentInsets={false}
            keyboardShouldPersistTaps="handled"
            contentOffset={{
              x: this.props.initialPage * this.state.containerWidth
            }}
            ref={scrollView => {
              this.scrollView = scrollView;
            }}
            onScroll={e => {
              const offsetX = e.nativeEvent.contentOffset.x;
              this._updateScrollValue(offsetX / this.state.containerWidth);
            }}
            onMomentumScrollBegin={this._onMomentumScrollBeginAndEnd}
            onMomentumScrollEnd={this._onMomentumScrollBeginAndEnd}
            scrollEventThrottle={16}
            scrollsToTop={false}
            showsHorizontalScrollIndicator={false}
            scrollEnabled={!this.props.locked}
            directionalLockEnabled
            alwaysBounceVertical={false}
            keyboardDismissMode="on-drag"
            {...this.props.contentProps}
          >
          /*******************************************
            If is isRtl do reverse else keep as it is
          ********************************************/
            {isRTLAndroid?scenes.reverse():scenes}
          </ScrollView>
        );
        },

不要忘记更改 package.json 中的 "main": "src/index.js"

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

NativeBase 选项卡强制 RTL 问题 - 修复 的相关文章

随机推荐