Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/458.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 强制RTL的NativeBase选项卡问题-修复_Javascript_React Native_Native Base - Fatal编程技术网

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

Javascript 强制RTL的NativeBase选项卡问题-修复,javascript,react-native,native-base,Javascript,React Native,Native Base,当我使用forceRtl时,我对本机基本选项卡有问题。一切都正常,但只有原生基在初始加载时不显示任何内容 所以我在native base/src/basic/Tabs/index.js中有一个临时解决方案 import { I18nManager } from "react-native" renderScrollableContent() { const scenes = this._composeScenes(); const isRTLAn

当我使用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>
        );
        },
从“react native”导入{I18nManager}
renderScrollableContent(){
const scenes=这个;
const isRTLAndroid=I18nManager.isRTL;
返回(
{
this.scrollView=滚动视图;
}}
onScroll={e=>{
const offsetX=e.nativeEvent.contentOffset.x;
this.\u updateScrollValue(offsetX/this.state.containerWidth);
}}
onMomentumScrollBegin={this.\u onMomentumScrollBeginAnd}
onMomentumScrollEnd={this.\u onMomentumScrollBeginAnd}
scrollEventThrottle={16}
scrollsToTop={false}
showshorizontalscrolindicator={false}
scrollEnabled={!this.props.locked}
方向锁定启用
alwaysBounceVertical={false}
keyboardDismissMode=“拖动时”
{…this.props.contentProps}
>
/*******************************************
如果是isRtl,则执行相反操作,否则保持原样
********************************************/
{isRTLAndroid?scenes.reverse():scenes}
);
},

别忘了更改“main”:“src/index.js”在package.json中

它真的很有用,我可以更改本机base/src/basic/Tabs/index.js,但不需要更改什么?