首页 > 解决方案 > flatlist 用阿拉伯语口吃

问题描述

我正在使用 Flatlist 水平显示产品。当我在英语模式 RTL 下使用应用程序时,Flatlist 工作正常,在切换阿拉伯语 LTR 后,Flatlist 口吃,拖动后再次出现,我开始拖动 Flatlist 项目。

<ScrollView>
  <FlatList
    contentContainerStyle={styles.flatlist}
    data={list}
    keyExtractor={(item) => `post__${item.id}`}
    renderItem={this.renderItem}
    showsHorizontalScrollIndicator={false}
    horizontal
    pagingEnabled={isPaging}
    onEndReached={false && this._nextPosts}
  />
</ScrollView>

标签: react-nativeexporeact-native-flatlist

解决方案


<ScrollView
  horizontal
  style={{ flexDirection: I18nManager.isRTL ? 'row-reverse' : 'row' }}
>
  <FlatList
    contentContainerStyle={styles.flatlist}
    data={list}
    keyExtractor={(item) => `post__${item.id}`}
    renderItem={this.renderItem}
    showsHorizontalScrollIndicator={false}
    horizontal
    pagingEnabled={isPaging}
    onEndReached={false && this._nextPosts}
  />
</ScrollView>

我发现解决方案需要添加

horizontal
style={{ flexDirection: I18nManager.isRTL ? 'row-reverse' : 'row' }}

滚动视图中的行。

https://github.com/facebook/react-native/issues/11960#issuecomment-278918568


推荐阅读