react-native - React Native Flexwrap 中断 ScrollView 不会滚动
问题描述
我试图让我的物品水平包装,他们确实做到了。只有当我添加 flexWrap: "wrap" 时,滚动视图才会决定根本不滚动。
<ScrollView contentContainerStyle={{ flexDirection: 'row', flexWrap: 'wrap', alignItems: 'flex-
start',}}>
<FrameComponent />
<FrameComponent />
<FrameComponent />
<FrameComponent />
<FrameComponent />
...
</ScrollView>
使用 FrameComponent 渲染
<View>
<Text>
...
</Text>
<View>
框架组件的样式是一些简单的 flex 和 margin 东西。
这与所有其他设置一起滚动,但是一旦我添加了 flexWrap,它就会变得很糟糕。
谢谢。
解决方案
将水平 = {true} 属性传递给您的 ScrollView 并删除 flex wrap 和 flexDirection 样式。
<ScrollView horizontal = {true}>
...
</ScrollView>
推荐阅读
- android - 在 Android 屏幕上获取文本内容——即使它不可见
- python-3.x - 开发用于下载和上传数据到 XNAT 的 Python Rest API
- database - 实现三种类型的用户 - Laravel
- python - TemplateDoesNotExist 用于 detail.html,但适用于 index.html(Django 教程第 3 部分)
- javascript - Discord.js PM 仅适用于 1 人
- python - Django-Q 和 request.POST 数据
- android - 带有 OnConflictStrategy.REPLACE 的 Android Room 自动时间戳
- oauth-2.0 - Azure AD 仅生成用于 Microsoft Graph 的无效访问令牌
- amazon-web-services - 用于内部 ALB 的 AWS Synthetics Canary
- azure-devops - 关闭新的 ADO 格式