Javascript 强制RTL的NativeBase选项卡问题-修复
当我使用forceRtl时,我对本机基本选项卡有问题。一切都正常,但只有原生基在初始加载时不显示任何内容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
所以我在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,但不需要更改什么?