List jumping when sliding using maintainVisibleContentPosition on Android
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 127k
- Forks
- 25.3k
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 4
Description
Description
I use maintainVisibleContentPosition in the chat list. When sliding to view older chat messages, if a new message (Especially very long messages, exceeding the height of the screen) is inserted into the list, the (android) list will jump, but iOS will not.
I can reproduce it using the latest RN 0.72.6 and wrote a demo.
https://github.com/Rays15/flatlist-demo
https://github.com/facebook/react-native/assets/17613135/d8872f9c-489e-4b83-bcbf-4205191504b7
@janicduplessis Can this be fixed?
React Native Version
0.72.6
Output of npx react-native info
System:
OS: macOS 14.0
CPU: (12) arm64 Apple M2 Max
Memory: 1.95 GB / 32.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 16.15.1
path: ~/.nvm/versions/node/v16.15.1/bin/node
Yarn:
version: 1.22.19
path: ~/.nvm/versions/node/v16.15.1/bin/yarn
npm:
version: 8.11.0
path: ~/.nvm/versions/node/v16.15.1/bin/npm
Watchman:
version: 2023.08.14.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.12.1
path: /opt/homebrew/bin/pod
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.3 AI-223.8836.35.2231.10406996
Xcode:
version: 14.3.1/14E300c
path: /usr/bin/xcodebuild
Languages:
Java:
version: 11.0.20
path: /Users/rays/.sdkman/candidates/java/current/bin/javac
Ruby:
version: 2.6.10
path: /usr/bin/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.72.6
wanted: 0.72.6
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
https://github.com/Rays15/flatlist-demo
Snack, screenshot, or link to a repository
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the linked flatlist-demo with React Native 0.72.6 and reproducing the Android jump while sliding through older messages. Trace the Android handling of maintainVisibleContentPosition and compare it with iOS behavior. Done means inserting a very long message no longer changes the visible position unexpectedly on Android.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react-native
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100