react-native-reanimated-bottom-sheet icon indicating copy to clipboard operation
react-native-reanimated-bottom-sheet copied to clipboard

Default behavior is open

Open emrahc opened this issue 5 years ago • 8 comments
trafficstars

I use expo with react navigation and react screens. Bottomsheet is open when component mounts. When i wrap Bottomsheet inside View i cant open it. I tried many combinations but no luck. Anyone had same issue ?

emrahc avatar Nov 10 '20 22:11 emrahc

Had the same issue I passed the prop initialSnap with value 1 and it worked. The docs say that the default value for this prop is 0, but it doesn't work for me.

nathanqueija avatar Nov 14 '20 08:11 nathanqueija

Any updates on how you solved it? I'm having a similar experience (I'm also using Expo).

ferceballos avatar Nov 20 '20 00:11 ferceballos

Not any chance it still persists

emrahc avatar Dec 02 '20 19:12 emrahc

Hey guys,

if you´re using the example, the definition of the snapPoints is 450, 300 and 0. It will open per default on snapPoint index 0 - so it´s 450.

Just set initialSnap={2}

initialSnap points to an index in the snapPoints-Array.

The snapTo() function will open the sheet at the given index of snapPoints.

In my case

onPress={() => sheetRef.current.snapTo(0)}

<BottomSheet
          ref={sheetRef}
          initialSnap={0}
          snapPoints={[600, 0]}
          borderRadius={10}
          renderContent={renderContent}
/>

stefanmichalk avatar Dec 30 '20 14:12 stefanmichalk

Had the same issue I passed the prop initialSnap with value 1 and it worked. The docs say that the default value for this prop is 0, but it doesn't work for me.

Initial Snap to 1 will fix the issue

Alipatel05 avatar Aug 23 '21 12:08 Alipatel05

initialSnap is not a valid Prop.

lucksp avatar Jan 23 '23 17:01 lucksp

<BottomSheet
        ref={ref}
        index={-1}
        snapPoints={snapPoints}
        onChange={handleSheetChanges}>
</BottomSheet>

set index to -1 to hide bottomsheet in default mode

ShelbyIB avatar Mar 07 '23 13:03 ShelbyIB

<BottomSheet
        ref={ref}
        index={-1}
        snapPoints={snapPoints}
        onChange={handleSheetChanges}>
</BottomSheet>

set index to -1 to hide bottomsheet in default mode

Works like charm !!!

Michaelvons avatar Sep 16 '23 09:09 Michaelvons