Skip to content

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

Closed as not planned
@kezike

Description

@kezike

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".

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions