react-native - 材料底部选项卡上的 ScrollView 不起作用
问题描述
当前行为
我正在创建这样的选项卡(注意:主页是 StackNavigator 屏幕):
ProfileTab 以这种方式呈现(项目是输入数组):
return <ScrollView contentContainerStyle={{flex: 1, backgroundColor: Colors.primaryShade3,
paddingTop: Sizes.paddingTop}}>
<View style={{flexDirection: "row", alignItems: "center", marginBottom: 50}}>
<Image source={{uri: RNStorage.userProfile.user.photo}}
style={{marginRight: 20, resizeMode: "contain", width: 70, height: 70, borderRadius: 50}}/>
<Text style={{color: Colors.white, fontSize: Sizes.h2}}>
Bem vindo, {RNStorage.userProfile.user.givenName}
</Text>
</View>
{items}
</ScrollView>
所有输入都遵循以下结构:
目前有这种行为(不滚动):
预期行为
滚动应该正常工作。我还使用 react-native-gesture-handler 的 ScrollView 进行了测试,但它也不起作用。
解决方案
这与材料底部选项卡无关。
您需要flex: 1
从contentContainerStyle
. 否则,您的视图将填充可用的可滚动区域并且不可滚动。
推荐阅读
- sql - 根据另一列的值查询该列
- c++ - 如何在同一个 MainWindow(或类似窗口)中制作两个不同的 QML 层和一个 QGraphicScene,以便 QML?
- c - 重新分配麻烦
- python - 是否可以将 dictview 对象指定为 Python 中的输入提示?
- javascript - API 不会返回数据
- r - 将矩阵与 tidyverse 相乘
- mysql - 在 MySQL 上按条件进行唯一连接
- sql - 使用使用 Excel 标记的 SQL Server 生成 XML
- php - php - 将数据插入 MSSQL
- python - 使用 Cpython 运行时,python 程序如何使用多个内核?