react-native - scrollToIndex 在 RTL FlatList React-Native 中不起作用
问题描述
我有 Horizontal FlatList,现在我将电话语言更改为阿拉伯语 (RTL)。scrollToIndex() 在 RTL 中不起作用,没有 RTL,它可以按预期正常工作。有什么建议么?
平面列表
<FlatList
style={myStyles.flatListStyle}
horizontal={true}
data={this.props.dataForFlatList}
renderItem={this.renderItem}
ref={(ref) => { this.flatListRef = ref; }}
keyExtractor={item => item.id.toString()} />
Press() 上的 renderItem 函数正在传递项目 ID
this.flatListRef.scrollToIndex({ animated: true, index: id }); // Working fine without RTL - NOT WORKING WITH RTL
提前致谢。
解决方案
如果您在渲染窗口之外滚动,则需要指定getItemLayout
道具
推荐阅读
- python - 逻辑回归的沙普利?
- scala - 如何在 spark 1.6 中显示带有标签的不匹配报告 - scala 除了函数?
- flutter - 如何在颤振中处理 100vh?
- angular - 代码是否在区域中运行,如果是,为什么以及如何运行?
- python - Python / ete3:将最密切相关的叶子定位到系统发育树中的特定物种
- gitlab - 自动关闭过时的 GitLab 合并请求
- vue.js - VueJS 动态添加表单组件
- html - 为什么我在 iFrame oEmbed 中的链接在 Wordpress 中不起作用?
- excel - VBA:在单元格值实际更改时运行“Worksheet_Change Function”,而不是在没有任何更改的情况下进入和退出编辑模式
- javascript - 模拟按键事件(纯js)