react-native: ListMetricsAggregator must be notified of list content layout before resolving offsets
Description
We are receiving this crash on Android devices, observed it on Firebase Crashlytics but It does not contain any logs. We could not reproduced this crash and would not find any similar bug.
Steps to reproduce
React Native Version
0.74.5
Affected Platforms
Runtime - Android
Output of npx react-native info
System:
OS: macOS 14.3.1
CPU: (8) arm64 Apple M3
Memory: 49.61 MB / 16.00 GB
Shell:
version: 3.2.57
path: /bin/bash
Binaries:
Node:
version: 18.19.1
path: ~/.nvm/versions/node/v18.19.1/bin/node
Yarn:
version: 1.22.22
path: ~/.nvm/versions/node/v18.19.1/bin/yarn
npm:
version: 10.2.4
path: ~/.nvm/versions/node/v18.19.1/bin/npm
Watchman:
version: 2024.07.29.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.15.2
path: /Users/alpaye/.rbenv/shims/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 23.2
- iOS 17.2
- macOS 14.2
- tvOS 17.2
- visionOS 1.0
- watchOS 10.2
Android SDK: Not Found
IDEs:
Android Studio: 2023.1 AI-231.9392.1.2311.11330709
Xcode:
version: 15.2/15C500b
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.10
path: /usr/bin/javac
Ruby:
version: 2.7.8
path: /Users/alpaye/.rbenv/shims/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.74.5
wanted: 0.74.5
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: true
newArchEnabled: false
Stacktrace or Logs
Fatal Exception: com.facebook.react.common.JavascriptException: Invariant Violation: ListMetricsAggregator must be notified of list content layout before resolving offsets, js engine: hermes, stack:
invariant@1:139225
flowRelativeOffset@1:605334
notifyCellLayout@1:604441
anonymous@1:587750
anonymous@1:611095
invokeGuardedCallbackImpl@1:409136
invokeGuardedCallback@1:409193
invokeGuardedCallbackAndCatchFirstError@1:409225
executeDispatch@1:409354
executeDispatchesAndReleaseTopLevel@1:412758
forEachAccumulated@1:410830
anonymous@1:413121
batchedUpdatesImpl@1:481191
batchedUpdates$1@1:412674
_receiveRootNodeIDEvent@1:412959
receiveEvent@1:475781
__callFunction@1:134915
anonymous@1:133217
__guard@1:134175
callFunctionReturnFlushedQueue@1:133175
at com.facebook.react.modules.core.ExceptionsManagerModule.reportException(ExceptionsManagerModule.java:65)
at java.lang.reflect.Method.invoke(Method.java)
at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:146)
at com.facebook.jni.NativeRunnable.run(NativeRunnable.java)
at android.os.Handler.handleCallback(Handler.java:958)
at android.os.Handler.dispatchMessage(Handler.java:99)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
at android.os.Looper.loopOnce(Looper.java:230)
at android.os.Looper.loop(Looper.java:319)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:233)
at java.lang.Thread.run(Thread.java:1012)
Reproducer
Screenshots and Videos
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 25 (1 by maintainers)
I know this isn’t the best solution, but for now, I added comments to the following in
node_modules > @react-native > virtualized-lists > Lists > ListMetricsAggregator.Specifically, I looked for the
flowRelativeOffsetfunction atline 247and commented out the three lines below it. This allowed the code to run without any crashes.@egealpay we can’t help you without a way to reproduce this crash
Hi! We also experienced this issue. Encountered on Android 12, 13, and 14. Is there already a fix for this? Thank you!