ソースを参照

Bugfix: BottomSheet second open problems fixed.

lfabl 2 ヶ月 前
コミット
2d85aab0d4
2 ファイル変更11 行追加0 行削除
  1. 1 0
      example/src/pages/home/index.tsx
  2. 10 0
      src/components/bottomSheet/index.tsx

+ 1 - 0
example/src/pages/home/index.tsx

@@ -79,6 +79,7 @@ const Home = () => {
         />
         />
         <BottomSheet
         <BottomSheet
             isWorkAsFullScreen={true}
             isWorkAsFullScreen={true}
+            isWorkWithPortal={false}
             ref={bottomSheetRef}
             ref={bottomSheetRef}
             renderHeader={() => {
             renderHeader={() => {
                 return <View
                 return <View

+ 10 - 0
src/components/bottomSheet/index.tsx

@@ -176,6 +176,14 @@ const BottomSheet: RefForwardingComponent<IBottomSheetRef, IBottomSheetProps> =
 
 
     useEffect(() => {
     useEffect(() => {
         if(isActive && isMeasured) {
         if(isActive && isMeasured) {
+            if(!isWorkAsFullScreen && !isCanFullScreenOnSwipe && snapPoint) {
+                maxHeight.current = snapPoint;
+            } else if(isWorkAsFullScreen) {
+                maxHeight.current = containerHeightRef.current - (isWrapSafeAreaContext ? topSafeArea : 0);
+            } else {
+                maxHeight.current = containerHeightRef.current - (isForceFullScreenOnSwipe ? 0 : isWrapSafeAreaContext ? topSafeArea : 0);
+            }
+
             openAnimation();
             openAnimation();
         }
         }
     }, [
     }, [
@@ -221,6 +229,7 @@ const BottomSheet: RefForwardingComponent<IBottomSheetRef, IBottomSheetProps> =
 
 
     const openAnimation = () => {
     const openAnimation = () => {
         resetState();
         resetState();
+
         if(onOpen) onOpen();
         if(onOpen) onOpen();
 
 
         Animated.timing(animatedTranslateY, {
         Animated.timing(animatedTranslateY, {
@@ -248,6 +257,7 @@ const BottomSheet: RefForwardingComponent<IBottomSheetRef, IBottomSheetProps> =
         }) => {
         }) => {
             if(finished) {
             if(finished) {
                 resetState();
                 resetState();
+
                 setIsActive(false);
                 setIsActive(false);
 
 
                 if(onClosed) onClosed();
                 if(onClosed) onClosed();