|
|
@@ -62,9 +62,11 @@ const BottomSheet: RefForwardingComponent<IBottomSheetRef, IBottomSheetProps> =
|
|
|
scrollViewStyle,
|
|
|
onScrollEnd,
|
|
|
customTheme,
|
|
|
+ portalName,
|
|
|
modalProps,
|
|
|
snapPoint,
|
|
|
customKey,
|
|
|
+ id: outID,
|
|
|
children,
|
|
|
onClosed,
|
|
|
onOpened,
|
|
|
@@ -93,6 +95,8 @@ const BottomSheet: RefForwardingComponent<IBottomSheetRef, IBottomSheetProps> =
|
|
|
setIsActive
|
|
|
] = useState(isActiveProp === undefined ? false : isActiveProp);
|
|
|
|
|
|
+ const id = useRef(outID ? outID : uuid());
|
|
|
+
|
|
|
const bottomSheetKey = useRef(customKey ? customKey : uuid());
|
|
|
|
|
|
let bottomSafeArea = isWrapSafeAreaContext ? bottom : 0;
|
|
|
@@ -145,8 +149,8 @@ const BottomSheet: RefForwardingComponent<IBottomSheetRef, IBottomSheetProps> =
|
|
|
useImperativeHandle(
|
|
|
ref,
|
|
|
() => ({
|
|
|
- close: (callback) => {
|
|
|
- closeAnimation(undefined, callback);
|
|
|
+ close: (onClosed) => {
|
|
|
+ closeAnimation(undefined, onClosed);
|
|
|
},
|
|
|
open: () => {
|
|
|
setIsActive(true);
|
|
|
@@ -302,8 +306,12 @@ const BottomSheet: RefForwardingComponent<IBottomSheetRef, IBottomSheetProps> =
|
|
|
});
|
|
|
};
|
|
|
|
|
|
- const closeAnimation = (toValue?: number, callback?: () => void) => {
|
|
|
- if(onClose) onClose();
|
|
|
+ const closeAnimation = (toValue?: number, _onClosed?: (props: {
|
|
|
+ id: string;
|
|
|
+ }) => void) => {
|
|
|
+ if(onClose) onClose({
|
|
|
+ id: id.current
|
|
|
+ });
|
|
|
|
|
|
const currentSnapPoint = isWorkAsFullScreen
|
|
|
? containerHeightRef.current
|
|
|
@@ -321,8 +329,13 @@ const BottomSheet: RefForwardingComponent<IBottomSheetRef, IBottomSheetProps> =
|
|
|
|
|
|
setIsActive(false);
|
|
|
|
|
|
- if(onClosed) onClosed();
|
|
|
- if(callback) callback();
|
|
|
+ if(onClosed) onClosed({
|
|
|
+ id: id.current
|
|
|
+ });
|
|
|
+
|
|
|
+ if(_onClosed) _onClosed({
|
|
|
+ id: id.current
|
|
|
+ });
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
@@ -672,7 +685,9 @@ const BottomSheet: RefForwardingComponent<IBottomSheetRef, IBottomSheetProps> =
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if(onClose) onClose();
|
|
|
+ if(onClose) onClose({
|
|
|
+ id: id.current
|
|
|
+ });
|
|
|
|
|
|
Animated.timing(animatedTranslateY, {
|
|
|
useNativeDriver: false,
|
|
|
@@ -684,7 +699,9 @@ const BottomSheet: RefForwardingComponent<IBottomSheetRef, IBottomSheetProps> =
|
|
|
if (finished && isClosing) {
|
|
|
setIsActive(false);
|
|
|
|
|
|
- if (onClosed) onClosed();
|
|
|
+ if (onClosed) onClosed({
|
|
|
+ id: id.current
|
|
|
+ });
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
@@ -806,12 +823,14 @@ const BottomSheet: RefForwardingComponent<IBottomSheetRef, IBottomSheetProps> =
|
|
|
|
|
|
return <Modal
|
|
|
{...modalProps}
|
|
|
+ portalName={portalName ? portalName : "bottomSheet-system"}
|
|
|
isWorkWithPortal={isWorkWithPortal}
|
|
|
key={`${bottomSheetKey}-modal`}
|
|
|
isContentRequired={false}
|
|
|
isActive={isActive}
|
|
|
alignContent="free"
|
|
|
isAnimated={false}
|
|
|
+ id={id.current}
|
|
|
ref={modalRef}
|
|
|
onContainerLayout={(e) => {
|
|
|
const containerLayoutHeight = e.nativeEvent.layout.height;
|