terminating with uncaught exception of type folly::json::parse_error: folly::toJson: JSON object value was a NaN or INF
Bug
I updated to v3 and I am using BottomSheetSectionList. I experience crashes when scrolling to top position of the bottomSheet, and the error is
libc++abi.dylib: terminating with uncaught exception of type folly::json::parse_error: folly::toJson: JSON object value was a NaN or INF
terminating with uncaught exception of type folly::json::parse_error: folly::toJson: JSON object value was a NaN or INF
Environment info
| Library | Version |
|---|---|
| @gorhom/bottom-sheet | 3.0.2-alpha.2 |
| react-native | 0.63.3 |
| react-native-reanimated | 2.0.0-rc.1 |
| react-native-gesture-handler | 1.9.0 |
Steps To Reproduce
<BottomSheet
// ref={sheetRef}
backgroundComponent={() => (
<View style={{ backgroundColor: COLORS.THEME.MODAL_DARK }} />
)}
handleComponent={() => (
<View style={{ backgroundColor: COLORS.THEME.TRANSPARENT, alignItems: 'center' }}>
<View
style={{
width: 40,
borderTopWidth: 5,
borderTopColor: '#979797',
borderRadius: 6,
marginBottom: 5,
backgroundColor: COLORS.THEME.MODAL_DARK,
}}
/>
</View>
)}
snapPoints={snapPoints}>
<BottomSheetSectionList
style={styles.scrollBottomSheet}
sections={
moments.length === 0 && closedMoments.length === 0 ? [] : (sections as any)
}
stickySectionHeadersEnabled
ref={ref}
keyExtractor={(item, index) => `${index} ${item}`}
renderSectionHeader={renderSectionHeader}
onEndReached={() => fetchNextClosedMoments()}
onEndReachedThreshold={1}
ListEmptyComponent={() => <EmptyState />}
renderItem={renderItem}
showsVerticalScrollIndicator={false}
ListHeaderComponent={cardOverlay}
ListFooterComponent={loadingFooter}
/>
</BottomSheet>
- Explain the steps we need to take to reproduce the issue: -->
- Scroll and go to top position of the bottom sheet
- Drag the bottom sheet several times, and try also to do it slowly, from the top position, scroll down and then up, and change snapPoint to the lowest one(default position of the bottom sheet).
- The application crashes with the exception described above. Does not happen always.
hi @gudberg , could you modify the reproducible code to be runnable from /example folder , thanks
@gorhom I did not need to write any code in the folder. You can reproduce this error by running the sectionlist example in v3 branch. Here is a video:
https://user-images.githubusercontent.com/16470938/104025341-611e2880-51bc-11eb-971b-d7284b2635b3.mp4
@gudberg thanks for spotting this bug ! will work on a fix later π
@gudberg i tried to reproduce the bug but i couldn't , maybe i missed something ?
https://user-images.githubusercontent.com/4061838/104067395-62bf0f00-5203-11eb-8f6c-de91e5c212db.mp4
my video upload seems to have failed, I canΒ΄t see it above. Will try to upload another video tomorrow. It is a really weird bug, you actually have to try many times and try to scroll more down and then up again. It seems to have something to do with the top position(highest snap point) and moving the sheet down to the default position. I had hard times reproducing it today but it surely happened at least 5 times.
I tested it again with the same result. The app crashes and I get the error that I pasted above. I tried on a real device also and then it is much more frequent and easier to reproduce. Try to forcefully pull it to the default position.
Here are links: https://streamable.com/yntpr8 (specially look at 0:19)
https://streamable.com/h1eedo
Suspected reason, something to do with when this happens:

found it, it seems that it occurs out of this library implementation, however i'll spend time to investigate it and have better answer and hopefully fix it π
[Sat Jan 09 2021 15:57:29.150] WARN The value `scrollView.contentOffset.y` equals NaN or INF and will be replaced by `0`.
thanks @gudberg again for spending the time to reproduce it.
@gorhom I've just had a crash on Android:
Fatal Exception: java.lang.RuntimeException: folly::toJson: JSON object value was a NaN or INF
at com.facebook.react.bridge.NativeMap.toString(NativeMap.java)
at com.swmansion.reanimated.NativeProxy$EventHandler.receiveEvent(NativeProxy.java)
at com.swmansion.reanimated.NativeProxy$EventHandler.receiveEvent(NativeProxy.java:60)
at com.facebook.react.views.scroll.ScrollEvent.dispatch(ScrollEvent.java:116)
at com.swmansion.reanimated.NodesManager.handleEvent(NodesManager.java:485)
at com.swmansion.reanimated.NodesManager.onEventDispatch(NodesManager.java:462)
at com.facebook.react.uimanager.events.EventDispatcher.dispatchEvent(EventDispatcher.java:114)
at com.facebook.react.views.scroll.ReactScrollViewHelper.emitScrollEvent(ReactScrollViewHelper.java:61)
at com.facebook.react.views.scroll.ReactScrollViewHelper.emitScrollEndDragEvent(ReactScrollViewHelper.java:35)
at com.facebook.react.views.scroll.ReactScrollView.onTouchEvent(ReactScrollView.java:316)
at android.view.View.dispatchTouchEvent(View.java:14002)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3136)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2820)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3142)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2834)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3142)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2834)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3142)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2834)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3142)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2834)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3142)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2834)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3142)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2834)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3142)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2834)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3142)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2834)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3142)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2834)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3142)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2834)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3142)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2834)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3142)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2834)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3142)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2834)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3142)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2834)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3142)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2834)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3142)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2834)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3142)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2834)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3142)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2834)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3142)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2834)
at com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView.dispatchTouchEvent(RNGestureHandlerEnabledRootView.java:39)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3142)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2834)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3142)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2834)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3142)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2834)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3142)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2834)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3142)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2834)
at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:495)
at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1868)
at android.app.Activity.dispatchTouchEvent(Activity.java:4022)
at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:69)
at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:453)
at android.view.View.dispatchPointerEvent(View.java:14261)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:5903)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5706)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5153)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5206)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5172)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5180)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5153)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5206)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5172)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5328)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5180)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5385)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5153)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5206)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5172)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5180)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5153)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:8002)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:7969)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:7930)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:8156)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:189)
at android.os.MessageQueue.nativePollOnce(MessageQueue.java)
at android.os.MessageQueue.next(MessageQueue.java:336)
at android.os.Looper.loop(Looper.java:174)
at android.app.ActivityThread.main(ActivityThread.java:7615)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)
i'm using reanimated 2.1.0 and @gorhom/bottom-sheet 3.6.4
Same issue here on @gorhom/bottom-sheet 3.6.4 and reanimated 2.1.0
I have one bottom sheet that gets this crash pretty consistently when I wiggle it around
Should be fixed with:
- https://github.com/software-mansion/react-native-reanimated/pull/2992
- https://github.com/software-mansion/react-native-reanimated/pull/2901
- https://github.com/software-mansion/react-native-reanimated/pull/2896