You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

React Native Web配合React Navigation时FlatList/ScrollView无法滚动怎么办

React Navigation Stack页面React Native Web端滚动失效修复方案

使用React Navigation Stack推入带有FlatList的页面时,会出现React Native Web端滚动功能失效的问题。

以下两种常见解决方案经测试无效:

  • 为父级View添加flex属性style={{flex: 1}}
  • 将FlatList替换为ScrollView

有效修复方案

在React Navigation栈导航器的screenOptions配置中为cardStyle添加flex属性即可解决,参考配置如下:

<Stack.Navigator mode="card" screenOptions={{ cardStyle: { flex: 1 } }}>
  <Stack.Screen name="MyScreen" component={MyScreen} />
</Stack.Navigator>

内容的提问来源于stack exchange,提问作者mirkokiefer

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.02 08:15:04