Skip to content

Automatic scroll to top when image is selected in iOS #826

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
3 tasks done
kezike opened this issue May 10, 2025 · 1 comment
Closed
3 tasks done

Automatic scroll to top when image is selected in iOS #826

kezike opened this issue May 10, 2025 · 1 comment

Comments

@kezike
Copy link

kezike commented May 10, 2025

I have searched open and closed issues for this issue.

  • I have searched open and closed issues.

I have read and understood the license (link below).

  • I have read and understood the license.

Minimal reproducible example

Can be provided if requested

What platform(s) does this occur on?

iOS

Did you reproduce on a real device or emulator / simulator?

real device

Steps to reproduce

TLDR - Screen renders to the top of the scroll view after I select an image in latest version of @react-native-documents/picker in iOS 0.78.0.

I have been using react-native-document-picker in my application since prior to the recent refactor into @react-native-documents/picker and @react-native-documents/viewer. After a recent upgrade to React Native 0.78.0, I found that I needed to upgrade to the new libraries. Generally, it has been fine, but I recently noticed an awkward UX issue in iOS that I never noticed in previous versions of the file picker: whenever the file picker is embedded in a scroll view and I invoke the file picker with the pick method, it jumps to the top of the scroll view after I select an image.

I have tried handling this issue by tracking the scroll position prior to selection and scrolling back to the correct position, but 1) it is difficult to restore the correct position accurately and 2) even if I do that, it is an awkward UX effect to restore the position because the screen temporarily scrolls up before scrolling back into position.

I have also tried handling this issue by temporarily disabling scroll before invoking pick and re-enabling it after returning from the file picker, but the view jumps to the top of the scroll view before the scroll is re-enabled.

Is there anything particular about the way you are picking images that is distinct from the way you are picking other files that could be causing this issue in iOS?

I have not yet created a minimal repro for this issue because I wanted to get this issue up as soon as I could. If requested, I will try to put something together when I am back at my desk later. In the meantime, I am hoping that my description and the attached screen recording suffices for you to understand the issue.

Thanks!

BAD-image-file-picker-jump-return.mov

If the issue is related to specific file(s), I have linked the files so that others can reproduce exactly what I see.

  • I have attached files necessary to reproduce the problem (if applicable).

Stacktrace of the crash (if applicable)

There is no crash that occurs. It is just an awkward UX effect.

Your computer environment

info Fetching system and libraries information...
System:
  OS: macOS 15.4.1
  CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
  Memory: 2.27 GB / 16.00 GB
  Shell:
    version: 3.2.57
    path: /bin/bash
Binaries:
  Node:
    version: 20.11.0
    path: ~/.nvm/versions/node/v20.11.0/bin/node
  Yarn:
    version: 1.22.21
    path: ~/.nvm/versions/node/v20.11.0/bin/yarn
  npm:
    version: 10.9.0
    path: ~/.nvm/versions/node/v20.11.0/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.15.2
    path: /usr/local/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.4
      - iOS 18.4
      - macOS 15.4
      - tvOS 18.4
      - visionOS 2.4
      - watchOS 11.4
  Android SDK:
    API Levels:
      - "29"
      - "30"
      - "31"
      - "33"
      - "34"
      - "35"
    Build Tools:
      - 29.0.2
      - 30.0.2
      - 30.0.3
      - 31.0.0
      - 33.0.0
      - 33.0.1
      - 34.0.0
      - 35.0.0
      - 36.0.0
    System Images:
      - android-30 | Intel x86 Atom_64
      - android-30 | Google APIs Intel x86 Atom
      - android-36 | Google Play Intel x86_64 Atom
    Android NDK: Not Found
IDEs:
  Android Studio: 2024.3 AI-243.24978.46.2431.13208083
  Xcode:
    version: 16.3/16E140
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.14
    path: /usr/local/Cellar/openjdk@17/17.0.14/libexec/openjdk.jdk/Contents/Home/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.1
    wanted: 15.0.1
  react:
    installed: 19.0.0
    wanted: 19.0.0
  react-native:
    installed: 0.78.0
    wanted: 0.78.0
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

info React Native v0.79.2 is now available (your project is running on v0.78.0).
info Changelog: https://github.com/facebook/react-native/releases/tag/v0.79.2
info Diff: https://react-native-community.github.io/upgrade-helper/?from=0.78.0&to=0.79.2
info For more info, check out "https://reactnative.dev/docs/upgrading?os=macos".
Copy link
Contributor

👋 @kezike, sorry you're having an issue. As the issue template explains, it's required that you provide a runnable example that reproduces your issue (see the issue template).
The reason is that a bug report is not actionable without a reproducer. Try to minimize the superfluous code and focus only on reproducing the bug.
Please create a new issue with this and the maintainer will do his best to review it!.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 11, 2025
@github-actions github-actions bot locked as off-topic and limited conversation to collaborators May 11, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants