Skip to content

[Bug]: Setting animateOnMount={false} and a non-zero index throws an out of bounds error #2267

@seba1342

Description

@seba1342

Version

v5

Reanimated Version

v3

Gesture Handler Version

v2

Platforms

iOS

What happened?

When setting animateOnMount={false} and providing an index that is greater than 0 with an array of snapPoints that has at least 2 snap points it throws the following error:
'index' was provided but out of the provided snap points range! expected value to be between -1, 0

This is replicable while setting either enableDynamicSizing as true or false.

Reproduction steps

  1. Render a BottomSheet with animateOnMount={false} and provide a couple snapPoints:
<BottomSheet
        enableDynamicSizing={false}
        animateOnMount={false}
        snapPoints={[200, 500]}
        index={1}>
        <BottomSheetScrollView>
        ...
        </BottomSheetScrollView>
      </BottomSheet>
  1. Set index to be greater than 0 (but still a valid option in the snapPoint array.

  2. Get 'index' was provided but out of the provided snap points range! expected value to be between -1, 0 error even though snapPoints[1] is a valid array option.

Reproduction sample

https://snack.expo.dev/@seba1342/bottom-sheet---issue-reproduction-template

Relevant log output

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

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions