Skip to content

SectionList sroll to item after setState not working on Android #25202

@joris1995

Description

@joris1995

Please see this snack for a demo.
A short description: I want to develop a component that allows users to add entries to a list that is being displayed in a SectionList . When the latest entry is out of the screen bounds, I want the SectionList to scroll to it's location. I do this by calling ScrollToLocation(params) in the completion callback of setState. On iOS this works, but on Android, the list scroll to the second last item rather than the last

React Native version:

React Native Environment Info:
  System:
    OS: macOS 10.14.5
    CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
    Memory: 69.66 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 10.15.1 - /usr/local/bin/node
    Yarn: 1.15.2 - /usr/local/bin/yarn
    npm: 6.4.1 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
    Android SDK:
      API Levels: 23, 28
      Build Tools: 23.0.1, 28.0.3
      System Images: android-28 | Google APIs Intel x86 Atom
  IDEs:
    Android Studio: 3.4 AI-183.6156.11.34.5522156
    Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.8.3 => 16.8.3 
    react-native: ^0.59.6 => 0.59.8 
  npmGlobalPackages:
    react-native-rename: 2.4.1

Steps To Reproduce

  1. Please check the snack

Describe what you expected to happen:
I expect the state to be updated and the render finished when the callback of setState gets fired, but apparently this is not the case in Android

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugComponent: SectionListPlatform: AndroidAndroid applications.StaleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions