react / react/react-native

ScrollView does not work inside position: absolute on Android.

未关闭
#38,730 25 条评论 9 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Component: ScrollView Issue: Author Provided Repro Needs: Triage :mag: Newer Patch Available Platform: Android
主要语言
C++
星标
127k
派生
25.3k
平均合并
1 天 23 小时
30 天内合并 PR
4

描述

Description

ScrollView does not work inside position: absolute on Android. Scrolling works on iOS.

React Native Version

0.71.11

Output of npx react-native info

System:
OS: macOS 12.6.4
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 131.35 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.14.0 - ~/.nvm/versions/node/v16.14.0/bin/node
Yarn: 1.22.17 - /usr/local/bin/yarn
npm: 8.5.0 - ~/.nvm/versions/node/v16.14.0/bin/npm
Watchman: 2023.04.03.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.12.1 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
Android SDK: Not Found
IDEs:
Android Studio: 2022.1 AI-221.6008.13.2211.9514443
Xcode: 14.2/14C18 - /usr/bin/xcodebuild
Languages:
Java: 19.0.2 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.2.0 => 18.2.0
react-native: 0.71.11 => 0.71.11
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Steps to reproduce

ScrollView does not work inside position: absolute on Android. Scrolling works on iOS.

 <View style={{ height: 300, paddingTop: 100 }}>
       <View
         style={{
           position: 'relative',
           height: 40,
           borderColor: 'red',
           borderWidth: 1,
         }}>
         <View
           style={{
             height: 60,
             position: 'absolute',
             width: '100%',
             borderColor: 'green',
             borderWidth: 1,
             zIndex: 1000,
             elevation: 1000,
           }}>
           <ScrollView>
             <Text>1</Text>
             <Text>2</Text>
             <Text>3</Text>
             <Text>4</Text>
             <Text>5</Text>
             <Text>6</Text>
           </ScrollView>
         </View>
       </View>
     </View>
Snack, screenshot, or link to a repository

https://snack.expo.dev/3enX3_UHW

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从链接的 Snack 复现开始,在 Android 上运行它,然后将 ScrollView 的行为与 iOS 进行比较。跟踪 React Native 如何处理绝对定位的 View 中的 ScrollView 子元素,并找出 Android 特有的故障。当示例在 Android 上能够正常滚动,且不会导致正常工作的 iOS 行为回归时,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
android, react-native
领域
mobile
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。