|
@@ -42,7 +42,7 @@ const BottomSheet: RefForwardingComponent<IBottomSheetRef, IBottomSheetProps> =
|
|
|
isCanFullScreenOnSwipe = false,
|
|
isCanFullScreenOnSwipe = false,
|
|
|
handleContainerBackgroundColor,
|
|
handleContainerBackgroundColor,
|
|
|
handleHeight: handleHeightProp,
|
|
handleHeight: handleHeightProp,
|
|
|
- isWrapSafeareaContext = true,
|
|
|
|
|
|
|
+ isWrapSafeAreaContext = true,
|
|
|
backgroundColor = "default",
|
|
backgroundColor = "default",
|
|
|
isWorkAsFullScreen = false,
|
|
isWorkAsFullScreen = false,
|
|
|
isWorkWithPortal = true,
|
|
isWorkWithPortal = true,
|
|
@@ -51,10 +51,13 @@ const BottomSheet: RefForwardingComponent<IBottomSheetRef, IBottomSheetProps> =
|
|
|
isActive: isActiveProp,
|
|
isActive: isActiveProp,
|
|
|
handleBackgroundColor,
|
|
handleBackgroundColor,
|
|
|
isAutoHeight = false,
|
|
isAutoHeight = false,
|
|
|
- isShowHandle = true,
|
|
|
|
|
isSwipeClose = true,
|
|
isSwipeClose = true,
|
|
|
|
|
+ isShowHandle = true,
|
|
|
isCanSwipe = true,
|
|
isCanSwipe = true,
|
|
|
onOverlayPressed,
|
|
onOverlayPressed,
|
|
|
|
|
+ scrollViewProps,
|
|
|
|
|
+ scrollViewStyle,
|
|
|
|
|
+ modalProps,
|
|
|
snapPoint,
|
|
snapPoint,
|
|
|
children,
|
|
children,
|
|
|
onClosed,
|
|
onClosed,
|
|
@@ -85,8 +88,8 @@ const BottomSheet: RefForwardingComponent<IBottomSheetRef, IBottomSheetProps> =
|
|
|
setIsActive
|
|
setIsActive
|
|
|
] = useState(isActiveProp === undefined ? false : isActiveProp);
|
|
] = useState(isActiveProp === undefined ? false : isActiveProp);
|
|
|
|
|
|
|
|
- let bottomSafeArea = isWrapSafeareaContext ? bottom : 0;
|
|
|
|
|
- let topSafeArea = isWrapSafeareaContext ? top : 0;
|
|
|
|
|
|
|
+ let bottomSafeArea = isWrapSafeAreaContext ? bottom : 0;
|
|
|
|
|
+ let topSafeArea = isWrapSafeAreaContext ? top : 0;
|
|
|
|
|
|
|
|
if(isForceFullScreenOnSwipe) {
|
|
if(isForceFullScreenOnSwipe) {
|
|
|
topSafeArea = 0;
|
|
topSafeArea = 0;
|
|
@@ -109,7 +112,7 @@ const BottomSheet: RefForwardingComponent<IBottomSheetRef, IBottomSheetProps> =
|
|
|
|
|
|
|
|
const TOP_GRAB_AREA = 140;
|
|
const TOP_GRAB_AREA = 140;
|
|
|
|
|
|
|
|
- const maxHeight = useRef(isWorkAsFullScreen ? containerHeightRef.current - (isWrapSafeareaContext ? topSafeArea : 0) : containerHeightRef.current - (isForceFullScreenOnSwipe ? 0 : isWrapSafeareaContext ? topSafeArea : 0));
|
|
|
|
|
|
|
+ const maxHeight = useRef(isWorkAsFullScreen ? containerHeightRef.current - (isWrapSafeAreaContext ? topSafeArea : 0) : containerHeightRef.current - (isForceFullScreenOnSwipe ? 0 : isWrapSafeAreaContext ? topSafeArea : 0));
|
|
|
const heightValue = useRef(isWorkAsFullScreen ? containerHeightRef.current : snapPoint ?? 0);
|
|
const heightValue = useRef(isWorkAsFullScreen ? containerHeightRef.current : snapPoint ?? 0);
|
|
|
const initialTranslateY = useRef(0);
|
|
const initialTranslateY = useRef(0);
|
|
|
const translateYValue = useRef(0);
|
|
const translateYValue = useRef(0);
|
|
@@ -184,14 +187,14 @@ const BottomSheet: RefForwardingComponent<IBottomSheetRef, IBottomSheetProps> =
|
|
|
if (!isWorkAsFullScreen && !isCanFullScreenOnSwipe && snapPoint) {
|
|
if (!isWorkAsFullScreen && !isCanFullScreenOnSwipe && snapPoint) {
|
|
|
maxHeight.current = snapPoint;
|
|
maxHeight.current = snapPoint;
|
|
|
} else if (!isWorkAsFullScreen) {
|
|
} else if (!isWorkAsFullScreen) {
|
|
|
- maxHeight.current = containerHeightRef.current - (isForceFullScreenOnSwipe ? 0 : isWrapSafeareaContext ? topSafeArea : 0);
|
|
|
|
|
|
|
+ maxHeight.current = containerHeightRef.current - (isForceFullScreenOnSwipe ? 0 : isWrapSafeAreaContext ? topSafeArea : 0);
|
|
|
} else {
|
|
} else {
|
|
|
- maxHeight.current = containerHeightRef.current - (isWrapSafeareaContext ? topSafeArea : 0);
|
|
|
|
|
|
|
+ maxHeight.current = containerHeightRef.current - (isWrapSafeAreaContext ? topSafeArea : 0);
|
|
|
}
|
|
}
|
|
|
}, [
|
|
}, [
|
|
|
isForceFullScreenOnSwipe,
|
|
isForceFullScreenOnSwipe,
|
|
|
isCanFullScreenOnSwipe,
|
|
isCanFullScreenOnSwipe,
|
|
|
- isWrapSafeareaContext,
|
|
|
|
|
|
|
+ isWrapSafeAreaContext,
|
|
|
isWorkAsFullScreen,
|
|
isWorkAsFullScreen,
|
|
|
topSafeArea,
|
|
topSafeArea,
|
|
|
snapPoint
|
|
snapPoint
|
|
@@ -564,6 +567,7 @@ const BottomSheet: RefForwardingComponent<IBottomSheetRef, IBottomSheetProps> =
|
|
|
{...panResponder.panHandlers}
|
|
{...panResponder.panHandlers}
|
|
|
onLayout={onLayout}
|
|
onLayout={onLayout}
|
|
|
style={[
|
|
style={[
|
|
|
|
|
+ style,
|
|
|
{
|
|
{
|
|
|
height: (isAutoHeight || !snapPoint) && !isMeasured ? "auto" : animatedHeight,
|
|
height: (isAutoHeight || !snapPoint) && !isMeasured ? "auto" : animatedHeight,
|
|
|
backgroundColor: colors.content.container[backgroundColor],
|
|
backgroundColor: colors.content.container[backgroundColor],
|
|
@@ -577,12 +581,12 @@ const BottomSheet: RefForwardingComponent<IBottomSheetRef, IBottomSheetProps> =
|
|
|
translateY: animatedTranslateY
|
|
translateY: animatedTranslateY
|
|
|
}]
|
|
}]
|
|
|
},
|
|
},
|
|
|
- stylesheet.container,
|
|
|
|
|
- style
|
|
|
|
|
|
|
+ stylesheet.container
|
|
|
]}
|
|
]}
|
|
|
>
|
|
>
|
|
|
{renderHeader()}
|
|
{renderHeader()}
|
|
|
<ScrollView
|
|
<ScrollView
|
|
|
|
|
+ {...scrollViewProps}
|
|
|
onContentSizeChange={(w, h) => {
|
|
onContentSizeChange={(w, h) => {
|
|
|
scrollViewContentHeight.current = h;
|
|
scrollViewContentHeight.current = h;
|
|
|
}}
|
|
}}
|
|
@@ -598,6 +602,9 @@ const BottomSheet: RefForwardingComponent<IBottomSheetRef, IBottomSheetProps> =
|
|
|
overScrollMode="never"
|
|
overScrollMode="never"
|
|
|
ref={scrollViewRef}
|
|
ref={scrollViewRef}
|
|
|
bounces={false}
|
|
bounces={false}
|
|
|
|
|
+ style={[
|
|
|
|
|
+ scrollViewStyle
|
|
|
|
|
+ ]}
|
|
|
>
|
|
>
|
|
|
{children}
|
|
{children}
|
|
|
</ScrollView>
|
|
</ScrollView>
|
|
@@ -664,6 +671,7 @@ const BottomSheet: RefForwardingComponent<IBottomSheetRef, IBottomSheetProps> =
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
return <Modal
|
|
return <Modal
|
|
|
|
|
+ {...modalProps}
|
|
|
isWorkWithPortal={isWorkWithPortal}
|
|
isWorkWithPortal={isWorkWithPortal}
|
|
|
isContentRequired={false}
|
|
isContentRequired={false}
|
|
|
key={`${key}-modal`}
|
|
key={`${key}-modal`}
|
|
@@ -680,7 +688,7 @@ const BottomSheet: RefForwardingComponent<IBottomSheetRef, IBottomSheetProps> =
|
|
|
if (!isWorkAsFullScreen && !isCanFullScreenOnSwipe && snapPoint) {
|
|
if (!isWorkAsFullScreen && !isCanFullScreenOnSwipe && snapPoint) {
|
|
|
maxHeight.current = snapPoint;
|
|
maxHeight.current = snapPoint;
|
|
|
} else if (!isWorkAsFullScreen) {
|
|
} else if (!isWorkAsFullScreen) {
|
|
|
- maxHeight.current = containerLayoutHeight - (isForceFullScreenOnSwipe ? 0 : isWrapSafeareaContext ? topSafeArea : 0);
|
|
|
|
|
|
|
+ maxHeight.current = containerLayoutHeight - (isForceFullScreenOnSwipe ? 0 : isWrapSafeAreaContext ? topSafeArea : 0);
|
|
|
} else {
|
|
} else {
|
|
|
maxHeight.current = containerLayoutHeight;
|
|
maxHeight.current = containerLayoutHeight;
|
|
|
}
|
|
}
|