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

Bottom Sheet Modal overlay not working when using one snap point

Open shop-fluencer opened this issue 3 years ago • 4 comments

Bug

Hello,

I use Bottom Sheet Modal, and want to use one Snap Point, it works but I dont get an overlay, if I use 2 snapPoints then its work. How can I fix it ?

Environment info

Library Version
@gorhom/bottom-sheet x.x.x
expo 45.0
react-native-reanimated 2.9.1
react-native-gesture-handler 2.2.1

Steps To Reproduce

Reproducible sample code

const snapPoints = useMemo(() => ['75%'], []);
....
  return (
    <BottomSheetModal
      ref={ref}         
      index={0}
      snapPoints={snapPoints}
      handleIndicatorStyle={s.handleStyle}
      onChange={handleChange}
      backdropComponent={BottomSheetBackdrop}
    >
      {
        renderTabBar
      }
      { datas && datas.length > 0 ? (
        <BottomSheetFlatList
          data={datas}
          renderItem={renderItem}
          keyExtractor={(item, i) => i.toString()}
          initialNumToRender={10}
          windowSize={8}
          maxToRenderPerBatch={50}
          updateCellsBatchingPeriod={50}
          contentContainerStyle={s.flatlistContent}
        />
        )
        :
        null
      }
    </BottomSheetModal>
  )

shop-fluencer avatar Jul 10 '22 21:07 shop-fluencer

You need to set the index prop to index={0} on the BottomSheetModal.

lpatrun avatar Jul 11 '22 07:07 lpatrun

You need to set the index prop to index={0} on the BottomSheetModal.

The Index prop is 0

shop-fluencer avatar Jul 11 '22 14:07 shop-fluencer

use preset() and dismiss() methods to show and hide modal, Its working fine for me .

ursnj avatar Jul 13 '22 03:07 ursnj

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Aug 12 '22 09:08 github-actions[bot]

This issue was closed because it has been stalled for 5 days with no activity.

github-actions[bot] avatar Aug 17 '22 09:08 github-actions[bot]

Leaving a comment here if anyone looking for a solution. Both disappearsOnIndex and appearsOnIndex must be set:

<BottomSheetBackdrop {...props} disappearsOnIndex={-1} appearsOnIndex={0} />

ewal avatar Aug 25 '22 16:08 ewal