You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In some situations, the modal snaps to more snap points then specified. So e.g. I provide two snapPoints (one above the bottom bar, one higher), but since v5 I can snap the modal to more than 2 points (one slightly above the bottom bar, one above the bottom bar and one higher).
Reproduction steps
constinsets=useSafeAreaInsets();constrealHeight=useAppSelector(selectRealHeight);constbottomInsets=Platform.select({android: insets.bottom,default: 0});constsnapPoints=useMemo(()=>[BOTTOM_NAVIGATION_HEIGHT+45+24,realHeight-MINIMIZED_TOP_HEIGHT],[realHeight]);// workaround https://github.com/gorhom/react-native-bottom-sheet/issues/1053#issuecomment-1824132757useEffect(()=>{// Check if the bottom sheet is in a closed state (animatedIndex === -1)if(position?.value===-1){// If so, reset it to an open statebottomSheetRef.current?.snapToIndex(0);}},[position,snapPoints]);return(<BottomSheetbackgroundStyle={{backgroundColor: theme.colors.inverseSurface}}handleComponent={null}ref={bottomSheetRef}index={0}snapPoints={snapPoints}style={{zIndex: 21}}topInset={MINIMIZED_TOP_HEIGHT}bottomInset={bottomInsets}animatedIndex={position}enableContentPanningGesture={true}enableOverDrag={false}enablePanDownToClose={false}><BottomSheetViewstyle={{flex: 1,paddingBottom: BOTTOM_NAVIGATION_HEIGHT+bottomInsets}}><Viewstyle={{width: "100%",alignItems: "center"}}><ModalHandleonPress={()=>bottomSheetRef.current?.snapToIndex(0)}/></View><TabsProviderdefaultIndex={0}onChangeIndex={(i)=>{if(!open||tabIndex.current===null){tabIndex.current=i;return;}tabIndex.current=i;bottomSheetRef.current?.snapToIndex(1);}}><TabsdisableSwipeuppercasetabLabelStyle={{fontSize: theme.fonts.bodyMedium.fontSize,fontFamily: theme.fonts.bodyMedium.fontFamily,fontWeight: theme.fonts.bodyMedium.fontWeight,letterSpacing: theme.fonts.bodyMedium.letterSpacing,color: theme.colors.inverseOnSurface}}style={{backgroundColor: theme.colors.inverseSurface,maxHeight: 50,marginTop: -5}}><TabScreenlabel={t("next-title")}><PlaylistScene/></TabScreen><TabScreenlabel={t("lyrics")}disabled={typeofsong?.lyrics==="undefined"||song?.lyrics?.length===0}><LyricsScenelyrics={song?.lyrics}/></TabScreen><TabScreenlabel={t("sheets")}disabled={typeofpdfFile==="undefined"}><SheetScenepdfFile={pdfFile}/></TabScreen></Tabs></TabsProvider></BottomSheetView></BottomSheet>);
Version
v5
Reanimated Version
v3
Gesture Handler Version
v2
Platforms
iOS, Android
What happened?
In some situations, the modal snaps to more snap points then specified. So e.g. I provide two snapPoints (one above the bottom bar, one higher), but since v5 I can snap the modal to more than 2 points (one slightly above the bottom bar, one above the bottom bar and one higher).
Reproduction steps
Reproduction sample
https://snack.expo.dev/@franamu/bottom-sheet---issue-reproduction-template
Relevant log output
When passing these two snapPoints:
[139, 777.2571341378348]
, BottomSheet logs these animatedSnapPoints:702.0951995849609, 638.142822265625, 0
The text was updated successfully, but these errors were encountered: