Skip to content

[Bug]: JavaScriptError: 'index' was provided but out of the provided snap points range! expected value to be between -1, 0 #2648

@BogdanRad

Description

@BogdanRad

Version

v5

Reanimated Version

v3

Gesture Handler Version

v2

Platforms

Android

What happened?

I have this error =>

JavaScriptError: 'index' was provided but out of the provided snap points range! expected value to be between -1, 0

Reproduction steps

The issue only occurs on Android. It happens when I use a bottom sheet inside another bottom sheet. I need this structure because my main component is displayed in a bottom sheet, and inside that component I use another bottom sheet for adding an address when the user needs to enter additional information.

My BottomSheetComponent has the following props (the problem appears on Android after I removed the snap points):

  <BottomSheetModal
      ref={bottomSheetModalRef}
      keyboardBehavior={Platform.OS === 'ios' ? 'interactive' : 'fillParent'}
      keyboardBlurBehavior="restore"
      enableDynamicSizing={true}
      enableBlurKeyboardOnGesture
      enablePanDownToClose
      android_keyboardInputMode="adjustResize"
      topInset={insets.top}
      backgroundStyle={{
        backgroundColor: sheetBackgroundColor,
      }}
      backdropComponent={renderBackdrop}
      onDismiss={onDismiss}
      onChange={handleOnChange}
      footerComponent={footerComponent}>
.......
</BottomSheetModal>

and

Image

In the PaymentComponent, I have another component that contains a BottomSheetModal. The crash occurs when closing the bottom sheet from the PaymentComponent, and it only happens on Android and I have this error.

JavaScriptError: 'index' was provided but out of the provided snap points range! expected value to be between -1, 0

Thank you!

Reproduction sample

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinginvalidThis doesn't seem right

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions