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

React Native FlatList隐藏滚动条失效 根源为debug={true}

FlatList设置showsVerticalScrollIndicator={false}后垂直滚动条仍可见的解决方法

问题详情

  • React Native版本:0.74.5
  • 核心问题:函数组件内的FlatList已配置showsVerticalScrollIndicator={false},但垂直滚动条始终保持可见
  • 组件层级(无外层ScrollView包裹):
...
Suspense
Section
Anonymous
View
FlatList <----- 问题FlatList
ForwardRef
VirtualizedList
View
VirtualizedListContextprovider
VirtualizedListContext.provider 
ScrollView
ScrollView
...
  • 相关代码片段:
const Section = () => {
    ...
    return data && <SafeAreaView 
                ...
            <FlatList
            ...
            data={data}
            horizontal={false}
            scrollEnabled = {true}
            showsVerticalScrollIndicator={false}
            ...
            />
}

排查结论(2024年11月16日更新)

经定位,该问题由**debug={true}**配置导致。

解决方案

将debug属性设置为false,即可正常隐藏FlatList的垂直滚动条。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.16 05:57:13