react / react/react-native

[Android] `ScrollView` shows top margin on top of the content when reaching the end

未关闭
#40,858 0 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

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

描述

Description

When having a ScrollView with overflow: 'visible' and some marginTop, this margin is shown on top of the ScrollView content when the end of the ScrollView is reached.

I have been able to reproduce this on a Pixel 6 running Android 13 and Android 14, and on an emulator running Android 12.
It works fine on Android 11.

Demo

https://github.com/facebook/react-native/assets/6463569/fdbf5012-2564-4c7e-aaa1-9bd4111d779b

React Native Version

0.72.5

Output of npx react-native info
System:
  OS: macOS 13.5
  CPU: (10) arm64 Apple M1 Pro
  Memory: 98.53 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 16.20.2
    path: ~/.nvm/versions/node/v16.20.2/bin/node
  Yarn:
    version: 1.22.19
    path: /opt/homebrew/bin/yarn
  npm:
    version: 8.19.4
    path: ~/.nvm/versions/node/v16.20.2/bin/npm
  Watchman:
    version: 2023.07.10.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods: Not Found
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 22.4
      - iOS 16.4
      - macOS 13.3
      - tvOS 16.4
      - watchOS 9.4
  Android SDK: Not Found
IDEs:
  Android Studio: 2022.2 AI-222.4459.24.2221.10121639
  Xcode:
    version: 14.3.1/14E300c
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 11.0.19
    path: /usr/bin/javac
  Ruby:
    version: 2.7.5
    path: /Users/aitorcubelestorres/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.5
    wanted: 0.72.5
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found
Steps to reproduce
  1. Create a new screen with a ScrollView.
  2. Fill it with enough content so that it is scrollable.
  3. Apply some marginTop to the ScrollView, and set overflow: 'visible'.
  4. Scroll down until you reach the end of the ScrollView.
  5. Hold the scroll position: see that the top margin of the ScrollView is shown on top of the content.
Snack, screenshot, or link to a repository

Repository: https://github.com/aitorct/ScrollViewOverflowMargin
Snack: https://snack.expo.dev/@aitorct/scrollviewoverflowmargin

贡献指南

打开贡献指南

从这里开始

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

调研方向

首先在 Android 12–14 上运行链接的 ScrollViewOverflowMargin repository,并使用 overflow: 'visible' 和 marginTop 重现该问题。将滚动结束时的行为与 Android 11 进行比较,然后跟踪 React Native ScrollView 的 Android 实现。当滚动结束时 margin 不再显示在内容上方,同时报告的滚动行为保持不变时,即表示完成。

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

评估

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

把新 issue 发到你的邮箱

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