|
|
@@ -208,6 +208,36 @@ const BottomSheet: RefForwardingComponent<IBottomSheetRef, IBottomSheetProps> =
|
|
|
snapPoint
|
|
|
]);
|
|
|
|
|
|
+ useEffect(() => {
|
|
|
+ if (!isActive) {
|
|
|
+ const newSnapValue = isWorkAsFullScreen
|
|
|
+ ? containerHeightRef.current
|
|
|
+ : (snapPoint ?? contentHeight.current);
|
|
|
+
|
|
|
+ animatedHeight.setValue(isAutoHeight ? 0 : newSnapValue);
|
|
|
+ animatedTranslateY.setValue(newSnapValue);
|
|
|
+
|
|
|
+ heightValue.current = newSnapValue;
|
|
|
+ translateYValue.current = newSnapValue;
|
|
|
+ initialHeight.current = newSnapValue;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!isWorkAsFullScreen && !isCanFullScreenOnSwipe && snapPoint) {
|
|
|
+ maxHeight.current = snapPoint;
|
|
|
+ } else if (!isWorkAsFullScreen) {
|
|
|
+ maxHeight.current = containerHeightRef.current - (
|
|
|
+ isForceFullScreenOnSwipe ? 0 : isWrapSafeAreaContext ? topSafeArea : 0
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ maxHeight.current = containerHeightRef.current - (
|
|
|
+ isWrapSafeAreaContext ? topSafeArea : 0
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }, [
|
|
|
+ snapPoint,
|
|
|
+ isWorkAsFullScreen
|
|
|
+ ]);
|
|
|
+
|
|
|
useEffect(() => {
|
|
|
const listenerAHeightId = animatedHeight.addListener(({
|
|
|
value
|
|
|
@@ -248,8 +278,12 @@ const BottomSheet: RefForwardingComponent<IBottomSheetRef, IBottomSheetProps> =
|
|
|
const closeAnimation = (toValue?: number) => {
|
|
|
if(onClose) onClose();
|
|
|
|
|
|
+ const currentSnapPoint = isWorkAsFullScreen
|
|
|
+ ? containerHeightRef.current
|
|
|
+ : (isAutoHeight || !snapPoint ? contentHeight.current : snapPoint);
|
|
|
+
|
|
|
Animated.timing(animatedTranslateY, {
|
|
|
- toValue: toValue ? toValue : isAutoHeight || !snapPoint ? contentHeight.current : snapPoint,
|
|
|
+ toValue: toValue ?? currentSnapPoint,
|
|
|
useNativeDriver: false,
|
|
|
duration: 300
|
|
|
}).start(({
|
|
|
@@ -286,10 +320,14 @@ const BottomSheet: RefForwardingComponent<IBottomSheetRef, IBottomSheetProps> =
|
|
|
scrollOffset.current = 0;
|
|
|
initialScrollOffset.current = 0;
|
|
|
|
|
|
- initialHeight.current = snapPoint ?? contentHeight.current;
|
|
|
+ const pivot = isWorkAsFullScreen
|
|
|
+ ? containerHeightRef.current
|
|
|
+ : (snapPoint ?? contentHeight.current);
|
|
|
+
|
|
|
+ initialHeight.current = pivot;
|
|
|
initialTranslateY.current = 0;
|
|
|
|
|
|
- heightValue.current = snapPoint ?? contentHeight.current;
|
|
|
+ heightValue.current = pivot;
|
|
|
translateYValue.current = 0;
|
|
|
};
|
|
|
|