Skip to content

[iOS] scrollTo() can scroll past the child contents #22768

@cabelitos

Description

@cabelitos

Environment

  React Native Environment Info:
    System:
      OS: macOS 10.14.2
      CPU: x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
      Memory: 183.48 MB / 8.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 10.14.0 - /opt/local/bin/node
      Yarn: 1.12.3 - /opt/local/bin/yarn
      npm: 6.5.0 - /opt/local/bin/npm
      Watchman: 4.9.0 - /opt/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
      Android SDK:
        Build Tools: 23.0.1, 25.0.2, 26.0.1, 26.0.2, 26.0.3, 27.0.3, 28.0.0, 28.0.1, 28.0.2, 28.0.3
        API Levels: 23, 25, 26, 27, 28
    IDEs:
      Android Studio: 3.2 AI-181.5540.7.32.5014246
      Xcode: 10.1/10B61 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.6.3 => 16.6.3
      react-native: 0.57.8 => 0.57.8

Description

On iOS if one uses the scrollTo()/scrollToOffset() family of functions and the offset provided is bigger than the actual content, the content will disappears from the screen and will only be visible again if the user interacts with the UI again. It's important to note that this behavior does not occur on Android, therefore both platforms should behave equally.

Reproducible Demo

1 - Go to https://snack.expo.io/@cabelitos/scroll-problem
2 - Run the project on an iOS simulator.
3 - After 2 seconds the scrollToOffset() function will be called with an offset bigger than the content.
4 - The screen will be white after the function executes.

One can execute the same app on an Android emulator and will notice that the app will stop at the last item and will not advance any further.

iOS behavior

iOS scroll problem

Android behavior

Android

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions