diff --git a/src/components/bottomSheet/index.tsx b/src/components/bottomSheet/index.tsx index f6873d4..0378081 100644 --- a/src/components/bottomSheet/index.tsx +++ b/src/components/bottomSheet/index.tsx @@ -68,6 +68,8 @@ const BottomSheet = forwardRef( closeDuration = DEFAULT_CLOSE_ANIMATION_DURATION, customEasingFunction, android_closeOnBackPress = true, + onClose, + onOpen, }, ref ) => { @@ -314,6 +316,10 @@ const BottomSheet = forwardRef( Animators.animateHeight(convertedHeight, openDuration).start(); } setSheetOpen(true); + + if (onOpen) { + onOpen(); + } }; const closeBottomSheet = () => { @@ -334,6 +340,10 @@ const BottomSheet = forwardRef( setSheetOpen(false); removeKeyboardListeners(); Keyboard.dismiss(); + + if (onClose) { + onClose(); + } }; const containerViewLayoutHandler = (event: LayoutChangeEvent) => { diff --git a/src/components/bottomSheet/types.d.ts b/src/components/bottomSheet/types.d.ts index ab0c764..a0ca3de 100644 --- a/src/components/bottomSheet/types.d.ts +++ b/src/components/bottomSheet/types.d.ts @@ -292,6 +292,36 @@ interface BottomSheetProps { * @default {true} */ android_closeOnBackPress?: boolean; + + /** + * Сallback function that is called when the bottom sheet starts to close + * + * @example + * { + * console.log('Bottom Sheet closing.'); + * }} + * /> + * + * @type {Function} + * @default undefined + */ + onClose?: Function; + + /** + * Сallback function that is called when the bottom sheet starts to open + * + * @example + * { + * console.log('Bottom Sheet opening.'); + * }} + * /> + * + * @type {Function} + * @default undefined + */ + onOpen?: Function; } export {