javascript - 强制 RTL 的 NativeBase 选项卡问题 - 修复
问题描述
当我执行 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"
推荐阅读
- arrays - 基于pvalues在SAS中添加上标
- android - 在 Android 上安装 Chilkat
- javascript - 调整 Fabric Rect 的大小而不调整文本框的大小
- regex - 具有多个组的正则表达式,这些组在正则表达式组内对逻辑 AND 使用前瞻
- python - datetime.strptime 奇怪的行为
- elm - 如何使 Elm-UI 元素响应按“Enter”
- r - 在 R 中进行组合
- java - Jacoco:jacocoTestResport 工作正常,但 jacocoTestCoverageVerification 始终显示 0 覆盖率
- graphql - graphql 模块通过嵌套扩展类型定义
- protocol-buffers - 关于默认值,如何在 GO 和 JS 之间进行标准序列化输出?