From 056ba00bfd5c1c26397b933c514c318b78dda05a Mon Sep 17 00:00:00 2001 From: MoritzCooks Date: Wed, 29 Nov 2023 17:21:43 +0100 Subject: [PATCH 1/3] fix(BottomSheetContainer): `Cannot add new property 'value'` issue --- src/components/bottomSheetContainer/BottomSheetContainer.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/bottomSheetContainer/BottomSheetContainer.tsx b/src/components/bottomSheetContainer/BottomSheetContainer.tsx index ffcd5448a..72fe2cb49 100644 --- a/src/components/bottomSheetContainer/BottomSheetContainer.tsx +++ b/src/components/bottomSheetContainer/BottomSheetContainer.tsx @@ -48,6 +48,7 @@ function BottomSheetContainerComponent({ containerRef.current?.measure( (_x, _y, _width, _height, _pageX, pageY) => { + if (!containerOffset.value) return; containerOffset.value = { top: pageY ?? 0, left: 0, From 5ab27b636019056d8342a24cde94ff467481d6d8 Mon Sep 17 00:00:00 2001 From: MoritzCooks Date: Wed, 29 Nov 2023 17:22:02 +0100 Subject: [PATCH 2/3] fix(BottomSheetContainer): upload lib --- .gitignore | 2 +- .../components/bottomSheet/BottomSheet.js | 1160 +++++++++++++++++ .../components/bottomSheet/BottomSheet.js.map | 1 + .../components/bottomSheet/constants.js | 52 + .../components/bottomSheet/constants.js.map | 1 + lib/commonjs/components/bottomSheet/index.js | 16 + .../components/bottomSheet/index.js.map | 1 + lib/commonjs/components/bottomSheet/styles.js | 25 + .../components/bottomSheet/styles.js.map | 1 + .../BottomSheetBackdrop.js | 108 ++ .../BottomSheetBackdrop.js.map | 1 + .../bottomSheetBackdrop/constants.js | 17 + .../bottomSheetBackdrop/constants.js.map | 1 + .../components/bottomSheetBackdrop/index.js | 16 + .../bottomSheetBackdrop/index.js.map | 1 + .../components/bottomSheetBackdrop/styles.js | 17 + .../bottomSheetBackdrop/styles.js.map | 1 + .../BottomSheetBackdropContainer.js | 32 + .../BottomSheetBackdropContainer.js.map | 1 + .../bottomSheetBackdropContainer/index.js | 16 + .../bottomSheetBackdropContainer/index.js.map | 1 + .../bottomSheetBackdropContainer/styles.js | 21 + .../styles.js.map | 1 + .../BottomSheetBackground.js | 33 + .../BottomSheetBackground.js.map | 1 + .../components/bottomSheetBackground/index.js | 16 + .../bottomSheetBackground/index.js.map | 1 + .../bottomSheetBackground/styles.js | 18 + .../bottomSheetBackground/styles.js.map | 1 + .../BottomSheetBackgroundContainer.js | 42 + .../BottomSheetBackgroundContainer.js.map | 1 + .../bottomSheetBackgroundContainer/index.js | 16 + .../index.js.map | 1 + .../bottomSheetBackgroundContainer/styles.js | 21 + .../styles.js.map | 1 + .../BottomSheetContainer.js | 85 ++ .../BottomSheetContainer.js.map | 1 + .../components/bottomSheetContainer/index.js | 16 + .../bottomSheetContainer/index.js.map | 1 + .../components/bottomSheetContainer/styles.js | 16 + .../bottomSheetContainer/styles.js.map | 1 + .../bottomSheetContainer/styles.web.js | 22 + .../bottomSheetContainer/styles.web.js.map | 1 + .../BottomSheetDraggableView.js | 94 ++ .../BottomSheetDraggableView.js.map | 1 + .../bottomSheetDraggableView/index.js | 16 + .../bottomSheetDraggableView/index.js.map | 1 + .../bottomSheetFooter/BottomSheetFooter.js | 75 ++ .../BottomSheetFooter.js.map | 1 + .../components/bottomSheetFooter/index.js | 16 + .../components/bottomSheetFooter/index.js.map | 1 + .../components/bottomSheetFooter/styles.js | 21 + .../bottomSheetFooter/styles.js.map | 1 + .../BottomSheetFooterContainer.js | 55 + .../BottomSheetFooterContainer.js.map | 1 + .../BottomSheetGestureHandlersProvider.js | 60 + .../BottomSheetGestureHandlersProvider.js.map | 1 + .../index.js | 16 + .../index.js.map | 1 + .../bottomSheetHandle/BottomSheetHandle.js | 40 + .../BottomSheetHandle.js.map | 1 + .../components/bottomSheetHandle/index.js | 16 + .../components/bottomSheetHandle/index.js.map | 1 + .../components/bottomSheetHandle/styles.js | 26 + .../bottomSheetHandle/styles.js.map | 1 + .../BottomSheetHandleContainer.js | 117 ++ .../BottomSheetHandleContainer.js.map | 1 + .../bottomSheetHandleContainer/index.js | 16 + .../bottomSheetHandleContainer/index.js.map | 1 + .../bottomSheetModal/BottomSheetModal.js | 384 ++++++ .../bottomSheetModal/BottomSheetModal.js.map | 1 + .../components/bottomSheetModal/constants.js | 11 + .../bottomSheetModal/constants.js.map | 1 + .../components/bottomSheetModal/index.js | 16 + .../components/bottomSheetModal/index.js.map | 1 + .../BottomSheetModalProvider.js | 198 +++ .../BottomSheetModalProvider.js.map | 1 + .../bottomSheetModalProvider/index.js | 16 + .../bottomSheetModalProvider/index.js.map | 1 + .../BottomSheetRefreshControl.android.js | 53 + .../BottomSheetRefreshControl.android.js.map | 1 + .../BottomSheetRefreshControl.js | 11 + .../BottomSheetRefreshControl.js.map | 1 + .../bottomSheetRefreshControl/index.js | 14 + .../bottomSheetRefreshControl/index.js.map | 1 + .../BottomSheetFlatList.js | 27 + .../BottomSheetFlatList.js.map | 1 + .../BottomSheetScrollView.js | 27 + .../BottomSheetScrollView.js.map | 1 + .../BottomSheetSectionList.js | 27 + .../BottomSheetSectionList.js.map | 1 + .../BottomSheetVirtualizedList.js | 27 + .../BottomSheetVirtualizedList.js.map | 1 + .../createBottomSheetScrollableComponent.js | 163 +++ ...reateBottomSheetScrollableComponent.js.map | 1 + .../components/bottomSheetScrollable/index.js | 48 + .../bottomSheetScrollable/index.js.map | 1 + .../bottomSheetScrollable/styles.js | 18 + .../bottomSheetScrollable/styles.js.map | 1 + .../BottomSheetTextInput.js | 62 + .../BottomSheetTextInput.js.map | 1 + .../components/bottomSheetTextInput/index.js | 16 + .../bottomSheetTextInput/index.js.map | 1 + .../components/bottomSheetTextInput/types.js | 6 + .../bottomSheetTextInput/types.js.map | 1 + .../bottomSheetView/BottomSheetView.js | 91 ++ .../bottomSheetView/BottomSheetView.js.map | 1 + .../components/bottomSheetView/index.js | 16 + .../components/bottomSheetView/index.js.map | 1 + .../components/bottomSheetView/styles.js | 16 + .../components/bottomSheetView/styles.js.map | 1 + .../components/touchables/Touchables.ios.js | 26 + .../touchables/Touchables.ios.js.map | 1 + .../components/touchables/Touchables.js | 26 + .../components/touchables/Touchables.js.map | 1 + lib/commonjs/components/touchables/index.js | 16 + .../components/touchables/index.js.map | 1 + lib/commonjs/constants.js | 161 +++ lib/commonjs/constants.js.map | 1 + lib/commonjs/contexts/external.js | 14 + lib/commonjs/contexts/external.js.map | 1 + lib/commonjs/contexts/gesture.js | 12 + lib/commonjs/contexts/gesture.js.map | 1 + lib/commonjs/contexts/index.js | 70 + lib/commonjs/contexts/index.js.map | 1 + lib/commonjs/contexts/internal.js | 14 + lib/commonjs/contexts/internal.js.map | 1 + lib/commonjs/contexts/modal/external.js | 14 + lib/commonjs/contexts/modal/external.js.map | 1 + lib/commonjs/contexts/modal/internal.js | 14 + lib/commonjs/contexts/modal/internal.js.map | 1 + lib/commonjs/hooks/index.js | 134 ++ lib/commonjs/hooks/index.js.map | 1 + lib/commonjs/hooks/useBottomSheet.js | 23 + lib/commonjs/hooks/useBottomSheet.js.map | 1 + .../hooks/useBottomSheetDynamicSnapPoints.js | 64 + .../useBottomSheetDynamicSnapPoints.js.map | 1 + .../hooks/useBottomSheetGestureHandlers.js | 23 + .../useBottomSheetGestureHandlers.js.map | 1 + lib/commonjs/hooks/useBottomSheetInternal.js | 21 + .../hooks/useBottomSheetInternal.js.map | 1 + lib/commonjs/hooks/useBottomSheetModal.js | 23 + lib/commonjs/hooks/useBottomSheetModal.js.map | 1 + .../hooks/useBottomSheetModalInternal.js | 21 + .../hooks/useBottomSheetModalInternal.js.map | 1 + .../hooks/useBottomSheetSpringConfigs.js | 19 + .../hooks/useBottomSheetSpringConfigs.js.map | 1 + .../hooks/useBottomSheetTimingConfigs.js | 30 + .../hooks/useBottomSheetTimingConfigs.js.map | 1 + .../hooks/useGestureEventsHandlersDefault.js | 258 ++++ .../useGestureEventsHandlersDefault.js.map | 1 + lib/commonjs/hooks/useGestureHandler.js | 82 ++ lib/commonjs/hooks/useGestureHandler.js.map | 1 + lib/commonjs/hooks/useKeyboard.js | 100 ++ lib/commonjs/hooks/useKeyboard.js.map | 1 + lib/commonjs/hooks/useNormalizedSnapPoints.js | 58 + .../hooks/useNormalizedSnapPoints.js.map | 1 + lib/commonjs/hooks/usePropsValidator.js | 53 + lib/commonjs/hooks/usePropsValidator.js.map | 1 + lib/commonjs/hooks/useReactiveSharedValue.js | 55 + .../hooks/useReactiveSharedValue.js.map | 1 + .../hooks/useScrollEventsHandlersDefault.js | 111 ++ .../useScrollEventsHandlersDefault.js.map | 1 + lib/commonjs/hooks/useScrollHandler.js | 67 + lib/commonjs/hooks/useScrollHandler.js.map | 1 + lib/commonjs/hooks/useScrollable.js | 79 ++ lib/commonjs/hooks/useScrollable.js.map | 1 + lib/commonjs/hooks/useScrollableSetter.js | 52 + lib/commonjs/hooks/useScrollableSetter.js.map | 1 + lib/commonjs/hooks/useStableCallback.js | 25 + lib/commonjs/hooks/useStableCallback.js.map | 1 + lib/commonjs/index.js | 290 +++++ lib/commonjs/index.js.map | 1 + lib/commonjs/utilities/animate.js | 37 + lib/commonjs/utilities/animate.js.map | 1 + lib/commonjs/utilities/clamp.js | 15 + lib/commonjs/utilities/clamp.js.map | 1 + lib/commonjs/utilities/easingExp.js | 21 + lib/commonjs/utilities/easingExp.js.map | 1 + .../utilities/getKeyboardAnimationConfigs.js | 51 + .../getKeyboardAnimationConfigs.js.map | 1 + lib/commonjs/utilities/getRefNativeTag.js | 45 + lib/commonjs/utilities/getRefNativeTag.js.map | 1 + lib/commonjs/utilities/id.js | 15 + lib/commonjs/utilities/id.js.map | 1 + lib/commonjs/utilities/index.js | 52 + lib/commonjs/utilities/index.js.map | 1 + lib/commonjs/utilities/logger.js | 48 + lib/commonjs/utilities/logger.js.map | 1 + lib/commonjs/utilities/noop.js | 17 + lib/commonjs/utilities/noop.js.map | 1 + lib/commonjs/utilities/normalizeSnapPoint.js | 24 + .../utilities/normalizeSnapPoint.js.map | 1 + lib/commonjs/utilities/snapPoint.js | 18 + lib/commonjs/utilities/snapPoint.js.map | 1 + lib/commonjs/utilities/validateSnapPoint.js | 19 + .../utilities/validateSnapPoint.js.map | 1 + .../components/bottomSheet/BottomSheet.js | 1127 ++++++++++++++++ .../components/bottomSheet/BottomSheet.js.map | 1 + .../components/bottomSheet/constants.js | 30 + .../components/bottomSheet/constants.js.map | 1 + lib/module/components/bottomSheet/index.js | 2 + .../components/bottomSheet/index.js.map | 1 + lib/module/components/bottomSheet/styles.js | 15 + .../components/bottomSheet/styles.js.map | 1 + .../BottomSheetBackdrop.js | 91 ++ .../BottomSheetBackdrop.js.map | 1 + .../bottomSheetBackdrop/constants.js | 7 + .../bottomSheetBackdrop/constants.js.map | 1 + .../components/bottomSheetBackdrop/index.js | 2 + .../bottomSheetBackdrop/index.js.map | 1 + .../components/bottomSheetBackdrop/styles.js | 7 + .../bottomSheetBackdrop/styles.js.map | 1 + .../BottomSheetBackdropContainer.js | 19 + .../BottomSheetBackdropContainer.js.map | 1 + .../bottomSheetBackdropContainer/index.js | 2 + .../bottomSheetBackdropContainer/index.js.map | 1 + .../bottomSheetBackdropContainer/styles.js | 11 + .../styles.js.map | 1 + .../BottomSheetBackground.js | 19 + .../BottomSheetBackground.js.map | 1 + .../components/bottomSheetBackground/index.js | 2 + .../bottomSheetBackground/index.js.map | 1 + .../bottomSheetBackground/styles.js | 8 + .../bottomSheetBackground/styles.js.map | 1 + .../BottomSheetBackgroundContainer.js | 25 + .../BottomSheetBackgroundContainer.js.map | 1 + .../bottomSheetBackgroundContainer/index.js | 2 + .../index.js.map | 1 + .../bottomSheetBackgroundContainer/styles.js | 11 + .../styles.js.map | 1 + .../BottomSheetContainer.js | 69 + .../BottomSheetContainer.js.map | 1 + .../components/bottomSheetContainer/index.js | 2 + .../bottomSheetContainer/index.js.map | 1 + .../components/bottomSheetContainer/styles.js | 6 + .../bottomSheetContainer/styles.js.map | 1 + .../bottomSheetContainer/styles.web.js | 12 + .../bottomSheetContainer/styles.web.js.map | 1 + .../BottomSheetDraggableView.js | 76 ++ .../BottomSheetDraggableView.js.map | 1 + .../bottomSheetDraggableView/index.js | 2 + .../bottomSheetDraggableView/index.js.map | 1 + .../bottomSheetFooter/BottomSheetFooter.js | 59 + .../BottomSheetFooter.js.map | 1 + .../components/bottomSheetFooter/index.js | 2 + .../components/bottomSheetFooter/index.js.map | 1 + .../components/bottomSheetFooter/styles.js | 11 + .../bottomSheetFooter/styles.js.map | 1 + .../BottomSheetFooterContainer.js | 40 + .../BottomSheetFooterContainer.js.map | 1 + .../BottomSheetGestureHandlersProvider.js | 44 + .../BottomSheetGestureHandlersProvider.js.map | 1 + .../index.js | 2 + .../index.js.map | 1 + .../bottomSheetHandle/BottomSheetHandle.js | 24 + .../BottomSheetHandle.js.map | 1 + .../components/bottomSheetHandle/index.js | 2 + .../components/bottomSheetHandle/index.js.map | 1 + .../components/bottomSheetHandle/styles.js | 15 + .../bottomSheetHandle/styles.js.map | 1 + .../BottomSheetHandleContainer.js | 98 ++ .../BottomSheetHandleContainer.js.map | 1 + .../bottomSheetHandleContainer/index.js | 2 + .../bottomSheetHandleContainer/index.js.map | 1 + .../bottomSheetModal/BottomSheetModal.js | 363 ++++++ .../bottomSheetModal/BottomSheetModal.js.map | 1 + .../components/bottomSheetModal/constants.js | 4 + .../bottomSheetModal/constants.js.map | 1 + .../components/bottomSheetModal/index.js | 2 + .../components/bottomSheetModal/index.js.map | 1 + .../BottomSheetModalProvider.js | 178 +++ .../BottomSheetModalProvider.js.map | 1 + .../bottomSheetModalProvider/index.js | 2 + .../bottomSheetModalProvider/index.js.map | 1 + .../BottomSheetRefreshControl.android.js | 34 + .../BottomSheetRefreshControl.android.js.map | 1 + .../BottomSheetRefreshControl.js | 2 + .../BottomSheetRefreshControl.js.map | 1 + .../bottomSheetRefreshControl/index.js | 3 + .../bottomSheetRefreshControl/index.js.map | 1 + .../BottomSheetFlatList.js | 11 + .../BottomSheetFlatList.js.map | 1 + .../BottomSheetScrollView.js | 11 + .../BottomSheetScrollView.js.map | 1 + .../BottomSheetSectionList.js | 11 + .../BottomSheetSectionList.js.map | 1 + .../BottomSheetVirtualizedList.js | 11 + .../BottomSheetVirtualizedList.js.map | 1 + .../createBottomSheetScrollableComponent.js | 140 ++ ...reateBottomSheetScrollableComponent.js.map | 1 + .../components/bottomSheetScrollable/index.js | 6 + .../bottomSheetScrollable/index.js.map | 1 + .../bottomSheetScrollable/styles.js | 8 + .../bottomSheetScrollable/styles.js.map | 1 + .../BottomSheetTextInput.js | 47 + .../BottomSheetTextInput.js.map | 1 + .../components/bottomSheetTextInput/index.js | 2 + .../bottomSheetTextInput/index.js.map | 1 + .../components/bottomSheetTextInput/types.js | 2 + .../bottomSheetTextInput/types.js.map | 1 + .../bottomSheetView/BottomSheetView.js | 73 ++ .../bottomSheetView/BottomSheetView.js.map | 1 + .../components/bottomSheetView/index.js | 2 + .../components/bottomSheetView/index.js.map | 1 + .../components/bottomSheetView/styles.js | 6 + .../components/bottomSheetView/styles.js.map | 1 + .../components/touchables/Touchables.ios.js | 2 + .../touchables/Touchables.ios.js.map | 1 + .../components/touchables/Touchables.js | 2 + .../components/touchables/Touchables.js.map | 1 + lib/module/components/touchables/index.js | 8 + lib/module/components/touchables/index.js.map | 1 + lib/module/constants.js | 128 ++ lib/module/constants.js.map | 1 + lib/module/contexts/external.js | 4 + lib/module/contexts/external.js.map | 1 + lib/module/contexts/gesture.js | 3 + lib/module/contexts/gesture.js.map | 1 + lib/module/contexts/index.js | 6 + lib/module/contexts/index.js.map | 1 + lib/module/contexts/internal.js | 4 + lib/module/contexts/internal.js.map | 1 + lib/module/contexts/modal/external.js | 4 + lib/module/contexts/modal/external.js.map | 1 + lib/module/contexts/modal/internal.js | 4 + lib/module/contexts/modal/internal.js.map | 1 + lib/module/hooks/index.js | 21 + lib/module/hooks/index.js.map | 1 + lib/module/hooks/useBottomSheet.js | 12 + lib/module/hooks/useBottomSheet.js.map | 1 + .../hooks/useBottomSheetDynamicSnapPoints.js | 53 + .../useBottomSheetDynamicSnapPoints.js.map | 1 + .../hooks/useBottomSheetGestureHandlers.js | 12 + .../useBottomSheetGestureHandlers.js.map | 1 + lib/module/hooks/useBottomSheetInternal.js | 12 + .../hooks/useBottomSheetInternal.js.map | 1 + lib/module/hooks/useBottomSheetModal.js | 12 + lib/module/hooks/useBottomSheetModal.js.map | 1 + .../hooks/useBottomSheetModalInternal.js | 12 + .../hooks/useBottomSheetModalInternal.js.map | 1 + .../hooks/useBottomSheetSpringConfigs.js | 10 + .../hooks/useBottomSheetSpringConfigs.js.map | 1 + .../hooks/useBottomSheetTimingConfigs.js | 20 + .../hooks/useBottomSheetTimingConfigs.js.map | 1 + .../hooks/useGestureEventsHandlersDefault.js | 242 ++++ .../useGestureEventsHandlersDefault.js.map | 1 + lib/module/hooks/useGestureHandler.js | 71 + lib/module/hooks/useGestureHandler.js.map | 1 + lib/module/hooks/useKeyboard.js | 84 ++ lib/module/hooks/useKeyboard.js.map | 1 + lib/module/hooks/useNormalizedSnapPoints.js | 47 + .../hooks/useNormalizedSnapPoints.js.map | 1 + lib/module/hooks/usePropsValidator.js | 40 + lib/module/hooks/usePropsValidator.js.map | 1 + lib/module/hooks/useReactiveSharedValue.js | 44 + .../hooks/useReactiveSharedValue.js.map | 1 + .../hooks/useScrollEventsHandlersDefault.js | 99 ++ .../useScrollEventsHandlersDefault.js.map | 1 + lib/module/hooks/useScrollHandler.js | 55 + lib/module/hooks/useScrollHandler.js.map | 1 + lib/module/hooks/useScrollable.js | 66 + lib/module/hooks/useScrollable.js.map | 1 + lib/module/hooks/useScrollableSetter.js | 40 + lib/module/hooks/useScrollableSetter.js.map | 1 + lib/module/hooks/useStableCallback.js | 16 + lib/module/hooks/useStableCallback.js.map | 1 + lib/module/index.js | 44 + lib/module/index.js.map | 1 + lib/module/utilities/animate.js | 26 + lib/module/utilities/animate.js.map | 1 + lib/module/utilities/clamp.js | 6 + lib/module/utilities/clamp.js.map | 1 + lib/module/utilities/easingExp.js | 12 + lib/module/utilities/easingExp.js.map | 1 + .../utilities/getKeyboardAnimationConfigs.js | 41 + .../getKeyboardAnimationConfigs.js.map | 1 + lib/module/utilities/getRefNativeTag.js | 38 + lib/module/utilities/getRefNativeTag.js.map | 1 + lib/module/utilities/id.js | 6 + lib/module/utilities/id.js.map | 1 + lib/module/utilities/index.js | 6 + lib/module/utilities/index.js.map | 1 + lib/module/utilities/logger.js | 39 + lib/module/utilities/logger.js.map | 1 + lib/module/utilities/noop.js | 8 + lib/module/utilities/noop.js.map | 1 + lib/module/utilities/normalizeSnapPoint.js | 15 + .../utilities/normalizeSnapPoint.js.map | 1 + lib/module/utilities/snapPoint.js | 9 + lib/module/utilities/snapPoint.js.map | 1 + lib/module/utilities/validateSnapPoint.js | 7 + lib/module/utilities/validateSnapPoint.js.map | 1 + .../components/bottomSheet/BottomSheet.d.ts | 6 + .../components/bottomSheet/constants.d.ts | 23 + .../components/bottomSheet/index.d.ts | 2 + .../components/bottomSheet/styles.d.ts | 13 + .../components/bottomSheet/types.d.ts | 334 +++++ .../BottomSheetBackdrop.d.ts | 4 + .../bottomSheetBackdrop/constants.d.ts | 6 + .../components/bottomSheetBackdrop/index.d.ts | 2 + .../bottomSheetBackdrop/styles.d.ts | 5 + .../components/bottomSheetBackdrop/types.d.ts | 53 + .../BottomSheetBackdropContainer.d.ts | 4 + .../bottomSheetBackdropContainer/index.d.ts | 1 + .../bottomSheetBackdropContainer/styles.d.ts | 9 + .../bottomSheetBackdropContainer/types.d.ts | 6 + .../BottomSheetBackground.d.ts | 4 + .../bottomSheetBackground/index.d.ts | 2 + .../bottomSheetBackground/styles.d.ts | 6 + .../bottomSheetBackground/types.d.ts | 6 + .../BottomSheetBackgroundContainer.d.ts | 4 + .../bottomSheetBackgroundContainer/index.d.ts | 1 + .../styles.d.ts | 9 + .../bottomSheetBackgroundContainer/types.d.ts | 6 + .../BottomSheetContainer.d.ts | 5 + .../bottomSheetContainer/index.d.ts | 2 + .../bottomSheetContainer/styles.d.ts | 9 + .../bottomSheetContainer/styles.web.d.ts | 10 + .../bottomSheetContainer/types.d.ts | 15 + .../BottomSheetDraggableView.d.ts | 4 + .../bottomSheetDraggableView/index.d.ts | 1 + .../bottomSheetDraggableView/types.d.ts | 17 + .../bottomSheetFooter/BottomSheetFooter.d.ts | 5 + .../components/bottomSheetFooter/index.d.ts | 2 + .../components/bottomSheetFooter/styles.d.ts | 9 + .../components/bottomSheetFooter/types.d.ts | 37 + .../BottomSheetFooterContainer.d.ts | 4 + .../bottomSheetFooterContainer/types.d.ts | 4 + .../BottomSheetGestureHandlersProvider.d.ts | 3 + .../index.d.ts | 1 + .../types.d.ts | 7 + .../bottomSheetHandle/BottomSheetHandle.d.ts | 4 + .../components/bottomSheetHandle/index.d.ts | 2 + .../components/bottomSheetHandle/styles.d.ts | 12 + .../components/bottomSheetHandle/types.d.ts | 27 + .../BottomSheetHandleContainer.d.ts | 5 + .../bottomSheetHandleContainer/index.d.ts | 1 + .../bottomSheetHandleContainer/types.d.ts | 25 + .../bottomSheetModal/BottomSheetModal.d.ts | 6 + .../bottomSheetModal/constants.d.ts | 3 + .../components/bottomSheetModal/index.d.ts | 2 + .../components/bottomSheetModal/types.d.ts | 61 + .../BottomSheetModalProvider.d.ts | 3 + .../bottomSheetModalProvider/index.d.ts | 1 + .../bottomSheetModalProvider/types.d.ts | 14 + .../BottomSheetRefreshControl.android.d.ts | 4 + .../BottomSheetRefreshControl.d.ts | 2 + .../bottomSheetRefreshControl/index.d.ts | 7 + .../BottomSheetFlatList.d.ts | 5 + .../BottomSheetScrollView.d.ts | 5 + .../BottomSheetSectionList.d.ts | 6 + .../BottomSheetVirtualizedList.d.ts | 5 + .../createBottomSheetScrollableComponent.d.ts | 3 + .../bottomSheetScrollable/index.d.ts | 6 + .../bottomSheetScrollable/styles.d.ts | 6 + .../bottomSheetScrollable/types.d.ts | 276 ++++ .../BottomSheetTextInput.d.ts | 4 + .../bottomSheetTextInput/index.d.ts | 2 + .../bottomSheetTextInput/types.d.ts | 3 + .../bottomSheetView/BottomSheetView.d.ts | 5 + .../components/bottomSheetView/index.d.ts | 1 + .../components/bottomSheetView/styles.d.ts | 3 + .../components/bottomSheetView/types.d.ts | 24 + .../components/touchables/Touchables.d.ts | 1 + .../components/touchables/Touchables.ios.d.ts | 1 + .../components/touchables/index.d.ts | 7 + lib/typescript/constants.d.ts | 90 ++ lib/typescript/contexts/external.d.ts | 4 + lib/typescript/contexts/gesture.d.ts | 8 + lib/typescript/contexts/index.d.ts | 6 + lib/typescript/contexts/internal.d.ts | 38 + lib/typescript/contexts/modal/external.d.ts | 7 + lib/typescript/contexts/modal/internal.d.ts | 14 + lib/typescript/hooks/index.d.ts | 16 + lib/typescript/hooks/useBottomSheet.d.ts | 1 + .../useBottomSheetDynamicSnapPoints.d.ts | 29 + .../hooks/useBottomSheetGestureHandlers.d.ts | 1 + .../hooks/useBottomSheetInternal.d.ts | 3 + lib/typescript/hooks/useBottomSheetModal.d.ts | 1 + .../hooks/useBottomSheetModalInternal.d.ts | 3 + .../hooks/useBottomSheetSpringConfigs.d.ts | 6 + .../hooks/useBottomSheetTimingConfigs.d.ts | 9 + .../useGestureEventsHandlersDefault.d.ts | 2 + lib/typescript/hooks/useGestureHandler.d.ts | 5 + lib/typescript/hooks/useKeyboard.d.ts | 10 + .../hooks/useNormalizedSnapPoints.d.ts | 14 + lib/typescript/hooks/usePropsValidator.d.ts | 6 + .../hooks/useReactiveSharedValue.d.ts | 3 + .../hooks/useScrollEventsHandlersDefault.d.ts | 6 + lib/typescript/hooks/useScrollHandler.d.ts | 8 + lib/typescript/hooks/useScrollable.d.ts | 13 + lib/typescript/hooks/useScrollableSetter.d.ts | 5 + lib/typescript/hooks/useStableCallback.d.ts | 7 + lib/typescript/index.d.ts | 35 + lib/typescript/types.d.ts | 165 +++ lib/typescript/utilities/animate.d.ts | 9 + lib/typescript/utilities/clamp.d.ts | 1 + lib/typescript/utilities/easingExp.d.ts | 7 + .../getKeyboardAnimationConfigs.d.ts | 20 + lib/typescript/utilities/getRefNativeTag.d.ts | 1 + lib/typescript/utilities/id.d.ts | 1 + lib/typescript/utilities/index.d.ts | 5 + lib/typescript/utilities/logger.d.ts | 9 + lib/typescript/utilities/noop.d.ts | 3 + .../utilities/normalizeSnapPoint.d.ts | 4 + lib/typescript/utilities/snapPoint.d.ts | 1 + .../utilities/validateSnapPoint.d.ts | 1 + 508 files changed, 12008 insertions(+), 1 deletion(-) create mode 100644 lib/commonjs/components/bottomSheet/BottomSheet.js create mode 100644 lib/commonjs/components/bottomSheet/BottomSheet.js.map create mode 100644 lib/commonjs/components/bottomSheet/constants.js create mode 100644 lib/commonjs/components/bottomSheet/constants.js.map create mode 100644 lib/commonjs/components/bottomSheet/index.js create mode 100644 lib/commonjs/components/bottomSheet/index.js.map create mode 100644 lib/commonjs/components/bottomSheet/styles.js create mode 100644 lib/commonjs/components/bottomSheet/styles.js.map create mode 100644 lib/commonjs/components/bottomSheetBackdrop/BottomSheetBackdrop.js create mode 100644 lib/commonjs/components/bottomSheetBackdrop/BottomSheetBackdrop.js.map create mode 100644 lib/commonjs/components/bottomSheetBackdrop/constants.js create mode 100644 lib/commonjs/components/bottomSheetBackdrop/constants.js.map create mode 100644 lib/commonjs/components/bottomSheetBackdrop/index.js create mode 100644 lib/commonjs/components/bottomSheetBackdrop/index.js.map create mode 100644 lib/commonjs/components/bottomSheetBackdrop/styles.js create mode 100644 lib/commonjs/components/bottomSheetBackdrop/styles.js.map create mode 100644 lib/commonjs/components/bottomSheetBackdropContainer/BottomSheetBackdropContainer.js create mode 100644 lib/commonjs/components/bottomSheetBackdropContainer/BottomSheetBackdropContainer.js.map create mode 100644 lib/commonjs/components/bottomSheetBackdropContainer/index.js create mode 100644 lib/commonjs/components/bottomSheetBackdropContainer/index.js.map create mode 100644 lib/commonjs/components/bottomSheetBackdropContainer/styles.js create mode 100644 lib/commonjs/components/bottomSheetBackdropContainer/styles.js.map create mode 100644 lib/commonjs/components/bottomSheetBackground/BottomSheetBackground.js create mode 100644 lib/commonjs/components/bottomSheetBackground/BottomSheetBackground.js.map create mode 100644 lib/commonjs/components/bottomSheetBackground/index.js create mode 100644 lib/commonjs/components/bottomSheetBackground/index.js.map create mode 100644 lib/commonjs/components/bottomSheetBackground/styles.js create mode 100644 lib/commonjs/components/bottomSheetBackground/styles.js.map create mode 100644 lib/commonjs/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.js create mode 100644 lib/commonjs/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.js.map create mode 100644 lib/commonjs/components/bottomSheetBackgroundContainer/index.js create mode 100644 lib/commonjs/components/bottomSheetBackgroundContainer/index.js.map create mode 100644 lib/commonjs/components/bottomSheetBackgroundContainer/styles.js create mode 100644 lib/commonjs/components/bottomSheetBackgroundContainer/styles.js.map create mode 100644 lib/commonjs/components/bottomSheetContainer/BottomSheetContainer.js create mode 100644 lib/commonjs/components/bottomSheetContainer/BottomSheetContainer.js.map create mode 100644 lib/commonjs/components/bottomSheetContainer/index.js create mode 100644 lib/commonjs/components/bottomSheetContainer/index.js.map create mode 100644 lib/commonjs/components/bottomSheetContainer/styles.js create mode 100644 lib/commonjs/components/bottomSheetContainer/styles.js.map create mode 100644 lib/commonjs/components/bottomSheetContainer/styles.web.js create mode 100644 lib/commonjs/components/bottomSheetContainer/styles.web.js.map create mode 100644 lib/commonjs/components/bottomSheetDraggableView/BottomSheetDraggableView.js create mode 100644 lib/commonjs/components/bottomSheetDraggableView/BottomSheetDraggableView.js.map create mode 100644 lib/commonjs/components/bottomSheetDraggableView/index.js create mode 100644 lib/commonjs/components/bottomSheetDraggableView/index.js.map create mode 100644 lib/commonjs/components/bottomSheetFooter/BottomSheetFooter.js create mode 100644 lib/commonjs/components/bottomSheetFooter/BottomSheetFooter.js.map create mode 100644 lib/commonjs/components/bottomSheetFooter/index.js create mode 100644 lib/commonjs/components/bottomSheetFooter/index.js.map create mode 100644 lib/commonjs/components/bottomSheetFooter/styles.js create mode 100644 lib/commonjs/components/bottomSheetFooter/styles.js.map create mode 100644 lib/commonjs/components/bottomSheetFooterContainer/BottomSheetFooterContainer.js create mode 100644 lib/commonjs/components/bottomSheetFooterContainer/BottomSheetFooterContainer.js.map create mode 100644 lib/commonjs/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.js create mode 100644 lib/commonjs/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.js.map create mode 100644 lib/commonjs/components/bottomSheetGestureHandlersProvider/index.js create mode 100644 lib/commonjs/components/bottomSheetGestureHandlersProvider/index.js.map create mode 100644 lib/commonjs/components/bottomSheetHandle/BottomSheetHandle.js create mode 100644 lib/commonjs/components/bottomSheetHandle/BottomSheetHandle.js.map create mode 100644 lib/commonjs/components/bottomSheetHandle/index.js create mode 100644 lib/commonjs/components/bottomSheetHandle/index.js.map create mode 100644 lib/commonjs/components/bottomSheetHandle/styles.js create mode 100644 lib/commonjs/components/bottomSheetHandle/styles.js.map create mode 100644 lib/commonjs/components/bottomSheetHandleContainer/BottomSheetHandleContainer.js create mode 100644 lib/commonjs/components/bottomSheetHandleContainer/BottomSheetHandleContainer.js.map create mode 100644 lib/commonjs/components/bottomSheetHandleContainer/index.js create mode 100644 lib/commonjs/components/bottomSheetHandleContainer/index.js.map create mode 100644 lib/commonjs/components/bottomSheetModal/BottomSheetModal.js create mode 100644 lib/commonjs/components/bottomSheetModal/BottomSheetModal.js.map create mode 100644 lib/commonjs/components/bottomSheetModal/constants.js create mode 100644 lib/commonjs/components/bottomSheetModal/constants.js.map create mode 100644 lib/commonjs/components/bottomSheetModal/index.js create mode 100644 lib/commonjs/components/bottomSheetModal/index.js.map create mode 100644 lib/commonjs/components/bottomSheetModalProvider/BottomSheetModalProvider.js create mode 100644 lib/commonjs/components/bottomSheetModalProvider/BottomSheetModalProvider.js.map create mode 100644 lib/commonjs/components/bottomSheetModalProvider/index.js create mode 100644 lib/commonjs/components/bottomSheetModalProvider/index.js.map create mode 100644 lib/commonjs/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.js create mode 100644 lib/commonjs/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.js.map create mode 100644 lib/commonjs/components/bottomSheetRefreshControl/BottomSheetRefreshControl.js create mode 100644 lib/commonjs/components/bottomSheetRefreshControl/BottomSheetRefreshControl.js.map create mode 100644 lib/commonjs/components/bottomSheetRefreshControl/index.js create mode 100644 lib/commonjs/components/bottomSheetRefreshControl/index.js.map create mode 100644 lib/commonjs/components/bottomSheetScrollable/BottomSheetFlatList.js create mode 100644 lib/commonjs/components/bottomSheetScrollable/BottomSheetFlatList.js.map create mode 100644 lib/commonjs/components/bottomSheetScrollable/BottomSheetScrollView.js create mode 100644 lib/commonjs/components/bottomSheetScrollable/BottomSheetScrollView.js.map create mode 100644 lib/commonjs/components/bottomSheetScrollable/BottomSheetSectionList.js create mode 100644 lib/commonjs/components/bottomSheetScrollable/BottomSheetSectionList.js.map create mode 100644 lib/commonjs/components/bottomSheetScrollable/BottomSheetVirtualizedList.js create mode 100644 lib/commonjs/components/bottomSheetScrollable/BottomSheetVirtualizedList.js.map create mode 100644 lib/commonjs/components/bottomSheetScrollable/createBottomSheetScrollableComponent.js create mode 100644 lib/commonjs/components/bottomSheetScrollable/createBottomSheetScrollableComponent.js.map create mode 100644 lib/commonjs/components/bottomSheetScrollable/index.js create mode 100644 lib/commonjs/components/bottomSheetScrollable/index.js.map create mode 100644 lib/commonjs/components/bottomSheetScrollable/styles.js create mode 100644 lib/commonjs/components/bottomSheetScrollable/styles.js.map create mode 100644 lib/commonjs/components/bottomSheetTextInput/BottomSheetTextInput.js create mode 100644 lib/commonjs/components/bottomSheetTextInput/BottomSheetTextInput.js.map create mode 100644 lib/commonjs/components/bottomSheetTextInput/index.js create mode 100644 lib/commonjs/components/bottomSheetTextInput/index.js.map create mode 100644 lib/commonjs/components/bottomSheetTextInput/types.js create mode 100644 lib/commonjs/components/bottomSheetTextInput/types.js.map create mode 100644 lib/commonjs/components/bottomSheetView/BottomSheetView.js create mode 100644 lib/commonjs/components/bottomSheetView/BottomSheetView.js.map create mode 100644 lib/commonjs/components/bottomSheetView/index.js create mode 100644 lib/commonjs/components/bottomSheetView/index.js.map create mode 100644 lib/commonjs/components/bottomSheetView/styles.js create mode 100644 lib/commonjs/components/bottomSheetView/styles.js.map create mode 100644 lib/commonjs/components/touchables/Touchables.ios.js create mode 100644 lib/commonjs/components/touchables/Touchables.ios.js.map create mode 100644 lib/commonjs/components/touchables/Touchables.js create mode 100644 lib/commonjs/components/touchables/Touchables.js.map create mode 100644 lib/commonjs/components/touchables/index.js create mode 100644 lib/commonjs/components/touchables/index.js.map create mode 100644 lib/commonjs/constants.js create mode 100644 lib/commonjs/constants.js.map create mode 100644 lib/commonjs/contexts/external.js create mode 100644 lib/commonjs/contexts/external.js.map create mode 100644 lib/commonjs/contexts/gesture.js create mode 100644 lib/commonjs/contexts/gesture.js.map create mode 100644 lib/commonjs/contexts/index.js create mode 100644 lib/commonjs/contexts/index.js.map create mode 100644 lib/commonjs/contexts/internal.js create mode 100644 lib/commonjs/contexts/internal.js.map create mode 100644 lib/commonjs/contexts/modal/external.js create mode 100644 lib/commonjs/contexts/modal/external.js.map create mode 100644 lib/commonjs/contexts/modal/internal.js create mode 100644 lib/commonjs/contexts/modal/internal.js.map create mode 100644 lib/commonjs/hooks/index.js create mode 100644 lib/commonjs/hooks/index.js.map create mode 100644 lib/commonjs/hooks/useBottomSheet.js create mode 100644 lib/commonjs/hooks/useBottomSheet.js.map create mode 100644 lib/commonjs/hooks/useBottomSheetDynamicSnapPoints.js create mode 100644 lib/commonjs/hooks/useBottomSheetDynamicSnapPoints.js.map create mode 100644 lib/commonjs/hooks/useBottomSheetGestureHandlers.js create mode 100644 lib/commonjs/hooks/useBottomSheetGestureHandlers.js.map create mode 100644 lib/commonjs/hooks/useBottomSheetInternal.js create mode 100644 lib/commonjs/hooks/useBottomSheetInternal.js.map create mode 100644 lib/commonjs/hooks/useBottomSheetModal.js create mode 100644 lib/commonjs/hooks/useBottomSheetModal.js.map create mode 100644 lib/commonjs/hooks/useBottomSheetModalInternal.js create mode 100644 lib/commonjs/hooks/useBottomSheetModalInternal.js.map create mode 100644 lib/commonjs/hooks/useBottomSheetSpringConfigs.js create mode 100644 lib/commonjs/hooks/useBottomSheetSpringConfigs.js.map create mode 100644 lib/commonjs/hooks/useBottomSheetTimingConfigs.js create mode 100644 lib/commonjs/hooks/useBottomSheetTimingConfigs.js.map create mode 100644 lib/commonjs/hooks/useGestureEventsHandlersDefault.js create mode 100644 lib/commonjs/hooks/useGestureEventsHandlersDefault.js.map create mode 100644 lib/commonjs/hooks/useGestureHandler.js create mode 100644 lib/commonjs/hooks/useGestureHandler.js.map create mode 100644 lib/commonjs/hooks/useKeyboard.js create mode 100644 lib/commonjs/hooks/useKeyboard.js.map create mode 100644 lib/commonjs/hooks/useNormalizedSnapPoints.js create mode 100644 lib/commonjs/hooks/useNormalizedSnapPoints.js.map create mode 100644 lib/commonjs/hooks/usePropsValidator.js create mode 100644 lib/commonjs/hooks/usePropsValidator.js.map create mode 100644 lib/commonjs/hooks/useReactiveSharedValue.js create mode 100644 lib/commonjs/hooks/useReactiveSharedValue.js.map create mode 100644 lib/commonjs/hooks/useScrollEventsHandlersDefault.js create mode 100644 lib/commonjs/hooks/useScrollEventsHandlersDefault.js.map create mode 100644 lib/commonjs/hooks/useScrollHandler.js create mode 100644 lib/commonjs/hooks/useScrollHandler.js.map create mode 100644 lib/commonjs/hooks/useScrollable.js create mode 100644 lib/commonjs/hooks/useScrollable.js.map create mode 100644 lib/commonjs/hooks/useScrollableSetter.js create mode 100644 lib/commonjs/hooks/useScrollableSetter.js.map create mode 100644 lib/commonjs/hooks/useStableCallback.js create mode 100644 lib/commonjs/hooks/useStableCallback.js.map create mode 100644 lib/commonjs/index.js create mode 100644 lib/commonjs/index.js.map create mode 100644 lib/commonjs/utilities/animate.js create mode 100644 lib/commonjs/utilities/animate.js.map create mode 100644 lib/commonjs/utilities/clamp.js create mode 100644 lib/commonjs/utilities/clamp.js.map create mode 100644 lib/commonjs/utilities/easingExp.js create mode 100644 lib/commonjs/utilities/easingExp.js.map create mode 100644 lib/commonjs/utilities/getKeyboardAnimationConfigs.js create mode 100644 lib/commonjs/utilities/getKeyboardAnimationConfigs.js.map create mode 100644 lib/commonjs/utilities/getRefNativeTag.js create mode 100644 lib/commonjs/utilities/getRefNativeTag.js.map create mode 100644 lib/commonjs/utilities/id.js create mode 100644 lib/commonjs/utilities/id.js.map create mode 100644 lib/commonjs/utilities/index.js create mode 100644 lib/commonjs/utilities/index.js.map create mode 100644 lib/commonjs/utilities/logger.js create mode 100644 lib/commonjs/utilities/logger.js.map create mode 100644 lib/commonjs/utilities/noop.js create mode 100644 lib/commonjs/utilities/noop.js.map create mode 100644 lib/commonjs/utilities/normalizeSnapPoint.js create mode 100644 lib/commonjs/utilities/normalizeSnapPoint.js.map create mode 100644 lib/commonjs/utilities/snapPoint.js create mode 100644 lib/commonjs/utilities/snapPoint.js.map create mode 100644 lib/commonjs/utilities/validateSnapPoint.js create mode 100644 lib/commonjs/utilities/validateSnapPoint.js.map create mode 100644 lib/module/components/bottomSheet/BottomSheet.js create mode 100644 lib/module/components/bottomSheet/BottomSheet.js.map create mode 100644 lib/module/components/bottomSheet/constants.js create mode 100644 lib/module/components/bottomSheet/constants.js.map create mode 100644 lib/module/components/bottomSheet/index.js create mode 100644 lib/module/components/bottomSheet/index.js.map create mode 100644 lib/module/components/bottomSheet/styles.js create mode 100644 lib/module/components/bottomSheet/styles.js.map create mode 100644 lib/module/components/bottomSheetBackdrop/BottomSheetBackdrop.js create mode 100644 lib/module/components/bottomSheetBackdrop/BottomSheetBackdrop.js.map create mode 100644 lib/module/components/bottomSheetBackdrop/constants.js create mode 100644 lib/module/components/bottomSheetBackdrop/constants.js.map create mode 100644 lib/module/components/bottomSheetBackdrop/index.js create mode 100644 lib/module/components/bottomSheetBackdrop/index.js.map create mode 100644 lib/module/components/bottomSheetBackdrop/styles.js create mode 100644 lib/module/components/bottomSheetBackdrop/styles.js.map create mode 100644 lib/module/components/bottomSheetBackdropContainer/BottomSheetBackdropContainer.js create mode 100644 lib/module/components/bottomSheetBackdropContainer/BottomSheetBackdropContainer.js.map create mode 100644 lib/module/components/bottomSheetBackdropContainer/index.js create mode 100644 lib/module/components/bottomSheetBackdropContainer/index.js.map create mode 100644 lib/module/components/bottomSheetBackdropContainer/styles.js create mode 100644 lib/module/components/bottomSheetBackdropContainer/styles.js.map create mode 100644 lib/module/components/bottomSheetBackground/BottomSheetBackground.js create mode 100644 lib/module/components/bottomSheetBackground/BottomSheetBackground.js.map create mode 100644 lib/module/components/bottomSheetBackground/index.js create mode 100644 lib/module/components/bottomSheetBackground/index.js.map create mode 100644 lib/module/components/bottomSheetBackground/styles.js create mode 100644 lib/module/components/bottomSheetBackground/styles.js.map create mode 100644 lib/module/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.js create mode 100644 lib/module/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.js.map create mode 100644 lib/module/components/bottomSheetBackgroundContainer/index.js create mode 100644 lib/module/components/bottomSheetBackgroundContainer/index.js.map create mode 100644 lib/module/components/bottomSheetBackgroundContainer/styles.js create mode 100644 lib/module/components/bottomSheetBackgroundContainer/styles.js.map create mode 100644 lib/module/components/bottomSheetContainer/BottomSheetContainer.js create mode 100644 lib/module/components/bottomSheetContainer/BottomSheetContainer.js.map create mode 100644 lib/module/components/bottomSheetContainer/index.js create mode 100644 lib/module/components/bottomSheetContainer/index.js.map create mode 100644 lib/module/components/bottomSheetContainer/styles.js create mode 100644 lib/module/components/bottomSheetContainer/styles.js.map create mode 100644 lib/module/components/bottomSheetContainer/styles.web.js create mode 100644 lib/module/components/bottomSheetContainer/styles.web.js.map create mode 100644 lib/module/components/bottomSheetDraggableView/BottomSheetDraggableView.js create mode 100644 lib/module/components/bottomSheetDraggableView/BottomSheetDraggableView.js.map create mode 100644 lib/module/components/bottomSheetDraggableView/index.js create mode 100644 lib/module/components/bottomSheetDraggableView/index.js.map create mode 100644 lib/module/components/bottomSheetFooter/BottomSheetFooter.js create mode 100644 lib/module/components/bottomSheetFooter/BottomSheetFooter.js.map create mode 100644 lib/module/components/bottomSheetFooter/index.js create mode 100644 lib/module/components/bottomSheetFooter/index.js.map create mode 100644 lib/module/components/bottomSheetFooter/styles.js create mode 100644 lib/module/components/bottomSheetFooter/styles.js.map create mode 100644 lib/module/components/bottomSheetFooterContainer/BottomSheetFooterContainer.js create mode 100644 lib/module/components/bottomSheetFooterContainer/BottomSheetFooterContainer.js.map create mode 100644 lib/module/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.js create mode 100644 lib/module/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.js.map create mode 100644 lib/module/components/bottomSheetGestureHandlersProvider/index.js create mode 100644 lib/module/components/bottomSheetGestureHandlersProvider/index.js.map create mode 100644 lib/module/components/bottomSheetHandle/BottomSheetHandle.js create mode 100644 lib/module/components/bottomSheetHandle/BottomSheetHandle.js.map create mode 100644 lib/module/components/bottomSheetHandle/index.js create mode 100644 lib/module/components/bottomSheetHandle/index.js.map create mode 100644 lib/module/components/bottomSheetHandle/styles.js create mode 100644 lib/module/components/bottomSheetHandle/styles.js.map create mode 100644 lib/module/components/bottomSheetHandleContainer/BottomSheetHandleContainer.js create mode 100644 lib/module/components/bottomSheetHandleContainer/BottomSheetHandleContainer.js.map create mode 100644 lib/module/components/bottomSheetHandleContainer/index.js create mode 100644 lib/module/components/bottomSheetHandleContainer/index.js.map create mode 100644 lib/module/components/bottomSheetModal/BottomSheetModal.js create mode 100644 lib/module/components/bottomSheetModal/BottomSheetModal.js.map create mode 100644 lib/module/components/bottomSheetModal/constants.js create mode 100644 lib/module/components/bottomSheetModal/constants.js.map create mode 100644 lib/module/components/bottomSheetModal/index.js create mode 100644 lib/module/components/bottomSheetModal/index.js.map create mode 100644 lib/module/components/bottomSheetModalProvider/BottomSheetModalProvider.js create mode 100644 lib/module/components/bottomSheetModalProvider/BottomSheetModalProvider.js.map create mode 100644 lib/module/components/bottomSheetModalProvider/index.js create mode 100644 lib/module/components/bottomSheetModalProvider/index.js.map create mode 100644 lib/module/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.js create mode 100644 lib/module/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.js.map create mode 100644 lib/module/components/bottomSheetRefreshControl/BottomSheetRefreshControl.js create mode 100644 lib/module/components/bottomSheetRefreshControl/BottomSheetRefreshControl.js.map create mode 100644 lib/module/components/bottomSheetRefreshControl/index.js create mode 100644 lib/module/components/bottomSheetRefreshControl/index.js.map create mode 100644 lib/module/components/bottomSheetScrollable/BottomSheetFlatList.js create mode 100644 lib/module/components/bottomSheetScrollable/BottomSheetFlatList.js.map create mode 100644 lib/module/components/bottomSheetScrollable/BottomSheetScrollView.js create mode 100644 lib/module/components/bottomSheetScrollable/BottomSheetScrollView.js.map create mode 100644 lib/module/components/bottomSheetScrollable/BottomSheetSectionList.js create mode 100644 lib/module/components/bottomSheetScrollable/BottomSheetSectionList.js.map create mode 100644 lib/module/components/bottomSheetScrollable/BottomSheetVirtualizedList.js create mode 100644 lib/module/components/bottomSheetScrollable/BottomSheetVirtualizedList.js.map create mode 100644 lib/module/components/bottomSheetScrollable/createBottomSheetScrollableComponent.js create mode 100644 lib/module/components/bottomSheetScrollable/createBottomSheetScrollableComponent.js.map create mode 100644 lib/module/components/bottomSheetScrollable/index.js create mode 100644 lib/module/components/bottomSheetScrollable/index.js.map create mode 100644 lib/module/components/bottomSheetScrollable/styles.js create mode 100644 lib/module/components/bottomSheetScrollable/styles.js.map create mode 100644 lib/module/components/bottomSheetTextInput/BottomSheetTextInput.js create mode 100644 lib/module/components/bottomSheetTextInput/BottomSheetTextInput.js.map create mode 100644 lib/module/components/bottomSheetTextInput/index.js create mode 100644 lib/module/components/bottomSheetTextInput/index.js.map create mode 100644 lib/module/components/bottomSheetTextInput/types.js create mode 100644 lib/module/components/bottomSheetTextInput/types.js.map create mode 100644 lib/module/components/bottomSheetView/BottomSheetView.js create mode 100644 lib/module/components/bottomSheetView/BottomSheetView.js.map create mode 100644 lib/module/components/bottomSheetView/index.js create mode 100644 lib/module/components/bottomSheetView/index.js.map create mode 100644 lib/module/components/bottomSheetView/styles.js create mode 100644 lib/module/components/bottomSheetView/styles.js.map create mode 100644 lib/module/components/touchables/Touchables.ios.js create mode 100644 lib/module/components/touchables/Touchables.ios.js.map create mode 100644 lib/module/components/touchables/Touchables.js create mode 100644 lib/module/components/touchables/Touchables.js.map create mode 100644 lib/module/components/touchables/index.js create mode 100644 lib/module/components/touchables/index.js.map create mode 100644 lib/module/constants.js create mode 100644 lib/module/constants.js.map create mode 100644 lib/module/contexts/external.js create mode 100644 lib/module/contexts/external.js.map create mode 100644 lib/module/contexts/gesture.js create mode 100644 lib/module/contexts/gesture.js.map create mode 100644 lib/module/contexts/index.js create mode 100644 lib/module/contexts/index.js.map create mode 100644 lib/module/contexts/internal.js create mode 100644 lib/module/contexts/internal.js.map create mode 100644 lib/module/contexts/modal/external.js create mode 100644 lib/module/contexts/modal/external.js.map create mode 100644 lib/module/contexts/modal/internal.js create mode 100644 lib/module/contexts/modal/internal.js.map create mode 100644 lib/module/hooks/index.js create mode 100644 lib/module/hooks/index.js.map create mode 100644 lib/module/hooks/useBottomSheet.js create mode 100644 lib/module/hooks/useBottomSheet.js.map create mode 100644 lib/module/hooks/useBottomSheetDynamicSnapPoints.js create mode 100644 lib/module/hooks/useBottomSheetDynamicSnapPoints.js.map create mode 100644 lib/module/hooks/useBottomSheetGestureHandlers.js create mode 100644 lib/module/hooks/useBottomSheetGestureHandlers.js.map create mode 100644 lib/module/hooks/useBottomSheetInternal.js create mode 100644 lib/module/hooks/useBottomSheetInternal.js.map create mode 100644 lib/module/hooks/useBottomSheetModal.js create mode 100644 lib/module/hooks/useBottomSheetModal.js.map create mode 100644 lib/module/hooks/useBottomSheetModalInternal.js create mode 100644 lib/module/hooks/useBottomSheetModalInternal.js.map create mode 100644 lib/module/hooks/useBottomSheetSpringConfigs.js create mode 100644 lib/module/hooks/useBottomSheetSpringConfigs.js.map create mode 100644 lib/module/hooks/useBottomSheetTimingConfigs.js create mode 100644 lib/module/hooks/useBottomSheetTimingConfigs.js.map create mode 100644 lib/module/hooks/useGestureEventsHandlersDefault.js create mode 100644 lib/module/hooks/useGestureEventsHandlersDefault.js.map create mode 100644 lib/module/hooks/useGestureHandler.js create mode 100644 lib/module/hooks/useGestureHandler.js.map create mode 100644 lib/module/hooks/useKeyboard.js create mode 100644 lib/module/hooks/useKeyboard.js.map create mode 100644 lib/module/hooks/useNormalizedSnapPoints.js create mode 100644 lib/module/hooks/useNormalizedSnapPoints.js.map create mode 100644 lib/module/hooks/usePropsValidator.js create mode 100644 lib/module/hooks/usePropsValidator.js.map create mode 100644 lib/module/hooks/useReactiveSharedValue.js create mode 100644 lib/module/hooks/useReactiveSharedValue.js.map create mode 100644 lib/module/hooks/useScrollEventsHandlersDefault.js create mode 100644 lib/module/hooks/useScrollEventsHandlersDefault.js.map create mode 100644 lib/module/hooks/useScrollHandler.js create mode 100644 lib/module/hooks/useScrollHandler.js.map create mode 100644 lib/module/hooks/useScrollable.js create mode 100644 lib/module/hooks/useScrollable.js.map create mode 100644 lib/module/hooks/useScrollableSetter.js create mode 100644 lib/module/hooks/useScrollableSetter.js.map create mode 100644 lib/module/hooks/useStableCallback.js create mode 100644 lib/module/hooks/useStableCallback.js.map create mode 100644 lib/module/index.js create mode 100644 lib/module/index.js.map create mode 100644 lib/module/utilities/animate.js create mode 100644 lib/module/utilities/animate.js.map create mode 100644 lib/module/utilities/clamp.js create mode 100644 lib/module/utilities/clamp.js.map create mode 100644 lib/module/utilities/easingExp.js create mode 100644 lib/module/utilities/easingExp.js.map create mode 100644 lib/module/utilities/getKeyboardAnimationConfigs.js create mode 100644 lib/module/utilities/getKeyboardAnimationConfigs.js.map create mode 100644 lib/module/utilities/getRefNativeTag.js create mode 100644 lib/module/utilities/getRefNativeTag.js.map create mode 100644 lib/module/utilities/id.js create mode 100644 lib/module/utilities/id.js.map create mode 100644 lib/module/utilities/index.js create mode 100644 lib/module/utilities/index.js.map create mode 100644 lib/module/utilities/logger.js create mode 100644 lib/module/utilities/logger.js.map create mode 100644 lib/module/utilities/noop.js create mode 100644 lib/module/utilities/noop.js.map create mode 100644 lib/module/utilities/normalizeSnapPoint.js create mode 100644 lib/module/utilities/normalizeSnapPoint.js.map create mode 100644 lib/module/utilities/snapPoint.js create mode 100644 lib/module/utilities/snapPoint.js.map create mode 100644 lib/module/utilities/validateSnapPoint.js create mode 100644 lib/module/utilities/validateSnapPoint.js.map create mode 100644 lib/typescript/components/bottomSheet/BottomSheet.d.ts create mode 100644 lib/typescript/components/bottomSheet/constants.d.ts create mode 100644 lib/typescript/components/bottomSheet/index.d.ts create mode 100644 lib/typescript/components/bottomSheet/styles.d.ts create mode 100644 lib/typescript/components/bottomSheet/types.d.ts create mode 100644 lib/typescript/components/bottomSheetBackdrop/BottomSheetBackdrop.d.ts create mode 100644 lib/typescript/components/bottomSheetBackdrop/constants.d.ts create mode 100644 lib/typescript/components/bottomSheetBackdrop/index.d.ts create mode 100644 lib/typescript/components/bottomSheetBackdrop/styles.d.ts create mode 100644 lib/typescript/components/bottomSheetBackdrop/types.d.ts create mode 100644 lib/typescript/components/bottomSheetBackdropContainer/BottomSheetBackdropContainer.d.ts create mode 100644 lib/typescript/components/bottomSheetBackdropContainer/index.d.ts create mode 100644 lib/typescript/components/bottomSheetBackdropContainer/styles.d.ts create mode 100644 lib/typescript/components/bottomSheetBackdropContainer/types.d.ts create mode 100644 lib/typescript/components/bottomSheetBackground/BottomSheetBackground.d.ts create mode 100644 lib/typescript/components/bottomSheetBackground/index.d.ts create mode 100644 lib/typescript/components/bottomSheetBackground/styles.d.ts create mode 100644 lib/typescript/components/bottomSheetBackground/types.d.ts create mode 100644 lib/typescript/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.d.ts create mode 100644 lib/typescript/components/bottomSheetBackgroundContainer/index.d.ts create mode 100644 lib/typescript/components/bottomSheetBackgroundContainer/styles.d.ts create mode 100644 lib/typescript/components/bottomSheetBackgroundContainer/types.d.ts create mode 100644 lib/typescript/components/bottomSheetContainer/BottomSheetContainer.d.ts create mode 100644 lib/typescript/components/bottomSheetContainer/index.d.ts create mode 100644 lib/typescript/components/bottomSheetContainer/styles.d.ts create mode 100644 lib/typescript/components/bottomSheetContainer/styles.web.d.ts create mode 100644 lib/typescript/components/bottomSheetContainer/types.d.ts create mode 100644 lib/typescript/components/bottomSheetDraggableView/BottomSheetDraggableView.d.ts create mode 100644 lib/typescript/components/bottomSheetDraggableView/index.d.ts create mode 100644 lib/typescript/components/bottomSheetDraggableView/types.d.ts create mode 100644 lib/typescript/components/bottomSheetFooter/BottomSheetFooter.d.ts create mode 100644 lib/typescript/components/bottomSheetFooter/index.d.ts create mode 100644 lib/typescript/components/bottomSheetFooter/styles.d.ts create mode 100644 lib/typescript/components/bottomSheetFooter/types.d.ts create mode 100644 lib/typescript/components/bottomSheetFooterContainer/BottomSheetFooterContainer.d.ts create mode 100644 lib/typescript/components/bottomSheetFooterContainer/types.d.ts create mode 100644 lib/typescript/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.d.ts create mode 100644 lib/typescript/components/bottomSheetGestureHandlersProvider/index.d.ts create mode 100644 lib/typescript/components/bottomSheetGestureHandlersProvider/types.d.ts create mode 100644 lib/typescript/components/bottomSheetHandle/BottomSheetHandle.d.ts create mode 100644 lib/typescript/components/bottomSheetHandle/index.d.ts create mode 100644 lib/typescript/components/bottomSheetHandle/styles.d.ts create mode 100644 lib/typescript/components/bottomSheetHandle/types.d.ts create mode 100644 lib/typescript/components/bottomSheetHandleContainer/BottomSheetHandleContainer.d.ts create mode 100644 lib/typescript/components/bottomSheetHandleContainer/index.d.ts create mode 100644 lib/typescript/components/bottomSheetHandleContainer/types.d.ts create mode 100644 lib/typescript/components/bottomSheetModal/BottomSheetModal.d.ts create mode 100644 lib/typescript/components/bottomSheetModal/constants.d.ts create mode 100644 lib/typescript/components/bottomSheetModal/index.d.ts create mode 100644 lib/typescript/components/bottomSheetModal/types.d.ts create mode 100644 lib/typescript/components/bottomSheetModalProvider/BottomSheetModalProvider.d.ts create mode 100644 lib/typescript/components/bottomSheetModalProvider/index.d.ts create mode 100644 lib/typescript/components/bottomSheetModalProvider/types.d.ts create mode 100644 lib/typescript/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.d.ts create mode 100644 lib/typescript/components/bottomSheetRefreshControl/BottomSheetRefreshControl.d.ts create mode 100644 lib/typescript/components/bottomSheetRefreshControl/index.d.ts create mode 100644 lib/typescript/components/bottomSheetScrollable/BottomSheetFlatList.d.ts create mode 100644 lib/typescript/components/bottomSheetScrollable/BottomSheetScrollView.d.ts create mode 100644 lib/typescript/components/bottomSheetScrollable/BottomSheetSectionList.d.ts create mode 100644 lib/typescript/components/bottomSheetScrollable/BottomSheetVirtualizedList.d.ts create mode 100644 lib/typescript/components/bottomSheetScrollable/createBottomSheetScrollableComponent.d.ts create mode 100644 lib/typescript/components/bottomSheetScrollable/index.d.ts create mode 100644 lib/typescript/components/bottomSheetScrollable/styles.d.ts create mode 100644 lib/typescript/components/bottomSheetScrollable/types.d.ts create mode 100644 lib/typescript/components/bottomSheetTextInput/BottomSheetTextInput.d.ts create mode 100644 lib/typescript/components/bottomSheetTextInput/index.d.ts create mode 100644 lib/typescript/components/bottomSheetTextInput/types.d.ts create mode 100644 lib/typescript/components/bottomSheetView/BottomSheetView.d.ts create mode 100644 lib/typescript/components/bottomSheetView/index.d.ts create mode 100644 lib/typescript/components/bottomSheetView/styles.d.ts create mode 100644 lib/typescript/components/bottomSheetView/types.d.ts create mode 100644 lib/typescript/components/touchables/Touchables.d.ts create mode 100644 lib/typescript/components/touchables/Touchables.ios.d.ts create mode 100644 lib/typescript/components/touchables/index.d.ts create mode 100644 lib/typescript/constants.d.ts create mode 100644 lib/typescript/contexts/external.d.ts create mode 100644 lib/typescript/contexts/gesture.d.ts create mode 100644 lib/typescript/contexts/index.d.ts create mode 100644 lib/typescript/contexts/internal.d.ts create mode 100644 lib/typescript/contexts/modal/external.d.ts create mode 100644 lib/typescript/contexts/modal/internal.d.ts create mode 100644 lib/typescript/hooks/index.d.ts create mode 100644 lib/typescript/hooks/useBottomSheet.d.ts create mode 100644 lib/typescript/hooks/useBottomSheetDynamicSnapPoints.d.ts create mode 100644 lib/typescript/hooks/useBottomSheetGestureHandlers.d.ts create mode 100644 lib/typescript/hooks/useBottomSheetInternal.d.ts create mode 100644 lib/typescript/hooks/useBottomSheetModal.d.ts create mode 100644 lib/typescript/hooks/useBottomSheetModalInternal.d.ts create mode 100644 lib/typescript/hooks/useBottomSheetSpringConfigs.d.ts create mode 100644 lib/typescript/hooks/useBottomSheetTimingConfigs.d.ts create mode 100644 lib/typescript/hooks/useGestureEventsHandlersDefault.d.ts create mode 100644 lib/typescript/hooks/useGestureHandler.d.ts create mode 100644 lib/typescript/hooks/useKeyboard.d.ts create mode 100644 lib/typescript/hooks/useNormalizedSnapPoints.d.ts create mode 100644 lib/typescript/hooks/usePropsValidator.d.ts create mode 100644 lib/typescript/hooks/useReactiveSharedValue.d.ts create mode 100644 lib/typescript/hooks/useScrollEventsHandlersDefault.d.ts create mode 100644 lib/typescript/hooks/useScrollHandler.d.ts create mode 100644 lib/typescript/hooks/useScrollable.d.ts create mode 100644 lib/typescript/hooks/useScrollableSetter.d.ts create mode 100644 lib/typescript/hooks/useStableCallback.d.ts create mode 100644 lib/typescript/index.d.ts create mode 100644 lib/typescript/types.d.ts create mode 100644 lib/typescript/utilities/animate.d.ts create mode 100644 lib/typescript/utilities/clamp.d.ts create mode 100644 lib/typescript/utilities/easingExp.d.ts create mode 100644 lib/typescript/utilities/getKeyboardAnimationConfigs.d.ts create mode 100644 lib/typescript/utilities/getRefNativeTag.d.ts create mode 100644 lib/typescript/utilities/id.d.ts create mode 100644 lib/typescript/utilities/index.d.ts create mode 100644 lib/typescript/utilities/logger.d.ts create mode 100644 lib/typescript/utilities/noop.d.ts create mode 100644 lib/typescript/utilities/normalizeSnapPoint.d.ts create mode 100644 lib/typescript/utilities/snapPoint.d.ts create mode 100644 lib/typescript/utilities/validateSnapPoint.d.ts diff --git a/.gitignore b/.gitignore index 27dd6343a..1616285c4 100644 --- a/.gitignore +++ b/.gitignore @@ -56,4 +56,4 @@ android/app/libs android/keystores/debug.keystore # generated by bob -lib/ +#lib/ diff --git a/lib/commonjs/components/bottomSheet/BottomSheet.js b/lib/commonjs/components/bottomSheet/BottomSheet.js new file mode 100644 index 000000000..bdc5082a6 --- /dev/null +++ b/lib/commonjs/components/bottomSheet/BottomSheet.js @@ -0,0 +1,1160 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireWildcard(require("react")); + +var _reactNative = require("react-native"); + +var _invariant = _interopRequireDefault(require("invariant")); + +var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated")); + +var _reactNativeGestureHandler = require("react-native-gesture-handler"); + +var _hooks = require("../../hooks"); + +var _contexts = require("../../contexts"); + +var _bottomSheetContainer = _interopRequireDefault(require("../bottomSheetContainer")); + +var _bottomSheetGestureHandlersProvider = _interopRequireDefault(require("../bottomSheetGestureHandlersProvider")); + +var _bottomSheetBackdropContainer = _interopRequireDefault(require("../bottomSheetBackdropContainer")); + +var _bottomSheetHandleContainer = _interopRequireDefault(require("../bottomSheetHandleContainer")); + +var _bottomSheetBackgroundContainer = _interopRequireDefault(require("../bottomSheetBackgroundContainer")); + +var _BottomSheetFooterContainer = _interopRequireDefault(require("../bottomSheetFooterContainer/BottomSheetFooterContainer")); + +var _bottomSheetDraggableView = _interopRequireDefault(require("../bottomSheetDraggableView")); + +var _constants = require("../../constants"); + +var _utilities = require("../../utilities"); + +var _constants2 = require("./constants"); + +var _styles = require("./styles"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +// import BottomSheetDebugView from '../bottomSheetDebugView'; +_reactNativeReanimated.default.addWhitelistedUIProps({ + decelerationRate: true +}); + +const BottomSheetComponent = /*#__PURE__*/(0, _react.forwardRef)(function BottomSheet(props, ref) { + //#region validate props + (0, _hooks.usePropsValidator)(props); //#endregion + //#region extract props + + const { + // animations configurations + animationConfigs: _providedAnimationConfigs, + // configurations + index: _providedIndex = 0, + snapPoints: _providedSnapPoints, + animateOnMount = _constants2.DEFAULT_ANIMATE_ON_MOUNT, + enableContentPanningGesture = _constants2.DEFAULT_ENABLE_CONTENT_PANNING_GESTURE, + enableHandlePanningGesture = _constants2.DEFAULT_ENABLE_HANDLE_PANNING_GESTURE, + enableOverDrag = _constants2.DEFAULT_ENABLE_OVER_DRAG, + enablePanDownToClose = _constants2.DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE, + enableDynamicSizing = _constants2.DEFAULT_DYNAMIC_SIZING, + overDragResistanceFactor = _constants2.DEFAULT_OVER_DRAG_RESISTANCE_FACTOR, + // styles + style: _providedStyle, + containerStyle: _providedContainerStyle, + backgroundStyle: _providedBackgroundStyle, + handleStyle: _providedHandleStyle, + handleIndicatorStyle: _providedHandleIndicatorStyle, + // hooks + gestureEventsHandlersHook, + // keyboard + keyboardBehavior = _constants2.DEFAULT_KEYBOARD_BEHAVIOR, + keyboardBlurBehavior = _constants2.DEFAULT_KEYBOARD_BLUR_BEHAVIOR, + android_keyboardInputMode = _constants2.DEFAULT_KEYBOARD_INPUT_MODE, + // layout + handleHeight: _providedHandleHeight, + containerHeight: _providedContainerHeight, + contentHeight: _providedContentHeight, + containerOffset: _providedContainerOffset, + topInset = 0, + bottomInset = 0, + maxDynamicContentSize, + // animated callback shared values + animatedPosition: _providedAnimatedPosition, + animatedIndex: _providedAnimatedIndex, + // gestures + simultaneousHandlers: _providedSimultaneousHandlers, + waitFor: _providedWaitFor, + activeOffsetX: _providedActiveOffsetX, + activeOffsetY: _providedActiveOffsetY, + failOffsetX: _providedFailOffsetX, + failOffsetY: _providedFailOffsetY, + // callbacks + onChange: _providedOnChange, + onClose: _providedOnClose, + onAnimate: _providedOnAnimate, + // private + $modal = false, + detached = false, + // components + handleComponent, + backdropComponent, + backgroundComponent, + footerComponent, + children: Content + } = props; //#endregion + //#region layout variables + + /** + * This variable is consider an internal variable, + * that will be used conditionally in `animatedContainerHeight` + */ + + const _animatedContainerHeight = (0, _hooks.useReactiveSharedValue)(_providedContainerHeight !== null && _providedContainerHeight !== void 0 ? _providedContainerHeight : _constants2.INITIAL_CONTAINER_HEIGHT); + /** + * This is a conditional variable, where if the `BottomSheet` is used + * in a modal, then it will subset vertical insets (top+bottom) from + * provided container height. + */ + + + const animatedContainerHeight = (0, _reactNativeReanimated.useDerivedValue)(() => { + const verticalInset = topInset + bottomInset; + return $modal ? _animatedContainerHeight.value - verticalInset : _animatedContainerHeight.value; + }, [$modal, topInset, bottomInset]); + const animatedContainerOffset = (0, _hooks.useReactiveSharedValue)(_providedContainerOffset !== null && _providedContainerOffset !== void 0 ? _providedContainerOffset : _constants2.INITIAL_CONTAINER_OFFSET); + const animatedHandleHeight = (0, _hooks.useReactiveSharedValue)(_providedHandleHeight !== null && _providedHandleHeight !== void 0 ? _providedHandleHeight : _constants2.INITIAL_HANDLE_HEIGHT); + const animatedFooterHeight = (0, _reactNativeReanimated.useSharedValue)(0); + const animatedContentHeight = (0, _reactNativeReanimated.useSharedValue)(_constants2.INITIAL_CONTAINER_HEIGHT); + const animatedSnapPoints = (0, _hooks.useNormalizedSnapPoints)(_providedSnapPoints, animatedContainerHeight, animatedContentHeight, animatedHandleHeight, enableDynamicSizing, maxDynamicContentSize); + const animatedHighestSnapPoint = (0, _reactNativeReanimated.useDerivedValue)(() => animatedSnapPoints.value[animatedSnapPoints.value.length - 1]); + const animatedClosedPosition = (0, _reactNativeReanimated.useDerivedValue)(() => { + let closedPosition = animatedContainerHeight.value; + + if ($modal || detached) { + closedPosition = animatedContainerHeight.value + bottomInset; + } + + return closedPosition; + }, [$modal, detached, bottomInset]); + const animatedSheetHeight = (0, _reactNativeReanimated.useDerivedValue)(() => animatedContainerHeight.value - animatedHighestSnapPoint.value); + const animatedCurrentIndex = (0, _hooks.useReactiveSharedValue)(animateOnMount ? -1 : _providedIndex); + const animatedPosition = (0, _reactNativeReanimated.useSharedValue)(_constants2.INITIAL_POSITION); + const animatedNextPosition = (0, _reactNativeReanimated.useSharedValue)(_constants2.INITIAL_VALUE); + const animatedNextPositionIndex = (0, _reactNativeReanimated.useSharedValue)(0); // conditional + + const isAnimatedOnMount = (0, _reactNativeReanimated.useSharedValue)(false); + const isContentHeightFixed = (0, _reactNativeReanimated.useSharedValue)(false); + const isLayoutCalculated = (0, _reactNativeReanimated.useDerivedValue)(() => { + let isContainerHeightCalculated = false; //container height was provided. + + if (_providedContainerHeight !== null || _providedContainerHeight !== undefined) { + isContainerHeightCalculated = true; + } // container height did set. + + + if (animatedContainerHeight.value !== _constants2.INITIAL_CONTAINER_HEIGHT) { + isContainerHeightCalculated = true; + } + + let isHandleHeightCalculated = false; // handle height is provided. + + if (_providedHandleHeight !== null && _providedHandleHeight !== undefined && typeof _providedHandleHeight === 'number') { + isHandleHeightCalculated = true; + } // handle component is null. + + + if (handleComponent === null) { + animatedHandleHeight.value = 0; + isHandleHeightCalculated = true; + } // handle height did set. + + + if (animatedHandleHeight.value !== _constants2.INITIAL_HANDLE_HEIGHT) { + isHandleHeightCalculated = true; + } + + let isSnapPointsNormalized = false; // the first snap point did normalized + + if (animatedSnapPoints.value[0] !== _constants2.INITIAL_SNAP_POINT) { + isSnapPointsNormalized = true; + } + + return isContainerHeightCalculated && isHandleHeightCalculated && isSnapPointsNormalized; + }); + const isInTemporaryPosition = (0, _reactNativeReanimated.useSharedValue)(false); + const isForcedClosing = (0, _reactNativeReanimated.useSharedValue)(false); // gesture + + const animatedContentGestureState = (0, _reactNativeReanimated.useSharedValue)(_reactNativeGestureHandler.State.UNDETERMINED); + const animatedHandleGestureState = (0, _reactNativeReanimated.useSharedValue)(_reactNativeGestureHandler.State.UNDETERMINED); //#endregion + //#region hooks variables + // scrollable variables + + const { + animatedScrollableType, + animatedScrollableContentOffsetY, + animatedScrollableOverrideState, + isScrollableRefreshable, + setScrollableRef, + removeScrollableRef + } = (0, _hooks.useScrollable)(); // keyboard + + const { + state: animatedKeyboardState, + height: animatedKeyboardHeight, + animationDuration: keyboardAnimationDuration, + animationEasing: keyboardAnimationEasing, + shouldHandleKeyboardEvents + } = (0, _hooks.useKeyboard)(); + const animatedKeyboardHeightInContainer = (0, _reactNativeReanimated.useSharedValue)(0); //#endregion + //#region state/dynamic variables + // states + + const animatedAnimationState = (0, _reactNativeReanimated.useSharedValue)(_constants.ANIMATION_STATE.UNDETERMINED); + const animatedAnimationSource = (0, _reactNativeReanimated.useSharedValue)(_constants.ANIMATION_SOURCE.MOUNT); + const animatedSheetState = (0, _reactNativeReanimated.useDerivedValue)(() => { + // closed position = position >= container height + if (animatedPosition.value >= animatedClosedPosition.value) return _constants.SHEET_STATE.CLOSED; // extended position = container height - sheet height + + const extendedPosition = animatedContainerHeight.value - animatedSheetHeight.value; + if (animatedPosition.value === extendedPosition) return _constants.SHEET_STATE.EXTENDED; // extended position with keyboard = + // container height - (sheet height + keyboard height in root container) + + const keyboardHeightInContainer = animatedKeyboardHeightInContainer.value; + const extendedPositionWithKeyboard = Math.max(0, animatedContainerHeight.value - (animatedSheetHeight.value + keyboardHeightInContainer)); // detect if keyboard is open and the sheet is in temporary position + + if (keyboardBehavior === _constants.KEYBOARD_BEHAVIOR.interactive && isInTemporaryPosition.value && animatedPosition.value === extendedPositionWithKeyboard) { + return _constants.SHEET_STATE.EXTENDED; + } // fill parent = 0 + + + if (animatedPosition.value === 0) { + return _constants.SHEET_STATE.FILL_PARENT; + } // detect if position is below extended point + + + if (animatedPosition.value < extendedPosition) { + return _constants.SHEET_STATE.OVER_EXTENDED; + } + + return _constants.SHEET_STATE.OPENED; + }, [animatedClosedPosition, animatedContainerHeight, animatedKeyboardHeightInContainer, animatedPosition, animatedSheetHeight, isInTemporaryPosition, keyboardBehavior]); + const animatedScrollableState = (0, _reactNativeReanimated.useDerivedValue)(() => { + /** + * if scrollable override state is set, then we just return its value. + */ + if (animatedScrollableOverrideState.value !== _constants.SCROLLABLE_STATE.UNDETERMINED) { + return animatedScrollableOverrideState.value; + } + /** + * if sheet state is fill parent, then unlock scrolling + */ + + + if (animatedSheetState.value === _constants.SHEET_STATE.FILL_PARENT) { + return _constants.SCROLLABLE_STATE.UNLOCKED; + } + /** + * if sheet state is extended, then unlock scrolling + */ + + + if (animatedSheetState.value === _constants.SHEET_STATE.EXTENDED) { + return _constants.SCROLLABLE_STATE.UNLOCKED; + } + /** + * if keyboard is shown and sheet is animating + * then we do not lock the scrolling to not lose + * current scrollable scroll position. + */ + + + if (animatedKeyboardState.value === _constants.KEYBOARD_STATE.SHOWN && animatedAnimationState.value === _constants.ANIMATION_STATE.RUNNING) { + return _constants.SCROLLABLE_STATE.UNLOCKED; + } + + return _constants.SCROLLABLE_STATE.LOCKED; + }); // dynamic + + const animatedContentHeightMax = (0, _reactNativeReanimated.useDerivedValue)(() => { + const keyboardHeightInContainer = animatedKeyboardHeightInContainer.value; + const handleHeight = Math.max(0, animatedHandleHeight.value); + let contentHeight = animatedSheetHeight.value - handleHeight; + + if (keyboardBehavior === _constants.KEYBOARD_BEHAVIOR.extend && animatedKeyboardState.value === _constants.KEYBOARD_STATE.SHOWN) { + contentHeight = contentHeight - keyboardHeightInContainer; + } else if (keyboardBehavior === _constants.KEYBOARD_BEHAVIOR.fillParent && isInTemporaryPosition.value) { + if (animatedKeyboardState.value === _constants.KEYBOARD_STATE.SHOWN) { + contentHeight = animatedContainerHeight.value - handleHeight - keyboardHeightInContainer; + } else { + contentHeight = animatedContainerHeight.value - handleHeight; + } + } else if (keyboardBehavior === _constants.KEYBOARD_BEHAVIOR.interactive && isInTemporaryPosition.value) { + const contentWithKeyboardHeight = contentHeight + keyboardHeightInContainer; + + if (animatedKeyboardState.value === _constants.KEYBOARD_STATE.SHOWN) { + if (keyboardHeightInContainer + animatedSheetHeight.value > animatedContainerHeight.value) { + contentHeight = animatedContainerHeight.value - keyboardHeightInContainer - handleHeight; + } + } else if (contentWithKeyboardHeight + handleHeight > animatedContainerHeight.value) { + contentHeight = animatedContainerHeight.value - handleHeight; + } else { + contentHeight = contentWithKeyboardHeight; + } + } + /** + * before the container is measured, `contentHeight` value will be below zero, + * which will lead to freeze the scrollable. + * + * @link (https://github.com/gorhom/react-native-bottom-sheet/issues/470) + */ + + + return Math.max(contentHeight, 0); + }, [animatedContainerHeight, animatedHandleHeight, animatedKeyboardHeightInContainer, animatedKeyboardState, animatedSheetHeight, isInTemporaryPosition, keyboardBehavior]); + const animatedIndex = (0, _reactNativeReanimated.useDerivedValue)(() => { + const adjustedSnapPoints = animatedSnapPoints.value.slice().reverse(); + const adjustedSnapPointsIndexes = animatedSnapPoints.value.slice().map((_, index) => index).reverse(); + /** + * we add the close state index `-1` + */ + + adjustedSnapPoints.push(animatedContainerHeight.value); + adjustedSnapPointsIndexes.push(-1); + const currentIndex = isLayoutCalculated.value ? (0, _reactNativeReanimated.interpolate)(animatedPosition.value, adjustedSnapPoints, adjustedSnapPointsIndexes, _reactNativeReanimated.Extrapolate.CLAMP) : -1; + /** + * if the sheet is currently running an animation by the keyboard opening, + * then we clamp the index on android with resize keyboard mode. + */ + + if (android_keyboardInputMode === _constants.KEYBOARD_INPUT_MODE.adjustResize && animatedAnimationSource.value === _constants.ANIMATION_SOURCE.KEYBOARD && animatedAnimationState.value === _constants.ANIMATION_STATE.RUNNING && isInTemporaryPosition.value) { + return Math.max(animatedCurrentIndex.value, currentIndex); + } + /** + * if the sheet is currently running an animation by snap point change - usually caused + * by dynamic content height -, then we return the next position index. + */ + + + if (animatedAnimationSource.value === _constants.ANIMATION_SOURCE.SNAP_POINT_CHANGE && animatedAnimationState.value === _constants.ANIMATION_STATE.RUNNING) { + return animatedNextPositionIndex.value; + } + + return currentIndex; + }, [android_keyboardInputMode]); //#endregion + //#region private methods + + /** + * Calculate the next position based on keyboard state. + */ + + const getNextPosition = (0, _reactNativeReanimated.useWorkletCallback)(function getNextPosition() { + 'worklet'; + + const currentIndex = animatedCurrentIndex.value; + const snapPoints = animatedSnapPoints.value; + const keyboardState = animatedKeyboardState.value; + const highestSnapPoint = animatedHighestSnapPoint.value; + /** + * Handle restore sheet position on blur + */ + + if (keyboardBlurBehavior === _constants.KEYBOARD_BLUR_BEHAVIOR.restore && keyboardState === _constants.KEYBOARD_STATE.HIDDEN && animatedContentGestureState.value !== _reactNativeGestureHandler.State.ACTIVE && animatedHandleGestureState.value !== _reactNativeGestureHandler.State.ACTIVE) { + isInTemporaryPosition.value = false; + const nextPosition = snapPoints[currentIndex]; + return nextPosition; + } + /** + * Handle extend behavior + */ + + + if (keyboardBehavior === _constants.KEYBOARD_BEHAVIOR.extend && keyboardState === _constants.KEYBOARD_STATE.SHOWN) { + return highestSnapPoint; + } + /** + * Handle full screen behavior + */ + + + if (keyboardBehavior === _constants.KEYBOARD_BEHAVIOR.fillParent && keyboardState === _constants.KEYBOARD_STATE.SHOWN) { + isInTemporaryPosition.value = true; + return 0; + } + /** + * handle interactive behavior + */ + + + if (keyboardBehavior === _constants.KEYBOARD_BEHAVIOR.interactive && keyboardState === _constants.KEYBOARD_STATE.SHOWN) { + isInTemporaryPosition.value = true; + const keyboardHeightInContainer = animatedKeyboardHeightInContainer.value; + return Math.max(0, highestSnapPoint - keyboardHeightInContainer); + } + + if (isInTemporaryPosition.value) { + return animatedPosition.value; + } + + return snapPoints[currentIndex]; + }, [animatedContentGestureState, animatedCurrentIndex, animatedHandleGestureState, animatedHighestSnapPoint, animatedKeyboardHeightInContainer, animatedKeyboardState, animatedPosition, animatedSnapPoints, isInTemporaryPosition, keyboardBehavior, keyboardBlurBehavior]); + const handleOnChange = (0, _react.useCallback)(function handleOnChange(index) { + (0, _utilities.print)({ + component: BottomSheet.name, + method: handleOnChange.name, + params: { + index, + animatedCurrentIndex: animatedCurrentIndex.value + } + }); + + if (_providedOnChange) { + _providedOnChange(index); + } + }, [_providedOnChange, animatedCurrentIndex]); + const handleOnAnimate = (0, _react.useCallback)(function handleOnAnimate(toPoint) { + const snapPoints = animatedSnapPoints.value; + const toIndex = snapPoints.indexOf(toPoint); + (0, _utilities.print)({ + component: BottomSheet.name, + method: handleOnAnimate.name, + params: { + toIndex, + fromIndex: animatedCurrentIndex.value + } + }); + + if (!_providedOnAnimate) { + return; + } + + if (toIndex !== animatedCurrentIndex.value) { + _providedOnAnimate(animatedCurrentIndex.value, toIndex); + } + }, [_providedOnAnimate, animatedSnapPoints, animatedCurrentIndex]); //#endregion + //#region animation + + const stopAnimation = (0, _reactNativeReanimated.useWorkletCallback)(() => { + (0, _reactNativeReanimated.cancelAnimation)(animatedPosition); + isForcedClosing.value = false; + animatedAnimationSource.value = _constants.ANIMATION_SOURCE.NONE; + animatedAnimationState.value = _constants.ANIMATION_STATE.STOPPED; + }, [animatedPosition, animatedAnimationState, animatedAnimationSource]); + const animateToPositionCompleted = (0, _reactNativeReanimated.useWorkletCallback)(function animateToPositionCompleted(isFinished) { + isForcedClosing.value = false; + + if (!isFinished) { + return; + } + + (0, _reactNativeReanimated.runOnJS)(_utilities.print)({ + component: BottomSheet.name, + method: animateToPositionCompleted.name, + params: { + animatedCurrentIndex: animatedCurrentIndex.value, + animatedNextPosition: animatedNextPosition.value, + animatedNextPositionIndex: animatedNextPositionIndex.value + } + }); + animatedAnimationSource.value = _constants.ANIMATION_SOURCE.NONE; + animatedAnimationState.value = _constants.ANIMATION_STATE.STOPPED; + animatedNextPosition.value = _constants2.INITIAL_VALUE; + animatedNextPositionIndex.value = _constants2.INITIAL_VALUE; + }); + const animateToPosition = (0, _reactNativeReanimated.useWorkletCallback)(function animateToPosition(position, source, velocity = 0, configs) { + if (position === animatedPosition.value || position === undefined || animatedAnimationState.value === _constants.ANIMATION_STATE.RUNNING && position === animatedNextPosition.value) { + return; + } + + (0, _reactNativeReanimated.runOnJS)(_utilities.print)({ + component: BottomSheet.name, + method: animateToPosition.name, + params: { + currentPosition: animatedPosition.value, + position, + velocity, + animatedContainerHeight: animatedContainerHeight.value + } + }); + stopAnimation(); + /** + * set animation state to running, and source + */ + + animatedAnimationState.value = _constants.ANIMATION_STATE.RUNNING; + animatedAnimationSource.value = source; + /** + * store next position + */ + + animatedNextPosition.value = position; + animatedNextPositionIndex.value = animatedSnapPoints.value.indexOf(position); + /** + * fire `onAnimate` callback + */ + + (0, _reactNativeReanimated.runOnJS)(handleOnAnimate)(position); + /** + * force animation configs from parameters, if provided + */ + + if (configs !== undefined) { + animatedPosition.value = (0, _utilities.animate)({ + point: position, + configs, + velocity, + onComplete: animateToPositionCompleted + }); + } else { + /** + * use animationConfigs callback, if provided + */ + animatedPosition.value = (0, _utilities.animate)({ + point: position, + velocity, + configs: _providedAnimationConfigs, + onComplete: animateToPositionCompleted + }); + } + }, [handleOnAnimate, _providedAnimationConfigs]); //#endregion + //#region public methods + + const handleSnapToIndex = (0, _react.useCallback)(function handleSnapToIndex(index, animationConfigs) { + const snapPoints = animatedSnapPoints.value; + (0, _invariant.default)(index >= -1 && index <= snapPoints.length - 1, `'index' was provided but out of the provided snap points range! expected value to be between -1, ${snapPoints.length - 1}`); + (0, _utilities.print)({ + component: BottomSheet.name, + method: handleSnapToIndex.name, + params: { + index + } + }); + const nextPosition = snapPoints[index]; + /** + * exit method if : + * - layout is not calculated. + * - already animating to next position. + * - sheet is forced closing. + */ + + if (!isLayoutCalculated.value || index === animatedNextPositionIndex.value || nextPosition === animatedNextPosition.value || isForcedClosing.value) { + return; + } + /** + * reset temporary position boolean. + */ + + + isInTemporaryPosition.value = false; + (0, _reactNativeReanimated.runOnUI)(animateToPosition)(nextPosition, _constants.ANIMATION_SOURCE.USER, 0, animationConfigs); + }, [animateToPosition, isLayoutCalculated, isInTemporaryPosition, isForcedClosing, animatedSnapPoints, animatedNextPosition, animatedNextPositionIndex]); + const handleSnapToPosition = (0, _reactNativeReanimated.useWorkletCallback)(function handleSnapToPosition(position, animationConfigs) { + (0, _utilities.print)({ + component: BottomSheet.name, + method: handleSnapToPosition.name, + params: { + position + } + }); + /** + * normalized provided position. + */ + + const nextPosition = (0, _utilities.normalizeSnapPoint)(position, animatedContainerHeight.value); + /** + * exit method if : + * - layout is not calculated. + * - already animating to next position. + * - sheet is forced closing. + */ + + if (!isLayoutCalculated || nextPosition === animatedNextPosition.value || isForcedClosing.value) { + return; + } + /** + * mark the new position as temporary. + */ + + + isInTemporaryPosition.value = true; + (0, _reactNativeReanimated.runOnUI)(animateToPosition)(nextPosition, _constants.ANIMATION_SOURCE.USER, 0, animationConfigs); + }, [animateToPosition, bottomInset, topInset, isLayoutCalculated, isForcedClosing, animatedContainerHeight, animatedPosition]); + const handleClose = (0, _react.useCallback)(function handleClose(animationConfigs) { + (0, _utilities.print)({ + component: BottomSheet.name, + method: handleClose.name + }); + const nextPosition = animatedClosedPosition.value; + /** + * exit method if : + * - layout is not calculated. + * - already animating to next position. + * - sheet is forced closing. + */ + + if (!isLayoutCalculated.value || nextPosition === animatedNextPosition.value || isForcedClosing.value) { + return; + } + /** + * reset temporary position variable. + */ + + + isInTemporaryPosition.value = false; + (0, _reactNativeReanimated.runOnUI)(animateToPosition)(nextPosition, _constants.ANIMATION_SOURCE.USER, 0, animationConfigs); + }, [animateToPosition, isForcedClosing, isLayoutCalculated, isInTemporaryPosition, animatedNextPosition, animatedClosedPosition]); + const handleForceClose = (0, _react.useCallback)(function handleForceClose(animationConfigs) { + (0, _utilities.print)({ + component: BottomSheet.name, + method: handleForceClose.name + }); + const nextPosition = animatedClosedPosition.value; + /** + * exit method if : + * - already animating to next position. + * - sheet is forced closing. + */ + + if (nextPosition === animatedNextPosition.value || isForcedClosing.value) { + return; + } + /** + * reset temporary position variable. + */ + + + isInTemporaryPosition.value = false; + /** + * set force closing variable. + */ + + isForcedClosing.value = true; + (0, _reactNativeReanimated.runOnUI)(animateToPosition)(nextPosition, _constants.ANIMATION_SOURCE.USER, 0, animationConfigs); + }, [animateToPosition, isForcedClosing, isInTemporaryPosition, animatedNextPosition, animatedClosedPosition]); + const handleExpand = (0, _react.useCallback)(function handleExpand(animationConfigs) { + (0, _utilities.print)({ + component: BottomSheet.name, + method: handleExpand.name + }); + const snapPoints = animatedSnapPoints.value; + const nextPosition = snapPoints[snapPoints.length - 1]; + /** + * exit method if : + * - layout is not calculated. + * - already animating to next position. + * - sheet is forced closing. + */ + + if (!isLayoutCalculated.value || snapPoints.length - 1 === animatedNextPositionIndex.value || nextPosition === animatedNextPosition.value || isForcedClosing.value) { + return; + } + /** + * reset temporary position boolean. + */ + + + isInTemporaryPosition.value = false; + (0, _reactNativeReanimated.runOnUI)(animateToPosition)(nextPosition, _constants.ANIMATION_SOURCE.USER, 0, animationConfigs); + }, [animateToPosition, isInTemporaryPosition, isLayoutCalculated, isForcedClosing, animatedSnapPoints, animatedNextPosition, animatedNextPositionIndex]); + const handleCollapse = (0, _react.useCallback)(function handleCollapse(animationConfigs) { + (0, _utilities.print)({ + component: BottomSheet.name, + method: handleCollapse.name + }); + const nextPosition = animatedSnapPoints.value[0]; + /** + * exit method if : + * - layout is not calculated. + * - already animating to next position. + * - sheet is forced closing. + */ + + if (!isLayoutCalculated || animatedNextPositionIndex.value === 0 || nextPosition === animatedNextPosition.value || isForcedClosing.value) { + return; + } + /** + * reset temporary position boolean. + */ + + + isInTemporaryPosition.value = false; + (0, _reactNativeReanimated.runOnUI)(animateToPosition)(nextPosition, _constants.ANIMATION_SOURCE.USER, 0, animationConfigs); + }, [animateToPosition, isForcedClosing, isLayoutCalculated, isInTemporaryPosition, animatedSnapPoints, animatedNextPosition, animatedNextPositionIndex]); + (0, _react.useImperativeHandle)(ref, () => ({ + snapToIndex: handleSnapToIndex, + snapToPosition: handleSnapToPosition, + expand: handleExpand, + collapse: handleCollapse, + close: handleClose, + forceClose: handleForceClose + })); //#endregion + //#region contexts variables + + const internalContextVariables = (0, _react.useMemo)(() => ({ + enableContentPanningGesture, + enableDynamicSizing, + overDragResistanceFactor, + enableOverDrag, + enablePanDownToClose, + animatedAnimationState, + animatedSheetState, + animatedScrollableState, + animatedScrollableOverrideState, + animatedContentGestureState, + animatedHandleGestureState, + animatedKeyboardState, + animatedScrollableType, + animatedIndex, + animatedPosition, + animatedContentHeight, + animatedClosedPosition, + animatedHandleHeight, + animatedFooterHeight, + animatedKeyboardHeight, + animatedKeyboardHeightInContainer, + animatedContainerHeight, + animatedSnapPoints, + animatedHighestSnapPoint, + animatedScrollableContentOffsetY, + isInTemporaryPosition, + isContentHeightFixed, + isScrollableRefreshable, + shouldHandleKeyboardEvents, + simultaneousHandlers: _providedSimultaneousHandlers, + waitFor: _providedWaitFor, + activeOffsetX: _providedActiveOffsetX, + activeOffsetY: _providedActiveOffsetY, + failOffsetX: _providedFailOffsetX, + failOffsetY: _providedFailOffsetY, + animateToPosition, + stopAnimation, + setScrollableRef, + removeScrollableRef + }), [animatedIndex, animatedPosition, animatedContentHeight, animatedScrollableType, animatedContentGestureState, animatedHandleGestureState, animatedClosedPosition, animatedFooterHeight, animatedContainerHeight, animatedHandleHeight, animatedAnimationState, animatedKeyboardState, animatedKeyboardHeight, animatedKeyboardHeightInContainer, animatedSheetState, animatedHighestSnapPoint, animatedScrollableState, animatedScrollableOverrideState, animatedSnapPoints, shouldHandleKeyboardEvents, animatedScrollableContentOffsetY, isScrollableRefreshable, isContentHeightFixed, isInTemporaryPosition, enableContentPanningGesture, overDragResistanceFactor, enableOverDrag, enablePanDownToClose, enableDynamicSizing, _providedSimultaneousHandlers, _providedWaitFor, _providedActiveOffsetX, _providedActiveOffsetY, _providedFailOffsetX, _providedFailOffsetY, setScrollableRef, removeScrollableRef, animateToPosition, stopAnimation]); + const externalContextVariables = (0, _react.useMemo)(() => ({ + animatedIndex, + animatedPosition, + snapToIndex: handleSnapToIndex, + snapToPosition: handleSnapToPosition, + expand: handleExpand, + collapse: handleCollapse, + close: handleClose, + forceClose: handleForceClose + }), [animatedIndex, animatedPosition, handleSnapToIndex, handleSnapToPosition, handleExpand, handleCollapse, handleClose, handleForceClose]); //#endregion + //#region styles + + const containerAnimatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({ + opacity: _reactNative.Platform.OS === 'android' && animatedIndex.value === -1 ? 0 : 1, + transform: [{ + translateY: animatedPosition.value + }] + }), [animatedPosition, animatedIndex]); + const containerStyle = (0, _react.useMemo)(() => [_providedStyle, _styles.styles.container, containerAnimatedStyle], [_providedStyle, containerAnimatedStyle]); + const contentContainerAnimatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => { + /** + * if content height was provided, then we skip setting + * calculated height. + */ + if (_providedContentHeight) { + return {}; + } + + return { + height: (0, _utilities.animate)({ + point: animatedContentHeightMax.value, + configs: _providedAnimationConfigs + }) + }; + }, [animatedContentHeightMax, enableDynamicSizing, animatedContentHeight]); + const contentContainerStyle = (0, _react.useMemo)(() => [_styles.styles.contentContainer, contentContainerAnimatedStyle], [contentContainerAnimatedStyle]); + /** + * added safe area to prevent the sheet from floating above + * the bottom of the screen, when sheet being over dragged or + * when the sheet is resized. + */ + + const contentMaskContainerAnimatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => { + if (detached) { + return { + overflow: 'visible' + }; + } + + return { + paddingBottom: animatedContainerHeight.value + }; + }, [detached]); + const contentMaskContainerStyle = (0, _react.useMemo)(() => [_styles.styles.contentMaskContainer, contentMaskContainerAnimatedStyle], [contentMaskContainerAnimatedStyle]); //#endregion + //#region effects + + /** + * React to `isLayoutCalculated` change, to insure that the sheet will + * appears/mounts only when all layout is been calculated. + * + * @alias OnMount + */ + + (0, _reactNativeReanimated.useAnimatedReaction)(() => isLayoutCalculated.value, _isLayoutCalculated => { + /** + * exit method if: + * - layout is not calculated yet. + * - already did animate on mount. + */ + if (!_isLayoutCalculated || isAnimatedOnMount.value) { + return; + } + + let nextPosition; + + if (_providedIndex === -1) { + nextPosition = animatedClosedPosition.value; + animatedNextPositionIndex.value = -1; + } else { + nextPosition = animatedSnapPoints.value[_providedIndex]; + } + + (0, _reactNativeReanimated.runOnJS)(_utilities.print)({ + component: BottomSheet.name, + method: 'useAnimatedReaction::OnMount', + params: { + isLayoutCalculated: _isLayoutCalculated, + animatedSnapPoints: animatedSnapPoints.value, + nextPosition + } + }); + /** + * here we exit method early because the next position + * is out of the screen, this happens when `snapPoints` + * still being calculated. + */ + + if (nextPosition === _constants2.INITIAL_POSITION || nextPosition === animatedClosedPosition.value) { + isAnimatedOnMount.value = true; + animatedCurrentIndex.value = _providedIndex; + return; + } + + if (animateOnMount) { + animateToPosition(nextPosition, _constants.ANIMATION_SOURCE.MOUNT); + } else { + animatedPosition.value = nextPosition; + } + + isAnimatedOnMount.value = true; + }, [_providedIndex, animateOnMount]); + /** + * React to `snapPoints` change, to insure that the sheet position reflect + * to the current point correctly. + * + * @alias OnSnapPointsChange + */ + + (0, _reactNativeReanimated.useAnimatedReaction)(() => ({ + snapPoints: animatedSnapPoints.value, + containerHeight: animatedContainerHeight.value + }), (result, _previousResult) => { + const { + snapPoints, + containerHeight + } = result; + + const _previousSnapPoints = _previousResult === null || _previousResult === void 0 ? void 0 : _previousResult.snapPoints; + + const _previousContainerHeight = _previousResult === null || _previousResult === void 0 ? void 0 : _previousResult.containerHeight; + + let nextPosition; + let animationConfig; + let animationSource = _constants.ANIMATION_SOURCE.SNAP_POINT_CHANGE; + /** + * if the bottom sheet is closing and the container gets resized, + * then we restart the closing animation to the new position. + */ + + if (animatedAnimationState.value === _constants.ANIMATION_STATE.RUNNING && animatedNextPositionIndex.value === -1 && _previousContainerHeight !== containerHeight) { + animationSource = _constants.ANIMATION_SOURCE.CONTAINER_RESIZE; + animationConfig = { + duration: 0 + }; + animateToPosition(containerHeight, animationSource, 0, animationConfig); + } + + if (JSON.stringify(snapPoints) === JSON.stringify(_previousSnapPoints) || !isLayoutCalculated.value || !isAnimatedOnMount.value || containerHeight <= 0) { + return; + } + + (0, _reactNativeReanimated.runOnJS)(_utilities.print)({ + component: BottomSheet.name, + method: 'useAnimatedReaction::OnSnapPointChange', + params: { + snapPoints + } + }); + /** + * if snap points changed while sheet is animating, then + * we stop the animation and animate to the updated point. + */ + + if (animatedAnimationState.value === _constants.ANIMATION_STATE.RUNNING && animatedNextPositionIndex.value !== animatedCurrentIndex.value) { + nextPosition = animatedNextPositionIndex.value !== -1 ? snapPoints[animatedNextPositionIndex.value] : animatedNextPosition.value; + } else if (animatedCurrentIndex.value === -1) { + nextPosition = animatedClosedPosition.value; + } else if (isInTemporaryPosition.value) { + nextPosition = getNextPosition(); + } else { + nextPosition = snapPoints[animatedCurrentIndex.value]; + /** + * if snap points changes because of the container height change, + * then we skip the snap animation by setting the duration to 0. + */ + + if (containerHeight !== _previousContainerHeight) { + animationSource = _constants.ANIMATION_SOURCE.CONTAINER_RESIZE; + animationConfig = { + duration: 0 + }; + } + } + + animateToPosition(nextPosition, animationSource, 0, animationConfig); + }); + /** + * React to keyboard appearance state. + * + * @alias OnKeyboardStateChange + */ + + (0, _reactNativeReanimated.useAnimatedReaction)(() => ({ + _keyboardState: animatedKeyboardState.value, + _keyboardHeight: animatedKeyboardHeight.value + }), (result, _previousResult) => { + const { + _keyboardState, + _keyboardHeight + } = result; + + const _previousKeyboardState = _previousResult === null || _previousResult === void 0 ? void 0 : _previousResult._keyboardState; + + const _previousKeyboardHeight = _previousResult === null || _previousResult === void 0 ? void 0 : _previousResult._keyboardHeight; + /** + * Calculate the keyboard height in the container. + */ + + + animatedKeyboardHeightInContainer.value = $modal ? Math.abs(_keyboardHeight - Math.abs(bottomInset - animatedContainerOffset.value.bottom)) : Math.abs(_keyboardHeight - animatedContainerOffset.value.bottom); + const hasActiveGesture = animatedContentGestureState.value === _reactNativeGestureHandler.State.ACTIVE || animatedContentGestureState.value === _reactNativeGestureHandler.State.BEGAN || animatedHandleGestureState.value === _reactNativeGestureHandler.State.ACTIVE || animatedHandleGestureState.value === _reactNativeGestureHandler.State.BEGAN; + + if ( + /** + * if keyboard state is equal to the previous state, then exit the method + */ + _keyboardState === _previousKeyboardState && _keyboardHeight === _previousKeyboardHeight || + /** + * if user is interacting with sheet, then exit the method + */ + hasActiveGesture || + /** + * if sheet not animated on mount yet, then exit the method + */ + !isAnimatedOnMount.value || _keyboardState === _constants.KEYBOARD_STATE.HIDDEN && keyboardBlurBehavior === _constants.KEYBOARD_BLUR_BEHAVIOR.none || _reactNative.Platform.OS === 'android' && keyboardBehavior === _constants.KEYBOARD_BEHAVIOR.interactive && android_keyboardInputMode === _constants.KEYBOARD_INPUT_MODE.adjustResize) { + animatedKeyboardHeightInContainer.value = 0; + return; + } + + (0, _reactNativeReanimated.runOnJS)(_utilities.print)({ + component: BottomSheet.name, + method: 'useAnimatedReaction::OnKeyboardStateChange', + params: { + keyboardState: _keyboardState, + keyboardHeight: _keyboardHeight + } + }); + let animationConfigs = (0, _utilities.getKeyboardAnimationConfigs)(keyboardAnimationEasing.value, keyboardAnimationDuration.value); + const nextPosition = getNextPosition(); + animateToPosition(nextPosition, _constants.ANIMATION_SOURCE.KEYBOARD, 0, animationConfigs); + }, [$modal, bottomInset, keyboardBehavior, keyboardBlurBehavior, android_keyboardInputMode, animatedContainerOffset, getNextPosition]); + /** + * sets provided animated position + */ + + (0, _reactNativeReanimated.useAnimatedReaction)(() => animatedPosition.value, _animatedPosition => { + if (_providedAnimatedPosition) { + _providedAnimatedPosition.value = _animatedPosition + topInset; + } + }); + /** + * sets provided animated index + */ + + (0, _reactNativeReanimated.useAnimatedReaction)(() => animatedIndex.value, _animatedIndex => { + if (_providedAnimatedIndex) { + _providedAnimatedIndex.value = _animatedIndex; + } + }); + /** + * React to internal variables to detect change in snap position. + * + * @alias OnChange + */ + + (0, _reactNativeReanimated.useAnimatedReaction)(() => ({ + _animatedIndex: animatedIndex.value, + _animatedPosition: animatedPosition.value, + _animationState: animatedAnimationState.value, + _contentGestureState: animatedContentGestureState.value, + _handleGestureState: animatedHandleGestureState.value + }), ({ + _animatedIndex, + _animationState, + _contentGestureState, + _handleGestureState + }) => { + /** + * exit the method if animation state is not stopped. + */ + if (_animationState !== _constants.ANIMATION_STATE.STOPPED) { + return; + } + /** + * exit the method if animated index value + * has fraction, e.g. 1.99, 0.52 + */ + + + if (_animatedIndex % 1 !== 0) { + return; + } + /** + * exit the method if there any active gesture. + */ + + + const hasNoActiveGesture = (_contentGestureState === _reactNativeGestureHandler.State.END || _contentGestureState === _reactNativeGestureHandler.State.UNDETERMINED || _contentGestureState === _reactNativeGestureHandler.State.CANCELLED) && (_handleGestureState === _reactNativeGestureHandler.State.END || _handleGestureState === _reactNativeGestureHandler.State.UNDETERMINED || _handleGestureState === _reactNativeGestureHandler.State.CANCELLED); + + if (!hasNoActiveGesture) { + return; + } + /** + * if the index is not equal to the current index, + * than the sheet position had changed and we trigger + * the `onChange` callback. + */ + + + if (_animatedIndex !== animatedCurrentIndex.value) { + (0, _reactNativeReanimated.runOnJS)(_utilities.print)({ + component: BottomSheet.name, + method: 'useAnimatedReaction::OnChange', + params: { + animatedCurrentIndex: animatedCurrentIndex.value, + animatedIndex: _animatedIndex + } + }); + animatedCurrentIndex.value = _animatedIndex; + (0, _reactNativeReanimated.runOnJS)(handleOnChange)(_animatedIndex); + } + /** + * if index is `-1` than we fire the `onClose` callback. + */ + + + if (_animatedIndex === -1 && _providedOnClose) { + (0, _reactNativeReanimated.runOnJS)(_utilities.print)({ + component: BottomSheet.name, + method: 'useAnimatedReaction::onClose', + params: { + animatedCurrentIndex: animatedCurrentIndex.value, + animatedIndex: _animatedIndex + } + }); + (0, _reactNativeReanimated.runOnJS)(_providedOnClose)(); + } + }, [handleOnChange, _providedOnClose]); + /** + * React to `index` prop to snap the sheet to the new position. + * + * @alias onIndexChange + */ + + (0, _react.useEffect)(() => { + if (isAnimatedOnMount.value) { + handleSnapToIndex(_providedIndex); + } + }, [_providedIndex, animatedCurrentIndex, isAnimatedOnMount, handleSnapToIndex]); //#endregion + // render + + (0, _utilities.print)({ + component: BottomSheet.name, + method: 'render', + params: { + animatedSnapPoints: animatedSnapPoints.value, + animatedCurrentIndex: animatedCurrentIndex.value, + providedIndex: _providedIndex + } + }); + return /*#__PURE__*/_react.default.createElement(_contexts.BottomSheetProvider, { + value: externalContextVariables + }, /*#__PURE__*/_react.default.createElement(_contexts.BottomSheetInternalProvider, { + value: internalContextVariables + }, /*#__PURE__*/_react.default.createElement(_bottomSheetGestureHandlersProvider.default, { + gestureEventsHandlersHook: gestureEventsHandlersHook + }, /*#__PURE__*/_react.default.createElement(_bottomSheetBackdropContainer.default, { + key: "BottomSheetBackdropContainer", + animatedIndex: animatedIndex, + animatedPosition: animatedPosition, + backdropComponent: backdropComponent + }), /*#__PURE__*/_react.default.createElement(_bottomSheetContainer.default, { + key: "BottomSheetContainer", + shouldCalculateHeight: !$modal, + containerHeight: _animatedContainerHeight, + containerOffset: animatedContainerOffset, + topInset: topInset, + bottomInset: bottomInset, + detached: detached, + style: _providedContainerStyle + }, /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, { + style: containerStyle + }, /*#__PURE__*/_react.default.createElement(_bottomSheetBackgroundContainer.default, { + key: "BottomSheetBackgroundContainer", + animatedIndex: animatedIndex, + animatedPosition: animatedPosition, + backgroundComponent: backgroundComponent, + backgroundStyle: _providedBackgroundStyle + }), /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, { + pointerEvents: "box-none", + style: contentMaskContainerStyle + }, /*#__PURE__*/_react.default.createElement(_bottomSheetDraggableView.default, { + key: "BottomSheetRootDraggableView", + style: contentContainerStyle + }, typeof Content === 'function' ? /*#__PURE__*/_react.default.createElement(Content, null) : Content, footerComponent && /*#__PURE__*/_react.default.createElement(_BottomSheetFooterContainer.default, { + footerComponent: footerComponent + }))), /*#__PURE__*/_react.default.createElement(_bottomSheetHandleContainer.default, { + key: "BottomSheetHandleContainer", + animatedIndex: animatedIndex, + animatedPosition: animatedPosition, + handleHeight: animatedHandleHeight, + enableHandlePanningGesture: enableHandlePanningGesture, + enableOverDrag: enableOverDrag, + enablePanDownToClose: enablePanDownToClose, + overDragResistanceFactor: overDragResistanceFactor, + keyboardBehavior: keyboardBehavior, + handleComponent: handleComponent, + handleStyle: _providedHandleStyle, + handleIndicatorStyle: _providedHandleIndicatorStyle + })))))); +}); +const BottomSheet = /*#__PURE__*/(0, _react.memo)(BottomSheetComponent); +BottomSheet.displayName = 'BottomSheet'; +var _default = BottomSheet; +exports.default = _default; +//# sourceMappingURL=BottomSheet.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheet/BottomSheet.js.map b/lib/commonjs/components/bottomSheet/BottomSheet.js.map new file mode 100644 index 000000000..6e668a4cd --- /dev/null +++ b/lib/commonjs/components/bottomSheet/BottomSheet.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheet.tsx"],"names":["Animated","addWhitelistedUIProps","decelerationRate","BottomSheetComponent","BottomSheet","props","ref","animationConfigs","_providedAnimationConfigs","index","_providedIndex","snapPoints","_providedSnapPoints","animateOnMount","DEFAULT_ANIMATE_ON_MOUNT","enableContentPanningGesture","DEFAULT_ENABLE_CONTENT_PANNING_GESTURE","enableHandlePanningGesture","DEFAULT_ENABLE_HANDLE_PANNING_GESTURE","enableOverDrag","DEFAULT_ENABLE_OVER_DRAG","enablePanDownToClose","DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE","enableDynamicSizing","DEFAULT_DYNAMIC_SIZING","overDragResistanceFactor","DEFAULT_OVER_DRAG_RESISTANCE_FACTOR","style","_providedStyle","containerStyle","_providedContainerStyle","backgroundStyle","_providedBackgroundStyle","handleStyle","_providedHandleStyle","handleIndicatorStyle","_providedHandleIndicatorStyle","gestureEventsHandlersHook","keyboardBehavior","DEFAULT_KEYBOARD_BEHAVIOR","keyboardBlurBehavior","DEFAULT_KEYBOARD_BLUR_BEHAVIOR","android_keyboardInputMode","DEFAULT_KEYBOARD_INPUT_MODE","handleHeight","_providedHandleHeight","containerHeight","_providedContainerHeight","contentHeight","_providedContentHeight","containerOffset","_providedContainerOffset","topInset","bottomInset","maxDynamicContentSize","animatedPosition","_providedAnimatedPosition","animatedIndex","_providedAnimatedIndex","simultaneousHandlers","_providedSimultaneousHandlers","waitFor","_providedWaitFor","activeOffsetX","_providedActiveOffsetX","activeOffsetY","_providedActiveOffsetY","failOffsetX","_providedFailOffsetX","failOffsetY","_providedFailOffsetY","onChange","_providedOnChange","onClose","_providedOnClose","onAnimate","_providedOnAnimate","$modal","detached","handleComponent","backdropComponent","backgroundComponent","footerComponent","children","Content","_animatedContainerHeight","INITIAL_CONTAINER_HEIGHT","animatedContainerHeight","verticalInset","value","animatedContainerOffset","INITIAL_CONTAINER_OFFSET","animatedHandleHeight","INITIAL_HANDLE_HEIGHT","animatedFooterHeight","animatedContentHeight","animatedSnapPoints","animatedHighestSnapPoint","length","animatedClosedPosition","closedPosition","animatedSheetHeight","animatedCurrentIndex","INITIAL_POSITION","animatedNextPosition","INITIAL_VALUE","animatedNextPositionIndex","isAnimatedOnMount","isContentHeightFixed","isLayoutCalculated","isContainerHeightCalculated","undefined","isHandleHeightCalculated","isSnapPointsNormalized","INITIAL_SNAP_POINT","isInTemporaryPosition","isForcedClosing","animatedContentGestureState","State","UNDETERMINED","animatedHandleGestureState","animatedScrollableType","animatedScrollableContentOffsetY","animatedScrollableOverrideState","isScrollableRefreshable","setScrollableRef","removeScrollableRef","state","animatedKeyboardState","height","animatedKeyboardHeight","animationDuration","keyboardAnimationDuration","animationEasing","keyboardAnimationEasing","shouldHandleKeyboardEvents","animatedKeyboardHeightInContainer","animatedAnimationState","ANIMATION_STATE","animatedAnimationSource","ANIMATION_SOURCE","MOUNT","animatedSheetState","SHEET_STATE","CLOSED","extendedPosition","EXTENDED","keyboardHeightInContainer","extendedPositionWithKeyboard","Math","max","KEYBOARD_BEHAVIOR","interactive","FILL_PARENT","OVER_EXTENDED","OPENED","animatedScrollableState","SCROLLABLE_STATE","UNLOCKED","KEYBOARD_STATE","SHOWN","RUNNING","LOCKED","animatedContentHeightMax","extend","fillParent","contentWithKeyboardHeight","adjustedSnapPoints","slice","reverse","adjustedSnapPointsIndexes","map","_","push","currentIndex","Extrapolate","CLAMP","KEYBOARD_INPUT_MODE","adjustResize","KEYBOARD","SNAP_POINT_CHANGE","getNextPosition","keyboardState","highestSnapPoint","KEYBOARD_BLUR_BEHAVIOR","restore","HIDDEN","ACTIVE","nextPosition","handleOnChange","component","name","method","params","handleOnAnimate","toPoint","toIndex","indexOf","fromIndex","stopAnimation","NONE","STOPPED","animateToPositionCompleted","isFinished","print","animateToPosition","position","source","velocity","configs","currentPosition","point","onComplete","handleSnapToIndex","USER","handleSnapToPosition","handleClose","handleForceClose","handleExpand","handleCollapse","snapToIndex","snapToPosition","expand","collapse","close","forceClose","internalContextVariables","externalContextVariables","containerAnimatedStyle","opacity","Platform","OS","transform","translateY","styles","container","contentContainerAnimatedStyle","contentContainerStyle","contentContainer","contentMaskContainerAnimatedStyle","overflow","paddingBottom","contentMaskContainerStyle","contentMaskContainer","_isLayoutCalculated","result","_previousResult","_previousSnapPoints","_previousContainerHeight","animationConfig","animationSource","CONTAINER_RESIZE","duration","JSON","stringify","_keyboardState","_keyboardHeight","_previousKeyboardState","_previousKeyboardHeight","abs","bottom","hasActiveGesture","BEGAN","none","keyboardHeight","_animatedPosition","_animatedIndex","_animationState","_contentGestureState","_handleGestureState","hasNoActiveGesture","END","CANCELLED","providedIndex","displayName"],"mappings":";;;;;;;AAAA;;AAQA;;AACA;;AACA;;AAcA;;AACA;;AAOA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AAUA;;AAMA;;AAoBA;;;;;;;;AArCA;AAuCAA,+BAASC,qBAAT,CAA+B;AAC7BC,EAAAA,gBAAgB,EAAE;AADW,CAA/B;;AAMA,MAAMC,oBAAoB,gBAAG,uBAC3B,SAASC,WAAT,CAAqBC,KAArB,EAA4BC,GAA5B,EAAiC;AAC/B;AACA,gCAAkBD,KAAlB,EAF+B,CAG/B;AAEA;;AACA,QAAM;AACJ;AACAE,IAAAA,gBAAgB,EAAEC,yBAFd;AAIJ;AACAC,IAAAA,KAAK,EAAEC,cAAc,GAAG,CALpB;AAMJC,IAAAA,UAAU,EAAEC,mBANR;AAOJC,IAAAA,cAAc,GAAGC,oCAPb;AAQJC,IAAAA,2BAA2B,GAAGC,kDAR1B;AASJC,IAAAA,0BAA0B,GAAGC,iDATzB;AAUJC,IAAAA,cAAc,GAAGC,oCAVb;AAWJC,IAAAA,oBAAoB,GAAGC,4CAXnB;AAYJC,IAAAA,mBAAmB,GAAGC,kCAZlB;AAaJC,IAAAA,wBAAwB,GAAGC,+CAbvB;AAeJ;AACAC,IAAAA,KAAK,EAAEC,cAhBH;AAiBJC,IAAAA,cAAc,EAAEC,uBAjBZ;AAkBJC,IAAAA,eAAe,EAAEC,wBAlBb;AAmBJC,IAAAA,WAAW,EAAEC,oBAnBT;AAoBJC,IAAAA,oBAAoB,EAAEC,6BApBlB;AAsBJ;AACAC,IAAAA,yBAvBI;AAyBJ;AACAC,IAAAA,gBAAgB,GAAGC,qCA1Bf;AA2BJC,IAAAA,oBAAoB,GAAGC,0CA3BnB;AA4BJC,IAAAA,yBAAyB,GAAGC,uCA5BxB;AA8BJ;AACAC,IAAAA,YAAY,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mB,UAAnB,gBAAgC,6BAAC,OAAD,OAAhC,GAA8CA,OAJjD,EAMGF,eAAe,iBACd,6BAAC,mCAAD;AACE,IAAA,eAAe,EAAEA;AADnB,IAPJ,CAJF,CARF,eAyBE,6BAAC,mCAAD;AACE,IAAA,GAAG,EAAC,4BADN;AAEE,IAAA,aAAa,EAAEzB,aAFjB;AAGE,IAAA,gBAAgB,EAAEF,gBAHpB;AAIE,IAAA,YAAY,EAAEqC,oBAJhB;AAKE,IAAA,0BAA0B,EAAE3E,0BAL9B;AAME,IAAA,cAAc,EAAEE,cANlB;AAOE,IAAA,oBAAoB,EAAEE,oBAPxB;AAQE,IAAA,wBAAwB,EAAEI,wBAR5B;AASE,IAAA,gBAAgB,EAAEa,gBATpB;AAUE,IAAA,eAAe,EAAEyC,eAVnB;AAWE,IAAA,WAAW,EAAE7C,oBAXf;AAYE,IAAA,oBAAoB,EAAEE;AAZxB,IAzBF,CAVF,CATF,CADF,CADF,CADF;AA0FD,CAtkD0B,CAA7B;AAykDA,MAAMhC,WAAW,gBAAG,iBAAKD,oBAAL,CAApB;AACAC,WAAW,CAAC8Q,WAAZ,GAA0B,aAA1B;eAEe9Q,W","sourcesContent":["import React, {\n useMemo,\n useCallback,\n forwardRef,\n useImperativeHandle,\n memo,\n useEffect,\n} from 'react';\nimport { Platform } from 'react-native';\nimport invariant from 'invariant';\nimport Animated, {\n useAnimatedReaction,\n useSharedValue,\n useAnimatedStyle,\n useDerivedValue,\n runOnJS,\n interpolate,\n Extrapolate,\n runOnUI,\n cancelAnimation,\n useWorkletCallback,\n WithSpringConfig,\n WithTimingConfig,\n} from 'react-native-reanimated';\nimport { State } from 'react-native-gesture-handler';\nimport {\n useScrollable,\n usePropsValidator,\n useReactiveSharedValue,\n useNormalizedSnapPoints,\n useKeyboard,\n} from '../../hooks';\nimport {\n BottomSheetInternalProvider,\n BottomSheetProvider,\n} from '../../contexts';\nimport BottomSheetContainer from '../bottomSheetContainer';\nimport BottomSheetGestureHandlersProvider from '../bottomSheetGestureHandlersProvider';\nimport BottomSheetBackdropContainer from '../bottomSheetBackdropContainer';\nimport BottomSheetHandleContainer from '../bottomSheetHandleContainer';\nimport BottomSheetBackgroundContainer from '../bottomSheetBackgroundContainer';\nimport BottomSheetFooterContainer from '../bottomSheetFooterContainer/BottomSheetFooterContainer';\nimport BottomSheetDraggableView from '../bottomSheetDraggableView';\n// import BottomSheetDebugView from '../bottomSheetDebugView';\nimport {\n ANIMATION_STATE,\n KEYBOARD_STATE,\n KEYBOARD_BEHAVIOR,\n SHEET_STATE,\n SCROLLABLE_STATE,\n KEYBOARD_BLUR_BEHAVIOR,\n KEYBOARD_INPUT_MODE,\n ANIMATION_SOURCE,\n} from '../../constants';\nimport {\n animate,\n getKeyboardAnimationConfigs,\n normalizeSnapPoint,\n print,\n} from '../../utilities';\nimport {\n DEFAULT_OVER_DRAG_RESISTANCE_FACTOR,\n DEFAULT_ENABLE_CONTENT_PANNING_GESTURE,\n DEFAULT_ENABLE_HANDLE_PANNING_GESTURE,\n DEFAULT_ENABLE_OVER_DRAG,\n DEFAULT_ANIMATE_ON_MOUNT,\n DEFAULT_KEYBOARD_BEHAVIOR,\n DEFAULT_KEYBOARD_BLUR_BEHAVIOR,\n DEFAULT_KEYBOARD_INPUT_MODE,\n INITIAL_CONTAINER_HEIGHT,\n INITIAL_HANDLE_HEIGHT,\n INITIAL_POSITION,\n INITIAL_SNAP_POINT,\n DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE,\n INITIAL_CONTAINER_OFFSET,\n INITIAL_VALUE,\n DEFAULT_DYNAMIC_SIZING,\n} from './constants';\nimport type { BottomSheetMethods, Insets } from '../../types';\nimport type { BottomSheetProps, AnimateToPositionType } from './types';\nimport { styles } from './styles';\n\nAnimated.addWhitelistedUIProps({\n decelerationRate: true,\n});\n\ntype BottomSheet = BottomSheetMethods;\n\nconst BottomSheetComponent = forwardRef(\n function BottomSheet(props, ref) {\n //#region validate props\n usePropsValidator(props);\n //#endregion\n\n //#region extract props\n const {\n // animations configurations\n animationConfigs: _providedAnimationConfigs,\n\n // configurations\n index: _providedIndex = 0,\n snapPoints: _providedSnapPoints,\n animateOnMount = DEFAULT_ANIMATE_ON_MOUNT,\n enableContentPanningGesture = DEFAULT_ENABLE_CONTENT_PANNING_GESTURE,\n enableHandlePanningGesture = DEFAULT_ENABLE_HANDLE_PANNING_GESTURE,\n enableOverDrag = DEFAULT_ENABLE_OVER_DRAG,\n enablePanDownToClose = DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE,\n enableDynamicSizing = DEFAULT_DYNAMIC_SIZING,\n overDragResistanceFactor = DEFAULT_OVER_DRAG_RESISTANCE_FACTOR,\n\n // styles\n style: _providedStyle,\n containerStyle: _providedContainerStyle,\n backgroundStyle: _providedBackgroundStyle,\n handleStyle: _providedHandleStyle,\n handleIndicatorStyle: _providedHandleIndicatorStyle,\n\n // hooks\n gestureEventsHandlersHook,\n\n // keyboard\n keyboardBehavior = DEFAULT_KEYBOARD_BEHAVIOR,\n keyboardBlurBehavior = DEFAULT_KEYBOARD_BLUR_BEHAVIOR,\n android_keyboardInputMode = DEFAULT_KEYBOARD_INPUT_MODE,\n\n // layout\n handleHeight: _providedHandleHeight,\n containerHeight: _providedContainerHeight,\n contentHeight: _providedContentHeight,\n containerOffset: _providedContainerOffset,\n topInset = 0,\n bottomInset = 0,\n maxDynamicContentSize,\n\n // animated callback shared values\n animatedPosition: _providedAnimatedPosition,\n animatedIndex: _providedAnimatedIndex,\n\n // gestures\n simultaneousHandlers: _providedSimultaneousHandlers,\n waitFor: _providedWaitFor,\n activeOffsetX: _providedActiveOffsetX,\n activeOffsetY: _providedActiveOffsetY,\n failOffsetX: _providedFailOffsetX,\n failOffsetY: _providedFailOffsetY,\n\n // callbacks\n onChange: _providedOnChange,\n onClose: _providedOnClose,\n onAnimate: _providedOnAnimate,\n\n // private\n $modal = false,\n detached = false,\n\n // components\n handleComponent,\n backdropComponent,\n backgroundComponent,\n footerComponent,\n children: Content,\n } = props;\n //#endregion\n\n //#region layout variables\n /**\n * This variable is consider an internal variable,\n * that will be used conditionally in `animatedContainerHeight`\n */\n const _animatedContainerHeight = useReactiveSharedValue(\n _providedContainerHeight ?? INITIAL_CONTAINER_HEIGHT\n );\n /**\n * This is a conditional variable, where if the `BottomSheet` is used\n * in a modal, then it will subset vertical insets (top+bottom) from\n * provided container height.\n */\n const animatedContainerHeight = useDerivedValue(() => {\n const verticalInset = topInset + bottomInset;\n return $modal\n ? _animatedContainerHeight.value - verticalInset\n : _animatedContainerHeight.value;\n }, [$modal, topInset, bottomInset]);\n const animatedContainerOffset = useReactiveSharedValue(\n _providedContainerOffset ?? INITIAL_CONTAINER_OFFSET\n ) as Animated.SharedValue;\n const animatedHandleHeight = useReactiveSharedValue(\n _providedHandleHeight ?? INITIAL_HANDLE_HEIGHT\n );\n const animatedFooterHeight = useSharedValue(0);\n const animatedContentHeight = useSharedValue(INITIAL_CONTAINER_HEIGHT);\n const animatedSnapPoints = useNormalizedSnapPoints(\n _providedSnapPoints,\n animatedContainerHeight,\n animatedContentHeight,\n animatedHandleHeight,\n enableDynamicSizing,\n maxDynamicContentSize\n );\n const animatedHighestSnapPoint = useDerivedValue(\n () => animatedSnapPoints.value[animatedSnapPoints.value.length - 1]\n );\n const animatedClosedPosition = useDerivedValue(() => {\n let closedPosition = animatedContainerHeight.value;\n\n if ($modal || detached) {\n closedPosition = animatedContainerHeight.value + bottomInset;\n }\n\n return closedPosition;\n }, [$modal, detached, bottomInset]);\n const animatedSheetHeight = useDerivedValue(\n () => animatedContainerHeight.value - animatedHighestSnapPoint.value\n );\n const animatedCurrentIndex = useReactiveSharedValue(\n animateOnMount ? -1 : _providedIndex\n );\n const animatedPosition = useSharedValue(INITIAL_POSITION);\n const animatedNextPosition = useSharedValue(INITIAL_VALUE);\n const animatedNextPositionIndex = useSharedValue(0);\n\n // conditional\n const isAnimatedOnMount = useSharedValue(false);\n const isContentHeightFixed = useSharedValue(false);\n const isLayoutCalculated = useDerivedValue(() => {\n let isContainerHeightCalculated = false;\n //container height was provided.\n if (\n _providedContainerHeight !== null ||\n _providedContainerHeight !== undefined\n ) {\n isContainerHeightCalculated = true;\n }\n // container height did set.\n if (animatedContainerHeight.value !== INITIAL_CONTAINER_HEIGHT) {\n isContainerHeightCalculated = true;\n }\n\n let isHandleHeightCalculated = false;\n // handle height is provided.\n if (\n _providedHandleHeight !== null &&\n _providedHandleHeight !== undefined &&\n typeof _providedHandleHeight === 'number'\n ) {\n isHandleHeightCalculated = true;\n }\n // handle component is null.\n if (handleComponent === null) {\n animatedHandleHeight.value = 0;\n isHandleHeightCalculated = true;\n }\n // handle height did set.\n if (animatedHandleHeight.value !== INITIAL_HANDLE_HEIGHT) {\n isHandleHeightCalculated = true;\n }\n\n let isSnapPointsNormalized = false;\n // the first snap point did normalized\n if (animatedSnapPoints.value[0] !== INITIAL_SNAP_POINT) {\n isSnapPointsNormalized = true;\n }\n\n return (\n isContainerHeightCalculated &&\n isHandleHeightCalculated &&\n isSnapPointsNormalized\n );\n });\n const isInTemporaryPosition = useSharedValue(false);\n const isForcedClosing = useSharedValue(false);\n\n // gesture\n const animatedContentGestureState = useSharedValue(\n State.UNDETERMINED\n );\n const animatedHandleGestureState = useSharedValue(\n State.UNDETERMINED\n );\n //#endregion\n\n //#region hooks variables\n // scrollable variables\n const {\n animatedScrollableType,\n animatedScrollableContentOffsetY,\n animatedScrollableOverrideState,\n isScrollableRefreshable,\n setScrollableRef,\n removeScrollableRef,\n } = useScrollable();\n // keyboard\n const {\n state: animatedKeyboardState,\n height: animatedKeyboardHeight,\n animationDuration: keyboardAnimationDuration,\n animationEasing: keyboardAnimationEasing,\n shouldHandleKeyboardEvents,\n } = useKeyboard();\n const animatedKeyboardHeightInContainer = useSharedValue(0);\n //#endregion\n\n //#region state/dynamic variables\n // states\n const animatedAnimationState = useSharedValue(ANIMATION_STATE.UNDETERMINED);\n const animatedAnimationSource = useSharedValue(\n ANIMATION_SOURCE.MOUNT\n );\n const animatedSheetState = useDerivedValue(() => {\n // closed position = position >= container height\n if (animatedPosition.value >= animatedClosedPosition.value)\n return SHEET_STATE.CLOSED;\n\n // extended position = container height - sheet height\n const extendedPosition =\n animatedContainerHeight.value - animatedSheetHeight.value;\n if (animatedPosition.value === extendedPosition)\n return SHEET_STATE.EXTENDED;\n\n // extended position with keyboard =\n // container height - (sheet height + keyboard height in root container)\n const keyboardHeightInContainer = animatedKeyboardHeightInContainer.value;\n const extendedPositionWithKeyboard = Math.max(\n 0,\n animatedContainerHeight.value -\n (animatedSheetHeight.value + keyboardHeightInContainer)\n );\n\n // detect if keyboard is open and the sheet is in temporary position\n if (\n keyboardBehavior === KEYBOARD_BEHAVIOR.interactive &&\n isInTemporaryPosition.value &&\n animatedPosition.value === extendedPositionWithKeyboard\n ) {\n return SHEET_STATE.EXTENDED;\n }\n\n // fill parent = 0\n if (animatedPosition.value === 0) {\n return SHEET_STATE.FILL_PARENT;\n }\n\n // detect if position is below extended point\n if (animatedPosition.value < extendedPosition) {\n return SHEET_STATE.OVER_EXTENDED;\n }\n\n return SHEET_STATE.OPENED;\n }, [\n animatedClosedPosition,\n animatedContainerHeight,\n animatedKeyboardHeightInContainer,\n animatedPosition,\n animatedSheetHeight,\n isInTemporaryPosition,\n keyboardBehavior,\n ]);\n const animatedScrollableState = useDerivedValue(() => {\n /**\n * if scrollable override state is set, then we just return its value.\n */\n if (\n animatedScrollableOverrideState.value !== SCROLLABLE_STATE.UNDETERMINED\n ) {\n return animatedScrollableOverrideState.value;\n }\n /**\n * if sheet state is fill parent, then unlock scrolling\n */\n if (animatedSheetState.value === SHEET_STATE.FILL_PARENT) {\n return SCROLLABLE_STATE.UNLOCKED;\n }\n\n /**\n * if sheet state is extended, then unlock scrolling\n */\n if (animatedSheetState.value === SHEET_STATE.EXTENDED) {\n return SCROLLABLE_STATE.UNLOCKED;\n }\n\n /**\n * if keyboard is shown and sheet is animating\n * then we do not lock the scrolling to not lose\n * current scrollable scroll position.\n */\n if (\n animatedKeyboardState.value === KEYBOARD_STATE.SHOWN &&\n animatedAnimationState.value === ANIMATION_STATE.RUNNING\n ) {\n return SCROLLABLE_STATE.UNLOCKED;\n }\n\n return SCROLLABLE_STATE.LOCKED;\n });\n // dynamic\n const animatedContentHeightMax = useDerivedValue(() => {\n const keyboardHeightInContainer = animatedKeyboardHeightInContainer.value;\n const handleHeight = Math.max(0, animatedHandleHeight.value);\n let contentHeight = animatedSheetHeight.value - handleHeight;\n\n if (\n keyboardBehavior === KEYBOARD_BEHAVIOR.extend &&\n animatedKeyboardState.value === KEYBOARD_STATE.SHOWN\n ) {\n contentHeight = contentHeight - keyboardHeightInContainer;\n } else if (\n keyboardBehavior === KEYBOARD_BEHAVIOR.fillParent &&\n isInTemporaryPosition.value\n ) {\n if (animatedKeyboardState.value === KEYBOARD_STATE.SHOWN) {\n contentHeight =\n animatedContainerHeight.value -\n handleHeight -\n keyboardHeightInContainer;\n } else {\n contentHeight = animatedContainerHeight.value - handleHeight;\n }\n } else if (\n keyboardBehavior === KEYBOARD_BEHAVIOR.interactive &&\n isInTemporaryPosition.value\n ) {\n const contentWithKeyboardHeight =\n contentHeight + keyboardHeightInContainer;\n\n if (animatedKeyboardState.value === KEYBOARD_STATE.SHOWN) {\n if (\n keyboardHeightInContainer + animatedSheetHeight.value >\n animatedContainerHeight.value\n ) {\n contentHeight =\n animatedContainerHeight.value -\n keyboardHeightInContainer -\n handleHeight;\n }\n } else if (\n contentWithKeyboardHeight + handleHeight >\n animatedContainerHeight.value\n ) {\n contentHeight = animatedContainerHeight.value - handleHeight;\n } else {\n contentHeight = contentWithKeyboardHeight;\n }\n }\n\n /**\n * before the container is measured, `contentHeight` value will be below zero,\n * which will lead to freeze the scrollable.\n *\n * @link (https://github.com/gorhom/react-native-bottom-sheet/issues/470)\n */\n return Math.max(contentHeight, 0);\n }, [\n animatedContainerHeight,\n animatedHandleHeight,\n animatedKeyboardHeightInContainer,\n animatedKeyboardState,\n animatedSheetHeight,\n isInTemporaryPosition,\n keyboardBehavior,\n ]);\n const animatedIndex = useDerivedValue(() => {\n const adjustedSnapPoints = animatedSnapPoints.value.slice().reverse();\n const adjustedSnapPointsIndexes = animatedSnapPoints.value\n .slice()\n .map((_: any, index: number) => index)\n .reverse();\n\n /**\n * we add the close state index `-1`\n */\n adjustedSnapPoints.push(animatedContainerHeight.value);\n adjustedSnapPointsIndexes.push(-1);\n\n const currentIndex = isLayoutCalculated.value\n ? interpolate(\n animatedPosition.value,\n adjustedSnapPoints,\n adjustedSnapPointsIndexes,\n Extrapolate.CLAMP\n )\n : -1;\n\n /**\n * if the sheet is currently running an animation by the keyboard opening,\n * then we clamp the index on android with resize keyboard mode.\n */\n if (\n android_keyboardInputMode === KEYBOARD_INPUT_MODE.adjustResize &&\n animatedAnimationSource.value === ANIMATION_SOURCE.KEYBOARD &&\n animatedAnimationState.value === ANIMATION_STATE.RUNNING &&\n isInTemporaryPosition.value\n ) {\n return Math.max(animatedCurrentIndex.value, currentIndex);\n }\n\n /**\n * if the sheet is currently running an animation by snap point change - usually caused\n * by dynamic content height -, then we return the next position index.\n */\n if (\n animatedAnimationSource.value === ANIMATION_SOURCE.SNAP_POINT_CHANGE &&\n animatedAnimationState.value === ANIMATION_STATE.RUNNING\n ) {\n return animatedNextPositionIndex.value;\n }\n\n return currentIndex;\n }, [android_keyboardInputMode]);\n //#endregion\n\n //#region private methods\n /**\n * Calculate the next position based on keyboard state.\n */\n const getNextPosition = useWorkletCallback(\n function getNextPosition() {\n 'worklet';\n const currentIndex = animatedCurrentIndex.value;\n const snapPoints = animatedSnapPoints.value;\n const keyboardState = animatedKeyboardState.value;\n const highestSnapPoint = animatedHighestSnapPoint.value;\n\n /**\n * Handle restore sheet position on blur\n */\n if (\n keyboardBlurBehavior === KEYBOARD_BLUR_BEHAVIOR.restore &&\n keyboardState === KEYBOARD_STATE.HIDDEN &&\n animatedContentGestureState.value !== State.ACTIVE &&\n animatedHandleGestureState.value !== State.ACTIVE\n ) {\n isInTemporaryPosition.value = false;\n const nextPosition = snapPoints[currentIndex];\n return nextPosition;\n }\n\n /**\n * Handle extend behavior\n */\n if (\n keyboardBehavior === KEYBOARD_BEHAVIOR.extend &&\n keyboardState === KEYBOARD_STATE.SHOWN\n ) {\n return highestSnapPoint;\n }\n\n /**\n * Handle full screen behavior\n */\n if (\n keyboardBehavior === KEYBOARD_BEHAVIOR.fillParent &&\n keyboardState === KEYBOARD_STATE.SHOWN\n ) {\n isInTemporaryPosition.value = true;\n return 0;\n }\n\n /**\n * handle interactive behavior\n */\n if (\n keyboardBehavior === KEYBOARD_BEHAVIOR.interactive &&\n keyboardState === KEYBOARD_STATE.SHOWN\n ) {\n isInTemporaryPosition.value = true;\n const keyboardHeightInContainer =\n animatedKeyboardHeightInContainer.value;\n return Math.max(0, highestSnapPoint - keyboardHeightInContainer);\n }\n\n if (isInTemporaryPosition.value) {\n return animatedPosition.value;\n }\n\n return snapPoints[currentIndex];\n },\n [\n animatedContentGestureState,\n animatedCurrentIndex,\n animatedHandleGestureState,\n animatedHighestSnapPoint,\n animatedKeyboardHeightInContainer,\n animatedKeyboardState,\n animatedPosition,\n animatedSnapPoints,\n isInTemporaryPosition,\n keyboardBehavior,\n keyboardBlurBehavior,\n ]\n );\n const handleOnChange = useCallback(\n function handleOnChange(index: number) {\n print({\n component: BottomSheet.name,\n method: handleOnChange.name,\n params: {\n index,\n animatedCurrentIndex: animatedCurrentIndex.value,\n },\n });\n\n if (_providedOnChange) {\n _providedOnChange(index);\n }\n },\n [_providedOnChange, animatedCurrentIndex]\n );\n const handleOnAnimate = useCallback(\n function handleOnAnimate(toPoint: number) {\n const snapPoints = animatedSnapPoints.value;\n const toIndex = snapPoints.indexOf(toPoint);\n\n print({\n component: BottomSheet.name,\n method: handleOnAnimate.name,\n params: {\n toIndex,\n fromIndex: animatedCurrentIndex.value,\n },\n });\n\n if (!_providedOnAnimate) {\n return;\n }\n\n if (toIndex !== animatedCurrentIndex.value) {\n _providedOnAnimate(animatedCurrentIndex.value, toIndex);\n }\n },\n [_providedOnAnimate, animatedSnapPoints, animatedCurrentIndex]\n );\n //#endregion\n\n //#region animation\n const stopAnimation = useWorkletCallback(() => {\n cancelAnimation(animatedPosition);\n isForcedClosing.value = false;\n animatedAnimationSource.value = ANIMATION_SOURCE.NONE;\n animatedAnimationState.value = ANIMATION_STATE.STOPPED;\n }, [animatedPosition, animatedAnimationState, animatedAnimationSource]);\n const animateToPositionCompleted = useWorkletCallback(\n function animateToPositionCompleted(isFinished?: boolean) {\n isForcedClosing.value = false;\n\n if (!isFinished) {\n return;\n }\n runOnJS(print)({\n component: BottomSheet.name,\n method: animateToPositionCompleted.name,\n params: {\n animatedCurrentIndex: animatedCurrentIndex.value,\n animatedNextPosition: animatedNextPosition.value,\n animatedNextPositionIndex: animatedNextPositionIndex.value,\n },\n });\n\n animatedAnimationSource.value = ANIMATION_SOURCE.NONE;\n animatedAnimationState.value = ANIMATION_STATE.STOPPED;\n animatedNextPosition.value = INITIAL_VALUE;\n animatedNextPositionIndex.value = INITIAL_VALUE;\n }\n );\n const animateToPosition: AnimateToPositionType = useWorkletCallback(\n function animateToPosition(\n position: number,\n source: ANIMATION_SOURCE,\n velocity: number = 0,\n configs?: WithTimingConfig | WithSpringConfig\n ) {\n if (\n position === animatedPosition.value ||\n position === undefined ||\n (animatedAnimationState.value === ANIMATION_STATE.RUNNING &&\n position === animatedNextPosition.value)\n ) {\n return;\n }\n\n runOnJS(print)({\n component: BottomSheet.name,\n method: animateToPosition.name,\n params: {\n currentPosition: animatedPosition.value,\n position,\n velocity,\n animatedContainerHeight: animatedContainerHeight.value,\n },\n });\n\n stopAnimation();\n\n /**\n * set animation state to running, and source\n */\n animatedAnimationState.value = ANIMATION_STATE.RUNNING;\n animatedAnimationSource.value = source;\n\n /**\n * store next position\n */\n animatedNextPosition.value = position;\n animatedNextPositionIndex.value =\n animatedSnapPoints.value.indexOf(position);\n\n /**\n * fire `onAnimate` callback\n */\n runOnJS(handleOnAnimate)(position);\n\n /**\n * force animation configs from parameters, if provided\n */\n if (configs !== undefined) {\n animatedPosition.value = animate({\n point: position,\n configs,\n velocity,\n onComplete: animateToPositionCompleted,\n });\n } else {\n /**\n * use animationConfigs callback, if provided\n */\n animatedPosition.value = animate({\n point: position,\n velocity,\n configs: _providedAnimationConfigs,\n onComplete: animateToPositionCompleted,\n });\n }\n },\n [handleOnAnimate, _providedAnimationConfigs]\n );\n //#endregion\n\n //#region public methods\n const handleSnapToIndex = useCallback(\n function handleSnapToIndex(\n index: number,\n animationConfigs?: WithSpringConfig | WithTimingConfig\n ) {\n const snapPoints = animatedSnapPoints.value;\n invariant(\n index >= -1 && index <= snapPoints.length - 1,\n `'index' was provided but out of the provided snap points range! expected value to be between -1, ${\n snapPoints.length - 1\n }`\n );\n print({\n component: BottomSheet.name,\n method: handleSnapToIndex.name,\n params: {\n index,\n },\n });\n\n const nextPosition = snapPoints[index];\n\n /**\n * exit method if :\n * - layout is not calculated.\n * - already animating to next position.\n * - sheet is forced closing.\n */\n if (\n !isLayoutCalculated.value ||\n index === animatedNextPositionIndex.value ||\n nextPosition === animatedNextPosition.value ||\n isForcedClosing.value\n ) {\n return;\n }\n\n /**\n * reset temporary position boolean.\n */\n isInTemporaryPosition.value = false;\n\n runOnUI(animateToPosition)(\n nextPosition,\n ANIMATION_SOURCE.USER,\n 0,\n animationConfigs\n );\n },\n [\n animateToPosition,\n isLayoutCalculated,\n isInTemporaryPosition,\n isForcedClosing,\n animatedSnapPoints,\n animatedNextPosition,\n animatedNextPositionIndex,\n ]\n );\n const handleSnapToPosition = useWorkletCallback(\n function handleSnapToPosition(\n position: number | string,\n animationConfigs?: WithSpringConfig | WithTimingConfig\n ) {\n print({\n component: BottomSheet.name,\n method: handleSnapToPosition.name,\n params: {\n position,\n },\n });\n\n /**\n * normalized provided position.\n */\n const nextPosition = normalizeSnapPoint(\n position,\n animatedContainerHeight.value\n );\n\n /**\n * exit method if :\n * - layout is not calculated.\n * - already animating to next position.\n * - sheet is forced closing.\n */\n if (\n !isLayoutCalculated ||\n nextPosition === animatedNextPosition.value ||\n isForcedClosing.value\n ) {\n return;\n }\n\n /**\n * mark the new position as temporary.\n */\n isInTemporaryPosition.value = true;\n\n runOnUI(animateToPosition)(\n nextPosition,\n ANIMATION_SOURCE.USER,\n 0,\n animationConfigs\n );\n },\n [\n animateToPosition,\n bottomInset,\n topInset,\n isLayoutCalculated,\n isForcedClosing,\n animatedContainerHeight,\n animatedPosition,\n ]\n );\n const handleClose = useCallback(\n function handleClose(\n animationConfigs?: WithSpringConfig | WithTimingConfig\n ) {\n print({\n component: BottomSheet.name,\n method: handleClose.name,\n });\n\n const nextPosition = animatedClosedPosition.value;\n\n /**\n * exit method if :\n * - layout is not calculated.\n * - already animating to next position.\n * - sheet is forced closing.\n */\n if (\n !isLayoutCalculated.value ||\n nextPosition === animatedNextPosition.value ||\n isForcedClosing.value\n ) {\n return;\n }\n\n /**\n * reset temporary position variable.\n */\n isInTemporaryPosition.value = false;\n\n runOnUI(animateToPosition)(\n nextPosition,\n ANIMATION_SOURCE.USER,\n 0,\n animationConfigs\n );\n },\n [\n animateToPosition,\n isForcedClosing,\n isLayoutCalculated,\n isInTemporaryPosition,\n animatedNextPosition,\n animatedClosedPosition,\n ]\n );\n const handleForceClose = useCallback(\n function handleForceClose(\n animationConfigs?: WithSpringConfig | WithTimingConfig\n ) {\n print({\n component: BottomSheet.name,\n method: handleForceClose.name,\n });\n\n const nextPosition = animatedClosedPosition.value;\n\n /**\n * exit method if :\n * - already animating to next position.\n * - sheet is forced closing.\n */\n if (\n nextPosition === animatedNextPosition.value ||\n isForcedClosing.value\n ) {\n return;\n }\n\n /**\n * reset temporary position variable.\n */\n isInTemporaryPosition.value = false;\n\n /**\n * set force closing variable.\n */\n isForcedClosing.value = true;\n\n runOnUI(animateToPosition)(\n nextPosition,\n ANIMATION_SOURCE.USER,\n 0,\n animationConfigs\n );\n },\n [\n animateToPosition,\n isForcedClosing,\n isInTemporaryPosition,\n animatedNextPosition,\n animatedClosedPosition,\n ]\n );\n const handleExpand = useCallback(\n function handleExpand(\n animationConfigs?: WithSpringConfig | WithTimingConfig\n ) {\n print({\n component: BottomSheet.name,\n method: handleExpand.name,\n });\n\n const snapPoints = animatedSnapPoints.value;\n const nextPosition = snapPoints[snapPoints.length - 1];\n\n /**\n * exit method if :\n * - layout is not calculated.\n * - already animating to next position.\n * - sheet is forced closing.\n */\n if (\n !isLayoutCalculated.value ||\n snapPoints.length - 1 === animatedNextPositionIndex.value ||\n nextPosition === animatedNextPosition.value ||\n isForcedClosing.value\n ) {\n return;\n }\n\n /**\n * reset temporary position boolean.\n */\n isInTemporaryPosition.value = false;\n\n runOnUI(animateToPosition)(\n nextPosition,\n ANIMATION_SOURCE.USER,\n 0,\n animationConfigs\n );\n },\n [\n animateToPosition,\n isInTemporaryPosition,\n isLayoutCalculated,\n isForcedClosing,\n animatedSnapPoints,\n animatedNextPosition,\n animatedNextPositionIndex,\n ]\n );\n const handleCollapse = useCallback(\n function handleCollapse(\n animationConfigs?: WithSpringConfig | WithTimingConfig\n ) {\n print({\n component: BottomSheet.name,\n method: handleCollapse.name,\n });\n\n const nextPosition = animatedSnapPoints.value[0];\n\n /**\n * exit method if :\n * - layout is not calculated.\n * - already animating to next position.\n * - sheet is forced closing.\n */\n if (\n !isLayoutCalculated ||\n animatedNextPositionIndex.value === 0 ||\n nextPosition === animatedNextPosition.value ||\n isForcedClosing.value\n ) {\n return;\n }\n\n /**\n * reset temporary position boolean.\n */\n isInTemporaryPosition.value = false;\n\n runOnUI(animateToPosition)(\n nextPosition,\n ANIMATION_SOURCE.USER,\n 0,\n animationConfigs\n );\n },\n [\n animateToPosition,\n isForcedClosing,\n isLayoutCalculated,\n isInTemporaryPosition,\n animatedSnapPoints,\n animatedNextPosition,\n animatedNextPositionIndex,\n ]\n );\n\n useImperativeHandle(ref, () => ({\n snapToIndex: handleSnapToIndex,\n snapToPosition: handleSnapToPosition,\n expand: handleExpand,\n collapse: handleCollapse,\n close: handleClose,\n forceClose: handleForceClose,\n }));\n //#endregion\n\n //#region contexts variables\n const internalContextVariables = useMemo(\n () => ({\n enableContentPanningGesture,\n enableDynamicSizing,\n overDragResistanceFactor,\n enableOverDrag,\n enablePanDownToClose,\n animatedAnimationState,\n animatedSheetState,\n animatedScrollableState,\n animatedScrollableOverrideState,\n animatedContentGestureState,\n animatedHandleGestureState,\n animatedKeyboardState,\n animatedScrollableType,\n animatedIndex,\n animatedPosition,\n animatedContentHeight,\n animatedClosedPosition,\n animatedHandleHeight,\n animatedFooterHeight,\n animatedKeyboardHeight,\n animatedKeyboardHeightInContainer,\n animatedContainerHeight,\n animatedSnapPoints,\n animatedHighestSnapPoint,\n animatedScrollableContentOffsetY,\n isInTemporaryPosition,\n isContentHeightFixed,\n isScrollableRefreshable,\n shouldHandleKeyboardEvents,\n simultaneousHandlers: _providedSimultaneousHandlers,\n waitFor: _providedWaitFor,\n activeOffsetX: _providedActiveOffsetX,\n activeOffsetY: _providedActiveOffsetY,\n failOffsetX: _providedFailOffsetX,\n failOffsetY: _providedFailOffsetY,\n animateToPosition,\n stopAnimation,\n setScrollableRef,\n removeScrollableRef,\n }),\n [\n animatedIndex,\n animatedPosition,\n animatedContentHeight,\n animatedScrollableType,\n animatedContentGestureState,\n animatedHandleGestureState,\n animatedClosedPosition,\n animatedFooterHeight,\n animatedContainerHeight,\n animatedHandleHeight,\n animatedAnimationState,\n animatedKeyboardState,\n animatedKeyboardHeight,\n animatedKeyboardHeightInContainer,\n animatedSheetState,\n animatedHighestSnapPoint,\n animatedScrollableState,\n animatedScrollableOverrideState,\n animatedSnapPoints,\n shouldHandleKeyboardEvents,\n animatedScrollableContentOffsetY,\n isScrollableRefreshable,\n isContentHeightFixed,\n isInTemporaryPosition,\n enableContentPanningGesture,\n overDragResistanceFactor,\n enableOverDrag,\n enablePanDownToClose,\n enableDynamicSizing,\n _providedSimultaneousHandlers,\n _providedWaitFor,\n _providedActiveOffsetX,\n _providedActiveOffsetY,\n _providedFailOffsetX,\n _providedFailOffsetY,\n setScrollableRef,\n removeScrollableRef,\n animateToPosition,\n stopAnimation,\n ]\n );\n const externalContextVariables = useMemo(\n () => ({\n animatedIndex,\n animatedPosition,\n snapToIndex: handleSnapToIndex,\n snapToPosition: handleSnapToPosition,\n expand: handleExpand,\n collapse: handleCollapse,\n close: handleClose,\n forceClose: handleForceClose,\n }),\n [\n animatedIndex,\n animatedPosition,\n handleSnapToIndex,\n handleSnapToPosition,\n handleExpand,\n handleCollapse,\n handleClose,\n handleForceClose,\n ]\n );\n //#endregion\n\n //#region styles\n const containerAnimatedStyle = useAnimatedStyle(\n () => ({\n opacity:\n Platform.OS === 'android' && animatedIndex.value === -1 ? 0 : 1,\n transform: [\n {\n translateY: animatedPosition.value,\n },\n ],\n }),\n [animatedPosition, animatedIndex]\n );\n const containerStyle = useMemo(\n () => [_providedStyle, styles.container, containerAnimatedStyle],\n [_providedStyle, containerAnimatedStyle]\n );\n const contentContainerAnimatedStyle = useAnimatedStyle(() => {\n /**\n * if content height was provided, then we skip setting\n * calculated height.\n */\n if (_providedContentHeight) {\n return {};\n }\n\n return {\n height: animate({\n point: animatedContentHeightMax.value,\n configs: _providedAnimationConfigs,\n }),\n };\n }, [animatedContentHeightMax, enableDynamicSizing, animatedContentHeight]);\n const contentContainerStyle = useMemo(\n () => [styles.contentContainer, contentContainerAnimatedStyle],\n [contentContainerAnimatedStyle]\n );\n /**\n * added safe area to prevent the sheet from floating above\n * the bottom of the screen, when sheet being over dragged or\n * when the sheet is resized.\n */\n const contentMaskContainerAnimatedStyle = useAnimatedStyle(() => {\n if (detached) {\n return {\n overflow: 'visible',\n };\n }\n return {\n paddingBottom: animatedContainerHeight.value,\n };\n }, [detached]);\n const contentMaskContainerStyle = useMemo(\n () => [styles.contentMaskContainer, contentMaskContainerAnimatedStyle],\n [contentMaskContainerAnimatedStyle]\n );\n //#endregion\n\n //#region effects\n /**\n * React to `isLayoutCalculated` change, to insure that the sheet will\n * appears/mounts only when all layout is been calculated.\n *\n * @alias OnMount\n */\n useAnimatedReaction(\n () => isLayoutCalculated.value,\n _isLayoutCalculated => {\n /**\n * exit method if:\n * - layout is not calculated yet.\n * - already did animate on mount.\n */\n if (!_isLayoutCalculated || isAnimatedOnMount.value) {\n return;\n }\n\n let nextPosition;\n if (_providedIndex === -1) {\n nextPosition = animatedClosedPosition.value;\n animatedNextPositionIndex.value = -1;\n } else {\n nextPosition = animatedSnapPoints.value[_providedIndex];\n }\n\n runOnJS(print)({\n component: BottomSheet.name,\n method: 'useAnimatedReaction::OnMount',\n params: {\n isLayoutCalculated: _isLayoutCalculated,\n animatedSnapPoints: animatedSnapPoints.value,\n nextPosition,\n },\n });\n\n /**\n * here we exit method early because the next position\n * is out of the screen, this happens when `snapPoints`\n * still being calculated.\n */\n if (\n nextPosition === INITIAL_POSITION ||\n nextPosition === animatedClosedPosition.value\n ) {\n isAnimatedOnMount.value = true;\n animatedCurrentIndex.value = _providedIndex;\n return;\n }\n\n if (animateOnMount) {\n animateToPosition(nextPosition, ANIMATION_SOURCE.MOUNT);\n } else {\n animatedPosition.value = nextPosition;\n }\n isAnimatedOnMount.value = true;\n },\n [_providedIndex, animateOnMount]\n );\n\n /**\n * React to `snapPoints` change, to insure that the sheet position reflect\n * to the current point correctly.\n *\n * @alias OnSnapPointsChange\n */\n useAnimatedReaction(\n () => ({\n snapPoints: animatedSnapPoints.value,\n containerHeight: animatedContainerHeight.value,\n }),\n (result, _previousResult) => {\n const { snapPoints, containerHeight } = result;\n const _previousSnapPoints = _previousResult?.snapPoints;\n const _previousContainerHeight = _previousResult?.containerHeight;\n\n let nextPosition;\n let animationConfig;\n let animationSource = ANIMATION_SOURCE.SNAP_POINT_CHANGE;\n\n /**\n * if the bottom sheet is closing and the container gets resized,\n * then we restart the closing animation to the new position.\n */\n if (\n animatedAnimationState.value === ANIMATION_STATE.RUNNING &&\n animatedNextPositionIndex.value === -1 &&\n _previousContainerHeight !== containerHeight\n ) {\n animationSource = ANIMATION_SOURCE.CONTAINER_RESIZE;\n animationConfig = {\n duration: 0,\n };\n animateToPosition(\n containerHeight,\n animationSource,\n 0,\n animationConfig\n );\n }\n\n if (\n JSON.stringify(snapPoints) === JSON.stringify(_previousSnapPoints) ||\n !isLayoutCalculated.value ||\n !isAnimatedOnMount.value ||\n containerHeight <= 0\n ) {\n return;\n }\n\n runOnJS(print)({\n component: BottomSheet.name,\n method: 'useAnimatedReaction::OnSnapPointChange',\n params: {\n snapPoints,\n },\n });\n\n /**\n * if snap points changed while sheet is animating, then\n * we stop the animation and animate to the updated point.\n */\n if (\n animatedAnimationState.value === ANIMATION_STATE.RUNNING &&\n animatedNextPositionIndex.value !== animatedCurrentIndex.value\n ) {\n nextPosition =\n animatedNextPositionIndex.value !== -1\n ? snapPoints[animatedNextPositionIndex.value]\n : animatedNextPosition.value;\n } else if (animatedCurrentIndex.value === -1) {\n nextPosition = animatedClosedPosition.value;\n } else if (isInTemporaryPosition.value) {\n nextPosition = getNextPosition();\n } else {\n nextPosition = snapPoints[animatedCurrentIndex.value];\n\n /**\n * if snap points changes because of the container height change,\n * then we skip the snap animation by setting the duration to 0.\n */\n if (containerHeight !== _previousContainerHeight) {\n animationSource = ANIMATION_SOURCE.CONTAINER_RESIZE;\n animationConfig = {\n duration: 0,\n };\n }\n }\n animateToPosition(nextPosition, animationSource, 0, animationConfig);\n }\n );\n\n /**\n * React to keyboard appearance state.\n *\n * @alias OnKeyboardStateChange\n */\n useAnimatedReaction(\n () => ({\n _keyboardState: animatedKeyboardState.value,\n _keyboardHeight: animatedKeyboardHeight.value,\n }),\n (result, _previousResult) => {\n const { _keyboardState, _keyboardHeight } = result;\n const _previousKeyboardState = _previousResult?._keyboardState;\n const _previousKeyboardHeight = _previousResult?._keyboardHeight;\n\n /**\n * Calculate the keyboard height in the container.\n */\n animatedKeyboardHeightInContainer.value = $modal\n ? Math.abs(\n _keyboardHeight -\n Math.abs(bottomInset - animatedContainerOffset.value.bottom)\n )\n : Math.abs(_keyboardHeight - animatedContainerOffset.value.bottom);\n\n const hasActiveGesture =\n animatedContentGestureState.value === State.ACTIVE ||\n animatedContentGestureState.value === State.BEGAN ||\n animatedHandleGestureState.value === State.ACTIVE ||\n animatedHandleGestureState.value === State.BEGAN;\n\n if (\n /**\n * if keyboard state is equal to the previous state, then exit the method\n */\n (_keyboardState === _previousKeyboardState &&\n _keyboardHeight === _previousKeyboardHeight) ||\n /**\n * if user is interacting with sheet, then exit the method\n */\n hasActiveGesture ||\n /**\n * if sheet not animated on mount yet, then exit the method\n */\n !isAnimatedOnMount.value ||\n /**\n * if new keyboard state is hidden and blur behavior is none, then exit the method\n */\n (_keyboardState === KEYBOARD_STATE.HIDDEN &&\n keyboardBlurBehavior === KEYBOARD_BLUR_BEHAVIOR.none) ||\n /**\n * if platform is android and the input mode is resize, then exit the method\n */\n (Platform.OS === 'android' &&\n keyboardBehavior === KEYBOARD_BEHAVIOR.interactive &&\n android_keyboardInputMode === KEYBOARD_INPUT_MODE.adjustResize)\n ) {\n animatedKeyboardHeightInContainer.value = 0;\n return;\n }\n\n runOnJS(print)({\n component: BottomSheet.name,\n method: 'useAnimatedReaction::OnKeyboardStateChange',\n params: {\n keyboardState: _keyboardState,\n keyboardHeight: _keyboardHeight,\n },\n });\n\n let animationConfigs = getKeyboardAnimationConfigs(\n keyboardAnimationEasing.value,\n keyboardAnimationDuration.value\n );\n const nextPosition = getNextPosition();\n animateToPosition(\n nextPosition,\n ANIMATION_SOURCE.KEYBOARD,\n 0,\n animationConfigs\n );\n },\n [\n $modal,\n bottomInset,\n keyboardBehavior,\n keyboardBlurBehavior,\n android_keyboardInputMode,\n animatedContainerOffset,\n getNextPosition,\n ]\n );\n\n /**\n * sets provided animated position\n */\n useAnimatedReaction(\n () => animatedPosition.value,\n _animatedPosition => {\n if (_providedAnimatedPosition) {\n _providedAnimatedPosition.value = _animatedPosition + topInset;\n }\n }\n );\n\n /**\n * sets provided animated index\n */\n useAnimatedReaction(\n () => animatedIndex.value,\n _animatedIndex => {\n if (_providedAnimatedIndex) {\n _providedAnimatedIndex.value = _animatedIndex;\n }\n }\n );\n\n /**\n * React to internal variables to detect change in snap position.\n *\n * @alias OnChange\n */\n useAnimatedReaction(\n () => ({\n _animatedIndex: animatedIndex.value,\n _animatedPosition: animatedPosition.value,\n _animationState: animatedAnimationState.value,\n _contentGestureState: animatedContentGestureState.value,\n _handleGestureState: animatedHandleGestureState.value,\n }),\n ({\n _animatedIndex,\n _animationState,\n _contentGestureState,\n _handleGestureState,\n }) => {\n /**\n * exit the method if animation state is not stopped.\n */\n if (_animationState !== ANIMATION_STATE.STOPPED) {\n return;\n }\n\n /**\n * exit the method if animated index value\n * has fraction, e.g. 1.99, 0.52\n */\n if (_animatedIndex % 1 !== 0) {\n return;\n }\n\n /**\n * exit the method if there any active gesture.\n */\n const hasNoActiveGesture =\n (_contentGestureState === State.END ||\n _contentGestureState === State.UNDETERMINED ||\n _contentGestureState === State.CANCELLED) &&\n (_handleGestureState === State.END ||\n _handleGestureState === State.UNDETERMINED ||\n _handleGestureState === State.CANCELLED);\n if (!hasNoActiveGesture) {\n return;\n }\n\n /**\n * if the index is not equal to the current index,\n * than the sheet position had changed and we trigger\n * the `onChange` callback.\n */\n if (_animatedIndex !== animatedCurrentIndex.value) {\n runOnJS(print)({\n component: BottomSheet.name,\n method: 'useAnimatedReaction::OnChange',\n params: {\n animatedCurrentIndex: animatedCurrentIndex.value,\n animatedIndex: _animatedIndex,\n },\n });\n\n animatedCurrentIndex.value = _animatedIndex;\n runOnJS(handleOnChange)(_animatedIndex);\n }\n\n /**\n * if index is `-1` than we fire the `onClose` callback.\n */\n if (_animatedIndex === -1 && _providedOnClose) {\n runOnJS(print)({\n component: BottomSheet.name,\n method: 'useAnimatedReaction::onClose',\n params: {\n animatedCurrentIndex: animatedCurrentIndex.value,\n animatedIndex: _animatedIndex,\n },\n });\n runOnJS(_providedOnClose)();\n }\n },\n [handleOnChange, _providedOnClose]\n );\n\n /**\n * React to `index` prop to snap the sheet to the new position.\n *\n * @alias onIndexChange\n */\n useEffect(() => {\n if (isAnimatedOnMount.value) {\n handleSnapToIndex(_providedIndex);\n }\n }, [\n _providedIndex,\n animatedCurrentIndex,\n isAnimatedOnMount,\n handleSnapToIndex,\n ]);\n //#endregion\n\n // render\n print({\n component: BottomSheet.name,\n method: 'render',\n params: {\n animatedSnapPoints: animatedSnapPoints.value,\n animatedCurrentIndex: animatedCurrentIndex.value,\n providedIndex: _providedIndex,\n },\n });\n return (\n \n \n \n \n \n \n \n \n \n {typeof Content === 'function' ? : Content}\n\n {footerComponent && (\n \n )}\n \n \n \n \n {/* */}\n \n \n \n \n );\n }\n);\n\nconst BottomSheet = memo(BottomSheetComponent);\nBottomSheet.displayName = 'BottomSheet';\n\nexport default BottomSheet;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheet/constants.js b/lib/commonjs/components/bottomSheet/constants.js new file mode 100644 index 000000000..8ab6b9974 --- /dev/null +++ b/lib/commonjs/components/bottomSheet/constants.js @@ -0,0 +1,52 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.INITIAL_VALUE = exports.INITIAL_SNAP_POINT = exports.INITIAL_HANDLE_HEIGHT = exports.INITIAL_CONTAINER_OFFSET = exports.INITIAL_CONTAINER_HEIGHT = exports.INITIAL_POSITION = exports.DEFAULT_KEYBOARD_INPUT_MODE = exports.DEFAULT_KEYBOARD_BLUR_BEHAVIOR = exports.DEFAULT_KEYBOARD_BEHAVIOR = exports.DEFAULT_ANIMATE_ON_MOUNT = exports.DEFAULT_DYNAMIC_SIZING = exports.DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE = exports.DEFAULT_ENABLE_OVER_DRAG = exports.DEFAULT_ENABLE_HANDLE_PANNING_GESTURE = exports.DEFAULT_ENABLE_CONTENT_PANNING_GESTURE = exports.DEFAULT_OVER_DRAG_RESISTANCE_FACTOR = exports.DEFAULT_HANDLE_HEIGHT = void 0; + +var _constants = require("../../constants"); + +// default values +const DEFAULT_HANDLE_HEIGHT = 24; +exports.DEFAULT_HANDLE_HEIGHT = DEFAULT_HANDLE_HEIGHT; +const DEFAULT_OVER_DRAG_RESISTANCE_FACTOR = 2.5; +exports.DEFAULT_OVER_DRAG_RESISTANCE_FACTOR = DEFAULT_OVER_DRAG_RESISTANCE_FACTOR; +const DEFAULT_ENABLE_CONTENT_PANNING_GESTURE = true; +exports.DEFAULT_ENABLE_CONTENT_PANNING_GESTURE = DEFAULT_ENABLE_CONTENT_PANNING_GESTURE; +const DEFAULT_ENABLE_HANDLE_PANNING_GESTURE = true; +exports.DEFAULT_ENABLE_HANDLE_PANNING_GESTURE = DEFAULT_ENABLE_HANDLE_PANNING_GESTURE; +const DEFAULT_ENABLE_OVER_DRAG = true; +exports.DEFAULT_ENABLE_OVER_DRAG = DEFAULT_ENABLE_OVER_DRAG; +const DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE = false; +exports.DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE = DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE; +const DEFAULT_ANIMATE_ON_MOUNT = true; +exports.DEFAULT_ANIMATE_ON_MOUNT = DEFAULT_ANIMATE_ON_MOUNT; +const DEFAULT_DYNAMIC_SIZING = false; // keyboard + +exports.DEFAULT_DYNAMIC_SIZING = DEFAULT_DYNAMIC_SIZING; +const DEFAULT_KEYBOARD_BEHAVIOR = _constants.KEYBOARD_BEHAVIOR.interactive; +exports.DEFAULT_KEYBOARD_BEHAVIOR = DEFAULT_KEYBOARD_BEHAVIOR; +const DEFAULT_KEYBOARD_BLUR_BEHAVIOR = _constants.KEYBOARD_BLUR_BEHAVIOR.none; +exports.DEFAULT_KEYBOARD_BLUR_BEHAVIOR = DEFAULT_KEYBOARD_BLUR_BEHAVIOR; +const DEFAULT_KEYBOARD_INPUT_MODE = _constants.KEYBOARD_INPUT_MODE.adjustPan; // initial values + +exports.DEFAULT_KEYBOARD_INPUT_MODE = DEFAULT_KEYBOARD_INPUT_MODE; +const INITIAL_VALUE = Number.NEGATIVE_INFINITY; +exports.INITIAL_VALUE = INITIAL_VALUE; +const INITIAL_SNAP_POINT = -999; +exports.INITIAL_SNAP_POINT = INITIAL_SNAP_POINT; +const INITIAL_CONTAINER_HEIGHT = -999; +exports.INITIAL_CONTAINER_HEIGHT = INITIAL_CONTAINER_HEIGHT; +const INITIAL_CONTAINER_OFFSET = { + top: 0, + bottom: 0, + left: 0, + right: 0 +}; +exports.INITIAL_CONTAINER_OFFSET = INITIAL_CONTAINER_OFFSET; +const INITIAL_HANDLE_HEIGHT = -999; +exports.INITIAL_HANDLE_HEIGHT = INITIAL_HANDLE_HEIGHT; +const INITIAL_POSITION = _constants.SCREEN_HEIGHT; +exports.INITIAL_POSITION = INITIAL_POSITION; +//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheet/constants.js.map b/lib/commonjs/components/bottomSheet/constants.js.map new file mode 100644 index 000000000..1c6c0352a --- /dev/null +++ b/lib/commonjs/components/bottomSheet/constants.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["constants.ts"],"names":["DEFAULT_HANDLE_HEIGHT","DEFAULT_OVER_DRAG_RESISTANCE_FACTOR","DEFAULT_ENABLE_CONTENT_PANNING_GESTURE","DEFAULT_ENABLE_HANDLE_PANNING_GESTURE","DEFAULT_ENABLE_OVER_DRAG","DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE","DEFAULT_ANIMATE_ON_MOUNT","DEFAULT_DYNAMIC_SIZING","DEFAULT_KEYBOARD_BEHAVIOR","KEYBOARD_BEHAVIOR","interactive","DEFAULT_KEYBOARD_BLUR_BEHAVIOR","KEYBOARD_BLUR_BEHAVIOR","none","DEFAULT_KEYBOARD_INPUT_MODE","KEYBOARD_INPUT_MODE","adjustPan","INITIAL_VALUE","Number","NEGATIVE_INFINITY","INITIAL_SNAP_POINT","INITIAL_CONTAINER_HEIGHT","INITIAL_CONTAINER_OFFSET","top","bottom","left","right","INITIAL_HANDLE_HEIGHT","INITIAL_POSITION","SCREEN_HEIGHT"],"mappings":";;;;;;;AAAA;;AAOA;AACA,MAAMA,qBAAqB,GAAG,EAA9B;;AACA,MAAMC,mCAAmC,GAAG,GAA5C;;AACA,MAAMC,sCAAsC,GAAG,IAA/C;;AACA,MAAMC,qCAAqC,GAAG,IAA9C;;AACA,MAAMC,wBAAwB,GAAG,IAAjC;;AACA,MAAMC,gCAAgC,GAAG,KAAzC;;AACA,MAAMC,wBAAwB,GAAG,IAAjC;;AACA,MAAMC,sBAAsB,GAAG,KAA/B,C,CAEA;;;AACA,MAAMC,yBAAyB,GAAGC,6BAAkBC,WAApD;;AACA,MAAMC,8BAA8B,GAAGC,kCAAuBC,IAA9D;;AACA,MAAMC,2BAA2B,GAAGC,+BAAoBC,SAAxD,C,CAEA;;;AACA,MAAMC,aAAa,GAAGC,MAAM,CAACC,iBAA7B;;AACA,MAAMC,kBAAkB,GAAG,CAAC,GAA5B;;AACA,MAAMC,wBAAwB,GAAG,CAAC,GAAlC;;AACA,MAAMC,wBAAwB,GAAG;AAC/BC,EAAAA,GAAG,EAAE,CAD0B;AAE/BC,EAAAA,MAAM,EAAE,CAFuB;AAG/BC,EAAAA,IAAI,EAAE,CAHyB;AAI/BC,EAAAA,KAAK,EAAE;AAJwB,CAAjC;;AAMA,MAAMC,qBAAqB,GAAG,CAAC,GAA/B;;AACA,MAAMC,gBAAgB,GAAGC,wBAAzB","sourcesContent":["import {\n KEYBOARD_BEHAVIOR,\n KEYBOARD_BLUR_BEHAVIOR,\n KEYBOARD_INPUT_MODE,\n SCREEN_HEIGHT,\n} from '../../constants';\n\n// default values\nconst DEFAULT_HANDLE_HEIGHT = 24;\nconst DEFAULT_OVER_DRAG_RESISTANCE_FACTOR = 2.5;\nconst DEFAULT_ENABLE_CONTENT_PANNING_GESTURE = true;\nconst DEFAULT_ENABLE_HANDLE_PANNING_GESTURE = true;\nconst DEFAULT_ENABLE_OVER_DRAG = true;\nconst DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE = false;\nconst DEFAULT_ANIMATE_ON_MOUNT = true;\nconst DEFAULT_DYNAMIC_SIZING = false;\n\n// keyboard\nconst DEFAULT_KEYBOARD_BEHAVIOR = KEYBOARD_BEHAVIOR.interactive;\nconst DEFAULT_KEYBOARD_BLUR_BEHAVIOR = KEYBOARD_BLUR_BEHAVIOR.none;\nconst DEFAULT_KEYBOARD_INPUT_MODE = KEYBOARD_INPUT_MODE.adjustPan;\n\n// initial values\nconst INITIAL_VALUE = Number.NEGATIVE_INFINITY;\nconst INITIAL_SNAP_POINT = -999;\nconst INITIAL_CONTAINER_HEIGHT = -999;\nconst INITIAL_CONTAINER_OFFSET = {\n top: 0,\n bottom: 0,\n left: 0,\n right: 0,\n};\nconst INITIAL_HANDLE_HEIGHT = -999;\nconst INITIAL_POSITION = SCREEN_HEIGHT;\n\nexport {\n DEFAULT_HANDLE_HEIGHT,\n DEFAULT_OVER_DRAG_RESISTANCE_FACTOR,\n DEFAULT_ENABLE_CONTENT_PANNING_GESTURE,\n DEFAULT_ENABLE_HANDLE_PANNING_GESTURE,\n DEFAULT_ENABLE_OVER_DRAG,\n DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE,\n DEFAULT_DYNAMIC_SIZING,\n DEFAULT_ANIMATE_ON_MOUNT,\n // keyboard\n DEFAULT_KEYBOARD_BEHAVIOR,\n DEFAULT_KEYBOARD_BLUR_BEHAVIOR,\n DEFAULT_KEYBOARD_INPUT_MODE,\n // layout\n INITIAL_POSITION,\n INITIAL_CONTAINER_HEIGHT,\n INITIAL_CONTAINER_OFFSET,\n INITIAL_HANDLE_HEIGHT,\n INITIAL_SNAP_POINT,\n INITIAL_VALUE,\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheet/index.js b/lib/commonjs/components/bottomSheet/index.js new file mode 100644 index 000000000..d334aebd8 --- /dev/null +++ b/lib/commonjs/components/bottomSheet/index.js @@ -0,0 +1,16 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "default", { + enumerable: true, + get: function () { + return _BottomSheet.default; + } +}); + +var _BottomSheet = _interopRequireDefault(require("./BottomSheet")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheet/index.js.map b/lib/commonjs/components/bottomSheet/index.js.map new file mode 100644 index 000000000..c39d4144d --- /dev/null +++ b/lib/commonjs/components/bottomSheet/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { default } from './BottomSheet';\nexport type { BottomSheetProps } from './types';\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheet/styles.js b/lib/commonjs/components/bottomSheet/styles.js new file mode 100644 index 000000000..1305493f5 --- /dev/null +++ b/lib/commonjs/components/bottomSheet/styles.js @@ -0,0 +1,25 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.styles = void 0; + +var _reactNative = require("react-native"); + +const styles = _reactNative.StyleSheet.create({ + container: { + flexDirection: 'column-reverse', + position: 'absolute', + top: 0, + left: 0, + right: 0 + }, + contentContainer: {}, + contentMaskContainer: { + overflow: 'hidden' + } +}); + +exports.styles = styles; +//# sourceMappingURL=styles.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheet/styles.js.map b/lib/commonjs/components/bottomSheet/styles.js.map new file mode 100644 index 000000000..730aedddc --- /dev/null +++ b/lib/commonjs/components/bottomSheet/styles.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["styles.ts"],"names":["styles","StyleSheet","create","container","flexDirection","position","top","left","right","contentContainer","contentMaskContainer","overflow"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,MAAM,GAAGC,wBAAWC,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE;AACTC,IAAAA,aAAa,EAAE,gBADN;AAETC,IAAAA,QAAQ,EAAE,UAFD;AAGTC,IAAAA,GAAG,EAAE,CAHI;AAITC,IAAAA,IAAI,EAAE,CAJG;AAKTC,IAAAA,KAAK,EAAE;AALE,GAD2B;AAQtCC,EAAAA,gBAAgB,EAAE,EARoB;AAStCC,EAAAA,oBAAoB,EAAE;AACpBC,IAAAA,QAAQ,EAAE;AADU;AATgB,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\n\nexport const styles = StyleSheet.create({\n container: {\n flexDirection: 'column-reverse',\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n },\n contentContainer: {},\n contentMaskContainer: {\n overflow: 'hidden',\n },\n});\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackdrop/BottomSheetBackdrop.js b/lib/commonjs/components/bottomSheetBackdrop/BottomSheetBackdrop.js new file mode 100644 index 000000000..200a7524e --- /dev/null +++ b/lib/commonjs/components/bottomSheetBackdrop/BottomSheetBackdrop.js @@ -0,0 +1,108 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireWildcard(require("react")); + +var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated")); + +var _reactNativeGestureHandler = require("react-native-gesture-handler"); + +var _hooks = require("../../hooks"); + +var _constants = require("./constants"); + +var _styles = require("./styles"); + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +const BottomSheetBackdropComponent = ({ + animatedIndex, + opacity: _providedOpacity, + appearsOnIndex: _providedAppearsOnIndex, + disappearsOnIndex: _providedDisappearsOnIndex, + enableTouchThrough: _providedEnableTouchThrough, + pressBehavior = _constants.DEFAULT_PRESS_BEHAVIOR, + onPress, + style, + children +}) => { + //#region hooks + const { + snapToIndex, + close + } = (0, _hooks.useBottomSheet)(); //#endregion + //#region defaults + + const opacity = _providedOpacity !== null && _providedOpacity !== void 0 ? _providedOpacity : _constants.DEFAULT_OPACITY; + const appearsOnIndex = _providedAppearsOnIndex !== null && _providedAppearsOnIndex !== void 0 ? _providedAppearsOnIndex : _constants.DEFAULT_APPEARS_ON_INDEX; + const disappearsOnIndex = _providedDisappearsOnIndex !== null && _providedDisappearsOnIndex !== void 0 ? _providedDisappearsOnIndex : _constants.DEFAULT_DISAPPEARS_ON_INDEX; + const enableTouchThrough = _providedEnableTouchThrough !== null && _providedEnableTouchThrough !== void 0 ? _providedEnableTouchThrough : _constants.DEFAULT_ENABLE_TOUCH_THROUGH; //#endregion + //#region variables + + const [pointerEvents, setPointerEvents] = (0, _react.useState)(enableTouchThrough ? 'none' : 'auto'); //#endregion + //#region callbacks + + const handleOnPress = (0, _react.useCallback)(() => { + onPress === null || onPress === void 0 ? void 0 : onPress(); + + if (pressBehavior === 'close') { + close(); + } else if (pressBehavior === 'collapse') { + snapToIndex(disappearsOnIndex); + } else if (typeof pressBehavior === 'number') { + snapToIndex(pressBehavior); + } + }, [snapToIndex, close, disappearsOnIndex, pressBehavior, onPress]); + const handleContainerTouchability = (0, _react.useCallback)(shouldDisableTouchability => { + setPointerEvents(shouldDisableTouchability ? 'none' : 'auto'); + }, []); //#endregion + //#region tap gesture + + const gestureHandler = (0, _reactNativeReanimated.useAnimatedGestureHandler)({ + onFinish: () => { + (0, _reactNativeReanimated.runOnJS)(handleOnPress)(); + } + }, [handleOnPress]); //#endregion + //#region styles + + const containerAnimatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({ + opacity: (0, _reactNativeReanimated.interpolate)(animatedIndex.value, [-1, disappearsOnIndex, appearsOnIndex], [0, 0, opacity], _reactNativeReanimated.Extrapolate.CLAMP), + flex: 1 + })); + const containerStyle = (0, _react.useMemo)(() => [_styles.styles.container, style, containerAnimatedStyle], [style, containerAnimatedStyle]); //#endregion + //#region effects + + (0, _reactNativeReanimated.useAnimatedReaction)(() => animatedIndex.value <= disappearsOnIndex, (shouldDisableTouchability, previous) => { + if (shouldDisableTouchability === previous) { + return; + } + + (0, _reactNativeReanimated.runOnJS)(handleContainerTouchability)(shouldDisableTouchability); + }, [disappearsOnIndex]); //#endregion + + return pressBehavior !== 'none' ? /*#__PURE__*/_react.default.createElement(_reactNativeGestureHandler.TapGestureHandler, { + onGestureEvent: gestureHandler + }, /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, { + style: containerStyle, + pointerEvents: pointerEvents, + accessible: true, + accessibilityRole: "button", + accessibilityLabel: "Bottom Sheet backdrop", + accessibilityHint: `Tap to ${typeof pressBehavior === 'string' ? pressBehavior : 'move'} the Bottom Sheet` + }, children)) : /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, { + pointerEvents: pointerEvents, + style: containerStyle + }, children); +}; + +const BottomSheetBackdrop = /*#__PURE__*/(0, _react.memo)(BottomSheetBackdropComponent); +BottomSheetBackdrop.displayName = 'BottomSheetBackdrop'; +var _default = BottomSheetBackdrop; +exports.default = _default; +//# sourceMappingURL=BottomSheetBackdrop.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackdrop/BottomSheetBackdrop.js.map b/lib/commonjs/components/bottomSheetBackdrop/BottomSheetBackdrop.js.map new file mode 100644 index 000000000..b0ec1fc49 --- /dev/null +++ b/lib/commonjs/components/bottomSheetBackdrop/BottomSheetBackdrop.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheetBackdrop.tsx"],"names":["BottomSheetBackdropComponent","animatedIndex","opacity","_providedOpacity","appearsOnIndex","_providedAppearsOnIndex","disappearsOnIndex","_providedDisappearsOnIndex","enableTouchThrough","_providedEnableTouchThrough","pressBehavior","DEFAULT_PRESS_BEHAVIOR","onPress","style","children","snapToIndex","close","DEFAULT_OPACITY","DEFAULT_APPEARS_ON_INDEX","DEFAULT_DISAPPEARS_ON_INDEX","DEFAULT_ENABLE_TOUCH_THROUGH","pointerEvents","setPointerEvents","handleOnPress","handleContainerTouchability","shouldDisableTouchability","gestureHandler","onFinish","containerAnimatedStyle","value","Extrapolate","CLAMP","flex","containerStyle","styles","container","previous","BottomSheetBackdrop","displayName"],"mappings":";;;;;;;AAAA;;AAEA;;AAQA;;AAIA;;AACA;;AAOA;;;;;;AAGA,MAAMA,4BAA4B,GAAG,CAAC;AACpCC,EAAAA,aADoC;AAEpCC,EAAAA,OAAO,EAAEC,gBAF2B;AAGpCC,EAAAA,cAAc,EAAEC,uBAHoB;AAIpCC,EAAAA,iBAAiB,EAAEC,0BAJiB;AAKpCC,EAAAA,kBAAkB,EAAEC,2BALgB;AAMpCC,EAAAA,aAAa,GAAGC,iCANoB;AAOpCC,EAAAA,OAPoC;AAQpCC,EAAAA,KARoC;AASpCC,EAAAA;AAToC,CAAD,KAUE;AACrC;AACA,QAAM;AAAEC,IAAAA,WAAF;AAAeC,IAAAA;AAAf,MAAyB,4BAA/B,CAFqC,CAGrC;AAEA;;AACA,QAAMd,OAAO,GAAGC,gBAAH,aAAGA,gBAAH,cAAGA,gBAAH,GAAuBc,0BAApC;AACA,QAAMb,cAAc,GAAGC,uBAAH,aAAGA,uBAAH,cAAGA,uBAAH,GAA8Ba,mCAAlD;AACA,QAAMZ,iBAAiB,GACrBC,0BADqB,aACrBA,0BADqB,cACrBA,0BADqB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CAAYC,KAJL,CAD4C;AAOrDC,IAAAA,IAAI,EAAE;AAP+C,GAAP,CAAjB,CAA/B;AASA,QAAMC,cAAc,GAAG,oBACrB,MAAM,CAACC,eAAOC,SAAR,EAAmBtB,KAAnB,EAA0Be,sBAA1B,CADe,EAErB,CAACf,KAAD,EAAQe,sBAAR,CAFqB,CAAvB,CA9DqC,CAkErC;AAEA;;AACA,kDACE,MAAM3B,aAAa,CAAC4B,KAAd,IAAuBvB,iBAD/B,EAEE,CAACmB,yBAAD,EAA4BW,QAA5B,KAAyC;AACvC,QAAIX,yBAAyB,KAAKW,QAAlC,EAA4C;AAC1C;AACD;;AACD,wCAAQZ,2BAAR,EAAqCC,yBAArC;AACD,GAPH,EAQE,CAACnB,iBAAD,CARF,EArEqC,CA+ErC;;AAEA,SAAOI,aAAa,KAAK,MAAlB,gBACL,6BAAC,4CAAD;AAAmB,IAAA,cAAc,EAAEgB;AAAnC,kBACE,6BAAC,8BAAD,CAAU,IAAV;AACE,IAAA,KAAK,EAAEO,cADT;AAEE,IAAA,aAAa,EAAEZ,aAFjB;AAGE,IAAA,UAAU,EAAE,IAHd;AAIE,IAAA,iBAAiB,EAAC,QAJpB;AAKE,IAAA,kBAAkB,EAAC,uBALrB;AAME,IAAA,iBAAiB,EAAG,UAClB,OAAOX,aAAP,KAAyB,QAAzB,GAAoCA,aAApC,GAAoD,MACrD;AARH,KAUGI,QAVH,CADF,CADK,gBAgBL,6BAAC,8BAAD,CAAU,IAAV;AAAe,IAAA,aAAa,EAAEO,aAA9B;AAA6C,IAAA,KAAK,EAAEY;AAApD,KACGnB,QADH,CAhBF;AAoBD,CA/GD;;AAiHA,MAAMuB,mBAAmB,gBAAG,iBAAKrC,4BAAL,CAA5B;AACAqC,mBAAmB,CAACC,WAApB,GAAkC,qBAAlC;eAEeD,mB","sourcesContent":["import React, { memo, useCallback, useMemo, useState } from 'react';\nimport { ViewProps } from 'react-native';\nimport Animated, {\n interpolate,\n Extrapolate,\n useAnimatedStyle,\n useAnimatedReaction,\n useAnimatedGestureHandler,\n runOnJS,\n} from 'react-native-reanimated';\nimport {\n TapGestureHandler,\n TapGestureHandlerGestureEvent,\n} from 'react-native-gesture-handler';\nimport { useBottomSheet } from '../../hooks';\nimport {\n DEFAULT_OPACITY,\n DEFAULT_APPEARS_ON_INDEX,\n DEFAULT_DISAPPEARS_ON_INDEX,\n DEFAULT_ENABLE_TOUCH_THROUGH,\n DEFAULT_PRESS_BEHAVIOR,\n} from './constants';\nimport { styles } from './styles';\nimport type { BottomSheetDefaultBackdropProps } from './types';\n\nconst BottomSheetBackdropComponent = ({\n animatedIndex,\n opacity: _providedOpacity,\n appearsOnIndex: _providedAppearsOnIndex,\n disappearsOnIndex: _providedDisappearsOnIndex,\n enableTouchThrough: _providedEnableTouchThrough,\n pressBehavior = DEFAULT_PRESS_BEHAVIOR,\n onPress,\n style,\n children,\n}: BottomSheetDefaultBackdropProps) => {\n //#region hooks\n const { snapToIndex, close } = useBottomSheet();\n //#endregion\n\n //#region defaults\n const opacity = _providedOpacity ?? DEFAULT_OPACITY;\n const appearsOnIndex = _providedAppearsOnIndex ?? DEFAULT_APPEARS_ON_INDEX;\n const disappearsOnIndex =\n _providedDisappearsOnIndex ?? DEFAULT_DISAPPEARS_ON_INDEX;\n const enableTouchThrough =\n _providedEnableTouchThrough ?? DEFAULT_ENABLE_TOUCH_THROUGH;\n //#endregion\n\n //#region variables\n const [pointerEvents, setPointerEvents] = useState<\n ViewProps['pointerEvents']\n >(enableTouchThrough ? 'none' : 'auto');\n //#endregion\n\n //#region callbacks\n const handleOnPress = useCallback(() => {\n onPress?.();\n\n if (pressBehavior === 'close') {\n close();\n } else if (pressBehavior === 'collapse') {\n snapToIndex(disappearsOnIndex as number);\n } else if (typeof pressBehavior === 'number') {\n snapToIndex(pressBehavior);\n }\n }, [snapToIndex, close, disappearsOnIndex, pressBehavior, onPress]);\n const handleContainerTouchability = useCallback(\n (shouldDisableTouchability: boolean) => {\n setPointerEvents(shouldDisableTouchability ? 'none' : 'auto');\n },\n []\n );\n //#endregion\n\n //#region tap gesture\n const gestureHandler =\n useAnimatedGestureHandler(\n {\n onFinish: () => {\n runOnJS(handleOnPress)();\n },\n },\n [handleOnPress]\n );\n //#endregion\n\n //#region styles\n const containerAnimatedStyle = useAnimatedStyle(() => ({\n opacity: interpolate(\n animatedIndex.value,\n [-1, disappearsOnIndex, appearsOnIndex],\n [0, 0, opacity],\n Extrapolate.CLAMP\n ),\n flex: 1,\n }));\n const containerStyle = useMemo(\n () => [styles.container, style, containerAnimatedStyle],\n [style, containerAnimatedStyle]\n );\n //#endregion\n\n //#region effects\n useAnimatedReaction(\n () => animatedIndex.value <= disappearsOnIndex,\n (shouldDisableTouchability, previous) => {\n if (shouldDisableTouchability === previous) {\n return;\n }\n runOnJS(handleContainerTouchability)(shouldDisableTouchability);\n },\n [disappearsOnIndex]\n );\n //#endregion\n\n return pressBehavior !== 'none' ? (\n \n \n {children}\n \n \n ) : (\n \n {children}\n \n );\n};\n\nconst BottomSheetBackdrop = memo(BottomSheetBackdropComponent);\nBottomSheetBackdrop.displayName = 'BottomSheetBackdrop';\n\nexport default BottomSheetBackdrop;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackdrop/constants.js b/lib/commonjs/components/bottomSheetBackdrop/constants.js new file mode 100644 index 000000000..0d4668160 --- /dev/null +++ b/lib/commonjs/components/bottomSheetBackdrop/constants.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.DEFAULT_PRESS_BEHAVIOR = exports.DEFAULT_ENABLE_TOUCH_THROUGH = exports.DEFAULT_DISAPPEARS_ON_INDEX = exports.DEFAULT_APPEARS_ON_INDEX = exports.DEFAULT_OPACITY = void 0; +const DEFAULT_OPACITY = 0.5; +exports.DEFAULT_OPACITY = DEFAULT_OPACITY; +const DEFAULT_APPEARS_ON_INDEX = 1; +exports.DEFAULT_APPEARS_ON_INDEX = DEFAULT_APPEARS_ON_INDEX; +const DEFAULT_DISAPPEARS_ON_INDEX = 0; +exports.DEFAULT_DISAPPEARS_ON_INDEX = DEFAULT_DISAPPEARS_ON_INDEX; +const DEFAULT_ENABLE_TOUCH_THROUGH = false; +exports.DEFAULT_ENABLE_TOUCH_THROUGH = DEFAULT_ENABLE_TOUCH_THROUGH; +const DEFAULT_PRESS_BEHAVIOR = 'close'; +exports.DEFAULT_PRESS_BEHAVIOR = DEFAULT_PRESS_BEHAVIOR; +//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackdrop/constants.js.map b/lib/commonjs/components/bottomSheetBackdrop/constants.js.map new file mode 100644 index 000000000..7f01a56c0 --- /dev/null +++ b/lib/commonjs/components/bottomSheetBackdrop/constants.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["constants.ts"],"names":["DEFAULT_OPACITY","DEFAULT_APPEARS_ON_INDEX","DEFAULT_DISAPPEARS_ON_INDEX","DEFAULT_ENABLE_TOUCH_THROUGH","DEFAULT_PRESS_BEHAVIOR"],"mappings":";;;;;;AAAA,MAAMA,eAAe,GAAG,GAAxB;;AACA,MAAMC,wBAAwB,GAAG,CAAjC;;AACA,MAAMC,2BAA2B,GAAG,CAApC;;AACA,MAAMC,4BAA4B,GAAG,KAArC;;AACA,MAAMC,sBAAsB,GAAG,OAA/B","sourcesContent":["const DEFAULT_OPACITY = 0.5;\nconst DEFAULT_APPEARS_ON_INDEX = 1;\nconst DEFAULT_DISAPPEARS_ON_INDEX = 0;\nconst DEFAULT_ENABLE_TOUCH_THROUGH = false;\nconst DEFAULT_PRESS_BEHAVIOR = 'close' as const;\n\nexport {\n DEFAULT_OPACITY,\n DEFAULT_APPEARS_ON_INDEX,\n DEFAULT_DISAPPEARS_ON_INDEX,\n DEFAULT_ENABLE_TOUCH_THROUGH,\n DEFAULT_PRESS_BEHAVIOR,\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackdrop/index.js b/lib/commonjs/components/bottomSheetBackdrop/index.js new file mode 100644 index 000000000..d6a37282c --- /dev/null +++ b/lib/commonjs/components/bottomSheetBackdrop/index.js @@ -0,0 +1,16 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "default", { + enumerable: true, + get: function () { + return _BottomSheetBackdrop.default; + } +}); + +var _BottomSheetBackdrop = _interopRequireDefault(require("./BottomSheetBackdrop")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackdrop/index.js.map b/lib/commonjs/components/bottomSheetBackdrop/index.js.map new file mode 100644 index 000000000..de182520b --- /dev/null +++ b/lib/commonjs/components/bottomSheetBackdrop/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { default } from './BottomSheetBackdrop';\nexport type { BottomSheetBackdropProps } from './types';\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackdrop/styles.js b/lib/commonjs/components/bottomSheetBackdrop/styles.js new file mode 100644 index 000000000..e3e00ab7c --- /dev/null +++ b/lib/commonjs/components/bottomSheetBackdrop/styles.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.styles = void 0; + +var _reactNative = require("react-native"); + +const styles = _reactNative.StyleSheet.create({ + container: { + backgroundColor: 'black' + } +}); + +exports.styles = styles; +//# sourceMappingURL=styles.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackdrop/styles.js.map b/lib/commonjs/components/bottomSheetBackdrop/styles.js.map new file mode 100644 index 000000000..f37bc5f69 --- /dev/null +++ b/lib/commonjs/components/bottomSheetBackdrop/styles.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["styles.ts"],"names":["styles","StyleSheet","create","container","backgroundColor"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,MAAM,GAAGC,wBAAWC,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE;AACTC,IAAAA,eAAe,EAAE;AADR;AAD2B,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\n\nexport const styles = StyleSheet.create({\n container: {\n backgroundColor: 'black',\n },\n});\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackdropContainer/BottomSheetBackdropContainer.js b/lib/commonjs/components/bottomSheetBackdropContainer/BottomSheetBackdropContainer.js new file mode 100644 index 000000000..9d945ed34 --- /dev/null +++ b/lib/commonjs/components/bottomSheetBackdropContainer/BottomSheetBackdropContainer.js @@ -0,0 +1,32 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireWildcard(require("react")); + +var _styles = require("./styles"); + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +const BottomSheetBackdropContainerComponent = ({ + animatedIndex, + animatedPosition, + backdropComponent: BackdropComponent +}) => { + return BackdropComponent ? /*#__PURE__*/_react.default.createElement(BackdropComponent, { + animatedIndex: animatedIndex, + animatedPosition: animatedPosition, + style: _styles.styles.container + }) : null; +}; + +const BottomSheetBackdropContainer = /*#__PURE__*/(0, _react.memo)(BottomSheetBackdropContainerComponent); +BottomSheetBackdropContainer.displayName = 'BottomSheetBackdropContainer'; +var _default = BottomSheetBackdropContainer; +exports.default = _default; +//# sourceMappingURL=BottomSheetBackdropContainer.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackdropContainer/BottomSheetBackdropContainer.js.map b/lib/commonjs/components/bottomSheetBackdropContainer/BottomSheetBackdropContainer.js.map new file mode 100644 index 000000000..591a53c90 --- /dev/null +++ b/lib/commonjs/components/bottomSheetBackdropContainer/BottomSheetBackdropContainer.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheetBackdropContainer.tsx"],"names":["BottomSheetBackdropContainerComponent","animatedIndex","animatedPosition","backdropComponent","BackdropComponent","styles","container","BottomSheetBackdropContainer","displayName"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;AAEA,MAAMA,qCAAqC,GAAG,CAAC;AAC7CC,EAAAA,aAD6C;AAE7CC,EAAAA,gBAF6C;AAG7CC,EAAAA,iBAAiB,EAAEC;AAH0B,CAAD,KAIL;AACvC,SAAOA,iBAAiB,gBACtB,6BAAC,iBAAD;AACE,IAAA,aAAa,EAAEH,aADjB;AAEE,IAAA,gBAAgB,EAAEC,gBAFpB;AAGE,IAAA,KAAK,EAAEG,eAAOC;AAHhB,IADsB,GAMpB,IANJ;AAOD,CAZD;;AAcA,MAAMC,4BAA4B,gBAAG,iBACnCP,qCADmC,CAArC;AAGAO,4BAA4B,CAACC,WAA7B,GAA2C,8BAA3C;eAEeD,4B","sourcesContent":["import React, { memo } from 'react';\nimport type { BottomSheetBackdropContainerProps } from './types';\nimport { styles } from './styles';\n\nconst BottomSheetBackdropContainerComponent = ({\n animatedIndex,\n animatedPosition,\n backdropComponent: BackdropComponent,\n}: BottomSheetBackdropContainerProps) => {\n return BackdropComponent ? (\n \n ) : null;\n};\n\nconst BottomSheetBackdropContainer = memo(\n BottomSheetBackdropContainerComponent\n);\nBottomSheetBackdropContainer.displayName = 'BottomSheetBackdropContainer';\n\nexport default BottomSheetBackdropContainer;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackdropContainer/index.js b/lib/commonjs/components/bottomSheetBackdropContainer/index.js new file mode 100644 index 000000000..cd79d6ec7 --- /dev/null +++ b/lib/commonjs/components/bottomSheetBackdropContainer/index.js @@ -0,0 +1,16 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "default", { + enumerable: true, + get: function () { + return _BottomSheetBackdropContainer.default; + } +}); + +var _BottomSheetBackdropContainer = _interopRequireDefault(require("./BottomSheetBackdropContainer")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackdropContainer/index.js.map b/lib/commonjs/components/bottomSheetBackdropContainer/index.js.map new file mode 100644 index 000000000..bc09f2088 --- /dev/null +++ b/lib/commonjs/components/bottomSheetBackdropContainer/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { default } from './BottomSheetBackdropContainer';\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackdropContainer/styles.js b/lib/commonjs/components/bottomSheetBackdropContainer/styles.js new file mode 100644 index 000000000..b9e7d8f49 --- /dev/null +++ b/lib/commonjs/components/bottomSheetBackdropContainer/styles.js @@ -0,0 +1,21 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.styles = void 0; + +var _reactNative = require("react-native"); + +const styles = _reactNative.StyleSheet.create({ + container: { + position: 'absolute', + top: 0, + left: 0, + right: 0, + bottom: 0 + } +}); + +exports.styles = styles; +//# sourceMappingURL=styles.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackdropContainer/styles.js.map b/lib/commonjs/components/bottomSheetBackdropContainer/styles.js.map new file mode 100644 index 000000000..1c074ebb0 --- /dev/null +++ b/lib/commonjs/components/bottomSheetBackdropContainer/styles.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["styles.ts"],"names":["styles","StyleSheet","create","container","position","top","left","right","bottom"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,MAAM,GAAGC,wBAAWC,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE;AACTC,IAAAA,QAAQ,EAAE,UADD;AAETC,IAAAA,GAAG,EAAE,CAFI;AAGTC,IAAAA,IAAI,EAAE,CAHG;AAITC,IAAAA,KAAK,EAAE,CAJE;AAKTC,IAAAA,MAAM,EAAE;AALC;AAD2B,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\n\nexport const styles = StyleSheet.create({\n container: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n },\n});\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackground/BottomSheetBackground.js b/lib/commonjs/components/bottomSheetBackground/BottomSheetBackground.js new file mode 100644 index 000000000..6f2c5799b --- /dev/null +++ b/lib/commonjs/components/bottomSheetBackground/BottomSheetBackground.js @@ -0,0 +1,33 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireWildcard(require("react")); + +var _reactNative = require("react-native"); + +var _styles = require("./styles"); + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +const BottomSheetBackgroundComponent = ({ + pointerEvents, + style +}) => /*#__PURE__*/_react.default.createElement(_reactNative.View, { + pointerEvents: pointerEvents, + accessible: true, + accessibilityRole: "adjustable", + accessibilityLabel: "Bottom Sheet", + style: [_styles.styles.container, style] +}); + +const BottomSheetBackground = /*#__PURE__*/(0, _react.memo)(BottomSheetBackgroundComponent); +BottomSheetBackground.displayName = 'BottomSheetBackground'; +var _default = BottomSheetBackground; +exports.default = _default; +//# sourceMappingURL=BottomSheetBackground.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackground/BottomSheetBackground.js.map b/lib/commonjs/components/bottomSheetBackground/BottomSheetBackground.js.map new file mode 100644 index 000000000..d0f4a1186 --- /dev/null +++ b/lib/commonjs/components/bottomSheetBackground/BottomSheetBackground.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheetBackground.tsx"],"names":["BottomSheetBackgroundComponent","pointerEvents","style","styles","container","BottomSheetBackground","displayName"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;;;;;AAEA,MAAMA,8BAA8B,GAAG,CAAC;AACtCC,EAAAA,aADsC;AAEtCC,EAAAA;AAFsC,CAAD,kBAIrC,6BAAC,iBAAD;AACE,EAAA,aAAa,EAAED,aADjB;AAEE,EAAA,UAAU,EAAE,IAFd;AAGE,EAAA,iBAAiB,EAAC,YAHpB;AAIE,EAAA,kBAAkB,EAAC,cAJrB;AAKE,EAAA,KAAK,EAAE,CAACE,eAAOC,SAAR,EAAmBF,KAAnB;AALT,EAJF;;AAaA,MAAMG,qBAAqB,gBAAG,iBAAKL,8BAAL,CAA9B;AACAK,qBAAqB,CAACC,WAAtB,GAAoC,uBAApC;eAEeD,qB","sourcesContent":["import React, { memo } from 'react';\nimport { View } from 'react-native';\nimport type { BottomSheetBackgroundProps } from './types';\nimport { styles } from './styles';\n\nconst BottomSheetBackgroundComponent = ({\n pointerEvents,\n style,\n}: BottomSheetBackgroundProps) => (\n \n);\n\nconst BottomSheetBackground = memo(BottomSheetBackgroundComponent);\nBottomSheetBackground.displayName = 'BottomSheetBackground';\n\nexport default BottomSheetBackground;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackground/index.js b/lib/commonjs/components/bottomSheetBackground/index.js new file mode 100644 index 000000000..aa13540ba --- /dev/null +++ b/lib/commonjs/components/bottomSheetBackground/index.js @@ -0,0 +1,16 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "default", { + enumerable: true, + get: function () { + return _BottomSheetBackground.default; + } +}); + +var _BottomSheetBackground = _interopRequireDefault(require("./BottomSheetBackground")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackground/index.js.map b/lib/commonjs/components/bottomSheetBackground/index.js.map new file mode 100644 index 000000000..4c48802e2 --- /dev/null +++ b/lib/commonjs/components/bottomSheetBackground/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { default } from './BottomSheetBackground';\nexport type { BottomSheetBackgroundProps } from './types';\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackground/styles.js b/lib/commonjs/components/bottomSheetBackground/styles.js new file mode 100644 index 000000000..d3f764b0b --- /dev/null +++ b/lib/commonjs/components/bottomSheetBackground/styles.js @@ -0,0 +1,18 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.styles = void 0; + +var _reactNative = require("react-native"); + +const styles = _reactNative.StyleSheet.create({ + container: { + backgroundColor: 'white', + borderRadius: 15 + } +}); + +exports.styles = styles; +//# sourceMappingURL=styles.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackground/styles.js.map b/lib/commonjs/components/bottomSheetBackground/styles.js.map new file mode 100644 index 000000000..02077a671 --- /dev/null +++ b/lib/commonjs/components/bottomSheetBackground/styles.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["styles.ts"],"names":["styles","StyleSheet","create","container","backgroundColor","borderRadius"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,MAAM,GAAGC,wBAAWC,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE;AACTC,IAAAA,eAAe,EAAE,OADR;AAETC,IAAAA,YAAY,EAAE;AAFL;AAD2B,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\n\nexport const styles = StyleSheet.create({\n container: {\n backgroundColor: 'white',\n borderRadius: 15,\n },\n});\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.js b/lib/commonjs/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.js new file mode 100644 index 000000000..de38b1397 --- /dev/null +++ b/lib/commonjs/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.js @@ -0,0 +1,42 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireWildcard(require("react")); + +var _bottomSheetBackground = _interopRequireDefault(require("../bottomSheetBackground")); + +var _styles = require("./styles"); + +var _reactNative = require("react-native"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +const BottomSheetBackgroundContainerComponent = ({ + animatedIndex, + animatedPosition, + backgroundComponent: _providedBackgroundComponent, + backgroundStyle: _providedBackgroundStyle +}) => { + const BackgroundComponent = _providedBackgroundComponent || _bottomSheetBackground.default; + const backgroundStyle = (0, _react.useMemo)(() => _reactNative.StyleSheet.flatten([_styles.styles.container, _providedBackgroundStyle]), [_providedBackgroundStyle]); + return _providedBackgroundComponent === null ? null : /*#__PURE__*/_react.default.createElement(BackgroundComponent, { + pointerEvents: "none", + animatedIndex: animatedIndex, + animatedPosition: animatedPosition, + style: backgroundStyle + }); +}; + +const BottomSheetBackgroundContainer = /*#__PURE__*/(0, _react.memo)(BottomSheetBackgroundContainerComponent); +BottomSheetBackgroundContainer.displayName = 'BottomSheetBackgroundContainer'; +var _default = BottomSheetBackgroundContainer; +exports.default = _default; +//# sourceMappingURL=BottomSheetBackgroundContainer.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.js.map b/lib/commonjs/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.js.map new file mode 100644 index 000000000..f3fbad824 --- /dev/null +++ b/lib/commonjs/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheetBackgroundContainer.tsx"],"names":["BottomSheetBackgroundContainerComponent","animatedIndex","animatedPosition","backgroundComponent","_providedBackgroundComponent","backgroundStyle","_providedBackgroundStyle","BackgroundComponent","BottomSheetBackground","StyleSheet","flatten","styles","container","BottomSheetBackgroundContainer","displayName"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;;;;;;;AAEA,MAAMA,uCAAuC,GAAG,CAAC;AAC/CC,EAAAA,aAD+C;AAE/CC,EAAAA,gBAF+C;AAG/CC,EAAAA,mBAAmB,EAAEC,4BAH0B;AAI/CC,EAAAA,eAAe,EAAEC;AAJ8B,CAAD,KAKL;AACzC,QAAMC,mBAAmB,GACvBH,4BAA4B,IAAII,8BADlC;AAGA,QAAMH,eAAe,GAAG,oBACtB,MAAMI,wBAAWC,OAAX,CAAmB,CAACC,eAAOC,SAAR,EAAmBN,wBAAnB,CAAnB,CADgB,EAEtB,CAACA,wBAAD,CAFsB,CAAxB;AAKA,SAAOF,4BAA4B,KAAK,IAAjC,GAAwC,IAAxC,gBACL,6BAAC,mBAAD;AACE,IAAA,aAAa,EAAC,MADhB;AAEE,IAAA,aAAa,EAAEH,aAFjB;AAGE,IAAA,gBAAgB,EAAEC,gBAHpB;AAIE,IAAA,KAAK,EAAEG;AAJT,IADF;AAQD,CAtBD;;AAwBA,MAAMQ,8BAA8B,gBAAG,iBACrCb,uCADqC,CAAvC;AAGAa,8BAA8B,CAACC,WAA/B,GAA6C,gCAA7C;eAEeD,8B","sourcesContent":["import React, { memo, useMemo } from 'react';\nimport BottomSheetBackground from '../bottomSheetBackground';\nimport type { BottomSheetBackgroundContainerProps } from './types';\nimport { styles } from './styles';\nimport { StyleSheet } from 'react-native';\n\nconst BottomSheetBackgroundContainerComponent = ({\n animatedIndex,\n animatedPosition,\n backgroundComponent: _providedBackgroundComponent,\n backgroundStyle: _providedBackgroundStyle,\n}: BottomSheetBackgroundContainerProps) => {\n const BackgroundComponent =\n _providedBackgroundComponent || BottomSheetBackground;\n\n const backgroundStyle = useMemo(\n () => StyleSheet.flatten([styles.container, _providedBackgroundStyle]),\n [_providedBackgroundStyle]\n );\n\n return _providedBackgroundComponent === null ? null : (\n \n );\n};\n\nconst BottomSheetBackgroundContainer = memo(\n BottomSheetBackgroundContainerComponent\n);\nBottomSheetBackgroundContainer.displayName = 'BottomSheetBackgroundContainer';\n\nexport default BottomSheetBackgroundContainer;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackgroundContainer/index.js b/lib/commonjs/components/bottomSheetBackgroundContainer/index.js new file mode 100644 index 000000000..002ca423d --- /dev/null +++ b/lib/commonjs/components/bottomSheetBackgroundContainer/index.js @@ -0,0 +1,16 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "default", { + enumerable: true, + get: function () { + return _BottomSheetBackgroundContainer.default; + } +}); + +var _BottomSheetBackgroundContainer = _interopRequireDefault(require("./BottomSheetBackgroundContainer")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackgroundContainer/index.js.map b/lib/commonjs/components/bottomSheetBackgroundContainer/index.js.map new file mode 100644 index 000000000..5ad573e78 --- /dev/null +++ b/lib/commonjs/components/bottomSheetBackgroundContainer/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { default } from './BottomSheetBackgroundContainer';\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackgroundContainer/styles.js b/lib/commonjs/components/bottomSheetBackgroundContainer/styles.js new file mode 100644 index 000000000..b9e7d8f49 --- /dev/null +++ b/lib/commonjs/components/bottomSheetBackgroundContainer/styles.js @@ -0,0 +1,21 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.styles = void 0; + +var _reactNative = require("react-native"); + +const styles = _reactNative.StyleSheet.create({ + container: { + position: 'absolute', + top: 0, + left: 0, + right: 0, + bottom: 0 + } +}); + +exports.styles = styles; +//# sourceMappingURL=styles.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackgroundContainer/styles.js.map b/lib/commonjs/components/bottomSheetBackgroundContainer/styles.js.map new file mode 100644 index 000000000..1c074ebb0 --- /dev/null +++ b/lib/commonjs/components/bottomSheetBackgroundContainer/styles.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["styles.ts"],"names":["styles","StyleSheet","create","container","position","top","left","right","bottom"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,MAAM,GAAGC,wBAAWC,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE;AACTC,IAAAA,QAAQ,EAAE,UADD;AAETC,IAAAA,GAAG,EAAE,CAFI;AAGTC,IAAAA,IAAI,EAAE,CAHG;AAITC,IAAAA,KAAK,EAAE,CAJE;AAKTC,IAAAA,MAAM,EAAE;AALC;AAD2B,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\n\nexport const styles = StyleSheet.create({\n container: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n },\n});\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetContainer/BottomSheetContainer.js b/lib/commonjs/components/bottomSheetContainer/BottomSheetContainer.js new file mode 100644 index 000000000..a1aa99068 --- /dev/null +++ b/lib/commonjs/components/bottomSheetContainer/BottomSheetContainer.js @@ -0,0 +1,85 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireWildcard(require("react")); + +var _reactNative = require("react-native"); + +var _constants = require("../../constants"); + +var _utilities = require("../../utilities"); + +var _styles = require("./styles"); + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function BottomSheetContainerComponent({ + containerHeight, + containerOffset, + topInset = 0, + bottomInset = 0, + shouldCalculateHeight = true, + detached, + style, + children +}) { + const containerRef = (0, _react.useRef)(null); //#region styles + + const containerStyle = (0, _react.useMemo)(() => [style, _styles.styles.container, { + top: topInset, + bottom: bottomInset, + overflow: detached ? 'visible' : 'hidden' + }], [style, detached, topInset, bottomInset]); //#endregion + //#region callbacks + + const handleContainerLayout = (0, _react.useCallback)(function handleContainerLayout({ + nativeEvent: { + layout: { + height + } + } + }) { + var _containerRef$current; + + containerHeight.value = height; + (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.measure((_x, _y, _width, _height, _pageX, pageY) => { + var _StatusBar$currentHei; + + if (!containerOffset.value) return; + containerOffset.value = { + top: pageY !== null && pageY !== void 0 ? pageY : 0, + left: 0, + right: 0, + bottom: Math.max(0, _constants.WINDOW_HEIGHT - ((pageY !== null && pageY !== void 0 ? pageY : 0) + height + ((_StatusBar$currentHei = _reactNative.StatusBar.currentHeight) !== null && _StatusBar$currentHei !== void 0 ? _StatusBar$currentHei : 0))) + }; + }); + (0, _utilities.print)({ + component: BottomSheetContainer.displayName, + method: 'handleContainerLayout', + params: { + height + } + }); + }, [containerHeight, containerOffset, containerRef]); //#endregion + //#region render + + return /*#__PURE__*/_react.default.createElement(_reactNative.View, { + ref: containerRef, + pointerEvents: "box-none", + onLayout: shouldCalculateHeight ? handleContainerLayout : undefined, + style: containerStyle, + children: children + }); //#endregion +} + +const BottomSheetContainer = /*#__PURE__*/(0, _react.memo)(BottomSheetContainerComponent); +BottomSheetContainer.displayName = 'BottomSheetContainer'; +var _default = BottomSheetContainer; +exports.default = _default; +//# sourceMappingURL=BottomSheetContainer.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetContainer/BottomSheetContainer.js.map b/lib/commonjs/components/bottomSheetContainer/BottomSheetContainer.js.map new file mode 100644 index 000000000..ad9daac47 --- /dev/null +++ b/lib/commonjs/components/bottomSheetContainer/BottomSheetContainer.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheetContainer.tsx"],"names":["BottomSheetContainerComponent","containerHeight","containerOffset","topInset","bottomInset","shouldCalculateHeight","detached","style","children","containerRef","containerStyle","styles","container","top","bottom","overflow","handleContainerLayout","nativeEvent","layout","height","value","current","measure","_x","_y","_width","_height","_pageX","pageY","left","right","Math","max","WINDOW_HEIGHT","StatusBar","currentHeight","component","BottomSheetContainer","displayName","method","params","undefined"],"mappings":";;;;;;;AAAA;;AACA;;AAOA;;AACA;;AACA;;;;;;AAGA,SAASA,6BAAT,CAAuC;AACrCC,EAAAA,eADqC;AAErCC,EAAAA,eAFqC;AAGrCC,EAAAA,QAAQ,GAAG,CAH0B;AAIrCC,EAAAA,WAAW,GAAG,CAJuB;AAKrCC,EAAAA,qBAAqB,GAAG,IALa;AAMrCC,EAAAA,QANqC;AAOrCC,EAAAA,KAPqC;AAQrCC,EAAAA;AARqC,CAAvC,EAS8B;AAC5B,QAAMC,YAAY,GAAG,mBAAa,IAAb,CAArB,CAD4B,CAE5B;;AACA,QAAMC,cAAc,GAAG,oBACrB,MAAM,CACJH,KADI,EAEJI,eAAOC,SAFH,EAGJ;AACEC,IAAAA,GAAG,EAA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CO,YAAnC,CAhC4B,CAA9B,CAlB4B,CAoD5B;AAEA;;AACA,sBACE,6BAAC,iBAAD;AACE,IAAA,GAAG,EAAEA,YADP;AAEE,IAAA,aAAa,EAAC,UAFhB;AAGE,IAAA,QAAQ,EAAEJ,qBAAqB,GAAGW,qBAAH,GAA2ByB,SAH5D;AAIE,IAAA,KAAK,EAAE/B,cAJT;AAKE,IAAA,QAAQ,EAAEF;AALZ,IADF,CAvD4B,CAgE5B;AACD;;AAED,MAAM6B,oBAAoB,gBAAG,iBAAKrC,6BAAL,CAA7B;AACAqC,oBAAoB,CAACC,WAArB,GAAmC,sBAAnC;eAEeD,oB","sourcesContent":["import React, { memo, useCallback, useMemo, useRef } from 'react';\nimport {\n LayoutChangeEvent,\n StatusBar,\n StyleProp,\n View,\n ViewStyle,\n} from 'react-native';\nimport { WINDOW_HEIGHT } from '../../constants';\nimport { print } from '../../utilities';\nimport { styles } from './styles';\nimport type { BottomSheetContainerProps } from './types';\n\nfunction BottomSheetContainerComponent({\n containerHeight,\n containerOffset,\n topInset = 0,\n bottomInset = 0,\n shouldCalculateHeight = true,\n detached,\n style,\n children,\n}: BottomSheetContainerProps) {\n const containerRef = useRef(null);\n //#region styles\n const containerStyle = useMemo>(\n () => [\n style,\n styles.container,\n {\n top: topInset,\n bottom: bottomInset,\n overflow: detached ? 'visible' : 'hidden',\n },\n ],\n [style, detached, topInset, bottomInset]\n );\n //#endregion\n\n //#region callbacks\n const handleContainerLayout = useCallback(\n function handleContainerLayout({\n nativeEvent: {\n layout: { height },\n },\n }: LayoutChangeEvent) {\n containerHeight.value = height;\n\n containerRef.current?.measure(\n (_x, _y, _width, _height, _pageX, pageY) => {\n if (!containerOffset.value) return;\n containerOffset.value = {\n top: pageY ?? 0,\n left: 0,\n right: 0,\n bottom: Math.max(\n 0,\n WINDOW_HEIGHT -\n ((pageY ?? 0) + height + (StatusBar.currentHeight ?? 0))\n ),\n };\n }\n );\n\n print({\n component: BottomSheetContainer.displayName,\n method: 'handleContainerLayout',\n params: {\n height,\n },\n });\n },\n [containerHeight, containerOffset, containerRef]\n );\n //#endregion\n\n //#region render\n return (\n \n );\n //#endregion\n}\n\nconst BottomSheetContainer = memo(BottomSheetContainerComponent);\nBottomSheetContainer.displayName = 'BottomSheetContainer';\n\nexport default BottomSheetContainer;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetContainer/index.js b/lib/commonjs/components/bottomSheetContainer/index.js new file mode 100644 index 000000000..2817384e4 --- /dev/null +++ b/lib/commonjs/components/bottomSheetContainer/index.js @@ -0,0 +1,16 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "default", { + enumerable: true, + get: function () { + return _BottomSheetContainer.default; + } +}); + +var _BottomSheetContainer = _interopRequireDefault(require("./BottomSheetContainer")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetContainer/index.js.map b/lib/commonjs/components/bottomSheetContainer/index.js.map new file mode 100644 index 000000000..ab6858d88 --- /dev/null +++ b/lib/commonjs/components/bottomSheetContainer/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { default } from './BottomSheetContainer';\nexport type { BottomSheetContainerProps } from './types';\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetContainer/styles.js b/lib/commonjs/components/bottomSheetContainer/styles.js new file mode 100644 index 000000000..e333cbaaf --- /dev/null +++ b/lib/commonjs/components/bottomSheetContainer/styles.js @@ -0,0 +1,16 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.styles = void 0; + +var _reactNative = require("react-native"); + +const styles = _reactNative.StyleSheet.create({ + container: { ..._reactNative.StyleSheet.absoluteFillObject + } +}); + +exports.styles = styles; +//# sourceMappingURL=styles.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetContainer/styles.js.map b/lib/commonjs/components/bottomSheetContainer/styles.js.map new file mode 100644 index 000000000..3c14e6685 --- /dev/null +++ b/lib/commonjs/components/bottomSheetContainer/styles.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["styles.ts"],"names":["styles","StyleSheet","create","container","absoluteFillObject"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,MAAM,GAAGC,wBAAWC,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE,EACT,GAAGF,wBAAWG;AADL;AAD2B,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\n\nexport const styles = StyleSheet.create({\n container: {\n ...StyleSheet.absoluteFillObject,\n },\n});\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetContainer/styles.web.js b/lib/commonjs/components/bottomSheetContainer/styles.web.js new file mode 100644 index 000000000..34116d412 --- /dev/null +++ b/lib/commonjs/components/bottomSheetContainer/styles.web.js @@ -0,0 +1,22 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.styles = void 0; + +var _reactNative = require("react-native"); + +const styles = _reactNative.StyleSheet.create({ + container: { + // @ts-ignore + position: 'fixed', + left: 0, + right: 0, + bottom: 0, + top: 0 + } +}); + +exports.styles = styles; +//# sourceMappingURL=styles.web.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetContainer/styles.web.js.map b/lib/commonjs/components/bottomSheetContainer/styles.web.js.map new file mode 100644 index 000000000..f46893508 --- /dev/null +++ b/lib/commonjs/components/bottomSheetContainer/styles.web.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["styles.web.ts"],"names":["styles","StyleSheet","create","container","position","left","right","bottom","top"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,MAAM,GAAGC,wBAAWC,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE;AACT;AACAC,IAAAA,QAAQ,EAAE,OAFD;AAGTC,IAAAA,IAAI,EAAE,CAHG;AAITC,IAAAA,KAAK,EAAE,CAJE;AAKTC,IAAAA,MAAM,EAAE,CALC;AAMTC,IAAAA,GAAG,EAAE;AANI;AAD2B,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\n\nexport const styles = StyleSheet.create({\n container: {\n // @ts-ignore\n position: 'fixed',\n left: 0,\n right: 0,\n bottom: 0,\n top: 0,\n },\n});\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetDraggableView/BottomSheetDraggableView.js b/lib/commonjs/components/bottomSheetDraggableView/BottomSheetDraggableView.js new file mode 100644 index 000000000..2a83d6e7a --- /dev/null +++ b/lib/commonjs/components/bottomSheetDraggableView/BottomSheetDraggableView.js @@ -0,0 +1,94 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireWildcard(require("react")); + +var _reactNativeReanimated = _interopRequireDefault(require("react-native-reanimated")); + +var _reactNativeGestureHandler = require("react-native-gesture-handler"); + +var _hooks = require("../../hooks"); + +var _constants = require("../../constants"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } + +const BottomSheetDraggableViewComponent = ({ + gestureType = _constants.GESTURE_SOURCE.CONTENT, + nativeGestureRef, + refreshControlGestureRef, + style, + children, + ...rest +}) => { + //#region hooks + const { + enableContentPanningGesture, + simultaneousHandlers: _providedSimultaneousHandlers, + waitFor, + activeOffsetX, + activeOffsetY, + failOffsetX, + failOffsetY + } = (0, _hooks.useBottomSheetInternal)(); + const { + contentPanGestureHandler, + scrollablePanGestureHandler + } = (0, _hooks.useBottomSheetGestureHandlers)(); //#endregion + //#region variables + + const panGestureRef = (0, _react.useRef)(null); + const gestureHandler = (0, _react.useMemo)(() => gestureType === _constants.GESTURE_SOURCE.CONTENT ? contentPanGestureHandler : scrollablePanGestureHandler, [gestureType, contentPanGestureHandler, scrollablePanGestureHandler]); + const simultaneousHandlers = (0, _react.useMemo)(() => { + const refs = []; + + if (nativeGestureRef) { + refs.push(nativeGestureRef); + } + + if (refreshControlGestureRef) { + refs.push(refreshControlGestureRef); + } + + if (_providedSimultaneousHandlers) { + if (Array.isArray(_providedSimultaneousHandlers)) { + refs.push(..._providedSimultaneousHandlers); + } else { + refs.push(_providedSimultaneousHandlers); + } + } + + return refs; + }, [_providedSimultaneousHandlers, nativeGestureRef, refreshControlGestureRef]); //#endregion + + return /*#__PURE__*/_react.default.createElement(_reactNativeGestureHandler.PanGestureHandler, { + ref: panGestureRef, + enabled: enableContentPanningGesture, + simultaneousHandlers: simultaneousHandlers, + shouldCancelWhenOutside: false, + waitFor: waitFor, + onGestureEvent: gestureHandler, + activeOffsetX: activeOffsetX, + activeOffsetY: activeOffsetY, + failOffsetX: failOffsetX, + failOffsetY: failOffsetY + }, /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, _extends({ + style: style + }, rest), children)); +}; + +const BottomSheetDraggableView = /*#__PURE__*/(0, _react.memo)(BottomSheetDraggableViewComponent); +BottomSheetDraggableView.displayName = 'BottomSheetDraggableView'; +var _default = BottomSheetDraggableView; +exports.default = _default; +//# sourceMappingURL=BottomSheetDraggableView.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetDraggableView/BottomSheetDraggableView.js.map b/lib/commonjs/components/bottomSheetDraggableView/BottomSheetDraggableView.js.map new file mode 100644 index 000000000..55c1d9757 --- /dev/null +++ b/lib/commonjs/components/bottomSheetDraggableView/BottomSheetDraggableView.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheetDraggableView.tsx"],"names":["BottomSheetDraggableViewComponent","gestureType","GESTURE_SOURCE","CONTENT","nativeGestureRef","refreshControlGestureRef","style","children","rest","enableContentPanningGesture","simultaneousHandlers","_providedSimultaneousHandlers","waitFor","activeOffsetX","activeOffsetY","failOffsetX","failOffsetY","contentPanGestureHandler","scrollablePanGestureHandler","panGestureRef","gestureHandler","refs","push","Array","isArray","BottomSheetDraggableView","displayName"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AAIA;;;;;;;;;;AAGA,MAAMA,iCAAiC,GAAG,CAAC;AACzCC,EAAAA,WAAW,GAAGC,0BAAeC,OADY;AAEzCC,EAAAA,gBAFyC;AAGzCC,EAAAA,wBAHyC;AAIzCC,EAAAA,KAJyC;AAKzCC,EAAAA,QALyC;AAMzC,KAAGC;AANsC,CAAD,KAOL;AACnC;AACA,QAAM;AACJC,IAAAA,2BADI;AAEJC,IAAAA,oBAAoB,EAAEC,6BAFlB;AAGJC,IAAAA,OAHI;AAIJC,IAAAA,aAJI;AAKJC,IAAAA,aALI;AAMJC,IAAAA,WANI;AAOJC,IAAAA;AAPI,MAQF,oCARJ;AASA,QAAM;AAAEC,IAAAA,wBAAF;AAA4BC,IAAAA;AAA5B,MACJ,2CADF,CAXmC,CAanC;AAEA;;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,CA5ED;;AA8EA,MAAMkB,wBAAwB,gBAAG,iBAAKzB,iCAAL,CAAjC;AACAyB,wBAAwB,CAACC,WAAzB,GAAuC,0BAAvC;eAEeD,wB","sourcesContent":["import React, { useMemo, useRef, memo } from 'react';\nimport Animated from 'react-native-reanimated';\nimport { PanGestureHandler } from 'react-native-gesture-handler';\nimport {\n useBottomSheetGestureHandlers,\n useBottomSheetInternal,\n} from '../../hooks';\nimport { GESTURE_SOURCE } from '../../constants';\nimport type { BottomSheetDraggableViewProps } from './types';\n\nconst BottomSheetDraggableViewComponent = ({\n gestureType = GESTURE_SOURCE.CONTENT,\n nativeGestureRef,\n refreshControlGestureRef,\n style,\n children,\n ...rest\n}: BottomSheetDraggableViewProps) => {\n //#region hooks\n const {\n enableContentPanningGesture,\n simultaneousHandlers: _providedSimultaneousHandlers,\n waitFor,\n activeOffsetX,\n activeOffsetY,\n failOffsetX,\n failOffsetY,\n } = useBottomSheetInternal();\n const { contentPanGestureHandler, scrollablePanGestureHandler } =\n useBottomSheetGestureHandlers();\n //#endregion\n\n //#region variables\n const panGestureRef = useRef(null);\n const gestureHandler = useMemo(\n () =>\n gestureType === GESTURE_SOURCE.CONTENT\n ? contentPanGestureHandler\n : scrollablePanGestureHandler,\n [gestureType, contentPanGestureHandler, scrollablePanGestureHandler]\n );\n const simultaneousHandlers = useMemo(() => {\n const refs = [];\n\n if (nativeGestureRef) {\n refs.push(nativeGestureRef);\n }\n\n if (refreshControlGestureRef) {\n refs.push(refreshControlGestureRef);\n }\n\n if (_providedSimultaneousHandlers) {\n if (Array.isArray(_providedSimultaneousHandlers)) {\n refs.push(..._providedSimultaneousHandlers);\n } else {\n refs.push(_providedSimultaneousHandlers);\n }\n }\n\n return refs;\n }, [\n _providedSimultaneousHandlers,\n nativeGestureRef,\n refreshControlGestureRef,\n ]);\n //#endregion\n\n return (\n \n \n {children}\n \n \n );\n};\n\nconst BottomSheetDraggableView = memo(BottomSheetDraggableViewComponent);\nBottomSheetDraggableView.displayName = 'BottomSheetDraggableView';\n\nexport default BottomSheetDraggableView;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetDraggableView/index.js b/lib/commonjs/components/bottomSheetDraggableView/index.js new file mode 100644 index 000000000..0ecdbcf29 --- /dev/null +++ b/lib/commonjs/components/bottomSheetDraggableView/index.js @@ -0,0 +1,16 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "default", { + enumerable: true, + get: function () { + return _BottomSheetDraggableView.default; + } +}); + +var _BottomSheetDraggableView = _interopRequireDefault(require("./BottomSheetDraggableView")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetDraggableView/index.js.map b/lib/commonjs/components/bottomSheetDraggableView/index.js.map new file mode 100644 index 000000000..7c9605420 --- /dev/null +++ b/lib/commonjs/components/bottomSheetDraggableView/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { default } from './BottomSheetDraggableView';\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetFooter/BottomSheetFooter.js b/lib/commonjs/components/bottomSheetFooter/BottomSheetFooter.js new file mode 100644 index 000000000..fe6f151ed --- /dev/null +++ b/lib/commonjs/components/bottomSheetFooter/BottomSheetFooter.js @@ -0,0 +1,75 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireWildcard(require("react")); + +var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated")); + +var _constants = require("../../constants"); + +var _hooks = require("../../hooks"); + +var _styles = require("./styles"); + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function BottomSheetFooterComponent({ + animatedFooterPosition, + bottomInset = 0, + style, + children +}) { + //#region hooks + const { + animatedFooterHeight, + animatedKeyboardState + } = (0, _hooks.useBottomSheetInternal)(); //#endregion + //#region styles + + const containerAnimatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => { + let footerTranslateY = animatedFooterPosition.value; + /** + * Offset the bottom inset only when keyboard is not shown + */ + + if (animatedKeyboardState.value !== _constants.KEYBOARD_STATE.SHOWN) { + footerTranslateY = footerTranslateY - bottomInset; + } + + return { + transform: [{ + translateY: Math.max(0, footerTranslateY) + }] + }; + }, [bottomInset, animatedKeyboardState, animatedFooterPosition]); + const containerStyle = (0, _react.useMemo)(() => [_styles.styles.container, style, containerAnimatedStyle], [style, containerAnimatedStyle]); //#endregion + //#region callbacks + + const handleContainerLayout = (0, _react.useCallback)(({ + nativeEvent: { + layout: { + height + } + } + }) => { + animatedFooterHeight.value = height; + }, [animatedFooterHeight]); //#endregion + + return children !== null ? /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, { + pointerEvents: "box-none", + onLayout: handleContainerLayout, + style: containerStyle + }, typeof children === 'function' ? children() : children) : null; +} + +const BottomSheetFooter = /*#__PURE__*/(0, _react.memo)(BottomSheetFooterComponent); +BottomSheetFooter.displayName = 'BottomSheetFooter'; +var _default = BottomSheetFooter; +exports.default = _default; +//# sourceMappingURL=BottomSheetFooter.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetFooter/BottomSheetFooter.js.map b/lib/commonjs/components/bottomSheetFooter/BottomSheetFooter.js.map new file mode 100644 index 000000000..d687aa378 --- /dev/null +++ b/lib/commonjs/components/bottomSheetFooter/BottomSheetFooter.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheetFooter.tsx"],"names":["BottomSheetFooterComponent","animatedFooterPosition","bottomInset","style","children","animatedFooterHeight","animatedKeyboardState","containerAnimatedStyle","footerTranslateY","value","KEYBOARD_STATE","SHOWN","transform","translateY","Math","max","containerStyle","styles","container","handleContainerLayout","nativeEvent","layout","height","BottomSheetFooter","displayName"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AACA;;AAEA;;;;;;AAEA,SAASA,0BAAT,CAAoC;AAClCC,EAAAA,sBADkC;AAElCC,EAAAA,WAAW,GAAG,CAFoB;AAGlCC,EAAAA,KAHkC;AAIlCC,EAAAA;AAJkC,CAApC,EAKkC;AAChC;AACA,QAAM;AAAEC,IAAAA,oBAAF;AAAwBC,IAAAA;AAAxB,MACJ,oCADF,CAFgC,CAIhC;AAEA;;AACA,QAAMC,sBAAsB,GAAG,6CAAiB,MAAM;AACpD,QAAIC,gBAAgB,GAAGP,sBAAsB,CAACQ,KAA9C;AAEA;AACJ;AACA;;AACI,QAAIH,qBAAqB,CAACG,KAAtB,KAAgCC,0BAAeC,KAAnD,EAA0D;AACxDH,MAAAA,gBAAgB,GAAGA,gBAAgB,GAAGN,WAAtC;AACD;;AAED,WAAO;AACLU,MAAAA,SAAS,EAAE,CACT;AACEC,QAAAA,UAAU,EAAEC,IAAI,CAACC,GAAL,CAAS,CAAT,EAAYP,gBAAZ;AADd,OADS;AADN,KAAP;AAOD,GAjB8B,EAiB5B,CAACN,WAAD,EAAcI,qBAAd,EAAqCL,sBAArC,CAjB4B,CAA/B;AAkBA,QAAMe,cAAc,GAAG,oBACrB,MAAM,CAACC,eAAOC,SAAR,EAAmBf,KAAnB,EAA0BI,sBAA1B,CADe,EAErB,CAACJ,KAAD,EAAQI,sBAAR,CAFqB,CAAvB,CAzBgC,CA6BhC;AAEA;;AACA,QAAMY,qBAAqB,GAAG,wBAC5B,CAAC;AACCC,IAAAA,WAAW,EAAE;AACXC,MAAAA,MAAM,EAAE;AAAEC,QAAAA;AAAF;AADG;AADd,GAAD,KAIyB;AACvBjB,IAAAA,oBAAoB,CAACI,KAArB,GAA6Ba,MAA7B;AACD,GAP2B,EAQ5B,CAACjB,oBAAD,CAR4B,CAA9B,CAhCgC,CA0ChC;;AAEA,SAAOD,QAAQ,KAAK,IAAb,gBACL,6BAAC,8BAAD,CAAU,IAAV;AACE,IAAA,aAAa,EAAC,UADhB;AAEE,IAAA,QAAQ,EAAEe,qBAFZ;AAGE,IAAA,KAAK,EAAEH;AAHT,KAKG,OAAOZ,QAAP,KAAoB,UAApB,GAAiCA,QAAQ,EAAzC,GAA8CA,QALjD,CADK,GAQH,IARJ;AASD;;AAED,MAAMmB,iBAAiB,gBAAG,iBAAKvB,0BAAL,CAA1B;AACAuB,iBAAiB,CAACC,WAAlB,GAAgC,mBAAhC;eAEeD,iB","sourcesContent":["import React, { memo, useCallback, useMemo } from 'react';\nimport { LayoutChangeEvent } from 'react-native';\nimport Animated, { useAnimatedStyle } from 'react-native-reanimated';\nimport { KEYBOARD_STATE } from '../../constants';\nimport { useBottomSheetInternal } from '../../hooks';\nimport type { BottomSheetDefaultFooterProps } from './types';\nimport { styles } from './styles';\n\nfunction BottomSheetFooterComponent({\n animatedFooterPosition,\n bottomInset = 0,\n style,\n children,\n}: BottomSheetDefaultFooterProps) {\n //#region hooks\n const { animatedFooterHeight, animatedKeyboardState } =\n useBottomSheetInternal();\n //#endregion\n\n //#region styles\n const containerAnimatedStyle = useAnimatedStyle(() => {\n let footerTranslateY = animatedFooterPosition.value;\n\n /**\n * Offset the bottom inset only when keyboard is not shown\n */\n if (animatedKeyboardState.value !== KEYBOARD_STATE.SHOWN) {\n footerTranslateY = footerTranslateY - bottomInset;\n }\n\n return {\n transform: [\n {\n translateY: Math.max(0, footerTranslateY),\n },\n ],\n };\n }, [bottomInset, animatedKeyboardState, animatedFooterPosition]);\n const containerStyle = useMemo(\n () => [styles.container, style, containerAnimatedStyle],\n [style, containerAnimatedStyle]\n );\n //#endregion\n\n //#region callbacks\n const handleContainerLayout = useCallback(\n ({\n nativeEvent: {\n layout: { height },\n },\n }: LayoutChangeEvent) => {\n animatedFooterHeight.value = height;\n },\n [animatedFooterHeight]\n );\n //#endregion\n\n return children !== null ? (\n \n {typeof children === 'function' ? children() : children}\n \n ) : null;\n}\n\nconst BottomSheetFooter = memo(BottomSheetFooterComponent);\nBottomSheetFooter.displayName = 'BottomSheetFooter';\n\nexport default BottomSheetFooter;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetFooter/index.js b/lib/commonjs/components/bottomSheetFooter/index.js new file mode 100644 index 000000000..f6cfe529b --- /dev/null +++ b/lib/commonjs/components/bottomSheetFooter/index.js @@ -0,0 +1,16 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "default", { + enumerable: true, + get: function () { + return _BottomSheetFooter.default; + } +}); + +var _BottomSheetFooter = _interopRequireDefault(require("./BottomSheetFooter")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetFooter/index.js.map b/lib/commonjs/components/bottomSheetFooter/index.js.map new file mode 100644 index 000000000..daf04946d --- /dev/null +++ b/lib/commonjs/components/bottomSheetFooter/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { default } from './BottomSheetFooter';\nexport type { BottomSheetFooterProps } from './types';\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetFooter/styles.js b/lib/commonjs/components/bottomSheetFooter/styles.js new file mode 100644 index 000000000..b3f080509 --- /dev/null +++ b/lib/commonjs/components/bottomSheetFooter/styles.js @@ -0,0 +1,21 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.styles = void 0; + +var _reactNative = require("react-native"); + +const styles = _reactNative.StyleSheet.create({ + container: { + position: 'absolute', + top: 0, + left: 0, + right: 0, + zIndex: 9999 + } +}); + +exports.styles = styles; +//# sourceMappingURL=styles.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetFooter/styles.js.map b/lib/commonjs/components/bottomSheetFooter/styles.js.map new file mode 100644 index 000000000..076e4205e --- /dev/null +++ b/lib/commonjs/components/bottomSheetFooter/styles.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["styles.ts"],"names":["styles","StyleSheet","create","container","position","top","left","right","zIndex"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,MAAM,GAAGC,wBAAWC,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE;AACTC,IAAAA,QAAQ,EAAE,UADD;AAETC,IAAAA,GAAG,EAAE,CAFI;AAGTC,IAAAA,IAAI,EAAE,CAHG;AAITC,IAAAA,KAAK,EAAE,CAJE;AAKTC,IAAAA,MAAM,EAAE;AALC;AAD2B,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\n\nexport const styles = StyleSheet.create({\n container: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n zIndex: 9999,\n },\n});\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetFooterContainer/BottomSheetFooterContainer.js b/lib/commonjs/components/bottomSheetFooterContainer/BottomSheetFooterContainer.js new file mode 100644 index 000000000..b38709b1e --- /dev/null +++ b/lib/commonjs/components/bottomSheetFooterContainer/BottomSheetFooterContainer.js @@ -0,0 +1,55 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireWildcard(require("react")); + +var _reactNativeReanimated = require("react-native-reanimated"); + +var _hooks = require("../../hooks"); + +var _constants = require("../../constants"); + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +const BottomSheetFooterContainerComponent = ({ + footerComponent: FooterComponent +}) => { + //#region hooks + const { + animatedContainerHeight, + animatedHandleHeight, + animatedFooterHeight, + animatedPosition, + animatedKeyboardState, + animatedKeyboardHeightInContainer + } = (0, _hooks.useBottomSheetInternal)(); //#endregion + //#region variables + + const animatedFooterPosition = (0, _reactNativeReanimated.useDerivedValue)(() => { + const keyboardHeight = animatedKeyboardHeightInContainer.value; + let footerTranslateY = Math.max(0, animatedContainerHeight.value - animatedPosition.value); + + if (animatedKeyboardState.value === _constants.KEYBOARD_STATE.SHOWN) { + footerTranslateY = footerTranslateY - keyboardHeight; + } + + footerTranslateY = footerTranslateY - animatedFooterHeight.value - animatedHandleHeight.value; + return footerTranslateY; + }, [animatedKeyboardHeightInContainer, animatedContainerHeight, animatedPosition, animatedKeyboardState, animatedFooterHeight, animatedHandleHeight]); //#endregion + + return /*#__PURE__*/_react.default.createElement(FooterComponent, { + animatedFooterPosition: animatedFooterPosition + }); +}; + +const BottomSheetFooterContainer = /*#__PURE__*/(0, _react.memo)(BottomSheetFooterContainerComponent); +BottomSheetFooterContainer.displayName = 'BottomSheetFooterContainer'; +var _default = BottomSheetFooterContainer; +exports.default = _default; +//# sourceMappingURL=BottomSheetFooterContainer.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetFooterContainer/BottomSheetFooterContainer.js.map b/lib/commonjs/components/bottomSheetFooterContainer/BottomSheetFooterContainer.js.map new file mode 100644 index 000000000..d99cdc7fe --- /dev/null +++ b/lib/commonjs/components/bottomSheetFooterContainer/BottomSheetFooterContainer.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheetFooterContainer.tsx"],"names":["BottomSheetFooterContainerComponent","footerComponent","FooterComponent","animatedContainerHeight","animatedHandleHeight","animatedFooterHeight","animatedPosition","animatedKeyboardState","animatedKeyboardHeightInContainer","animatedFooterPosition","keyboardHeight","value","footerTranslateY","Math","max","KEYBOARD_STATE","SHOWN","BottomSheetFooterContainer","displayName"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;AAGA,MAAMA,mCAAmC,GAAG,CAAC;AAC3CC,EAAAA,eAAe,EAAEC;AAD0B,CAAD,KAEL;AACrC;AACA,QAAM;AACJC,IAAAA,uBADI;AAEJC,IAAAA,oBAFI;AAGJC,IAAAA,oBAHI;AAIJC,IAAAA,gBAJI;AAKJC,IAAAA,qBALI;AAMJC,IAAAA;AANI,MAOF,oCAPJ,CAFqC,CAUrC;AAEA;;AACA,QAAMC,sBAAsB,GAAG,4CAAgB,MAAM;AACnD,UAAMC,cAAc,GAAGF,iCAAiC,CAACG,KAAzD;AACA,QAAIC,gBAAgB,GAAGC,IAAI,CAACC,GAAL,CACrB,CADqB,EAErBX,uBAAuB,CAACQ,KAAxB,GAAgCL,gBAAgB,CAACK,KAF5B,CAAvB;;AAKA,QAAIJ,qBAAqB,CAACI,KAAtB,KAAgCI,0BAAeC,KAAnD,EAA0D;AACxDJ,MAAAA,gBAAgB,GAAGA,gBAAgB,GAAGF,cAAtC;AACD;;AAEDE,IAAAA,gBAAgB,GACdA,gBAAgB,GAChBP,oBAAoB,CAACM,KADrB,GAEAP,oBAAoB,CAACO,KAHvB;AAKA,WAAOC,gBAAP;AACD,GAjB8B,EAiB5B,CACDJ,iCADC,EAEDL,uBAFC,EAGDG,gBAHC,EAIDC,qBAJC,EAKDF,oBALC,EAMDD,oBANC,CAjB4B,CAA/B,CAbqC,CAsCrC;;AAEA,sBAAO,6BAAC,eAAD;AAAiB,IAAA,sBAAsB,EAAEK;AAAzC,IAAP;AACD,CA3CD;;AA6CA,MAAMQ,0BAA0B,gBAAG,iBAAKjB,mCAAL,CAAnC;AACAiB,0BAA0B,CAACC,WAA3B,GAAyC,4BAAzC;eAEeD,0B","sourcesContent":["import React, { memo } from 'react';\nimport { useDerivedValue } from 'react-native-reanimated';\nimport { useBottomSheetInternal } from '../../hooks';\nimport { KEYBOARD_STATE } from '../../constants';\nimport type { BottomSheetFooterContainerProps } from './types';\n\nconst BottomSheetFooterContainerComponent = ({\n footerComponent: FooterComponent,\n}: BottomSheetFooterContainerProps) => {\n //#region hooks\n const {\n animatedContainerHeight,\n animatedHandleHeight,\n animatedFooterHeight,\n animatedPosition,\n animatedKeyboardState,\n animatedKeyboardHeightInContainer,\n } = useBottomSheetInternal();\n //#endregion\n\n //#region variables\n const animatedFooterPosition = useDerivedValue(() => {\n const keyboardHeight = animatedKeyboardHeightInContainer.value;\n let footerTranslateY = Math.max(\n 0,\n animatedContainerHeight.value - animatedPosition.value\n );\n\n if (animatedKeyboardState.value === KEYBOARD_STATE.SHOWN) {\n footerTranslateY = footerTranslateY - keyboardHeight;\n }\n\n footerTranslateY =\n footerTranslateY -\n animatedFooterHeight.value -\n animatedHandleHeight.value;\n\n return footerTranslateY;\n }, [\n animatedKeyboardHeightInContainer,\n animatedContainerHeight,\n animatedPosition,\n animatedKeyboardState,\n animatedFooterHeight,\n animatedHandleHeight,\n ]);\n //#endregion\n\n return ;\n};\n\nconst BottomSheetFooterContainer = memo(BottomSheetFooterContainerComponent);\nBottomSheetFooterContainer.displayName = 'BottomSheetFooterContainer';\n\nexport default BottomSheetFooterContainer;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.js b/lib/commonjs/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.js new file mode 100644 index 000000000..9263f22f9 --- /dev/null +++ b/lib/commonjs/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.js @@ -0,0 +1,60 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireWildcard(require("react")); + +var _constants = require("../../constants"); + +var _hooks = require("../../hooks"); + +var _contexts = require("../../contexts"); + +var _reactNativeReanimated = require("react-native-reanimated"); + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +const BottomSheetGestureHandlersProvider = ({ + gestureEventsHandlersHook: useGestureEventsHandlers = _hooks.useGestureEventsHandlersDefault, + children +}) => { + //#region variables + const animatedGestureSource = (0, _reactNativeReanimated.useSharedValue)(_constants.GESTURE_SOURCE.UNDETERMINED); //#endregion + //#region hooks + + const { + animatedContentGestureState, + animatedHandleGestureState + } = (0, _hooks.useBottomSheetInternal)(); + const { + handleOnStart, + handleOnActive, + handleOnEnd + } = useGestureEventsHandlers(); //#endregion + //#region gestures + + const contentPanGestureHandler = (0, _hooks.useGestureHandler)(_constants.GESTURE_SOURCE.CONTENT, animatedContentGestureState, animatedGestureSource, handleOnStart, handleOnActive, handleOnEnd); + const scrollablePanGestureHandler = (0, _hooks.useGestureHandler)(_constants.GESTURE_SOURCE.SCROLLABLE, animatedContentGestureState, animatedGestureSource, handleOnStart, handleOnActive, handleOnEnd); + const handlePanGestureHandler = (0, _hooks.useGestureHandler)(_constants.GESTURE_SOURCE.HANDLE, animatedHandleGestureState, animatedGestureSource, handleOnStart, handleOnActive, handleOnEnd); //#endregion + //#region context + + const contextValue = (0, _react.useMemo)(() => ({ + contentPanGestureHandler, + handlePanGestureHandler, + scrollablePanGestureHandler, + animatedGestureSource + }), [contentPanGestureHandler, handlePanGestureHandler, scrollablePanGestureHandler, animatedGestureSource]); //#endregion + + return /*#__PURE__*/_react.default.createElement(_contexts.BottomSheetGestureHandlersContext.Provider, { + value: contextValue + }, children); +}; + +var _default = BottomSheetGestureHandlersProvider; +exports.default = _default; +//# sourceMappingURL=BottomSheetGestureHandlersProvider.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.js.map b/lib/commonjs/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.js.map new file mode 100644 index 000000000..dd452a0cc --- /dev/null +++ b/lib/commonjs/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheetGestureHandlersProvider.tsx"],"names":["BottomSheetGestureHandlersProvider","gestureEventsHandlersHook","useGestureEventsHandlers","useGestureEventsHandlersDefault","children","animatedGestureSource","GESTURE_SOURCE","UNDETERMINED","animatedContentGestureState","animatedHandleGestureState","handleOnStart","handleOnActive","handleOnEnd","contentPanGestureHandler","CONTENT","scrollablePanGestureHandler","SCROLLABLE","handlePanGestureHandler","HANDLE","contextValue"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAKA;;AAEA;;;;;;AAEA,MAAMA,kCAAkC,GAAG,CAAC;AAC1CC,EAAAA,yBAAyB,EACvBC,wBAAwB,GAAGC,sCAFa;AAG1CC,EAAAA;AAH0C,CAAD,KAII;AAC7C;AACA,QAAMC,qBAAqB,GAAG,2CAC5BC,0BAAeC,YADa,CAA9B,CAF6C,CAK7C;AAEA;;AACA,QAAM;AAAEC,IAAAA,2BAAF;AAA+BC,IAAAA;AAA/B,MACJ,oCADF;AAEA,QAAM;AAAEC,IAAAA,aAAF;AAAiBC,IAAAA,cAAjB;AAAiCC,IAAAA;AAAjC,MACJV,wBAAwB,EAD1B,CAV6C,CAY7C;AAEA;;AACA,QAAMW,wBAAwB,GAAG,8BAC/BP,0BAAeQ,OADgB,EAE/BN,2BAF+B,EAG/BH,qBAH+B,EAI/BK,aAJ+B,EAK/BC,cAL+B,EAM/BC,WAN+B,CAAjC;AASA,QAAMG,2BAA2B,GAAG,8BAClCT,0BAAeU,UADmB,EAElCR,2BAFkC,EAGlCH,qBAHkC,EAIlCK,aAJkC,EAKlCC,cALkC,EAMlCC,WANkC,CAApC;AASA,QAAMK,uBAAuB,GAAG,8BAC9BX,0BAAeY,MADe,EAE9BT,0BAF8B,EAG9BJ,qBAH8B,EAI9BK,aAJ8B,EAK9BC,cAL8B,EAM9BC,WAN8B,CAAhC,CAjC6C,CAyC7C;AAEA;;AACA,QAAMO,YAAY,GAAG,oBACnB,OAAO;AACLN,IAAAA,wBADK;AAELI,IAAAA,uBAFK;AAGLF,IAAAA,2BAHK;AAILV,IAAAA;AAJK,GAAP,CADmB,EAOnB,CACEQ,wBADF,EAEEI,uBAFF,EAGEF,2BAHF,EAIEV,qBAJF,CAPmB,CAArB,CA5C6C,CA0D7C;;AACA,sBACE,6BAAC,2CAAD,CAAmC,QAAnC;AAA4C,IAAA,KAAK,EAAEc;AAAnD,KACGf,QADH,CADF;AAKD,CApED;;eAsEeJ,kC","sourcesContent":["import React, { useMemo } from 'react';\nimport { GESTURE_SOURCE } from '../../constants';\nimport {\n useGestureHandler,\n useBottomSheetInternal,\n useGestureEventsHandlersDefault,\n} from '../../hooks';\nimport { BottomSheetGestureHandlersContext } from '../../contexts';\nimport type { BottomSheetGestureHandlersProviderProps } from './types';\nimport { useSharedValue } from 'react-native-reanimated';\n\nconst BottomSheetGestureHandlersProvider = ({\n gestureEventsHandlersHook:\n useGestureEventsHandlers = useGestureEventsHandlersDefault,\n children,\n}: BottomSheetGestureHandlersProviderProps) => {\n //#region variables\n const animatedGestureSource = useSharedValue(\n GESTURE_SOURCE.UNDETERMINED\n );\n //#endregion\n\n //#region hooks\n const { animatedContentGestureState, animatedHandleGestureState } =\n useBottomSheetInternal();\n const { handleOnStart, handleOnActive, handleOnEnd } =\n useGestureEventsHandlers();\n //#endregion\n\n //#region gestures\n const contentPanGestureHandler = useGestureHandler(\n GESTURE_SOURCE.CONTENT,\n animatedContentGestureState,\n animatedGestureSource,\n handleOnStart,\n handleOnActive,\n handleOnEnd\n );\n\n const scrollablePanGestureHandler = useGestureHandler(\n GESTURE_SOURCE.SCROLLABLE,\n animatedContentGestureState,\n animatedGestureSource,\n handleOnStart,\n handleOnActive,\n handleOnEnd\n );\n\n const handlePanGestureHandler = useGestureHandler(\n GESTURE_SOURCE.HANDLE,\n animatedHandleGestureState,\n animatedGestureSource,\n handleOnStart,\n handleOnActive,\n handleOnEnd\n );\n //#endregion\n\n //#region context\n const contextValue = useMemo(\n () => ({\n contentPanGestureHandler,\n handlePanGestureHandler,\n scrollablePanGestureHandler,\n animatedGestureSource,\n }),\n [\n contentPanGestureHandler,\n handlePanGestureHandler,\n scrollablePanGestureHandler,\n animatedGestureSource,\n ]\n );\n //#endregion\n return (\n \n {children}\n \n );\n};\n\nexport default BottomSheetGestureHandlersProvider;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetGestureHandlersProvider/index.js b/lib/commonjs/components/bottomSheetGestureHandlersProvider/index.js new file mode 100644 index 000000000..0d0ad97f1 --- /dev/null +++ b/lib/commonjs/components/bottomSheetGestureHandlersProvider/index.js @@ -0,0 +1,16 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "default", { + enumerable: true, + get: function () { + return _BottomSheetGestureHandlersProvider.default; + } +}); + +var _BottomSheetGestureHandlersProvider = _interopRequireDefault(require("./BottomSheetGestureHandlersProvider")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetGestureHandlersProvider/index.js.map b/lib/commonjs/components/bottomSheetGestureHandlersProvider/index.js.map new file mode 100644 index 000000000..435db8036 --- /dev/null +++ b/lib/commonjs/components/bottomSheetGestureHandlersProvider/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { default } from './BottomSheetGestureHandlersProvider';\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetHandle/BottomSheetHandle.js b/lib/commonjs/components/bottomSheetHandle/BottomSheetHandle.js new file mode 100644 index 000000000..df780a8cd --- /dev/null +++ b/lib/commonjs/components/bottomSheetHandle/BottomSheetHandle.js @@ -0,0 +1,40 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireWildcard(require("react")); + +var _reactNativeReanimated = _interopRequireDefault(require("react-native-reanimated")); + +var _styles = require("./styles"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +const BottomSheetHandleComponent = ({ + style, + indicatorStyle: _indicatorStyle, + children +}) => { + // styles + const containerStyle = (0, _react.useMemo)(() => [_styles.styles.container, ...[Array.isArray(style) ? style : [style]]], [style]); + const indicatorStyle = (0, _react.useMemo)(() => [_styles.styles.indicator, ...[Array.isArray(_indicatorStyle) ? _indicatorStyle : [_indicatorStyle]]], [_indicatorStyle]); // render + + return /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, { + style: containerStyle + }, /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, { + style: indicatorStyle + }), children); +}; + +const BottomSheetHandle = /*#__PURE__*/(0, _react.memo)(BottomSheetHandleComponent); +BottomSheetHandle.displayName = 'BottomSheetHandle'; +var _default = BottomSheetHandle; +exports.default = _default; +//# sourceMappingURL=BottomSheetHandle.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetHandle/BottomSheetHandle.js.map b/lib/commonjs/components/bottomSheetHandle/BottomSheetHandle.js.map new file mode 100644 index 000000000..2cc9b31c8 --- /dev/null +++ b/lib/commonjs/components/bottomSheetHandle/BottomSheetHandle.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheetHandle.tsx"],"names":["BottomSheetHandleComponent","style","indicatorStyle","_indicatorStyle","children","containerStyle","styles","container","Array","isArray","indicator","BottomSheetHandle","displayName"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;;;;;AAGA,MAAMA,0BAA0B,GAAG,CAAC;AAClCC,EAAAA,KADkC;AAElCC,EAAAA,cAAc,EAAEC,eAFkB;AAGlCC,EAAAA;AAHkC,CAAD,KAIE;AACnC;AACA,QAAMC,cAAc,GAAG,oBACrB,MAAM,CAACC,eAAOC,SAAR,EAAmB,GAAG,CAACC,KAAK,CAACC,OAAN,CAAcR,KAAd,IAAuBA,KAAvB,GAA+B,CAACA,KAAD,CAAhC,CAAtB,CADe,EAErB,CAACA,KAAD,CAFqB,CAAvB;AAIA,QAAMC,cAAc,GAAG,oBACrB,MAAM,CACJI,eAAOI,SADH,EAEJ,GAAG,CAACF,KAAK,CAACC,OAAN,CAAcN,eAAd,IAAiCA,eAAjC,GAAmD,CAACA,eAAD,CAApD,CAFC,CADe,EAKrB,CAACA,eAAD,CALqB,CAAvB,CANmC,CAcnC;;AACA,sBACE,6BAAC,8BAAD,CAAU,IAAV;AAAe,IAAA,KAAK,EAAEE;AAAtB,kBACE,6BAAC,8BAAD,CAAU,IAAV;AAAe,IAAA,KAAK,EAAEH;AAAtB,IADF,EAEGE,QAFH,CADF;AAMD,CAzBD;;AA2BA,MAAMO,iBAAiB,gBAAG,iBAAKX,0BAAL,CAA1B;AACAW,iBAAiB,CAACC,WAAlB,GAAgC,mBAAhC;eAEeD,iB","sourcesContent":["import React, { memo, useMemo } from 'react';\nimport Animated from 'react-native-reanimated';\nimport { styles } from './styles';\nimport type { BottomSheetDefaultHandleProps } from './types';\n\nconst BottomSheetHandleComponent = ({\n style,\n indicatorStyle: _indicatorStyle,\n children,\n}: BottomSheetDefaultHandleProps) => {\n // styles\n const containerStyle = useMemo(\n () => [styles.container, ...[Array.isArray(style) ? style : [style]]],\n [style]\n );\n const indicatorStyle = useMemo(\n () => [\n styles.indicator,\n ...[Array.isArray(_indicatorStyle) ? _indicatorStyle : [_indicatorStyle]],\n ],\n [_indicatorStyle]\n );\n\n // render\n return (\n \n \n {children}\n \n );\n};\n\nconst BottomSheetHandle = memo(BottomSheetHandleComponent);\nBottomSheetHandle.displayName = 'BottomSheetHandle';\n\nexport default BottomSheetHandle;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetHandle/index.js b/lib/commonjs/components/bottomSheetHandle/index.js new file mode 100644 index 000000000..5f758bd29 --- /dev/null +++ b/lib/commonjs/components/bottomSheetHandle/index.js @@ -0,0 +1,16 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "default", { + enumerable: true, + get: function () { + return _BottomSheetHandle.default; + } +}); + +var _BottomSheetHandle = _interopRequireDefault(require("./BottomSheetHandle")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetHandle/index.js.map b/lib/commonjs/components/bottomSheetHandle/index.js.map new file mode 100644 index 000000000..ea0d960c9 --- /dev/null +++ b/lib/commonjs/components/bottomSheetHandle/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { default } from './BottomSheetHandle';\nexport type { BottomSheetHandleProps } from './types';\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetHandle/styles.js b/lib/commonjs/components/bottomSheetHandle/styles.js new file mode 100644 index 000000000..d544f5627 --- /dev/null +++ b/lib/commonjs/components/bottomSheetHandle/styles.js @@ -0,0 +1,26 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.styles = void 0; + +var _reactNative = require("react-native"); + +var _constants = require("../../constants"); + +const styles = _reactNative.StyleSheet.create({ + container: { + padding: 10 + }, + indicator: { + alignSelf: 'center', + width: 7.5 * _constants.WINDOW_WIDTH / 100, + height: 4, + borderRadius: 4, + backgroundColor: 'rgba(0, 0, 0, 0.75)' + } +}); + +exports.styles = styles; +//# sourceMappingURL=styles.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetHandle/styles.js.map b/lib/commonjs/components/bottomSheetHandle/styles.js.map new file mode 100644 index 000000000..3d7f00468 --- /dev/null +++ b/lib/commonjs/components/bottomSheetHandle/styles.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["styles.ts"],"names":["styles","StyleSheet","create","container","padding","indicator","alignSelf","width","WINDOW_WIDTH","height","borderRadius","backgroundColor"],"mappings":";;;;;;;AAAA;;AACA;;AAEO,MAAMA,MAAM,GAAGC,wBAAWC,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE;AACTC,IAAAA,OAAO,EAAE;AADA,GAD2B;AAKtCC,EAAAA,SAAS,EAAE;AACTC,IAAAA,SAAS,EAAE,QADF;AAETC,IAAAA,KAAK,EAAG,MAAMC,uBAAP,GAAuB,GAFrB;AAGTC,IAAAA,MAAM,EAAE,CAHC;AAITC,IAAAA,YAAY,EAAE,CAJL;AAKTC,IAAAA,eAAe,EAAE;AALR;AAL2B,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\nimport { WINDOW_WIDTH } from '../../constants';\n\nexport const styles = StyleSheet.create({\n container: {\n padding: 10,\n },\n\n indicator: {\n alignSelf: 'center',\n width: (7.5 * WINDOW_WIDTH) / 100,\n height: 4,\n borderRadius: 4,\n backgroundColor: 'rgba(0, 0, 0, 0.75)',\n },\n});\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetHandleContainer/BottomSheetHandleContainer.js b/lib/commonjs/components/bottomSheetHandleContainer/BottomSheetHandleContainer.js new file mode 100644 index 000000000..0fb476847 --- /dev/null +++ b/lib/commonjs/components/bottomSheetHandleContainer/BottomSheetHandleContainer.js @@ -0,0 +1,117 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireWildcard(require("react")); + +var _reactNativeGestureHandler = require("react-native-gesture-handler"); + +var _reactNativeReanimated = _interopRequireDefault(require("react-native-reanimated")); + +var _bottomSheetHandle = _interopRequireDefault(require("../bottomSheetHandle")); + +var _hooks = require("../../hooks"); + +var _utilities = require("../../utilities"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function BottomSheetHandleContainerComponent({ + animatedIndex, + animatedPosition, + simultaneousHandlers: _internalSimultaneousHandlers, + enableHandlePanningGesture, + handleHeight, + handleComponent: _providedHandleComponent, + handleStyle: _providedHandleStyle, + handleIndicatorStyle: _providedIndicatorStyle +}) { + //#region hooks + const { + activeOffsetX, + activeOffsetY, + failOffsetX, + failOffsetY, + waitFor, + simultaneousHandlers: _providedSimultaneousHandlers + } = (0, _hooks.useBottomSheetInternal)(); + const { + handlePanGestureHandler + } = (0, _hooks.useBottomSheetGestureHandlers)(); //#endregion + //#region variables + + const simultaneousHandlers = (0, _react.useMemo)(() => { + const refs = []; + + if (_internalSimultaneousHandlers) { + refs.push(_internalSimultaneousHandlers); + } + + if (_providedSimultaneousHandlers) { + if (Array.isArray(_providedSimultaneousHandlers)) { + refs.push(..._providedSimultaneousHandlers); + } else { + refs.push(_providedSimultaneousHandlers); + } + } + + return refs; + }, [_providedSimultaneousHandlers, _internalSimultaneousHandlers]); //#endregion + //#region callbacks + + const handleContainerLayout = (0, _react.useCallback)(function handleContainerLayout({ + nativeEvent: { + layout: { + height + } + } + }) { + handleHeight.value = height; + (0, _utilities.print)({ + component: BottomSheetHandleContainer.displayName, + method: 'handleContainerLayout', + params: { + height + } + }); + }, [handleHeight]); //#endregion + //#region renders + + const HandleComponent = _providedHandleComponent === undefined ? _bottomSheetHandle.default : _providedHandleComponent; + return HandleComponent !== null ? /*#__PURE__*/_react.default.createElement(_reactNativeGestureHandler.PanGestureHandler, { + enabled: enableHandlePanningGesture, + waitFor: waitFor, + simultaneousHandlers: simultaneousHandlers, + shouldCancelWhenOutside: false, + activeOffsetX: activeOffsetX, + activeOffsetY: activeOffsetY, + failOffsetX: failOffsetX, + failOffsetY: failOffsetY, + onGestureEvent: handlePanGestureHandler + }, /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, { + key: "BottomSheetHandleContainer", + accessible: true, + accessibilityRole: "adjustable", + accessibilityLabel: "Bottom Sheet handle", + accessibilityHint: "Drag up or down to extend or minimize the Bottom Sheet", + onLayout: handleContainerLayout + }, /*#__PURE__*/_react.default.createElement(HandleComponent, { + animatedIndex: animatedIndex, + animatedPosition: animatedPosition, + style: _providedHandleStyle, + indicatorStyle: _providedIndicatorStyle + }))) : null; //#endregion +} + +const BottomSheetHandleContainer = /*#__PURE__*/(0, _react.memo)(BottomSheetHandleContainerComponent); +BottomSheetHandleContainer.displayName = 'BottomSheetHandleContainer'; +var _default = BottomSheetHandleContainer; +exports.default = _default; +//# sourceMappingURL=BottomSheetHandleContainer.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetHandleContainer/BottomSheetHandleContainer.js.map b/lib/commonjs/components/bottomSheetHandleContainer/BottomSheetHandleContainer.js.map new file mode 100644 index 000000000..a2b3bb3a0 --- /dev/null +++ b/lib/commonjs/components/bottomSheetHandleContainer/BottomSheetHandleContainer.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheetHandleContainer.tsx"],"names":["BottomSheetHandleContainerComponent","animatedIndex","animatedPosition","simultaneousHandlers","_internalSimultaneousHandlers","enableHandlePanningGesture","handleHeight","handleComponent","_providedHandleComponent","handleStyle","_providedHandleStyle","handleIndicatorStyle","_providedIndicatorStyle","activeOffsetX","activeOffsetY","failOffsetX","failOffsetY","waitFor","_providedSimultaneousHandlers","handlePanGestureHandler","refs","push","Array","isArray","handleContainerLayout","nativeEvent","layout","height","value","component","BottomSheetHandleContainer","displayName","method","params","HandleComponent","undefined","BottomSheetHandle"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AAIA;;;;;;;;AAGA,SAASA,mCAAT,CAA6C;AAC3CC,EAAAA,aAD2C;AAE3CC,EAAAA,gBAF2C;AAG3CC,EAAAA,oBAAoB,EAAEC,6BAHqB;AAI3CC,EAAAA,0BAJ2C;AAK3CC,EAAAA,YAL2C;AAM3CC,EAAAA,eAAe,EAAEC,wBAN0B;AAO3CC,EAAAA,WAAW,EAAEC,oBAP8B;AAQ3CC,EAAAA,oBAAoB,EAAEC;AARqB,CAA7C,EASoC;AAClC;AACA,QAAM;AACJC,IAAAA,aADI;AAEJC,IAAAA,aAFI;AAGJC,IAAAA,WAHI;AAIJC,IAAAA,WAJI;AAKJC,IAAAA,OALI;AAMJd,IAAAA,oBAAoB,EAAEe;AANlB,MAOF,oCAPJ;AAQA,QAAM;AAAEC,IAAAA;AAAF,MAA8B,2CAApC,CAVkC,CAWlC;AA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a,EAAEC,aANjB;AAOE,IAAA,WAAW,EAAEC,WAPf;AAQE,IAAA,WAAW,EAAEC,WARf;AASE,IAAA,cAAc,EAAEG;AATlB,kBAWE,6BAAC,8BAAD,CAAU,IAAV;AACE,IAAA,GAAG,EAAC,4BADN;AAEE,IAAA,UAAU,EAAE,IAFd;AAGE,IAAA,iBAAiB,EAAC,YAHpB;AAIE,IAAA,kBAAkB,EAAC,qBAJrB;AAKE,IAAA,iBAAiB,EAAC,wDALpB;AAME,IAAA,QAAQ,EAAEK;AANZ,kBAQE,6BAAC,eAAD;AACE,IAAA,aAAa,EAAEvB,aADjB;AAEE,IAAA,gBAAgB,EAAEC,gBAFpB;AAGE,IAAA,KAAK,EAAEQ,oBAHT;AAIE,IAAA,cAAc,EAAEE;AAJlB,IARF,CAXF,CADK,GA4BH,IA5BJ,CA3DkC,CAwFlC;AACD;;AAED,MAAMkB,0BAA0B,gBAAG,iBAAK9B,mCAAL,CAAnC;AACA8B,0BAA0B,CAACC,WAA3B,GAAyC,4BAAzC;eAEeD,0B","sourcesContent":["import React, { memo, useCallback, useMemo } from 'react';\nimport type { LayoutChangeEvent } from 'react-native';\nimport { PanGestureHandler } from 'react-native-gesture-handler';\nimport Animated from 'react-native-reanimated';\nimport BottomSheetHandle from '../bottomSheetHandle';\nimport {\n useBottomSheetGestureHandlers,\n useBottomSheetInternal,\n} from '../../hooks';\nimport { print } from '../../utilities';\nimport type { BottomSheetHandleContainerProps } from './types';\n\nfunction BottomSheetHandleContainerComponent({\n animatedIndex,\n animatedPosition,\n simultaneousHandlers: _internalSimultaneousHandlers,\n enableHandlePanningGesture,\n handleHeight,\n handleComponent: _providedHandleComponent,\n handleStyle: _providedHandleStyle,\n handleIndicatorStyle: _providedIndicatorStyle,\n}: BottomSheetHandleContainerProps) {\n //#region hooks\n const {\n activeOffsetX,\n activeOffsetY,\n failOffsetX,\n failOffsetY,\n waitFor,\n simultaneousHandlers: _providedSimultaneousHandlers,\n } = useBottomSheetInternal();\n const { handlePanGestureHandler } = useBottomSheetGestureHandlers();\n //#endregion\n\n //#region variables\n const simultaneousHandlers = useMemo(() => {\n const refs = [];\n\n if (_internalSimultaneousHandlers) {\n refs.push(_internalSimultaneousHandlers);\n }\n\n if (_providedSimultaneousHandlers) {\n if (Array.isArray(_providedSimultaneousHandlers)) {\n refs.push(..._providedSimultaneousHandlers);\n } else {\n refs.push(_providedSimultaneousHandlers);\n }\n }\n\n return refs;\n }, [_providedSimultaneousHandlers, _internalSimultaneousHandlers]);\n //#endregion\n\n //#region callbacks\n const handleContainerLayout = useCallback(\n function handleContainerLayout({\n nativeEvent: {\n layout: { height },\n },\n }: LayoutChangeEvent) {\n handleHeight.value = height;\n\n print({\n component: BottomSheetHandleContainer.displayName,\n method: 'handleContainerLayout',\n params: {\n height,\n },\n });\n },\n [handleHeight]\n );\n //#endregion\n\n //#region renders\n const HandleComponent =\n _providedHandleComponent === undefined\n ? BottomSheetHandle\n : _providedHandleComponent;\n return HandleComponent !== null ? (\n \n \n \n \n \n ) : null;\n //#endregion\n}\n\nconst BottomSheetHandleContainer = memo(BottomSheetHandleContainerComponent);\nBottomSheetHandleContainer.displayName = 'BottomSheetHandleContainer';\n\nexport default BottomSheetHandleContainer;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetHandleContainer/index.js b/lib/commonjs/components/bottomSheetHandleContainer/index.js new file mode 100644 index 000000000..170fcfa10 --- /dev/null +++ b/lib/commonjs/components/bottomSheetHandleContainer/index.js @@ -0,0 +1,16 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "default", { + enumerable: true, + get: function () { + return _BottomSheetHandleContainer.default; + } +}); + +var _BottomSheetHandleContainer = _interopRequireDefault(require("./BottomSheetHandleContainer")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetHandleContainer/index.js.map b/lib/commonjs/components/bottomSheetHandleContainer/index.js.map new file mode 100644 index 000000000..b98bd3483 --- /dev/null +++ b/lib/commonjs/components/bottomSheetHandleContainer/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { default } from './BottomSheetHandleContainer';\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetModal/BottomSheetModal.js b/lib/commonjs/components/bottomSheetModal/BottomSheetModal.js new file mode 100644 index 000000000..5dca51fdf --- /dev/null +++ b/lib/commonjs/components/bottomSheetModal/BottomSheetModal.js @@ -0,0 +1,384 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireWildcard(require("react")); + +var _portal = require("@gorhom/portal"); + +var _bottomSheet = _interopRequireDefault(require("../bottomSheet")); + +var _hooks = require("../../hooks"); + +var _utilities = require("../../utilities"); + +var _constants = require("./constants"); + +var _id = require("../../utilities/id"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } + +const INITIAL_STATE = { + mount: false, + data: undefined +}; +const BottomSheetModalComponent = /*#__PURE__*/(0, _react.forwardRef)(function BottomSheetModal(props, ref) { + const { + // modal props + name, + stackBehavior = _constants.DEFAULT_STACK_BEHAVIOR, + enableDismissOnClose = _constants.DEFAULT_ENABLE_DISMISS_ON_CLOSE, + onDismiss: _providedOnDismiss, + // bottom sheet props + index = 0, + snapPoints, + enablePanDownToClose = true, + animateOnMount = true, + containerComponent: ContainerComponent = _react.default.Fragment, + // callbacks + onChange: _providedOnChange, + // components + children: Content, + ...bottomSheetProps + } = props; //#region state + + const [{ + mount, + data + }, setState] = (0, _react.useState)(INITIAL_STATE); //#endregion + //#region hooks + + const { + containerHeight, + containerOffset, + mountSheet, + unmountSheet, + willUnmountSheet + } = (0, _hooks.useBottomSheetModalInternal)(); + const { + removePortal: unmountPortal + } = (0, _portal.usePortal)(); //#endregion + //#region refs + + const bottomSheetRef = (0, _react.useRef)(null); + const currentIndexRef = (0, _react.useRef)(!animateOnMount ? index : -1); + const restoreIndexRef = (0, _react.useRef)(-1); + const minimized = (0, _react.useRef)(false); + const forcedDismissed = (0, _react.useRef)(false); + const mounted = (0, _react.useRef)(false); + mounted.current = mount; //#endregion + //#region variables + + const key = (0, _react.useMemo)(() => name || `bottom-sheet-modal-${(0, _id.id)()}`, [name]); //#endregion + //#region private methods + + const resetVariables = (0, _react.useCallback)(function resetVariables() { + (0, _utilities.print)({ + component: BottomSheetModal.name, + method: resetVariables.name + }); + currentIndexRef.current = -1; + restoreIndexRef.current = -1; + minimized.current = false; + mounted.current = false; + forcedDismissed.current = false; + }, []); + const unmount = (0, _react.useCallback)(function unmount() { + (0, _utilities.print)({ + component: BottomSheetModal.name, + method: unmount.name + }); + const _mounted = mounted.current; // reset variables + + resetVariables(); // unmount sheet and portal + + unmountSheet(key); + unmountPortal(key); // unmount the node, if sheet is still mounted + + if (_mounted) { + setState(INITIAL_STATE); + } // fire `onDismiss` callback + + + if (_providedOnDismiss) { + _providedOnDismiss(); + } + }, [key, resetVariables, unmountSheet, unmountPortal, _providedOnDismiss]); //#endregion + //#region bottom sheet methods + + const handleSnapToIndex = (0, _react.useCallback)((...args) => { + var _bottomSheetRef$curre; + + if (minimized.current) { + return; + } + + (_bottomSheetRef$curre = bottomSheetRef.current) === null || _bottomSheetRef$curre === void 0 ? void 0 : _bottomSheetRef$curre.snapToIndex(...args); + }, []); + const handleSnapToPosition = (0, _react.useCallback)((...args) => { + var _bottomSheetRef$curre2; + + if (minimized.current) { + return; + } + + (_bottomSheetRef$curre2 = bottomSheetRef.current) === null || _bottomSheetRef$curre2 === void 0 ? void 0 : _bottomSheetRef$curre2.snapToPosition(...args); + }, []); + const handleExpand = (0, _react.useCallback)((...args) => { + var _bottomSheetRef$curre3; + + if (minimized.current) { + return; + } + + (_bottomSheetRef$curre3 = bottomSheetRef.current) === null || _bottomSheetRef$curre3 === void 0 ? void 0 : _bottomSheetRef$curre3.expand(...args); + }, []); + const handleCollapse = (0, _react.useCallback)((...args) => { + var _bottomSheetRef$curre4; + + if (minimized.current) { + return; + } + + (_bottomSheetRef$curre4 = bottomSheetRef.current) === null || _bottomSheetRef$curre4 === void 0 ? void 0 : _bottomSheetRef$curre4.collapse(...args); + }, []); + const handleClose = (0, _react.useCallback)((...args) => { + var _bottomSheetRef$curre5; + + if (minimized.current) { + return; + } + + (_bottomSheetRef$curre5 = bottomSheetRef.current) === null || _bottomSheetRef$curre5 === void 0 ? void 0 : _bottomSheetRef$curre5.close(...args); + }, []); + const handleForceClose = (0, _react.useCallback)((...args) => { + var _bottomSheetRef$curre6; + + if (minimized.current) { + return; + } + + (_bottomSheetRef$curre6 = bottomSheetRef.current) === null || _bottomSheetRef$curre6 === void 0 ? void 0 : _bottomSheetRef$curre6.forceClose(...args); + }, []); //#endregion + //#region bottom sheet modal methods + + const handlePresent = (0, _react.useCallback)(function handlePresent(_data) { + requestAnimationFrame(() => { + setState({ + mount: true, + data: _data + }); + mountSheet(key, ref, stackBehavior); + (0, _utilities.print)({ + component: BottomSheetModal.name, + method: handlePresent.name + }); + }); + }, // eslint-disable-next-line react-hooks/exhaustive-deps + [key, stackBehavior, mountSheet]); + const handleDismiss = (0, _react.useCallback)(function handleDismiss(animationConfigs) { + var _bottomSheetRef$curre7; + + (0, _utilities.print)({ + component: BottomSheetModal.name, + method: handleDismiss.name, + params: { + currentIndexRef: currentIndexRef.current, + minimized: minimized.current + } + }); + /** + * if modal is already been dismiss, we exit the method. + */ + + if (currentIndexRef.current === -1 && minimized.current === false) { + return; + } + + if (minimized.current || currentIndexRef.current === -1 && enablePanDownToClose) { + unmount(); + return; + } + + willUnmountSheet(key); + forcedDismissed.current = true; + (_bottomSheetRef$curre7 = bottomSheetRef.current) === null || _bottomSheetRef$curre7 === void 0 ? void 0 : _bottomSheetRef$curre7.forceClose(animationConfigs); + }, [willUnmountSheet, unmount, key, enablePanDownToClose]); + const handleMinimize = (0, _react.useCallback)(function handleMinimize() { + var _bottomSheetRef$curre8; + + (0, _utilities.print)({ + component: BottomSheetModal.name, + method: handleMinimize.name, + params: { + minimized: minimized.current + } + }); + + if (minimized.current) { + return; + } + + minimized.current = true; + /** + * if modal got minimized before it finish its mounting + * animation, we set the `restoreIndexRef` to the + * provided index. + */ + + if (currentIndexRef.current === -1) { + restoreIndexRef.current = index; + } else { + restoreIndexRef.current = currentIndexRef.current; + } + + (_bottomSheetRef$curre8 = bottomSheetRef.current) === null || _bottomSheetRef$curre8 === void 0 ? void 0 : _bottomSheetRef$curre8.close(); + }, [index]); + const handleRestore = (0, _react.useCallback)(function handleRestore() { + var _bottomSheetRef$curre9; + + (0, _utilities.print)({ + component: BottomSheetModal.name, + method: handleRestore.name, + params: { + minimized: minimized.current, + forcedDismissed: forcedDismissed.current + } + }); + + if (!minimized.current || forcedDismissed.current) { + return; + } + + minimized.current = false; + (_bottomSheetRef$curre9 = bottomSheetRef.current) === null || _bottomSheetRef$curre9 === void 0 ? void 0 : _bottomSheetRef$curre9.snapToIndex(restoreIndexRef.current); + }, []); //#endregion + //#region callbacks + + const handlePortalOnUnmount = (0, _react.useCallback)(function handlePortalOnUnmount() { + var _bottomSheetRef$curre10; + + (0, _utilities.print)({ + component: BottomSheetModal.name, + method: handlePortalOnUnmount.name, + params: { + minimized: minimized.current, + forcedDismissed: forcedDismissed.current + } + }); + /** + * if modal is already been dismiss, we exit the method. + */ + + if (currentIndexRef.current === -1 && minimized.current === false) { + return; + } + + mounted.current = false; + forcedDismissed.current = true; + + if (minimized.current) { + unmount(); + return; + } + + willUnmountSheet(key); + (_bottomSheetRef$curre10 = bottomSheetRef.current) === null || _bottomSheetRef$curre10 === void 0 ? void 0 : _bottomSheetRef$curre10.close(); + }, [key, unmount, willUnmountSheet]); + const handlePortalRender = (0, _react.useCallback)(function handlePortalRender(render) { + if (mounted.current) { + render(); + } + }, []); + const handleBottomSheetOnChange = (0, _react.useCallback)(function handleBottomSheetOnChange(_index) { + (0, _utilities.print)({ + component: BottomSheetModal.name, + method: handleBottomSheetOnChange.name, + params: { + minimized: minimized.current, + forcedDismissed: forcedDismissed.current + } + }); + currentIndexRef.current = _index; + + if (_providedOnChange) { + _providedOnChange(_index); + } + }, [_providedOnChange]); + const handleBottomSheetOnClose = (0, _react.useCallback)(function handleBottomSheetOnClose() { + (0, _utilities.print)({ + component: BottomSheetModal.name, + method: handleBottomSheetOnClose.name, + params: { + minimized: minimized.current, + forcedDismissed: forcedDismissed.current + } + }); + + if (minimized.current) { + return; + } + + if (enableDismissOnClose) { + unmount(); + } + }, [enableDismissOnClose, unmount]); //#endregion + //#region expose methods + + (0, _react.useImperativeHandle)(ref, () => ({ + // sheet + snapToIndex: handleSnapToIndex, + snapToPosition: handleSnapToPosition, + expand: handleExpand, + collapse: handleCollapse, + close: handleClose, + forceClose: handleForceClose, + // modal methods + dismiss: handleDismiss, + present: handlePresent, + // internal + minimize: handleMinimize, + restore: handleRestore + })); //#endregion + // render + // console.log('BottomSheetModal', index, mount, data); + + return mount ? /*#__PURE__*/_react.default.createElement(_portal.Portal, { + key: key, + name: key, + handleOnMount: handlePortalRender, + handleOnUpdate: handlePortalRender, + handleOnUnmount: handlePortalOnUnmount + }, /*#__PURE__*/_react.default.createElement(ContainerComponent, { + key: key + }, /*#__PURE__*/_react.default.createElement(_bottomSheet.default, _extends({}, bottomSheetProps, { + ref: bottomSheetRef, + key: key, + index: index, + snapPoints: snapPoints, + enablePanDownToClose: enablePanDownToClose, + animateOnMount: animateOnMount, + containerHeight: containerHeight, + containerOffset: containerOffset, + onChange: handleBottomSheetOnChange, + onClose: handleBottomSheetOnClose, + children: typeof Content === 'function' ? /*#__PURE__*/_react.default.createElement(Content, { + data: data + }) : Content, + $modal: true + })))) : null; +}); +const BottomSheetModal = /*#__PURE__*/(0, _react.memo)(BottomSheetModalComponent); +BottomSheetModal.displayName = 'BottomSheetModal'; +var _default = BottomSheetModal; +exports.default = _default; +//# sourceMappingURL=BottomSheetModal.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetModal/BottomSheetModal.js.map b/lib/commonjs/components/bottomSheetModal/BottomSheetModal.js.map new file mode 100644 index 000000000..3aad70c0e --- /dev/null +++ b/lib/commonjs/components/bottomSheetModal/BottomSheetModal.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheetModal.tsx"],"names":["INITIAL_STATE","mount","data","undefined","BottomSheetModalComponent","BottomSheetModal","props","ref","name","stackBehavior","DEFAULT_STACK_BEHAVIOR","enableDismissOnClose","DEFAULT_ENABLE_DISMISS_ON_CLOSE","onDismiss","_providedOnDismiss","index","snapPoints","enablePanDownToClose","animateOnMount","containerComponent","ContainerComponent","React","Fragment","onChange","_providedOnChange","children","Content","bottomSheetProps","setState","containerHeight","containerOffset","mountSheet","unmountSheet","willUnmountSheet","removePortal","unmountPortal","bottomSheetRef","currentIndexRef","restoreIndexRef","minimized","forcedDismissed","mounted","current","key","resetVariables","component","method","unmount","_mounted","handleSnapToIndex","args","snapToIndex","handleSnapToPosition","snapToPosition","handleExpand","expand","handleCollapse","collapse","handleClose","close","handleForceClose","forceClose","handlePresent","_data","requestAnimationFrame","handleDismiss","animationConfigs","params","handleMinimize","handleRestore","handlePortalOnUnmount","handlePortalRender","render","handleBottomSheetOnChange","_index","handleBottomSheetOnClose","dismiss","present","minimize","restore","displayName"],"mappings":";;;;;;;AAAA;;AASA;;AACA;;AACA;;AACA;;AACA;;AAMA;;;;;;;;;;AAIA,MAAMA,aAGL,GAAG;AACFC,EAAAA,KAAK,EAAE,KADL;AAEFC,EAAAA,IAAI,EAAEC;AAFJ,CAHJ;AAQA,MAAMC,yBAAyB,gBAAG,uBAGhC,SAASC,gBAAT,CAA0BC,KAA1B,EAAiCC,GAAjC,EAAsC;AACtC,QAAM;AACJ;AACAC,IAAAA,IAFI;AAGJC,IAAAA,aAAa,GAAGC,iCAHZ;AAIJC,IAAAA,oBAAoB,GAAGC,0CAJnB;AAKJC,IAAAA,SAAS,EAAEC,kBALP;AAOJ;AACAC,IAAAA,KAAK,GAAG,CARJ;AASJC,IAAAA,UATI;AAUJC,IAAAA,oBAAoB,GAAG,IAVnB;AAWJC,IAAAA,cAAc,GAAG,IAXb;AAYJC,IAAAA,kBAAkB,EAAEC,kBAAkB,GAAGC,eAAMC,QAZ3C;AAcJ;AACAC,IAAAA,QAAQ,EAAEC,iBAfN;AAiBJ;AACAC,IAAAA,QAAQ,EAAEC,OAlBN;AAmBJ,OAAGC;AAnBC,MAoBFrB,KApBJ,CADsC,CAuBtC;;AACA,QAAM,CAAC;AAAEL,IAAAA,KAAF;AAASC,IAAAA;AAAT,GAAD,EAAkB0B,QAAlB,IAA8B,qBAAS5B,aAAT,CAApC,CAxBsC,CAyBtC;AAEA;;AACA,QAAM;AACJ6B,IAAAA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nB;AASE,IAAA,eAAe,EAAEC,eATnB;AAUE,IAAA,QAAQ,EAAE2C,yBAVZ;AAWE,IAAA,OAAO,EAAEE,wBAXX;AAYE,IAAA,QAAQ,EACN,OAAOjD,OAAP,KAAmB,UAAnB,gBAAgC,6BAAC,OAAD;AAAS,MAAA,IAAI,EAAExB;AAAf,MAAhC,GAA0DwB,OAb9D;AAeE,IAAA,MAAM,EAAE;AAfV,KADF,CAPF,CADU,GA4BR,IA5BJ;AA6BD,CAhXiC,CAAlC;AAkXA,MAAMrB,gBAAgB,gBAAG,iBAAKD,yBAAL,CAAzB;AACAC,gBAAgB,CAAC2E,WAAjB,GAA+B,kBAA/B;eAEe3E,gB","sourcesContent":["import React, {\n forwardRef,\n memo,\n useCallback,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { Portal, usePortal } from '@gorhom/portal';\nimport BottomSheet from '../bottomSheet';\nimport { useBottomSheetModalInternal } from '../../hooks';\nimport { print } from '../../utilities';\nimport {\n DEFAULT_STACK_BEHAVIOR,\n DEFAULT_ENABLE_DISMISS_ON_CLOSE,\n} from './constants';\nimport type { BottomSheetModalMethods, BottomSheetMethods } from '../../types';\nimport type { BottomSheetModalProps } from './types';\nimport { id } from '../../utilities/id';\n\ntype BottomSheetModal = BottomSheetModalMethods;\n\nconst INITIAL_STATE: {\n mount: boolean;\n data: any;\n} = {\n mount: false,\n data: undefined,\n};\n\nconst BottomSheetModalComponent = forwardRef<\n BottomSheetModal,\n BottomSheetModalProps\n>(function BottomSheetModal(props, ref) {\n const {\n // modal props\n name,\n stackBehavior = DEFAULT_STACK_BEHAVIOR,\n enableDismissOnClose = DEFAULT_ENABLE_DISMISS_ON_CLOSE,\n onDismiss: _providedOnDismiss,\n\n // bottom sheet props\n index = 0,\n snapPoints,\n enablePanDownToClose = true,\n animateOnMount = true,\n containerComponent: ContainerComponent = React.Fragment,\n\n // callbacks\n onChange: _providedOnChange,\n\n // components\n children: Content,\n ...bottomSheetProps\n } = props;\n\n //#region state\n const [{ mount, data }, setState] = useState(INITIAL_STATE);\n //#endregion\n\n //#region hooks\n const {\n containerHeight,\n containerOffset,\n mountSheet,\n unmountSheet,\n willUnmountSheet,\n } = useBottomSheetModalInternal();\n const { removePortal: unmountPortal } = usePortal();\n //#endregion\n\n //#region refs\n const bottomSheetRef = useRef(null);\n const currentIndexRef = useRef(!animateOnMount ? index : -1);\n const restoreIndexRef = useRef(-1);\n const minimized = useRef(false);\n const forcedDismissed = useRef(false);\n const mounted = useRef(false);\n mounted.current = mount;\n //#endregion\n\n //#region variables\n const key = useMemo(() => name || `bottom-sheet-modal-${id()}`, [name]);\n //#endregion\n\n //#region private methods\n const resetVariables = useCallback(function resetVariables() {\n print({\n component: BottomSheetModal.name,\n method: resetVariables.name,\n });\n currentIndexRef.current = -1;\n restoreIndexRef.current = -1;\n minimized.current = false;\n mounted.current = false;\n forcedDismissed.current = false;\n }, []);\n const unmount = useCallback(\n function unmount() {\n print({\n component: BottomSheetModal.name,\n method: unmount.name,\n });\n const _mounted = mounted.current;\n\n // reset variables\n resetVariables();\n\n // unmount sheet and portal\n unmountSheet(key);\n unmountPortal(key);\n\n // unmount the node, if sheet is still mounted\n if (_mounted) {\n setState(INITIAL_STATE);\n }\n\n // fire `onDismiss` callback\n if (_providedOnDismiss) {\n _providedOnDismiss();\n }\n },\n [key, resetVariables, unmountSheet, unmountPortal, _providedOnDismiss]\n );\n //#endregion\n\n //#region bottom sheet methods\n const handleSnapToIndex = useCallback(\n (...args) => {\n if (minimized.current) {\n return;\n }\n bottomSheetRef.current?.snapToIndex(...args);\n },\n []\n );\n const handleSnapToPosition = useCallback<\n BottomSheetMethods['snapToPosition']\n >((...args) => {\n if (minimized.current) {\n return;\n }\n bottomSheetRef.current?.snapToPosition(...args);\n }, []);\n const handleExpand = useCallback((...args) => {\n if (minimized.current) {\n return;\n }\n bottomSheetRef.current?.expand(...args);\n }, []);\n const handleCollapse = useCallback(\n (...args) => {\n if (minimized.current) {\n return;\n }\n bottomSheetRef.current?.collapse(...args);\n },\n []\n );\n const handleClose = useCallback((...args) => {\n if (minimized.current) {\n return;\n }\n bottomSheetRef.current?.close(...args);\n }, []);\n const handleForceClose = useCallback(\n (...args) => {\n if (minimized.current) {\n return;\n }\n bottomSheetRef.current?.forceClose(...args);\n },\n []\n );\n //#endregion\n\n //#region bottom sheet modal methods\n const handlePresent = useCallback(\n function handlePresent(_data?: any) {\n requestAnimationFrame(() => {\n setState({\n mount: true,\n data: _data,\n });\n mountSheet(key, ref, stackBehavior);\n\n print({\n component: BottomSheetModal.name,\n method: handlePresent.name,\n });\n });\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [key, stackBehavior, mountSheet]\n );\n const handleDismiss = useCallback(\n function handleDismiss(animationConfigs) {\n print({\n component: BottomSheetModal.name,\n method: handleDismiss.name,\n params: {\n currentIndexRef: currentIndexRef.current,\n minimized: minimized.current,\n },\n });\n /**\n * if modal is already been dismiss, we exit the method.\n */\n if (currentIndexRef.current === -1 && minimized.current === false) {\n return;\n }\n\n if (\n minimized.current ||\n (currentIndexRef.current === -1 && enablePanDownToClose)\n ) {\n unmount();\n return;\n }\n willUnmountSheet(key);\n forcedDismissed.current = true;\n bottomSheetRef.current?.forceClose(animationConfigs);\n },\n [willUnmountSheet, unmount, key, enablePanDownToClose]\n );\n const handleMinimize = useCallback(\n function handleMinimize() {\n print({\n component: BottomSheetModal.name,\n method: handleMinimize.name,\n params: {\n minimized: minimized.current,\n },\n });\n if (minimized.current) {\n return;\n }\n minimized.current = true;\n\n /**\n * if modal got minimized before it finish its mounting\n * animation, we set the `restoreIndexRef` to the\n * provided index.\n */\n if (currentIndexRef.current === -1) {\n restoreIndexRef.current = index;\n } else {\n restoreIndexRef.current = currentIndexRef.current;\n }\n bottomSheetRef.current?.close();\n },\n [index]\n );\n const handleRestore = useCallback(function handleRestore() {\n print({\n component: BottomSheetModal.name,\n method: handleRestore.name,\n params: {\n minimized: minimized.current,\n forcedDismissed: forcedDismissed.current,\n },\n });\n if (!minimized.current || forcedDismissed.current) {\n return;\n }\n minimized.current = false;\n bottomSheetRef.current?.snapToIndex(restoreIndexRef.current);\n }, []);\n //#endregion\n\n //#region callbacks\n const handlePortalOnUnmount = useCallback(\n function handlePortalOnUnmount() {\n print({\n component: BottomSheetModal.name,\n method: handlePortalOnUnmount.name,\n params: {\n minimized: minimized.current,\n forcedDismissed: forcedDismissed.current,\n },\n });\n /**\n * if modal is already been dismiss, we exit the method.\n */\n if (currentIndexRef.current === -1 && minimized.current === false) {\n return;\n }\n\n mounted.current = false;\n forcedDismissed.current = true;\n\n if (minimized.current) {\n unmount();\n return;\n }\n willUnmountSheet(key);\n bottomSheetRef.current?.close();\n },\n [key, unmount, willUnmountSheet]\n );\n const handlePortalRender = useCallback(function handlePortalRender(\n render: () => void\n ) {\n if (mounted.current) {\n render();\n }\n },\n []);\n const handleBottomSheetOnChange = useCallback(\n function handleBottomSheetOnChange(_index: number) {\n print({\n component: BottomSheetModal.name,\n method: handleBottomSheetOnChange.name,\n params: {\n minimized: minimized.current,\n forcedDismissed: forcedDismissed.current,\n },\n });\n currentIndexRef.current = _index;\n\n if (_providedOnChange) {\n _providedOnChange(_index);\n }\n },\n [_providedOnChange]\n );\n const handleBottomSheetOnClose = useCallback(\n function handleBottomSheetOnClose() {\n print({\n component: BottomSheetModal.name,\n method: handleBottomSheetOnClose.name,\n params: {\n minimized: minimized.current,\n forcedDismissed: forcedDismissed.current,\n },\n });\n\n if (minimized.current) {\n return;\n }\n\n if (enableDismissOnClose) {\n unmount();\n }\n },\n [enableDismissOnClose, unmount]\n );\n //#endregion\n\n //#region expose methods\n useImperativeHandle(ref, () => ({\n // sheet\n snapToIndex: handleSnapToIndex,\n snapToPosition: handleSnapToPosition,\n expand: handleExpand,\n collapse: handleCollapse,\n close: handleClose,\n forceClose: handleForceClose,\n // modal methods\n dismiss: handleDismiss,\n present: handlePresent,\n // internal\n minimize: handleMinimize,\n restore: handleRestore,\n }));\n //#endregion\n\n // render\n // console.log('BottomSheetModal', index, mount, data);\n return mount ? (\n \n \n : Content\n }\n $modal={true}\n />\n \n \n ) : null;\n});\n\nconst BottomSheetModal = memo(BottomSheetModalComponent);\nBottomSheetModal.displayName = 'BottomSheetModal';\n\nexport default BottomSheetModal;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetModal/constants.js b/lib/commonjs/components/bottomSheetModal/constants.js new file mode 100644 index 000000000..a9cce70e0 --- /dev/null +++ b/lib/commonjs/components/bottomSheetModal/constants.js @@ -0,0 +1,11 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.DEFAULT_ENABLE_DISMISS_ON_CLOSE = exports.DEFAULT_STACK_BEHAVIOR = void 0; +const DEFAULT_STACK_BEHAVIOR = 'replace'; +exports.DEFAULT_STACK_BEHAVIOR = DEFAULT_STACK_BEHAVIOR; +const DEFAULT_ENABLE_DISMISS_ON_CLOSE = true; +exports.DEFAULT_ENABLE_DISMISS_ON_CLOSE = DEFAULT_ENABLE_DISMISS_ON_CLOSE; +//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetModal/constants.js.map b/lib/commonjs/components/bottomSheetModal/constants.js.map new file mode 100644 index 000000000..ad599905a --- /dev/null +++ b/lib/commonjs/components/bottomSheetModal/constants.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["constants.ts"],"names":["DEFAULT_STACK_BEHAVIOR","DEFAULT_ENABLE_DISMISS_ON_CLOSE"],"mappings":";;;;;;AAAA,MAAMA,sBAAsB,GAAG,SAA/B;;AACA,MAAMC,+BAA+B,GAAG,IAAxC","sourcesContent":["const DEFAULT_STACK_BEHAVIOR = 'replace';\nconst DEFAULT_ENABLE_DISMISS_ON_CLOSE = true;\n\nexport { DEFAULT_STACK_BEHAVIOR, DEFAULT_ENABLE_DISMISS_ON_CLOSE };\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetModal/index.js b/lib/commonjs/components/bottomSheetModal/index.js new file mode 100644 index 000000000..f3b30a2a7 --- /dev/null +++ b/lib/commonjs/components/bottomSheetModal/index.js @@ -0,0 +1,16 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "default", { + enumerable: true, + get: function () { + return _BottomSheetModal.default; + } +}); + +var _BottomSheetModal = _interopRequireDefault(require("./BottomSheetModal")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetModal/index.js.map b/lib/commonjs/components/bottomSheetModal/index.js.map new file mode 100644 index 000000000..a87df46b2 --- /dev/null +++ b/lib/commonjs/components/bottomSheetModal/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { default } from './BottomSheetModal';\nexport type {\n BottomSheetModalProps,\n BottomSheetModalPrivateMethods,\n BottomSheetModalStackBehavior,\n} from './types';\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetModalProvider/BottomSheetModalProvider.js b/lib/commonjs/components/bottomSheetModalProvider/BottomSheetModalProvider.js new file mode 100644 index 000000000..3aad04a50 --- /dev/null +++ b/lib/commonjs/components/bottomSheetModalProvider/BottomSheetModalProvider.js @@ -0,0 +1,198 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireWildcard(require("react")); + +var _reactNativeReanimated = require("react-native-reanimated"); + +var _portal = require("@gorhom/portal"); + +var _contexts = require("../../contexts"); + +var _bottomSheetContainer = _interopRequireDefault(require("../bottomSheetContainer")); + +var _constants = require("../../constants"); + +var _constants2 = require("../bottomSheet/constants"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +const BottomSheetModalProviderWrapper = ({ + children +}) => { + //#region layout variables + const animatedContainerHeight = (0, _reactNativeReanimated.useSharedValue)(_constants2.INITIAL_CONTAINER_HEIGHT); + const animatedContainerOffset = (0, _reactNativeReanimated.useSharedValue)(_constants2.INITIAL_CONTAINER_OFFSET); //#endregion + //#region variables + + const sheetsQueueRef = (0, _react.useRef)([]); //#endregion + //#region private methods + + const handleMountSheet = (0, _react.useCallback)((key, ref, stackBehavior) => { + const _sheetsQueue = sheetsQueueRef.current.slice(); + + const sheetIndex = _sheetsQueue.findIndex(item => item.key === key); + + const sheetOnTop = sheetIndex === _sheetsQueue.length - 1; + /** + * Exit the method, if sheet is already presented + * and at the top. + */ + + if (sheetIndex !== -1 && sheetOnTop) { + return; + } + /** + * Minimize the current sheet if: + * - it exists. + * - it is not unmounting. + * - stack behavior is 'replace'. + */ + + + const currentMountedSheet = _sheetsQueue[_sheetsQueue.length - 1]; + + if (currentMountedSheet && !currentMountedSheet.willUnmount && stackBehavior === _constants.MODAL_STACK_BEHAVIOR.replace) { + var _currentMountedSheet$, _currentMountedSheet$2; + + (_currentMountedSheet$ = currentMountedSheet.ref) === null || _currentMountedSheet$ === void 0 ? void 0 : (_currentMountedSheet$2 = _currentMountedSheet$.current) === null || _currentMountedSheet$2 === void 0 ? void 0 : _currentMountedSheet$2.minimize(); + } + /** + * Restore and remove incoming sheet from the queue, + * if it was registered. + */ + + + if (sheetIndex !== -1) { + var _ref$current; + + _sheetsQueue.splice(sheetIndex, 1); + + ref === null || ref === void 0 ? void 0 : (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.restore(); + } + + _sheetsQueue.push({ + key, + ref, + willUnmount: false + }); + + sheetsQueueRef.current = _sheetsQueue; + }, []); + const handleUnmountSheet = (0, _react.useCallback)(key => { + const _sheetsQueue = sheetsQueueRef.current.slice(); + + const sheetIndex = _sheetsQueue.findIndex(item => item.key === key); + + const sheetOnTop = sheetIndex === _sheetsQueue.length - 1; + /** + * Here we remove the unmounted sheet and update + * the sheets queue. + */ + + _sheetsQueue.splice(sheetIndex, 1); + + sheetsQueueRef.current = _sheetsQueue; + /** + * Here we try to restore previous sheet position if unmounted + * sheet was on top. This is needed when user dismiss + * the modal by panning down. + */ + + const hasMinimizedSheet = sheetsQueueRef.current.length > 0; + const minimizedSheet = sheetsQueueRef.current[sheetsQueueRef.current.length - 1]; + + if (sheetOnTop && hasMinimizedSheet && minimizedSheet && !minimizedSheet.willUnmount) { + var _sheetsQueueRef$curre, _sheetsQueueRef$curre2; + + (_sheetsQueueRef$curre = sheetsQueueRef.current[sheetsQueueRef.current.length - 1].ref) === null || _sheetsQueueRef$curre === void 0 ? void 0 : (_sheetsQueueRef$curre2 = _sheetsQueueRef$curre.current) === null || _sheetsQueueRef$curre2 === void 0 ? void 0 : _sheetsQueueRef$curre2.restore(); + } + }, []); + const handleWillUnmountSheet = (0, _react.useCallback)(key => { + const _sheetsQueue = sheetsQueueRef.current.slice(); + + const sheetIndex = _sheetsQueue.findIndex(item => item.key === key); + + const sheetOnTop = sheetIndex === _sheetsQueue.length - 1; + /** + * Here we mark the sheet that will unmount, + * so it won't be restored. + */ + + if (sheetIndex !== -1) { + _sheetsQueue[sheetIndex].willUnmount = true; + } + /** + * Here we try to restore previous sheet position, + * This is needed when user dismiss the modal by fire the dismiss action. + */ + + + const hasMinimizedSheet = _sheetsQueue.length > 1; + + if (sheetOnTop && hasMinimizedSheet) { + var _sheetsQueue$ref, _sheetsQueue$ref$curr; + + (_sheetsQueue$ref = _sheetsQueue[_sheetsQueue.length - 2].ref) === null || _sheetsQueue$ref === void 0 ? void 0 : (_sheetsQueue$ref$curr = _sheetsQueue$ref.current) === null || _sheetsQueue$ref$curr === void 0 ? void 0 : _sheetsQueue$ref$curr.restore(); + } + + sheetsQueueRef.current = _sheetsQueue; + }, []); //#endregion + //#region public methods + + const handleDismiss = (0, _react.useCallback)(key => { + const sheetToBeDismissed = key ? sheetsQueueRef.current.find(item => item.key === key) : sheetsQueueRef.current[sheetsQueueRef.current.length - 1]; + + if (sheetToBeDismissed) { + var _sheetToBeDismissed$r, _sheetToBeDismissed$r2; + + (_sheetToBeDismissed$r = sheetToBeDismissed.ref) === null || _sheetToBeDismissed$r === void 0 ? void 0 : (_sheetToBeDismissed$r2 = _sheetToBeDismissed$r.current) === null || _sheetToBeDismissed$r2 === void 0 ? void 0 : _sheetToBeDismissed$r2.dismiss(); + return true; + } + + return false; + }, []); + const handleDismissAll = (0, _react.useCallback)(() => { + sheetsQueueRef.current.map(item => { + var _item$ref, _item$ref$current; + + (_item$ref = item.ref) === null || _item$ref === void 0 ? void 0 : (_item$ref$current = _item$ref.current) === null || _item$ref$current === void 0 ? void 0 : _item$ref$current.dismiss(); + }); + }, []); //#endregion + //#region context variables + + const externalContextVariables = (0, _react.useMemo)(() => ({ + dismiss: handleDismiss, + dismissAll: handleDismissAll + }), [handleDismiss, handleDismissAll]); + const internalContextVariables = (0, _react.useMemo)(() => ({ + containerHeight: animatedContainerHeight, + containerOffset: animatedContainerOffset, + mountSheet: handleMountSheet, + unmountSheet: handleUnmountSheet, + willUnmountSheet: handleWillUnmountSheet + }), [animatedContainerHeight, animatedContainerOffset, handleMountSheet, handleUnmountSheet, handleWillUnmountSheet]); //#endregion + //#region renders + + return /*#__PURE__*/_react.default.createElement(_contexts.BottomSheetModalProvider, { + value: externalContextVariables + }, /*#__PURE__*/_react.default.createElement(_contexts.BottomSheetModalInternalProvider, { + value: internalContextVariables + }, /*#__PURE__*/_react.default.createElement(_bottomSheetContainer.default, { + containerOffset: animatedContainerOffset, + containerHeight: animatedContainerHeight, + children: null + }), /*#__PURE__*/_react.default.createElement(_portal.PortalProvider, null, children))); //#endregion +}; + +var _default = BottomSheetModalProviderWrapper; +exports.default = _default; +//# sourceMappingURL=BottomSheetModalProvider.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetModalProvider/BottomSheetModalProvider.js.map b/lib/commonjs/components/bottomSheetModalProvider/BottomSheetModalProvider.js.map new file mode 100644 index 000000000..0b3443dc7 --- /dev/null +++ b/lib/commonjs/components/bottomSheetModalProvider/BottomSheetModalProvider.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheetModalProvider.tsx"],"names":["BottomSheetModalProviderWrapper","children","animatedContainerHeight","INITIAL_CONTAINER_HEIGHT","animatedContainerOffset","INITIAL_CONTAINER_OFFSET","sheetsQueueRef","handleMountSheet","key","ref","stackBehavior","_sheetsQueue","current","slice","sheetIndex","findIndex","item","sheetOnTop","length","currentMountedSheet","willUnmount","MODAL_STACK_BEHAVIOR","replace","minimize","splice","restore","push","handleUnmountSheet","hasMinimizedSheet","minimizedSheet","handleWillUnmountSheet","handleDismiss","sheetToBeDismissed","find","dismiss","handleDismissAll","map","externalContextVariables","dismissAll","internalContextVariables","containerHeight","containerOffset","mountSheet","unmountSheet","willUnmountSheet"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AAIA;;AACA;;AACA;;;;;;;;AAUA,MAAMA,+BAA+B,GAAG,CAAC;AACvCC,EAAAA;AADuC,CAAD,KAEH;AACnC;AACA,QAAMC,uBAAuB,GAAG,2CAAeC,oCAAf,CAAhC;AACA,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AAMG,wBAAwB,GAAG,oBAC/B,OAAO;AACLH,IAAAA,OAAO,EAAEH,aADJ;AAELO,IAAAA,UAAU,EAAEH;AAFP,GAAP,CAD+B,EAK/B,CAACJ,aAAD,EAAgBI,gBAAhB,CAL+B,CAAjC;AAOA,QAAMI,wBAAwB,GAAG,oBAC/B,OAAO;AACLC,IAAAA,eAAe,EAAEtC,uBADZ;AAELuC,IAAAA,eAAe,EAAErC,uBAFZ;AAGLsC,IAAAA,UAAU,EAAEnC,gBAHP;AAILoC,IAAAA,YAAY,EAAEhB,kBAJT;AAKLiB,IAAAA,gBAAgB,EAAEd;AALb,GAAP,CAD+B,EAQ/B,CACE5B,uBADF,EAEEE,uBAFF,EAGEG,gBAHF,EAIEoB,kBAJF,EAKEG,sBALF,CAR+B,CAAjC,CA7ImC,CA6JnC;AAEA;;AACA,sBACE,6BAAC,kCAAD;AAA0B,IAAA,KAAK,EAAEO;AAAjC,kBACE,6BAAC,0CAAD;AAAkC,IAAA,KAAK,EAAEE;AAAzC,kBACE,6BAAC,6BAAD;AACE,IAAA,eAAe,EAAEnC,uBADnB;AAEE,IAAA,eAAe,EAAEF,uBAFnB;AAGE,IAAA,QAAQ,EAAE;AAHZ,IADF,eAME,6BAAC,sBAAD,QAAiBD,QAAjB,CANF,CADF,CADF,CAhKmC,CA4KnC;AACD,CA/KD;;eAiLeD,+B","sourcesContent":["import React, { useCallback, useMemo, useRef } from 'react';\nimport { useSharedValue } from 'react-native-reanimated';\nimport { PortalProvider } from '@gorhom/portal';\nimport {\n BottomSheetModalProvider,\n BottomSheetModalInternalProvider,\n} from '../../contexts';\nimport BottomSheetContainer from '../bottomSheetContainer';\nimport { MODAL_STACK_BEHAVIOR } from '../../constants';\nimport {\n INITIAL_CONTAINER_HEIGHT,\n INITIAL_CONTAINER_OFFSET,\n} from '../bottomSheet/constants';\nimport type { BottomSheetModalStackBehavior } from '../bottomSheetModal';\nimport type {\n BottomSheetModalProviderProps,\n BottomSheetModalRef,\n} from './types';\n\nconst BottomSheetModalProviderWrapper = ({\n children,\n}: BottomSheetModalProviderProps) => {\n //#region layout variables\n const animatedContainerHeight = useSharedValue(INITIAL_CONTAINER_HEIGHT);\n const animatedContainerOffset = useSharedValue(INITIAL_CONTAINER_OFFSET);\n //#endregion\n\n //#region variables\n const sheetsQueueRef = useRef([]);\n //#endregion\n\n //#region private methods\n const handleMountSheet = useCallback(\n (key: string, ref: any, stackBehavior: BottomSheetModalStackBehavior) => {\n const _sheetsQueue = sheetsQueueRef.current.slice();\n const sheetIndex = _sheetsQueue.findIndex(item => item.key === key);\n const sheetOnTop = sheetIndex === _sheetsQueue.length - 1;\n\n /**\n * Exit the method, if sheet is already presented\n * and at the top.\n */\n if (sheetIndex !== -1 && sheetOnTop) {\n return;\n }\n\n /**\n * Minimize the current sheet if:\n * - it exists.\n * - it is not unmounting.\n * - stack behavior is 'replace'.\n */\n const currentMountedSheet = _sheetsQueue[_sheetsQueue.length - 1];\n if (\n currentMountedSheet &&\n !currentMountedSheet.willUnmount &&\n stackBehavior === MODAL_STACK_BEHAVIOR.replace\n ) {\n currentMountedSheet.ref?.current?.minimize();\n }\n\n /**\n * Restore and remove incoming sheet from the queue,\n * if it was registered.\n */\n if (sheetIndex !== -1) {\n _sheetsQueue.splice(sheetIndex, 1);\n ref?.current?.restore();\n }\n\n _sheetsQueue.push({\n key,\n ref,\n willUnmount: false,\n });\n sheetsQueueRef.current = _sheetsQueue;\n },\n []\n );\n const handleUnmountSheet = useCallback((key: string) => {\n const _sheetsQueue = sheetsQueueRef.current.slice();\n const sheetIndex = _sheetsQueue.findIndex(item => item.key === key);\n const sheetOnTop = sheetIndex === _sheetsQueue.length - 1;\n\n /**\n * Here we remove the unmounted sheet and update\n * the sheets queue.\n */\n _sheetsQueue.splice(sheetIndex, 1);\n sheetsQueueRef.current = _sheetsQueue;\n\n /**\n * Here we try to restore previous sheet position if unmounted\n * sheet was on top. This is needed when user dismiss\n * the modal by panning down.\n */\n const hasMinimizedSheet = sheetsQueueRef.current.length > 0;\n const minimizedSheet =\n sheetsQueueRef.current[sheetsQueueRef.current.length - 1];\n if (\n sheetOnTop &&\n hasMinimizedSheet &&\n minimizedSheet &&\n !minimizedSheet.willUnmount\n ) {\n sheetsQueueRef.current[\n sheetsQueueRef.current.length - 1\n ].ref?.current?.restore();\n }\n }, []);\n const handleWillUnmountSheet = useCallback((key: string) => {\n const _sheetsQueue = sheetsQueueRef.current.slice();\n const sheetIndex = _sheetsQueue.findIndex(item => item.key === key);\n const sheetOnTop = sheetIndex === _sheetsQueue.length - 1;\n\n /**\n * Here we mark the sheet that will unmount,\n * so it won't be restored.\n */\n if (sheetIndex !== -1) {\n _sheetsQueue[sheetIndex].willUnmount = true;\n }\n\n /**\n * Here we try to restore previous sheet position,\n * This is needed when user dismiss the modal by fire the dismiss action.\n */\n const hasMinimizedSheet = _sheetsQueue.length > 1;\n if (sheetOnTop && hasMinimizedSheet) {\n _sheetsQueue[_sheetsQueue.length - 2].ref?.current?.restore();\n }\n\n sheetsQueueRef.current = _sheetsQueue;\n }, []);\n //#endregion\n\n //#region public methods\n const handleDismiss = useCallback((key?: string) => {\n const sheetToBeDismissed = key\n ? sheetsQueueRef.current.find(item => item.key === key)\n : sheetsQueueRef.current[sheetsQueueRef.current.length - 1];\n if (sheetToBeDismissed) {\n sheetToBeDismissed.ref?.current?.dismiss();\n return true;\n }\n return false;\n }, []);\n const handleDismissAll = useCallback(() => {\n sheetsQueueRef.current.map(item => {\n item.ref?.current?.dismiss();\n });\n }, []);\n //#endregion\n\n //#region context variables\n const externalContextVariables = useMemo(\n () => ({\n dismiss: handleDismiss,\n dismissAll: handleDismissAll,\n }),\n [handleDismiss, handleDismissAll]\n );\n const internalContextVariables = useMemo(\n () => ({\n containerHeight: animatedContainerHeight,\n containerOffset: animatedContainerOffset,\n mountSheet: handleMountSheet,\n unmountSheet: handleUnmountSheet,\n willUnmountSheet: handleWillUnmountSheet,\n }),\n [\n animatedContainerHeight,\n animatedContainerOffset,\n handleMountSheet,\n handleUnmountSheet,\n handleWillUnmountSheet,\n ]\n );\n //#endregion\n\n //#region renders\n return (\n \n \n \n {children}\n \n \n );\n //#endregion\n};\n\nexport default BottomSheetModalProviderWrapper;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetModalProvider/index.js b/lib/commonjs/components/bottomSheetModalProvider/index.js new file mode 100644 index 000000000..5ab630a1e --- /dev/null +++ b/lib/commonjs/components/bottomSheetModalProvider/index.js @@ -0,0 +1,16 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "default", { + enumerable: true, + get: function () { + return _BottomSheetModalProvider.default; + } +}); + +var _BottomSheetModalProvider = _interopRequireDefault(require("./BottomSheetModalProvider")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetModalProvider/index.js.map b/lib/commonjs/components/bottomSheetModalProvider/index.js.map new file mode 100644 index 000000000..fb1c86cea --- /dev/null +++ b/lib/commonjs/components/bottomSheetModalProvider/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { default } from './BottomSheetModalProvider';\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.js b/lib/commonjs/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.js new file mode 100644 index 000000000..519900810 --- /dev/null +++ b/lib/commonjs/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.js @@ -0,0 +1,53 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireWildcard(require("react")); + +var _reactNative = require("react-native"); + +var _reactNativeGestureHandler = require("react-native-gesture-handler"); + +var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated")); + +var _constants = require("../../constants"); + +var _hooks = require("../../hooks"); + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } + +const AnimatedRefreshControl = _reactNativeReanimated.default.createAnimatedComponent(_reactNative.RefreshControl); + +const BottomSheetRefreshControlComponent = /*#__PURE__*/(0, _react.forwardRef)(({ + onRefresh, + ...rest +}, ref) => { + // hooks + const { + animatedScrollableState + } = (0, _hooks.useBottomSheetInternal)(); // variables + + const animatedProps = (0, _reactNativeReanimated.useAnimatedProps)(() => ({ + enabled: animatedScrollableState.value === _constants.SCROLLABLE_STATE.UNLOCKED + })); // render + + return /*#__PURE__*/_react.default.createElement(_reactNativeGestureHandler.NativeViewGestureHandler, { + ref: ref, + shouldCancelWhenOutside: false + }, /*#__PURE__*/_react.default.createElement(AnimatedRefreshControl, _extends({}, rest, { + onRefresh: onRefresh, + animatedProps: animatedProps + }))); +}); +const BottomSheetRefreshControl = /*#__PURE__*/(0, _react.memo)(BottomSheetRefreshControlComponent); +BottomSheetRefreshControl.displayName = 'BottomSheetRefreshControl'; +var _default = BottomSheetRefreshControl; +exports.default = _default; +//# sourceMappingURL=BottomSheetRefreshControl.android.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.js.map b/lib/commonjs/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.js.map new file mode 100644 index 000000000..f4388a632 --- /dev/null +++ b/lib/commonjs/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheetRefreshControl.android.tsx"],"names":["AnimatedRefreshControl","Animated","createAnimatedComponent","RefreshControl","BottomSheetRefreshControlComponent","onRefresh","rest","ref","animatedScrollableState","animatedProps","enabled","value","SCROLLABLE_STATE","UNLOCKED","BottomSheetRefreshControl","displayName"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAEA,MAAMA,sBAAsB,GAAGC,+BAASC,uBAAT,CAAiCC,2BAAjC,CAA/B;;AAEA,MAAMC,kCAAkC,gBAAG,uBAGzC,CAAC;AAAEC,EAAAA,SAAF;AAAa,KAAGC;AAAhB,CAAD,EAAyBC,GAAzB,KAAiC;AACjC;AACA,QAAM;AAAEC,IAAAA;AAAF,MAA8B,oCAApC,CAFiC,CAIjC;;AACA,QAAMC,aAAa,GAAG,6CAAiB,OAAO;AAC5CC,IAAAA,OAAO,EAAEF,uBAAuB,CAACG,KAAxB,KAAkCC,4BAAiBC;AADhB,GAAP,CAAjB,CAAtB,CALiC,CASjC;;AACA,sBACE,6BAAC,mDAAD;AAA0B,IAAA,GAAG,EAAEN,GAA/B;AAAoC,IAAA,uBAAuB,EAAE;AAA7D,kBACE,6BAAC,sBAAD,eACMD,IADN;AAEE,IAAA,SAAS,EAAED,SAFb;AAGE,IAAA,aAAa,EAAEI;AAHjB,KADF,CADF;AASD,CAtB0C,CAA3C;AAwBA,MAAMK,yBAAyB,gBAAG,iBAAKV,kCAAL,CAAlC;AACAU,yBAAyB,CAACC,WAA1B,GAAwC,2BAAxC;eAEeD,yB","sourcesContent":["import React, { forwardRef, memo } from 'react';\nimport { RefreshControl, RefreshControlProps } from 'react-native';\nimport { NativeViewGestureHandler } from 'react-native-gesture-handler';\nimport Animated, { useAnimatedProps } from 'react-native-reanimated';\nimport { SCROLLABLE_STATE } from '../../constants';\nimport { useBottomSheetInternal } from '../../hooks';\n\nconst AnimatedRefreshControl = Animated.createAnimatedComponent(RefreshControl);\n\nconst BottomSheetRefreshControlComponent = forwardRef<\n NativeViewGestureHandler,\n RefreshControlProps\n>(({ onRefresh, ...rest }, ref) => {\n // hooks\n const { animatedScrollableState } = useBottomSheetInternal();\n\n // variables\n const animatedProps = useAnimatedProps(() => ({\n enabled: animatedScrollableState.value === SCROLLABLE_STATE.UNLOCKED,\n }));\n\n // render\n return (\n \n \n \n );\n});\n\nconst BottomSheetRefreshControl = memo(BottomSheetRefreshControlComponent);\nBottomSheetRefreshControl.displayName = 'BottomSheetRefreshControl';\n\nexport default BottomSheetRefreshControl;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetRefreshControl/BottomSheetRefreshControl.js b/lib/commonjs/components/bottomSheetRefreshControl/BottomSheetRefreshControl.js new file mode 100644 index 000000000..d3f3b943c --- /dev/null +++ b/lib/commonjs/components/bottomSheetRefreshControl/BottomSheetRefreshControl.js @@ -0,0 +1,11 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _default = () => null; + +exports.default = _default; +//# sourceMappingURL=BottomSheetRefreshControl.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetRefreshControl/BottomSheetRefreshControl.js.map b/lib/commonjs/components/bottomSheetRefreshControl/BottomSheetRefreshControl.js.map new file mode 100644 index 000000000..1b6481996 --- /dev/null +++ b/lib/commonjs/components/bottomSheetRefreshControl/BottomSheetRefreshControl.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheetRefreshControl.tsx"],"names":[],"mappings":";;;;;;;eAAe,MAAM,I","sourcesContent":["export default () => null;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetRefreshControl/index.js b/lib/commonjs/components/bottomSheetRefreshControl/index.js new file mode 100644 index 000000000..bed7760e9 --- /dev/null +++ b/lib/commonjs/components/bottomSheetRefreshControl/index.js @@ -0,0 +1,14 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _BottomSheetRefreshControl = _interopRequireDefault(require("./BottomSheetRefreshControl")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var _default = _BottomSheetRefreshControl.default; +exports.default = _default; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetRefreshControl/index.js.map b/lib/commonjs/components/bottomSheetRefreshControl/index.js.map new file mode 100644 index 000000000..b901195d9 --- /dev/null +++ b/lib/commonjs/components/bottomSheetRefreshControl/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":["BottomSheetRefreshControl"],"mappings":";;;;;;;AAGA;;;;eAEeA,kC","sourcesContent":["import type React from 'react';\nimport type { RefreshControlProps } from 'react-native';\nimport type { NativeViewGestureHandlerProps } from 'react-native-gesture-handler';\nimport BottomSheetRefreshControl from './BottomSheetRefreshControl';\n\nexport default BottomSheetRefreshControl as any as React.MemoExoticComponent<\n React.ForwardRefExoticComponent<\n RefreshControlProps & {\n children: React.ReactNode | React.ReactNode[];\n } & React.RefAttributes<\n React.ComponentType<\n NativeViewGestureHandlerProps & React.RefAttributes\n >\n >\n >\n>;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetScrollable/BottomSheetFlatList.js b/lib/commonjs/components/bottomSheetScrollable/BottomSheetFlatList.js new file mode 100644 index 000000000..1e04a5c59 --- /dev/null +++ b/lib/commonjs/components/bottomSheetScrollable/BottomSheetFlatList.js @@ -0,0 +1,27 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = require("react"); + +var _reactNative = require("react-native"); + +var _reactNativeReanimated = _interopRequireDefault(require("react-native-reanimated")); + +var _constants = require("../../constants"); + +var _createBottomSheetScrollableComponent = require("./createBottomSheetScrollableComponent"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const AnimatedFlatList = _reactNativeReanimated.default.createAnimatedComponent(_reactNative.FlatList); + +const BottomSheetFlatListComponent = (0, _createBottomSheetScrollableComponent.createBottomSheetScrollableComponent)(_constants.SCROLLABLE_TYPE.FLATLIST, AnimatedFlatList); +const BottomSheetFlatList = /*#__PURE__*/(0, _react.memo)(BottomSheetFlatListComponent); +BottomSheetFlatList.displayName = 'BottomSheetFlatList'; +var _default = BottomSheetFlatList; +exports.default = _default; +//# sourceMappingURL=BottomSheetFlatList.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetScrollable/BottomSheetFlatList.js.map b/lib/commonjs/components/bottomSheetScrollable/BottomSheetFlatList.js.map new file mode 100644 index 000000000..7dc60fefe --- /dev/null +++ b/lib/commonjs/components/bottomSheetScrollable/BottomSheetFlatList.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheetFlatList.tsx"],"names":["AnimatedFlatList","Animated","createAnimatedComponent","RNFlatList","BottomSheetFlatListComponent","SCROLLABLE_TYPE","FLATLIST","BottomSheetFlatList","displayName"],"mappings":";;;;;;;AAAA;;AACA;;AAIA;;AACA;;AACA;;;;AAMA,MAAMA,gBAAgB,GACpBC,+BAASC,uBAAT,CAAuDC,qBAAvD,CADF;;AAGA,MAAMC,4BAA4B,GAAG,gFAGnCC,2BAAgBC,QAHmB,EAGTN,gBAHS,CAArC;AAKA,MAAMO,mBAAmB,gBAAG,iBAAKH,4BAAL,CAA5B;AACAG,mBAAmB,CAACC,WAApB,GAAkC,qBAAlC;eAEeD,mB","sourcesContent":["import { memo } from 'react';\nimport {\n FlatList as RNFlatList,\n FlatListProps as RNFlatListProps,\n} from 'react-native';\nimport Animated from 'react-native-reanimated';\nimport { SCROLLABLE_TYPE } from '../../constants';\nimport { createBottomSheetScrollableComponent } from './createBottomSheetScrollableComponent';\nimport type {\n BottomSheetFlatListMethods,\n BottomSheetFlatListProps,\n} from './types';\n\nconst AnimatedFlatList =\n Animated.createAnimatedComponent>(RNFlatList);\n\nconst BottomSheetFlatListComponent = createBottomSheetScrollableComponent<\n BottomSheetFlatListMethods,\n BottomSheetFlatListProps\n>(SCROLLABLE_TYPE.FLATLIST, AnimatedFlatList);\n\nconst BottomSheetFlatList = memo(BottomSheetFlatListComponent);\nBottomSheetFlatList.displayName = 'BottomSheetFlatList';\n\nexport default BottomSheetFlatList as (\n props: BottomSheetFlatListProps\n) => ReturnType;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetScrollable/BottomSheetScrollView.js b/lib/commonjs/components/bottomSheetScrollable/BottomSheetScrollView.js new file mode 100644 index 000000000..bb0b0b443 --- /dev/null +++ b/lib/commonjs/components/bottomSheetScrollable/BottomSheetScrollView.js @@ -0,0 +1,27 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = require("react"); + +var _reactNative = require("react-native"); + +var _reactNativeReanimated = _interopRequireDefault(require("react-native-reanimated")); + +var _constants = require("../../constants"); + +var _createBottomSheetScrollableComponent = require("./createBottomSheetScrollableComponent"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const AnimatedScrollView = _reactNativeReanimated.default.createAnimatedComponent(_reactNative.ScrollView); + +const BottomSheetScrollViewComponent = (0, _createBottomSheetScrollableComponent.createBottomSheetScrollableComponent)(_constants.SCROLLABLE_TYPE.SCROLLVIEW, AnimatedScrollView); +const BottomSheetScrollView = /*#__PURE__*/(0, _react.memo)(BottomSheetScrollViewComponent); +BottomSheetScrollView.displayName = 'BottomSheetScrollView'; +var _default = BottomSheetScrollView; +exports.default = _default; +//# sourceMappingURL=BottomSheetScrollView.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetScrollable/BottomSheetScrollView.js.map b/lib/commonjs/components/bottomSheetScrollable/BottomSheetScrollView.js.map new file mode 100644 index 000000000..de3d25111 --- /dev/null +++ b/lib/commonjs/components/bottomSheetScrollable/BottomSheetScrollView.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheetScrollView.tsx"],"names":["AnimatedScrollView","Animated","createAnimatedComponent","RNScrollView","BottomSheetScrollViewComponent","SCROLLABLE_TYPE","SCROLLVIEW","BottomSheetScrollView","displayName"],"mappings":";;;;;;;AAAA;;AACA;;AAIA;;AACA;;AACA;;;;AAMA,MAAMA,kBAAkB,GACtBC,+BAASC,uBAAT,CAAoDC,uBAApD,CADF;;AAGA,MAAMC,8BAA8B,GAAG,gFAGrCC,2BAAgBC,UAHqB,EAGTN,kBAHS,CAAvC;AAKA,MAAMO,qBAAqB,gBAAG,iBAAKH,8BAAL,CAA9B;AACAG,qBAAqB,CAACC,WAAtB,GAAoC,uBAApC;eAEeD,qB","sourcesContent":["import { memo } from 'react';\nimport {\n ScrollView as RNScrollView,\n ScrollViewProps as RNScrollViewProps,\n} from 'react-native';\nimport Animated from 'react-native-reanimated';\nimport { SCROLLABLE_TYPE } from '../../constants';\nimport { createBottomSheetScrollableComponent } from './createBottomSheetScrollableComponent';\nimport type {\n BottomSheetScrollViewMethods,\n BottomSheetScrollViewProps,\n} from './types';\n\nconst AnimatedScrollView =\n Animated.createAnimatedComponent(RNScrollView);\n\nconst BottomSheetScrollViewComponent = createBottomSheetScrollableComponent<\n BottomSheetScrollViewMethods,\n BottomSheetScrollViewProps\n>(SCROLLABLE_TYPE.SCROLLVIEW, AnimatedScrollView);\n\nconst BottomSheetScrollView = memo(BottomSheetScrollViewComponent);\nBottomSheetScrollView.displayName = 'BottomSheetScrollView';\n\nexport default BottomSheetScrollView as (\n props: BottomSheetScrollViewProps\n) => ReturnType;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetScrollable/BottomSheetSectionList.js b/lib/commonjs/components/bottomSheetScrollable/BottomSheetSectionList.js new file mode 100644 index 000000000..723dcfd5d --- /dev/null +++ b/lib/commonjs/components/bottomSheetScrollable/BottomSheetSectionList.js @@ -0,0 +1,27 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = require("react"); + +var _reactNative = require("react-native"); + +var _reactNativeReanimated = _interopRequireDefault(require("react-native-reanimated")); + +var _constants = require("../../constants"); + +var _createBottomSheetScrollableComponent = require("./createBottomSheetScrollableComponent"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const AnimatedSectionList = _reactNativeReanimated.default.createAnimatedComponent(_reactNative.SectionList); + +const BottomSheetSectionListComponent = (0, _createBottomSheetScrollableComponent.createBottomSheetScrollableComponent)(_constants.SCROLLABLE_TYPE.SECTIONLIST, AnimatedSectionList); +const BottomSheetSectionList = /*#__PURE__*/(0, _react.memo)(BottomSheetSectionListComponent); +BottomSheetSectionList.displayName = 'BottomSheetSectionList'; +var _default = BottomSheetSectionList; +exports.default = _default; +//# sourceMappingURL=BottomSheetSectionList.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetScrollable/BottomSheetSectionList.js.map b/lib/commonjs/components/bottomSheetScrollable/BottomSheetSectionList.js.map new file mode 100644 index 000000000..03d933e80 --- /dev/null +++ b/lib/commonjs/components/bottomSheetScrollable/BottomSheetSectionList.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheetSectionList.tsx"],"names":["AnimatedSectionList","Animated","createAnimatedComponent","RNSectionList","BottomSheetSectionListComponent","SCROLLABLE_TYPE","SECTIONLIST","BottomSheetSectionList","displayName"],"mappings":";;;;;;;AAAA;;AACA;;AAKA;;AACA;;AACA;;;;AAMA,MAAMA,mBAAmB,GACvBC,+BAASC,uBAAT,CAA0DC,wBAA1D,CADF;;AAGA,MAAMC,+BAA+B,GAAG,gFAGtCC,2BAAgBC,WAHsB,EAGTN,mBAHS,CAAxC;AAKA,MAAMO,sBAAsB,gBAAG,iBAAKH,+BAAL,CAA/B;AACAG,sBAAsB,CAACC,WAAvB,GAAqC,wBAArC;eAEeD,sB","sourcesContent":["import { memo } from 'react';\nimport {\n DefaultSectionT,\n SectionList as RNSectionList,\n SectionListProps as RNSectionListProps,\n} from 'react-native';\nimport Animated from 'react-native-reanimated';\nimport { SCROLLABLE_TYPE } from '../../constants';\nimport { createBottomSheetScrollableComponent } from './createBottomSheetScrollableComponent';\nimport type {\n BottomSheetSectionListMethods,\n BottomSheetSectionListProps,\n} from './types';\n\nconst AnimatedSectionList =\n Animated.createAnimatedComponent>(RNSectionList);\n\nconst BottomSheetSectionListComponent = createBottomSheetScrollableComponent<\n BottomSheetSectionListMethods,\n BottomSheetSectionListProps\n>(SCROLLABLE_TYPE.SECTIONLIST, AnimatedSectionList);\n\nconst BottomSheetSectionList = memo(BottomSheetSectionListComponent);\nBottomSheetSectionList.displayName = 'BottomSheetSectionList';\n\nexport default BottomSheetSectionList as (\n props: BottomSheetSectionListProps\n) => ReturnType;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetScrollable/BottomSheetVirtualizedList.js b/lib/commonjs/components/bottomSheetScrollable/BottomSheetVirtualizedList.js new file mode 100644 index 000000000..e37ed725c --- /dev/null +++ b/lib/commonjs/components/bottomSheetScrollable/BottomSheetVirtualizedList.js @@ -0,0 +1,27 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = require("react"); + +var _reactNative = require("react-native"); + +var _reactNativeReanimated = _interopRequireDefault(require("react-native-reanimated")); + +var _constants = require("../../constants"); + +var _createBottomSheetScrollableComponent = require("./createBottomSheetScrollableComponent"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const AnimatedVirtualizedList = _reactNativeReanimated.default.createAnimatedComponent(_reactNative.VirtualizedList); + +const BottomSheetVirtualizedListComponent = (0, _createBottomSheetScrollableComponent.createBottomSheetScrollableComponent)(_constants.SCROLLABLE_TYPE.VIRTUALIZEDLIST, AnimatedVirtualizedList); +const BottomSheetVirtualizedList = /*#__PURE__*/(0, _react.memo)(BottomSheetVirtualizedListComponent); +BottomSheetVirtualizedList.displayName = 'BottomSheetVirtualizedList'; +var _default = BottomSheetVirtualizedList; +exports.default = _default; +//# sourceMappingURL=BottomSheetVirtualizedList.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetScrollable/BottomSheetVirtualizedList.js.map b/lib/commonjs/components/bottomSheetScrollable/BottomSheetVirtualizedList.js.map new file mode 100644 index 000000000..8fa472cb9 --- /dev/null +++ b/lib/commonjs/components/bottomSheetScrollable/BottomSheetVirtualizedList.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheetVirtualizedList.tsx"],"names":["AnimatedVirtualizedList","Animated","createAnimatedComponent","RNVirtualizedList","BottomSheetVirtualizedListComponent","SCROLLABLE_TYPE","VIRTUALIZEDLIST","BottomSheetVirtualizedList","displayName"],"mappings":";;;;;;;AAAA;;AACA;;AAIA;;AACA;;AACA;;;;AAMA,MAAMA,uBAAuB,GAC3BC,+BAASC,uBAAT,CACEC,4BADF,CADF;;AAKA,MAAMC,mCAAmC,GACvC,gFAGEC,2BAAgBC,eAHlB,EAGmCN,uBAHnC,CADF;AAMA,MAAMO,0BAA0B,gBAAG,iBAAKH,mCAAL,CAAnC;AACAG,0BAA0B,CAACC,WAA3B,GAAyC,4BAAzC;eAEeD,0B","sourcesContent":["import { memo } from 'react';\nimport {\n VirtualizedList as RNVirtualizedList,\n VirtualizedListProps as RNVirtualizedListProps,\n} from 'react-native';\nimport Animated from 'react-native-reanimated';\nimport { SCROLLABLE_TYPE } from '../../constants';\nimport { createBottomSheetScrollableComponent } from './createBottomSheetScrollableComponent';\nimport type {\n BottomSheetVirtualizedListMethods,\n BottomSheetVirtualizedListProps,\n} from './types';\n\nconst AnimatedVirtualizedList =\n Animated.createAnimatedComponent>(\n RNVirtualizedList\n );\n\nconst BottomSheetVirtualizedListComponent =\n createBottomSheetScrollableComponent<\n BottomSheetVirtualizedListMethods,\n BottomSheetVirtualizedListProps\n >(SCROLLABLE_TYPE.VIRTUALIZEDLIST, AnimatedVirtualizedList);\n\nconst BottomSheetVirtualizedList = memo(BottomSheetVirtualizedListComponent);\nBottomSheetVirtualizedList.displayName = 'BottomSheetVirtualizedList';\n\nexport default BottomSheetVirtualizedList as (\n props: BottomSheetVirtualizedListProps\n) => ReturnType;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetScrollable/createBottomSheetScrollableComponent.js b/lib/commonjs/components/bottomSheetScrollable/createBottomSheetScrollableComponent.js new file mode 100644 index 000000000..2927c7b51 --- /dev/null +++ b/lib/commonjs/components/bottomSheetScrollable/createBottomSheetScrollableComponent.js @@ -0,0 +1,163 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.createBottomSheetScrollableComponent = createBottomSheetScrollableComponent; + +var _react = _interopRequireWildcard(require("react")); + +var _reactNative = require("react-native"); + +var _reactNativeReanimated = require("react-native-reanimated"); + +var _reactNativeGestureHandler = require("react-native-gesture-handler"); + +var _bottomSheetDraggableView = _interopRequireDefault(require("../bottomSheetDraggableView")); + +var _bottomSheetRefreshControl = _interopRequireDefault(require("../bottomSheetRefreshControl")); + +var _hooks = require("../../hooks"); + +var _constants = require("../../constants"); + +var _styles = require("./styles"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } + +function createBottomSheetScrollableComponent(type, ScrollableComponent) { + return /*#__PURE__*/(0, _react.forwardRef)((props, ref) => { + // props + const { + // hooks + focusHook, + scrollEventsHandlersHook, + // props + enableFooterMarginAdjustment = false, + overScrollMode = 'never', + keyboardDismissMode = 'interactive', + showsVerticalScrollIndicator = true, + style, + refreshing, + onRefresh, + progressViewOffset, + refreshControl, + // events + onScroll, + onScrollBeginDrag, + onScrollEndDrag, + onContentSizeChange, + ...rest + } = props; //#region refs + + const nativeGestureRef = (0, _react.useRef)(null); + const refreshControlGestureRef = (0, _react.useRef)(null); //#endregion + //#region hooks + + const { + scrollableRef, + scrollableContentOffsetY, + scrollHandler + } = (0, _hooks.useScrollHandler)(scrollEventsHandlersHook, onScroll, onScrollBeginDrag, onScrollEndDrag); + const { + enableContentPanningGesture, + animatedFooterHeight, + animatedScrollableState, + animatedContentHeight, + enableDynamicSizing + } = (0, _hooks.useBottomSheetInternal)(); //#endregion + //#region variables + + const scrollableAnimatedProps = (0, _reactNativeReanimated.useAnimatedProps)(() => ({ + decelerationRate: _constants.SCROLLABLE_DECELERATION_RATE_MAPPER[animatedScrollableState.value], + showsVerticalScrollIndicator: showsVerticalScrollIndicator ? animatedScrollableState.value === _constants.SCROLLABLE_STATE.UNLOCKED : showsVerticalScrollIndicator + }), [showsVerticalScrollIndicator]); //#endregion + //#region callbacks + + const handleContentSizeChange = (0, _hooks.useStableCallback)((contentWidth, contentHeight) => { + if (enableDynamicSizing) { + animatedContentHeight.value = contentHeight; + } + + if (onContentSizeChange) { + onContentSizeChange(contentWidth, contentHeight); + } + }); //#endregion + //#region styles + + const containerAnimatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({ + marginBottom: enableFooterMarginAdjustment ? animatedFooterHeight.value : 0 + }), [enableFooterMarginAdjustment]); + const containerStyle = (0, _react.useMemo)(() => { + return enableFooterMarginAdjustment ? [...(style ? 'length' in style ? style : [style] : []), containerAnimatedStyle] : style; + }, [enableFooterMarginAdjustment, style, containerAnimatedStyle]); //#endregion + //#region effects + // @ts-ignore + + (0, _react.useImperativeHandle)(ref, () => scrollableRef.current); + (0, _hooks.useScrollableSetter)(scrollableRef, type, scrollableContentOffsetY, onRefresh !== undefined, focusHook); //#endregion + //#region render + + if (_reactNative.Platform.OS === 'android') { + const scrollableContent = /*#__PURE__*/_react.default.createElement(_reactNativeGestureHandler.NativeViewGestureHandler, { + ref: nativeGestureRef, + enabled: enableContentPanningGesture, + shouldCancelWhenOutside: false + }, /*#__PURE__*/_react.default.createElement(ScrollableComponent, _extends({ + animatedProps: scrollableAnimatedProps + }, rest, { + scrollEventThrottle: 16, + ref: scrollableRef, + overScrollMode: overScrollMode, + keyboardDismissMode: keyboardDismissMode, + onScroll: scrollHandler, + onContentSizeChange: handleContentSizeChange, + style: containerStyle + }))); + + return /*#__PURE__*/_react.default.createElement(_bottomSheetDraggableView.default, { + nativeGestureRef: nativeGestureRef, + refreshControlGestureRef: refreshControlGestureRef, + gestureType: _constants.GESTURE_SOURCE.SCROLLABLE, + style: _styles.styles.container + }, onRefresh ? /*#__PURE__*/_react.default.createElement(_bottomSheetRefreshControl.default, { + ref: refreshControlGestureRef, + refreshing: refreshing, + onRefresh: onRefresh, + progressViewOffset: progressViewOffset, + style: _styles.styles.container + }, scrollableContent) : scrollableContent); + } + + return /*#__PURE__*/_react.default.createElement(_bottomSheetDraggableView.default, { + nativeGestureRef: nativeGestureRef, + gestureType: _constants.GESTURE_SOURCE.SCROLLABLE, + style: _styles.styles.container + }, /*#__PURE__*/_react.default.createElement(_reactNativeGestureHandler.NativeViewGestureHandler, { + ref: nativeGestureRef, + enabled: enableContentPanningGesture, + shouldCancelWhenOutside: false + }, /*#__PURE__*/_react.default.createElement(ScrollableComponent, _extends({ + animatedProps: scrollableAnimatedProps + }, rest, { + scrollEventThrottle: 16, + ref: scrollableRef, + overScrollMode: overScrollMode, + keyboardDismissMode: keyboardDismissMode, + refreshing: refreshing, + onRefresh: onRefresh, + progressViewOffset: progressViewOffset, + refreshControl: refreshControl, + onScroll: scrollHandler, + onContentSizeChange: handleContentSizeChange, + style: containerStyle + })))); //#endregion + }); +} +//# sourceMappingURL=createBottomSheetScrollableComponent.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetScrollable/createBottomSheetScrollableComponent.js.map b/lib/commonjs/components/bottomSheetScrollable/createBottomSheetScrollableComponent.js.map new file mode 100644 index 000000000..144635549 --- /dev/null +++ b/lib/commonjs/components/bottomSheetScrollable/createBottomSheetScrollableComponent.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["createBottomSheetScrollableComponent.tsx"],"names":["createBottomSheetScrollableComponent","type","ScrollableComponent","props","ref","focusHook","scrollEventsHandlersHook","enableFooterMarginAdjustment","overScrollMode","keyboardDismissMode","showsVerticalScrollIndicator","style","refreshing","onRefresh","progressViewOffset","refreshControl","onScroll","onScrollBeginDrag","onScrollEndDrag","onContentSizeChange","rest","nativeGestureRef","refreshControlGestureRef","scrollableRef","scrollableContentOffsetY","scrollHandler","enableContentPanningGesture","animatedFooterHeight","animatedScrollableState","animatedContentHeight","enableDynamicSizing","scrollableAnimatedProps","decelerationRate","SCROLLABLE_DECELERATION_RATE_MAPPER","value","SCROLLABLE_STATE","UNLOCKED","handleContentSizeChange","contentWidth","contentHeight","containerAnimatedStyle","marginBottom","containerStyle","current","undefined","Platform","OS","scrollableContent","GESTURE_SOURCE","SCROLLABLE","styles","container"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAMA;;AAMA;;;;;;;;;;AAEO,SAASA,oCAAT,CACLC,IADK,EAELC,mBAFK,EAGL;AACA,sBAAO,uBAAiB,CAACC,KAAD,EAAQC,GAAR,KAAgB;AACtC;AACA,UAAM;AACJ;AACAC,MAAAA,SAFI;AAGJC,MAAAA,wBAHI;AAIJ;AACAC,MAAAA,4BAA4B,GAAG,KAL3B;AAMJC,MAAAA,cAAc,GAAG,OANb;AAOJC,MAAAA,mBAAmB,GAAG,aAPlB;AAQJC,MAAAA,4BAA4B,GAAG,IAR3B;AASJC,MAAAA,KATI;AAUJC,MAAAA,UAVI;AAWJC,MAAAA,SAXI;AAYJC,MAAAA,kBAZI;AAaJC,MAAAA,cAbI;AAcJ;AACAC,MAAAA,QAfI;AAgBJC,MAAAA,iBAhBI;AAiBJC,MAAAA,eAjBI;AAkBJC,MAAAA,mBAlBI;AAmBJ,SAAGC;AAnBC,QAoBGjB,KApBT,CAFsC,CAwBtC;;AACA,UAAMkB,gBAAgB,GAAG,mBAAiC,IAAjC,CAAzB;AACA,UAAMC,wBAAwB,GAAG,mBAAiC,IAAjC,CAAjC,CA1BsC,CA2BtC;AAEA;;AACA,UAAM;AAAEC,MAAAA,aAAF;AAAiBC,MAAAA,wBAAjB;AAA2CC,MAAAA;AAA3C,QACJ,6BACEnB,wBADF,EAEEU,QAFF,EAGEC,iBAHF,EAIEC,eAJF,CADF;AAOA,UAAM;AACJQ,MAAAA,2BADI;AAEJC,MAAAA,oBAFI;AAGJC,MAAAA,uBAHI;AAIJC,MAAAA,qBAJI;AAKJC,MAAAA;AALI,QAMF,oCANJ,CArCsC,CA4CtC;AAEA;;AACA,UAAMC,uB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EMX,IAFN;AAGE,MAAA,mBAAmB,EAAE,EAHvB;AAIE,MAAA,GAAG,EAAEG,aAJP;AAKE,MAAA,cAAc,EAAEf,cALlB;AAME,MAAA,mBAAmB,EAAEC,mBANvB;AAOE,MAAA,UAAU,EAAEG,UAPd;AAQE,MAAA,SAAS,EAAEC,SARb;AASE,MAAA,kBAAkB,EAAEC,kBATtB;AAUE,MAAA,cAAc,EAAEC,cAVlB;AAWE,MAAA,QAAQ,EAAEU,aAXZ;AAYE,MAAA,mBAAmB,EAAEY,uBAZvB;AAaE,MAAA,KAAK,EAAEK;AAbT,OALF,CALF,CADF,CApJsC,CAiLtC;AACD,GAlLM,CAAP;AAmLD","sourcesContent":["import React, { forwardRef, useImperativeHandle, useMemo, useRef } from 'react';\nimport { Platform } from 'react-native';\nimport { useAnimatedProps, useAnimatedStyle } from 'react-native-reanimated';\nimport { NativeViewGestureHandler } from 'react-native-gesture-handler';\nimport BottomSheetDraggableView from '../bottomSheetDraggableView';\nimport BottomSheetRefreshControl from '../bottomSheetRefreshControl';\nimport {\n useScrollHandler,\n useScrollableSetter,\n useBottomSheetInternal,\n useStableCallback,\n} from '../../hooks';\nimport {\n GESTURE_SOURCE,\n SCROLLABLE_DECELERATION_RATE_MAPPER,\n SCROLLABLE_STATE,\n SCROLLABLE_TYPE,\n} from '../../constants';\nimport { styles } from './styles';\n\nexport function createBottomSheetScrollableComponent(\n type: SCROLLABLE_TYPE,\n ScrollableComponent: any\n) {\n return forwardRef((props, ref) => {\n // props\n const {\n // hooks\n focusHook,\n scrollEventsHandlersHook,\n // props\n enableFooterMarginAdjustment = false,\n overScrollMode = 'never',\n keyboardDismissMode = 'interactive',\n showsVerticalScrollIndicator = true,\n style,\n refreshing,\n onRefresh,\n progressViewOffset,\n refreshControl,\n // events\n onScroll,\n onScrollBeginDrag,\n onScrollEndDrag,\n onContentSizeChange,\n ...rest\n }: any = props;\n\n //#region refs\n const nativeGestureRef = useRef(null);\n const refreshControlGestureRef = useRef(null);\n //#endregion\n\n //#region hooks\n const { scrollableRef, scrollableContentOffsetY, scrollHandler } =\n useScrollHandler(\n scrollEventsHandlersHook,\n onScroll,\n onScrollBeginDrag,\n onScrollEndDrag\n );\n const {\n enableContentPanningGesture,\n animatedFooterHeight,\n animatedScrollableState,\n animatedContentHeight,\n enableDynamicSizing,\n } = useBottomSheetInternal();\n //#endregion\n\n //#region variables\n const scrollableAnimatedProps = useAnimatedProps(\n () => ({\n decelerationRate:\n SCROLLABLE_DECELERATION_RATE_MAPPER[animatedScrollableState.value],\n showsVerticalScrollIndicator: showsVerticalScrollIndicator\n ? animatedScrollableState.value === SCROLLABLE_STATE.UNLOCKED\n : showsVerticalScrollIndicator,\n }),\n [showsVerticalScrollIndicator]\n );\n //#endregion\n\n //#region callbacks\n const handleContentSizeChange = useStableCallback(\n (contentWidth: number, contentHeight: number) => {\n if (enableDynamicSizing) {\n animatedContentHeight.value = contentHeight;\n }\n\n if (onContentSizeChange) {\n onContentSizeChange(contentWidth, contentHeight);\n }\n }\n );\n //#endregion\n\n //#region styles\n const containerAnimatedStyle = useAnimatedStyle(\n () => ({\n marginBottom: enableFooterMarginAdjustment\n ? animatedFooterHeight.value\n : 0,\n }),\n [enableFooterMarginAdjustment]\n );\n const containerStyle = useMemo(() => {\n return enableFooterMarginAdjustment\n ? [\n ...(style ? ('length' in style ? style : [style]) : []),\n containerAnimatedStyle,\n ]\n : style;\n }, [enableFooterMarginAdjustment, style, containerAnimatedStyle]);\n //#endregion\n\n //#region effects\n // @ts-ignore\n useImperativeHandle(ref, () => scrollableRef.current);\n useScrollableSetter(\n scrollableRef,\n type,\n scrollableContentOffsetY,\n onRefresh !== undefined,\n focusHook\n );\n //#endregion\n\n //#region render\n if (Platform.OS === 'android') {\n const scrollableContent = (\n \n \n \n );\n return (\n \n {onRefresh ? (\n \n {scrollableContent}\n \n ) : (\n scrollableContent\n )}\n \n );\n }\n return (\n \n \n \n \n \n );\n //#endregion\n });\n}\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetScrollable/index.js b/lib/commonjs/components/bottomSheetScrollable/index.js new file mode 100644 index 000000000..e913863af --- /dev/null +++ b/lib/commonjs/components/bottomSheetScrollable/index.js @@ -0,0 +1,48 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "createBottomSheetScrollableComponent", { + enumerable: true, + get: function () { + return _createBottomSheetScrollableComponent.createBottomSheetScrollableComponent; + } +}); +Object.defineProperty(exports, "BottomSheetSectionList", { + enumerable: true, + get: function () { + return _BottomSheetSectionList.default; + } +}); +Object.defineProperty(exports, "BottomSheetFlatList", { + enumerable: true, + get: function () { + return _BottomSheetFlatList.default; + } +}); +Object.defineProperty(exports, "BottomSheetScrollView", { + enumerable: true, + get: function () { + return _BottomSheetScrollView.default; + } +}); +Object.defineProperty(exports, "BottomSheetVirtualizedList", { + enumerable: true, + get: function () { + return _BottomSheetVirtualizedList.default; + } +}); + +var _createBottomSheetScrollableComponent = require("./createBottomSheetScrollableComponent"); + +var _BottomSheetSectionList = _interopRequireDefault(require("./BottomSheetSectionList")); + +var _BottomSheetFlatList = _interopRequireDefault(require("./BottomSheetFlatList")); + +var _BottomSheetScrollView = _interopRequireDefault(require("./BottomSheetScrollView")); + +var _BottomSheetVirtualizedList = _interopRequireDefault(require("./BottomSheetVirtualizedList")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetScrollable/index.js.map b/lib/commonjs/components/bottomSheetScrollable/index.js.map new file mode 100644 index 000000000..9468e9c8e --- /dev/null +++ b/lib/commonjs/components/bottomSheetScrollable/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA","sourcesContent":["export { createBottomSheetScrollableComponent } from './createBottomSheetScrollableComponent';\nexport { default as BottomSheetSectionList } from './BottomSheetSectionList';\nexport { default as BottomSheetFlatList } from './BottomSheetFlatList';\nexport { default as BottomSheetScrollView } from './BottomSheetScrollView';\nexport { default as BottomSheetVirtualizedList } from './BottomSheetVirtualizedList';\n\nexport type {\n BottomSheetFlatListMethods,\n BottomSheetScrollViewMethods,\n BottomSheetSectionListMethods,\n BottomSheetVirtualizedListMethods,\n BottomSheetScrollableProps,\n} from './types';\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetScrollable/styles.js b/lib/commonjs/components/bottomSheetScrollable/styles.js new file mode 100644 index 000000000..9501d29d9 --- /dev/null +++ b/lib/commonjs/components/bottomSheetScrollable/styles.js @@ -0,0 +1,18 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.styles = void 0; + +var _reactNative = require("react-native"); + +const styles = _reactNative.StyleSheet.create({ + container: { + flex: 1, + overflow: 'visible' + } +}); + +exports.styles = styles; +//# sourceMappingURL=styles.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetScrollable/styles.js.map b/lib/commonjs/components/bottomSheetScrollable/styles.js.map new file mode 100644 index 000000000..09c6c7d55 --- /dev/null +++ b/lib/commonjs/components/bottomSheetScrollable/styles.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["styles.ts"],"names":["styles","StyleSheet","create","container","flex","overflow"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,MAAM,GAAGC,wBAAWC,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE;AACTC,IAAAA,IAAI,EAAE,CADG;AAETC,IAAAA,QAAQ,EAAE;AAFD;AAD2B,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\n\nexport const styles = StyleSheet.create({\n container: {\n flex: 1,\n overflow: 'visible',\n },\n});\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetTextInput/BottomSheetTextInput.js b/lib/commonjs/components/bottomSheetTextInput/BottomSheetTextInput.js new file mode 100644 index 000000000..c0c0f6662 --- /dev/null +++ b/lib/commonjs/components/bottomSheetTextInput/BottomSheetTextInput.js @@ -0,0 +1,62 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireWildcard(require("react")); + +var _reactNativeGestureHandler = require("react-native-gesture-handler"); + +var _hooks = require("../../hooks"); + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } + +const BottomSheetTextInputComponent = /*#__PURE__*/(0, _react.forwardRef)(({ + onFocus, + onBlur, + ...rest +}, ref) => { + //#region hooks + const { + shouldHandleKeyboardEvents + } = (0, _hooks.useBottomSheetInternal)(); + (0, _react.useEffect)(() => { + return () => { + // Reset the flag on unmount + shouldHandleKeyboardEvents.value = false; + }; + }, [shouldHandleKeyboardEvents]); //#endregion + //#region callbacks + + const handleOnFocus = (0, _react.useCallback)(args => { + shouldHandleKeyboardEvents.value = true; + + if (onFocus) { + onFocus(args); + } + }, [onFocus, shouldHandleKeyboardEvents]); + const handleOnBlur = (0, _react.useCallback)(args => { + shouldHandleKeyboardEvents.value = false; + + if (onBlur) { + onBlur(args); + } + }, [onBlur, shouldHandleKeyboardEvents]); //#endregion + + return /*#__PURE__*/_react.default.createElement(_reactNativeGestureHandler.TextInput, _extends({ + ref: ref, + onFocus: handleOnFocus, + onBlur: handleOnBlur + }, rest)); +}); +const BottomSheetTextInput = /*#__PURE__*/(0, _react.memo)(BottomSheetTextInputComponent); +BottomSheetTextInput.displayName = 'BottomSheetTextInput'; +var _default = BottomSheetTextInput; +exports.default = _default; +//# sourceMappingURL=BottomSheetTextInput.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetTextInput/BottomSheetTextInput.js.map b/lib/commonjs/components/bottomSheetTextInput/BottomSheetTextInput.js.map new file mode 100644 index 000000000..3104517e6 --- /dev/null +++ b/lib/commonjs/components/bottomSheetTextInput/BottomSheetTextInput.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheetTextInput.tsx"],"names":["BottomSheetTextInputComponent","onFocus","onBlur","rest","ref","shouldHandleKeyboardEvents","value","handleOnFocus","args","handleOnBlur","BottomSheetTextInput","displayName"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;;;;;AAGA,MAAMA,6BAA6B,gBAAG,uBAGpC,CAAC;AAAEC,EAAAA,OAAF;AAAWC,EAAAA,MAAX;AAAmB,KAAGC;AAAtB,CAAD,EAA+BC,GAA/B,KAAuC;AACvC;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAiC,oCAAvC;AAEA,wBAAU,MAAM;AACd,WAAO,MAAM;AACX;AACAA,MAAAA,0BAA0B,CAACC,KAA3B,GAAmC,KAAnC;AACD,KAHD;AAID,GALD,EAKG,CAACD,0BAAD,CALH,EAJuC,CAUvC;AAEA;;AACA,QAAME,aAAa,GAAG,wBACpBC,IAAI,IAAI;AACNH,IAAAA,0BAA0B,CAACC,KAA3B,GAAmC,IAAnC;;AACA,QAAIL,OAAJ,EAAa;AACXA,MAAAA,OAAO,CAACO,IAAD,CAAP;AACD;AACF,GANmB,EAOpB,CAACP,OAAD,EAAUI,0BAAV,CAPoB,CAAtB;AASA,QAAMI,YAAY,GAAG,wBACnBD,IAAI,IAAI;AACNH,IAAAA,0BAA0B,CAACC,KAA3B,GAAmC,KAAnC;;AACA,QAAIJ,MAAJ,EAAY;AACVA,MAAAA,MAAM,CAACM,IAAD,CAAN;AACD;AACF,GANkB,EAOnB,CAACN,MAAD,EAASG,0BAAT,CAPmB,CAArB,CAtBuC,CA+BvC;;AAEA,sBACE,6BAAC,oCAAD;AACE,IAAA,GAAG,EAAED,GADP;AAEE,IAAA,OAAO,EAAEG,aAFX;AAGE,IAAA,MAAM,EAAEE;AAHV,KAIMN,IAJN,EADF;AAQD,CA5CqC,CAAtC;AA8CA,MAAMO,oBAAoB,gBAAG,iBAAKV,6BAAL,CAA7B;AACAU,oBAAoB,CAACC,WAArB,GAAmC,sBAAnC;eAEeD,oB","sourcesContent":["import React, { memo, useCallback, forwardRef, useEffect } from 'react';\nimport { TextInput } from 'react-native-gesture-handler';\nimport { useBottomSheetInternal } from '../../hooks';\nimport type { BottomSheetTextInputProps } from './types';\n\nconst BottomSheetTextInputComponent = forwardRef<\n TextInput,\n BottomSheetTextInputProps\n>(({ onFocus, onBlur, ...rest }, ref) => {\n //#region hooks\n const { shouldHandleKeyboardEvents } = useBottomSheetInternal();\n\n useEffect(() => {\n return () => {\n // Reset the flag on unmount\n shouldHandleKeyboardEvents.value = false;\n };\n }, [shouldHandleKeyboardEvents]);\n //#endregion\n\n //#region callbacks\n const handleOnFocus = useCallback(\n args => {\n shouldHandleKeyboardEvents.value = true;\n if (onFocus) {\n onFocus(args);\n }\n },\n [onFocus, shouldHandleKeyboardEvents]\n );\n const handleOnBlur = useCallback(\n args => {\n shouldHandleKeyboardEvents.value = false;\n if (onBlur) {\n onBlur(args);\n }\n },\n [onBlur, shouldHandleKeyboardEvents]\n );\n //#endregion\n\n return (\n \n );\n});\n\nconst BottomSheetTextInput = memo(BottomSheetTextInputComponent);\nBottomSheetTextInput.displayName = 'BottomSheetTextInput';\n\nexport default BottomSheetTextInput;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetTextInput/index.js b/lib/commonjs/components/bottomSheetTextInput/index.js new file mode 100644 index 000000000..acd7d7566 --- /dev/null +++ b/lib/commonjs/components/bottomSheetTextInput/index.js @@ -0,0 +1,16 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "default", { + enumerable: true, + get: function () { + return _BottomSheetTextInput.default; + } +}); + +var _BottomSheetTextInput = _interopRequireDefault(require("./BottomSheetTextInput")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetTextInput/index.js.map b/lib/commonjs/components/bottomSheetTextInput/index.js.map new file mode 100644 index 000000000..97ea46b47 --- /dev/null +++ b/lib/commonjs/components/bottomSheetTextInput/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { default } from './BottomSheetTextInput';\nexport type { BottomSheetTextInputProps } from './types';\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetTextInput/types.js b/lib/commonjs/components/bottomSheetTextInput/types.js new file mode 100644 index 000000000..239667a3d --- /dev/null +++ b/lib/commonjs/components/bottomSheetTextInput/types.js @@ -0,0 +1,6 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetTextInput/types.js.map b/lib/commonjs/components/bottomSheetTextInput/types.js.map new file mode 100644 index 000000000..9ffd4b22f --- /dev/null +++ b/lib/commonjs/components/bottomSheetTextInput/types.js.map @@ -0,0 +1 @@ +{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetView/BottomSheetView.js b/lib/commonjs/components/bottomSheetView/BottomSheetView.js new file mode 100644 index 000000000..13401fa1a --- /dev/null +++ b/lib/commonjs/components/bottomSheetView/BottomSheetView.js @@ -0,0 +1,91 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireWildcard(require("react")); + +var _reactNative = require("react-native"); + +var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated")); + +var _constants = require("../../constants"); + +var _hooks = require("../../hooks"); + +var _utilities = require("../../utilities"); + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } + +function BottomSheetViewComponent({ + focusHook: useFocusHook = _react.useEffect, + enableFooterMarginAdjustment = false, + onLayout, + style, + children, + ...rest +}) { + //#region hooks + const { + animatedScrollableContentOffsetY, + animatedScrollableType, + animatedFooterHeight, + enableDynamicSizing, + animatedContentHeight + } = (0, _hooks.useBottomSheetInternal)(); //#endregion + //#region styles + + const containerStylePaddingBottom = (0, _react.useMemo)(() => { + const flattenStyle = _reactNative.StyleSheet.flatten(style); + + const paddingBottom = flattenStyle && 'paddingBottom' in flattenStyle ? flattenStyle.paddingBottom : 0; + return typeof paddingBottom === 'number' ? paddingBottom : 0; + }, [style]); + const containerAnimatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({ + paddingBottom: enableFooterMarginAdjustment ? animatedFooterHeight.value + containerStylePaddingBottom : containerStylePaddingBottom + }), [containerStylePaddingBottom, enableFooterMarginAdjustment]); + const containerStyle = (0, _react.useMemo)(() => [style, containerAnimatedStyle], [style, containerAnimatedStyle]); //#endregion + //#region callbacks + + const handleSettingScrollable = (0, _react.useCallback)(() => { + animatedScrollableContentOffsetY.value = 0; + animatedScrollableType.value = _constants.SCROLLABLE_TYPE.VIEW; + }, [animatedScrollableContentOffsetY, animatedScrollableType]); + const handleLayout = (0, _react.useCallback)(event => { + if (enableDynamicSizing) { + animatedContentHeight.value = event.nativeEvent.layout.height; + } + + if (onLayout) { + onLayout(event); + } + + (0, _utilities.print)({ + component: BottomSheetView.displayName, + method: 'handleLayout', + params: { + height: event.nativeEvent.layout.height + } + }); + }, [onLayout, animatedContentHeight, enableDynamicSizing]); //#endregion + // effects + + useFocusHook(handleSettingScrollable); //render + + return /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, _extends({ + onLayout: handleLayout, + style: containerStyle + }, rest), children); +} + +const BottomSheetView = /*#__PURE__*/(0, _react.memo)(BottomSheetViewComponent); +BottomSheetView.displayName = 'BottomSheetView'; +var _default = BottomSheetView; +exports.default = _default; +//# sourceMappingURL=BottomSheetView.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetView/BottomSheetView.js.map b/lib/commonjs/components/bottomSheetView/BottomSheetView.js.map new file mode 100644 index 000000000..f591c9ba8 --- /dev/null +++ b/lib/commonjs/components/bottomSheetView/BottomSheetView.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheetView.tsx"],"names":["BottomSheetViewComponent","focusHook","useFocusHook","useEffect","enableFooterMarginAdjustment","onLayout","style","children","rest","animatedScrollableContentOffsetY","animatedScrollableType","animatedFooterHeight","enableDynamicSizing","animatedContentHeight","containerStylePaddingBottom","flattenStyle","StyleSheet","flatten","paddingBottom","containerAnimatedStyle","value","containerStyle","handleSettingScrollable","SCROLLABLE_TYPE","VIEW","handleLayout","event","nativeEvent","layout","height","component","BottomSheetView","displayName","method","params"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;AAEA,SAASA,wBAAT,CAAkC;AAChCC,EAAAA,SAAS,EAAEC,YAAY,GAAGC,gBADM;AAEhCC,EAAAA,4BAA4B,GAAG,KAFC;AAGhCC,EAAAA,QAHgC;AAIhCC,EAAAA,KAJgC;AAKhCC,EAAAA,QALgC;AAMhC,KAAGC;AAN6B,CAAlC,EAOyB;AACvB;AACA,QAAM;AACJC,IAAAA,gCADI;AAEJC,IAAAA,sBAFI;AAGJC,IAAAA,oBAHI;AAIJC,IAAAA,mBAJI;AAKJC,IAAAA;AALI,MAMF,oCANJ,CAFuB,CASvB;AAEA;;AACA,QAAMC,2BAA2B,GAAG,oBAAQ,MAAM;AAChD,UAAMC,YAAY,GAAGC,wBAAWC,OAAX,CAAmBX,KAAnB,CAArB;;AACA,UAAMY,aAAa,GACjBH,YAAY,IAAI,mBAAmBA,YAAnC,GACIA,YAAY,CAACG,aADjB,GAEI,CAHN;AAIA,WAAO,OAAOA,aAAP,KAAyB,QAAzB,GAAoCA,aAApC,GAAoD,CAA3D;AACD,GAPmC,EAOjC,CAACZ,KAAD,CAPiC,CAApC;AAQA,QAAMa,sBAAsB,GAAG,6CAC7B,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EJ;AAA9C,KAAkEb,IAAlE,GACGD,QADH,CADF;AAKD;;AAED,MAAMwB,eAAe,gBAAG,iBAAK/B,wBAAL,CAAxB;AACA+B,eAAe,CAACC,WAAhB,GAA8B,iBAA9B;eAEeD,e","sourcesContent":["import React, { memo, useEffect, useCallback, useMemo } from 'react';\nimport { LayoutChangeEvent, StyleSheet } from 'react-native';\nimport Animated, { useAnimatedStyle } from 'react-native-reanimated';\nimport { SCROLLABLE_TYPE } from '../../constants';\nimport { useBottomSheetInternal } from '../../hooks';\nimport type { BottomSheetViewProps } from './types';\nimport { print } from '../../utilities';\n\nfunction BottomSheetViewComponent({\n focusHook: useFocusHook = useEffect,\n enableFooterMarginAdjustment = false,\n onLayout,\n style,\n children,\n ...rest\n}: BottomSheetViewProps) {\n //#region hooks\n const {\n animatedScrollableContentOffsetY,\n animatedScrollableType,\n animatedFooterHeight,\n enableDynamicSizing,\n animatedContentHeight,\n } = useBottomSheetInternal();\n //#endregion\n\n //#region styles\n const containerStylePaddingBottom = useMemo(() => {\n const flattenStyle = StyleSheet.flatten(style);\n const paddingBottom =\n flattenStyle && 'paddingBottom' in flattenStyle\n ? flattenStyle.paddingBottom\n : 0;\n return typeof paddingBottom === 'number' ? paddingBottom : 0;\n }, [style]);\n const containerAnimatedStyle = useAnimatedStyle(\n () => ({\n paddingBottom: enableFooterMarginAdjustment\n ? animatedFooterHeight.value + containerStylePaddingBottom\n : containerStylePaddingBottom,\n }),\n [containerStylePaddingBottom, enableFooterMarginAdjustment]\n );\n const containerStyle = useMemo(\n () => [style, containerAnimatedStyle],\n [style, containerAnimatedStyle]\n );\n //#endregion\n\n //#region callbacks\n const handleSettingScrollable = useCallback(() => {\n animatedScrollableContentOffsetY.value = 0;\n animatedScrollableType.value = SCROLLABLE_TYPE.VIEW;\n }, [animatedScrollableContentOffsetY, animatedScrollableType]);\n const handleLayout = useCallback(\n (event: LayoutChangeEvent) => {\n if (enableDynamicSizing) {\n animatedContentHeight.value = event.nativeEvent.layout.height;\n }\n\n if (onLayout) {\n onLayout(event);\n }\n\n print({\n component: BottomSheetView.displayName,\n method: 'handleLayout',\n params: {\n height: event.nativeEvent.layout.height,\n },\n });\n },\n [onLayout, animatedContentHeight, enableDynamicSizing]\n );\n //#endregion\n\n // effects\n useFocusHook(handleSettingScrollable);\n\n //render\n return (\n \n {children}\n \n );\n}\n\nconst BottomSheetView = memo(BottomSheetViewComponent);\nBottomSheetView.displayName = 'BottomSheetView';\n\nexport default BottomSheetView;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetView/index.js b/lib/commonjs/components/bottomSheetView/index.js new file mode 100644 index 000000000..bfeda7c44 --- /dev/null +++ b/lib/commonjs/components/bottomSheetView/index.js @@ -0,0 +1,16 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "default", { + enumerable: true, + get: function () { + return _BottomSheetView.default; + } +}); + +var _BottomSheetView = _interopRequireDefault(require("./BottomSheetView")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetView/index.js.map b/lib/commonjs/components/bottomSheetView/index.js.map new file mode 100644 index 000000000..52a6b5531 --- /dev/null +++ b/lib/commonjs/components/bottomSheetView/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { default } from './BottomSheetView';\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetView/styles.js b/lib/commonjs/components/bottomSheetView/styles.js new file mode 100644 index 000000000..9aaaa46d6 --- /dev/null +++ b/lib/commonjs/components/bottomSheetView/styles.js @@ -0,0 +1,16 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.styles = void 0; + +var _reactNative = require("react-native"); + +const styles = _reactNative.StyleSheet.create({ + container: {// flex: 1, + } +}); + +exports.styles = styles; +//# sourceMappingURL=styles.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetView/styles.js.map b/lib/commonjs/components/bottomSheetView/styles.js.map new file mode 100644 index 000000000..55fc8c05d --- /dev/null +++ b/lib/commonjs/components/bottomSheetView/styles.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["styles.ts"],"names":["styles","StyleSheet","create","container"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,MAAM,GAAGC,wBAAWC,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE,CACT;AADS;AAD2B,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\n\nexport const styles = StyleSheet.create({\n container: {\n // flex: 1,\n },\n});\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/touchables/Touchables.ios.js b/lib/commonjs/components/touchables/Touchables.ios.js new file mode 100644 index 000000000..0163feae5 --- /dev/null +++ b/lib/commonjs/components/touchables/Touchables.ios.js @@ -0,0 +1,26 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "TouchableOpacity", { + enumerable: true, + get: function () { + return _reactNative.TouchableOpacity; + } +}); +Object.defineProperty(exports, "TouchableHighlight", { + enumerable: true, + get: function () { + return _reactNative.TouchableHighlight; + } +}); +Object.defineProperty(exports, "TouchableWithoutFeedback", { + enumerable: true, + get: function () { + return _reactNative.TouchableWithoutFeedback; + } +}); + +var _reactNative = require("react-native"); +//# sourceMappingURL=Touchables.ios.js.map \ No newline at end of file diff --git a/lib/commonjs/components/touchables/Touchables.ios.js.map b/lib/commonjs/components/touchables/Touchables.ios.js.map new file mode 100644 index 000000000..f1bff73b8 --- /dev/null +++ b/lib/commonjs/components/touchables/Touchables.ios.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["Touchables.ios.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA","sourcesContent":["export {\n TouchableOpacity,\n TouchableHighlight,\n TouchableWithoutFeedback,\n} from 'react-native';\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/touchables/Touchables.js b/lib/commonjs/components/touchables/Touchables.js new file mode 100644 index 000000000..df97a9f1c --- /dev/null +++ b/lib/commonjs/components/touchables/Touchables.js @@ -0,0 +1,26 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "TouchableOpacity", { + enumerable: true, + get: function () { + return _reactNativeGestureHandler.TouchableOpacity; + } +}); +Object.defineProperty(exports, "TouchableHighlight", { + enumerable: true, + get: function () { + return _reactNativeGestureHandler.TouchableHighlight; + } +}); +Object.defineProperty(exports, "TouchableWithoutFeedback", { + enumerable: true, + get: function () { + return _reactNativeGestureHandler.TouchableWithoutFeedback; + } +}); + +var _reactNativeGestureHandler = require("react-native-gesture-handler"); +//# sourceMappingURL=Touchables.js.map \ No newline at end of file diff --git a/lib/commonjs/components/touchables/Touchables.js.map b/lib/commonjs/components/touchables/Touchables.js.map new file mode 100644 index 000000000..a16bc7882 --- /dev/null +++ b/lib/commonjs/components/touchables/Touchables.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["Touchables.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA","sourcesContent":["export {\n TouchableOpacity,\n TouchableHighlight,\n TouchableWithoutFeedback,\n} from 'react-native-gesture-handler';\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/touchables/index.js b/lib/commonjs/components/touchables/index.js new file mode 100644 index 000000000..6b0484d17 --- /dev/null +++ b/lib/commonjs/components/touchables/index.js @@ -0,0 +1,16 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Touchables = require("./Touchables"); + +var _default = { + TouchableOpacity: _Touchables.TouchableOpacity, + TouchableHighlight: _Touchables.TouchableHighlight, + TouchableWithoutFeedback: _Touchables.TouchableWithoutFeedback +}; +exports.default = _default; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/components/touchables/index.js.map b/lib/commonjs/components/touchables/index.js.map new file mode 100644 index 000000000..90a65edf7 --- /dev/null +++ b/lib/commonjs/components/touchables/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":["TouchableOpacity","TouchableHighlight","TouchableWithoutFeedback"],"mappings":";;;;;;;AAMA;;eAOe;AACbA,EAAAA,gBAAgB,EAAEA,4BADL;AAEbC,EAAAA,kBAAkB,EAAEA,8BAFP;AAGbC,EAAAA,wBAAwB,EACtBA;AAJW,C","sourcesContent":["import type {\n TouchableOpacity as RNTouchableOpacity,\n TouchableHighlight as RNTouchableHighlight,\n TouchableWithoutFeedback as RNTouchableWithoutFeedback,\n} from 'react-native';\n\nimport {\n TouchableOpacity,\n TouchableHighlight,\n TouchableWithoutFeedback,\n // @ts-ignore\n} from './Touchables';\n\nexport default {\n TouchableOpacity: TouchableOpacity as any as typeof RNTouchableOpacity,\n TouchableHighlight: TouchableHighlight as any as typeof RNTouchableHighlight,\n TouchableWithoutFeedback:\n TouchableWithoutFeedback as any as typeof RNTouchableWithoutFeedback,\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/constants.js b/lib/commonjs/constants.js new file mode 100644 index 000000000..47779dd76 --- /dev/null +++ b/lib/commonjs/constants.js @@ -0,0 +1,161 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.ANIMATION_DURATION = exports.ANIMATION_EASING = exports.ANIMATION_CONFIGS = exports.KEYBOARD_DISMISS_THRESHOLD = exports.KEYBOARD_INPUT_MODE = exports.KEYBOARD_BLUR_BEHAVIOR = exports.KEYBOARD_BEHAVIOR = exports.MODAL_STACK_BEHAVIOR = exports.SCROLLABLE_DECELERATION_RATE_MAPPER = exports.SCREEN_WIDTH = exports.SCREEN_HEIGHT = exports.WINDOW_WIDTH = exports.WINDOW_HEIGHT = exports.KEYBOARD_STATE = exports.SCROLLABLE_STATE = exports.SCROLLABLE_TYPE = exports.ANIMATION_SOURCE = exports.ANIMATION_METHOD = exports.ANIMATION_STATE = exports.SHEET_STATE = exports.GESTURE_SOURCE = void 0; + +var _reactNative = require("react-native"); + +var _reactNativeReanimated = require("react-native-reanimated"); + +const { + height: WINDOW_HEIGHT, + width: WINDOW_WIDTH +} = _reactNative.Dimensions.get('window'); + +exports.WINDOW_WIDTH = WINDOW_WIDTH; +exports.WINDOW_HEIGHT = WINDOW_HEIGHT; + +const { + height: SCREEN_HEIGHT, + width: SCREEN_WIDTH +} = _reactNative.Dimensions.get('screen'); + +exports.SCREEN_WIDTH = SCREEN_WIDTH; +exports.SCREEN_HEIGHT = SCREEN_HEIGHT; +var GESTURE_SOURCE; +exports.GESTURE_SOURCE = GESTURE_SOURCE; + +(function (GESTURE_SOURCE) { + GESTURE_SOURCE[GESTURE_SOURCE["UNDETERMINED"] = 0] = "UNDETERMINED"; + GESTURE_SOURCE[GESTURE_SOURCE["SCROLLABLE"] = 1] = "SCROLLABLE"; + GESTURE_SOURCE[GESTURE_SOURCE["HANDLE"] = 2] = "HANDLE"; + GESTURE_SOURCE[GESTURE_SOURCE["CONTENT"] = 3] = "CONTENT"; +})(GESTURE_SOURCE || (exports.GESTURE_SOURCE = GESTURE_SOURCE = {})); + +var SHEET_STATE; +exports.SHEET_STATE = SHEET_STATE; + +(function (SHEET_STATE) { + SHEET_STATE[SHEET_STATE["CLOSED"] = 0] = "CLOSED"; + SHEET_STATE[SHEET_STATE["OPENED"] = 1] = "OPENED"; + SHEET_STATE[SHEET_STATE["EXTENDED"] = 2] = "EXTENDED"; + SHEET_STATE[SHEET_STATE["OVER_EXTENDED"] = 3] = "OVER_EXTENDED"; + SHEET_STATE[SHEET_STATE["FILL_PARENT"] = 4] = "FILL_PARENT"; +})(SHEET_STATE || (exports.SHEET_STATE = SHEET_STATE = {})); + +var SCROLLABLE_STATE; +exports.SCROLLABLE_STATE = SCROLLABLE_STATE; + +(function (SCROLLABLE_STATE) { + SCROLLABLE_STATE[SCROLLABLE_STATE["LOCKED"] = 0] = "LOCKED"; + SCROLLABLE_STATE[SCROLLABLE_STATE["UNLOCKED"] = 1] = "UNLOCKED"; + SCROLLABLE_STATE[SCROLLABLE_STATE["UNDETERMINED"] = 2] = "UNDETERMINED"; +})(SCROLLABLE_STATE || (exports.SCROLLABLE_STATE = SCROLLABLE_STATE = {})); + +var SCROLLABLE_TYPE; +exports.SCROLLABLE_TYPE = SCROLLABLE_TYPE; + +(function (SCROLLABLE_TYPE) { + SCROLLABLE_TYPE[SCROLLABLE_TYPE["UNDETERMINED"] = 0] = "UNDETERMINED"; + SCROLLABLE_TYPE[SCROLLABLE_TYPE["VIEW"] = 1] = "VIEW"; + SCROLLABLE_TYPE[SCROLLABLE_TYPE["FLATLIST"] = 2] = "FLATLIST"; + SCROLLABLE_TYPE[SCROLLABLE_TYPE["SCROLLVIEW"] = 3] = "SCROLLVIEW"; + SCROLLABLE_TYPE[SCROLLABLE_TYPE["SECTIONLIST"] = 4] = "SECTIONLIST"; + SCROLLABLE_TYPE[SCROLLABLE_TYPE["VIRTUALIZEDLIST"] = 5] = "VIRTUALIZEDLIST"; +})(SCROLLABLE_TYPE || (exports.SCROLLABLE_TYPE = SCROLLABLE_TYPE = {})); + +var ANIMATION_STATE; +exports.ANIMATION_STATE = ANIMATION_STATE; + +(function (ANIMATION_STATE) { + ANIMATION_STATE[ANIMATION_STATE["UNDETERMINED"] = 0] = "UNDETERMINED"; + ANIMATION_STATE[ANIMATION_STATE["RUNNING"] = 1] = "RUNNING"; + ANIMATION_STATE[ANIMATION_STATE["STOPPED"] = 2] = "STOPPED"; + ANIMATION_STATE[ANIMATION_STATE["INTERRUPTED"] = 3] = "INTERRUPTED"; +})(ANIMATION_STATE || (exports.ANIMATION_STATE = ANIMATION_STATE = {})); + +var ANIMATION_SOURCE; +exports.ANIMATION_SOURCE = ANIMATION_SOURCE; + +(function (ANIMATION_SOURCE) { + ANIMATION_SOURCE[ANIMATION_SOURCE["NONE"] = 0] = "NONE"; + ANIMATION_SOURCE[ANIMATION_SOURCE["MOUNT"] = 1] = "MOUNT"; + ANIMATION_SOURCE[ANIMATION_SOURCE["GESTURE"] = 2] = "GESTURE"; + ANIMATION_SOURCE[ANIMATION_SOURCE["USER"] = 3] = "USER"; + ANIMATION_SOURCE[ANIMATION_SOURCE["CONTAINER_RESIZE"] = 4] = "CONTAINER_RESIZE"; + ANIMATION_SOURCE[ANIMATION_SOURCE["SNAP_POINT_CHANGE"] = 5] = "SNAP_POINT_CHANGE"; + ANIMATION_SOURCE[ANIMATION_SOURCE["KEYBOARD"] = 6] = "KEYBOARD"; +})(ANIMATION_SOURCE || (exports.ANIMATION_SOURCE = ANIMATION_SOURCE = {})); + +var ANIMATION_METHOD; +exports.ANIMATION_METHOD = ANIMATION_METHOD; + +(function (ANIMATION_METHOD) { + ANIMATION_METHOD[ANIMATION_METHOD["TIMING"] = 0] = "TIMING"; + ANIMATION_METHOD[ANIMATION_METHOD["SPRING"] = 1] = "SPRING"; +})(ANIMATION_METHOD || (exports.ANIMATION_METHOD = ANIMATION_METHOD = {})); + +var KEYBOARD_STATE; +exports.KEYBOARD_STATE = KEYBOARD_STATE; + +(function (KEYBOARD_STATE) { + KEYBOARD_STATE[KEYBOARD_STATE["UNDETERMINED"] = 0] = "UNDETERMINED"; + KEYBOARD_STATE[KEYBOARD_STATE["SHOWN"] = 1] = "SHOWN"; + KEYBOARD_STATE[KEYBOARD_STATE["HIDDEN"] = 2] = "HIDDEN"; +})(KEYBOARD_STATE || (exports.KEYBOARD_STATE = KEYBOARD_STATE = {})); + +const ANIMATION_EASING = _reactNativeReanimated.Easing.out(_reactNativeReanimated.Easing.exp); + +exports.ANIMATION_EASING = ANIMATION_EASING; +const ANIMATION_DURATION = 250; +exports.ANIMATION_DURATION = ANIMATION_DURATION; +const ANIMATION_CONFIGS_IOS = { + damping: 500, + stiffness: 1000, + mass: 3, + overshootClamping: true, + restDisplacementThreshold: 10, + restSpeedThreshold: 10 +}; +const ANIMATION_CONFIGS_ANDROID = { + duration: ANIMATION_DURATION, + easing: ANIMATION_EASING +}; +const ANIMATION_CONFIGS = _reactNative.Platform.OS === 'ios' ? ANIMATION_CONFIGS_IOS : ANIMATION_CONFIGS_ANDROID; +exports.ANIMATION_CONFIGS = ANIMATION_CONFIGS; +const SCROLLABLE_DECELERATION_RATE_MAPPER = { + [SCROLLABLE_STATE.UNDETERMINED]: 0, + [SCROLLABLE_STATE.LOCKED]: 0, + [SCROLLABLE_STATE.UNLOCKED]: _reactNative.Platform.select({ + ios: 0.998, + android: 0.985, + default: 1 + }) +}; +exports.SCROLLABLE_DECELERATION_RATE_MAPPER = SCROLLABLE_DECELERATION_RATE_MAPPER; +const MODAL_STACK_BEHAVIOR = { + replace: 'replace', + push: 'push' +}; +exports.MODAL_STACK_BEHAVIOR = MODAL_STACK_BEHAVIOR; +const KEYBOARD_BEHAVIOR = { + interactive: 'interactive', + extend: 'extend', + fillParent: 'fillParent' +}; +exports.KEYBOARD_BEHAVIOR = KEYBOARD_BEHAVIOR; +const KEYBOARD_BLUR_BEHAVIOR = { + none: 'none', + restore: 'restore' +}; +exports.KEYBOARD_BLUR_BEHAVIOR = KEYBOARD_BLUR_BEHAVIOR; +const KEYBOARD_INPUT_MODE = { + adjustPan: 'adjustPan', + adjustResize: 'adjustResize' +}; +exports.KEYBOARD_INPUT_MODE = KEYBOARD_INPUT_MODE; +const KEYBOARD_DISMISS_THRESHOLD = 12.5; +exports.KEYBOARD_DISMISS_THRESHOLD = KEYBOARD_DISMISS_THRESHOLD; +//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/lib/commonjs/constants.js.map b/lib/commonjs/constants.js.map new file mode 100644 index 000000000..b2956a8ad --- /dev/null +++ b/lib/commonjs/constants.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["constants.ts"],"names":["height","WINDOW_HEIGHT","width","WINDOW_WIDTH","Dimensions","get","SCREEN_HEIGHT","SCREEN_WIDTH","GESTURE_SOURCE","SHEET_STATE","SCROLLABLE_STATE","SCROLLABLE_TYPE","ANIMATION_STATE","ANIMATION_SOURCE","ANIMATION_METHOD","KEYBOARD_STATE","ANIMATION_EASING","Easing","out","exp","ANIMATION_DURATION","ANIMATION_CONFIGS_IOS","damping","stiffness","mass","overshootClamping","restDisplacementThreshold","restSpeedThreshold","ANIMATION_CONFIGS_ANDROID","duration","easing","ANIMATION_CONFIGS","Platform","OS","SCROLLABLE_DECELERATION_RATE_MAPPER","UNDETERMINED","LOCKED","UNLOCKED","select","ios","android","default","MODAL_STACK_BEHAVIOR","replace","push","KEYBOARD_BEHAVIOR","interactive","extend","fillParent","KEYBOARD_BLUR_BEHAVIOR","none","restore","KEYBOARD_INPUT_MODE","adjustPan","adjustResize","KEYBOARD_DISMISS_THRESHOLD"],"mappings":";;;;;;;AAAA;;AACA;;AAEA,MAAM;AAAEA,EAAAA,MAAM,EAAEC,aAAV;AAAyBC,EAAAA,KAAK,EAAEC;AAAhC,IAAiDC,wBAAWC,GAAX,CAAe,QAAf,CAAvD;;;;;AACA,MAAM;AAAEL,EAAAA,MAAM,EAAEM,aAAV;AAAyBJ,EAAAA,KAAK,EAAEK;AAAhC,IAAiDH,wBAAWC,GAAX,CAAe,QAAf,CAAvD;;;;IAEKG,c;;;WAAAA,c;AAAAA,EAAAA,c,CAAAA,c;AAAAA,EAAAA,c,CAAAA,c;AAAAA,EAAAA,c,CAAAA,c;AAAAA,EAAAA,c,CAAAA,c;GAAAA,c,8BAAAA,c;;IAOAC,W;;;WAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;GAAAA,W,2BAAAA,W;;IAQAC,gB;;;WAAAA,gB;AAAAA,EAAAA,gB,CAAAA,gB;AAAAA,EAAAA,gB,CAAAA,gB;AAAAA,EAAAA,gB,CAAAA,gB;GAAAA,gB,gCAAAA,gB;;IAMAC,e;;;WAAAA,e;AAAAA,EAAAA,e,CAAAA,e;AAAAA,EAAAA,e,CAAAA,e;AAAAA,EA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,sBAASC,EAAT,KAAgB,KAAhB,GAAwBZ,qBAAxB,GAAgDO,yBADlD;;AAGA,MAAMM,mCAAmC,GAAG;AAC1C,GAACxB,gBAAgB,CAACyB,YAAlB,GAAiC,CADS;AAE1C,GAACzB,gBAAgB,CAAC0B,MAAlB,GAA2B,CAFe;AAG1C,GAAC1B,gBAAgB,CAAC2B,QAAlB,GAA6BL,sBAASM,MAAT,CAAgB;AAC3CC,IAAAA,GAAG,EAAE,KADsC;AAE3CC,IAAAA,OAAO,EAAE,KAFkC;AAG3CC,IAAAA,OAAO,EAAE;AAHkC,GAAhB;AAHa,CAA5C;;AAUA,MAAMC,oBAAoB,GAAG;AAC3BC,EAAAA,OAAO,EAAE,SADkB;AAE3BC,EAAAA,IAAI,EAAE;AAFqB,CAA7B;;AAKA,MAAMC,iBAAiB,GAAG;AACxBC,EAAAA,WAAW,EAAE,aADW;AAExBC,EAAAA,MAAM,EAAE,QAFgB;AAGxBC,EAAAA,UAAU,EAAE;AAHY,CAA1B;;AAMA,MAAMC,sBAAsB,GAAG;AAC7BC,EAAAA,IAAI,EAAE,MADuB;AAE7BC,EAAAA,OAAO,EAAE;AAFoB,CAA/B;;AAKA,MAAMC,mBAAmB,GAAG;AAC1BC,EAAAA,SAAS,EAAE,WADe;AAE1BC,EAAAA,YAAY,EAAE;AAFY,CAA5B;;AAKA,MAAMC,0BAA0B,GAAG,IAAnC","sourcesContent":["import { Dimensions, Platform } from 'react-native';\nimport Animated, { Easing } from 'react-native-reanimated';\n\nconst { height: WINDOW_HEIGHT, width: WINDOW_WIDTH } = Dimensions.get('window');\nconst { height: SCREEN_HEIGHT, width: SCREEN_WIDTH } = Dimensions.get('screen');\n\nenum GESTURE_SOURCE {\n UNDETERMINED = 0,\n SCROLLABLE,\n HANDLE,\n CONTENT,\n}\n\nenum SHEET_STATE {\n CLOSED = 0,\n OPENED,\n EXTENDED,\n OVER_EXTENDED,\n FILL_PARENT,\n}\n\nenum SCROLLABLE_STATE {\n LOCKED = 0,\n UNLOCKED,\n UNDETERMINED,\n}\n\nenum SCROLLABLE_TYPE {\n UNDETERMINED = 0,\n VIEW,\n FLATLIST,\n SCROLLVIEW,\n SECTIONLIST,\n VIRTUALIZEDLIST,\n}\n\nenum ANIMATION_STATE {\n UNDETERMINED = 0,\n RUNNING,\n STOPPED,\n INTERRUPTED,\n}\n\nenum ANIMATION_SOURCE {\n NONE = 0,\n MOUNT,\n GESTURE,\n USER,\n CONTAINER_RESIZE,\n SNAP_POINT_CHANGE,\n KEYBOARD,\n}\n\nenum ANIMATION_METHOD {\n TIMING,\n SPRING,\n}\n\nenum KEYBOARD_STATE {\n UNDETERMINED = 0,\n SHOWN,\n HIDDEN,\n}\n\nconst ANIMATION_EASING: Animated.EasingFunction = Easing.out(Easing.exp);\nconst ANIMATION_DURATION = 250;\n\nconst ANIMATION_CONFIGS_IOS = {\n damping: 500,\n stiffness: 1000,\n mass: 3,\n overshootClamping: true,\n restDisplacementThreshold: 10,\n restSpeedThreshold: 10,\n};\n\nconst ANIMATION_CONFIGS_ANDROID = {\n duration: ANIMATION_DURATION,\n easing: ANIMATION_EASING,\n};\n\nconst ANIMATION_CONFIGS =\n Platform.OS === 'ios' ? ANIMATION_CONFIGS_IOS : ANIMATION_CONFIGS_ANDROID;\n\nconst SCROLLABLE_DECELERATION_RATE_MAPPER = {\n [SCROLLABLE_STATE.UNDETERMINED]: 0,\n [SCROLLABLE_STATE.LOCKED]: 0,\n [SCROLLABLE_STATE.UNLOCKED]: Platform.select({\n ios: 0.998,\n android: 0.985,\n default: 1,\n }),\n};\n\nconst MODAL_STACK_BEHAVIOR = {\n replace: 'replace',\n push: 'push',\n};\n\nconst KEYBOARD_BEHAVIOR = {\n interactive: 'interactive',\n extend: 'extend',\n fillParent: 'fillParent',\n} as const;\n\nconst KEYBOARD_BLUR_BEHAVIOR = {\n none: 'none',\n restore: 'restore',\n} as const;\n\nconst KEYBOARD_INPUT_MODE = {\n adjustPan: 'adjustPan',\n adjustResize: 'adjustResize',\n} as const;\n\nconst KEYBOARD_DISMISS_THRESHOLD = 12.5;\n\nexport {\n GESTURE_SOURCE,\n SHEET_STATE,\n ANIMATION_STATE,\n ANIMATION_METHOD,\n ANIMATION_SOURCE,\n SCROLLABLE_TYPE,\n SCROLLABLE_STATE,\n KEYBOARD_STATE,\n WINDOW_HEIGHT,\n WINDOW_WIDTH,\n SCREEN_HEIGHT,\n SCREEN_WIDTH,\n SCROLLABLE_DECELERATION_RATE_MAPPER,\n MODAL_STACK_BEHAVIOR,\n KEYBOARD_BEHAVIOR,\n KEYBOARD_BLUR_BEHAVIOR,\n KEYBOARD_INPUT_MODE,\n KEYBOARD_DISMISS_THRESHOLD,\n ANIMATION_CONFIGS,\n ANIMATION_EASING,\n ANIMATION_DURATION,\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/contexts/external.js b/lib/commonjs/contexts/external.js new file mode 100644 index 000000000..3722572ca --- /dev/null +++ b/lib/commonjs/contexts/external.js @@ -0,0 +1,14 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.BottomSheetProvider = exports.BottomSheetContext = void 0; + +var _react = require("react"); + +const BottomSheetContext = /*#__PURE__*/(0, _react.createContext)(null); +exports.BottomSheetContext = BottomSheetContext; +const BottomSheetProvider = BottomSheetContext.Provider; +exports.BottomSheetProvider = BottomSheetProvider; +//# sourceMappingURL=external.js.map \ No newline at end of file diff --git a/lib/commonjs/contexts/external.js.map b/lib/commonjs/contexts/external.js.map new file mode 100644 index 000000000..2da2b7655 --- /dev/null +++ b/lib/commonjs/contexts/external.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["external.ts"],"names":["BottomSheetContext","BottomSheetProvider","Provider"],"mappings":";;;;;;;AAAA;;AAGO,MAAMA,kBAAkB,gBAAG,0BAEhC,IAFgC,CAA3B;;AAIA,MAAMC,mBAAmB,GAAGD,kBAAkB,CAACE,QAA/C","sourcesContent":["import { createContext } from 'react';\nimport type { BottomSheetMethods, BottomSheetVariables } from '../types';\n\nexport const BottomSheetContext = createContext<\n (BottomSheetMethods & BottomSheetVariables) | null\n>(null);\n\nexport const BottomSheetProvider = BottomSheetContext.Provider;\n"]} \ No newline at end of file diff --git a/lib/commonjs/contexts/gesture.js b/lib/commonjs/contexts/gesture.js new file mode 100644 index 000000000..67d702039 --- /dev/null +++ b/lib/commonjs/contexts/gesture.js @@ -0,0 +1,12 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.BottomSheetGestureHandlersContext = void 0; + +var _react = require("react"); + +const BottomSheetGestureHandlersContext = /*#__PURE__*/(0, _react.createContext)(null); +exports.BottomSheetGestureHandlersContext = BottomSheetGestureHandlersContext; +//# sourceMappingURL=gesture.js.map \ No newline at end of file diff --git a/lib/commonjs/contexts/gesture.js.map b/lib/commonjs/contexts/gesture.js.map new file mode 100644 index 000000000..fd960983a --- /dev/null +++ b/lib/commonjs/contexts/gesture.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["gesture.ts"],"names":["BottomSheetGestureHandlersContext"],"mappings":";;;;;;;AAAA;;AASO,MAAMA,iCAAiC,gBAC5C,0BAA4D,IAA5D,CADK","sourcesContent":["import { createContext } from 'react';\nimport type { PanGestureHandlerGestureEvent } from 'react-native-gesture-handler';\n\nexport interface BottomSheetGestureHandlersContextType {\n contentPanGestureHandler: (event: PanGestureHandlerGestureEvent) => void;\n handlePanGestureHandler: (event: PanGestureHandlerGestureEvent) => void;\n scrollablePanGestureHandler: (event: PanGestureHandlerGestureEvent) => void;\n}\n\nexport const BottomSheetGestureHandlersContext =\n createContext(null);\n"]} \ No newline at end of file diff --git a/lib/commonjs/contexts/index.js b/lib/commonjs/contexts/index.js new file mode 100644 index 000000000..42763baaf --- /dev/null +++ b/lib/commonjs/contexts/index.js @@ -0,0 +1,70 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "BottomSheetContext", { + enumerable: true, + get: function () { + return _external.BottomSheetContext; + } +}); +Object.defineProperty(exports, "BottomSheetProvider", { + enumerable: true, + get: function () { + return _external.BottomSheetProvider; + } +}); +Object.defineProperty(exports, "BottomSheetInternalContext", { + enumerable: true, + get: function () { + return _internal.BottomSheetInternalContext; + } +}); +Object.defineProperty(exports, "BottomSheetInternalProvider", { + enumerable: true, + get: function () { + return _internal.BottomSheetInternalProvider; + } +}); +Object.defineProperty(exports, "BottomSheetGestureHandlersContext", { + enumerable: true, + get: function () { + return _gesture.BottomSheetGestureHandlersContext; + } +}); +Object.defineProperty(exports, "BottomSheetModalContext", { + enumerable: true, + get: function () { + return _external2.BottomSheetModalContext; + } +}); +Object.defineProperty(exports, "BottomSheetModalProvider", { + enumerable: true, + get: function () { + return _external2.BottomSheetModalProvider; + } +}); +Object.defineProperty(exports, "BottomSheetModalInternalContext", { + enumerable: true, + get: function () { + return _internal2.BottomSheetModalInternalContext; + } +}); +Object.defineProperty(exports, "BottomSheetModalInternalProvider", { + enumerable: true, + get: function () { + return _internal2.BottomSheetModalInternalProvider; + } +}); + +var _external = require("./external"); + +var _internal = require("./internal"); + +var _gesture = require("./gesture"); + +var _external2 = require("./modal/external"); + +var _internal2 = require("./modal/internal"); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/contexts/index.js.map b/lib/commonjs/contexts/index.js.map new file mode 100644 index 000000000..cf72fdee3 --- /dev/null +++ b/lib/commonjs/contexts/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAIA;;AACA;;AAIA","sourcesContent":["export { BottomSheetContext, BottomSheetProvider } from './external';\nexport {\n BottomSheetInternalContext,\n BottomSheetInternalProvider,\n} from './internal';\nexport { BottomSheetGestureHandlersContext } from './gesture';\nexport {\n BottomSheetModalContext,\n BottomSheetModalProvider,\n} from './modal/external';\nexport {\n BottomSheetModalInternalContext,\n BottomSheetModalInternalProvider,\n} from './modal/internal';\nexport type { BottomSheetModalInternalContextType } from './modal/internal';\n"]} \ No newline at end of file diff --git a/lib/commonjs/contexts/internal.js b/lib/commonjs/contexts/internal.js new file mode 100644 index 000000000..51de8ae8b --- /dev/null +++ b/lib/commonjs/contexts/internal.js @@ -0,0 +1,14 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.BottomSheetInternalProvider = exports.BottomSheetInternalContext = void 0; + +var _react = require("react"); + +const BottomSheetInternalContext = /*#__PURE__*/(0, _react.createContext)(null); +exports.BottomSheetInternalContext = BottomSheetInternalContext; +const BottomSheetInternalProvider = BottomSheetInternalContext.Provider; +exports.BottomSheetInternalProvider = BottomSheetInternalProvider; +//# sourceMappingURL=internal.js.map \ No newline at end of file diff --git a/lib/commonjs/contexts/internal.js.map b/lib/commonjs/contexts/internal.js.map new file mode 100644 index 000000000..d0b307ed8 --- /dev/null +++ b/lib/commonjs/contexts/internal.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["internal.ts"],"names":["BottomSheetInternalContext","BottomSheetInternalProvider","Provider"],"mappings":";;;;;;;AAAA;;AA0EO,MAAMA,0BAA0B,gBACrC,0BAAqD,IAArD,CADK;;AAGA,MAAMC,2BAA2B,GAAGD,0BAA0B,CAACE,QAA/D","sourcesContent":["import { createContext, RefObject } from 'react';\nimport type {\n PanGestureHandlerProps,\n State,\n} from 'react-native-gesture-handler';\nimport type Animated from 'react-native-reanimated';\nimport type {\n AnimateToPositionType,\n BottomSheetProps,\n} from '../components/bottomSheet/types';\nimport type {\n ANIMATION_STATE,\n KEYBOARD_STATE,\n SCROLLABLE_STATE,\n SCROLLABLE_TYPE,\n SHEET_STATE,\n} from '../constants';\nimport type { Scrollable, ScrollableRef } from '../types';\n\nexport interface BottomSheetInternalContextType\n extends Pick<\n PanGestureHandlerProps,\n | 'activeOffsetY'\n | 'activeOffsetX'\n | 'failOffsetY'\n | 'failOffsetX'\n | 'waitFor'\n | 'simultaneousHandlers'\n >,\n Required<\n Pick<\n BottomSheetProps,\n | 'enableContentPanningGesture'\n | 'enableOverDrag'\n | 'enablePanDownToClose'\n | 'enableDynamicSizing'\n | 'overDragResistanceFactor'\n >\n > {\n // animated states\n animatedAnimationState: Animated.SharedValue;\n animatedSheetState: Animated.SharedValue;\n animatedScrollableState: Animated.SharedValue;\n animatedKeyboardState: Animated.SharedValue;\n animatedContentGestureState: Animated.SharedValue;\n animatedHandleGestureState: Animated.SharedValue;\n\n // animated values\n animatedSnapPoints: Animated.SharedValue;\n animatedPosition: Animated.SharedValue;\n animatedIndex: Animated.SharedValue;\n animatedContainerHeight: Animated.SharedValue;\n animatedContentHeight: Animated.SharedValue;\n animatedHighestSnapPoint: Animated.SharedValue;\n animatedClosedPosition: Animated.SharedValue;\n animatedFooterHeight: Animated.SharedValue;\n animatedHandleHeight: Animated.SharedValue;\n animatedKeyboardHeight: Animated.SharedValue;\n animatedKeyboardHeightInContainer: Animated.SharedValue;\n animatedScrollableType: Animated.SharedValue;\n animatedScrollableContentOffsetY: Animated.SharedValue;\n animatedScrollableOverrideState: Animated.SharedValue;\n isScrollableRefreshable: Animated.SharedValue;\n isContentHeightFixed: Animated.SharedValue;\n isInTemporaryPosition: Animated.SharedValue;\n shouldHandleKeyboardEvents: Animated.SharedValue;\n\n // methods\n stopAnimation: () => void;\n animateToPosition: AnimateToPositionType;\n setScrollableRef: (ref: ScrollableRef) => void;\n removeScrollableRef: (ref: RefObject) => void;\n}\n\nexport const BottomSheetInternalContext =\n createContext(null);\n\nexport const BottomSheetInternalProvider = BottomSheetInternalContext.Provider;\n"]} \ No newline at end of file diff --git a/lib/commonjs/contexts/modal/external.js b/lib/commonjs/contexts/modal/external.js new file mode 100644 index 000000000..f62ed52c5 --- /dev/null +++ b/lib/commonjs/contexts/modal/external.js @@ -0,0 +1,14 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.BottomSheetModalProvider = exports.BottomSheetModalContext = void 0; + +var _react = require("react"); + +const BottomSheetModalContext = /*#__PURE__*/(0, _react.createContext)(null); +exports.BottomSheetModalContext = BottomSheetModalContext; +const BottomSheetModalProvider = BottomSheetModalContext.Provider; +exports.BottomSheetModalProvider = BottomSheetModalProvider; +//# sourceMappingURL=external.js.map \ No newline at end of file diff --git a/lib/commonjs/contexts/modal/external.js.map b/lib/commonjs/contexts/modal/external.js.map new file mode 100644 index 000000000..c16297405 --- /dev/null +++ b/lib/commonjs/contexts/modal/external.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["external.ts"],"names":["BottomSheetModalContext","BottomSheetModalProvider","Provider"],"mappings":";;;;;;;AAAA;;AAOO,MAAMA,uBAAuB,gBAClC,0BAAkD,IAAlD,CADK;;AAGA,MAAMC,wBAAwB,GAAGD,uBAAuB,CAACE,QAAzD","sourcesContent":["import { createContext } from 'react';\n\nexport interface BottomSheetModalContextType {\n dismiss: (key?: string) => boolean;\n dismissAll: () => void;\n}\n\nexport const BottomSheetModalContext =\n createContext(null);\n\nexport const BottomSheetModalProvider = BottomSheetModalContext.Provider;\n"]} \ No newline at end of file diff --git a/lib/commonjs/contexts/modal/internal.js b/lib/commonjs/contexts/modal/internal.js new file mode 100644 index 000000000..9dce3a42b --- /dev/null +++ b/lib/commonjs/contexts/modal/internal.js @@ -0,0 +1,14 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.BottomSheetModalInternalProvider = exports.BottomSheetModalInternalContext = void 0; + +var _react = require("react"); + +const BottomSheetModalInternalContext = /*#__PURE__*/(0, _react.createContext)(null); +exports.BottomSheetModalInternalContext = BottomSheetModalInternalContext; +const BottomSheetModalInternalProvider = BottomSheetModalInternalContext.Provider; +exports.BottomSheetModalInternalProvider = BottomSheetModalInternalProvider; +//# sourceMappingURL=internal.js.map \ No newline at end of file diff --git a/lib/commonjs/contexts/modal/internal.js.map b/lib/commonjs/contexts/modal/internal.js.map new file mode 100644 index 000000000..264579afe --- /dev/null +++ b/lib/commonjs/contexts/modal/internal.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["internal.ts"],"names":["BottomSheetModalInternalContext","BottomSheetModalInternalProvider","Provider"],"mappings":";;;;;;;AAAA;;AAkBO,MAAMA,+BAA+B,gBAC1C,0BAA0D,IAA1D,CADK;;AAGA,MAAMC,gCAAgC,GAC3CD,+BAA+B,CAACE,QAD3B","sourcesContent":["import { createContext, Ref } from 'react';\nimport type { Insets } from 'react-native';\nimport type Animated from 'react-native-reanimated';\nimport type BottomSheet from '../../components/bottomSheet';\nimport type { BottomSheetModalStackBehavior } from '../../components/bottomSheetModal';\n\nexport interface BottomSheetModalInternalContextType {\n containerHeight: Animated.SharedValue;\n containerOffset: Animated.SharedValue>;\n mountSheet: (\n key: string,\n ref: Ref,\n stackBehavior: BottomSheetModalStackBehavior\n ) => void;\n unmountSheet: (key: string) => void;\n willUnmountSheet: (key: string) => void;\n}\n\nexport const BottomSheetModalInternalContext =\n createContext(null);\n\nexport const BottomSheetModalInternalProvider =\n BottomSheetModalInternalContext.Provider;\n"]} \ No newline at end of file diff --git a/lib/commonjs/hooks/index.js b/lib/commonjs/hooks/index.js new file mode 100644 index 000000000..ce8107878 --- /dev/null +++ b/lib/commonjs/hooks/index.js @@ -0,0 +1,134 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "useBottomSheet", { + enumerable: true, + get: function () { + return _useBottomSheet.useBottomSheet; + } +}); +Object.defineProperty(exports, "useBottomSheetInternal", { + enumerable: true, + get: function () { + return _useBottomSheetInternal.useBottomSheetInternal; + } +}); +Object.defineProperty(exports, "useBottomSheetModal", { + enumerable: true, + get: function () { + return _useBottomSheetModal.useBottomSheetModal; + } +}); +Object.defineProperty(exports, "useBottomSheetModalInternal", { + enumerable: true, + get: function () { + return _useBottomSheetModalInternal.useBottomSheetModalInternal; + } +}); +Object.defineProperty(exports, "useScrollable", { + enumerable: true, + get: function () { + return _useScrollable.useScrollable; + } +}); +Object.defineProperty(exports, "useScrollableSetter", { + enumerable: true, + get: function () { + return _useScrollableSetter.useScrollableSetter; + } +}); +Object.defineProperty(exports, "useScrollHandler", { + enumerable: true, + get: function () { + return _useScrollHandler.useScrollHandler; + } +}); +Object.defineProperty(exports, "useGestureHandler", { + enumerable: true, + get: function () { + return _useGestureHandler.useGestureHandler; + } +}); +Object.defineProperty(exports, "useGestureEventsHandlersDefault", { + enumerable: true, + get: function () { + return _useGestureEventsHandlersDefault.useGestureEventsHandlersDefault; + } +}); +Object.defineProperty(exports, "useKeyboard", { + enumerable: true, + get: function () { + return _useKeyboard.useKeyboard; + } +}); +Object.defineProperty(exports, "useStableCallback", { + enumerable: true, + get: function () { + return _useStableCallback.useStableCallback; + } +}); +Object.defineProperty(exports, "usePropsValidator", { + enumerable: true, + get: function () { + return _usePropsValidator.usePropsValidator; + } +}); +Object.defineProperty(exports, "useNormalizedSnapPoints", { + enumerable: true, + get: function () { + return _useNormalizedSnapPoints.useNormalizedSnapPoints; + } +}); +Object.defineProperty(exports, "useReactiveSharedValue", { + enumerable: true, + get: function () { + return _useReactiveSharedValue.useReactiveSharedValue; + } +}); +Object.defineProperty(exports, "useBottomSheetDynamicSnapPoints", { + enumerable: true, + get: function () { + return _useBottomSheetDynamicSnapPoints.useBottomSheetDynamicSnapPoints; + } +}); +Object.defineProperty(exports, "useBottomSheetGestureHandlers", { + enumerable: true, + get: function () { + return _useBottomSheetGestureHandlers.useBottomSheetGestureHandlers; + } +}); + +var _useBottomSheet = require("./useBottomSheet"); + +var _useBottomSheetInternal = require("./useBottomSheetInternal"); + +var _useBottomSheetModal = require("./useBottomSheetModal"); + +var _useBottomSheetModalInternal = require("./useBottomSheetModalInternal"); + +var _useScrollable = require("./useScrollable"); + +var _useScrollableSetter = require("./useScrollableSetter"); + +var _useScrollHandler = require("./useScrollHandler"); + +var _useGestureHandler = require("./useGestureHandler"); + +var _useGestureEventsHandlersDefault = require("./useGestureEventsHandlersDefault"); + +var _useKeyboard = require("./useKeyboard"); + +var _useStableCallback = require("./useStableCallback"); + +var _usePropsValidator = require("./usePropsValidator"); + +var _useNormalizedSnapPoints = require("./useNormalizedSnapPoints"); + +var _useReactiveSharedValue = require("./useReactiveSharedValue"); + +var _useBottomSheetDynamicSnapPoints = require("./useBottomSheetDynamicSnapPoints"); + +var _useBottomSheetGestureHandlers = require("./useBottomSheetGestureHandlers"); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/hooks/index.js.map b/lib/commonjs/hooks/index.js.map new file mode 100644 index 000000000..d1453a553 --- /dev/null +++ b/lib/commonjs/hooks/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAGA;;AACA;;AAGA;;AACA;;AACA;;AAGA;;AACA;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA","sourcesContent":["export { useBottomSheet } from './useBottomSheet';\nexport { useBottomSheetInternal } from './useBottomSheetInternal';\n\n// modal\nexport { useBottomSheetModal } from './useBottomSheetModal';\nexport { useBottomSheetModalInternal } from './useBottomSheetModalInternal';\n\n// scrollable\nexport { useScrollable } from './useScrollable';\nexport { useScrollableSetter } from './useScrollableSetter';\nexport { useScrollHandler } from './useScrollHandler';\n\n// gestures\nexport { useGestureHandler } from './useGestureHandler';\nexport { useGestureEventsHandlersDefault } from './useGestureEventsHandlersDefault';\n\n// utilities\nexport { useKeyboard } from './useKeyboard';\nexport { useStableCallback } from './useStableCallback';\nexport { usePropsValidator } from './usePropsValidator';\nexport { useNormalizedSnapPoints } from './useNormalizedSnapPoints';\nexport { useReactiveSharedValue } from './useReactiveSharedValue';\nexport { useBottomSheetDynamicSnapPoints } from './useBottomSheetDynamicSnapPoints';\nexport { useBottomSheetGestureHandlers } from './useBottomSheetGestureHandlers';\n"]} \ No newline at end of file diff --git a/lib/commonjs/hooks/useBottomSheet.js b/lib/commonjs/hooks/useBottomSheet.js new file mode 100644 index 000000000..35c3ceb50 --- /dev/null +++ b/lib/commonjs/hooks/useBottomSheet.js @@ -0,0 +1,23 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.useBottomSheet = void 0; + +var _react = require("react"); + +var _external = require("../contexts/external"); + +const useBottomSheet = () => { + const context = (0, _react.useContext)(_external.BottomSheetContext); + + if (context === null) { + throw "'useBottomSheet' cannot be used out of the BottomSheet!"; + } + + return context; +}; + +exports.useBottomSheet = useBottomSheet; +//# sourceMappingURL=useBottomSheet.js.map \ No newline at end of file diff --git a/lib/commonjs/hooks/useBottomSheet.js.map b/lib/commonjs/hooks/useBottomSheet.js.map new file mode 100644 index 000000000..d28ec749d --- /dev/null +++ b/lib/commonjs/hooks/useBottomSheet.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["useBottomSheet.ts"],"names":["useBottomSheet","context","BottomSheetContext"],"mappings":";;;;;;;AAAA;;AACA;;AAEO,MAAMA,cAAc,GAAG,MAAM;AAClC,QAAMC,OAAO,GAAG,uBAAWC,4BAAX,CAAhB;;AAEA,MAAID,OAAO,KAAK,IAAhB,EAAsB;AACpB,UAAM,yDAAN;AACD;;AAED,SAAOA,OAAP;AACD,CARM","sourcesContent":["import { useContext } from 'react';\nimport { BottomSheetContext } from '../contexts/external';\n\nexport const useBottomSheet = () => {\n const context = useContext(BottomSheetContext);\n\n if (context === null) {\n throw \"'useBottomSheet' cannot be used out of the BottomSheet!\";\n }\n\n return context;\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/hooks/useBottomSheetDynamicSnapPoints.js b/lib/commonjs/hooks/useBottomSheetDynamicSnapPoints.js new file mode 100644 index 000000000..eab98ec21 --- /dev/null +++ b/lib/commonjs/hooks/useBottomSheetDynamicSnapPoints.js @@ -0,0 +1,64 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.useBottomSheetDynamicSnapPoints = void 0; + +var _react = require("react"); + +var _reactNativeReanimated = require("react-native-reanimated"); + +var _constants = require("../components/bottomSheet/constants"); + +/** + * Provides dynamic content height calculating functionalities, by + * replacing the placeholder `CONTENT_HEIGHT` with calculated layout. + * @example + * [0, 'CONTENT_HEIGHT', '100%'] + * @param initialSnapPoints your snap point with content height placeholder. + * @returns { + * - animatedSnapPoints: an animated snap points to be set on `BottomSheet` or `BottomSheetModal`. + * - animatedHandleHeight: an animated handle height callback node to be set on `BottomSheet` or `BottomSheetModal`. + * - animatedContentHeight: an animated content height callback node to be set on `BottomSheet` or `BottomSheetModal`. + * - handleContentLayout: a `onLayout` callback method to be set on `BottomSheetView` component. + * } + * @deprecated will be deprecated in the next major release! please use the new introduce prop `enableDynamicSizing`. + */ +const useBottomSheetDynamicSnapPoints = initialSnapPoints => { + // variables + const animatedContentHeight = (0, _reactNativeReanimated.useSharedValue)(0); + const animatedHandleHeight = (0, _reactNativeReanimated.useSharedValue)(_constants.INITIAL_HANDLE_HEIGHT); + const animatedSnapPoints = (0, _reactNativeReanimated.useDerivedValue)(() => { + if (animatedHandleHeight.value === _constants.INITIAL_HANDLE_HEIGHT || animatedContentHeight.value === 0) { + return initialSnapPoints.map(() => _constants.INITIAL_SNAP_POINT); + } + + const contentWithHandleHeight = animatedContentHeight.value + animatedHandleHeight.value; + return initialSnapPoints.map(snapPoint => snapPoint === 'CONTENT_HEIGHT' ? contentWithHandleHeight : snapPoint); + }, []); + // callbacks + const handleContentLayout = (0, _react.useCallback)(({ + nativeEvent: { + layout: { + height + } + } + }) => { + animatedContentHeight.value = height; + }, [animatedContentHeight]); //#region effects + + (0, _react.useEffect)(() => { + console.warn('`useBottomSheetDynamicSnapPoints` will be deprecated in the next major release! please use the new introduce prop `enableDynamicSizing`.'); + }, []); //#endregion + + return { + animatedSnapPoints, + animatedHandleHeight, + animatedContentHeight, + handleContentLayout + }; +}; + +exports.useBottomSheetDynamicSnapPoints = useBottomSheetDynamicSnapPoints; +//# sourceMappingURL=useBottomSheetDynamicSnapPoints.js.map \ No newline at end of file diff --git a/lib/commonjs/hooks/useBottomSheetDynamicSnapPoints.js.map b/lib/commonjs/hooks/useBottomSheetDynamicSnapPoints.js.map new file mode 100644 index 000000000..2b08e6d6b --- /dev/null +++ b/lib/commonjs/hooks/useBottomSheetDynamicSnapPoints.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["useBottomSheetDynamicSnapPoints.ts"],"names":["useBottomSheetDynamicSnapPoints","initialSnapPoints","animatedContentHeight","animatedHandleHeight","INITIAL_HANDLE_HEIGHT","animatedSnapPoints","value","map","INITIAL_SNAP_POINT","contentWithHandleHeight","snapPoint","handleContentLayout","nativeEvent","layout","height","console","warn"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,+BAA+B,GAC1CC,iBAD6C,IAE1C;AACH;AACA,QAAMC,qBAAqB,GAAG,2CAAe,CAAf,CAA9B;AACA,QAAMC,oBAAoB,GAAG,2CAAeC,gCAAf,CAA7B;AACA,QAAMC,kBAAkB,GAAG,4CAAgB,MAAM;AAC/C,QACEF,oBAAoB,CAACG,KAArB,KAA+BF,gCAA/B,IACAF,qBAAqB,CAACI,KAAtB,KAAgC,CAFlC,EAGE;AACA,aAAOL,iBAAiB,CAACM,GAAlB,CAAsB,MAAMC,6BAA5B,CAAP;AACD;;AACD,UAAMC,uBAAuB,GAC3BP,qBAAqB,CAACI,KAAtB,GAA8BH,oBAAoB,CAACG,KADrD;AAGA,WAAOL,iBAAiB,CAACM,GAAlB,CAAsBG,SAAS,IACpCA,SAAS,KAAK,gBAAd,GAAiCD,uBAAjC,GAA2DC,SADtD,CAAP;AAGD,GAb0B,EAaxB,EAbwB,CAA3B;AAoBA;AACA,QAAMC,mBAAmB,GAAG,wBAC1B,CAAC;AACCC,IAAAA,WAAW,EAAE;AACXC,MAAAA,MAAM,EAAE;AAAEC,QAAAA;AAAF;AADG;AADd,GAAD,KAIgC;AAC9BZ,IAAAA,qBAAqB,CAACI,KAAtB,GAA8BQ,MAA9B;AACD,GAPyB,EAQ1B,CAACZ,qBAAD,CAR0B,CAA5B,CAzBG,CAoCH;;AACA,wBAAU,MAAM;AACda,IAAAA,OAAO,CAACC,IAAR,CACE,0IADF;AAGD,GAJD,EAIG,EAJH,EArCG,CA0CH;;AACA,SAAO;AACLX,IAAAA,kBADK;AAELF,IAAAA,oBAFK;AAGLD,IAAAA,qBAHK;AAILS,IAAAA;AAJK,GAAP;AAMD,CAnDM","sourcesContent":["import { useCallback, useEffect } from 'react';\nimport { useDerivedValue, useSharedValue } from 'react-native-reanimated';\nimport {\n INITIAL_HANDLE_HEIGHT,\n INITIAL_SNAP_POINT,\n} from '../components/bottomSheet/constants';\n\n/**\n * Provides dynamic content height calculating functionalities, by\n * replacing the placeholder `CONTENT_HEIGHT` with calculated layout.\n * @example\n * [0, 'CONTENT_HEIGHT', '100%']\n * @param initialSnapPoints your snap point with content height placeholder.\n * @returns {\n * - animatedSnapPoints: an animated snap points to be set on `BottomSheet` or `BottomSheetModal`.\n * - animatedHandleHeight: an animated handle height callback node to be set on `BottomSheet` or `BottomSheetModal`.\n * - animatedContentHeight: an animated content height callback node to be set on `BottomSheet` or `BottomSheetModal`.\n * - handleContentLayout: a `onLayout` callback method to be set on `BottomSheetView` component.\n * }\n * @deprecated will be deprecated in the next major release! please use the new introduce prop `enableDynamicSizing`.\n */\nexport const useBottomSheetDynamicSnapPoints = (\n initialSnapPoints: Array\n) => {\n // variables\n const animatedContentHeight = useSharedValue(0);\n const animatedHandleHeight = useSharedValue(INITIAL_HANDLE_HEIGHT);\n const animatedSnapPoints = useDerivedValue(() => {\n if (\n animatedHandleHeight.value === INITIAL_HANDLE_HEIGHT ||\n animatedContentHeight.value === 0\n ) {\n return initialSnapPoints.map(() => INITIAL_SNAP_POINT);\n }\n const contentWithHandleHeight =\n animatedContentHeight.value + animatedHandleHeight.value;\n\n return initialSnapPoints.map(snapPoint =>\n snapPoint === 'CONTENT_HEIGHT' ? contentWithHandleHeight : snapPoint\n );\n }, []);\n\n type HandleContentLayoutProps = {\n nativeEvent: {\n layout: { height: number };\n };\n };\n // callbacks\n const handleContentLayout = useCallback(\n ({\n nativeEvent: {\n layout: { height },\n },\n }: HandleContentLayoutProps) => {\n animatedContentHeight.value = height;\n },\n [animatedContentHeight]\n );\n\n //#region effects\n useEffect(() => {\n console.warn(\n '`useBottomSheetDynamicSnapPoints` will be deprecated in the next major release! please use the new introduce prop `enableDynamicSizing`.'\n );\n }, []);\n //#endregion\n return {\n animatedSnapPoints,\n animatedHandleHeight,\n animatedContentHeight,\n handleContentLayout,\n };\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/hooks/useBottomSheetGestureHandlers.js b/lib/commonjs/hooks/useBottomSheetGestureHandlers.js new file mode 100644 index 000000000..c0a4341cc --- /dev/null +++ b/lib/commonjs/hooks/useBottomSheetGestureHandlers.js @@ -0,0 +1,23 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.useBottomSheetGestureHandlers = void 0; + +var _react = require("react"); + +var _gesture = require("../contexts/gesture"); + +const useBottomSheetGestureHandlers = () => { + const context = (0, _react.useContext)(_gesture.BottomSheetGestureHandlersContext); + + if (context === null) { + throw "'useBottomSheetGestureHandlers' cannot be used out of the BottomSheet!"; + } + + return context; +}; + +exports.useBottomSheetGestureHandlers = useBottomSheetGestureHandlers; +//# sourceMappingURL=useBottomSheetGestureHandlers.js.map \ No newline at end of file diff --git a/lib/commonjs/hooks/useBottomSheetGestureHandlers.js.map b/lib/commonjs/hooks/useBottomSheetGestureHandlers.js.map new file mode 100644 index 000000000..335d2141e --- /dev/null +++ b/lib/commonjs/hooks/useBottomSheetGestureHandlers.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["useBottomSheetGestureHandlers.ts"],"names":["useBottomSheetGestureHandlers","context","BottomSheetGestureHandlersContext"],"mappings":";;;;;;;AAAA;;AACA;;AAEO,MAAMA,6BAA6B,GAAG,MAAM;AACjD,QAAMC,OAAO,GAAG,uBAAWC,0CAAX,CAAhB;;AAEA,MAAID,OAAO,KAAK,IAAhB,EAAsB;AACpB,UAAM,wEAAN;AACD;;AAED,SAAOA,OAAP;AACD,CARM","sourcesContent":["import { useContext } from 'react';\nimport { BottomSheetGestureHandlersContext } from '../contexts/gesture';\n\nexport const useBottomSheetGestureHandlers = () => {\n const context = useContext(BottomSheetGestureHandlersContext);\n\n if (context === null) {\n throw \"'useBottomSheetGestureHandlers' cannot be used out of the BottomSheet!\";\n }\n\n return context;\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/hooks/useBottomSheetInternal.js b/lib/commonjs/hooks/useBottomSheetInternal.js new file mode 100644 index 000000000..1ba310a08 --- /dev/null +++ b/lib/commonjs/hooks/useBottomSheetInternal.js @@ -0,0 +1,21 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.useBottomSheetInternal = useBottomSheetInternal; + +var _react = require("react"); + +var _internal = require("../contexts/internal"); + +function useBottomSheetInternal(unsafe) { + const context = (0, _react.useContext)(_internal.BottomSheetInternalContext); + + if (unsafe !== true && context === null) { + throw "'useBottomSheetInternal' cannot be used out of the BottomSheet!"; + } + + return context; +} +//# sourceMappingURL=useBottomSheetInternal.js.map \ No newline at end of file diff --git a/lib/commonjs/hooks/useBottomSheetInternal.js.map b/lib/commonjs/hooks/useBottomSheetInternal.js.map new file mode 100644 index 000000000..c6b40bf10 --- /dev/null +++ b/lib/commonjs/hooks/useBottomSheetInternal.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["useBottomSheetInternal.ts"],"names":["useBottomSheetInternal","unsafe","context","BottomSheetInternalContext"],"mappings":";;;;;;;AAAA;;AACA;;AAaO,SAASA,sBAAT,CACLC,MADK,EAEkC;AACvC,QAAMC,OAAO,GAAG,uBAAWC,oCAAX,CAAhB;;AAEA,MAAIF,MAAM,KAAK,IAAX,IAAmBC,OAAO,KAAK,IAAnC,EAAyC;AACvC,UAAM,iEAAN;AACD;;AAED,SAAOA,OAAP;AACD","sourcesContent":["import { useContext } from 'react';\nimport {\n BottomSheetInternalContext,\n BottomSheetInternalContextType,\n} from '../contexts/internal';\n\nexport function useBottomSheetInternal(\n unsafe?: false\n): BottomSheetInternalContextType;\n\nexport function useBottomSheetInternal(\n unsafe: true\n): BottomSheetInternalContextType | null;\n\nexport function useBottomSheetInternal(\n unsafe?: boolean\n): BottomSheetInternalContextType | null {\n const context = useContext(BottomSheetInternalContext);\n\n if (unsafe !== true && context === null) {\n throw \"'useBottomSheetInternal' cannot be used out of the BottomSheet!\";\n }\n\n return context;\n}\n"]} \ No newline at end of file diff --git a/lib/commonjs/hooks/useBottomSheetModal.js b/lib/commonjs/hooks/useBottomSheetModal.js new file mode 100644 index 000000000..d9d27bbec --- /dev/null +++ b/lib/commonjs/hooks/useBottomSheetModal.js @@ -0,0 +1,23 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.useBottomSheetModal = void 0; + +var _react = require("react"); + +var _contexts = require("../contexts"); + +const useBottomSheetModal = () => { + const context = (0, _react.useContext)(_contexts.BottomSheetModalContext); + + if (context === null) { + throw "'BottomSheetModalContext' cannot be null!"; + } + + return context; +}; + +exports.useBottomSheetModal = useBottomSheetModal; +//# sourceMappingURL=useBottomSheetModal.js.map \ No newline at end of file diff --git a/lib/commonjs/hooks/useBottomSheetModal.js.map b/lib/commonjs/hooks/useBottomSheetModal.js.map new file mode 100644 index 000000000..c7368a8ad --- /dev/null +++ b/lib/commonjs/hooks/useBottomSheetModal.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["useBottomSheetModal.ts"],"names":["useBottomSheetModal","context","BottomSheetModalContext"],"mappings":";;;;;;;AAAA;;AACA;;AAEO,MAAMA,mBAAmB,GAAG,MAAM;AACvC,QAAMC,OAAO,GAAG,uBAAWC,iCAAX,CAAhB;;AAEA,MAAID,OAAO,KAAK,IAAhB,EAAsB;AACpB,UAAM,2CAAN;AACD;;AAED,SAAOA,OAAP;AACD,CARM","sourcesContent":["import { useContext } from 'react';\nimport { BottomSheetModalContext } from '../contexts';\n\nexport const useBottomSheetModal = () => {\n const context = useContext(BottomSheetModalContext);\n\n if (context === null) {\n throw \"'BottomSheetModalContext' cannot be null!\";\n }\n\n return context;\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/hooks/useBottomSheetModalInternal.js b/lib/commonjs/hooks/useBottomSheetModalInternal.js new file mode 100644 index 000000000..9549a71ff --- /dev/null +++ b/lib/commonjs/hooks/useBottomSheetModalInternal.js @@ -0,0 +1,21 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.useBottomSheetModalInternal = useBottomSheetModalInternal; + +var _react = require("react"); + +var _contexts = require("../contexts"); + +function useBottomSheetModalInternal(unsafe) { + const context = (0, _react.useContext)(_contexts.BottomSheetModalInternalContext); + + if (unsafe !== true && context === null) { + throw "'BottomSheetModalInternalContext' cannot be null!"; + } + + return context; +} +//# sourceMappingURL=useBottomSheetModalInternal.js.map \ No newline at end of file diff --git a/lib/commonjs/hooks/useBottomSheetModalInternal.js.map b/lib/commonjs/hooks/useBottomSheetModalInternal.js.map new file mode 100644 index 000000000..9c1eee2db --- /dev/null +++ b/lib/commonjs/hooks/useBottomSheetModalInternal.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["useBottomSheetModalInternal.ts"],"names":["useBottomSheetModalInternal","unsafe","context","BottomSheetModalInternalContext"],"mappings":";;;;;;;AAAA;;AACA;;AAaO,SAASA,2BAAT,CACLC,MADK,EAEuC;AAC5C,QAAMC,OAAO,GAAG,uBAAWC,yCAAX,CAAhB;;AAEA,MAAIF,MAAM,KAAK,IAAX,IAAmBC,OAAO,KAAK,IAAnC,EAAyC;AACvC,UAAM,mDAAN;AACD;;AAED,SAAOA,OAAP;AACD","sourcesContent":["import { useContext } from 'react';\nimport {\n BottomSheetModalInternalContext,\n BottomSheetModalInternalContextType,\n} from '../contexts';\n\nexport function useBottomSheetModalInternal(\n unsafe?: false\n): BottomSheetModalInternalContextType;\n\nexport function useBottomSheetModalInternal(\n unsafe: true\n): BottomSheetModalInternalContextType | null;\n\nexport function useBottomSheetModalInternal(\n unsafe?: boolean\n): BottomSheetModalInternalContextType | null {\n const context = useContext(BottomSheetModalInternalContext);\n\n if (unsafe !== true && context === null) {\n throw \"'BottomSheetModalInternalContext' cannot be null!\";\n }\n\n return context;\n}\n"]} \ No newline at end of file diff --git a/lib/commonjs/hooks/useBottomSheetSpringConfigs.js b/lib/commonjs/hooks/useBottomSheetSpringConfigs.js new file mode 100644 index 000000000..ade007494 --- /dev/null +++ b/lib/commonjs/hooks/useBottomSheetSpringConfigs.js @@ -0,0 +1,19 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.useBottomSheetSpringConfigs = void 0; + +var _react = require("react"); + +/** + * Generate spring animation configs. + * @param configs overridable configs. + */ +const useBottomSheetSpringConfigs = configs => { + return (0, _react.useMemo)(() => configs, [configs]); +}; + +exports.useBottomSheetSpringConfigs = useBottomSheetSpringConfigs; +//# sourceMappingURL=useBottomSheetSpringConfigs.js.map \ No newline at end of file diff --git a/lib/commonjs/hooks/useBottomSheetSpringConfigs.js.map b/lib/commonjs/hooks/useBottomSheetSpringConfigs.js.map new file mode 100644 index 000000000..bf456ed4c --- /dev/null +++ b/lib/commonjs/hooks/useBottomSheetSpringConfigs.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["useBottomSheetSpringConfigs.ts"],"names":["useBottomSheetSpringConfigs","configs"],"mappings":";;;;;;;AAAA;;AAGA;AACA;AACA;AACA;AACO,MAAMA,2BAA2B,GACtCC,OADyC,IAEtC;AACH,SAAO,oBAAQ,MAAMA,OAAd,EAAuB,CAACA,OAAD,CAAvB,CAAP;AACD,CAJM","sourcesContent":["import { useMemo } from 'react';\nimport type { WithSpringConfig } from 'react-native-reanimated';\n\n/**\n * Generate spring animation configs.\n * @param configs overridable configs.\n */\nexport const useBottomSheetSpringConfigs = (\n configs: Omit\n) => {\n return useMemo(() => configs, [configs]);\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/hooks/useBottomSheetTimingConfigs.js b/lib/commonjs/hooks/useBottomSheetTimingConfigs.js new file mode 100644 index 000000000..f1b6eb0d9 --- /dev/null +++ b/lib/commonjs/hooks/useBottomSheetTimingConfigs.js @@ -0,0 +1,30 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.useBottomSheetTimingConfigs = void 0; + +var _react = require("react"); + +var _constants = require("../constants"); + +/** + * Generate timing animation configs. + * @default + * - easing: Easing.out(Easing.exp) + * - duration 250 + * @param configs overridable configs. + */ +const useBottomSheetTimingConfigs = configs => { + return (0, _react.useMemo)(() => { + const _configs = { + easing: configs.easing || _constants.ANIMATION_EASING, + duration: configs.duration || _constants.ANIMATION_DURATION + }; + return _configs; + }, [configs.duration, configs.easing]); +}; + +exports.useBottomSheetTimingConfigs = useBottomSheetTimingConfigs; +//# sourceMappingURL=useBottomSheetTimingConfigs.js.map \ No newline at end of file diff --git a/lib/commonjs/hooks/useBottomSheetTimingConfigs.js.map b/lib/commonjs/hooks/useBottomSheetTimingConfigs.js.map new file mode 100644 index 000000000..f817c745a --- /dev/null +++ b/lib/commonjs/hooks/useBottomSheetTimingConfigs.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["useBottomSheetTimingConfigs.ts"],"names":["useBottomSheetTimingConfigs","configs","_configs","easing","ANIMATION_EASING","duration","ANIMATION_DURATION"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,2BAA2B,GAAIC,OAAD,IAA+B;AACxE,SAAO,oBAAQ,MAAM;AACnB,UAAMC,QAA0B,GAAG;AACjCC,MAAAA,MAAM,EAAEF,OAAO,CAACE,MAAR,IAAkBC,2BADO;AAEjCC,MAAAA,QAAQ,EAAEJ,OAAO,CAACI,QAAR,IAAoBC;AAFG,KAAnC;AAKA,WAAOJ,QAAP;AACD,GAPM,EAOJ,CAACD,OAAO,CAACI,QAAT,EAAmBJ,OAAO,CAACE,MAA3B,CAPI,CAAP;AAQD,CATM","sourcesContent":["import { useMemo } from 'react';\nimport type { WithTimingConfig } from 'react-native-reanimated';\nimport { ANIMATION_DURATION, ANIMATION_EASING } from '../constants';\n\n/**\n * Generate timing animation configs.\n * @default\n * - easing: Easing.out(Easing.exp)\n * - duration 250\n * @param configs overridable configs.\n */\nexport const useBottomSheetTimingConfigs = (configs: WithTimingConfig) => {\n return useMemo(() => {\n const _configs: WithTimingConfig = {\n easing: configs.easing || ANIMATION_EASING,\n duration: configs.duration || ANIMATION_DURATION,\n };\n\n return _configs;\n }, [configs.duration, configs.easing]);\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/hooks/useGestureEventsHandlersDefault.js b/lib/commonjs/hooks/useGestureEventsHandlersDefault.js new file mode 100644 index 000000000..59ec8343b --- /dev/null +++ b/lib/commonjs/hooks/useGestureEventsHandlersDefault.js @@ -0,0 +1,258 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.useGestureEventsHandlersDefault = void 0; + +var _reactNative = require("react-native"); + +var _reactNativeReanimated = require("react-native-reanimated"); + +var _useBottomSheetInternal = require("./useBottomSheetInternal"); + +var _constants = require("../constants"); + +var _clamp = require("../utilities/clamp"); + +var _snapPoint = require("../utilities/snapPoint"); + +const dismissKeyboard = _reactNative.Keyboard.dismiss; + +const useGestureEventsHandlersDefault = () => { + //#region variables + const { + animatedPosition, + animatedSnapPoints, + animatedKeyboardState, + animatedKeyboardHeight, + animatedContainerHeight, + animatedScrollableType, + animatedHighestSnapPoint, + animatedClosedPosition, + animatedScrollableContentOffsetY, + enableOverDrag, + enablePanDownToClose, + overDragResistanceFactor, + isInTemporaryPosition, + isScrollableRefreshable, + animateToPosition, + stopAnimation + } = (0, _useBottomSheetInternal.useBottomSheetInternal)(); //#endregion + //#region gesture methods + + const handleOnStart = (0, _reactNativeReanimated.useWorkletCallback)(function handleOnStart(__, _, context) { + // cancel current animation + stopAnimation(); // store current animated position + + context.initialPosition = animatedPosition.value; + context.initialKeyboardState = animatedKeyboardState.value; + /** + * if the scrollable content is scrolled, then + * we lock the position. + */ + + if (animatedScrollableContentOffsetY.value > 0) { + context.isScrollablePositionLocked = true; + } + }, [stopAnimation, animatedPosition, animatedKeyboardState, animatedScrollableContentOffsetY]); + const handleOnActive = (0, _reactNativeReanimated.useWorkletCallback)(function handleOnActive(source, { + translationY + }, context) { + let highestSnapPoint = animatedHighestSnapPoint.value; + /** + * if keyboard is shown, then we set the highest point to the current + * position which includes the keyboard height. + */ + + if (isInTemporaryPosition.value && context.initialKeyboardState === _constants.KEYBOARD_STATE.SHOWN) { + highestSnapPoint = context.initialPosition; + } + /** + * if current position is out of provided `snapPoints` and smaller then + * highest snap pont, then we set the highest point to the current position. + */ + + + if (isInTemporaryPosition.value && context.initialPosition < highestSnapPoint) { + highestSnapPoint = context.initialPosition; + } + + const lowestSnapPoint = enablePanDownToClose ? animatedContainerHeight.value : animatedSnapPoints.value[0]; + /** + * if scrollable is refreshable and sheet position at the highest + * point, then do not interact with current gesture. + */ + + if (source === _constants.GESTURE_SOURCE.SCROLLABLE && isScrollableRefreshable.value && animatedPosition.value === highestSnapPoint) { + return; + } + /** + * a negative scrollable content offset to be subtracted from accumulated + * current position and gesture translation Y to allow user to drag the sheet, + * when scrollable position at the top. + * a negative scrollable content offset when the scrollable is not locked. + */ + + + const negativeScrollableContentOffset = context.initialPosition === highestSnapPoint && source === _constants.GESTURE_SOURCE.SCROLLABLE || !context.isScrollablePositionLocked ? animatedScrollableContentOffsetY.value * -1 : 0; + /** + * an accumulated value of starting position with gesture translation y. + */ + + const draggedPosition = context.initialPosition + translationY; + /** + * an accumulated value of dragged position and negative scrollable content offset, + * this will insure locking sheet position when user is scrolling the scrollable until, + * they reach to the top of the scrollable. + */ + + const accumulatedDraggedPosition = draggedPosition + negativeScrollableContentOffset; + /** + * a clamped value of the accumulated dragged position, to insure keeping the dragged + * position between the highest and lowest snap points. + */ + + const clampedPosition = (0, _clamp.clamp)(accumulatedDraggedPosition, highestSnapPoint, lowestSnapPoint); + /** + * if scrollable position is locked and the animated position + * reaches the highest point, then we unlock the scrollable position. + */ + + if (context.isScrollablePositionLocked && source === _constants.GESTURE_SOURCE.SCROLLABLE && animatedPosition.value === highestSnapPoint) { + context.isScrollablePositionLocked = false; + } + /** + * over-drag implementation. + */ + + + if (enableOverDrag) { + if ((source === _constants.GESTURE_SOURCE.HANDLE || animatedScrollableType.value === _constants.SCROLLABLE_TYPE.VIEW) && draggedPosition < highestSnapPoint) { + const resistedPosition = highestSnapPoint - Math.sqrt(1 + (highestSnapPoint - draggedPosition)) * overDragResistanceFactor; + animatedPosition.value = resistedPosition; + return; + } + + if (source === _constants.GESTURE_SOURCE.HANDLE && draggedPosition > lowestSnapPoint) { + const resistedPosition = lowestSnapPoint + Math.sqrt(1 + (draggedPosition - lowestSnapPoint)) * overDragResistanceFactor; + animatedPosition.value = resistedPosition; + return; + } + + if (source === _constants.GESTURE_SOURCE.SCROLLABLE && draggedPosition + negativeScrollableContentOffset > lowestSnapPoint) { + const resistedPosition = lowestSnapPoint + Math.sqrt(1 + (draggedPosition + negativeScrollableContentOffset - lowestSnapPoint)) * overDragResistanceFactor; + animatedPosition.value = resistedPosition; + return; + } + } + + animatedPosition.value = clampedPosition; + }, [enableOverDrag, enablePanDownToClose, overDragResistanceFactor, isInTemporaryPosition, isScrollableRefreshable, animatedHighestSnapPoint, animatedContainerHeight, animatedSnapPoints, animatedPosition, animatedScrollableType, animatedScrollableContentOffsetY]); + const handleOnEnd = (0, _reactNativeReanimated.useWorkletCallback)(function handleOnEnd(source, { + translationY, + absoluteY, + velocityY + }, context) { + const highestSnapPoint = animatedHighestSnapPoint.value; + const isSheetAtHighestSnapPoint = animatedPosition.value === highestSnapPoint; + /** + * if scrollable is refreshable and sheet position at the highest + * point, then do not interact with current gesture. + */ + + if (source === _constants.GESTURE_SOURCE.SCROLLABLE && isScrollableRefreshable.value && isSheetAtHighestSnapPoint) { + return; + } + /** + * if the sheet is in a temporary position and the gesture ended above + * the current position, then we snap back to the temporary position. + */ + + + if (isInTemporaryPosition.value && context.initialPosition >= animatedPosition.value) { + if (context.initialPosition > animatedPosition.value) { + animateToPosition(context.initialPosition, _constants.ANIMATION_SOURCE.GESTURE, velocityY / 2); + } + + return; + } + /** + * close keyboard if current position is below the recorded + * start position and keyboard still shown. + */ + + + const isScrollable = animatedScrollableType.value !== _constants.SCROLLABLE_TYPE.UNDETERMINED && animatedScrollableType.value !== _constants.SCROLLABLE_TYPE.VIEW; + /** + * if keyboard is shown and the sheet is dragged down, + * then we dismiss the keyboard. + */ + + if (context.initialKeyboardState === _constants.KEYBOARD_STATE.SHOWN && animatedPosition.value > context.initialPosition) { + /** + * if the platform is ios, current content is scrollable and + * the end touch point is below the keyboard position then + * we exit the method. + * + * because the the keyboard dismiss is interactive in iOS. + */ + if (!(_reactNative.Platform.OS === 'ios' && isScrollable && absoluteY > _constants.WINDOW_HEIGHT - animatedKeyboardHeight.value)) { + (0, _reactNativeReanimated.runOnJS)(dismissKeyboard)(); + } + } + /** + * reset isInTemporaryPosition value + */ + + + if (isInTemporaryPosition.value) { + isInTemporaryPosition.value = false; + } + /** + * clone snap points array, and insert the container height + * if pan down to close is enabled. + */ + + + const snapPoints = animatedSnapPoints.value.slice(); + + if (enablePanDownToClose) { + snapPoints.unshift(animatedClosedPosition.value); + } + /** + * calculate the destination point, using redash. + */ + + + const destinationPoint = (0, _snapPoint.snapPoint)(translationY + context.initialPosition, velocityY, snapPoints); + /** + * if destination point is the same as the current position, + * then no need to perform animation. + */ + + if (destinationPoint === animatedPosition.value) { + return; + } + + const wasGestureHandledByScrollView = source === _constants.GESTURE_SOURCE.SCROLLABLE && animatedScrollableContentOffsetY.value > 0; + /** + * prevents snapping from top to middle / bottom with repeated interrupted scrolls + */ + + if (wasGestureHandledByScrollView && isSheetAtHighestSnapPoint) { + return; + } + + animateToPosition(destinationPoint, _constants.ANIMATION_SOURCE.GESTURE, velocityY / 2); + }, [enablePanDownToClose, isInTemporaryPosition, isScrollableRefreshable, animatedClosedPosition, animatedHighestSnapPoint, animatedKeyboardHeight, animatedPosition, animatedScrollableType, animatedSnapPoints, animatedScrollableContentOffsetY, animateToPosition]); //#endregion + + return { + handleOnStart, + handleOnActive, + handleOnEnd + }; +}; + +exports.useGestureEventsHandlersDefault = useGestureEventsHandlersDefault; +//# sourceMappingURL=useGestureEventsHandlersDefault.js.map \ No newline at end of file diff --git a/lib/commonjs/hooks/useGestureEventsHandlersDefault.js.map b/lib/commonjs/hooks/useGestureEventsHandlersDefault.js.map new file mode 100644 index 000000000..a7ffb3391 --- /dev/null +++ b/lib/commonjs/hooks/useGestureEventsHandlersDefault.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["useGestureEventsHandlersDefault.tsx"],"names":["dismissKeyboard","Keyboard","dismiss","useGestureEventsHandlersDefault","animatedPosition","animatedSnapPoints","animatedKeyboardState","animatedKeyboardHeight","animatedContainerHeight","animatedScrollableType","animatedHighestSnapPoint","animatedClosedPosition","animatedScrollableContentOffsetY","enableOverDrag","enablePanDownToClose","overDragResistanceFactor","isInTemporaryPosition","isScrollableRefreshable","animateToPosition","stopAnimation","handleOnStart","__","_","context","initialPosition","value","initialKeyboardState","isScrollablePositionLocked","handleOnActive","source","translationY","highestSnapPoint","KEYBOARD_STATE","SHOWN","lowestSnapPoint","GESTURE_SOURCE","SCROLLABLE","negativeScrollableContentOffset","draggedPosition","accumulatedDraggedPosition","clampedPosition","HANDLE","SCROLLABLE_TYPE","VIEW","resistedPosition","Math","sqrt","handleOnEnd","absoluteY","velocityY","isSheetAtHighestSnapPoint","ANIMATION_SOURCE","GESTURE","isScrollable","UNDETERMINED","Platform","OS","WINDOW_HEIGHT","snapPoints","slice","unshift","destinationPoint","wasGestureHandledByScrollView"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AAWA;;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,EAA0B;AACxB4C,MAAAA,UAAU,CAACE,OAAX,CAAmBjD,sBAAsB,CAACc,KAA1C;AACD;AAED;AACV;AACA;;;AACU,UAAMoC,gBAAgB,GAAG,0BACvB/B,YAAY,GAAGP,OAAO,CAACC,eADA,EAEvByB,SAFuB,EAGvBS,UAHuB,CAAzB;AAMA;AACV;AACA;AACA;;AACU,QAAIG,gBAAgB,KAAKzD,gBAAgB,CAACqB,KAA1C,EAAiD;AAC/C;AACD;;AAED,UAAMqC,6BAA6B,GACjCjC,MAAM,KAAKM,0BAAeC,UAA1B,IACAxB,gCAAgC,CAACa,KAAjC,GAAyC,CAF3C;AAGA;AACV;AACA;;AACU,QAAIqC,6BAA6B,IAAIZ,yBAArC,EAAgE;AAC9D;AACD;;AAEDhC,IAAAA,iBAAiB,CACf2C,gBADe,EAEfV,4BAAiBC,OAFF,EAGfH,SAAS,GAAG,CAHG,CAAjB;AAKD,GA1HH,EA2HE,CACEnC,oBADF,EAEEE,qBAFF,EAGEC,uBAHF,EAIEN,sBAJF,EAKED,wBALF,EAMEH,sBANF,EAOEH,gBAPF,EAQEK,sBARF,EASEJ,kBATF,EAUEO,gCAVF,EAWEM,iBAXF,CA3HF,CADF,CA3MI,CAqVJ;;AAEA,SAAO;AACLE,IAAAA,aADK;AAELQ,IAAAA,cAFK;AAGLmB,IAAAA;AAHK,GAAP;AAKD,CA7VI","sourcesContent":["import { Keyboard, Platform } from 'react-native';\nimport { runOnJS, useWorkletCallback } from 'react-native-reanimated';\nimport { useBottomSheetInternal } from './useBottomSheetInternal';\nimport {\n ANIMATION_SOURCE,\n GESTURE_SOURCE,\n KEYBOARD_STATE,\n SCROLLABLE_TYPE,\n WINDOW_HEIGHT,\n} from '../constants';\nimport type {\n GestureEventsHandlersHookType,\n GestureEventHandlerCallbackType,\n} from '../types';\nimport { clamp } from '../utilities/clamp';\nimport { snapPoint } from '../utilities/snapPoint';\n\ntype GestureEventContextType = {\n initialPosition: number;\n initialKeyboardState: KEYBOARD_STATE;\n isScrollablePositionLocked: boolean;\n};\n\nconst dismissKeyboard = Keyboard.dismiss;\n\nexport const useGestureEventsHandlersDefault: GestureEventsHandlersHookType =\n () => {\n //#region variables\n const {\n animatedPosition,\n animatedSnapPoints,\n animatedKeyboardState,\n animatedKeyboardHeight,\n animatedContainerHeight,\n animatedScrollableType,\n animatedHighestSnapPoint,\n animatedClosedPosition,\n animatedScrollableContentOffsetY,\n enableOverDrag,\n enablePanDownToClose,\n overDragResistanceFactor,\n isInTemporaryPosition,\n isScrollableRefreshable,\n animateToPosition,\n stopAnimation,\n } = useBottomSheetInternal();\n //#endregion\n\n //#region gesture methods\n const handleOnStart: GestureEventHandlerCallbackType =\n useWorkletCallback(\n function handleOnStart(__, _, context) {\n // cancel current animation\n stopAnimation();\n\n // store current animated position\n context.initialPosition = animatedPosition.value;\n context.initialKeyboardState = animatedKeyboardState.value;\n\n /**\n * if the scrollable content is scrolled, then\n * we lock the position.\n */\n if (animatedScrollableContentOffsetY.value > 0) {\n context.isScrollablePositionLocked = true;\n }\n },\n [\n stopAnimation,\n animatedPosition,\n animatedKeyboardState,\n animatedScrollableContentOffsetY,\n ]\n );\n const handleOnActive: GestureEventHandlerCallbackType =\n useWorkletCallback(\n function handleOnActive(source, { translationY }, context) {\n let highestSnapPoint = animatedHighestSnapPoint.value;\n\n /**\n * if keyboard is shown, then we set the highest point to the current\n * position which includes the keyboard height.\n */\n if (\n isInTemporaryPosition.value &&\n context.initialKeyboardState === KEYBOARD_STATE.SHOWN\n ) {\n highestSnapPoint = context.initialPosition;\n }\n\n /**\n * if current position is out of provided `snapPoints` and smaller then\n * highest snap pont, then we set the highest point to the current position.\n */\n if (\n isInTemporaryPosition.value &&\n context.initialPosition < highestSnapPoint\n ) {\n highestSnapPoint = context.initialPosition;\n }\n\n const lowestSnapPoint = enablePanDownToClose\n ? animatedContainerHeight.value\n : animatedSnapPoints.value[0];\n\n /**\n * if scrollable is refreshable and sheet position at the highest\n * point, then do not interact with current gesture.\n */\n if (\n source === GESTURE_SOURCE.SCROLLABLE &&\n isScrollableRefreshable.value &&\n animatedPosition.value === highestSnapPoint\n ) {\n return;\n }\n\n /**\n * a negative scrollable content offset to be subtracted from accumulated\n * current position and gesture translation Y to allow user to drag the sheet,\n * when scrollable position at the top.\n * a negative scrollable content offset when the scrollable is not locked.\n */\n const negativeScrollableContentOffset =\n (context.initialPosition === highestSnapPoint &&\n source === GESTURE_SOURCE.SCROLLABLE) ||\n !context.isScrollablePositionLocked\n ? animatedScrollableContentOffsetY.value * -1\n : 0;\n\n /**\n * an accumulated value of starting position with gesture translation y.\n */\n const draggedPosition = context.initialPosition + translationY;\n\n /**\n * an accumulated value of dragged position and negative scrollable content offset,\n * this will insure locking sheet position when user is scrolling the scrollable until,\n * they reach to the top of the scrollable.\n */\n const accumulatedDraggedPosition =\n draggedPosition + negativeScrollableContentOffset;\n\n /**\n * a clamped value of the accumulated dragged position, to insure keeping the dragged\n * position between the highest and lowest snap points.\n */\n const clampedPosition = clamp(\n accumulatedDraggedPosition,\n highestSnapPoint,\n lowestSnapPoint\n );\n\n /**\n * if scrollable position is locked and the animated position\n * reaches the highest point, then we unlock the scrollable position.\n */\n if (\n context.isScrollablePositionLocked &&\n source === GESTURE_SOURCE.SCROLLABLE &&\n animatedPosition.value === highestSnapPoint\n ) {\n context.isScrollablePositionLocked = false;\n }\n\n /**\n * over-drag implementation.\n */\n if (enableOverDrag) {\n if (\n (source === GESTURE_SOURCE.HANDLE ||\n animatedScrollableType.value === SCROLLABLE_TYPE.VIEW) &&\n draggedPosition < highestSnapPoint\n ) {\n const resistedPosition =\n highestSnapPoint -\n Math.sqrt(1 + (highestSnapPoint - draggedPosition)) *\n overDragResistanceFactor;\n animatedPosition.value = resistedPosition;\n return;\n }\n\n if (\n source === GESTURE_SOURCE.HANDLE &&\n draggedPosition > lowestSnapPoint\n ) {\n const resistedPosition =\n lowestSnapPoint +\n Math.sqrt(1 + (draggedPosition - lowestSnapPoint)) *\n overDragResistanceFactor;\n animatedPosition.value = resistedPosition;\n return;\n }\n\n if (\n source === GESTURE_SOURCE.SCROLLABLE &&\n draggedPosition + negativeScrollableContentOffset >\n lowestSnapPoint\n ) {\n const resistedPosition =\n lowestSnapPoint +\n Math.sqrt(\n 1 +\n (draggedPosition +\n negativeScrollableContentOffset -\n lowestSnapPoint)\n ) *\n overDragResistanceFactor;\n animatedPosition.value = resistedPosition;\n return;\n }\n }\n\n animatedPosition.value = clampedPosition;\n },\n [\n enableOverDrag,\n enablePanDownToClose,\n overDragResistanceFactor,\n isInTemporaryPosition,\n isScrollableRefreshable,\n animatedHighestSnapPoint,\n animatedContainerHeight,\n animatedSnapPoints,\n animatedPosition,\n animatedScrollableType,\n animatedScrollableContentOffsetY,\n ]\n );\n const handleOnEnd: GestureEventHandlerCallbackType =\n useWorkletCallback(\n function handleOnEnd(\n source,\n { translationY, absoluteY, velocityY },\n context\n ) {\n const highestSnapPoint = animatedHighestSnapPoint.value;\n const isSheetAtHighestSnapPoint =\n animatedPosition.value === highestSnapPoint;\n\n /**\n * if scrollable is refreshable and sheet position at the highest\n * point, then do not interact with current gesture.\n */\n if (\n source === GESTURE_SOURCE.SCROLLABLE &&\n isScrollableRefreshable.value &&\n isSheetAtHighestSnapPoint\n ) {\n return;\n }\n\n /**\n * if the sheet is in a temporary position and the gesture ended above\n * the current position, then we snap back to the temporary position.\n */\n if (\n isInTemporaryPosition.value &&\n context.initialPosition >= animatedPosition.value\n ) {\n if (context.initialPosition > animatedPosition.value) {\n animateToPosition(\n context.initialPosition,\n ANIMATION_SOURCE.GESTURE,\n velocityY / 2\n );\n }\n return;\n }\n\n /**\n * close keyboard if current position is below the recorded\n * start position and keyboard still shown.\n */\n const isScrollable =\n animatedScrollableType.value !== SCROLLABLE_TYPE.UNDETERMINED &&\n animatedScrollableType.value !== SCROLLABLE_TYPE.VIEW;\n\n /**\n * if keyboard is shown and the sheet is dragged down,\n * then we dismiss the keyboard.\n */\n if (\n context.initialKeyboardState === KEYBOARD_STATE.SHOWN &&\n animatedPosition.value > context.initialPosition\n ) {\n /**\n * if the platform is ios, current content is scrollable and\n * the end touch point is below the keyboard position then\n * we exit the method.\n *\n * because the the keyboard dismiss is interactive in iOS.\n */\n if (\n !(\n Platform.OS === 'ios' &&\n isScrollable &&\n absoluteY > WINDOW_HEIGHT - animatedKeyboardHeight.value\n )\n ) {\n runOnJS(dismissKeyboard)();\n }\n }\n\n /**\n * reset isInTemporaryPosition value\n */\n if (isInTemporaryPosition.value) {\n isInTemporaryPosition.value = false;\n }\n\n /**\n * clone snap points array, and insert the container height\n * if pan down to close is enabled.\n */\n const snapPoints = animatedSnapPoints.value.slice();\n if (enablePanDownToClose) {\n snapPoints.unshift(animatedClosedPosition.value);\n }\n\n /**\n * calculate the destination point, using redash.\n */\n const destinationPoint = snapPoint(\n translationY + context.initialPosition,\n velocityY,\n snapPoints\n );\n\n /**\n * if destination point is the same as the current position,\n * then no need to perform animation.\n */\n if (destinationPoint === animatedPosition.value) {\n return;\n }\n\n const wasGestureHandledByScrollView =\n source === GESTURE_SOURCE.SCROLLABLE &&\n animatedScrollableContentOffsetY.value > 0;\n /**\n * prevents snapping from top to middle / bottom with repeated interrupted scrolls\n */\n if (wasGestureHandledByScrollView && isSheetAtHighestSnapPoint) {\n return;\n }\n\n animateToPosition(\n destinationPoint,\n ANIMATION_SOURCE.GESTURE,\n velocityY / 2\n );\n },\n [\n enablePanDownToClose,\n isInTemporaryPosition,\n isScrollableRefreshable,\n animatedClosedPosition,\n animatedHighestSnapPoint,\n animatedKeyboardHeight,\n animatedPosition,\n animatedScrollableType,\n animatedSnapPoints,\n animatedScrollableContentOffsetY,\n animateToPosition,\n ]\n );\n //#endregion\n\n return {\n handleOnStart,\n handleOnActive,\n handleOnEnd,\n };\n };\n"]} \ No newline at end of file diff --git a/lib/commonjs/hooks/useGestureHandler.js b/lib/commonjs/hooks/useGestureHandler.js new file mode 100644 index 000000000..0753433c2 --- /dev/null +++ b/lib/commonjs/hooks/useGestureHandler.js @@ -0,0 +1,82 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.useGestureHandler = void 0; + +var _reactNativeReanimated = require("react-native-reanimated"); + +var _reactNativeGestureHandler = require("react-native-gesture-handler"); + +var _constants = require("../constants"); + +const resetContext = context => { + 'worklet'; + + Object.keys(context).map(key => { + context[key] = undefined; + }); +}; + +const useGestureHandler = (type, state, gestureSource, handleOnStart, handleOnActive, handleOnEnd) => { + const gestureHandler = (0, _reactNativeReanimated.useAnimatedGestureHandler)({ + onActive: (payload, context) => { + if (!context.didStart) { + context.didStart = true; + state.value = _reactNativeGestureHandler.State.BEGAN; + gestureSource.value = type; + handleOnStart(type, payload, context); + return; + } + + if (gestureSource.value !== type) { + return; + } + + state.value = payload.state; + handleOnActive(type, payload, context); + }, + onEnd: (payload, context) => { + if (gestureSource.value !== type) { + return; + } + + state.value = payload.state; + gestureSource.value = _constants.GESTURE_SOURCE.UNDETERMINED; + handleOnEnd(type, payload, context); + resetContext(context); + }, + onCancel: (payload, context) => { + if (gestureSource.value !== type) { + return; + } + + state.value = payload.state; + gestureSource.value = _constants.GESTURE_SOURCE.UNDETERMINED; + resetContext(context); + }, + onFail: (payload, context) => { + if (gestureSource.value !== type) { + return; + } + + state.value = payload.state; + gestureSource.value = _constants.GESTURE_SOURCE.UNDETERMINED; + resetContext(context); + }, + onFinish: (payload, context) => { + if (gestureSource.value !== type) { + return; + } + + state.value = payload.state; + gestureSource.value = _constants.GESTURE_SOURCE.UNDETERMINED; + resetContext(context); + } + }, [type, state, handleOnStart, handleOnActive, handleOnEnd]); + return gestureHandler; +}; + +exports.useGestureHandler = useGestureHandler; +//# sourceMappingURL=useGestureHandler.js.map \ No newline at end of file diff --git a/lib/commonjs/hooks/useGestureHandler.js.map b/lib/commonjs/hooks/useGestureHandler.js.map new file mode 100644 index 000000000..c144a1842 --- /dev/null +++ b/lib/commonjs/hooks/useGestureHandler.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["useGestureHandler.ts"],"names":["resetContext","context","Object","keys","map","key","undefined","useGestureHandler","type","state","gestureSource","handleOnStart","handleOnActive","handleOnEnd","gestureHandler","onActive","payload","didStart","value","State","BEGAN","onEnd","GESTURE_SOURCE","UNDETERMINED","onCancel","onFail","onFinish"],"mappings":";;;;;;;AAAA;;AACA;;AAIA;;AAMA,MAAMA,YAAY,GAAIC,OAAD,IAAkB;AACrC;;AAEAC,EAAAA,MAAM,CAACC,IAAP,CAAYF,OAAZ,EAAqBG,GAArB,CAAyBC,GAAG,IAAI;AAC9BJ,IAAAA,OAAO,CAACI,GAAD,CAAP,GAAeC,SAAf;AACD,GAFD;AAGD,CAND;;AAQO,MAAMC,iBAAiB,GAAG,CAC/BC,IAD+B,EAE/BC,KAF+B,EAG/BC,aAH+B,EAI/BC,aAJ+B,EAK/BC,cAL+B,EAM/BC,WAN+B,KAOsB;AACrD,QAAMC,cAAc,GAAG,sDAIrB;AACEC,IAAAA,QAAQ,EAAE,CAACC,OAAD,EAAUf,OAAV,KAAsB;AAC9B,UAAI,CAACA,OAAO,CAACgB,QAAb,EAAuB;AACrBhB,QAAAA,OAAO,CAACgB,QAAR,GAAmB,IAAnB;AAEAR,QAAAA,KAAK,CAACS,KAAN,GAAcC,iCAAMC,KAApB;AACAV,QAAAA,aAAa,CAACQ,KAAd,GAAsBV,IAAtB;AAEAG,QAAAA,aAAa,CAACH,IAAD,EAAOQ,OAAP,EAAgBf,OAAhB,CAAb;AACA;AACD;;AAED,UAAIS,aAAa,CAACQ,KAAd,KAAwBV,IAA5B,EAAkC;AAChC;AACD;;AAEDC,MAAAA,KAAK,CAACS,KAAN,GAAcF,OAAO,CAACP,KAAtB;AACAG,MAAAA,cAAc,CAACJ,IAAD,EAAOQ,OAAP,EAAgBf,OAAhB,CAAd;AACD,KAlBH;AAmBEoB,IAAAA,KAAK,EAAE,CAACL,OAAD,EAAUf,OAAV,KAAsB;AAC3B,UAAIS,aAAa,CAACQ,KAAd,KAAwBV,IAA5B,EAAkC;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CAAvB;AAmEA,SAAOC,cAAP;AACD,CA5EM","sourcesContent":["import Animated, { useAnimatedGestureHandler } from 'react-native-reanimated';\nimport {\n State,\n PanGestureHandlerGestureEvent,\n} from 'react-native-gesture-handler';\nimport { GESTURE_SOURCE } from '../constants';\nimport type {\n GestureEventContextType,\n GestureEventHandlerCallbackType,\n} from '../types';\n\nconst resetContext = (context: any) => {\n 'worklet';\n\n Object.keys(context).map(key => {\n context[key] = undefined;\n });\n};\n\nexport const useGestureHandler = (\n type: GESTURE_SOURCE,\n state: Animated.SharedValue,\n gestureSource: Animated.SharedValue,\n handleOnStart: GestureEventHandlerCallbackType,\n handleOnActive: GestureEventHandlerCallbackType,\n handleOnEnd: GestureEventHandlerCallbackType\n): ((event: PanGestureHandlerGestureEvent) => void) => {\n const gestureHandler = useAnimatedGestureHandler<\n PanGestureHandlerGestureEvent,\n GestureEventContextType\n >(\n {\n onActive: (payload, context) => {\n if (!context.didStart) {\n context.didStart = true;\n\n state.value = State.BEGAN;\n gestureSource.value = type;\n\n handleOnStart(type, payload, context);\n return;\n }\n\n if (gestureSource.value !== type) {\n return;\n }\n\n state.value = payload.state;\n handleOnActive(type, payload, context);\n },\n onEnd: (payload, context) => {\n if (gestureSource.value !== type) {\n return;\n }\n\n state.value = payload.state;\n gestureSource.value = GESTURE_SOURCE.UNDETERMINED;\n\n handleOnEnd(type, payload, context);\n resetContext(context);\n },\n onCancel: (payload, context) => {\n if (gestureSource.value !== type) {\n return;\n }\n\n state.value = payload.state;\n gestureSource.value = GESTURE_SOURCE.UNDETERMINED;\n\n resetContext(context);\n },\n onFail: (payload, context) => {\n if (gestureSource.value !== type) {\n return;\n }\n\n state.value = payload.state;\n gestureSource.value = GESTURE_SOURCE.UNDETERMINED;\n\n resetContext(context);\n },\n onFinish: (payload, context) => {\n if (gestureSource.value !== type) {\n return;\n }\n\n state.value = payload.state;\n gestureSource.value = GESTURE_SOURCE.UNDETERMINED;\n\n resetContext(context);\n },\n },\n [type, state, handleOnStart, handleOnActive, handleOnEnd]\n );\n return gestureHandler;\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/hooks/useKeyboard.js b/lib/commonjs/hooks/useKeyboard.js new file mode 100644 index 000000000..7666a64dc --- /dev/null +++ b/lib/commonjs/hooks/useKeyboard.js @@ -0,0 +1,100 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.useKeyboard = void 0; + +var _react = require("react"); + +var _reactNative = require("react-native"); + +var _reactNativeReanimated = require("react-native-reanimated"); + +var _constants = require("../constants"); + +const KEYBOARD_EVENT_MAPPER = { + KEYBOARD_SHOW: _reactNative.Platform.select({ + ios: 'keyboardWillShow', + android: 'keyboardDidShow', + default: '' + }), + KEYBOARD_HIDE: _reactNative.Platform.select({ + ios: 'keyboardWillHide', + android: 'keyboardDidHide', + default: '' + }) +}; + +const useKeyboard = () => { + //#region variables + const shouldHandleKeyboardEvents = (0, _reactNativeReanimated.useSharedValue)(false); + const keyboardState = (0, _reactNativeReanimated.useSharedValue)(_constants.KEYBOARD_STATE.UNDETERMINED); + const keyboardHeight = (0, _reactNativeReanimated.useSharedValue)(0); + const keyboardAnimationEasing = (0, _reactNativeReanimated.useSharedValue)('keyboard'); + const keyboardAnimationDuration = (0, _reactNativeReanimated.useSharedValue)(500); + const temporaryCachedKeyboardEvent = (0, _reactNativeReanimated.useSharedValue)([]); //#endregion + //#region worklets + + const handleKeyboardEvent = (0, _reactNativeReanimated.useWorkletCallback)((state, height, duration, easing) => { + if (state === _constants.KEYBOARD_STATE.SHOWN && !shouldHandleKeyboardEvents.value) { + /** + * if the keyboard event was fired before the `onFocus` on TextInput, + * then we cache the input, and wait till the `shouldHandleKeyboardEvents` + * to be updated then fire this function again. + */ + temporaryCachedKeyboardEvent.value = [state, height, duration, easing]; + return; + } + + keyboardHeight.value = state === _constants.KEYBOARD_STATE.SHOWN ? height : height === 0 ? keyboardHeight.value : height; + keyboardAnimationDuration.value = duration; + keyboardAnimationEasing.value = easing; + keyboardState.value = state; + temporaryCachedKeyboardEvent.value = []; + }, []); //#endregion + //#region effects + + (0, _react.useEffect)(() => { + const handleOnKeyboardShow = event => { + (0, _reactNativeReanimated.runOnUI)(handleKeyboardEvent)(_constants.KEYBOARD_STATE.SHOWN, event.endCoordinates.height, event.duration, event.easing); + }; + + const handleOnKeyboardHide = event => { + (0, _reactNativeReanimated.runOnUI)(handleKeyboardEvent)(_constants.KEYBOARD_STATE.HIDDEN, event.endCoordinates.height, event.duration, event.easing); + }; + + const showSubscription = _reactNative.Keyboard.addListener(KEYBOARD_EVENT_MAPPER.KEYBOARD_SHOW, handleOnKeyboardShow); + + const hideSubscription = _reactNative.Keyboard.addListener(KEYBOARD_EVENT_MAPPER.KEYBOARD_HIDE, handleOnKeyboardHide); + + return () => { + showSubscription.remove(); + hideSubscription.remove(); + }; + }, [handleKeyboardEvent]); + /** + * This reaction is needed to handle the issue with multiline text input. + * + * @link https://github.com/gorhom/react-native-bottom-sheet/issues/411 + */ + + (0, _reactNativeReanimated.useAnimatedReaction)(() => shouldHandleKeyboardEvents.value, result => { + const params = temporaryCachedKeyboardEvent.value; + + if (result && params.length > 0) { + handleKeyboardEvent(params[0], params[1], params[2], params[3]); + } + }); //#endregion + + return { + state: keyboardState, + height: keyboardHeight, + animationEasing: keyboardAnimationEasing, + animationDuration: keyboardAnimationDuration, + shouldHandleKeyboardEvents + }; +}; + +exports.useKeyboard = useKeyboard; +//# sourceMappingURL=useKeyboard.js.map \ No newline at end of file diff --git a/lib/commonjs/hooks/useKeyboard.js.map b/lib/commonjs/hooks/useKeyboard.js.map new file mode 100644 index 000000000..62de18dd5 --- /dev/null +++ b/lib/commonjs/hooks/useKeyboard.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["useKeyboard.ts"],"names":["KEYBOARD_EVENT_MAPPER","KEYBOARD_SHOW","Platform","select","ios","android","default","KEYBOARD_HIDE","useKeyboard","shouldHandleKeyboardEvents","keyboardState","KEYBOARD_STATE","UNDETERMINED","keyboardHeight","keyboardAnimationEasing","keyboardAnimationDuration","temporaryCachedKeyboardEvent","handleKeyboardEvent","state","height","duration","easing","SHOWN","value","handleOnKeyboardShow","event","endCoordinates","handleOnKeyboardHide","HIDDEN","showSubscription","Keyboard","addListener","hideSubscription","remove","result","params","length","animationEasing","animationDuration"],"mappings":";;;;;;;AAAA;;AACA;;AAOA;;AAMA;;AAEA,MAAMA,qBAAqB,GAAG;AAC5BC,EAAAA,aAAa,EAAEC,sBAASC,MAAT,CAAgB;AAC7BC,IAAAA,GAAG,EAAE,kBADwB;AAE7BC,IAAAA,OAAO,EAAE,iBAFoB;AAG7BC,IAAAA,OAAO,EAAE;AAHoB,GAAhB,CADa;AAM5BC,EAAAA,aAAa,EAAEL,sBAASC,MAAT,CAAgB;AAC7BC,IAAAA,GAAG,EAAE,kBADwB;AAE7BC,IAAAA,OAAO,EAAE,iBAFoB;AAG7BC,IAAAA,OAAO,EAAE;AAHoB,GAAhB;AANa,CAA9B;;AAaO,MAAME,WAAW,GAAG,MAAM;AAC/B;AACA,QAAMC,0BAA0B,GAAG,2CAAe,KAAf,CAAnC;AACA,QAAMC,aAAa,GAAG,2CACpBC,0BAAeC,YADK,CAAtB;AAGA,QAAMC,cAAc,GAAG,2CAAe,CAAf,CAAvB;AACA,QAAMC,uBAAuB,GAC3B,2CAAoC,UAApC,CADF;AAEA,QAAMC,yBAAyB,GAAG,2CAAe,GAAf,CAAlC;AACA,QAAMC,4BAA4B,GAAG,2CAAoB,EAApB,CAArC,CAV+B,CAW/B;AAEA;;AACA,QAAMC,mBAAmB,GAAG,+CAC1B,CAACC,KAAD,EAAQC,MAAR,EAAgBC,QAAhB,EAA0BC,MAA1B,KAAqC;AACnC,QAAIH,KAAK,KAAKP,0BAAeW,KAAzB,IAAkC,CAACb,0BAA0B,CAACc,KAAlE,EAAyE;AACvE;AACR;AACA;AACA;AACA;AACQP,MAAAA,4BAA4B,CAACO,KAA7B,GAAqC,CAACL,KAAD,EAAQC,MAAR,EAAgBC,QAA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AEEW,MAAM,IAAI;AACR,UAAMC,MAAM,GAAGnB,4BAA4B,CAACO,KAA5C;;AACA,QAAIW,MAAM,IAAIC,MAAM,CAACC,MAAP,GAAgB,CAA9B,EAAiC;AAC/BnB,MAAAA,mBAAmB,CAACkB,MAAM,CAAC,CAAD,CAAP,EAAYA,MAAM,CAAC,CAAD,CAAlB,EAAuBA,MAAM,CAAC,CAAD,CAA7B,EAAkCA,MAAM,CAAC,CAAD,CAAxC,CAAnB;AACD;AACF,GAPH,EAhF+B,CAyF/B;;AAEA,SAAO;AACLjB,IAAAA,KAAK,EAAER,aADF;AAELS,IAAAA,MAAM,EAAEN,cAFH;AAGLwB,IAAAA,eAAe,EAAEvB,uBAHZ;AAILwB,IAAAA,iBAAiB,EAAEvB,yBAJd;AAKLN,IAAAA;AALK,GAAP;AAOD,CAlGM","sourcesContent":["import { useEffect } from 'react';\nimport {\n Keyboard,\n KeyboardEvent,\n KeyboardEventEasing,\n KeyboardEventName,\n Platform,\n} from 'react-native';\nimport {\n runOnUI,\n useAnimatedReaction,\n useSharedValue,\n useWorkletCallback,\n} from 'react-native-reanimated';\nimport { KEYBOARD_STATE } from '../constants';\n\nconst KEYBOARD_EVENT_MAPPER = {\n KEYBOARD_SHOW: Platform.select({\n ios: 'keyboardWillShow',\n android: 'keyboardDidShow',\n default: '',\n }) as KeyboardEventName,\n KEYBOARD_HIDE: Platform.select({\n ios: 'keyboardWillHide',\n android: 'keyboardDidHide',\n default: '',\n }) as KeyboardEventName,\n};\n\nexport const useKeyboard = () => {\n //#region variables\n const shouldHandleKeyboardEvents = useSharedValue(false);\n const keyboardState = useSharedValue(\n KEYBOARD_STATE.UNDETERMINED\n );\n const keyboardHeight = useSharedValue(0);\n const keyboardAnimationEasing =\n useSharedValue('keyboard');\n const keyboardAnimationDuration = useSharedValue(500);\n const temporaryCachedKeyboardEvent = useSharedValue([]);\n //#endregion\n\n //#region worklets\n const handleKeyboardEvent = useWorkletCallback(\n (state, height, duration, easing) => {\n if (state === KEYBOARD_STATE.SHOWN && !shouldHandleKeyboardEvents.value) {\n /**\n * if the keyboard event was fired before the `onFocus` on TextInput,\n * then we cache the input, and wait till the `shouldHandleKeyboardEvents`\n * to be updated then fire this function again.\n */\n temporaryCachedKeyboardEvent.value = [state, height, duration, easing];\n return;\n }\n keyboardHeight.value =\n state === KEYBOARD_STATE.SHOWN\n ? height\n : height === 0\n ? keyboardHeight.value\n : height;\n keyboardAnimationDuration.value = duration;\n keyboardAnimationEasing.value = easing;\n keyboardState.value = state;\n temporaryCachedKeyboardEvent.value = [];\n },\n []\n );\n //#endregion\n\n //#region effects\n useEffect(() => {\n const handleOnKeyboardShow = (event: KeyboardEvent) => {\n runOnUI(handleKeyboardEvent)(\n KEYBOARD_STATE.SHOWN,\n event.endCoordinates.height,\n event.duration,\n event.easing\n );\n };\n const handleOnKeyboardHide = (event: KeyboardEvent) => {\n runOnUI(handleKeyboardEvent)(\n KEYBOARD_STATE.HIDDEN,\n event.endCoordinates.height,\n event.duration,\n event.easing\n );\n };\n\n const showSubscription = Keyboard.addListener(\n KEYBOARD_EVENT_MAPPER.KEYBOARD_SHOW,\n handleOnKeyboardShow\n );\n\n const hideSubscription = Keyboard.addListener(\n KEYBOARD_EVENT_MAPPER.KEYBOARD_HIDE,\n handleOnKeyboardHide\n );\n\n return () => {\n showSubscription.remove();\n hideSubscription.remove();\n };\n }, [handleKeyboardEvent]);\n\n /**\n * This reaction is needed to handle the issue with multiline text input.\n *\n * @link https://github.com/gorhom/react-native-bottom-sheet/issues/411\n */\n useAnimatedReaction(\n () => shouldHandleKeyboardEvents.value,\n result => {\n const params = temporaryCachedKeyboardEvent.value;\n if (result && params.length > 0) {\n handleKeyboardEvent(params[0], params[1], params[2], params[3]);\n }\n }\n );\n //#endregion\n\n return {\n state: keyboardState,\n height: keyboardHeight,\n animationEasing: keyboardAnimationEasing,\n animationDuration: keyboardAnimationDuration,\n shouldHandleKeyboardEvents,\n };\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/hooks/useNormalizedSnapPoints.js b/lib/commonjs/hooks/useNormalizedSnapPoints.js new file mode 100644 index 000000000..b24ea076f --- /dev/null +++ b/lib/commonjs/hooks/useNormalizedSnapPoints.js @@ -0,0 +1,58 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.useNormalizedSnapPoints = void 0; + +var _reactNativeReanimated = require("react-native-reanimated"); + +var _utilities = require("../utilities"); + +var _constants = require("../components/bottomSheet/constants"); + +/** + * Convert percentage snap points to pixels in screen and calculate + * the accurate snap points positions. + * @param snapPoints provided snap points. + * @param containerHeight BottomSheetContainer height. + * @param contentHeight content size. + * @param handleHeight handle size. + * @param enableDynamicSizing + * @param maxDynamicContentSize + * @returns {Animated.SharedValue} + */ +const useNormalizedSnapPoints = (snapPoints, containerHeight, contentHeight, handleHeight, enableDynamicSizing, maxDynamicContentSize) => { + const normalizedSnapPoints = (0, _reactNativeReanimated.useDerivedValue)(() => { + // early exit, if container layout is not ready + const isContainerLayoutReady = containerHeight.value !== _constants.INITIAL_CONTAINER_HEIGHT; + + if (!isContainerLayoutReady) { + return [_constants.INITIAL_SNAP_POINT]; + } + + const _snapPoints = snapPoints ? 'value' in snapPoints ? snapPoints.value : snapPoints : []; + + let _normalizedSnapPoints = _snapPoints.map(snapPoint => (0, _utilities.normalizeSnapPoint)(snapPoint, containerHeight.value)); + + if (enableDynamicSizing) { + if (handleHeight.value === _constants.INITIAL_HANDLE_HEIGHT) { + return [_constants.INITIAL_SNAP_POINT]; + } + + if (contentHeight.value === _constants.INITIAL_CONTAINER_HEIGHT) { + return [_constants.INITIAL_SNAP_POINT]; + } + + _normalizedSnapPoints.push(containerHeight.value - Math.min(contentHeight.value + handleHeight.value, maxDynamicContentSize !== undefined ? maxDynamicContentSize : containerHeight.value)); + + _normalizedSnapPoints = _normalizedSnapPoints.sort((a, b) => b - a); + } + + return _normalizedSnapPoints; + }, [snapPoints, enableDynamicSizing, maxDynamicContentSize]); + return normalizedSnapPoints; +}; + +exports.useNormalizedSnapPoints = useNormalizedSnapPoints; +//# sourceMappingURL=useNormalizedSnapPoints.js.map \ No newline at end of file diff --git a/lib/commonjs/hooks/useNormalizedSnapPoints.js.map b/lib/commonjs/hooks/useNormalizedSnapPoints.js.map new file mode 100644 index 000000000..dcabb6660 --- /dev/null +++ b/lib/commonjs/hooks/useNormalizedSnapPoints.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["useNormalizedSnapPoints.ts"],"names":["useNormalizedSnapPoints","snapPoints","containerHeight","contentHeight","handleHeight","enableDynamicSizing","maxDynamicContentSize","normalizedSnapPoints","isContainerLayoutReady","value","INITIAL_CONTAINER_HEIGHT","INITIAL_SNAP_POINT","_snapPoints","_normalizedSnapPoints","map","snapPoint","INITIAL_HANDLE_HEIGHT","push","Math","min","undefined","sort","a","b"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,uBAAuB,GAAG,CACrCC,UADqC,EAErCC,eAFqC,EAGrCC,aAHqC,EAIrCC,YAJqC,EAKrCC,mBALqC,EAMrCC,qBANqC,KAOlC;AACH,QAAMC,oBAAoB,GAAG,4CAAgB,MAAM;AACjD;AACA,UAAMC,sBAAsB,GAC1BN,eAAe,CAACO,KAAhB,KAA0BC,mCAD5B;;AAEA,QAAI,CAACF,sBAAL,EAA6B;AAC3B,aAAO,CAACG,6BAAD,CAAP;AACD;;AAED,UAAMC,WAAW,GAAGX,UAAU,GAC1B,WAAWA,UAAX,GACEA,UAAU,CAACQ,KADb,GAEER,UAHwB,GAI1B,EAJJ;;AAMA,QAAIY,qBAAqB,GAAGD,WAAW,CAACE,GAAZ,CAAgBC,SAAS,IACnD,mCAAmBA,SAAnB,EAA8Bb,eAAe,CAACO,KAA9C,CAD0B,CAA5B;;AAIA,QAAIJ,mBAAJ,EAAyB;AACvB,UAAID,YAAY,CAACK,KAAb,KAAuBO,gCAA3B,EAAkD;AAChD,eAAO,CAACL,6BAAD,CAAP;AACD;;AAED,UAAIR,aAAa,CAACM,KAAd,KAAwBC,mCAA5B,EAAsD;AACpD,eAAO,CAACC,6BAAD,CAAP;AACD;;AAEDE,MAAAA,qBAAqB,CAACI,IAAtB,CACEf,eAAe,CAACO,KAAhB,GACES,IAAI,CAACC,GAAL,CACEhB,aAAa,CAACM,KAAd,GAAsBL,YAAY,CAACK,KADrC,EAEEH,qBAAqB,KAAKc,SAA1B,GACId,qBADJ,GAEIJ,eAAe,CAACO,KAJtB,CAFJ;;AAUAI,MAAAA,qBAAqB,GAAGA,qBAAqB,CAACQ,IAAtB,CAA2B,CAACC,CAAD,EAAIC,CAAJ,KAAUA,CAAC,GAAGD,CAAzC,CAAxB;AACD;;AACD,WAAOT,qBAAP;AACD,GAxC4B,EAwC1B,CAACZ,UAAD,EAAaI,mBAAb,EAAkCC,qBAAlC,CAxC0B,CAA7B;AA0CA,SAAOC,oBAAP;AACD,CAnDM","sourcesContent":["import Animated, { useDerivedValue } from 'react-native-reanimated';\nimport { normalizeSnapPoint } from '../utilities';\nimport type { BottomSheetProps } from '../components/bottomSheet';\nimport {\n INITIAL_CONTAINER_HEIGHT,\n INITIAL_HANDLE_HEIGHT,\n INITIAL_SNAP_POINT,\n} from '../components/bottomSheet/constants';\n\n/**\n * Convert percentage snap points to pixels in screen and calculate\n * the accurate snap points positions.\n * @param snapPoints provided snap points.\n * @param containerHeight BottomSheetContainer height.\n * @param contentHeight content size.\n * @param handleHeight handle size.\n * @param enableDynamicSizing\n * @param maxDynamicContentSize\n * @returns {Animated.SharedValue}\n */\nexport const useNormalizedSnapPoints = (\n snapPoints: BottomSheetProps['snapPoints'],\n containerHeight: Animated.SharedValue,\n contentHeight: Animated.SharedValue,\n handleHeight: Animated.SharedValue,\n enableDynamicSizing: BottomSheetProps['enableDynamicSizing'],\n maxDynamicContentSize: BottomSheetProps['maxDynamicContentSize']\n) => {\n const normalizedSnapPoints = useDerivedValue(() => {\n // early exit, if container layout is not ready\n const isContainerLayoutReady =\n containerHeight.value !== INITIAL_CONTAINER_HEIGHT;\n if (!isContainerLayoutReady) {\n return [INITIAL_SNAP_POINT];\n }\n\n const _snapPoints = snapPoints\n ? 'value' in snapPoints\n ? snapPoints.value\n : snapPoints\n : [];\n\n let _normalizedSnapPoints = _snapPoints.map(snapPoint =>\n normalizeSnapPoint(snapPoint, containerHeight.value)\n ) as number[];\n\n if (enableDynamicSizing) {\n if (handleHeight.value === INITIAL_HANDLE_HEIGHT) {\n return [INITIAL_SNAP_POINT];\n }\n\n if (contentHeight.value === INITIAL_CONTAINER_HEIGHT) {\n return [INITIAL_SNAP_POINT];\n }\n\n _normalizedSnapPoints.push(\n containerHeight.value -\n Math.min(\n contentHeight.value + handleHeight.value,\n maxDynamicContentSize !== undefined\n ? maxDynamicContentSize\n : containerHeight.value\n )\n );\n\n _normalizedSnapPoints = _normalizedSnapPoints.sort((a, b) => b - a);\n }\n return _normalizedSnapPoints;\n }, [snapPoints, enableDynamicSizing, maxDynamicContentSize]);\n\n return normalizedSnapPoints;\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/hooks/usePropsValidator.js b/lib/commonjs/hooks/usePropsValidator.js new file mode 100644 index 000000000..ba3d109ce --- /dev/null +++ b/lib/commonjs/hooks/usePropsValidator.js @@ -0,0 +1,53 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.usePropsValidator = void 0; + +var _react = require("react"); + +var _invariant = _interopRequireDefault(require("invariant")); + +var _constants = require("../components/bottomSheet/constants"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @todo + * replace this with `prop-types`. + */ +const usePropsValidator = ({ + index, + snapPoints, + enableDynamicSizing, + topInset, + bottomInset +}) => { + (0, _react.useMemo)(() => { + //#region snap points + const _snapPoints = snapPoints ? 'value' in snapPoints ? snapPoints.value : snapPoints : []; + + (0, _invariant.default)(_snapPoints || enableDynamicSizing, `'snapPoints' was not provided! please provide at least one snap point.`); + + _snapPoints.map(snapPoint => { + const _snapPoint = typeof snapPoint === 'number' ? snapPoint : parseInt(snapPoint.replace('%', ''), 10); + + (0, _invariant.default)(_snapPoint > 0 || _snapPoint === _constants.INITIAL_SNAP_POINT, `Snap point '${snapPoint}' is invalid. if you want to allow user to close the sheet, Please use 'enablePanDownToClose' prop.`); + }); + + (0, _invariant.default)('value' in _snapPoints || _snapPoints.length > 0 || enableDynamicSizing, `'snapPoints' was provided with no points! please provide at least one snap point.`); //#endregion + //#region index + + (0, _invariant.default)(typeof index === 'number' || typeof index === 'undefined', `'index' was provided but with wrong type ! expected type is a number.`); + (0, _invariant.default)(enableDynamicSizing || (typeof index === 'number' ? index >= -1 && index <= _snapPoints.length - 1 : true), `'index' was provided but out of the provided snap points range! expected value to be between -1, ${_snapPoints.length - 1}`); //#endregion + //#region insets + + (0, _invariant.default)(typeof topInset === 'number' || typeof topInset === 'undefined', `'topInset' was provided but with wrong type ! expected type is a number.`); + (0, _invariant.default)(typeof bottomInset === 'number' || typeof bottomInset === 'undefined', `'bottomInset' was provided but with wrong type ! expected type is a number.`); //#endregion + // animations + }, [index, snapPoints, topInset, bottomInset, enableDynamicSizing]); +}; + +exports.usePropsValidator = usePropsValidator; +//# sourceMappingURL=usePropsValidator.js.map \ No newline at end of file diff --git a/lib/commonjs/hooks/usePropsValidator.js.map b/lib/commonjs/hooks/usePropsValidator.js.map new file mode 100644 index 000000000..96572db4b --- /dev/null +++ b/lib/commonjs/hooks/usePropsValidator.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["usePropsValidator.ts"],"names":["usePropsValidator","index","snapPoints","enableDynamicSizing","topInset","bottomInset","_snapPoints","value","map","snapPoint","_snapPoint","parseInt","replace","INITIAL_SNAP_POINT","length"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;AAGA;AACA;AACA;AACA;AAEO,MAAMA,iBAAiB,GAAG,CAAC;AAChCC,EAAAA,KADgC;AAEhCC,EAAAA,UAFgC;AAGhCC,E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QC,UAAR,EAAoBE,QAApB,EAA8BC,WAA9B,EAA2CF,mBAA3C,CA3DH;AA4DD,CAnEM","sourcesContent":["import { useMemo } from 'react';\nimport invariant from 'invariant';\nimport { INITIAL_SNAP_POINT } from '../components/bottomSheet/constants';\nimport type { BottomSheetProps } from '../components/bottomSheet';\n\n/**\n * @todo\n * replace this with `prop-types`.\n */\n\nexport const usePropsValidator = ({\n index,\n snapPoints,\n enableDynamicSizing,\n topInset,\n bottomInset,\n}: BottomSheetProps) => {\n useMemo(() => {\n //#region snap points\n const _snapPoints = snapPoints\n ? 'value' in snapPoints\n ? snapPoints.value\n : snapPoints\n : [];\n invariant(\n _snapPoints || enableDynamicSizing,\n `'snapPoints' was not provided! please provide at least one snap point.`\n );\n\n _snapPoints.map(snapPoint => {\n const _snapPoint =\n typeof snapPoint === 'number'\n ? snapPoint\n : parseInt(snapPoint.replace('%', ''), 10);\n\n invariant(\n _snapPoint > 0 || _snapPoint === INITIAL_SNAP_POINT,\n `Snap point '${snapPoint}' is invalid. if you want to allow user to close the sheet, Please use 'enablePanDownToClose' prop.`\n );\n });\n\n invariant(\n 'value' in _snapPoints || _snapPoints.length > 0 || enableDynamicSizing,\n `'snapPoints' was provided with no points! please provide at least one snap point.`\n );\n //#endregion\n\n //#region index\n invariant(\n typeof index === 'number' || typeof index === 'undefined',\n `'index' was provided but with wrong type ! expected type is a number.`\n );\n\n invariant(\n enableDynamicSizing ||\n (typeof index === 'number'\n ? index >= -1 && index <= _snapPoints.length - 1\n : true),\n `'index' was provided but out of the provided snap points range! expected value to be between -1, ${\n _snapPoints.length - 1\n }`\n );\n //#endregion\n\n //#region insets\n invariant(\n typeof topInset === 'number' || typeof topInset === 'undefined',\n `'topInset' was provided but with wrong type ! expected type is a number.`\n );\n invariant(\n typeof bottomInset === 'number' || typeof bottomInset === 'undefined',\n `'bottomInset' was provided but with wrong type ! expected type is a number.`\n );\n //#endregion\n\n // animations\n }, [index, snapPoints, topInset, bottomInset, enableDynamicSizing]);\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/hooks/useReactiveSharedValue.js b/lib/commonjs/hooks/useReactiveSharedValue.js new file mode 100644 index 000000000..080d3c28a --- /dev/null +++ b/lib/commonjs/hooks/useReactiveSharedValue.js @@ -0,0 +1,55 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.useReactiveSharedValue = void 0; + +var _react = require("react"); + +var _reactNativeReanimated = require("react-native-reanimated"); + +const useReactiveSharedValue = value => { + var _valueRef$current; + + const initialValueRef = (0, _react.useRef)(null); + const valueRef = (0, _react.useRef)(null); + + if (value && typeof value === 'object' && 'value' in value) { + /** + * if provided value is a shared value, + * then we do not initialize another one. + */ + } else if (valueRef.current === null) { + // @ts-ignore + initialValueRef.current = value; + /** + * if value is an object, then we need to + * pass a clone. + */ + + if (typeof value === 'object') { + // @ts-ignore + valueRef.current = (0, _reactNativeReanimated.makeMutable)({ ...value + }); + } else { + // @ts-ignore + valueRef.current = (0, _reactNativeReanimated.makeMutable)(value); + } + } else if (initialValueRef.current !== value) { + valueRef.current.value = value; + } + + (0, _react.useEffect)(() => { + return () => { + if (valueRef.current) { + (0, _reactNativeReanimated.cancelAnimation)(valueRef.current); + } + }; + }, []); // @ts-ignore + + return (_valueRef$current = valueRef.current) !== null && _valueRef$current !== void 0 ? _valueRef$current : value; +}; + +exports.useReactiveSharedValue = useReactiveSharedValue; +//# sourceMappingURL=useReactiveSharedValue.js.map \ No newline at end of file diff --git a/lib/commonjs/hooks/useReactiveSharedValue.js.map b/lib/commonjs/hooks/useReactiveSharedValue.js.map new file mode 100644 index 000000000..17c2ad0c4 --- /dev/null +++ b/lib/commonjs/hooks/useReactiveSharedValue.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["useReactiveSharedValue.ts"],"names":["useReactiveSharedValue","value","initialValueRef","valueRef","current"],"mappings":";;;;;;;AAAA;;AACA;;AAMO,MAAMA,sBAAsB,GACjCC,KADoC,IAEkB;AAAA;;AACtD,QAAMC,eAAe,GAAG,mBAAU,IAAV,CAAxB;AACA,QAAMC,QAAQ,GAAG,mBAAgC,IAAhC,CAAjB;;AAEA,MAAIF,KAAK,IAAI,OAAOA,KAAP,KAAiB,QAA1B,IAAsC,WAAWA,KAArD,EAA4D;AAC1D;AACJ;AACA;AACA;AACG,GALD,MAKO,IAAIE,QAAQ,CAACC,OAAT,KAAqB,IAAzB,EAA+B;AACpC;AACAF,IAAAA,eAAe,CAACE,OAAhB,GAA0BH,KAA1B;AACA;AACJ;AACA;AACA;;AACI,QAAI,OAAOA,KAAP,KAAiB,QAArB,EAA+B;AAC7B;AACAE,MAAAA,QAAQ,CAACC,OAAT,GAAmB,wCAAY,EAAE,GAAGH;AAAL,OAAZ,CAAnB;AACD,KAHD,MAGO;AACL;AACAE,MAAAA,QAAQ,CAACC,OAAT,GAAmB,wCAAYH,KAAZ,CAAnB;AACD;AACF,GAdM,MAcA,IAAIC,eAAe,CAACE,OAAhB,KAA4BH,KAAhC,EAAuC;AAC5CE,IAAAA,QAAQ,CAACC,OAAT,CAAiBH,KAAjB,GAAyBA,KAAzB;AACD;;AAED,wBAAU,MAAM;AACd,WAAO,MAAM;AACX,UAAIE,QAAQ,CAACC,OAAb,EAAsB;AACpB,oDAAgBD,QAAQ,CAACC,OAAzB;AACD;AACF,KAJD;AAKD,GAND,EAMG,EANH,EA3BsD,CAmCtD;;AACA,8BAAOD,QAAQ,CAACC,OAAhB,iEAA2BH,KAA3B;AACD,CAvCM","sourcesContent":["import { useEffect, useRef } from 'react';\nimport Animated, {\n cancelAnimation,\n makeMutable,\n} from 'react-native-reanimated';\nimport type { Primitive } from '../types';\n\nexport const useReactiveSharedValue = (\n value: T\n): T extends Primitive ? Animated.SharedValue : T => {\n const initialValueRef = useRef(null);\n const valueRef = useRef>(null);\n\n if (value && typeof value === 'object' && 'value' in value) {\n /**\n * if provided value is a shared value,\n * then we do not initialize another one.\n */\n } else if (valueRef.current === null) {\n // @ts-ignore\n initialValueRef.current = value;\n /**\n * if value is an object, then we need to\n * pass a clone.\n */\n if (typeof value === 'object') {\n // @ts-ignore\n valueRef.current = makeMutable({ ...value });\n } else {\n // @ts-ignore\n valueRef.current = makeMutable(value);\n }\n } else if (initialValueRef.current !== value) {\n valueRef.current.value = value as T;\n }\n\n useEffect(() => {\n return () => {\n if (valueRef.current) {\n cancelAnimation(valueRef.current);\n }\n };\n }, []);\n\n // @ts-ignore\n return valueRef.current ?? value;\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/hooks/useScrollEventsHandlersDefault.js b/lib/commonjs/hooks/useScrollEventsHandlersDefault.js new file mode 100644 index 000000000..ce3a22563 --- /dev/null +++ b/lib/commonjs/hooks/useScrollEventsHandlersDefault.js @@ -0,0 +1,111 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.useScrollEventsHandlersDefault = void 0; + +var _reactNativeReanimated = require("react-native-reanimated"); + +var _useBottomSheetInternal = require("./useBottomSheetInternal"); + +var _constants = require("../constants"); + +const useScrollEventsHandlersDefault = (scrollableRef, scrollableContentOffsetY) => { + // hooks + const { + animatedSheetState, + animatedScrollableState, + animatedAnimationState, + animatedScrollableContentOffsetY: rootScrollableContentOffsetY + } = (0, _useBottomSheetInternal.useBottomSheetInternal)(); //#region callbacks + + const handleOnScroll = (0, _reactNativeReanimated.useWorkletCallback)((_, context) => { + /** + * if sheet position is extended or fill parent, then we reset + * `shouldLockInitialPosition` value to false. + */ + if (animatedSheetState.value === _constants.SHEET_STATE.EXTENDED || animatedSheetState.value === _constants.SHEET_STATE.FILL_PARENT) { + context.shouldLockInitialPosition = false; + } + + if (animatedScrollableState.value === _constants.SCROLLABLE_STATE.LOCKED) { + var _context$initialConte; + + const lockPosition = context.shouldLockInitialPosition ? (_context$initialConte = context.initialContentOffsetY) !== null && _context$initialConte !== void 0 ? _context$initialConte : 0 : 0; // @ts-ignore + + (0, _reactNativeReanimated.scrollTo)(scrollableRef, 0, lockPosition, false); + scrollableContentOffsetY.value = lockPosition; + return; + } + }, [scrollableRef, scrollableContentOffsetY, animatedScrollableState, animatedSheetState]); + const handleOnBeginDrag = (0, _reactNativeReanimated.useWorkletCallback)(({ + contentOffset: { + y + } + }, context) => { + scrollableContentOffsetY.value = y; + rootScrollableContentOffsetY.value = y; + context.initialContentOffsetY = y; + /** + * if sheet position not extended or fill parent and the scrollable position + * not at the top, then we should lock the initial scrollable position. + */ + + if (animatedSheetState.value !== _constants.SHEET_STATE.EXTENDED && animatedSheetState.value !== _constants.SHEET_STATE.FILL_PARENT && y > 0) { + context.shouldLockInitialPosition = true; + } else { + context.shouldLockInitialPosition = false; + } + }, [scrollableContentOffsetY, animatedSheetState, rootScrollableContentOffsetY]); + const handleOnEndDrag = (0, _reactNativeReanimated.useWorkletCallback)(({ + contentOffset: { + y + } + }, context) => { + if (animatedScrollableState.value === _constants.SCROLLABLE_STATE.LOCKED) { + var _context$initialConte2; + + const lockPosition = context.shouldLockInitialPosition ? (_context$initialConte2 = context.initialContentOffsetY) !== null && _context$initialConte2 !== void 0 ? _context$initialConte2 : 0 : 0; // @ts-ignore + + (0, _reactNativeReanimated.scrollTo)(scrollableRef, 0, lockPosition, false); + scrollableContentOffsetY.value = lockPosition; + return; + } + + if (animatedAnimationState.value !== _constants.ANIMATION_STATE.RUNNING) { + scrollableContentOffsetY.value = y; + rootScrollableContentOffsetY.value = y; + } + }, [scrollableRef, scrollableContentOffsetY, animatedAnimationState, animatedScrollableState, rootScrollableContentOffsetY]); + const handleOnMomentumEnd = (0, _reactNativeReanimated.useWorkletCallback)(({ + contentOffset: { + y + } + }, context) => { + if (animatedScrollableState.value === _constants.SCROLLABLE_STATE.LOCKED) { + var _context$initialConte3; + + const lockPosition = context.shouldLockInitialPosition ? (_context$initialConte3 = context.initialContentOffsetY) !== null && _context$initialConte3 !== void 0 ? _context$initialConte3 : 0 : 0; // @ts-ignore + + (0, _reactNativeReanimated.scrollTo)(scrollableRef, 0, lockPosition, false); + scrollableContentOffsetY.value = 0; + return; + } + + if (animatedAnimationState.value !== _constants.ANIMATION_STATE.RUNNING) { + scrollableContentOffsetY.value = y; + rootScrollableContentOffsetY.value = y; + } + }, [scrollableContentOffsetY, scrollableRef, animatedAnimationState, animatedScrollableState, rootScrollableContentOffsetY]); //#endregion + + return { + handleOnScroll, + handleOnBeginDrag, + handleOnEndDrag, + handleOnMomentumEnd + }; +}; + +exports.useScrollEventsHandlersDefault = useScrollEventsHandlersDefault; +//# sourceMappingURL=useScrollEventsHandlersDefault.js.map \ No newline at end of file diff --git a/lib/commonjs/hooks/useScrollEventsHandlersDefault.js.map b/lib/commonjs/hooks/useScrollEventsHandlersDefault.js.map new file mode 100644 index 000000000..114683a57 --- /dev/null +++ b/lib/commonjs/hooks/useScrollEventsHandlersDefault.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["useScrollEventsHandlersDefault.ts"],"names":["useScrollEventsHandlersDefault","scrollableRef","scrollableContentOffsetY","animatedSheetState","animatedScrollableState","animatedAnimationState","animatedScrollableContentOffsetY","rootScrollableContentOffsetY","handleOnScroll","_","context","value","SHEET_STATE","EXTENDED","FILL_PARENT","shouldLockInitialPosition","SCROLLABLE_STATE","LOCKED","lockPosition","initialContentOffsetY","handleOnBeginDrag","contentOffset","y","handleOnEndDrag","ANIMATION_STATE","RUNNING","handleOnMomentumEnd"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAWO,MAAMA,8BAA4D,GAAG,CAC1EC,aAD0E,EAE1EC,wBAF0E,KAGvE;AACH;AACA,QAAM;AACJC,IAAAA,kBADI;AAEJC,IAAAA,uBAFI;AAGJC,IAAAA,sBAHI;AAIJC,IAAAA,gCAAgC,EAAEC;AAJ9B,MAKF,qDALJ,CAFG,CASH;;AACA,QAAMC,cAAsE,GAC1E,+CACE,CAACC,CAAD,EAAIC,OAAJ,KAAgB;AACd;AACR;AACA;AACA;AACQ,QACEP,kBAAkB,CAACQ,KAAnB,KAA6BC,uBAAYC,QAAzC,IACAV,kBAAkB,CAACQ,KAAnB,KAA6BC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wBADF,EAEED,aAFF,EAGEI,sBAHF,EAIED,uBAJF,EAKEG,4BALF,CAhBF,CADF,CA7FG,CAsHH;;AAEA,SAAO;AACLC,IAAAA,cADK;AAELY,IAAAA,iBAFK;AAGLG,IAAAA,eAHK;AAILG,IAAAA;AAJK,GAAP;AAMD,CAjIM","sourcesContent":["import { scrollTo, useWorkletCallback } from 'react-native-reanimated';\nimport { useBottomSheetInternal } from './useBottomSheetInternal';\nimport { ANIMATION_STATE, SCROLLABLE_STATE, SHEET_STATE } from '../constants';\nimport type {\n ScrollEventsHandlersHookType,\n ScrollEventHandlerCallbackType,\n} from '../types';\n\nexport type ScrollEventContextType = {\n initialContentOffsetY: number;\n shouldLockInitialPosition: boolean;\n};\n\nexport const useScrollEventsHandlersDefault: ScrollEventsHandlersHookType = (\n scrollableRef,\n scrollableContentOffsetY\n) => {\n // hooks\n const {\n animatedSheetState,\n animatedScrollableState,\n animatedAnimationState,\n animatedScrollableContentOffsetY: rootScrollableContentOffsetY,\n } = useBottomSheetInternal();\n\n //#region callbacks\n const handleOnScroll: ScrollEventHandlerCallbackType =\n useWorkletCallback(\n (_, context) => {\n /**\n * if sheet position is extended or fill parent, then we reset\n * `shouldLockInitialPosition` value to false.\n */\n if (\n animatedSheetState.value === SHEET_STATE.EXTENDED ||\n animatedSheetState.value === SHEET_STATE.FILL_PARENT\n ) {\n context.shouldLockInitialPosition = false;\n }\n\n if (animatedScrollableState.value === SCROLLABLE_STATE.LOCKED) {\n const lockPosition = context.shouldLockInitialPosition\n ? context.initialContentOffsetY ?? 0\n : 0;\n // @ts-ignore\n scrollTo(scrollableRef, 0, lockPosition, false);\n scrollableContentOffsetY.value = lockPosition;\n return;\n }\n },\n [\n scrollableRef,\n scrollableContentOffsetY,\n animatedScrollableState,\n animatedSheetState,\n ]\n );\n const handleOnBeginDrag: ScrollEventHandlerCallbackType =\n useWorkletCallback(\n ({ contentOffset: { y } }, context) => {\n scrollableContentOffsetY.value = y;\n rootScrollableContentOffsetY.value = y;\n context.initialContentOffsetY = y;\n\n /**\n * if sheet position not extended or fill parent and the scrollable position\n * not at the top, then we should lock the initial scrollable position.\n */\n if (\n animatedSheetState.value !== SHEET_STATE.EXTENDED &&\n animatedSheetState.value !== SHEET_STATE.FILL_PARENT &&\n y > 0\n ) {\n context.shouldLockInitialPosition = true;\n } else {\n context.shouldLockInitialPosition = false;\n }\n },\n [\n scrollableContentOffsetY,\n animatedSheetState,\n rootScrollableContentOffsetY,\n ]\n );\n const handleOnEndDrag: ScrollEventHandlerCallbackType =\n useWorkletCallback(\n ({ contentOffset: { y } }, context) => {\n if (animatedScrollableState.value === SCROLLABLE_STATE.LOCKED) {\n const lockPosition = context.shouldLockInitialPosition\n ? context.initialContentOffsetY ?? 0\n : 0;\n // @ts-ignore\n scrollTo(scrollableRef, 0, lockPosition, false);\n scrollableContentOffsetY.value = lockPosition;\n return;\n }\n if (animatedAnimationState.value !== ANIMATION_STATE.RUNNING) {\n scrollableContentOffsetY.value = y;\n rootScrollableContentOffsetY.value = y;\n }\n },\n [\n scrollableRef,\n scrollableContentOffsetY,\n animatedAnimationState,\n animatedScrollableState,\n rootScrollableContentOffsetY,\n ]\n );\n const handleOnMomentumEnd: ScrollEventHandlerCallbackType =\n useWorkletCallback(\n ({ contentOffset: { y } }, context) => {\n if (animatedScrollableState.value === SCROLLABLE_STATE.LOCKED) {\n const lockPosition = context.shouldLockInitialPosition\n ? context.initialContentOffsetY ?? 0\n : 0;\n // @ts-ignore\n scrollTo(scrollableRef, 0, lockPosition, false);\n scrollableContentOffsetY.value = 0;\n return;\n }\n if (animatedAnimationState.value !== ANIMATION_STATE.RUNNING) {\n scrollableContentOffsetY.value = y;\n rootScrollableContentOffsetY.value = y;\n }\n },\n [\n scrollableContentOffsetY,\n scrollableRef,\n animatedAnimationState,\n animatedScrollableState,\n rootScrollableContentOffsetY,\n ]\n );\n //#endregion\n\n return {\n handleOnScroll,\n handleOnBeginDrag,\n handleOnEndDrag,\n handleOnMomentumEnd,\n };\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/hooks/useScrollHandler.js b/lib/commonjs/hooks/useScrollHandler.js new file mode 100644 index 000000000..51864de15 --- /dev/null +++ b/lib/commonjs/hooks/useScrollHandler.js @@ -0,0 +1,67 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.useScrollHandler = void 0; + +var _reactNativeReanimated = require("react-native-reanimated"); + +var _useScrollEventsHandlersDefault = require("./useScrollEventsHandlersDefault"); + +var _utilities = require("../utilities"); + +const useScrollHandler = (useScrollEventsHandlers = _useScrollEventsHandlersDefault.useScrollEventsHandlersDefault, onScroll, onScrollBeginDrag, onScrollEndDrag) => { + // refs + const scrollableRef = (0, _reactNativeReanimated.useAnimatedRef)(); // variables + + const scrollableContentOffsetY = (0, _reactNativeReanimated.useSharedValue)(0); // hooks + + const { + handleOnScroll = _utilities.workletNoop, + handleOnBeginDrag = _utilities.workletNoop, + handleOnEndDrag = _utilities.workletNoop, + handleOnMomentumEnd = _utilities.workletNoop, + handleOnMomentumBegin = _utilities.workletNoop + } = useScrollEventsHandlers(scrollableRef, scrollableContentOffsetY); // callbacks + + const scrollHandler = (0, _reactNativeReanimated.useAnimatedScrollHandler)({ + onScroll: (event, context) => { + handleOnScroll(event, context); + + if (onScroll) { + (0, _reactNativeReanimated.runOnJS)(onScroll)({ + nativeEvent: event + }); + } + }, + onBeginDrag: (event, context) => { + handleOnBeginDrag(event, context); + + if (onScrollBeginDrag) { + (0, _reactNativeReanimated.runOnJS)(onScrollBeginDrag)({ + nativeEvent: event + }); + } + }, + onEndDrag: (event, context) => { + handleOnEndDrag(event, context); + + if (onScrollEndDrag) { + (0, _reactNativeReanimated.runOnJS)(onScrollEndDrag)({ + nativeEvent: event + }); + } + }, + onMomentumBegin: handleOnMomentumBegin, + onMomentumEnd: handleOnMomentumEnd + }, [handleOnScroll, handleOnBeginDrag, handleOnEndDrag, handleOnMomentumBegin, handleOnMomentumEnd, onScroll, onScrollBeginDrag, onScrollEndDrag]); + return { + scrollHandler, + scrollableRef, + scrollableContentOffsetY + }; +}; + +exports.useScrollHandler = useScrollHandler; +//# sourceMappingURL=useScrollHandler.js.map \ No newline at end of file diff --git a/lib/commonjs/hooks/useScrollHandler.js.map b/lib/commonjs/hooks/useScrollHandler.js.map new file mode 100644 index 000000000..d8de55aa0 --- /dev/null +++ b/lib/commonjs/hooks/useScrollHandler.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["useScrollHandler.ts"],"names":["useScrollHandler","useScrollEventsHandlers","useScrollEventsHandlersDefault","onScroll","onScrollBeginDrag","onScrollEndDrag","scrollableRef","scrollableContentOffsetY","handleOnScroll","noop","handleOnBeginDrag","handleOnEndDrag","handleOnMomentumEnd","handleOnMomentumBegin","scrollHandler","event","context","nativeEvent","onBeginDrag","onEndDrag","onMomentumBegin","onMomentumEnd"],"mappings":";;;;;;;AAAA;;AAMA;;AACA;;AAGO,MAAMA,gBAAgB,GAAG,CAC9BC,uBAAuB,GAAGC,8DADI,EAE9BC,QAF8B,EAG9BC,iBAH8B,EAI9BC,eAJ8B,KAK3B;AACH;AACA,QAAMC,aAAa,GAAG,4CAAtB,CAFG,CAIH;;AACA,QAAMC,wBAAwB,GAAG,2CAAuB,CAAvB,CAAjC,CALG,CAOH;;AACA,QAAM;AACJC,IAAAA,cAAc,GAAGC,sBADb;AAEJC,IAAAA,iBAAiB,GAAGD,sBAFhB;AAGJE,IAAAA,eAAe,GAAGF,sBAHd;AAIJG,IAAAA,mBAAmB,GAAGH,sBAJlB;AAKJI,IAAAA,qBAAqB,GAAGJ;AALpB,MAMFR,uBAAuB,CAACK,aAAD,EAAgBC,wBAAhB,CAN3B,CARG,CAgBH;;AACA,QAAMO,aAAa,GAAG,qDACpB;AACEX,IAAAA,QAAQ,EAAE,CAACY,KAAD,EAAQC,OAAR,KAAoB;AAC5BR,MAAAA,cAAc,CAACO,KAAD,EAAQC,OAAR,CAAd;;AAEA,UAAIb,QAAJ,EAAc;AACZ,4CAAQA,QAAR,EAAkB;AAAEc,UAAAA,WAAW,EAAEF;AAAf,SAAlB;AACD;AACF,KAPH;AAQEG,IAAAA,WAAW,EAAE,CAACH,KAAD,EAAQC,OAAR,KAAoB;AAC/BN,MAAAA,iBAAiB,CAACK,KAAD,EAAQC,OAAR,CAAjB;;AAEA,UAAIZ,iBAAJ,EAAuB;AACrB,4CAAQA,iBAAR,EAA2B;AAAEa,UAAAA,WAAW,EAAEF;AAAf,SAA3B;AACD;AACF,KAdH;AAeEI,IAAAA,SAAS,EAAE,CAACJ,KAAD,EAAQC,OAAR,KAAoB;AAC7BL,MAAAA,eAAe,CAACI,KAAD,EAAQC,OAAR,CAAf;;AAEA,UAAIX,eAAJ,EAAqB;AACnB,4CAAQA,eAAR,EAAyB;AAAEY,UAAAA,WAAW,EAAEF;AAAf,SAAzB;AACD;AACF,KArBH;AAsBEK,IAAAA,eAAe,EAAEP,qBAtBnB;AAuBEQ,IAAAA,aAAa,EAAET;AAvBjB,GADoB,EA0BpB,CACEJ,cADF,EAEEE,iBAFF,EAGEC,eAHF,EAIEE,qBAJF,EAKED,mBALF,EAMET,QANF,EAOEC,iBAPF,EAQEC,eARF,CA1BoB,CAAtB;AAsCA,SAAO;AAAES,IAAAA,aAAF;AAAiBR,IAAAA,aAAjB;AAAgCC,IAAAA;AAAhC,GAAP;AACD,CA7DM","sourcesContent":["import {\n runOnJS,\n useAnimatedRef,\n useAnimatedScrollHandler,\n useSharedValue,\n} from 'react-native-reanimated';\nimport { useScrollEventsHandlersDefault } from './useScrollEventsHandlersDefault';\nimport { workletNoop as noop } from '../utilities';\nimport type { Scrollable, ScrollableEvent } from '../types';\n\nexport const useScrollHandler = (\n useScrollEventsHandlers = useScrollEventsHandlersDefault,\n onScroll?: ScrollableEvent,\n onScrollBeginDrag?: ScrollableEvent,\n onScrollEndDrag?: ScrollableEvent\n) => {\n // refs\n const scrollableRef = useAnimatedRef();\n\n // variables\n const scrollableContentOffsetY = useSharedValue(0);\n\n // hooks\n const {\n handleOnScroll = noop,\n handleOnBeginDrag = noop,\n handleOnEndDrag = noop,\n handleOnMomentumEnd = noop,\n handleOnMomentumBegin = noop,\n } = useScrollEventsHandlers(scrollableRef, scrollableContentOffsetY);\n\n // callbacks\n const scrollHandler = useAnimatedScrollHandler(\n {\n onScroll: (event, context) => {\n handleOnScroll(event, context);\n\n if (onScroll) {\n runOnJS(onScroll)({ nativeEvent: event });\n }\n },\n onBeginDrag: (event, context) => {\n handleOnBeginDrag(event, context);\n\n if (onScrollBeginDrag) {\n runOnJS(onScrollBeginDrag)({ nativeEvent: event });\n }\n },\n onEndDrag: (event, context) => {\n handleOnEndDrag(event, context);\n\n if (onScrollEndDrag) {\n runOnJS(onScrollEndDrag)({ nativeEvent: event });\n }\n },\n onMomentumBegin: handleOnMomentumBegin,\n onMomentumEnd: handleOnMomentumEnd,\n },\n [\n handleOnScroll,\n handleOnBeginDrag,\n handleOnEndDrag,\n handleOnMomentumBegin,\n handleOnMomentumEnd,\n onScroll,\n onScrollBeginDrag,\n onScrollEndDrag,\n ]\n );\n\n return { scrollHandler, scrollableRef, scrollableContentOffsetY };\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/hooks/useScrollable.js b/lib/commonjs/hooks/useScrollable.js new file mode 100644 index 000000000..b1951e64b --- /dev/null +++ b/lib/commonjs/hooks/useScrollable.js @@ -0,0 +1,79 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.useScrollable = void 0; + +var _react = require("react"); + +var _reactNativeReanimated = require("react-native-reanimated"); + +var _getRefNativeTag = require("../utilities/getRefNativeTag"); + +var _constants = require("../constants"); + +const useScrollable = () => { + // refs + const scrollableRef = (0, _react.useRef)(null); + const previousScrollableRef = (0, _react.useRef)(null); // variables + + const animatedScrollableType = (0, _reactNativeReanimated.useSharedValue)(_constants.SCROLLABLE_TYPE.UNDETERMINED); + const animatedScrollableContentOffsetY = (0, _reactNativeReanimated.useSharedValue)(0); + const animatedScrollableOverrideState = (0, _reactNativeReanimated.useSharedValue)(_constants.SCROLLABLE_STATE.UNDETERMINED); + const isScrollableRefreshable = (0, _reactNativeReanimated.useSharedValue)(false); // callbacks + + const setScrollableRef = (0, _react.useCallback)(ref => { + var _scrollableRef$curren, _scrollableRef$curren2; + + // get current node handle id + let currentRefId = (_scrollableRef$curren = (_scrollableRef$curren2 = scrollableRef.current) === null || _scrollableRef$curren2 === void 0 ? void 0 : _scrollableRef$curren2.id) !== null && _scrollableRef$curren !== void 0 ? _scrollableRef$curren : null; + + if (currentRefId !== ref.id) { + if (scrollableRef.current) { + // @ts-ignore + previousScrollableRef.current = scrollableRef.current; + } // @ts-ignore + + + scrollableRef.current = ref; + } + }, []); + const removeScrollableRef = (0, _react.useCallback)(ref => { + var _scrollableRef$curren3, _scrollableRef$curren4; + + // find node handle id + let id; + + try { + id = (0, _getRefNativeTag.getRefNativeTag)(ref); + } catch { + return; + } // get current node handle id + + + let currentRefId = (_scrollableRef$curren3 = (_scrollableRef$curren4 = scrollableRef.current) === null || _scrollableRef$curren4 === void 0 ? void 0 : _scrollableRef$curren4.id) !== null && _scrollableRef$curren3 !== void 0 ? _scrollableRef$curren3 : null; + /** + * @DEV + * when the incoming node is actually the current node, we reset + * the current scrollable ref to the previous one. + */ + + if (id === currentRefId) { + // @ts-ignore + scrollableRef.current = previousScrollableRef.current; + } + }, []); + return { + scrollableRef, + animatedScrollableType, + animatedScrollableContentOffsetY, + animatedScrollableOverrideState, + isScrollableRefreshable, + setScrollableRef, + removeScrollableRef + }; +}; + +exports.useScrollable = useScrollable; +//# sourceMappingURL=useScrollable.js.map \ No newline at end of file diff --git a/lib/commonjs/hooks/useScrollable.js.map b/lib/commonjs/hooks/useScrollable.js.map new file mode 100644 index 000000000..4c1883e94 --- /dev/null +++ b/lib/commonjs/hooks/useScrollable.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["useScrollable.ts"],"names":["useScrollable","scrollableRef","previousScrollableRef","animatedScrollableType","SCROLLABLE_TYPE","UNDETERMINED","animatedScrollableContentOffsetY","animatedScrollableOverrideState","SCROLLABLE_STATE","isScrollableRefreshable","setScrollableRef","ref","currentRefId","current","id","removeScrollableRef"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AAGO,MAAMA,aAAa,GAAG,MAAM;AACjC;AACA,QAAMC,aAAa,GAAG,mBAAsB,IAAtB,CAAtB;AACA,QAAMC,qBAAqB,GAAG,mBAAsB,IAAtB,CAA9B,CAHiC,CAKjC;;AACA,QAAMC,sBAAsB,GAAG,2CAC7BC,2BAAgBC,YADa,CAA/B;AAGA,QAAMC,gCAAgC,GAAG,2CAAuB,CAAvB,CAAzC;AACA,QAAMC,+BAA+B,GAAG,2CACtCC,4BAAiBH,YADqB,CAAxC;AAGA,QAAMI,uBAAuB,GAAG,2CAAwB,KAAxB,CAAhC,CAbiC,CAejC;;AACA,QAAMC,gBAAgB,GAAG,wBAAaC,GAAD,IAAwB;AAAA;;AAC3D;AACA,QAAIC,YAAY,sDAAGX,aAAa,CAACY,OAAjB,2DAAG,uBAAuBC,EAA1B,yEAAgC,IAAhD;;AAEA,QAAIF,YAAY,KAAKD,GAAG,CAACG,EAAzB,EAA6B;AAC3B,UAAIb,aAAa,CAACY,OAAlB,EAA2B;AACzB;AACAX,QAAAA,qBAAqB,CAACW,OAAtB,GAAgCZ,aAAa,CAACY,OAA9C;AACD,OAJ0B,CAK3B;;;AACAZ,MAAAA,aAAa,CAACY,OAAd,GAAwBF,GAAxB;AACD;AACF,GAZwB,EAYtB,EAZsB,CAAzB;AAcA,QAAMI,mBAAmB,GAAG,wBAAaJ,GAAD,IAAgC;AAAA;;AACtE;AACA,QAAIG,EAAJ;;AACA,QAAI;AACFA,MAAAA,EAAE,GAAG,sCAAgBH,GAAhB,CAAL;AACD,KAFD,CAEE,MAAM;AACN;AACD,KAPqE,CAStE;;;AACA,QAAIC,YAAY,uDAAGX,aAAa,CAACY,OAAjB,2DAAG,uBAAuBC,EAA1B,2EAAgC,IAAhD;AAEA;AACJ;AACA;AACA;AACA;;AACI,QAAIA,EAAE,KAAKF,YAAX,EAAyB;AACvB;AACAX,MAAAA,aAAa,CAACY,OAAd,GAAwBX,qBAAqB,CAACW,OAA9C;AACD;AACF,GArB2B,EAqBzB,EArByB,CAA5B;AAuBA,SAAO;AACLZ,IAAAA,aADK;AAELE,IAAAA,sBAFK;AAGLG,IAAAA,gCAHK;AAILC,IAAAA,+BAJK;AAKLE,IAAAA,uBALK;AAMLC,IAAAA,gBANK;AAOLK,IAAAA;AAPK,GAAP;AASD,CA9DM","sourcesContent":["import { useCallback, RefObject, useRef } from 'react';\nimport { useSharedValue } from 'react-native-reanimated';\nimport { getRefNativeTag } from '../utilities/getRefNativeTag';\nimport { SCROLLABLE_STATE, SCROLLABLE_TYPE } from '../constants';\nimport type { ScrollableRef, Scrollable } from '../types';\n\nexport const useScrollable = () => {\n // refs\n const scrollableRef = useRef(null);\n const previousScrollableRef = useRef(null);\n\n // variables\n const animatedScrollableType = useSharedValue(\n SCROLLABLE_TYPE.UNDETERMINED\n );\n const animatedScrollableContentOffsetY = useSharedValue(0);\n const animatedScrollableOverrideState = useSharedValue(\n SCROLLABLE_STATE.UNDETERMINED\n );\n const isScrollableRefreshable = useSharedValue(false);\n\n // callbacks\n const setScrollableRef = useCallback((ref: ScrollableRef) => {\n // get current node handle id\n let currentRefId = scrollableRef.current?.id ?? null;\n\n if (currentRefId !== ref.id) {\n if (scrollableRef.current) {\n // @ts-ignore\n previousScrollableRef.current = scrollableRef.current;\n }\n // @ts-ignore\n scrollableRef.current = ref;\n }\n }, []);\n\n const removeScrollableRef = useCallback((ref: RefObject) => {\n // find node handle id\n let id;\n try {\n id = getRefNativeTag(ref);\n } catch {\n return;\n }\n\n // get current node handle id\n let currentRefId = scrollableRef.current?.id ?? null;\n\n /**\n * @DEV\n * when the incoming node is actually the current node, we reset\n * the current scrollable ref to the previous one.\n */\n if (id === currentRefId) {\n // @ts-ignore\n scrollableRef.current = previousScrollableRef.current;\n }\n }, []);\n\n return {\n scrollableRef,\n animatedScrollableType,\n animatedScrollableContentOffsetY,\n animatedScrollableOverrideState,\n isScrollableRefreshable,\n setScrollableRef,\n removeScrollableRef,\n };\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/hooks/useScrollableSetter.js b/lib/commonjs/hooks/useScrollableSetter.js new file mode 100644 index 000000000..a068616c7 --- /dev/null +++ b/lib/commonjs/hooks/useScrollableSetter.js @@ -0,0 +1,52 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.useScrollableSetter = void 0; + +var _react = require("react"); + +var _useBottomSheetInternal = require("./useBottomSheetInternal"); + +var _getRefNativeTag = require("../utilities/getRefNativeTag"); + +const useScrollableSetter = (ref, type, contentOffsetY, refreshable, useFocusHook = _react.useEffect) => { + // hooks + const { + animatedScrollableType, + animatedScrollableContentOffsetY: rootScrollableContentOffsetY, + isContentHeightFixed, + isScrollableRefreshable, + setScrollableRef, + removeScrollableRef + } = (0, _useBottomSheetInternal.useBottomSheetInternal)(); // callbacks + + const handleSettingScrollable = (0, _react.useCallback)(() => { + // set current content offset + rootScrollableContentOffsetY.value = contentOffsetY.value; + animatedScrollableType.value = type; + isScrollableRefreshable.value = refreshable; + isContentHeightFixed.value = false; // set current scrollable ref + + const id = (0, _getRefNativeTag.getRefNativeTag)(ref); + + if (id) { + setScrollableRef({ + id: id, + node: ref + }); + } else { + console.warn(`Couldn't find the scrollable node handle id!`); + } + + return () => { + removeScrollableRef(ref); + }; + }, [ref, type, refreshable, animatedScrollableType, rootScrollableContentOffsetY, contentOffsetY, isScrollableRefreshable, isContentHeightFixed, setScrollableRef, removeScrollableRef]); // effects + + useFocusHook(handleSettingScrollable); +}; + +exports.useScrollableSetter = useScrollableSetter; +//# sourceMappingURL=useScrollableSetter.js.map \ No newline at end of file diff --git a/lib/commonjs/hooks/useScrollableSetter.js.map b/lib/commonjs/hooks/useScrollableSetter.js.map new file mode 100644 index 000000000..8b20320f5 --- /dev/null +++ b/lib/commonjs/hooks/useScrollableSetter.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["useScrollableSetter.ts"],"names":["useScrollableSetter","ref","type","contentOffsetY","refreshable","useFocusHook","useEffect","animatedScrollableType","animatedScrollableContentOffsetY","rootScrollableContentOffsetY","isContentHeightFixed","isScrollableRefreshable","setScrollableRef","removeScrollableRef","handleSettingScrollable","value","id","node","console","warn"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AAIO,MAAMA,mBAAmB,GAAG,CACjCC,GADiC,EAEjCC,IAFiC,EAGjCC,cAHiC,EAIjCC,WAJiC,EAKjCC,YAAY,GAAGC,gBALkB,KAM9B;AACH;AACA,QAAM;AACJC,IAAAA,sBADI;AAEJC,IAAAA,gCAAgC,EAAEC,4BAF9B;AAGJC,IAAAA,oBAHI;AAIJC,IAAAA,uBAJI;AAKJC,IAAAA,gBALI;AAMJC,IAAAA;AANI,MAOF,qDAPJ,CAFG,CAWH;;AACA,QAAMC,uBAAuB,GAAG,wBAAY,MAAM;AAChD;AACAL,IAAAA,4BAA4B,CAACM,KAA7B,GAAqCZ,cAAc,CAACY,KAApD;AACAR,IAAAA,sBAAsB,CAACQ,KAAvB,GAA+Bb,IAA/B;AACAS,IAAAA,uBAAuB,CAACI,KAAxB,GAAgCX,WAAhC;AACAM,IAAAA,oBAAoB,CAACK,KAArB,GAA6B,KAA7B,CALgD,CAOhD;;AACA,UAAMC,EAAE,GAAG,sCAAgBf,GAAhB,CAAX;;AACA,QAAIe,EAAJ,EAAQ;AACNJ,MAAAA,gBAAgB,CAAC;AACfI,QAAAA,EAAE,EAAEA,EADW;AAEfC,QAAAA,IAAI,EAAEhB;AAFS,OAAD,CAAhB;AAID,KALD,MAKO;AACLiB,MAAAA,OAAO,CAACC,IAAR,CAAc,8CAAd;AACD;;AAED,WAAO,MAAM;AACXN,MAAAA,mBAAmB,CAACZ,GAAD,CAAnB;AACD,KAFD;AAGD,GArB+B,EAqB7B,CACDA,GADC,EAEDC,IAFC,EAGDE,WAHC,EAIDG,sBAJC,EAKDE,4BALC,EAMDN,cANC,EAODQ,uBAPC,EAQDD,oBARC,EASDE,gBATC,EAUDC,mBAVC,CArB6B,CAAhC,CAZG,CA8CH;;AACAR,EAAAA,YAAY,CAACS,uBAAD,CAAZ;AACD,CAtDM","sourcesContent":["import React, { useCallback, useEffect } from 'react';\nimport Animated from 'react-native-reanimated';\nimport { useBottomSheetInternal } from './useBottomSheetInternal';\nimport { getRefNativeTag } from '../utilities/getRefNativeTag';\nimport { SCROLLABLE_TYPE } from '../constants';\nimport type { Scrollable } from '../types';\n\nexport const useScrollableSetter = (\n ref: React.RefObject,\n type: SCROLLABLE_TYPE,\n contentOffsetY: Animated.SharedValue,\n refreshable: boolean,\n useFocusHook = useEffect\n) => {\n // hooks\n const {\n animatedScrollableType,\n animatedScrollableContentOffsetY: rootScrollableContentOffsetY,\n isContentHeightFixed,\n isScrollableRefreshable,\n setScrollableRef,\n removeScrollableRef,\n } = useBottomSheetInternal();\n\n // callbacks\n const handleSettingScrollable = useCallback(() => {\n // set current content offset\n rootScrollableContentOffsetY.value = contentOffsetY.value;\n animatedScrollableType.value = type;\n isScrollableRefreshable.value = refreshable;\n isContentHeightFixed.value = false;\n\n // set current scrollable ref\n const id = getRefNativeTag(ref);\n if (id) {\n setScrollableRef({\n id: id,\n node: ref,\n });\n } else {\n console.warn(`Couldn't find the scrollable node handle id!`);\n }\n\n return () => {\n removeScrollableRef(ref);\n };\n }, [\n ref,\n type,\n refreshable,\n animatedScrollableType,\n rootScrollableContentOffsetY,\n contentOffsetY,\n isScrollableRefreshable,\n isContentHeightFixed,\n setScrollableRef,\n removeScrollableRef,\n ]);\n\n // effects\n useFocusHook(handleSettingScrollable);\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/hooks/useStableCallback.js b/lib/commonjs/hooks/useStableCallback.js new file mode 100644 index 000000000..c80917cd4 --- /dev/null +++ b/lib/commonjs/hooks/useStableCallback.js @@ -0,0 +1,25 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.useStableCallback = void 0; + +var _react = require("react"); + +/** + * Provide a stable version of useCallback + * https://gist.github.com/JakeCoxon/c7ebf6e6496f8468226fd36b596e1985 + */ +const useStableCallback = callback => { + const callbackRef = (0, _react.useRef)(); + const memoCallback = (0, _react.useCallback)((...args) => callbackRef.current && callbackRef.current(...args), []); + (0, _react.useEffect)(() => { + callbackRef.current = callback; + return () => callbackRef.current = undefined; + }); + return memoCallback; +}; + +exports.useStableCallback = useStableCallback; +//# sourceMappingURL=useStableCallback.js.map \ No newline at end of file diff --git a/lib/commonjs/hooks/useStableCallback.js.map b/lib/commonjs/hooks/useStableCallback.js.map new file mode 100644 index 000000000..e9d9cccea --- /dev/null +++ b/lib/commonjs/hooks/useStableCallback.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["useStableCallback.ts"],"names":["useStableCallback","callback","callbackRef","memoCallback","args","current","undefined"],"mappings":";;;;;;;AAAA;;AAGA;AACA;AACA;AACA;AACO,MAAMA,iBAAiB,GAAIC,QAAD,IAAwB;AACvD,QAAMC,WAAW,GAAG,oBAApB;AACA,QAAMC,YAAY,GAAG,wBACnB,CAAC,GAAGC,IAAJ,KAAkBF,WAAW,CAACG,OAAZ,IAAuBH,WAAW,CAACG,OAAZ,CAAoB,GAAGD,IAAvB,CADtB,EAEnB,EAFmB,CAArB;AAIA,wBAAU,MAAM;AACdF,IAAAA,WAAW,CAACG,OAAZ,GAAsBJ,QAAtB;AACA,WAAO,MAAOC,WAAW,CAACG,OAAZ,GAAsBC,SAApC;AACD,GAHD;AAIA,SAAOH,YAAP;AACD,CAXM","sourcesContent":["import { useRef, useCallback, useEffect } from 'react';\n\ntype Callback = (...args: any[]) => any;\n/**\n * Provide a stable version of useCallback\n * https://gist.github.com/JakeCoxon/c7ebf6e6496f8468226fd36b596e1985\n */\nexport const useStableCallback = (callback: Callback) => {\n const callbackRef = useRef();\n const memoCallback = useCallback(\n (...args: any) => callbackRef.current && callbackRef.current(...args),\n []\n );\n useEffect(() => {\n callbackRef.current = callback;\n return () => (callbackRef.current = undefined);\n });\n return memoCallback;\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/index.js b/lib/commonjs/index.js new file mode 100644 index 000000000..edd6bd338 --- /dev/null +++ b/lib/commonjs/index.js @@ -0,0 +1,290 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +var _exportNames = { + TouchableHighlight: true, + TouchableOpacity: true, + TouchableWithoutFeedback: true, + BottomSheetModal: true, + BottomSheetModalProvider: true, + useBottomSheet: true, + useBottomSheetModal: true, + useBottomSheetSpringConfigs: true, + useBottomSheetTimingConfigs: true, + useBottomSheetInternal: true, + useBottomSheetModalInternal: true, + useBottomSheetDynamicSnapPoints: true, + useScrollEventsHandlersDefault: true, + useGestureEventsHandlersDefault: true, + useBottomSheetGestureHandlers: true, + useScrollHandler: true, + useScrollableSetter: true, + BottomSheetScrollView: true, + BottomSheetSectionList: true, + BottomSheetFlatList: true, + BottomSheetVirtualizedList: true, + createBottomSheetScrollableComponent: true, + BottomSheetHandle: true, + BottomSheetDraggableView: true, + BottomSheetView: true, + BottomSheetTextInput: true, + BottomSheetBackdrop: true, + BottomSheetFooter: true, + BottomSheetFooterContainer: true, + enableLogging: true +}; +Object.defineProperty(exports, "default", { + enumerable: true, + get: function () { + return _bottomSheet.default; + } +}); +Object.defineProperty(exports, "BottomSheetModal", { + enumerable: true, + get: function () { + return _bottomSheetModal.default; + } +}); +Object.defineProperty(exports, "BottomSheetModalProvider", { + enumerable: true, + get: function () { + return _bottomSheetModalProvider.default; + } +}); +Object.defineProperty(exports, "useBottomSheet", { + enumerable: true, + get: function () { + return _useBottomSheet.useBottomSheet; + } +}); +Object.defineProperty(exports, "useBottomSheetModal", { + enumerable: true, + get: function () { + return _useBottomSheetModal.useBottomSheetModal; + } +}); +Object.defineProperty(exports, "useBottomSheetSpringConfigs", { + enumerable: true, + get: function () { + return _useBottomSheetSpringConfigs.useBottomSheetSpringConfigs; + } +}); +Object.defineProperty(exports, "useBottomSheetTimingConfigs", { + enumerable: true, + get: function () { + return _useBottomSheetTimingConfigs.useBottomSheetTimingConfigs; + } +}); +Object.defineProperty(exports, "useBottomSheetInternal", { + enumerable: true, + get: function () { + return _useBottomSheetInternal.useBottomSheetInternal; + } +}); +Object.defineProperty(exports, "useBottomSheetModalInternal", { + enumerable: true, + get: function () { + return _useBottomSheetModalInternal.useBottomSheetModalInternal; + } +}); +Object.defineProperty(exports, "useBottomSheetDynamicSnapPoints", { + enumerable: true, + get: function () { + return _useBottomSheetDynamicSnapPoints.useBottomSheetDynamicSnapPoints; + } +}); +Object.defineProperty(exports, "useScrollEventsHandlersDefault", { + enumerable: true, + get: function () { + return _useScrollEventsHandlersDefault.useScrollEventsHandlersDefault; + } +}); +Object.defineProperty(exports, "useGestureEventsHandlersDefault", { + enumerable: true, + get: function () { + return _useGestureEventsHandlersDefault.useGestureEventsHandlersDefault; + } +}); +Object.defineProperty(exports, "useBottomSheetGestureHandlers", { + enumerable: true, + get: function () { + return _useBottomSheetGestureHandlers.useBottomSheetGestureHandlers; + } +}); +Object.defineProperty(exports, "useScrollHandler", { + enumerable: true, + get: function () { + return _useScrollHandler.useScrollHandler; + } +}); +Object.defineProperty(exports, "useScrollableSetter", { + enumerable: true, + get: function () { + return _useScrollableSetter.useScrollableSetter; + } +}); +Object.defineProperty(exports, "BottomSheetScrollView", { + enumerable: true, + get: function () { + return _bottomSheetScrollable.BottomSheetScrollView; + } +}); +Object.defineProperty(exports, "BottomSheetSectionList", { + enumerable: true, + get: function () { + return _bottomSheetScrollable.BottomSheetSectionList; + } +}); +Object.defineProperty(exports, "BottomSheetFlatList", { + enumerable: true, + get: function () { + return _bottomSheetScrollable.BottomSheetFlatList; + } +}); +Object.defineProperty(exports, "BottomSheetVirtualizedList", { + enumerable: true, + get: function () { + return _bottomSheetScrollable.BottomSheetVirtualizedList; + } +}); +Object.defineProperty(exports, "createBottomSheetScrollableComponent", { + enumerable: true, + get: function () { + return _bottomSheetScrollable.createBottomSheetScrollableComponent; + } +}); +Object.defineProperty(exports, "BottomSheetHandle", { + enumerable: true, + get: function () { + return _bottomSheetHandle.default; + } +}); +Object.defineProperty(exports, "BottomSheetDraggableView", { + enumerable: true, + get: function () { + return _bottomSheetDraggableView.default; + } +}); +Object.defineProperty(exports, "BottomSheetView", { + enumerable: true, + get: function () { + return _bottomSheetView.default; + } +}); +Object.defineProperty(exports, "BottomSheetTextInput", { + enumerable: true, + get: function () { + return _bottomSheetTextInput.default; + } +}); +Object.defineProperty(exports, "BottomSheetBackdrop", { + enumerable: true, + get: function () { + return _bottomSheetBackdrop.default; + } +}); +Object.defineProperty(exports, "BottomSheetFooter", { + enumerable: true, + get: function () { + return _bottomSheetFooter.default; + } +}); +Object.defineProperty(exports, "BottomSheetFooterContainer", { + enumerable: true, + get: function () { + return _BottomSheetFooterContainer.default; + } +}); +Object.defineProperty(exports, "enableLogging", { + enumerable: true, + get: function () { + return _logger.enableLogging; + } +}); +exports.TouchableWithoutFeedback = exports.TouchableOpacity = exports.TouchableHighlight = void 0; + +var _bottomSheet = _interopRequireDefault(require("./components/bottomSheet")); + +var _bottomSheetModal = _interopRequireDefault(require("./components/bottomSheetModal")); + +var _bottomSheetModalProvider = _interopRequireDefault(require("./components/bottomSheetModalProvider")); + +var _useBottomSheet = require("./hooks/useBottomSheet"); + +var _useBottomSheetModal = require("./hooks/useBottomSheetModal"); + +var _useBottomSheetSpringConfigs = require("./hooks/useBottomSheetSpringConfigs"); + +var _useBottomSheetTimingConfigs = require("./hooks/useBottomSheetTimingConfigs"); + +var _useBottomSheetInternal = require("./hooks/useBottomSheetInternal"); + +var _useBottomSheetModalInternal = require("./hooks/useBottomSheetModalInternal"); + +var _useBottomSheetDynamicSnapPoints = require("./hooks/useBottomSheetDynamicSnapPoints"); + +var _useScrollEventsHandlersDefault = require("./hooks/useScrollEventsHandlersDefault"); + +var _useGestureEventsHandlersDefault = require("./hooks/useGestureEventsHandlersDefault"); + +var _useBottomSheetGestureHandlers = require("./hooks/useBottomSheetGestureHandlers"); + +var _useScrollHandler = require("./hooks/useScrollHandler"); + +var _useScrollableSetter = require("./hooks/useScrollableSetter"); + +var _bottomSheetScrollable = require("./components/bottomSheetScrollable"); + +var _bottomSheetHandle = _interopRequireDefault(require("./components/bottomSheetHandle")); + +var _bottomSheetDraggableView = _interopRequireDefault(require("./components/bottomSheetDraggableView")); + +var _bottomSheetView = _interopRequireDefault(require("./components/bottomSheetView")); + +var _bottomSheetTextInput = _interopRequireDefault(require("./components/bottomSheetTextInput")); + +var _bottomSheetBackdrop = _interopRequireDefault(require("./components/bottomSheetBackdrop")); + +var _bottomSheetFooter = _interopRequireDefault(require("./components/bottomSheetFooter")); + +var _BottomSheetFooterContainer = _interopRequireDefault(require("./components/bottomSheetFooterContainer/BottomSheetFooterContainer")); + +var _touchables = _interopRequireDefault(require("./components/touchables")); + +var _constants = require("./constants"); + +Object.keys(_constants).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; + if (key in exports && exports[key] === _constants[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _constants[key]; + } + }); +}); + +var _logger = require("./utilities/logger"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// bottom sheet +// bottom sheet modal +//#region hooks +//#endregion +//#region components +// touchables +const { + TouchableHighlight, + TouchableOpacity, + TouchableWithoutFeedback +} = _touchables.default; // utils +//#endregion + +exports.TouchableWithoutFeedback = TouchableWithoutFeedback; +exports.TouchableOpacity = TouchableOpacity; +exports.TouchableHighlight = TouchableHighlight; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/index.js.map b/lib/commonjs/index.js.map new file mode 100644 index 000000000..d9ca6078a --- /dev/null +++ b/lib/commonjs/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":["TouchableHighlight","TouchableOpacity","TouchableWithoutFeedback","BottomSheetTouchable"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AAGA;;AACA;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAGA;;AAmCA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;;;AA1EA;AAGA;AAIA;AAaA;AAEA;AAeA;AAEO,MAAM;AACXA,EAAAA,kBADW;AAEXC,EAAAA,gBAFW;AAGXC,EAAAA;AAHW,IAITC,mBAJG,C,CAKP;AA+BA","sourcesContent":["// bottom sheet\nexport { default } from './components/bottomSheet';\n\n// bottom sheet modal\nexport { default as BottomSheetModal } from './components/bottomSheetModal';\nexport { default as BottomSheetModalProvider } from './components/bottomSheetModalProvider';\n\n//#region hooks\nexport { useBottomSheet } from './hooks/useBottomSheet';\nexport { useBottomSheetModal } from './hooks/useBottomSheetModal';\nexport { useBottomSheetSpringConfigs } from './hooks/useBottomSheetSpringConfigs';\nexport { useBottomSheetTimingConfigs } from './hooks/useBottomSheetTimingConfigs';\nexport { useBottomSheetInternal } from './hooks/useBottomSheetInternal';\nexport { useBottomSheetModalInternal } from './hooks/useBottomSheetModalInternal';\nexport { useBottomSheetDynamicSnapPoints } from './hooks/useBottomSheetDynamicSnapPoints';\nexport { useScrollEventsHandlersDefault } from './hooks/useScrollEventsHandlersDefault';\nexport { useGestureEventsHandlersDefault } from './hooks/useGestureEventsHandlersDefault';\nexport { useBottomSheetGestureHandlers } from './hooks/useBottomSheetGestureHandlers';\nexport { useScrollHandler } from './hooks/useScrollHandler';\nexport { useScrollableSetter } from './hooks/useScrollableSetter';\n//#endregion\n\n//#region components\nexport {\n BottomSheetScrollView,\n BottomSheetSectionList,\n BottomSheetFlatList,\n BottomSheetVirtualizedList,\n} from './components/bottomSheetScrollable';\nexport { default as BottomSheetHandle } from './components/bottomSheetHandle';\nexport { default as BottomSheetDraggableView } from './components/bottomSheetDraggableView';\nexport { default as BottomSheetView } from './components/bottomSheetView';\nexport { default as BottomSheetTextInput } from './components/bottomSheetTextInput';\nexport { default as BottomSheetBackdrop } from './components/bottomSheetBackdrop';\nexport { default as BottomSheetFooter } from './components/bottomSheetFooter';\nexport { default as BottomSheetFooterContainer } from './components/bottomSheetFooterContainer/BottomSheetFooterContainer';\n\n// touchables\nimport BottomSheetTouchable from './components/touchables';\nexport const {\n TouchableHighlight,\n TouchableOpacity,\n TouchableWithoutFeedback,\n} = BottomSheetTouchable;\n// utils\nexport { createBottomSheetScrollableComponent } from './components/bottomSheetScrollable';\n//#endregion\n\n//#region types\nexport type { BottomSheetProps } from './components/bottomSheet';\nexport type { BottomSheetModalProps } from './components/bottomSheetModal';\nexport type { BottomSheetHandleProps } from './components/bottomSheetHandle';\nexport type { BottomSheetBackgroundProps } from './components/bottomSheetBackground';\nexport type { BottomSheetBackdropProps } from './components/bottomSheetBackdrop';\nexport type { BottomSheetFooterProps } from './components/bottomSheetFooter';\n\nexport type {\n BottomSheetFlatListMethods,\n BottomSheetScrollViewMethods,\n BottomSheetSectionListMethods,\n BottomSheetVirtualizedListMethods,\n BottomSheetScrollableProps,\n} from './components/bottomSheetScrollable';\n\nexport type {\n ScrollEventsHandlersHookType,\n GestureEventsHandlersHookType,\n ScrollEventHandlerCallbackType,\n GestureEventHandlerCallbackType,\n} from './types';\n//#endregion\n\n//#region utilities\nexport * from './constants';\nexport { enableLogging } from './utilities/logger';\n//#endregion\n"]} \ No newline at end of file diff --git a/lib/commonjs/utilities/animate.js b/lib/commonjs/utilities/animate.js new file mode 100644 index 000000000..a00f627ec --- /dev/null +++ b/lib/commonjs/utilities/animate.js @@ -0,0 +1,37 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.animate = void 0; + +var _reactNativeReanimated = require("react-native-reanimated"); + +var _constants = require("../constants"); + +const animate = ({ + point, + configs = undefined, + velocity = 0, + onComplete +}) => { + 'worklet'; + + if (!configs) { + configs = _constants.ANIMATION_CONFIGS; + } // detect animation type + + + const type = 'duration' in configs || 'easing' in configs ? _constants.ANIMATION_METHOD.TIMING : _constants.ANIMATION_METHOD.SPRING; + + if (type === _constants.ANIMATION_METHOD.TIMING) { + return (0, _reactNativeReanimated.withTiming)(point, configs, onComplete); + } else { + return (0, _reactNativeReanimated.withSpring)(point, Object.assign({ + velocity + }, configs), onComplete); + } +}; + +exports.animate = animate; +//# sourceMappingURL=animate.js.map \ No newline at end of file diff --git a/lib/commonjs/utilities/animate.js.map b/lib/commonjs/utilities/animate.js.map new file mode 100644 index 000000000..bf3b7057d --- /dev/null +++ b/lib/commonjs/utilities/animate.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["animate.ts"],"names":["animate","point","configs","undefined","velocity","onComplete","ANIMATION_CONFIGS","type","ANIMATION_METHOD","TIMING","SPRING","Object","assign"],"mappings":";;;;;;;AAAA;;AAOA;;AASO,MAAMA,OAAO,GAAG,CAAC;AACtBC,EAAAA,KADsB;AAEtBC,EAAAA,OAAO,GAAGC,SAFY;AAGtBC,EAAAA,QAAQ,GAAG,CAHW;AAItBC,EAAAA;AAJsB,CAAD,KAKF;AACnB;;AAEA,MAAI,CAACH,OAAL,EAAc;AACZA,IAAAA,OAAO,GAAGI,4BAAV;AACD,GALkB,CAOnB;;;AACA,QAAMC,IAAI,GACR,cAAcL,OAAd,IAAyB,YAAYA,OAArC,GACIM,4BAAiBC,MADrB,GAEID,4BAAiBE,MAHvB;;AAKA,MAAIH,IAAI,KAAKC,4BAAiBC,MAA9B,EAAsC;AACpC,WAAO,uCAAWR,KAAX,EAAkBC,OAAlB,EAA+CG,UAA/C,CAAP;AACD,GAFD,MAEO;AACL,WAAO,uCACLJ,KADK,EAELU,MAAM,CAACC,MAAP,CAAc;AAAER,MAAAA;AAAF,KAAd,EAA4BF,OAA5B,CAFK,EAGLG,UAHK,CAAP;AAKD;AACF,CA3BM","sourcesContent":["import {\n WithSpringConfig,\n WithTimingConfig,\n withTiming,\n withSpring,\n AnimationCallback,\n} from 'react-native-reanimated';\nimport { ANIMATION_CONFIGS, ANIMATION_METHOD } from '../constants';\n\ninterface AnimateParams {\n point: number;\n velocity?: number;\n configs?: WithSpringConfig | WithTimingConfig;\n onComplete?: AnimationCallback;\n}\n\nexport const animate = ({\n point,\n configs = undefined,\n velocity = 0,\n onComplete,\n}: AnimateParams) => {\n 'worklet';\n\n if (!configs) {\n configs = ANIMATION_CONFIGS;\n }\n\n // detect animation type\n const type =\n 'duration' in configs || 'easing' in configs\n ? ANIMATION_METHOD.TIMING\n : ANIMATION_METHOD.SPRING;\n\n if (type === ANIMATION_METHOD.TIMING) {\n return withTiming(point, configs as WithTimingConfig, onComplete);\n } else {\n return withSpring(\n point,\n Object.assign({ velocity }, configs) as WithSpringConfig,\n onComplete\n );\n }\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/utilities/clamp.js b/lib/commonjs/utilities/clamp.js new file mode 100644 index 000000000..9fed155da --- /dev/null +++ b/lib/commonjs/utilities/clamp.js @@ -0,0 +1,15 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.clamp = void 0; + +const clamp = (value, lowerBound, upperBound) => { + 'worklet'; + + return Math.min(Math.max(lowerBound, value), upperBound); +}; + +exports.clamp = clamp; +//# sourceMappingURL=clamp.js.map \ No newline at end of file diff --git a/lib/commonjs/utilities/clamp.js.map b/lib/commonjs/utilities/clamp.js.map new file mode 100644 index 000000000..5b4eb6e7b --- /dev/null +++ b/lib/commonjs/utilities/clamp.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["clamp.ts"],"names":["clamp","value","lowerBound","upperBound","Math","min","max"],"mappings":";;;;;;;AAAO,MAAMA,KAAK,GAAG,CACnBC,KADmB,EAEnBC,UAFmB,EAGnBC,UAHmB,KAIhB;AACH;;AACA,SAAOC,IAAI,CAACC,GAAL,CAASD,IAAI,CAACE,GAAL,CAASJ,UAAT,EAAqBD,KAArB,CAAT,EAAsCE,UAAtC,CAAP;AACD,CAPM","sourcesContent":["export const clamp = (\n value: number,\n lowerBound: number,\n upperBound: number\n) => {\n 'worklet';\n return Math.min(Math.max(lowerBound, value), upperBound);\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/utilities/easingExp.js b/lib/commonjs/utilities/easingExp.js new file mode 100644 index 000000000..603d1b31b --- /dev/null +++ b/lib/commonjs/utilities/easingExp.js @@ -0,0 +1,21 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.exp = void 0; + +/** + * A modified version of the default AnimatedEasing.exp, + * to insure its value never goes below `0`. + * @see https://github.com/software-mansion/react-native-reanimated/issues/1610 + * @param t number + */ +const exp = t => { + 'worklet'; + + return Math.min(Math.max(0, Math.pow(2, 10 * (t - 1))), 1); +}; + +exports.exp = exp; +//# sourceMappingURL=easingExp.js.map \ No newline at end of file diff --git a/lib/commonjs/utilities/easingExp.js.map b/lib/commonjs/utilities/easingExp.js.map new file mode 100644 index 000000000..aca657ae0 --- /dev/null +++ b/lib/commonjs/utilities/easingExp.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["easingExp.ts"],"names":["exp","t","Math","min","max","pow"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,GAAG,GAAIC,CAAD,IAAe;AAChC;;AACA,SAAOC,IAAI,CAACC,GAAL,CAASD,IAAI,CAACE,GAAL,CAAS,CAAT,EAAYF,IAAI,CAACG,GAAL,CAAS,CAAT,EAAY,MAAMJ,CAAC,GAAG,CAAV,CAAZ,CAAZ,CAAT,EAAiD,CAAjD,CAAP;AACD,CAHM","sourcesContent":["/**\n * A modified version of the default AnimatedEasing.exp,\n * to insure its value never goes below `0`.\n * @see https://github.com/software-mansion/react-native-reanimated/issues/1610\n * @param t number\n */\nexport const exp = (t: number) => {\n 'worklet';\n return Math.min(Math.max(0, Math.pow(2, 10 * (t - 1))), 1);\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/utilities/getKeyboardAnimationConfigs.js b/lib/commonjs/utilities/getKeyboardAnimationConfigs.js new file mode 100644 index 000000000..7f8f929fe --- /dev/null +++ b/lib/commonjs/utilities/getKeyboardAnimationConfigs.js @@ -0,0 +1,51 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.getKeyboardAnimationConfigs = void 0; + +var _reactNativeReanimated = require("react-native-reanimated"); + +const getKeyboardAnimationConfigs = (easing, duration) => { + 'worklet'; + + switch (easing) { + case 'easeIn': + return { + easing: _reactNativeReanimated.Easing.in(_reactNativeReanimated.Easing.ease), + duration + }; + + case 'easeOut': + return { + easing: _reactNativeReanimated.Easing.out(_reactNativeReanimated.Easing.ease), + duration + }; + + case 'easeInEaseOut': + return { + easing: _reactNativeReanimated.Easing.inOut(_reactNativeReanimated.Easing.ease), + duration + }; + + case 'linear': + return { + easing: _reactNativeReanimated.Easing.linear, + duration + }; + + case 'keyboard': + return { + damping: 500, + stiffness: 1000, + mass: 3, + overshootClamping: true, + restDisplacementThreshold: 10, + restSpeedThreshold: 10 + }; + } +}; + +exports.getKeyboardAnimationConfigs = getKeyboardAnimationConfigs; +//# sourceMappingURL=getKeyboardAnimationConfigs.js.map \ No newline at end of file diff --git a/lib/commonjs/utilities/getKeyboardAnimationConfigs.js.map b/lib/commonjs/utilities/getKeyboardAnimationConfigs.js.map new file mode 100644 index 000000000..b9d292af8 --- /dev/null +++ b/lib/commonjs/utilities/getKeyboardAnimationConfigs.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["getKeyboardAnimationConfigs.ts"],"names":["getKeyboardAnimationConfigs","easing","duration","Easing","in","ease","out","inOut","linear","damping","stiffness","mass","overshootClamping","restDisplacementThreshold","restSpeedThreshold"],"mappings":";;;;;;;AAAA;;AAGO,MAAMA,2BAA2B,GAAG,CACzCC,MADyC,EAEzCC,QAFyC,KAGtC;AACH;;AACA,UAAQD,MAAR;AACE,SAAK,QAAL;AACE,aAAO;AACLA,QAAAA,MAAM,EAAEE,8BAAOC,EAAP,CAAUD,8BAAOE,IAAjB,CADH;AAELH,QAAAA;AAFK,OAAP;;AAKF,SAAK,SAAL;AACE,aAAO;AACLD,QAAAA,MAAM,EAAEE,8BAAOG,GAAP,CAAWH,8BAAOE,IAAlB,CADH;AAELH,QAAAA;AAFK,OAAP;;AAKF,SAAK,eAAL;AACE,aAAO;AACLD,QAAAA,MAAM,EAAEE,8BAAOI,KAAP,CAAaJ,8BAAOE,IAApB,CADH;AAELH,QAAAA;AAFK,OAAP;;AAKF,SAAK,QAAL;AACE,aAAO;AACLD,QAAAA,MAAM,EAAEE,8BAAOK,MADV;AAELN,QAAAA;AAFK,OAAP;;AAKF,SAAK,UAAL;AACE,aAAO;AACLO,QAAAA,OAAO,EAAE,GADJ;AAELC,QAAAA,SAAS,EAAE,IAFN;AAGLC,QAAAA,IAAI,EAAE,CAHD;AAILC,QAAAA,iBAAiB,EAAE,IAJd;AAKLC,QAAAA,yBAAyB,EAAE,EALtB;AAMLC,QAAAA,kBAAkB,EAAE;AANf,OAAP;AA1BJ;AAmCD,CAxCM","sourcesContent":["import { Easing } from 'react-native-reanimated';\nimport type { KeyboardEventEasing } from 'react-native';\n\nexport const getKeyboardAnimationConfigs = (\n easing: KeyboardEventEasing,\n duration: number\n) => {\n 'worklet';\n switch (easing) {\n case 'easeIn':\n return {\n easing: Easing.in(Easing.ease),\n duration,\n };\n\n case 'easeOut':\n return {\n easing: Easing.out(Easing.ease),\n duration,\n };\n\n case 'easeInEaseOut':\n return {\n easing: Easing.inOut(Easing.ease),\n duration,\n };\n\n case 'linear':\n return {\n easing: Easing.linear,\n duration,\n };\n\n case 'keyboard':\n return {\n damping: 500,\n stiffness: 1000,\n mass: 3,\n overshootClamping: true,\n restDisplacementThreshold: 10,\n restSpeedThreshold: 10,\n };\n }\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/utilities/getRefNativeTag.js b/lib/commonjs/utilities/getRefNativeTag.js new file mode 100644 index 000000000..0c1495d24 --- /dev/null +++ b/lib/commonjs/utilities/getRefNativeTag.js @@ -0,0 +1,45 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.getRefNativeTag = getRefNativeTag; + +const isFunction = ref => typeof ref === 'function'; + +const hasNativeTag = ref => !!ref && typeof ref === 'object' && 'current' in (ref || {}) && '_nativeTag' in ((ref === null || ref === void 0 ? void 0 : ref.current) || {}); +/* + * getRefNativeTag is an internal utility used by createBottomSheetScrollableComponent + * to grab the native tag from the native host component. It only works when the ref + * is pointing to a native Host component. + * + * Internally in the bottom-sheet library ref can be a function that returns a native tag + * this seems to happen due to the usage of Reanimated's animated scroll components. + * + * This should be Fabric compatible as long as the ref is a native host component. + * */ + + +function getRefNativeTag(ref) { + const refType = typeof ref; + let nativeTag; + + if (isFunction(ref)) { + nativeTag = ref(); + } else if (hasNativeTag(ref)) { + nativeTag = ref.current._nativeTag; + } + + if (!nativeTag || typeof nativeTag !== 'number') { + throw new Error(`Unexpected nativeTag: ${refType}; nativeTag=${nativeTag} + + createBottomSheetScrollableComponent's ScrollableComponent needs to return + a reference that contains a nativeTag to a Native HostComponent. + + ref=${ref} + `); + } + + return nativeTag; +} +//# sourceMappingURL=getRefNativeTag.js.map \ No newline at end of file diff --git a/lib/commonjs/utilities/getRefNativeTag.js.map b/lib/commonjs/utilities/getRefNativeTag.js.map new file mode 100644 index 000000000..ddb0c0d25 --- /dev/null +++ b/lib/commonjs/utilities/getRefNativeTag.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["getRefNativeTag.ts"],"names":["isFunction","ref","hasNativeTag","current","getRefNativeTag","refType","nativeTag","_nativeTag","Error"],"mappings":";;;;;;;AAAA,MAAMA,UAAU,GAAIC,GAAD,IAAmC,OAAOA,GAAP,KAAe,UAArE;;AAEA,MAAMC,YAAY,GAChBD,GADmB,IAGnB,CAAC,CAACA,GAAF,IACA,OAAOA,GAAP,KAAe,QADf,IAEA,cAAcA,GAAG,IAAI,EAArB,CAFA,IAGA,iBAAiB,CAACA,GAAD,aAACA,GAAD,uBAACA,GAAD,CAAcE,OAAd,KAAyB,EAA1C,CANF;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,eAAT,CAAyBH,GAAzB,EAAuC;AAC5C,QAAMI,OAAO,GAAG,OAAOJ,GAAvB;AACA,MAAIK,SAAJ;;AACA,MAAIN,UAAU,CAACC,GAAD,CAAd,EAAqB;AACnBK,IAAAA,SAAS,GAAGL,GAAG,EAAf;AACD,GAFD,MAEO,IAAIC,YAAY,CAACD,GAAD,CAAhB,EAAuB;AAC5BK,IAAAA,SAAS,GAAGL,GAAG,CAACE,OAAJ,CAAYI,UAAxB;AACD;;AAED,MAAI,CAACD,SAAD,IAAc,OAAOA,SAAP,KAAqB,QAAvC,EAAiD;AAC/C,UAAM,IAAIE,KAAJ,CACH,yBAAwBH,OAAQ,eAAcC,SAAU;AAC/D;AACA;AACA;AACA;AACA,SAASL,GAAI;AACb,IAPU,CAAN;AASD;;AAED,SAAOK,SAAP;AACD","sourcesContent":["const isFunction = (ref: unknown): ref is Function => typeof ref === 'function';\n\nconst hasNativeTag = (\n ref: unknown\n): ref is { current: { _nativeTag: number } } =>\n !!ref &&\n typeof ref === 'object' &&\n 'current' in (ref || {}) &&\n '_nativeTag' in ((ref as any)?.current || {});\n\n/*\n * getRefNativeTag is an internal utility used by createBottomSheetScrollableComponent\n * to grab the native tag from the native host component. It only works when the ref\n * is pointing to a native Host component.\n *\n * Internally in the bottom-sheet library ref can be a function that returns a native tag\n * this seems to happen due to the usage of Reanimated's animated scroll components.\n *\n * This should be Fabric compatible as long as the ref is a native host component.\n * */\nexport function getRefNativeTag(ref: unknown) {\n const refType = typeof ref;\n let nativeTag: undefined | number;\n if (isFunction(ref)) {\n nativeTag = ref();\n } else if (hasNativeTag(ref)) {\n nativeTag = ref.current._nativeTag;\n }\n\n if (!nativeTag || typeof nativeTag !== 'number') {\n throw new Error(\n `Unexpected nativeTag: ${refType}; nativeTag=${nativeTag} \n\n\t\t\tcreateBottomSheetScrollableComponent's ScrollableComponent needs to return \n\t\t\ta reference that contains a nativeTag to a Native HostComponent.\n\n\t\t\tref=${ref}\n\t\t\t`\n );\n }\n\n return nativeTag;\n}\n"]} \ No newline at end of file diff --git a/lib/commonjs/utilities/id.js b/lib/commonjs/utilities/id.js new file mode 100644 index 000000000..ff906cc6e --- /dev/null +++ b/lib/commonjs/utilities/id.js @@ -0,0 +1,15 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.id = void 0; +let current = 0; + +const id = () => { + current = (current + 1) % Number.MAX_SAFE_INTEGER; + return current; +}; + +exports.id = id; +//# sourceMappingURL=id.js.map \ No newline at end of file diff --git a/lib/commonjs/utilities/id.js.map b/lib/commonjs/utilities/id.js.map new file mode 100644 index 000000000..4e87610cd --- /dev/null +++ b/lib/commonjs/utilities/id.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["id.ts"],"names":["current","id","Number","MAX_SAFE_INTEGER"],"mappings":";;;;;;AAAA,IAAIA,OAAO,GAAG,CAAd;;AAEO,MAAMC,EAAE,GAAG,MAAM;AACtBD,EAAAA,OAAO,GAAG,CAACA,OAAO,GAAG,CAAX,IAAgBE,MAAM,CAACC,gBAAjC;AACA,SAAOH,OAAP;AACD,CAHM","sourcesContent":["let current = 0;\n\nexport const id = () => {\n current = (current + 1) % Number.MAX_SAFE_INTEGER;\n return current;\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/utilities/index.js b/lib/commonjs/utilities/index.js new file mode 100644 index 000000000..3576918db --- /dev/null +++ b/lib/commonjs/utilities/index.js @@ -0,0 +1,52 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "normalizeSnapPoint", { + enumerable: true, + get: function () { + return _normalizeSnapPoint.normalizeSnapPoint; + } +}); +Object.defineProperty(exports, "animate", { + enumerable: true, + get: function () { + return _animate.animate; + } +}); +Object.defineProperty(exports, "getKeyboardAnimationConfigs", { + enumerable: true, + get: function () { + return _getKeyboardAnimationConfigs.getKeyboardAnimationConfigs; + } +}); +Object.defineProperty(exports, "print", { + enumerable: true, + get: function () { + return _logger.print; + } +}); +Object.defineProperty(exports, "noop", { + enumerable: true, + get: function () { + return _noop.noop; + } +}); +Object.defineProperty(exports, "workletNoop", { + enumerable: true, + get: function () { + return _noop.workletNoop; + } +}); + +var _normalizeSnapPoint = require("./normalizeSnapPoint"); + +var _animate = require("./animate"); + +var _getKeyboardAnimationConfigs = require("./getKeyboardAnimationConfigs"); + +var _logger = require("./logger"); + +var _noop = require("./noop"); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/utilities/index.js.map b/lib/commonjs/utilities/index.js.map new file mode 100644 index 000000000..768a37f59 --- /dev/null +++ b/lib/commonjs/utilities/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA","sourcesContent":["export { normalizeSnapPoint } from './normalizeSnapPoint';\nexport { animate } from './animate';\nexport { getKeyboardAnimationConfigs } from './getKeyboardAnimationConfigs';\nexport { print } from './logger';\nexport { noop, workletNoop } from './noop';\n"]} \ No newline at end of file diff --git a/lib/commonjs/utilities/logger.js b/lib/commonjs/utilities/logger.js new file mode 100644 index 000000000..54a0140f8 --- /dev/null +++ b/lib/commonjs/utilities/logger.js @@ -0,0 +1,48 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.enableLogging = exports.print = void 0; +let isLoggingEnabled = false; + +const enableLogging = () => { + if (!__DEV__) { + console.warn('[BottomSheet] could not enable logging on production!'); + return; + } + + isLoggingEnabled = true; +}; + +exports.enableLogging = enableLogging; + +let print = () => {}; + +exports.print = print; + +if (__DEV__) { + exports.print = print = ({ + component, + method, + params + }) => { + if (!isLoggingEnabled) { + return; + } + + let message = ''; + + if (typeof params === 'object') { + message = Object.keys(params).map(key => `${key}:${params[key]}`).join(' '); + } else { + message = `${params !== null && params !== void 0 ? params : ''}`; + } // eslint-disable-next-line no-console + + + console.log(`[${[component, method].filter(Boolean).join('::')}]`, message); + }; +} + +Object.freeze(print); +//# sourceMappingURL=logger.js.map \ No newline at end of file diff --git a/lib/commonjs/utilities/logger.js.map b/lib/commonjs/utilities/logger.js.map new file mode 100644 index 000000000..bb51fdbe1 --- /dev/null +++ b/lib/commonjs/utilities/logger.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["logger.ts"],"names":["isLoggingEnabled","enableLogging","__DEV__","console","warn","print","component","method","params","message","Object","keys","map","key","join","log","filter","Boolean","freeze"],"mappings":";;;;;;AAQA,IAAIA,gBAAgB,GAAG,KAAvB;;AAEA,MAAMC,aAAa,GAAG,MAAM;AAC1B,MAAI,CAACC,OAAL,EAAc;AACZC,IAAAA,OAAO,CAACC,IAAR,CAAa,uDAAb;AACA;AACD;;AACDJ,EAAAA,gBAAgB,GAAG,IAAnB;AACD,CAND;;;;AAQA,IAAIK,KAAY,GAAG,MAAM,CAAE,CAA3B;;;;AAEA,IAAIH,OAAJ,EAAa;AACX,kBAAAG,KAAK,GAAG,CAAC;AAAEC,IAAAA,SAAF;AAAaC,IAAAA,MAAb;AAAqBC,IAAAA;AAArB,GAAD,KAAmC;AACzC,QAAI,CAACR,gBAAL,EAAuB;AACrB;AACD;;AACD,QAAIS,OAAO,GAAG,EAAd;;AAEA,QAAI,OAAOD,MAAP,KAAkB,QAAtB,EAAgC;AAC9BC,MAAAA,OAAO,GAAGC,MAAM,CAACC,IAAP,CAAYH,MAAZ,EACPI,GADO,CACHC,GAAG,IAAK,GAAEA,GAAI,IAAGL,MAAM,CAACK,GAAD,CAAM,EAD1B,EAEPC,IAFO,CAEF,GAFE,CAAV;AAGD,KAJD,MAIO;AACLL,MAAAA,OAAO,GAAI,GAAED,MAAH,aAAGA,MAAH,cAAGA,MAAH,GAAa,EAAG,EAA1B;AACD,KAZwC,CAazC;;;AACAL,IAAAA,OAAO,CAACY,GAAR,CAAa,IAAG,CAACT,SAAD,EAAYC,MAAZ,EAAoBS,MAApB,CAA2BC,OAA3B,EAAoCH,IAApC,CAAyC,IAAzC,CAA+C,GAA/D,EAAmEL,OAAnE;AACD,GAfD;AAgBD;;AAEDC,MAAM,CAACQ,MAAP,CAAcb,KAAd","sourcesContent":["interface PrintOptions {\n component?: string;\n method?: string;\n params?: Record | string | number | boolean;\n}\n\ntype Print = (options: PrintOptions) => void;\n\nlet isLoggingEnabled = false;\n\nconst enableLogging = () => {\n if (!__DEV__) {\n console.warn('[BottomSheet] could not enable logging on production!');\n return;\n }\n isLoggingEnabled = true;\n};\n\nlet print: Print = () => {};\n\nif (__DEV__) {\n print = ({ component, method, params }) => {\n if (!isLoggingEnabled) {\n return;\n }\n let message = '';\n\n if (typeof params === 'object') {\n message = Object.keys(params)\n .map(key => `${key}:${params[key]}`)\n .join(' ');\n } else {\n message = `${params ?? ''}`;\n }\n // eslint-disable-next-line no-console\n console.log(`[${[component, method].filter(Boolean).join('::')}]`, message);\n };\n}\n\nObject.freeze(print);\n\nexport { print, enableLogging };\n"]} \ No newline at end of file diff --git a/lib/commonjs/utilities/noop.js b/lib/commonjs/utilities/noop.js new file mode 100644 index 000000000..a9adcfb91 --- /dev/null +++ b/lib/commonjs/utilities/noop.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.workletNoop = exports.noop = void 0; + +const workletNoop = () => { + 'worklet'; +}; + +exports.workletNoop = workletNoop; + +const noop = () => {}; + +exports.noop = noop; +//# sourceMappingURL=noop.js.map \ No newline at end of file diff --git a/lib/commonjs/utilities/noop.js.map b/lib/commonjs/utilities/noop.js.map new file mode 100644 index 000000000..a0d60d0fc --- /dev/null +++ b/lib/commonjs/utilities/noop.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["noop.ts"],"names":["workletNoop","noop"],"mappings":";;;;;;;AAAA,MAAMA,WAAW,GAAG,MAAM;AACxB;AACD,CAFD;;;;AAIA,MAAMC,IAAI,GAAG,MAAM,CAAE,CAArB","sourcesContent":["const workletNoop = () => {\n 'worklet';\n};\n\nconst noop = () => {};\n\nexport { noop, workletNoop };\n"]} \ No newline at end of file diff --git a/lib/commonjs/utilities/normalizeSnapPoint.js b/lib/commonjs/utilities/normalizeSnapPoint.js new file mode 100644 index 000000000..d846c1236 --- /dev/null +++ b/lib/commonjs/utilities/normalizeSnapPoint.js @@ -0,0 +1,24 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.normalizeSnapPoint = void 0; + +/** + * Converts a snap point to fixed numbers. + */ +const normalizeSnapPoint = (snapPoint, containerHeight) => { + 'worklet'; + + let normalizedSnapPoint = snapPoint; // percentage snap point + + if (typeof normalizedSnapPoint === 'string') { + normalizedSnapPoint = Number(normalizedSnapPoint.split('%')[0]) * containerHeight / 100; + } + + return Math.max(0, containerHeight - normalizedSnapPoint); +}; + +exports.normalizeSnapPoint = normalizeSnapPoint; +//# sourceMappingURL=normalizeSnapPoint.js.map \ No newline at end of file diff --git a/lib/commonjs/utilities/normalizeSnapPoint.js.map b/lib/commonjs/utilities/normalizeSnapPoint.js.map new file mode 100644 index 000000000..6c4c14a0c --- /dev/null +++ b/lib/commonjs/utilities/normalizeSnapPoint.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["normalizeSnapPoint.ts"],"names":["normalizeSnapPoint","snapPoint","containerHeight","normalizedSnapPoint","Number","split","Math","max"],"mappings":";;;;;;;AAAA;AACA;AACA;AACO,MAAMA,kBAAkB,GAAG,CAChCC,SADgC,EAEhCC,eAFgC,KAG7B;AACH;;AACA,MAAIC,mBAAmB,GAAGF,SAA1B,CAFG,CAIH;;AACA,MAAI,OAAOE,mBAAP,KAA+B,QAAnC,EAA6C;AAC3CA,IAAAA,mBAAmB,GAChBC,MAAM,CAACD,mBAAmB,CAACE,KAApB,CAA0B,GAA1B,EAA+B,CAA/B,CAAD,CAAN,GAA4CH,eAA7C,GAAgE,GADlE;AAED;;AACD,SAAOI,IAAI,CAACC,GAAL,CAAS,CAAT,EAAYL,eAAe,GAAGC,mBAA9B,CAAP;AACD,CAbM","sourcesContent":["/**\n * Converts a snap point to fixed numbers.\n */\nexport const normalizeSnapPoint = (\n snapPoint: number | string,\n containerHeight: number\n) => {\n 'worklet';\n let normalizedSnapPoint = snapPoint;\n\n // percentage snap point\n if (typeof normalizedSnapPoint === 'string') {\n normalizedSnapPoint =\n (Number(normalizedSnapPoint.split('%')[0]) * containerHeight) / 100;\n }\n return Math.max(0, containerHeight - normalizedSnapPoint);\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/utilities/snapPoint.js b/lib/commonjs/utilities/snapPoint.js new file mode 100644 index 000000000..a525c1e78 --- /dev/null +++ b/lib/commonjs/utilities/snapPoint.js @@ -0,0 +1,18 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.snapPoint = void 0; + +const snapPoint = (value, velocity, points) => { + 'worklet'; + + const point = value + 0.2 * velocity; + const deltas = points.map(p => Math.abs(point - p)); + const minDelta = Math.min.apply(null, deltas); + return points.filter(p => Math.abs(point - p) === minDelta)[0]; +}; + +exports.snapPoint = snapPoint; +//# sourceMappingURL=snapPoint.js.map \ No newline at end of file diff --git a/lib/commonjs/utilities/snapPoint.js.map b/lib/commonjs/utilities/snapPoint.js.map new file mode 100644 index 000000000..1a88bd1f5 --- /dev/null +++ b/lib/commonjs/utilities/snapPoint.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["snapPoint.ts"],"names":["snapPoint","value","velocity","points","point","deltas","map","p","Math","abs","minDelta","min","apply","filter"],"mappings":";;;;;;;AAAO,MAAMA,SAAS,GAAG,CACvBC,KADuB,EAEvBC,QAFuB,EAGvBC,MAHuB,KAIZ;AACX;;AACA,QAAMC,KAAK,GAAGH,KAAK,GAAG,MAAMC,QAA5B;AACA,QAAMG,MAAM,GAAGF,MAAM,CAACG,GAAP,CAAWC,CAAC,IAAIC,IAAI,CAACC,GAAL,CAASL,KAAK,GAAGG,CAAjB,CAAhB,CAAf;AACA,QAAMG,QAAQ,GAAGF,IAAI,CAACG,GAAL,CAASC,KAAT,CAAe,IAAf,EAAqBP,MAArB,CAAjB;AACA,SAAOF,MAAM,CAACU,MAAP,CAAcN,CAAC,IAAIC,IAAI,CAACC,GAAL,CAASL,KAAK,GAAGG,CAAjB,MAAwBG,QAA3C,EAAqD,CAArD,CAAP;AACD,CAVM","sourcesContent":["export const snapPoint = (\n value: number,\n velocity: number,\n points: ReadonlyArray\n): number => {\n 'worklet';\n const point = value + 0.2 * velocity;\n const deltas = points.map(p => Math.abs(point - p));\n const minDelta = Math.min.apply(null, deltas);\n return points.filter(p => Math.abs(point - p) === minDelta)[0];\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/utilities/validateSnapPoint.js b/lib/commonjs/utilities/validateSnapPoint.js new file mode 100644 index 000000000..8f54cb8ea --- /dev/null +++ b/lib/commonjs/utilities/validateSnapPoint.js @@ -0,0 +1,19 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.validateSnapPoint = void 0; + +var _invariant = _interopRequireDefault(require("invariant")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const validateSnapPoint = snapPoint => { + (0, _invariant.default)(typeof snapPoint === 'number' || typeof snapPoint === 'string', `'${snapPoint}' is not a valid snap point! expected types are string or number.`); + (0, _invariant.default)(typeof snapPoint === 'number' || typeof snapPoint === 'string' && snapPoint.includes('%'), `'${snapPoint}' is not a valid percentage snap point! expected percentage snap point must include '%'. e.g. '50%'`); + (0, _invariant.default)(typeof snapPoint === 'number' || typeof snapPoint === 'string' && Number(snapPoint.split('%')[0]), `'${snapPoint}' is not a valid percentage snap point! expected percentage snap point must be only numbers and '%'. e.g. '50%'`); +}; + +exports.validateSnapPoint = validateSnapPoint; +//# sourceMappingURL=validateSnapPoint.js.map \ No newline at end of file diff --git a/lib/commonjs/utilities/validateSnapPoint.js.map b/lib/commonjs/utilities/validateSnapPoint.js.map new file mode 100644 index 000000000..1705ade1f --- /dev/null +++ b/lib/commonjs/utilities/validateSnapPoint.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["validateSnapPoint.ts"],"names":["validateSnapPoint","snapPoint","includes","Number","split"],"mappings":";;;;;;;AAAA;;;;AAEO,MAAMA,iBAAiB,GAAIC,SAAD,IAAoB;AACnD,0BACE,OAAOA,SAAP,KAAqB,QAArB,IAAiC,OAAOA,SAAP,KAAqB,QADxD,EAEG,IAAGA,SAAU,mEAFhB;AAKA,0BACE,OAAOA,SAAP,KAAqB,QAArB,IACG,OAAOA,SAAP,KAAqB,QAArB,IAAiCA,SAAS,CAACC,QAAV,CAAmB,GAAnB,CAFtC,EAGG,IAAGD,SAAU,qGAHhB;AAMA,0BACE,OAAOA,SAAP,KAAqB,QAArB,IACG,OAAOA,SAAP,KAAqB,QAArB,IAAiCE,MAAM,CAACF,SAAS,CAACG,KAAV,CAAgB,GAAhB,EAAqB,CAArB,CAAD,CAF5C,EAGG,IAAGH,SAAU,iHAHhB;AAKD,CAjBM","sourcesContent":["import invariant from 'invariant';\n\nexport const validateSnapPoint = (snapPoint: any) => {\n invariant(\n typeof snapPoint === 'number' || typeof snapPoint === 'string',\n `'${snapPoint}' is not a valid snap point! expected types are string or number.`\n );\n\n invariant(\n typeof snapPoint === 'number' ||\n (typeof snapPoint === 'string' && snapPoint.includes('%')),\n `'${snapPoint}' is not a valid percentage snap point! expected percentage snap point must include '%'. e.g. '50%'`\n );\n\n invariant(\n typeof snapPoint === 'number' ||\n (typeof snapPoint === 'string' && Number(snapPoint.split('%')[0])),\n `'${snapPoint}' is not a valid percentage snap point! expected percentage snap point must be only numbers and '%'. e.g. '50%'`\n );\n};\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheet/BottomSheet.js b/lib/module/components/bottomSheet/BottomSheet.js new file mode 100644 index 000000000..a6c369635 --- /dev/null +++ b/lib/module/components/bottomSheet/BottomSheet.js @@ -0,0 +1,1127 @@ +import React, { useMemo, useCallback, forwardRef, useImperativeHandle, memo, useEffect } from 'react'; +import { Platform } from 'react-native'; +import invariant from 'invariant'; +import Animated, { useAnimatedReaction, useSharedValue, useAnimatedStyle, useDerivedValue, runOnJS, interpolate, Extrapolate, runOnUI, cancelAnimation, useWorkletCallback } from 'react-native-reanimated'; +import { State } from 'react-native-gesture-handler'; +import { useScrollable, usePropsValidator, useReactiveSharedValue, useNormalizedSnapPoints, useKeyboard } from '../../hooks'; +import { BottomSheetInternalProvider, BottomSheetProvider } from '../../contexts'; +import BottomSheetContainer from '../bottomSheetContainer'; +import BottomSheetGestureHandlersProvider from '../bottomSheetGestureHandlersProvider'; +import BottomSheetBackdropContainer from '../bottomSheetBackdropContainer'; +import BottomSheetHandleContainer from '../bottomSheetHandleContainer'; +import BottomSheetBackgroundContainer from '../bottomSheetBackgroundContainer'; +import BottomSheetFooterContainer from '../bottomSheetFooterContainer/BottomSheetFooterContainer'; +import BottomSheetDraggableView from '../bottomSheetDraggableView'; // import BottomSheetDebugView from '../bottomSheetDebugView'; + +import { ANIMATION_STATE, KEYBOARD_STATE, KEYBOARD_BEHAVIOR, SHEET_STATE, SCROLLABLE_STATE, KEYBOARD_BLUR_BEHAVIOR, KEYBOARD_INPUT_MODE, ANIMATION_SOURCE } from '../../constants'; +import { animate, getKeyboardAnimationConfigs, normalizeSnapPoint, print } from '../../utilities'; +import { DEFAULT_OVER_DRAG_RESISTANCE_FACTOR, DEFAULT_ENABLE_CONTENT_PANNING_GESTURE, DEFAULT_ENABLE_HANDLE_PANNING_GESTURE, DEFAULT_ENABLE_OVER_DRAG, DEFAULT_ANIMATE_ON_MOUNT, DEFAULT_KEYBOARD_BEHAVIOR, DEFAULT_KEYBOARD_BLUR_BEHAVIOR, DEFAULT_KEYBOARD_INPUT_MODE, INITIAL_CONTAINER_HEIGHT, INITIAL_HANDLE_HEIGHT, INITIAL_POSITION, INITIAL_SNAP_POINT, DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE, INITIAL_CONTAINER_OFFSET, INITIAL_VALUE, DEFAULT_DYNAMIC_SIZING } from './constants'; +import { styles } from './styles'; +Animated.addWhitelistedUIProps({ + decelerationRate: true +}); +const BottomSheetComponent = /*#__PURE__*/forwardRef(function BottomSheet(props, ref) { + //#region validate props + usePropsValidator(props); //#endregion + //#region extract props + + const { + // animations configurations + animationConfigs: _providedAnimationConfigs, + // configurations + index: _providedIndex = 0, + snapPoints: _providedSnapPoints, + animateOnMount = DEFAULT_ANIMATE_ON_MOUNT, + enableContentPanningGesture = DEFAULT_ENABLE_CONTENT_PANNING_GESTURE, + enableHandlePanningGesture = DEFAULT_ENABLE_HANDLE_PANNING_GESTURE, + enableOverDrag = DEFAULT_ENABLE_OVER_DRAG, + enablePanDownToClose = DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE, + enableDynamicSizing = DEFAULT_DYNAMIC_SIZING, + overDragResistanceFactor = DEFAULT_OVER_DRAG_RESISTANCE_FACTOR, + // styles + style: _providedStyle, + containerStyle: _providedContainerStyle, + backgroundStyle: _providedBackgroundStyle, + handleStyle: _providedHandleStyle, + handleIndicatorStyle: _providedHandleIndicatorStyle, + // hooks + gestureEventsHandlersHook, + // keyboard + keyboardBehavior = DEFAULT_KEYBOARD_BEHAVIOR, + keyboardBlurBehavior = DEFAULT_KEYBOARD_BLUR_BEHAVIOR, + android_keyboardInputMode = DEFAULT_KEYBOARD_INPUT_MODE, + // layout + handleHeight: _providedHandleHeight, + containerHeight: _providedContainerHeight, + contentHeight: _providedContentHeight, + containerOffset: _providedContainerOffset, + topInset = 0, + bottomInset = 0, + maxDynamicContentSize, + // animated callback shared values + animatedPosition: _providedAnimatedPosition, + animatedIndex: _providedAnimatedIndex, + // gestures + simultaneousHandlers: _providedSimultaneousHandlers, + waitFor: _providedWaitFor, + activeOffsetX: _providedActiveOffsetX, + activeOffsetY: _providedActiveOffsetY, + failOffsetX: _providedFailOffsetX, + failOffsetY: _providedFailOffsetY, + // callbacks + onChange: _providedOnChange, + onClose: _providedOnClose, + onAnimate: _providedOnAnimate, + // private + $modal = false, + detached = false, + // components + handleComponent, + backdropComponent, + backgroundComponent, + footerComponent, + children: Content + } = props; //#endregion + //#region layout variables + + /** + * This variable is consider an internal variable, + * that will be used conditionally in `animatedContainerHeight` + */ + + const _animatedContainerHeight = useReactiveSharedValue(_providedContainerHeight !== null && _providedContainerHeight !== void 0 ? _providedContainerHeight : INITIAL_CONTAINER_HEIGHT); + /** + * This is a conditional variable, where if the `BottomSheet` is used + * in a modal, then it will subset vertical insets (top+bottom) from + * provided container height. + */ + + + const animatedContainerHeight = useDerivedValue(() => { + const verticalInset = topInset + bottomInset; + return $modal ? _animatedContainerHeight.value - verticalInset : _animatedContainerHeight.value; + }, [$modal, topInset, bottomInset]); + const animatedContainerOffset = useReactiveSharedValue(_providedContainerOffset !== null && _providedContainerOffset !== void 0 ? _providedContainerOffset : INITIAL_CONTAINER_OFFSET); + const animatedHandleHeight = useReactiveSharedValue(_providedHandleHeight !== null && _providedHandleHeight !== void 0 ? _providedHandleHeight : INITIAL_HANDLE_HEIGHT); + const animatedFooterHeight = useSharedValue(0); + const animatedContentHeight = useSharedValue(INITIAL_CONTAINER_HEIGHT); + const animatedSnapPoints = useNormalizedSnapPoints(_providedSnapPoints, animatedContainerHeight, animatedContentHeight, animatedHandleHeight, enableDynamicSizing, maxDynamicContentSize); + const animatedHighestSnapPoint = useDerivedValue(() => animatedSnapPoints.value[animatedSnapPoints.value.length - 1]); + const animatedClosedPosition = useDerivedValue(() => { + let closedPosition = animatedContainerHeight.value; + + if ($modal || detached) { + closedPosition = animatedContainerHeight.value + bottomInset; + } + + return closedPosition; + }, [$modal, detached, bottomInset]); + const animatedSheetHeight = useDerivedValue(() => animatedContainerHeight.value - animatedHighestSnapPoint.value); + const animatedCurrentIndex = useReactiveSharedValue(animateOnMount ? -1 : _providedIndex); + const animatedPosition = useSharedValue(INITIAL_POSITION); + const animatedNextPosition = useSharedValue(INITIAL_VALUE); + const animatedNextPositionIndex = useSharedValue(0); // conditional + + const isAnimatedOnMount = useSharedValue(false); + const isContentHeightFixed = useSharedValue(false); + const isLayoutCalculated = useDerivedValue(() => { + let isContainerHeightCalculated = false; //container height was provided. + + if (_providedContainerHeight !== null || _providedContainerHeight !== undefined) { + isContainerHeightCalculated = true; + } // container height did set. + + + if (animatedContainerHeight.value !== INITIAL_CONTAINER_HEIGHT) { + isContainerHeightCalculated = true; + } + + let isHandleHeightCalculated = false; // handle height is provided. + + if (_providedHandleHeight !== null && _providedHandleHeight !== undefined && typeof _providedHandleHeight === 'number') { + isHandleHeightCalculated = true; + } // handle component is null. + + + if (handleComponent === null) { + animatedHandleHeight.value = 0; + isHandleHeightCalculated = true; + } // handle height did set. + + + if (animatedHandleHeight.value !== INITIAL_HANDLE_HEIGHT) { + isHandleHeightCalculated = true; + } + + let isSnapPointsNormalized = false; // the first snap point did normalized + + if (animatedSnapPoints.value[0] !== INITIAL_SNAP_POINT) { + isSnapPointsNormalized = true; + } + + return isContainerHeightCalculated && isHandleHeightCalculated && isSnapPointsNormalized; + }); + const isInTemporaryPosition = useSharedValue(false); + const isForcedClosing = useSharedValue(false); // gesture + + const animatedContentGestureState = useSharedValue(State.UNDETERMINED); + const animatedHandleGestureState = useSharedValue(State.UNDETERMINED); //#endregion + //#region hooks variables + // scrollable variables + + const { + animatedScrollableType, + animatedScrollableContentOffsetY, + animatedScrollableOverrideState, + isScrollableRefreshable, + setScrollableRef, + removeScrollableRef + } = useScrollable(); // keyboard + + const { + state: animatedKeyboardState, + height: animatedKeyboardHeight, + animationDuration: keyboardAnimationDuration, + animationEasing: keyboardAnimationEasing, + shouldHandleKeyboardEvents + } = useKeyboard(); + const animatedKeyboardHeightInContainer = useSharedValue(0); //#endregion + //#region state/dynamic variables + // states + + const animatedAnimationState = useSharedValue(ANIMATION_STATE.UNDETERMINED); + const animatedAnimationSource = useSharedValue(ANIMATION_SOURCE.MOUNT); + const animatedSheetState = useDerivedValue(() => { + // closed position = position >= container height + if (animatedPosition.value >= animatedClosedPosition.value) return SHEET_STATE.CLOSED; // extended position = container height - sheet height + + const extendedPosition = animatedContainerHeight.value - animatedSheetHeight.value; + if (animatedPosition.value === extendedPosition) return SHEET_STATE.EXTENDED; // extended position with keyboard = + // container height - (sheet height + keyboard height in root container) + + const keyboardHeightInContainer = animatedKeyboardHeightInContainer.value; + const extendedPositionWithKeyboard = Math.max(0, animatedContainerHeight.value - (animatedSheetHeight.value + keyboardHeightInContainer)); // detect if keyboard is open and the sheet is in temporary position + + if (keyboardBehavior === KEYBOARD_BEHAVIOR.interactive && isInTemporaryPosition.value && animatedPosition.value === extendedPositionWithKeyboard) { + return SHEET_STATE.EXTENDED; + } // fill parent = 0 + + + if (animatedPosition.value === 0) { + return SHEET_STATE.FILL_PARENT; + } // detect if position is below extended point + + + if (animatedPosition.value < extendedPosition) { + return SHEET_STATE.OVER_EXTENDED; + } + + return SHEET_STATE.OPENED; + }, [animatedClosedPosition, animatedContainerHeight, animatedKeyboardHeightInContainer, animatedPosition, animatedSheetHeight, isInTemporaryPosition, keyboardBehavior]); + const animatedScrollableState = useDerivedValue(() => { + /** + * if scrollable override state is set, then we just return its value. + */ + if (animatedScrollableOverrideState.value !== SCROLLABLE_STATE.UNDETERMINED) { + return animatedScrollableOverrideState.value; + } + /** + * if sheet state is fill parent, then unlock scrolling + */ + + + if (animatedSheetState.value === SHEET_STATE.FILL_PARENT) { + return SCROLLABLE_STATE.UNLOCKED; + } + /** + * if sheet state is extended, then unlock scrolling + */ + + + if (animatedSheetState.value === SHEET_STATE.EXTENDED) { + return SCROLLABLE_STATE.UNLOCKED; + } + /** + * if keyboard is shown and sheet is animating + * then we do not lock the scrolling to not lose + * current scrollable scroll position. + */ + + + if (animatedKeyboardState.value === KEYBOARD_STATE.SHOWN && animatedAnimationState.value === ANIMATION_STATE.RUNNING) { + return SCROLLABLE_STATE.UNLOCKED; + } + + return SCROLLABLE_STATE.LOCKED; + }); // dynamic + + const animatedContentHeightMax = useDerivedValue(() => { + const keyboardHeightInContainer = animatedKeyboardHeightInContainer.value; + const handleHeight = Math.max(0, animatedHandleHeight.value); + let contentHeight = animatedSheetHeight.value - handleHeight; + + if (keyboardBehavior === KEYBOARD_BEHAVIOR.extend && animatedKeyboardState.value === KEYBOARD_STATE.SHOWN) { + contentHeight = contentHeight - keyboardHeightInContainer; + } else if (keyboardBehavior === KEYBOARD_BEHAVIOR.fillParent && isInTemporaryPosition.value) { + if (animatedKeyboardState.value === KEYBOARD_STATE.SHOWN) { + contentHeight = animatedContainerHeight.value - handleHeight - keyboardHeightInContainer; + } else { + contentHeight = animatedContainerHeight.value - handleHeight; + } + } else if (keyboardBehavior === KEYBOARD_BEHAVIOR.interactive && isInTemporaryPosition.value) { + const contentWithKeyboardHeight = contentHeight + keyboardHeightInContainer; + + if (animatedKeyboardState.value === KEYBOARD_STATE.SHOWN) { + if (keyboardHeightInContainer + animatedSheetHeight.value > animatedContainerHeight.value) { + contentHeight = animatedContainerHeight.value - keyboardHeightInContainer - handleHeight; + } + } else if (contentWithKeyboardHeight + handleHeight > animatedContainerHeight.value) { + contentHeight = animatedContainerHeight.value - handleHeight; + } else { + contentHeight = contentWithKeyboardHeight; + } + } + /** + * before the container is measured, `contentHeight` value will be below zero, + * which will lead to freeze the scrollable. + * + * @link (https://github.com/gorhom/react-native-bottom-sheet/issues/470) + */ + + + return Math.max(contentHeight, 0); + }, [animatedContainerHeight, animatedHandleHeight, animatedKeyboardHeightInContainer, animatedKeyboardState, animatedSheetHeight, isInTemporaryPosition, keyboardBehavior]); + const animatedIndex = useDerivedValue(() => { + const adjustedSnapPoints = animatedSnapPoints.value.slice().reverse(); + const adjustedSnapPointsIndexes = animatedSnapPoints.value.slice().map((_, index) => index).reverse(); + /** + * we add the close state index `-1` + */ + + adjustedSnapPoints.push(animatedContainerHeight.value); + adjustedSnapPointsIndexes.push(-1); + const currentIndex = isLayoutCalculated.value ? interpolate(animatedPosition.value, adjustedSnapPoints, adjustedSnapPointsIndexes, Extrapolate.CLAMP) : -1; + /** + * if the sheet is currently running an animation by the keyboard opening, + * then we clamp the index on android with resize keyboard mode. + */ + + if (android_keyboardInputMode === KEYBOARD_INPUT_MODE.adjustResize && animatedAnimationSource.value === ANIMATION_SOURCE.KEYBOARD && animatedAnimationState.value === ANIMATION_STATE.RUNNING && isInTemporaryPosition.value) { + return Math.max(animatedCurrentIndex.value, currentIndex); + } + /** + * if the sheet is currently running an animation by snap point change - usually caused + * by dynamic content height -, then we return the next position index. + */ + + + if (animatedAnimationSource.value === ANIMATION_SOURCE.SNAP_POINT_CHANGE && animatedAnimationState.value === ANIMATION_STATE.RUNNING) { + return animatedNextPositionIndex.value; + } + + return currentIndex; + }, [android_keyboardInputMode]); //#endregion + //#region private methods + + /** + * Calculate the next position based on keyboard state. + */ + + const getNextPosition = useWorkletCallback(function getNextPosition() { + 'worklet'; + + const currentIndex = animatedCurrentIndex.value; + const snapPoints = animatedSnapPoints.value; + const keyboardState = animatedKeyboardState.value; + const highestSnapPoint = animatedHighestSnapPoint.value; + /** + * Handle restore sheet position on blur + */ + + if (keyboardBlurBehavior === KEYBOARD_BLUR_BEHAVIOR.restore && keyboardState === KEYBOARD_STATE.HIDDEN && animatedContentGestureState.value !== State.ACTIVE && animatedHandleGestureState.value !== State.ACTIVE) { + isInTemporaryPosition.value = false; + const nextPosition = snapPoints[currentIndex]; + return nextPosition; + } + /** + * Handle extend behavior + */ + + + if (keyboardBehavior === KEYBOARD_BEHAVIOR.extend && keyboardState === KEYBOARD_STATE.SHOWN) { + return highestSnapPoint; + } + /** + * Handle full screen behavior + */ + + + if (keyboardBehavior === KEYBOARD_BEHAVIOR.fillParent && keyboardState === KEYBOARD_STATE.SHOWN) { + isInTemporaryPosition.value = true; + return 0; + } + /** + * handle interactive behavior + */ + + + if (keyboardBehavior === KEYBOARD_BEHAVIOR.interactive && keyboardState === KEYBOARD_STATE.SHOWN) { + isInTemporaryPosition.value = true; + const keyboardHeightInContainer = animatedKeyboardHeightInContainer.value; + return Math.max(0, highestSnapPoint - keyboardHeightInContainer); + } + + if (isInTemporaryPosition.value) { + return animatedPosition.value; + } + + return snapPoints[currentIndex]; + }, [animatedContentGestureState, animatedCurrentIndex, animatedHandleGestureState, animatedHighestSnapPoint, animatedKeyboardHeightInContainer, animatedKeyboardState, animatedPosition, animatedSnapPoints, isInTemporaryPosition, keyboardBehavior, keyboardBlurBehavior]); + const handleOnChange = useCallback(function handleOnChange(index) { + print({ + component: BottomSheet.name, + method: handleOnChange.name, + params: { + index, + animatedCurrentIndex: animatedCurrentIndex.value + } + }); + + if (_providedOnChange) { + _providedOnChange(index); + } + }, [_providedOnChange, animatedCurrentIndex]); + const handleOnAnimate = useCallback(function handleOnAnimate(toPoint) { + const snapPoints = animatedSnapPoints.value; + const toIndex = snapPoints.indexOf(toPoint); + print({ + component: BottomSheet.name, + method: handleOnAnimate.name, + params: { + toIndex, + fromIndex: animatedCurrentIndex.value + } + }); + + if (!_providedOnAnimate) { + return; + } + + if (toIndex !== animatedCurrentIndex.value) { + _providedOnAnimate(animatedCurrentIndex.value, toIndex); + } + }, [_providedOnAnimate, animatedSnapPoints, animatedCurrentIndex]); //#endregion + //#region animation + + const stopAnimation = useWorkletCallback(() => { + cancelAnimation(animatedPosition); + isForcedClosing.value = false; + animatedAnimationSource.value = ANIMATION_SOURCE.NONE; + animatedAnimationState.value = ANIMATION_STATE.STOPPED; + }, [animatedPosition, animatedAnimationState, animatedAnimationSource]); + const animateToPositionCompleted = useWorkletCallback(function animateToPositionCompleted(isFinished) { + isForcedClosing.value = false; + + if (!isFinished) { + return; + } + + runOnJS(print)({ + component: BottomSheet.name, + method: animateToPositionCompleted.name, + params: { + animatedCurrentIndex: animatedCurrentIndex.value, + animatedNextPosition: animatedNextPosition.value, + animatedNextPositionIndex: animatedNextPositionIndex.value + } + }); + animatedAnimationSource.value = ANIMATION_SOURCE.NONE; + animatedAnimationState.value = ANIMATION_STATE.STOPPED; + animatedNextPosition.value = INITIAL_VALUE; + animatedNextPositionIndex.value = INITIAL_VALUE; + }); + const animateToPosition = useWorkletCallback(function animateToPosition(position, source, velocity = 0, configs) { + if (position === animatedPosition.value || position === undefined || animatedAnimationState.value === ANIMATION_STATE.RUNNING && position === animatedNextPosition.value) { + return; + } + + runOnJS(print)({ + component: BottomSheet.name, + method: animateToPosition.name, + params: { + currentPosition: animatedPosition.value, + position, + velocity, + animatedContainerHeight: animatedContainerHeight.value + } + }); + stopAnimation(); + /** + * set animation state to running, and source + */ + + animatedAnimationState.value = ANIMATION_STATE.RUNNING; + animatedAnimationSource.value = source; + /** + * store next position + */ + + animatedNextPosition.value = position; + animatedNextPositionIndex.value = animatedSnapPoints.value.indexOf(position); + /** + * fire `onAnimate` callback + */ + + runOnJS(handleOnAnimate)(position); + /** + * force animation configs from parameters, if provided + */ + + if (configs !== undefined) { + animatedPosition.value = animate({ + point: position, + configs, + velocity, + onComplete: animateToPositionCompleted + }); + } else { + /** + * use animationConfigs callback, if provided + */ + animatedPosition.value = animate({ + point: position, + velocity, + configs: _providedAnimationConfigs, + onComplete: animateToPositionCompleted + }); + } + }, [handleOnAnimate, _providedAnimationConfigs]); //#endregion + //#region public methods + + const handleSnapToIndex = useCallback(function handleSnapToIndex(index, animationConfigs) { + const snapPoints = animatedSnapPoints.value; + invariant(index >= -1 && index <= snapPoints.length - 1, `'index' was provided but out of the provided snap points range! expected value to be between -1, ${snapPoints.length - 1}`); + print({ + component: BottomSheet.name, + method: handleSnapToIndex.name, + params: { + index + } + }); + const nextPosition = snapPoints[index]; + /** + * exit method if : + * - layout is not calculated. + * - already animating to next position. + * - sheet is forced closing. + */ + + if (!isLayoutCalculated.value || index === animatedNextPositionIndex.value || nextPosition === animatedNextPosition.value || isForcedClosing.value) { + return; + } + /** + * reset temporary position boolean. + */ + + + isInTemporaryPosition.value = false; + runOnUI(animateToPosition)(nextPosition, ANIMATION_SOURCE.USER, 0, animationConfigs); + }, [animateToPosition, isLayoutCalculated, isInTemporaryPosition, isForcedClosing, animatedSnapPoints, animatedNextPosition, animatedNextPositionIndex]); + const handleSnapToPosition = useWorkletCallback(function handleSnapToPosition(position, animationConfigs) { + print({ + component: BottomSheet.name, + method: handleSnapToPosition.name, + params: { + position + } + }); + /** + * normalized provided position. + */ + + const nextPosition = normalizeSnapPoint(position, animatedContainerHeight.value); + /** + * exit method if : + * - layout is not calculated. + * - already animating to next position. + * - sheet is forced closing. + */ + + if (!isLayoutCalculated || nextPosition === animatedNextPosition.value || isForcedClosing.value) { + return; + } + /** + * mark the new position as temporary. + */ + + + isInTemporaryPosition.value = true; + runOnUI(animateToPosition)(nextPosition, ANIMATION_SOURCE.USER, 0, animationConfigs); + }, [animateToPosition, bottomInset, topInset, isLayoutCalculated, isForcedClosing, animatedContainerHeight, animatedPosition]); + const handleClose = useCallback(function handleClose(animationConfigs) { + print({ + component: BottomSheet.name, + method: handleClose.name + }); + const nextPosition = animatedClosedPosition.value; + /** + * exit method if : + * - layout is not calculated. + * - already animating to next position. + * - sheet is forced closing. + */ + + if (!isLayoutCalculated.value || nextPosition === animatedNextPosition.value || isForcedClosing.value) { + return; + } + /** + * reset temporary position variable. + */ + + + isInTemporaryPosition.value = false; + runOnUI(animateToPosition)(nextPosition, ANIMATION_SOURCE.USER, 0, animationConfigs); + }, [animateToPosition, isForcedClosing, isLayoutCalculated, isInTemporaryPosition, animatedNextPosition, animatedClosedPosition]); + const handleForceClose = useCallback(function handleForceClose(animationConfigs) { + print({ + component: BottomSheet.name, + method: handleForceClose.name + }); + const nextPosition = animatedClosedPosition.value; + /** + * exit method if : + * - already animating to next position. + * - sheet is forced closing. + */ + + if (nextPosition === animatedNextPosition.value || isForcedClosing.value) { + return; + } + /** + * reset temporary position variable. + */ + + + isInTemporaryPosition.value = false; + /** + * set force closing variable. + */ + + isForcedClosing.value = true; + runOnUI(animateToPosition)(nextPosition, ANIMATION_SOURCE.USER, 0, animationConfigs); + }, [animateToPosition, isForcedClosing, isInTemporaryPosition, animatedNextPosition, animatedClosedPosition]); + const handleExpand = useCallback(function handleExpand(animationConfigs) { + print({ + component: BottomSheet.name, + method: handleExpand.name + }); + const snapPoints = animatedSnapPoints.value; + const nextPosition = snapPoints[snapPoints.length - 1]; + /** + * exit method if : + * - layout is not calculated. + * - already animating to next position. + * - sheet is forced closing. + */ + + if (!isLayoutCalculated.value || snapPoints.length - 1 === animatedNextPositionIndex.value || nextPosition === animatedNextPosition.value || isForcedClosing.value) { + return; + } + /** + * reset temporary position boolean. + */ + + + isInTemporaryPosition.value = false; + runOnUI(animateToPosition)(nextPosition, ANIMATION_SOURCE.USER, 0, animationConfigs); + }, [animateToPosition, isInTemporaryPosition, isLayoutCalculated, isForcedClosing, animatedSnapPoints, animatedNextPosition, animatedNextPositionIndex]); + const handleCollapse = useCallback(function handleCollapse(animationConfigs) { + print({ + component: BottomSheet.name, + method: handleCollapse.name + }); + const nextPosition = animatedSnapPoints.value[0]; + /** + * exit method if : + * - layout is not calculated. + * - already animating to next position. + * - sheet is forced closing. + */ + + if (!isLayoutCalculated || animatedNextPositionIndex.value === 0 || nextPosition === animatedNextPosition.value || isForcedClosing.value) { + return; + } + /** + * reset temporary position boolean. + */ + + + isInTemporaryPosition.value = false; + runOnUI(animateToPosition)(nextPosition, ANIMATION_SOURCE.USER, 0, animationConfigs); + }, [animateToPosition, isForcedClosing, isLayoutCalculated, isInTemporaryPosition, animatedSnapPoints, animatedNextPosition, animatedNextPositionIndex]); + useImperativeHandle(ref, () => ({ + snapToIndex: handleSnapToIndex, + snapToPosition: handleSnapToPosition, + expand: handleExpand, + collapse: handleCollapse, + close: handleClose, + forceClose: handleForceClose + })); //#endregion + //#region contexts variables + + const internalContextVariables = useMemo(() => ({ + enableContentPanningGesture, + enableDynamicSizing, + overDragResistanceFactor, + enableOverDrag, + enablePanDownToClose, + animatedAnimationState, + animatedSheetState, + animatedScrollableState, + animatedScrollableOverrideState, + animatedContentGestureState, + animatedHandleGestureState, + animatedKeyboardState, + animatedScrollableType, + animatedIndex, + animatedPosition, + animatedContentHeight, + animatedClosedPosition, + animatedHandleHeight, + animatedFooterHeight, + animatedKeyboardHeight, + animatedKeyboardHeightInContainer, + animatedContainerHeight, + animatedSnapPoints, + animatedHighestSnapPoint, + animatedScrollableContentOffsetY, + isInTemporaryPosition, + isContentHeightFixed, + isScrollableRefreshable, + shouldHandleKeyboardEvents, + simultaneousHandlers: _providedSimultaneousHandlers, + waitFor: _providedWaitFor, + activeOffsetX: _providedActiveOffsetX, + activeOffsetY: _providedActiveOffsetY, + failOffsetX: _providedFailOffsetX, + failOffsetY: _providedFailOffsetY, + animateToPosition, + stopAnimation, + setScrollableRef, + removeScrollableRef + }), [animatedIndex, animatedPosition, animatedContentHeight, animatedScrollableType, animatedContentGestureState, animatedHandleGestureState, animatedClosedPosition, animatedFooterHeight, animatedContainerHeight, animatedHandleHeight, animatedAnimationState, animatedKeyboardState, animatedKeyboardHeight, animatedKeyboardHeightInContainer, animatedSheetState, animatedHighestSnapPoint, animatedScrollableState, animatedScrollableOverrideState, animatedSnapPoints, shouldHandleKeyboardEvents, animatedScrollableContentOffsetY, isScrollableRefreshable, isContentHeightFixed, isInTemporaryPosition, enableContentPanningGesture, overDragResistanceFactor, enableOverDrag, enablePanDownToClose, enableDynamicSizing, _providedSimultaneousHandlers, _providedWaitFor, _providedActiveOffsetX, _providedActiveOffsetY, _providedFailOffsetX, _providedFailOffsetY, setScrollableRef, removeScrollableRef, animateToPosition, stopAnimation]); + const externalContextVariables = useMemo(() => ({ + animatedIndex, + animatedPosition, + snapToIndex: handleSnapToIndex, + snapToPosition: handleSnapToPosition, + expand: handleExpand, + collapse: handleCollapse, + close: handleClose, + forceClose: handleForceClose + }), [animatedIndex, animatedPosition, handleSnapToIndex, handleSnapToPosition, handleExpand, handleCollapse, handleClose, handleForceClose]); //#endregion + //#region styles + + const containerAnimatedStyle = useAnimatedStyle(() => ({ + opacity: Platform.OS === 'android' && animatedIndex.value === -1 ? 0 : 1, + transform: [{ + translateY: animatedPosition.value + }] + }), [animatedPosition, animatedIndex]); + const containerStyle = useMemo(() => [_providedStyle, styles.container, containerAnimatedStyle], [_providedStyle, containerAnimatedStyle]); + const contentContainerAnimatedStyle = useAnimatedStyle(() => { + /** + * if content height was provided, then we skip setting + * calculated height. + */ + if (_providedContentHeight) { + return {}; + } + + return { + height: animate({ + point: animatedContentHeightMax.value, + configs: _providedAnimationConfigs + }) + }; + }, [animatedContentHeightMax, enableDynamicSizing, animatedContentHeight]); + const contentContainerStyle = useMemo(() => [styles.contentContainer, contentContainerAnimatedStyle], [contentContainerAnimatedStyle]); + /** + * added safe area to prevent the sheet from floating above + * the bottom of the screen, when sheet being over dragged or + * when the sheet is resized. + */ + + const contentMaskContainerAnimatedStyle = useAnimatedStyle(() => { + if (detached) { + return { + overflow: 'visible' + }; + } + + return { + paddingBottom: animatedContainerHeight.value + }; + }, [detached]); + const contentMaskContainerStyle = useMemo(() => [styles.contentMaskContainer, contentMaskContainerAnimatedStyle], [contentMaskContainerAnimatedStyle]); //#endregion + //#region effects + + /** + * React to `isLayoutCalculated` change, to insure that the sheet will + * appears/mounts only when all layout is been calculated. + * + * @alias OnMount + */ + + useAnimatedReaction(() => isLayoutCalculated.value, _isLayoutCalculated => { + /** + * exit method if: + * - layout is not calculated yet. + * - already did animate on mount. + */ + if (!_isLayoutCalculated || isAnimatedOnMount.value) { + return; + } + + let nextPosition; + + if (_providedIndex === -1) { + nextPosition = animatedClosedPosition.value; + animatedNextPositionIndex.value = -1; + } else { + nextPosition = animatedSnapPoints.value[_providedIndex]; + } + + runOnJS(print)({ + component: BottomSheet.name, + method: 'useAnimatedReaction::OnMount', + params: { + isLayoutCalculated: _isLayoutCalculated, + animatedSnapPoints: animatedSnapPoints.value, + nextPosition + } + }); + /** + * here we exit method early because the next position + * is out of the screen, this happens when `snapPoints` + * still being calculated. + */ + + if (nextPosition === INITIAL_POSITION || nextPosition === animatedClosedPosition.value) { + isAnimatedOnMount.value = true; + animatedCurrentIndex.value = _providedIndex; + return; + } + + if (animateOnMount) { + animateToPosition(nextPosition, ANIMATION_SOURCE.MOUNT); + } else { + animatedPosition.value = nextPosition; + } + + isAnimatedOnMount.value = true; + }, [_providedIndex, animateOnMount]); + /** + * React to `snapPoints` change, to insure that the sheet position reflect + * to the current point correctly. + * + * @alias OnSnapPointsChange + */ + + useAnimatedReaction(() => ({ + snapPoints: animatedSnapPoints.value, + containerHeight: animatedContainerHeight.value + }), (result, _previousResult) => { + const { + snapPoints, + containerHeight + } = result; + + const _previousSnapPoints = _previousResult === null || _previousResult === void 0 ? void 0 : _previousResult.snapPoints; + + const _previousContainerHeight = _previousResult === null || _previousResult === void 0 ? void 0 : _previousResult.containerHeight; + + let nextPosition; + let animationConfig; + let animationSource = ANIMATION_SOURCE.SNAP_POINT_CHANGE; + /** + * if the bottom sheet is closing and the container gets resized, + * then we restart the closing animation to the new position. + */ + + if (animatedAnimationState.value === ANIMATION_STATE.RUNNING && animatedNextPositionIndex.value === -1 && _previousContainerHeight !== containerHeight) { + animationSource = ANIMATION_SOURCE.CONTAINER_RESIZE; + animationConfig = { + duration: 0 + }; + animateToPosition(containerHeight, animationSource, 0, animationConfig); + } + + if (JSON.stringify(snapPoints) === JSON.stringify(_previousSnapPoints) || !isLayoutCalculated.value || !isAnimatedOnMount.value || containerHeight <= 0) { + return; + } + + runOnJS(print)({ + component: BottomSheet.name, + method: 'useAnimatedReaction::OnSnapPointChange', + params: { + snapPoints + } + }); + /** + * if snap points changed while sheet is animating, then + * we stop the animation and animate to the updated point. + */ + + if (animatedAnimationState.value === ANIMATION_STATE.RUNNING && animatedNextPositionIndex.value !== animatedCurrentIndex.value) { + nextPosition = animatedNextPositionIndex.value !== -1 ? snapPoints[animatedNextPositionIndex.value] : animatedNextPosition.value; + } else if (animatedCurrentIndex.value === -1) { + nextPosition = animatedClosedPosition.value; + } else if (isInTemporaryPosition.value) { + nextPosition = getNextPosition(); + } else { + nextPosition = snapPoints[animatedCurrentIndex.value]; + /** + * if snap points changes because of the container height change, + * then we skip the snap animation by setting the duration to 0. + */ + + if (containerHeight !== _previousContainerHeight) { + animationSource = ANIMATION_SOURCE.CONTAINER_RESIZE; + animationConfig = { + duration: 0 + }; + } + } + + animateToPosition(nextPosition, animationSource, 0, animationConfig); + }); + /** + * React to keyboard appearance state. + * + * @alias OnKeyboardStateChange + */ + + useAnimatedReaction(() => ({ + _keyboardState: animatedKeyboardState.value, + _keyboardHeight: animatedKeyboardHeight.value + }), (result, _previousResult) => { + const { + _keyboardState, + _keyboardHeight + } = result; + + const _previousKeyboardState = _previousResult === null || _previousResult === void 0 ? void 0 : _previousResult._keyboardState; + + const _previousKeyboardHeight = _previousResult === null || _previousResult === void 0 ? void 0 : _previousResult._keyboardHeight; + /** + * Calculate the keyboard height in the container. + */ + + + animatedKeyboardHeightInContainer.value = $modal ? Math.abs(_keyboardHeight - Math.abs(bottomInset - animatedContainerOffset.value.bottom)) : Math.abs(_keyboardHeight - animatedContainerOffset.value.bottom); + const hasActiveGesture = animatedContentGestureState.value === State.ACTIVE || animatedContentGestureState.value === State.BEGAN || animatedHandleGestureState.value === State.ACTIVE || animatedHandleGestureState.value === State.BEGAN; + + if ( + /** + * if keyboard state is equal to the previous state, then exit the method + */ + _keyboardState === _previousKeyboardState && _keyboardHeight === _previousKeyboardHeight || + /** + * if user is interacting with sheet, then exit the method + */ + hasActiveGesture || + /** + * if sheet not animated on mount yet, then exit the method + */ + !isAnimatedOnMount.value || _keyboardState === KEYBOARD_STATE.HIDDEN && keyboardBlurBehavior === KEYBOARD_BLUR_BEHAVIOR.none || Platform.OS === 'android' && keyboardBehavior === KEYBOARD_BEHAVIOR.interactive && android_keyboardInputMode === KEYBOARD_INPUT_MODE.adjustResize) { + animatedKeyboardHeightInContainer.value = 0; + return; + } + + runOnJS(print)({ + component: BottomSheet.name, + method: 'useAnimatedReaction::OnKeyboardStateChange', + params: { + keyboardState: _keyboardState, + keyboardHeight: _keyboardHeight + } + }); + let animationConfigs = getKeyboardAnimationConfigs(keyboardAnimationEasing.value, keyboardAnimationDuration.value); + const nextPosition = getNextPosition(); + animateToPosition(nextPosition, ANIMATION_SOURCE.KEYBOARD, 0, animationConfigs); + }, [$modal, bottomInset, keyboardBehavior, keyboardBlurBehavior, android_keyboardInputMode, animatedContainerOffset, getNextPosition]); + /** + * sets provided animated position + */ + + useAnimatedReaction(() => animatedPosition.value, _animatedPosition => { + if (_providedAnimatedPosition) { + _providedAnimatedPosition.value = _animatedPosition + topInset; + } + }); + /** + * sets provided animated index + */ + + useAnimatedReaction(() => animatedIndex.value, _animatedIndex => { + if (_providedAnimatedIndex) { + _providedAnimatedIndex.value = _animatedIndex; + } + }); + /** + * React to internal variables to detect change in snap position. + * + * @alias OnChange + */ + + useAnimatedReaction(() => ({ + _animatedIndex: animatedIndex.value, + _animatedPosition: animatedPosition.value, + _animationState: animatedAnimationState.value, + _contentGestureState: animatedContentGestureState.value, + _handleGestureState: animatedHandleGestureState.value + }), ({ + _animatedIndex, + _animationState, + _contentGestureState, + _handleGestureState + }) => { + /** + * exit the method if animation state is not stopped. + */ + if (_animationState !== ANIMATION_STATE.STOPPED) { + return; + } + /** + * exit the method if animated index value + * has fraction, e.g. 1.99, 0.52 + */ + + + if (_animatedIndex % 1 !== 0) { + return; + } + /** + * exit the method if there any active gesture. + */ + + + const hasNoActiveGesture = (_contentGestureState === State.END || _contentGestureState === State.UNDETERMINED || _contentGestureState === State.CANCELLED) && (_handleGestureState === State.END || _handleGestureState === State.UNDETERMINED || _handleGestureState === State.CANCELLED); + + if (!hasNoActiveGesture) { + return; + } + /** + * if the index is not equal to the current index, + * than the sheet position had changed and we trigger + * the `onChange` callback. + */ + + + if (_animatedIndex !== animatedCurrentIndex.value) { + runOnJS(print)({ + component: BottomSheet.name, + method: 'useAnimatedReaction::OnChange', + params: { + animatedCurrentIndex: animatedCurrentIndex.value, + animatedIndex: _animatedIndex + } + }); + animatedCurrentIndex.value = _animatedIndex; + runOnJS(handleOnChange)(_animatedIndex); + } + /** + * if index is `-1` than we fire the `onClose` callback. + */ + + + if (_animatedIndex === -1 && _providedOnClose) { + runOnJS(print)({ + component: BottomSheet.name, + method: 'useAnimatedReaction::onClose', + params: { + animatedCurrentIndex: animatedCurrentIndex.value, + animatedIndex: _animatedIndex + } + }); + runOnJS(_providedOnClose)(); + } + }, [handleOnChange, _providedOnClose]); + /** + * React to `index` prop to snap the sheet to the new position. + * + * @alias onIndexChange + */ + + useEffect(() => { + if (isAnimatedOnMount.value) { + handleSnapToIndex(_providedIndex); + } + }, [_providedIndex, animatedCurrentIndex, isAnimatedOnMount, handleSnapToIndex]); //#endregion + // render + + print({ + component: BottomSheet.name, + method: 'render', + params: { + animatedSnapPoints: animatedSnapPoints.value, + animatedCurrentIndex: animatedCurrentIndex.value, + providedIndex: _providedIndex + } + }); + return /*#__PURE__*/React.createElement(BottomSheetProvider, { + value: externalContextVariables + }, /*#__PURE__*/React.createElement(BottomSheetInternalProvider, { + value: internalContextVariables + }, /*#__PURE__*/React.createElement(BottomSheetGestureHandlersProvider, { + gestureEventsHandlersHook: gestureEventsHandlersHook + }, /*#__PURE__*/React.createElement(BottomSheetBackdropContainer, { + key: "BottomSheetBackdropContainer", + animatedIndex: animatedIndex, + animatedPosition: animatedPosition, + backdropComponent: backdropComponent + }), /*#__PURE__*/React.createElement(BottomSheetContainer, { + key: "BottomSheetContainer", + shouldCalculateHeight: !$modal, + containerHeight: _animatedContainerHeight, + containerOffset: animatedContainerOffset, + topInset: topInset, + bottomInset: bottomInset, + detached: detached, + style: _providedContainerStyle + }, /*#__PURE__*/React.createElement(Animated.View, { + style: containerStyle + }, /*#__PURE__*/React.createElement(BottomSheetBackgroundContainer, { + key: "BottomSheetBackgroundContainer", + animatedIndex: animatedIndex, + animatedPosition: animatedPosition, + backgroundComponent: backgroundComponent, + backgroundStyle: _providedBackgroundStyle + }), /*#__PURE__*/React.createElement(Animated.View, { + pointerEvents: "box-none", + style: contentMaskContainerStyle + }, /*#__PURE__*/React.createElement(BottomSheetDraggableView, { + key: "BottomSheetRootDraggableView", + style: contentContainerStyle + }, typeof Content === 'function' ? /*#__PURE__*/React.createElement(Content, null) : Content, footerComponent && /*#__PURE__*/React.createElement(BottomSheetFooterContainer, { + footerComponent: footerComponent + }))), /*#__PURE__*/React.createElement(BottomSheetHandleContainer, { + key: "BottomSheetHandleContainer", + animatedIndex: animatedIndex, + animatedPosition: animatedPosition, + handleHeight: animatedHandleHeight, + enableHandlePanningGesture: enableHandlePanningGesture, + enableOverDrag: enableOverDrag, + enablePanDownToClose: enablePanDownToClose, + overDragResistanceFactor: overDragResistanceFactor, + keyboardBehavior: keyboardBehavior, + handleComponent: handleComponent, + handleStyle: _providedHandleStyle, + handleIndicatorStyle: _providedHandleIndicatorStyle + })))))); +}); +const BottomSheet = /*#__PURE__*/memo(BottomSheetComponent); +BottomSheet.displayName = 'BottomSheet'; +export default BottomSheet; +//# sourceMappingURL=BottomSheet.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheet/BottomSheet.js.map b/lib/module/components/bottomSheet/BottomSheet.js.map new file mode 100644 index 000000000..7cd46b65f --- /dev/null +++ b/lib/module/components/bottomSheet/BottomSheet.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheet.tsx"],"names":["React","useMemo","useCallback","forwardRef","useImperativeHandle","memo","useEffect","Platform","invariant","Animated","useAnimatedReaction","useSharedValue","useAnimatedStyle","useDerivedValue","runOnJS","interpolate","Extrapolate","runOnUI","cancelAnimation","useWorkletCallback","State","useScrollable","usePropsValidator","useReactiveSharedValue","useNormalizedSnapPoints","useKeyboard","BottomSheetInternalProvider","BottomSheetProvider","BottomSheetContainer","BottomSheetGestureHandlersProvider","BottomSheetBackdropContainer","BottomSheetHandleContainer","BottomSheetBackgroundContainer","BottomSheetFooterContainer","BottomSheetDraggableView","ANIMATION_STATE","KEYBOARD_STATE","KEYBOARD_BEHAVIOR","SHEET_STATE","SCROLLABLE_STATE","KEYBOARD_BLUR_BEHAVIOR","KEYBOARD_INPUT_MODE","ANIMATION_SOURCE","animate","getKeyboardAnimationConfigs","normalizeSnapPoint","print","DEFAULT_OVER_DRAG_RESISTANCE_FACTOR","DEFAULT_ENABLE_CONTENT_PANNING_GESTURE","DEFAULT_ENABLE_HANDLE_PANNING_GESTURE","DEFAULT_ENABLE_OVER_DRAG","DEFAULT_ANIMATE_ON_MOUNT","DEFAULT_KEYBOARD_BEHAVIOR","DEFAULT_KEYBOARD_BLUR_BEHAVIOR","DEFAULT_KEYBOARD_INPUT_MODE","INITIAL_CONTAINER_HEIGHT","INITIAL_HANDLE_HEIGHT","INITIAL_POSITION","INITIAL_SNAP_POINT","DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE","INITIAL_CONTAINER_OFFSET","INITIAL_VALUE","DEFAULT_DYNAMIC_SIZING","styles","addWhitelistedUIProps","decelerationRate","BottomSheetComponent","BottomSheet","props","ref","animationConfigs","_providedAnimationConfigs","index","_providedIndex","snapPoints","_providedSnapPoints","animateOnMount","enableContentPanningGesture","enableHandlePanningGesture","enableOverDrag","enablePanDownToClose","enableDynamicSizing","overDragResistanceFactor","style","_providedStyle","containerStyle","_providedContainerStyle","backgroundStyle","_providedBackgroundStyle","handleStyle","_providedHandleStyle","handleIndicatorStyle","_providedHandleIndicatorStyle","gestureEventsHandlersHook","keyboardBehavior","keyboardBlurBehavior","android_keyboardInputMode","handleHeight","_providedHandleHeight","containerHeight","_providedContainerHeight","contentHeight","_providedContentHeight","containerOffset","_providedContainerOffset","topInset","bottomInset","maxDynamicContentSize","animatedPosition","_providedAnimatedPosition","animatedIndex","_providedAnimatedIndex","simultaneousHandlers","_providedSimultaneousHandlers","waitFor","_providedWaitFor","activeOffsetX","_providedActiveOffsetX","activeOffsetY","_providedActiveOffsetY","failOffsetX","_providedFailOffsetX","failOffsetY","_providedFailOffsetY","onChange","_providedOnChange","onClose","_providedOnClose","onAnimate","_providedOnAnimate","$modal","detached","handleComponent","backdropComponent","backgroundComponent","footerComponent","children","Content","_animatedContainerHeight","animatedContainerHeight","verticalInset","value","animatedContainerOffset","animatedHandleHeight","animatedFooterHeight","animatedContentHeight","animatedSnapPoints","animatedHighestSnapPoint","length","animatedClosedPosition","closedPosition","animatedSheetHeight","animatedCurrentIndex","animatedNextPosition","animatedNextPositionIndex","isAnimatedOnMount","isContentHeightFixed","isLayoutCalculated","isContainerHeightCalculated","undefined","isHandleHeightCalculated","isSnapPointsNormalized","isInTemporaryPosition","isForcedClosing","animatedContentGestureState","UNDETERMINED","animatedHandleGestureState","animatedScrollableType","animatedScrollableContentOffsetY","animatedScrollableOverrideState","isScrollableRefreshable","setScrollableRef","removeScrollableRef","state","animatedKeyboardState","height","animatedKeyboardHeight","animationDuration","keyboardAnimationDuration","animationEasing","keyboardAnimationEasing","shouldHandleKeyboardEvents","animatedKeyboardHeightInContainer","animatedAnimationState","animatedAnimationSource","MOUNT","animatedSheetState","CLOSED","extendedPosition","EXTENDED","keyboardHeightInContainer","extendedPositionWithKeyboard","Math","max","interactive","FILL_PARENT","OVER_EXTENDED","OPENED","animatedScrollableState","UNLOCKED","SHOWN","RUNNING","LOCKED","animatedContentHeightMax","extend","fillParent","contentWithKeyboardHeight","adjustedSnapPoints","slice","reverse","adjustedSnapPointsIndexes","map","_","push","currentIndex","CLAMP","adjustResize","KEYBOARD","SNAP_POINT_CHANGE","getNextPosition","keyboardState","highestSnapPoint","restore","HIDDEN","ACTIVE","nextPosition","handleOnChange","component","name","method","params","handleOnAnimate","toPoint","toIndex","indexOf","fromIndex","stopAnimation","NONE","STOPPED","animateToPositionCompleted","isFinished","animateToPosition","position","source","velocity","configs","currentPosition","point","onComplete","handleSnapToIndex","USER","handleSnapToPosition","handleClose","handleForceClose","handleExpand","handleCollapse","snapToIndex","snapToPosition","expand","collapse","close","forceClose","internalContextVariables","externalContextVariables","containerAnimatedStyle","opacity","OS","transform","translateY","container","contentContainerAnimatedStyle","contentContainerStyle","contentContainer","contentMaskContainerAnimatedStyle","overflow","paddingBottom","contentMaskContainerStyle","contentMaskContainer","_isLayoutCalculated","result","_previousResult","_previousSnapPoints","_previousContainerHeight","animationConfig","animationSource","CONTAINER_RESIZE","duration","JSON","stringify","_keyboardState","_keyboardHeight","_previousKeyboardState","_previousKeyboardHeight","abs","bottom","hasActiveGesture","BEGAN","none","keyboardHeight","_animatedPosition","_animatedIndex","_animationState","_contentGestureState","_handleGestureState","hasNoActiveGesture","END","CANCELLED","providedIndex","displayName"],"mappings":"AAAA,OAAOA,KAAP,IACEC,OADF,EAEEC,WAFF,EAGEC,UAHF,EAIEC,mBAJF,EAKEC,IALF,EAMEC,SANF,QAOO,OAPP;AAQA,SAASC,QAAT,QAAyB,cAAzB;AACA,OAAOC,SAAP,MAAsB,WAAtB;AACA,OAAOC,QAAP,IACEC,mBADF,EAEEC,cAFF,EAGEC,gBAHF,EAIEC,eAJF,EAKEC,OALF,EAMEC,WANF,EAOEC,WAPF,EAQEC,OARF,EASEC,eATF,EAUEC,kBAVF,QAaO,yBAbP;AAcA,SAASC,KAAT,QAAsB,8BAAtB;AACA,SACEC,aADF,EAEEC,iBAFF,EAGEC,sBAHF,EAIEC,uBAJF,EAKEC,WALF,QAMO,aANP;AAOA,SACEC,2BADF,EAEEC,mBAFF,QAGO,gBAHP;AAIA,OAAOC,oBAAP,MAAiC,yBAAjC;AACA,OAAOC,kCAAP,MAA+C,uCAA/C;AACA,OAAOC,4BAAP,MAAyC,iCAAzC;AACA,OAAOC,0BAAP,MAAuC,+BAAvC;AACA,OAAOC,8BAAP,MAA2C,mCAA3C;AACA,OAAOC,0BAAP,MAAuC,0DAAvC;AACA,OAAOC,wBAAP,MAAqC,6BAArC,C,CACA;;AACA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D,CAtkDoC,CAAvC;AAykDA,MAAMzB,WAAW,gBAAG9D,IAAI,CAAC6D,oBAAD,CAAxB;AACAC,WAAW,CAACiP,WAAZ,GAA0B,aAA1B;AAEA,eAAejP,WAAf","sourcesContent":["import React, {\n useMemo,\n useCallback,\n forwardRef,\n useImperativeHandle,\n memo,\n useEffect,\n} from 'react';\nimport { Platform } from 'react-native';\nimport invariant from 'invariant';\nimport Animated, {\n useAnimatedReaction,\n useSharedValue,\n useAnimatedStyle,\n useDerivedValue,\n runOnJS,\n interpolate,\n Extrapolate,\n runOnUI,\n cancelAnimation,\n useWorkletCallback,\n WithSpringConfig,\n WithTimingConfig,\n} from 'react-native-reanimated';\nimport { State } from 'react-native-gesture-handler';\nimport {\n useScrollable,\n usePropsValidator,\n useReactiveSharedValue,\n useNormalizedSnapPoints,\n useKeyboard,\n} from '../../hooks';\nimport {\n BottomSheetInternalProvider,\n BottomSheetProvider,\n} from '../../contexts';\nimport BottomSheetContainer from '../bottomSheetContainer';\nimport BottomSheetGestureHandlersProvider from '../bottomSheetGestureHandlersProvider';\nimport BottomSheetBackdropContainer from '../bottomSheetBackdropContainer';\nimport BottomSheetHandleContainer from '../bottomSheetHandleContainer';\nimport BottomSheetBackgroundContainer from '../bottomSheetBackgroundContainer';\nimport BottomSheetFooterContainer from '../bottomSheetFooterContainer/BottomSheetFooterContainer';\nimport BottomSheetDraggableView from '../bottomSheetDraggableView';\n// import BottomSheetDebugView from '../bottomSheetDebugView';\nimport {\n ANIMATION_STATE,\n KEYBOARD_STATE,\n KEYBOARD_BEHAVIOR,\n SHEET_STATE,\n SCROLLABLE_STATE,\n KEYBOARD_BLUR_BEHAVIOR,\n KEYBOARD_INPUT_MODE,\n ANIMATION_SOURCE,\n} from '../../constants';\nimport {\n animate,\n getKeyboardAnimationConfigs,\n normalizeSnapPoint,\n print,\n} from '../../utilities';\nimport {\n DEFAULT_OVER_DRAG_RESISTANCE_FACTOR,\n DEFAULT_ENABLE_CONTENT_PANNING_GESTURE,\n DEFAULT_ENABLE_HANDLE_PANNING_GESTURE,\n DEFAULT_ENABLE_OVER_DRAG,\n DEFAULT_ANIMATE_ON_MOUNT,\n DEFAULT_KEYBOARD_BEHAVIOR,\n DEFAULT_KEYBOARD_BLUR_BEHAVIOR,\n DEFAULT_KEYBOARD_INPUT_MODE,\n INITIAL_CONTAINER_HEIGHT,\n INITIAL_HANDLE_HEIGHT,\n INITIAL_POSITION,\n INITIAL_SNAP_POINT,\n DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE,\n INITIAL_CONTAINER_OFFSET,\n INITIAL_VALUE,\n DEFAULT_DYNAMIC_SIZING,\n} from './constants';\nimport type { BottomSheetMethods, Insets } from '../../types';\nimport type { BottomSheetProps, AnimateToPositionType } from './types';\nimport { styles } from './styles';\n\nAnimated.addWhitelistedUIProps({\n decelerationRate: true,\n});\n\ntype BottomSheet = BottomSheetMethods;\n\nconst BottomSheetComponent = forwardRef(\n function BottomSheet(props, ref) {\n //#region validate props\n usePropsValidator(props);\n //#endregion\n\n //#region extract props\n const {\n // animations configurations\n animationConfigs: _providedAnimationConfigs,\n\n // configurations\n index: _providedIndex = 0,\n snapPoints: _providedSnapPoints,\n animateOnMount = DEFAULT_ANIMATE_ON_MOUNT,\n enableContentPanningGesture = DEFAULT_ENABLE_CONTENT_PANNING_GESTURE,\n enableHandlePanningGesture = DEFAULT_ENABLE_HANDLE_PANNING_GESTURE,\n enableOverDrag = DEFAULT_ENABLE_OVER_DRAG,\n enablePanDownToClose = DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE,\n enableDynamicSizing = DEFAULT_DYNAMIC_SIZING,\n overDragResistanceFactor = DEFAULT_OVER_DRAG_RESISTANCE_FACTOR,\n\n // styles\n style: _providedStyle,\n containerStyle: _providedContainerStyle,\n backgroundStyle: _providedBackgroundStyle,\n handleStyle: _providedHandleStyle,\n handleIndicatorStyle: _providedHandleIndicatorStyle,\n\n // hooks\n gestureEventsHandlersHook,\n\n // keyboard\n keyboardBehavior = DEFAULT_KEYBOARD_BEHAVIOR,\n keyboardBlurBehavior = DEFAULT_KEYBOARD_BLUR_BEHAVIOR,\n android_keyboardInputMode = DEFAULT_KEYBOARD_INPUT_MODE,\n\n // layout\n handleHeight: _providedHandleHeight,\n containerHeight: _providedContainerHeight,\n contentHeight: _providedContentHeight,\n containerOffset: _providedContainerOffset,\n topInset = 0,\n bottomInset = 0,\n maxDynamicContentSize,\n\n // animated callback shared values\n animatedPosition: _providedAnimatedPosition,\n animatedIndex: _providedAnimatedIndex,\n\n // gestures\n simultaneousHandlers: _providedSimultaneousHandlers,\n waitFor: _providedWaitFor,\n activeOffsetX: _providedActiveOffsetX,\n activeOffsetY: _providedActiveOffsetY,\n failOffsetX: _providedFailOffsetX,\n failOffsetY: _providedFailOffsetY,\n\n // callbacks\n onChange: _providedOnChange,\n onClose: _providedOnClose,\n onAnimate: _providedOnAnimate,\n\n // private\n $modal = false,\n detached = false,\n\n // components\n handleComponent,\n backdropComponent,\n backgroundComponent,\n footerComponent,\n children: Content,\n } = props;\n //#endregion\n\n //#region layout variables\n /**\n * This variable is consider an internal variable,\n * that will be used conditionally in `animatedContainerHeight`\n */\n const _animatedContainerHeight = useReactiveSharedValue(\n _providedContainerHeight ?? INITIAL_CONTAINER_HEIGHT\n );\n /**\n * This is a conditional variable, where if the `BottomSheet` is used\n * in a modal, then it will subset vertical insets (top+bottom) from\n * provided container height.\n */\n const animatedContainerHeight = useDerivedValue(() => {\n const verticalInset = topInset + bottomInset;\n return $modal\n ? _animatedContainerHeight.value - verticalInset\n : _animatedContainerHeight.value;\n }, [$modal, topInset, bottomInset]);\n const animatedContainerOffset = useReactiveSharedValue(\n _providedContainerOffset ?? INITIAL_CONTAINER_OFFSET\n ) as Animated.SharedValue;\n const animatedHandleHeight = useReactiveSharedValue(\n _providedHandleHeight ?? INITIAL_HANDLE_HEIGHT\n );\n const animatedFooterHeight = useSharedValue(0);\n const animatedContentHeight = useSharedValue(INITIAL_CONTAINER_HEIGHT);\n const animatedSnapPoints = useNormalizedSnapPoints(\n _providedSnapPoints,\n animatedContainerHeight,\n animatedContentHeight,\n animatedHandleHeight,\n enableDynamicSizing,\n maxDynamicContentSize\n );\n const animatedHighestSnapPoint = useDerivedValue(\n () => animatedSnapPoints.value[animatedSnapPoints.value.length - 1]\n );\n const animatedClosedPosition = useDerivedValue(() => {\n let closedPosition = animatedContainerHeight.value;\n\n if ($modal || detached) {\n closedPosition = animatedContainerHeight.value + bottomInset;\n }\n\n return closedPosition;\n }, [$modal, detached, bottomInset]);\n const animatedSheetHeight = useDerivedValue(\n () => animatedContainerHeight.value - animatedHighestSnapPoint.value\n );\n const animatedCurrentIndex = useReactiveSharedValue(\n animateOnMount ? -1 : _providedIndex\n );\n const animatedPosition = useSharedValue(INITIAL_POSITION);\n const animatedNextPosition = useSharedValue(INITIAL_VALUE);\n const animatedNextPositionIndex = useSharedValue(0);\n\n // conditional\n const isAnimatedOnMount = useSharedValue(false);\n const isContentHeightFixed = useSharedValue(false);\n const isLayoutCalculated = useDerivedValue(() => {\n let isContainerHeightCalculated = false;\n //container height was provided.\n if (\n _providedContainerHeight !== null ||\n _providedContainerHeight !== undefined\n ) {\n isContainerHeightCalculated = true;\n }\n // container height did set.\n if (animatedContainerHeight.value !== INITIAL_CONTAINER_HEIGHT) {\n isContainerHeightCalculated = true;\n }\n\n let isHandleHeightCalculated = false;\n // handle height is provided.\n if (\n _providedHandleHeight !== null &&\n _providedHandleHeight !== undefined &&\n typeof _providedHandleHeight === 'number'\n ) {\n isHandleHeightCalculated = true;\n }\n // handle component is null.\n if (handleComponent === null) {\n animatedHandleHeight.value = 0;\n isHandleHeightCalculated = true;\n }\n // handle height did set.\n if (animatedHandleHeight.value !== INITIAL_HANDLE_HEIGHT) {\n isHandleHeightCalculated = true;\n }\n\n let isSnapPointsNormalized = false;\n // the first snap point did normalized\n if (animatedSnapPoints.value[0] !== INITIAL_SNAP_POINT) {\n isSnapPointsNormalized = true;\n }\n\n return (\n isContainerHeightCalculated &&\n isHandleHeightCalculated &&\n isSnapPointsNormalized\n );\n });\n const isInTemporaryPosition = useSharedValue(false);\n const isForcedClosing = useSharedValue(false);\n\n // gesture\n const animatedContentGestureState = useSharedValue(\n State.UNDETERMINED\n );\n const animatedHandleGestureState = useSharedValue(\n State.UNDETERMINED\n );\n //#endregion\n\n //#region hooks variables\n // scrollable variables\n const {\n animatedScrollableType,\n animatedScrollableContentOffsetY,\n animatedScrollableOverrideState,\n isScrollableRefreshable,\n setScrollableRef,\n removeScrollableRef,\n } = useScrollable();\n // keyboard\n const {\n state: animatedKeyboardState,\n height: animatedKeyboardHeight,\n animationDuration: keyboardAnimationDuration,\n animationEasing: keyboardAnimationEasing,\n shouldHandleKeyboardEvents,\n } = useKeyboard();\n const animatedKeyboardHeightInContainer = useSharedValue(0);\n //#endregion\n\n //#region state/dynamic variables\n // states\n const animatedAnimationState = useSharedValue(ANIMATION_STATE.UNDETERMINED);\n const animatedAnimationSource = useSharedValue(\n ANIMATION_SOURCE.MOUNT\n );\n const animatedSheetState = useDerivedValue(() => {\n // closed position = position >= container height\n if (animatedPosition.value >= animatedClosedPosition.value)\n return SHEET_STATE.CLOSED;\n\n // extended position = container height - sheet height\n const extendedPosition =\n animatedContainerHeight.value - animatedSheetHeight.value;\n if (animatedPosition.value === extendedPosition)\n return SHEET_STATE.EXTENDED;\n\n // extended position with keyboard =\n // container height - (sheet height + keyboard height in root container)\n const keyboardHeightInContainer = animatedKeyboardHeightInContainer.value;\n const extendedPositionWithKeyboard = Math.max(\n 0,\n animatedContainerHeight.value -\n (animatedSheetHeight.value + keyboardHeightInContainer)\n );\n\n // detect if keyboard is open and the sheet is in temporary position\n if (\n keyboardBehavior === KEYBOARD_BEHAVIOR.interactive &&\n isInTemporaryPosition.value &&\n animatedPosition.value === extendedPositionWithKeyboard\n ) {\n return SHEET_STATE.EXTENDED;\n }\n\n // fill parent = 0\n if (animatedPosition.value === 0) {\n return SHEET_STATE.FILL_PARENT;\n }\n\n // detect if position is below extended point\n if (animatedPosition.value < extendedPosition) {\n return SHEET_STATE.OVER_EXTENDED;\n }\n\n return SHEET_STATE.OPENED;\n }, [\n animatedClosedPosition,\n animatedContainerHeight,\n animatedKeyboardHeightInContainer,\n animatedPosition,\n animatedSheetHeight,\n isInTemporaryPosition,\n keyboardBehavior,\n ]);\n const animatedScrollableState = useDerivedValue(() => {\n /**\n * if scrollable override state is set, then we just return its value.\n */\n if (\n animatedScrollableOverrideState.value !== SCROLLABLE_STATE.UNDETERMINED\n ) {\n return animatedScrollableOverrideState.value;\n }\n /**\n * if sheet state is fill parent, then unlock scrolling\n */\n if (animatedSheetState.value === SHEET_STATE.FILL_PARENT) {\n return SCROLLABLE_STATE.UNLOCKED;\n }\n\n /**\n * if sheet state is extended, then unlock scrolling\n */\n if (animatedSheetState.value === SHEET_STATE.EXTENDED) {\n return SCROLLABLE_STATE.UNLOCKED;\n }\n\n /**\n * if keyboard is shown and sheet is animating\n * then we do not lock the scrolling to not lose\n * current scrollable scroll position.\n */\n if (\n animatedKeyboardState.value === KEYBOARD_STATE.SHOWN &&\n animatedAnimationState.value === ANIMATION_STATE.RUNNING\n ) {\n return SCROLLABLE_STATE.UNLOCKED;\n }\n\n return SCROLLABLE_STATE.LOCKED;\n });\n // dynamic\n const animatedContentHeightMax = useDerivedValue(() => {\n const keyboardHeightInContainer = animatedKeyboardHeightInContainer.value;\n const handleHeight = Math.max(0, animatedHandleHeight.value);\n let contentHeight = animatedSheetHeight.value - handleHeight;\n\n if (\n keyboardBehavior === KEYBOARD_BEHAVIOR.extend &&\n animatedKeyboardState.value === KEYBOARD_STATE.SHOWN\n ) {\n contentHeight = contentHeight - keyboardHeightInContainer;\n } else if (\n keyboardBehavior === KEYBOARD_BEHAVIOR.fillParent &&\n isInTemporaryPosition.value\n ) {\n if (animatedKeyboardState.value === KEYBOARD_STATE.SHOWN) {\n contentHeight =\n animatedContainerHeight.value -\n handleHeight -\n keyboardHeightInContainer;\n } else {\n contentHeight = animatedContainerHeight.value - handleHeight;\n }\n } else if (\n keyboardBehavior === KEYBOARD_BEHAVIOR.interactive &&\n isInTemporaryPosition.value\n ) {\n const contentWithKeyboardHeight =\n contentHeight + keyboardHeightInContainer;\n\n if (animatedKeyboardState.value === KEYBOARD_STATE.SHOWN) {\n if (\n keyboardHeightInContainer + animatedSheetHeight.value >\n animatedContainerHeight.value\n ) {\n contentHeight =\n animatedContainerHeight.value -\n keyboardHeightInContainer -\n handleHeight;\n }\n } else if (\n contentWithKeyboardHeight + handleHeight >\n animatedContainerHeight.value\n ) {\n contentHeight = animatedContainerHeight.value - handleHeight;\n } else {\n contentHeight = contentWithKeyboardHeight;\n }\n }\n\n /**\n * before the container is measured, `contentHeight` value will be below zero,\n * which will lead to freeze the scrollable.\n *\n * @link (https://github.com/gorhom/react-native-bottom-sheet/issues/470)\n */\n return Math.max(contentHeight, 0);\n }, [\n animatedContainerHeight,\n animatedHandleHeight,\n animatedKeyboardHeightInContainer,\n animatedKeyboardState,\n animatedSheetHeight,\n isInTemporaryPosition,\n keyboardBehavior,\n ]);\n const animatedIndex = useDerivedValue(() => {\n const adjustedSnapPoints = animatedSnapPoints.value.slice().reverse();\n const adjustedSnapPointsIndexes = animatedSnapPoints.value\n .slice()\n .map((_: any, index: number) => index)\n .reverse();\n\n /**\n * we add the close state index `-1`\n */\n adjustedSnapPoints.push(animatedContainerHeight.value);\n adjustedSnapPointsIndexes.push(-1);\n\n const currentIndex = isLayoutCalculated.value\n ? interpolate(\n animatedPosition.value,\n adjustedSnapPoints,\n adjustedSnapPointsIndexes,\n Extrapolate.CLAMP\n )\n : -1;\n\n /**\n * if the sheet is currently running an animation by the keyboard opening,\n * then we clamp the index on android with resize keyboard mode.\n */\n if (\n android_keyboardInputMode === KEYBOARD_INPUT_MODE.adjustResize &&\n animatedAnimationSource.value === ANIMATION_SOURCE.KEYBOARD &&\n animatedAnimationState.value === ANIMATION_STATE.RUNNING &&\n isInTemporaryPosition.value\n ) {\n return Math.max(animatedCurrentIndex.value, currentIndex);\n }\n\n /**\n * if the sheet is currently running an animation by snap point change - usually caused\n * by dynamic content height -, then we return the next position index.\n */\n if (\n animatedAnimationSource.value === ANIMATION_SOURCE.SNAP_POINT_CHANGE &&\n animatedAnimationState.value === ANIMATION_STATE.RUNNING\n ) {\n return animatedNextPositionIndex.value;\n }\n\n return currentIndex;\n }, [android_keyboardInputMode]);\n //#endregion\n\n //#region private methods\n /**\n * Calculate the next position based on keyboard state.\n */\n const getNextPosition = useWorkletCallback(\n function getNextPosition() {\n 'worklet';\n const currentIndex = animatedCurrentIndex.value;\n const snapPoints = animatedSnapPoints.value;\n const keyboardState = animatedKeyboardState.value;\n const highestSnapPoint = animatedHighestSnapPoint.value;\n\n /**\n * Handle restore sheet position on blur\n */\n if (\n keyboardBlurBehavior === KEYBOARD_BLUR_BEHAVIOR.restore &&\n keyboardState === KEYBOARD_STATE.HIDDEN &&\n animatedContentGestureState.value !== State.ACTIVE &&\n animatedHandleGestureState.value !== State.ACTIVE\n ) {\n isInTemporaryPosition.value = false;\n const nextPosition = snapPoints[currentIndex];\n return nextPosition;\n }\n\n /**\n * Handle extend behavior\n */\n if (\n keyboardBehavior === KEYBOARD_BEHAVIOR.extend &&\n keyboardState === KEYBOARD_STATE.SHOWN\n ) {\n return highestSnapPoint;\n }\n\n /**\n * Handle full screen behavior\n */\n if (\n keyboardBehavior === KEYBOARD_BEHAVIOR.fillParent &&\n keyboardState === KEYBOARD_STATE.SHOWN\n ) {\n isInTemporaryPosition.value = true;\n return 0;\n }\n\n /**\n * handle interactive behavior\n */\n if (\n keyboardBehavior === KEYBOARD_BEHAVIOR.interactive &&\n keyboardState === KEYBOARD_STATE.SHOWN\n ) {\n isInTemporaryPosition.value = true;\n const keyboardHeightInContainer =\n animatedKeyboardHeightInContainer.value;\n return Math.max(0, highestSnapPoint - keyboardHeightInContainer);\n }\n\n if (isInTemporaryPosition.value) {\n return animatedPosition.value;\n }\n\n return snapPoints[currentIndex];\n },\n [\n animatedContentGestureState,\n animatedCurrentIndex,\n animatedHandleGestureState,\n animatedHighestSnapPoint,\n animatedKeyboardHeightInContainer,\n animatedKeyboardState,\n animatedPosition,\n animatedSnapPoints,\n isInTemporaryPosition,\n keyboardBehavior,\n keyboardBlurBehavior,\n ]\n );\n const handleOnChange = useCallback(\n function handleOnChange(index: number) {\n print({\n component: BottomSheet.name,\n method: handleOnChange.name,\n params: {\n index,\n animatedCurrentIndex: animatedCurrentIndex.value,\n },\n });\n\n if (_providedOnChange) {\n _providedOnChange(index);\n }\n },\n [_providedOnChange, animatedCurrentIndex]\n );\n const handleOnAnimate = useCallback(\n function handleOnAnimate(toPoint: number) {\n const snapPoints = animatedSnapPoints.value;\n const toIndex = snapPoints.indexOf(toPoint);\n\n print({\n component: BottomSheet.name,\n method: handleOnAnimate.name,\n params: {\n toIndex,\n fromIndex: animatedCurrentIndex.value,\n },\n });\n\n if (!_providedOnAnimate) {\n return;\n }\n\n if (toIndex !== animatedCurrentIndex.value) {\n _providedOnAnimate(animatedCurrentIndex.value, toIndex);\n }\n },\n [_providedOnAnimate, animatedSnapPoints, animatedCurrentIndex]\n );\n //#endregion\n\n //#region animation\n const stopAnimation = useWorkletCallback(() => {\n cancelAnimation(animatedPosition);\n isForcedClosing.value = false;\n animatedAnimationSource.value = ANIMATION_SOURCE.NONE;\n animatedAnimationState.value = ANIMATION_STATE.STOPPED;\n }, [animatedPosition, animatedAnimationState, animatedAnimationSource]);\n const animateToPositionCompleted = useWorkletCallback(\n function animateToPositionCompleted(isFinished?: boolean) {\n isForcedClosing.value = false;\n\n if (!isFinished) {\n return;\n }\n runOnJS(print)({\n component: BottomSheet.name,\n method: animateToPositionCompleted.name,\n params: {\n animatedCurrentIndex: animatedCurrentIndex.value,\n animatedNextPosition: animatedNextPosition.value,\n animatedNextPositionIndex: animatedNextPositionIndex.value,\n },\n });\n\n animatedAnimationSource.value = ANIMATION_SOURCE.NONE;\n animatedAnimationState.value = ANIMATION_STATE.STOPPED;\n animatedNextPosition.value = INITIAL_VALUE;\n animatedNextPositionIndex.value = INITIAL_VALUE;\n }\n );\n const animateToPosition: AnimateToPositionType = useWorkletCallback(\n function animateToPosition(\n position: number,\n source: ANIMATION_SOURCE,\n velocity: number = 0,\n configs?: WithTimingConfig | WithSpringConfig\n ) {\n if (\n position === animatedPosition.value ||\n position === undefined ||\n (animatedAnimationState.value === ANIMATION_STATE.RUNNING &&\n position === animatedNextPosition.value)\n ) {\n return;\n }\n\n runOnJS(print)({\n component: BottomSheet.name,\n method: animateToPosition.name,\n params: {\n currentPosition: animatedPosition.value,\n position,\n velocity,\n animatedContainerHeight: animatedContainerHeight.value,\n },\n });\n\n stopAnimation();\n\n /**\n * set animation state to running, and source\n */\n animatedAnimationState.value = ANIMATION_STATE.RUNNING;\n animatedAnimationSource.value = source;\n\n /**\n * store next position\n */\n animatedNextPosition.value = position;\n animatedNextPositionIndex.value =\n animatedSnapPoints.value.indexOf(position);\n\n /**\n * fire `onAnimate` callback\n */\n runOnJS(handleOnAnimate)(position);\n\n /**\n * force animation configs from parameters, if provided\n */\n if (configs !== undefined) {\n animatedPosition.value = animate({\n point: position,\n configs,\n velocity,\n onComplete: animateToPositionCompleted,\n });\n } else {\n /**\n * use animationConfigs callback, if provided\n */\n animatedPosition.value = animate({\n point: position,\n velocity,\n configs: _providedAnimationConfigs,\n onComplete: animateToPositionCompleted,\n });\n }\n },\n [handleOnAnimate, _providedAnimationConfigs]\n );\n //#endregion\n\n //#region public methods\n const handleSnapToIndex = useCallback(\n function handleSnapToIndex(\n index: number,\n animationConfigs?: WithSpringConfig | WithTimingConfig\n ) {\n const snapPoints = animatedSnapPoints.value;\n invariant(\n index >= -1 && index <= snapPoints.length - 1,\n `'index' was provided but out of the provided snap points range! expected value to be between -1, ${\n snapPoints.length - 1\n }`\n );\n print({\n component: BottomSheet.name,\n method: handleSnapToIndex.name,\n params: {\n index,\n },\n });\n\n const nextPosition = snapPoints[index];\n\n /**\n * exit method if :\n * - layout is not calculated.\n * - already animating to next position.\n * - sheet is forced closing.\n */\n if (\n !isLayoutCalculated.value ||\n index === animatedNextPositionIndex.value ||\n nextPosition === animatedNextPosition.value ||\n isForcedClosing.value\n ) {\n return;\n }\n\n /**\n * reset temporary position boolean.\n */\n isInTemporaryPosition.value = false;\n\n runOnUI(animateToPosition)(\n nextPosition,\n ANIMATION_SOURCE.USER,\n 0,\n animationConfigs\n );\n },\n [\n animateToPosition,\n isLayoutCalculated,\n isInTemporaryPosition,\n isForcedClosing,\n animatedSnapPoints,\n animatedNextPosition,\n animatedNextPositionIndex,\n ]\n );\n const handleSnapToPosition = useWorkletCallback(\n function handleSnapToPosition(\n position: number | string,\n animationConfigs?: WithSpringConfig | WithTimingConfig\n ) {\n print({\n component: BottomSheet.name,\n method: handleSnapToPosition.name,\n params: {\n position,\n },\n });\n\n /**\n * normalized provided position.\n */\n const nextPosition = normalizeSnapPoint(\n position,\n animatedContainerHeight.value\n );\n\n /**\n * exit method if :\n * - layout is not calculated.\n * - already animating to next position.\n * - sheet is forced closing.\n */\n if (\n !isLayoutCalculated ||\n nextPosition === animatedNextPosition.value ||\n isForcedClosing.value\n ) {\n return;\n }\n\n /**\n * mark the new position as temporary.\n */\n isInTemporaryPosition.value = true;\n\n runOnUI(animateToPosition)(\n nextPosition,\n ANIMATION_SOURCE.USER,\n 0,\n animationConfigs\n );\n },\n [\n animateToPosition,\n bottomInset,\n topInset,\n isLayoutCalculated,\n isForcedClosing,\n animatedContainerHeight,\n animatedPosition,\n ]\n );\n const handleClose = useCallback(\n function handleClose(\n animationConfigs?: WithSpringConfig | WithTimingConfig\n ) {\n print({\n component: BottomSheet.name,\n method: handleClose.name,\n });\n\n const nextPosition = animatedClosedPosition.value;\n\n /**\n * exit method if :\n * - layout is not calculated.\n * - already animating to next position.\n * - sheet is forced closing.\n */\n if (\n !isLayoutCalculated.value ||\n nextPosition === animatedNextPosition.value ||\n isForcedClosing.value\n ) {\n return;\n }\n\n /**\n * reset temporary position variable.\n */\n isInTemporaryPosition.value = false;\n\n runOnUI(animateToPosition)(\n nextPosition,\n ANIMATION_SOURCE.USER,\n 0,\n animationConfigs\n );\n },\n [\n animateToPosition,\n isForcedClosing,\n isLayoutCalculated,\n isInTemporaryPosition,\n animatedNextPosition,\n animatedClosedPosition,\n ]\n );\n const handleForceClose = useCallback(\n function handleForceClose(\n animationConfigs?: WithSpringConfig | WithTimingConfig\n ) {\n print({\n component: BottomSheet.name,\n method: handleForceClose.name,\n });\n\n const nextPosition = animatedClosedPosition.value;\n\n /**\n * exit method if :\n * - already animating to next position.\n * - sheet is forced closing.\n */\n if (\n nextPosition === animatedNextPosition.value ||\n isForcedClosing.value\n ) {\n return;\n }\n\n /**\n * reset temporary position variable.\n */\n isInTemporaryPosition.value = false;\n\n /**\n * set force closing variable.\n */\n isForcedClosing.value = true;\n\n runOnUI(animateToPosition)(\n nextPosition,\n ANIMATION_SOURCE.USER,\n 0,\n animationConfigs\n );\n },\n [\n animateToPosition,\n isForcedClosing,\n isInTemporaryPosition,\n animatedNextPosition,\n animatedClosedPosition,\n ]\n );\n const handleExpand = useCallback(\n function handleExpand(\n animationConfigs?: WithSpringConfig | WithTimingConfig\n ) {\n print({\n component: BottomSheet.name,\n method: handleExpand.name,\n });\n\n const snapPoints = animatedSnapPoints.value;\n const nextPosition = snapPoints[snapPoints.length - 1];\n\n /**\n * exit method if :\n * - layout is not calculated.\n * - already animating to next position.\n * - sheet is forced closing.\n */\n if (\n !isLayoutCalculated.value ||\n snapPoints.length - 1 === animatedNextPositionIndex.value ||\n nextPosition === animatedNextPosition.value ||\n isForcedClosing.value\n ) {\n return;\n }\n\n /**\n * reset temporary position boolean.\n */\n isInTemporaryPosition.value = false;\n\n runOnUI(animateToPosition)(\n nextPosition,\n ANIMATION_SOURCE.USER,\n 0,\n animationConfigs\n );\n },\n [\n animateToPosition,\n isInTemporaryPosition,\n isLayoutCalculated,\n isForcedClosing,\n animatedSnapPoints,\n animatedNextPosition,\n animatedNextPositionIndex,\n ]\n );\n const handleCollapse = useCallback(\n function handleCollapse(\n animationConfigs?: WithSpringConfig | WithTimingConfig\n ) {\n print({\n component: BottomSheet.name,\n method: handleCollapse.name,\n });\n\n const nextPosition = animatedSnapPoints.value[0];\n\n /**\n * exit method if :\n * - layout is not calculated.\n * - already animating to next position.\n * - sheet is forced closing.\n */\n if (\n !isLayoutCalculated ||\n animatedNextPositionIndex.value === 0 ||\n nextPosition === animatedNextPosition.value ||\n isForcedClosing.value\n ) {\n return;\n }\n\n /**\n * reset temporary position boolean.\n */\n isInTemporaryPosition.value = false;\n\n runOnUI(animateToPosition)(\n nextPosition,\n ANIMATION_SOURCE.USER,\n 0,\n animationConfigs\n );\n },\n [\n animateToPosition,\n isForcedClosing,\n isLayoutCalculated,\n isInTemporaryPosition,\n animatedSnapPoints,\n animatedNextPosition,\n animatedNextPositionIndex,\n ]\n );\n\n useImperativeHandle(ref, () => ({\n snapToIndex: handleSnapToIndex,\n snapToPosition: handleSnapToPosition,\n expand: handleExpand,\n collapse: handleCollapse,\n close: handleClose,\n forceClose: handleForceClose,\n }));\n //#endregion\n\n //#region contexts variables\n const internalContextVariables = useMemo(\n () => ({\n enableContentPanningGesture,\n enableDynamicSizing,\n overDragResistanceFactor,\n enableOverDrag,\n enablePanDownToClose,\n animatedAnimationState,\n animatedSheetState,\n animatedScrollableState,\n animatedScrollableOverrideState,\n animatedContentGestureState,\n animatedHandleGestureState,\n animatedKeyboardState,\n animatedScrollableType,\n animatedIndex,\n animatedPosition,\n animatedContentHeight,\n animatedClosedPosition,\n animatedHandleHeight,\n animatedFooterHeight,\n animatedKeyboardHeight,\n animatedKeyboardHeightInContainer,\n animatedContainerHeight,\n animatedSnapPoints,\n animatedHighestSnapPoint,\n animatedScrollableContentOffsetY,\n isInTemporaryPosition,\n isContentHeightFixed,\n isScrollableRefreshable,\n shouldHandleKeyboardEvents,\n simultaneousHandlers: _providedSimultaneousHandlers,\n waitFor: _providedWaitFor,\n activeOffsetX: _providedActiveOffsetX,\n activeOffsetY: _providedActiveOffsetY,\n failOffsetX: _providedFailOffsetX,\n failOffsetY: _providedFailOffsetY,\n animateToPosition,\n stopAnimation,\n setScrollableRef,\n removeScrollableRef,\n }),\n [\n animatedIndex,\n animatedPosition,\n animatedContentHeight,\n animatedScrollableType,\n animatedContentGestureState,\n animatedHandleGestureState,\n animatedClosedPosition,\n animatedFooterHeight,\n animatedContainerHeight,\n animatedHandleHeight,\n animatedAnimationState,\n animatedKeyboardState,\n animatedKeyboardHeight,\n animatedKeyboardHeightInContainer,\n animatedSheetState,\n animatedHighestSnapPoint,\n animatedScrollableState,\n animatedScrollableOverrideState,\n animatedSnapPoints,\n shouldHandleKeyboardEvents,\n animatedScrollableContentOffsetY,\n isScrollableRefreshable,\n isContentHeightFixed,\n isInTemporaryPosition,\n enableContentPanningGesture,\n overDragResistanceFactor,\n enableOverDrag,\n enablePanDownToClose,\n enableDynamicSizing,\n _providedSimultaneousHandlers,\n _providedWaitFor,\n _providedActiveOffsetX,\n _providedActiveOffsetY,\n _providedFailOffsetX,\n _providedFailOffsetY,\n setScrollableRef,\n removeScrollableRef,\n animateToPosition,\n stopAnimation,\n ]\n );\n const externalContextVariables = useMemo(\n () => ({\n animatedIndex,\n animatedPosition,\n snapToIndex: handleSnapToIndex,\n snapToPosition: handleSnapToPosition,\n expand: handleExpand,\n collapse: handleCollapse,\n close: handleClose,\n forceClose: handleForceClose,\n }),\n [\n animatedIndex,\n animatedPosition,\n handleSnapToIndex,\n handleSnapToPosition,\n handleExpand,\n handleCollapse,\n handleClose,\n handleForceClose,\n ]\n );\n //#endregion\n\n //#region styles\n const containerAnimatedStyle = useAnimatedStyle(\n () => ({\n opacity:\n Platform.OS === 'android' && animatedIndex.value === -1 ? 0 : 1,\n transform: [\n {\n translateY: animatedPosition.value,\n },\n ],\n }),\n [animatedPosition, animatedIndex]\n );\n const containerStyle = useMemo(\n () => [_providedStyle, styles.container, containerAnimatedStyle],\n [_providedStyle, containerAnimatedStyle]\n );\n const contentContainerAnimatedStyle = useAnimatedStyle(() => {\n /**\n * if content height was provided, then we skip setting\n * calculated height.\n */\n if (_providedContentHeight) {\n return {};\n }\n\n return {\n height: animate({\n point: animatedContentHeightMax.value,\n configs: _providedAnimationConfigs,\n }),\n };\n }, [animatedContentHeightMax, enableDynamicSizing, animatedContentHeight]);\n const contentContainerStyle = useMemo(\n () => [styles.contentContainer, contentContainerAnimatedStyle],\n [contentContainerAnimatedStyle]\n );\n /**\n * added safe area to prevent the sheet from floating above\n * the bottom of the screen, when sheet being over dragged or\n * when the sheet is resized.\n */\n const contentMaskContainerAnimatedStyle = useAnimatedStyle(() => {\n if (detached) {\n return {\n overflow: 'visible',\n };\n }\n return {\n paddingBottom: animatedContainerHeight.value,\n };\n }, [detached]);\n const contentMaskContainerStyle = useMemo(\n () => [styles.contentMaskContainer, contentMaskContainerAnimatedStyle],\n [contentMaskContainerAnimatedStyle]\n );\n //#endregion\n\n //#region effects\n /**\n * React to `isLayoutCalculated` change, to insure that the sheet will\n * appears/mounts only when all layout is been calculated.\n *\n * @alias OnMount\n */\n useAnimatedReaction(\n () => isLayoutCalculated.value,\n _isLayoutCalculated => {\n /**\n * exit method if:\n * - layout is not calculated yet.\n * - already did animate on mount.\n */\n if (!_isLayoutCalculated || isAnimatedOnMount.value) {\n return;\n }\n\n let nextPosition;\n if (_providedIndex === -1) {\n nextPosition = animatedClosedPosition.value;\n animatedNextPositionIndex.value = -1;\n } else {\n nextPosition = animatedSnapPoints.value[_providedIndex];\n }\n\n runOnJS(print)({\n component: BottomSheet.name,\n method: 'useAnimatedReaction::OnMount',\n params: {\n isLayoutCalculated: _isLayoutCalculated,\n animatedSnapPoints: animatedSnapPoints.value,\n nextPosition,\n },\n });\n\n /**\n * here we exit method early because the next position\n * is out of the screen, this happens when `snapPoints`\n * still being calculated.\n */\n if (\n nextPosition === INITIAL_POSITION ||\n nextPosition === animatedClosedPosition.value\n ) {\n isAnimatedOnMount.value = true;\n animatedCurrentIndex.value = _providedIndex;\n return;\n }\n\n if (animateOnMount) {\n animateToPosition(nextPosition, ANIMATION_SOURCE.MOUNT);\n } else {\n animatedPosition.value = nextPosition;\n }\n isAnimatedOnMount.value = true;\n },\n [_providedIndex, animateOnMount]\n );\n\n /**\n * React to `snapPoints` change, to insure that the sheet position reflect\n * to the current point correctly.\n *\n * @alias OnSnapPointsChange\n */\n useAnimatedReaction(\n () => ({\n snapPoints: animatedSnapPoints.value,\n containerHeight: animatedContainerHeight.value,\n }),\n (result, _previousResult) => {\n const { snapPoints, containerHeight } = result;\n const _previousSnapPoints = _previousResult?.snapPoints;\n const _previousContainerHeight = _previousResult?.containerHeight;\n\n let nextPosition;\n let animationConfig;\n let animationSource = ANIMATION_SOURCE.SNAP_POINT_CHANGE;\n\n /**\n * if the bottom sheet is closing and the container gets resized,\n * then we restart the closing animation to the new position.\n */\n if (\n animatedAnimationState.value === ANIMATION_STATE.RUNNING &&\n animatedNextPositionIndex.value === -1 &&\n _previousContainerHeight !== containerHeight\n ) {\n animationSource = ANIMATION_SOURCE.CONTAINER_RESIZE;\n animationConfig = {\n duration: 0,\n };\n animateToPosition(\n containerHeight,\n animationSource,\n 0,\n animationConfig\n );\n }\n\n if (\n JSON.stringify(snapPoints) === JSON.stringify(_previousSnapPoints) ||\n !isLayoutCalculated.value ||\n !isAnimatedOnMount.value ||\n containerHeight <= 0\n ) {\n return;\n }\n\n runOnJS(print)({\n component: BottomSheet.name,\n method: 'useAnimatedReaction::OnSnapPointChange',\n params: {\n snapPoints,\n },\n });\n\n /**\n * if snap points changed while sheet is animating, then\n * we stop the animation and animate to the updated point.\n */\n if (\n animatedAnimationState.value === ANIMATION_STATE.RUNNING &&\n animatedNextPositionIndex.value !== animatedCurrentIndex.value\n ) {\n nextPosition =\n animatedNextPositionIndex.value !== -1\n ? snapPoints[animatedNextPositionIndex.value]\n : animatedNextPosition.value;\n } else if (animatedCurrentIndex.value === -1) {\n nextPosition = animatedClosedPosition.value;\n } else if (isInTemporaryPosition.value) {\n nextPosition = getNextPosition();\n } else {\n nextPosition = snapPoints[animatedCurrentIndex.value];\n\n /**\n * if snap points changes because of the container height change,\n * then we skip the snap animation by setting the duration to 0.\n */\n if (containerHeight !== _previousContainerHeight) {\n animationSource = ANIMATION_SOURCE.CONTAINER_RESIZE;\n animationConfig = {\n duration: 0,\n };\n }\n }\n animateToPosition(nextPosition, animationSource, 0, animationConfig);\n }\n );\n\n /**\n * React to keyboard appearance state.\n *\n * @alias OnKeyboardStateChange\n */\n useAnimatedReaction(\n () => ({\n _keyboardState: animatedKeyboardState.value,\n _keyboardHeight: animatedKeyboardHeight.value,\n }),\n (result, _previousResult) => {\n const { _keyboardState, _keyboardHeight } = result;\n const _previousKeyboardState = _previousResult?._keyboardState;\n const _previousKeyboardHeight = _previousResult?._keyboardHeight;\n\n /**\n * Calculate the keyboard height in the container.\n */\n animatedKeyboardHeightInContainer.value = $modal\n ? Math.abs(\n _keyboardHeight -\n Math.abs(bottomInset - animatedContainerOffset.value.bottom)\n )\n : Math.abs(_keyboardHeight - animatedContainerOffset.value.bottom);\n\n const hasActiveGesture =\n animatedContentGestureState.value === State.ACTIVE ||\n animatedContentGestureState.value === State.BEGAN ||\n animatedHandleGestureState.value === State.ACTIVE ||\n animatedHandleGestureState.value === State.BEGAN;\n\n if (\n /**\n * if keyboard state is equal to the previous state, then exit the method\n */\n (_keyboardState === _previousKeyboardState &&\n _keyboardHeight === _previousKeyboardHeight) ||\n /**\n * if user is interacting with sheet, then exit the method\n */\n hasActiveGesture ||\n /**\n * if sheet not animated on mount yet, then exit the method\n */\n !isAnimatedOnMount.value ||\n /**\n * if new keyboard state is hidden and blur behavior is none, then exit the method\n */\n (_keyboardState === KEYBOARD_STATE.HIDDEN &&\n keyboardBlurBehavior === KEYBOARD_BLUR_BEHAVIOR.none) ||\n /**\n * if platform is android and the input mode is resize, then exit the method\n */\n (Platform.OS === 'android' &&\n keyboardBehavior === KEYBOARD_BEHAVIOR.interactive &&\n android_keyboardInputMode === KEYBOARD_INPUT_MODE.adjustResize)\n ) {\n animatedKeyboardHeightInContainer.value = 0;\n return;\n }\n\n runOnJS(print)({\n component: BottomSheet.name,\n method: 'useAnimatedReaction::OnKeyboardStateChange',\n params: {\n keyboardState: _keyboardState,\n keyboardHeight: _keyboardHeight,\n },\n });\n\n let animationConfigs = getKeyboardAnimationConfigs(\n keyboardAnimationEasing.value,\n keyboardAnimationDuration.value\n );\n const nextPosition = getNextPosition();\n animateToPosition(\n nextPosition,\n ANIMATION_SOURCE.KEYBOARD,\n 0,\n animationConfigs\n );\n },\n [\n $modal,\n bottomInset,\n keyboardBehavior,\n keyboardBlurBehavior,\n android_keyboardInputMode,\n animatedContainerOffset,\n getNextPosition,\n ]\n );\n\n /**\n * sets provided animated position\n */\n useAnimatedReaction(\n () => animatedPosition.value,\n _animatedPosition => {\n if (_providedAnimatedPosition) {\n _providedAnimatedPosition.value = _animatedPosition + topInset;\n }\n }\n );\n\n /**\n * sets provided animated index\n */\n useAnimatedReaction(\n () => animatedIndex.value,\n _animatedIndex => {\n if (_providedAnimatedIndex) {\n _providedAnimatedIndex.value = _animatedIndex;\n }\n }\n );\n\n /**\n * React to internal variables to detect change in snap position.\n *\n * @alias OnChange\n */\n useAnimatedReaction(\n () => ({\n _animatedIndex: animatedIndex.value,\n _animatedPosition: animatedPosition.value,\n _animationState: animatedAnimationState.value,\n _contentGestureState: animatedContentGestureState.value,\n _handleGestureState: animatedHandleGestureState.value,\n }),\n ({\n _animatedIndex,\n _animationState,\n _contentGestureState,\n _handleGestureState,\n }) => {\n /**\n * exit the method if animation state is not stopped.\n */\n if (_animationState !== ANIMATION_STATE.STOPPED) {\n return;\n }\n\n /**\n * exit the method if animated index value\n * has fraction, e.g. 1.99, 0.52\n */\n if (_animatedIndex % 1 !== 0) {\n return;\n }\n\n /**\n * exit the method if there any active gesture.\n */\n const hasNoActiveGesture =\n (_contentGestureState === State.END ||\n _contentGestureState === State.UNDETERMINED ||\n _contentGestureState === State.CANCELLED) &&\n (_handleGestureState === State.END ||\n _handleGestureState === State.UNDETERMINED ||\n _handleGestureState === State.CANCELLED);\n if (!hasNoActiveGesture) {\n return;\n }\n\n /**\n * if the index is not equal to the current index,\n * than the sheet position had changed and we trigger\n * the `onChange` callback.\n */\n if (_animatedIndex !== animatedCurrentIndex.value) {\n runOnJS(print)({\n component: BottomSheet.name,\n method: 'useAnimatedReaction::OnChange',\n params: {\n animatedCurrentIndex: animatedCurrentIndex.value,\n animatedIndex: _animatedIndex,\n },\n });\n\n animatedCurrentIndex.value = _animatedIndex;\n runOnJS(handleOnChange)(_animatedIndex);\n }\n\n /**\n * if index is `-1` than we fire the `onClose` callback.\n */\n if (_animatedIndex === -1 && _providedOnClose) {\n runOnJS(print)({\n component: BottomSheet.name,\n method: 'useAnimatedReaction::onClose',\n params: {\n animatedCurrentIndex: animatedCurrentIndex.value,\n animatedIndex: _animatedIndex,\n },\n });\n runOnJS(_providedOnClose)();\n }\n },\n [handleOnChange, _providedOnClose]\n );\n\n /**\n * React to `index` prop to snap the sheet to the new position.\n *\n * @alias onIndexChange\n */\n useEffect(() => {\n if (isAnimatedOnMount.value) {\n handleSnapToIndex(_providedIndex);\n }\n }, [\n _providedIndex,\n animatedCurrentIndex,\n isAnimatedOnMount,\n handleSnapToIndex,\n ]);\n //#endregion\n\n // render\n print({\n component: BottomSheet.name,\n method: 'render',\n params: {\n animatedSnapPoints: animatedSnapPoints.value,\n animatedCurrentIndex: animatedCurrentIndex.value,\n providedIndex: _providedIndex,\n },\n });\n return (\n \n \n \n \n \n \n \n \n \n {typeof Content === 'function' ? : Content}\n\n {footerComponent && (\n \n )}\n \n \n \n \n {/* */}\n \n \n \n \n );\n }\n);\n\nconst BottomSheet = memo(BottomSheetComponent);\nBottomSheet.displayName = 'BottomSheet';\n\nexport default BottomSheet;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheet/constants.js b/lib/module/components/bottomSheet/constants.js new file mode 100644 index 000000000..889a30d5d --- /dev/null +++ b/lib/module/components/bottomSheet/constants.js @@ -0,0 +1,30 @@ +import { KEYBOARD_BEHAVIOR, KEYBOARD_BLUR_BEHAVIOR, KEYBOARD_INPUT_MODE, SCREEN_HEIGHT } from '../../constants'; // default values + +const DEFAULT_HANDLE_HEIGHT = 24; +const DEFAULT_OVER_DRAG_RESISTANCE_FACTOR = 2.5; +const DEFAULT_ENABLE_CONTENT_PANNING_GESTURE = true; +const DEFAULT_ENABLE_HANDLE_PANNING_GESTURE = true; +const DEFAULT_ENABLE_OVER_DRAG = true; +const DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE = false; +const DEFAULT_ANIMATE_ON_MOUNT = true; +const DEFAULT_DYNAMIC_SIZING = false; // keyboard + +const DEFAULT_KEYBOARD_BEHAVIOR = KEYBOARD_BEHAVIOR.interactive; +const DEFAULT_KEYBOARD_BLUR_BEHAVIOR = KEYBOARD_BLUR_BEHAVIOR.none; +const DEFAULT_KEYBOARD_INPUT_MODE = KEYBOARD_INPUT_MODE.adjustPan; // initial values + +const INITIAL_VALUE = Number.NEGATIVE_INFINITY; +const INITIAL_SNAP_POINT = -999; +const INITIAL_CONTAINER_HEIGHT = -999; +const INITIAL_CONTAINER_OFFSET = { + top: 0, + bottom: 0, + left: 0, + right: 0 +}; +const INITIAL_HANDLE_HEIGHT = -999; +const INITIAL_POSITION = SCREEN_HEIGHT; +export { DEFAULT_HANDLE_HEIGHT, DEFAULT_OVER_DRAG_RESISTANCE_FACTOR, DEFAULT_ENABLE_CONTENT_PANNING_GESTURE, DEFAULT_ENABLE_HANDLE_PANNING_GESTURE, DEFAULT_ENABLE_OVER_DRAG, DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE, DEFAULT_DYNAMIC_SIZING, DEFAULT_ANIMATE_ON_MOUNT, // keyboard +DEFAULT_KEYBOARD_BEHAVIOR, DEFAULT_KEYBOARD_BLUR_BEHAVIOR, DEFAULT_KEYBOARD_INPUT_MODE, // layout +INITIAL_POSITION, INITIAL_CONTAINER_HEIGHT, INITIAL_CONTAINER_OFFSET, INITIAL_HANDLE_HEIGHT, INITIAL_SNAP_POINT, INITIAL_VALUE }; +//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheet/constants.js.map b/lib/module/components/bottomSheet/constants.js.map new file mode 100644 index 000000000..cb4369fe6 --- /dev/null +++ b/lib/module/components/bottomSheet/constants.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["constants.ts"],"names":["KEYBOARD_BEHAVIOR","KEYBOARD_BLUR_BEHAVIOR","KEYBOARD_INPUT_MODE","SCREEN_HEIGHT","DEFAULT_HANDLE_HEIGHT","DEFAULT_OVER_DRAG_RESISTANCE_FACTOR","DEFAULT_ENABLE_CONTENT_PANNING_GESTURE","DEFAULT_ENABLE_HANDLE_PANNING_GESTURE","DEFAULT_ENABLE_OVER_DRAG","DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE","DEFAULT_ANIMATE_ON_MOUNT","DEFAULT_DYNAMIC_SIZING","DEFAULT_KEYBOARD_BEHAVIOR","interactive","DEFAULT_KEYBOARD_BLUR_BEHAVIOR","none","DEFAULT_KEYBOARD_INPUT_MODE","adjustPan","INITIAL_VALUE","Number","NEGATIVE_INFINITY","INITIAL_SNAP_POINT","INITIAL_CONTAINER_HEIGHT","INITIAL_CONTAINER_OFFSET","top","bottom","left","right","INITIAL_HANDLE_HEIGHT","INITIAL_POSITION"],"mappings":"AAAA,SACEA,iBADF,EAEEC,sBAFF,EAGEC,mBAHF,EAIEC,aAJF,QAKO,iBALP,C,CAOA;;AACA,MAAMC,qBAAqB,GAAG,EAA9B;AACA,MAAMC,mCAAmC,GAAG,GAA5C;AACA,MAAMC,sCAAsC,GAAG,IAA/C;AACA,MAAMC,qCAAqC,GAAG,IAA9C;AACA,MAAMC,wBAAwB,GAAG,IAAjC;AACA,MAAMC,gCAAgC,GAAG,KAAzC;AACA,MAAMC,wBAAwB,GAAG,IAAjC;AACA,MAAMC,sBAAsB,GAAG,KAA/B,C,CAEA;;AACA,MAAMC,yBAAyB,GAAGZ,iBAAiB,CAACa,WAApD;AACA,MAAMC,8BAA8B,GAAGb,sBAAsB,CAACc,IAA9D;AACA,MAAMC,2BAA2B,GAAGd,mBAAmB,CAACe,SAAxD,C,CAEA;;AACA,MAAMC,aAAa,GAAGC,MAAM,CAACC,iBAA7B;AACA,MAAMC,kBAAkB,GAAG,CAAC,GAA5B;AACA,MAAMC,wBAAwB,GAAG,CAAC,GAAlC;AACA,MAAMC,wBAAwB,GAAG;AAC/BC,EAAAA,GAAG,EAAE,CAD0B;AAE/BC,EAAAA,MAAM,EAAE,CAFuB;AAG/BC,EAAAA,IAAI,EAAE,CAHyB;AAI/BC,EAAAA,KAAK,EAAE;AAJwB,CAAjC;AAMA,MAAMC,qBAAqB,GAAG,CAAC,GAA/B;AACA,MAAMC,gBAAgB,GAAG1B,aAAzB;AAEA,SACEC,qBADF,EAEEC,mCAFF,EAGEC,sCAHF,EAIEC,qCAJF,EAKEC,wBALF,EAMEC,gCANF,EAOEE,sBAPF,EAQED,wBARF,EASE;AACAE,yBAVF,EAWEE,8BAXF,EAYEE,2BAZF,EAaE;AACAa,gBAdF,EAeEP,wBAfF,EAgBEC,wBAhBF,EAiBEK,qBAjBF,EAkBEP,kBAlBF,EAmBEH,aAnBF","sourcesContent":["import {\n KEYBOARD_BEHAVIOR,\n KEYBOARD_BLUR_BEHAVIOR,\n KEYBOARD_INPUT_MODE,\n SCREEN_HEIGHT,\n} from '../../constants';\n\n// default values\nconst DEFAULT_HANDLE_HEIGHT = 24;\nconst DEFAULT_OVER_DRAG_RESISTANCE_FACTOR = 2.5;\nconst DEFAULT_ENABLE_CONTENT_PANNING_GESTURE = true;\nconst DEFAULT_ENABLE_HANDLE_PANNING_GESTURE = true;\nconst DEFAULT_ENABLE_OVER_DRAG = true;\nconst DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE = false;\nconst DEFAULT_ANIMATE_ON_MOUNT = true;\nconst DEFAULT_DYNAMIC_SIZING = false;\n\n// keyboard\nconst DEFAULT_KEYBOARD_BEHAVIOR = KEYBOARD_BEHAVIOR.interactive;\nconst DEFAULT_KEYBOARD_BLUR_BEHAVIOR = KEYBOARD_BLUR_BEHAVIOR.none;\nconst DEFAULT_KEYBOARD_INPUT_MODE = KEYBOARD_INPUT_MODE.adjustPan;\n\n// initial values\nconst INITIAL_VALUE = Number.NEGATIVE_INFINITY;\nconst INITIAL_SNAP_POINT = -999;\nconst INITIAL_CONTAINER_HEIGHT = -999;\nconst INITIAL_CONTAINER_OFFSET = {\n top: 0,\n bottom: 0,\n left: 0,\n right: 0,\n};\nconst INITIAL_HANDLE_HEIGHT = -999;\nconst INITIAL_POSITION = SCREEN_HEIGHT;\n\nexport {\n DEFAULT_HANDLE_HEIGHT,\n DEFAULT_OVER_DRAG_RESISTANCE_FACTOR,\n DEFAULT_ENABLE_CONTENT_PANNING_GESTURE,\n DEFAULT_ENABLE_HANDLE_PANNING_GESTURE,\n DEFAULT_ENABLE_OVER_DRAG,\n DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE,\n DEFAULT_DYNAMIC_SIZING,\n DEFAULT_ANIMATE_ON_MOUNT,\n // keyboard\n DEFAULT_KEYBOARD_BEHAVIOR,\n DEFAULT_KEYBOARD_BLUR_BEHAVIOR,\n DEFAULT_KEYBOARD_INPUT_MODE,\n // layout\n INITIAL_POSITION,\n INITIAL_CONTAINER_HEIGHT,\n INITIAL_CONTAINER_OFFSET,\n INITIAL_HANDLE_HEIGHT,\n INITIAL_SNAP_POINT,\n INITIAL_VALUE,\n};\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheet/index.js b/lib/module/components/bottomSheet/index.js new file mode 100644 index 000000000..492551ed7 --- /dev/null +++ b/lib/module/components/bottomSheet/index.js @@ -0,0 +1,2 @@ +export { default } from './BottomSheet'; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheet/index.js.map b/lib/module/components/bottomSheet/index.js.map new file mode 100644 index 000000000..57f7b105f --- /dev/null +++ b/lib/module/components/bottomSheet/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":["default"],"mappings":"AAAA,SAASA,OAAT,QAAwB,eAAxB","sourcesContent":["export { default } from './BottomSheet';\nexport type { BottomSheetProps } from './types';\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheet/styles.js b/lib/module/components/bottomSheet/styles.js new file mode 100644 index 000000000..2ed48af80 --- /dev/null +++ b/lib/module/components/bottomSheet/styles.js @@ -0,0 +1,15 @@ +import { StyleSheet } from 'react-native'; +export const styles = StyleSheet.create({ + container: { + flexDirection: 'column-reverse', + position: 'absolute', + top: 0, + left: 0, + right: 0 + }, + contentContainer: {}, + contentMaskContainer: { + overflow: 'hidden' + } +}); +//# sourceMappingURL=styles.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheet/styles.js.map b/lib/module/components/bottomSheet/styles.js.map new file mode 100644 index 000000000..b8dc43c06 --- /dev/null +++ b/lib/module/components/bottomSheet/styles.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["styles.ts"],"names":["StyleSheet","styles","create","container","flexDirection","position","top","left","right","contentContainer","contentMaskContainer","overflow"],"mappings":"AAAA,SAASA,UAAT,QAA2B,cAA3B;AAEA,OAAO,MAAMC,MAAM,GAAGD,UAAU,CAACE,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE;AACTC,IAAAA,aAAa,EAAE,gBADN;AAETC,IAAAA,QAAQ,EAAE,UAFD;AAGTC,IAAAA,GAAG,EAAE,CAHI;AAITC,IAAAA,IAAI,EAAE,CAJG;AAKTC,IAAAA,KAAK,EAAE;AALE,GAD2B;AAQtCC,EAAAA,gBAAgB,EAAE,EARoB;AAStCC,EAAAA,oBAAoB,EAAE;AACpBC,IAAAA,QAAQ,EAAE;AADU;AATgB,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\n\nexport const styles = StyleSheet.create({\n container: {\n flexDirection: 'column-reverse',\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n },\n contentContainer: {},\n contentMaskContainer: {\n overflow: 'hidden',\n },\n});\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackdrop/BottomSheetBackdrop.js b/lib/module/components/bottomSheetBackdrop/BottomSheetBackdrop.js new file mode 100644 index 000000000..6fbd1a07a --- /dev/null +++ b/lib/module/components/bottomSheetBackdrop/BottomSheetBackdrop.js @@ -0,0 +1,91 @@ +import React, { memo, useCallback, useMemo, useState } from 'react'; +import Animated, { interpolate, Extrapolate, useAnimatedStyle, useAnimatedReaction, useAnimatedGestureHandler, runOnJS } from 'react-native-reanimated'; +import { TapGestureHandler } from 'react-native-gesture-handler'; +import { useBottomSheet } from '../../hooks'; +import { DEFAULT_OPACITY, DEFAULT_APPEARS_ON_INDEX, DEFAULT_DISAPPEARS_ON_INDEX, DEFAULT_ENABLE_TOUCH_THROUGH, DEFAULT_PRESS_BEHAVIOR } from './constants'; +import { styles } from './styles'; + +const BottomSheetBackdropComponent = ({ + animatedIndex, + opacity: _providedOpacity, + appearsOnIndex: _providedAppearsOnIndex, + disappearsOnIndex: _providedDisappearsOnIndex, + enableTouchThrough: _providedEnableTouchThrough, + pressBehavior = DEFAULT_PRESS_BEHAVIOR, + onPress, + style, + children +}) => { + //#region hooks + const { + snapToIndex, + close + } = useBottomSheet(); //#endregion + //#region defaults + + const opacity = _providedOpacity !== null && _providedOpacity !== void 0 ? _providedOpacity : DEFAULT_OPACITY; + const appearsOnIndex = _providedAppearsOnIndex !== null && _providedAppearsOnIndex !== void 0 ? _providedAppearsOnIndex : DEFAULT_APPEARS_ON_INDEX; + const disappearsOnIndex = _providedDisappearsOnIndex !== null && _providedDisappearsOnIndex !== void 0 ? _providedDisappearsOnIndex : DEFAULT_DISAPPEARS_ON_INDEX; + const enableTouchThrough = _providedEnableTouchThrough !== null && _providedEnableTouchThrough !== void 0 ? _providedEnableTouchThrough : DEFAULT_ENABLE_TOUCH_THROUGH; //#endregion + //#region variables + + const [pointerEvents, setPointerEvents] = useState(enableTouchThrough ? 'none' : 'auto'); //#endregion + //#region callbacks + + const handleOnPress = useCallback(() => { + onPress === null || onPress === void 0 ? void 0 : onPress(); + + if (pressBehavior === 'close') { + close(); + } else if (pressBehavior === 'collapse') { + snapToIndex(disappearsOnIndex); + } else if (typeof pressBehavior === 'number') { + snapToIndex(pressBehavior); + } + }, [snapToIndex, close, disappearsOnIndex, pressBehavior, onPress]); + const handleContainerTouchability = useCallback(shouldDisableTouchability => { + setPointerEvents(shouldDisableTouchability ? 'none' : 'auto'); + }, []); //#endregion + //#region tap gesture + + const gestureHandler = useAnimatedGestureHandler({ + onFinish: () => { + runOnJS(handleOnPress)(); + } + }, [handleOnPress]); //#endregion + //#region styles + + const containerAnimatedStyle = useAnimatedStyle(() => ({ + opacity: interpolate(animatedIndex.value, [-1, disappearsOnIndex, appearsOnIndex], [0, 0, opacity], Extrapolate.CLAMP), + flex: 1 + })); + const containerStyle = useMemo(() => [styles.container, style, containerAnimatedStyle], [style, containerAnimatedStyle]); //#endregion + //#region effects + + useAnimatedReaction(() => animatedIndex.value <= disappearsOnIndex, (shouldDisableTouchability, previous) => { + if (shouldDisableTouchability === previous) { + return; + } + + runOnJS(handleContainerTouchability)(shouldDisableTouchability); + }, [disappearsOnIndex]); //#endregion + + return pressBehavior !== 'none' ? /*#__PURE__*/React.createElement(TapGestureHandler, { + onGestureEvent: gestureHandler + }, /*#__PURE__*/React.createElement(Animated.View, { + style: containerStyle, + pointerEvents: pointerEvents, + accessible: true, + accessibilityRole: "button", + accessibilityLabel: "Bottom Sheet backdrop", + accessibilityHint: `Tap to ${typeof pressBehavior === 'string' ? pressBehavior : 'move'} the Bottom Sheet` + }, children)) : /*#__PURE__*/React.createElement(Animated.View, { + pointerEvents: pointerEvents, + style: containerStyle + }, children); +}; + +const BottomSheetBackdrop = /*#__PURE__*/memo(BottomSheetBackdropComponent); +BottomSheetBackdrop.displayName = 'BottomSheetBackdrop'; +export default BottomSheetBackdrop; +//# sourceMappingURL=BottomSheetBackdrop.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackdrop/BottomSheetBackdrop.js.map b/lib/module/components/bottomSheetBackdrop/BottomSheetBackdrop.js.map new file mode 100644 index 000000000..329982e45 --- /dev/null +++ b/lib/module/components/bottomSheetBackdrop/BottomSheetBackdrop.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheetBackdrop.tsx"],"names":["React","memo","useCallback","useMemo","useState","Animated","interpolate","Extrapolate","useAnimatedStyle","useAnimatedReaction","useAnimatedGestureHandler","runOnJS","TapGestureHandler","useBottomSheet","DEFAULT_OPACITY","DEFAULT_APPEARS_ON_INDEX","DEFAULT_DISAPPEARS_ON_INDEX","DEFAULT_ENABLE_TOUCH_THROUGH","DEFAULT_PRESS_BEHAVIOR","styles","BottomSheetBackdropComponent","animatedIndex","opacity","_providedOpacity","appearsOnIndex","_providedAppearsOnIndex","disappearsOnIndex","_providedDisappearsOnIndex","enableTouchThrough","_providedEnableTouchThrough","pressBehavior","onPress","style","children","snapToIndex","close","pointerEvents","setPointerEvents","handleOnPress","handleContainerTouchability","shouldDisableTouchability","gestureHandler","onFinish","containerAnimatedStyle","value","CLAMP","flex","containerStyle","container","previous","BottomSheetBackdrop","displayName"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,IAAhB,EAAsBC,WAAtB,EAAmCC,OAAnC,EAA4CC,QAA5C,QAA4D,OAA5D;AAEA,OAAOC,QAAP,IACEC,WADF,EAEEC,WAFF,EAGEC,gBAHF,EAIEC,mBAJF,EAKEC,yBALF,EAMEC,OANF,QAOO,yBAPP;AAQA,SACEC,iBADF,QAGO,8BAHP;AAIA,SAASC,cAAT,QAA+B,aAA/B;AACA,SACEC,eADF,EAEEC,wBAFF,EAGEC,2BAHF,EAIEC,4BAJF,EAKEC,sBALF,QAMO,aANP;AAOA,SAASC,MAAT,QAAuB,UAAvB;;AAGA,MAAMC,4BAA4B,GAAG,CAAC;AACpCC,EAAAA,aADoC;AAEpCC,EAAAA,OAAO,EAA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K,MAAlB,gBACL,oBAAC,iBAAD;AAAmB,IAAA,cAAc,EAAEW;AAAnC,kBACE,oBAAC,QAAD,CAAU,IAAV;AACE,IAAA,KAAK,EAAEM,cADT;AAEE,IAAA,aAAa,EAAEX,aAFjB;AAGE,IAAA,UAAU,EAAE,IAHd;AAIE,IAAA,iBAAiB,EAAC,QAJpB;AAKE,IAAA,kBAAkB,EAAC,uBALrB;AAME,IAAA,iBAAiB,EAAG,UAClB,OAAON,aAAP,KAAyB,QAAzB,GAAoCA,aAApC,GAAoD,MACrD;AARH,KAUGG,QAVH,CADF,CADK,gBAgBL,oBAAC,QAAD,CAAU,IAAV;AAAe,IAAA,aAAa,EAAEG,aAA9B;AAA6C,IAAA,KAAK,EAAEW;AAApD,KACGd,QADH,CAhBF;AAoBD,CA/GD;;AAiHA,MAAMiB,mBAAmB,gBAAGjD,IAAI,CAACmB,4BAAD,CAAhC;AACA8B,mBAAmB,CAACC,WAApB,GAAkC,qBAAlC;AAEA,eAAeD,mBAAf","sourcesContent":["import React, { memo, useCallback, useMemo, useState } from 'react';\nimport { ViewProps } from 'react-native';\nimport Animated, {\n interpolate,\n Extrapolate,\n useAnimatedStyle,\n useAnimatedReaction,\n useAnimatedGestureHandler,\n runOnJS,\n} from 'react-native-reanimated';\nimport {\n TapGestureHandler,\n TapGestureHandlerGestureEvent,\n} from 'react-native-gesture-handler';\nimport { useBottomSheet } from '../../hooks';\nimport {\n DEFAULT_OPACITY,\n DEFAULT_APPEARS_ON_INDEX,\n DEFAULT_DISAPPEARS_ON_INDEX,\n DEFAULT_ENABLE_TOUCH_THROUGH,\n DEFAULT_PRESS_BEHAVIOR,\n} from './constants';\nimport { styles } from './styles';\nimport type { BottomSheetDefaultBackdropProps } from './types';\n\nconst BottomSheetBackdropComponent = ({\n animatedIndex,\n opacity: _providedOpacity,\n appearsOnIndex: _providedAppearsOnIndex,\n disappearsOnIndex: _providedDisappearsOnIndex,\n enableTouchThrough: _providedEnableTouchThrough,\n pressBehavior = DEFAULT_PRESS_BEHAVIOR,\n onPress,\n style,\n children,\n}: BottomSheetDefaultBackdropProps) => {\n //#region hooks\n const { snapToIndex, close } = useBottomSheet();\n //#endregion\n\n //#region defaults\n const opacity = _providedOpacity ?? DEFAULT_OPACITY;\n const appearsOnIndex = _providedAppearsOnIndex ?? DEFAULT_APPEARS_ON_INDEX;\n const disappearsOnIndex =\n _providedDisappearsOnIndex ?? DEFAULT_DISAPPEARS_ON_INDEX;\n const enableTouchThrough =\n _providedEnableTouchThrough ?? DEFAULT_ENABLE_TOUCH_THROUGH;\n //#endregion\n\n //#region variables\n const [pointerEvents, setPointerEvents] = useState<\n ViewProps['pointerEvents']\n >(enableTouchThrough ? 'none' : 'auto');\n //#endregion\n\n //#region callbacks\n const handleOnPress = useCallback(() => {\n onPress?.();\n\n if (pressBehavior === 'close') {\n close();\n } else if (pressBehavior === 'collapse') {\n snapToIndex(disappearsOnIndex as number);\n } else if (typeof pressBehavior === 'number') {\n snapToIndex(pressBehavior);\n }\n }, [snapToIndex, close, disappearsOnIndex, pressBehavior, onPress]);\n const handleContainerTouchability = useCallback(\n (shouldDisableTouchability: boolean) => {\n setPointerEvents(shouldDisableTouchability ? 'none' : 'auto');\n },\n []\n );\n //#endregion\n\n //#region tap gesture\n const gestureHandler =\n useAnimatedGestureHandler(\n {\n onFinish: () => {\n runOnJS(handleOnPress)();\n },\n },\n [handleOnPress]\n );\n //#endregion\n\n //#region styles\n const containerAnimatedStyle = useAnimatedStyle(() => ({\n opacity: interpolate(\n animatedIndex.value,\n [-1, disappearsOnIndex, appearsOnIndex],\n [0, 0, opacity],\n Extrapolate.CLAMP\n ),\n flex: 1,\n }));\n const containerStyle = useMemo(\n () => [styles.container, style, containerAnimatedStyle],\n [style, containerAnimatedStyle]\n );\n //#endregion\n\n //#region effects\n useAnimatedReaction(\n () => animatedIndex.value <= disappearsOnIndex,\n (shouldDisableTouchability, previous) => {\n if (shouldDisableTouchability === previous) {\n return;\n }\n runOnJS(handleContainerTouchability)(shouldDisableTouchability);\n },\n [disappearsOnIndex]\n );\n //#endregion\n\n return pressBehavior !== 'none' ? (\n \n \n {children}\n \n \n ) : (\n \n {children}\n \n );\n};\n\nconst BottomSheetBackdrop = memo(BottomSheetBackdropComponent);\nBottomSheetBackdrop.displayName = 'BottomSheetBackdrop';\n\nexport default BottomSheetBackdrop;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackdrop/constants.js b/lib/module/components/bottomSheetBackdrop/constants.js new file mode 100644 index 000000000..2abe24132 --- /dev/null +++ b/lib/module/components/bottomSheetBackdrop/constants.js @@ -0,0 +1,7 @@ +const DEFAULT_OPACITY = 0.5; +const DEFAULT_APPEARS_ON_INDEX = 1; +const DEFAULT_DISAPPEARS_ON_INDEX = 0; +const DEFAULT_ENABLE_TOUCH_THROUGH = false; +const DEFAULT_PRESS_BEHAVIOR = 'close'; +export { DEFAULT_OPACITY, DEFAULT_APPEARS_ON_INDEX, DEFAULT_DISAPPEARS_ON_INDEX, DEFAULT_ENABLE_TOUCH_THROUGH, DEFAULT_PRESS_BEHAVIOR }; +//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackdrop/constants.js.map b/lib/module/components/bottomSheetBackdrop/constants.js.map new file mode 100644 index 000000000..e07a61f81 --- /dev/null +++ b/lib/module/components/bottomSheetBackdrop/constants.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["constants.ts"],"names":["DEFAULT_OPACITY","DEFAULT_APPEARS_ON_INDEX","DEFAULT_DISAPPEARS_ON_INDEX","DEFAULT_ENABLE_TOUCH_THROUGH","DEFAULT_PRESS_BEHAVIOR"],"mappings":"AAAA,MAAMA,eAAe,GAAG,GAAxB;AACA,MAAMC,wBAAwB,GAAG,CAAjC;AACA,MAAMC,2BAA2B,GAAG,CAApC;AACA,MAAMC,4BAA4B,GAAG,KAArC;AACA,MAAMC,sBAAsB,GAAG,OAA/B;AAEA,SACEJ,eADF,EAEEC,wBAFF,EAGEC,2BAHF,EAIEC,4BAJF,EAKEC,sBALF","sourcesContent":["const DEFAULT_OPACITY = 0.5;\nconst DEFAULT_APPEARS_ON_INDEX = 1;\nconst DEFAULT_DISAPPEARS_ON_INDEX = 0;\nconst DEFAULT_ENABLE_TOUCH_THROUGH = false;\nconst DEFAULT_PRESS_BEHAVIOR = 'close' as const;\n\nexport {\n DEFAULT_OPACITY,\n DEFAULT_APPEARS_ON_INDEX,\n DEFAULT_DISAPPEARS_ON_INDEX,\n DEFAULT_ENABLE_TOUCH_THROUGH,\n DEFAULT_PRESS_BEHAVIOR,\n};\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackdrop/index.js b/lib/module/components/bottomSheetBackdrop/index.js new file mode 100644 index 000000000..e32285096 --- /dev/null +++ b/lib/module/components/bottomSheetBackdrop/index.js @@ -0,0 +1,2 @@ +export { default } from './BottomSheetBackdrop'; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackdrop/index.js.map b/lib/module/components/bottomSheetBackdrop/index.js.map new file mode 100644 index 000000000..81c427142 --- /dev/null +++ b/lib/module/components/bottomSheetBackdrop/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":["default"],"mappings":"AAAA,SAASA,OAAT,QAAwB,uBAAxB","sourcesContent":["export { default } from './BottomSheetBackdrop';\nexport type { BottomSheetBackdropProps } from './types';\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackdrop/styles.js b/lib/module/components/bottomSheetBackdrop/styles.js new file mode 100644 index 000000000..87817ba10 --- /dev/null +++ b/lib/module/components/bottomSheetBackdrop/styles.js @@ -0,0 +1,7 @@ +import { StyleSheet } from 'react-native'; +export const styles = StyleSheet.create({ + container: { + backgroundColor: 'black' + } +}); +//# sourceMappingURL=styles.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackdrop/styles.js.map b/lib/module/components/bottomSheetBackdrop/styles.js.map new file mode 100644 index 000000000..92aa3b86b --- /dev/null +++ b/lib/module/components/bottomSheetBackdrop/styles.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["styles.ts"],"names":["StyleSheet","styles","create","container","backgroundColor"],"mappings":"AAAA,SAASA,UAAT,QAA2B,cAA3B;AAEA,OAAO,MAAMC,MAAM,GAAGD,UAAU,CAACE,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE;AACTC,IAAAA,eAAe,EAAE;AADR;AAD2B,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\n\nexport const styles = StyleSheet.create({\n container: {\n backgroundColor: 'black',\n },\n});\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackdropContainer/BottomSheetBackdropContainer.js b/lib/module/components/bottomSheetBackdropContainer/BottomSheetBackdropContainer.js new file mode 100644 index 000000000..4a8452229 --- /dev/null +++ b/lib/module/components/bottomSheetBackdropContainer/BottomSheetBackdropContainer.js @@ -0,0 +1,19 @@ +import React, { memo } from 'react'; +import { styles } from './styles'; + +const BottomSheetBackdropContainerComponent = ({ + animatedIndex, + animatedPosition, + backdropComponent: BackdropComponent +}) => { + return BackdropComponent ? /*#__PURE__*/React.createElement(BackdropComponent, { + animatedIndex: animatedIndex, + animatedPosition: animatedPosition, + style: styles.container + }) : null; +}; + +const BottomSheetBackdropContainer = /*#__PURE__*/memo(BottomSheetBackdropContainerComponent); +BottomSheetBackdropContainer.displayName = 'BottomSheetBackdropContainer'; +export default BottomSheetBackdropContainer; +//# sourceMappingURL=BottomSheetBackdropContainer.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackdropContainer/BottomSheetBackdropContainer.js.map b/lib/module/components/bottomSheetBackdropContainer/BottomSheetBackdropContainer.js.map new file mode 100644 index 000000000..da6234cfa --- /dev/null +++ b/lib/module/components/bottomSheetBackdropContainer/BottomSheetBackdropContainer.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheetBackdropContainer.tsx"],"names":["React","memo","styles","BottomSheetBackdropContainerComponent","animatedIndex","animatedPosition","backdropComponent","BackdropComponent","container","BottomSheetBackdropContainer","displayName"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,IAAhB,QAA4B,OAA5B;AAEA,SAASC,MAAT,QAAuB,UAAvB;;AAEA,MAAMC,qCAAqC,GAAG,CAAC;AAC7CC,EAAAA,aAD6C;AAE7CC,EAAAA,gBAF6C;AAG7CC,EAAAA,iBAAiB,EAAEC;AAH0B,CAAD,KAIL;AACvC,SAAOA,iBAAiB,gBACtB,oBAAC,iBAAD;AACE,IAAA,aAAa,EAAEH,aADjB;AAEE,IAAA,gBAAgB,EAAEC,gBAFpB;AAGE,IAAA,KAAK,EAAEH,MAAM,CAACM;AAHhB,IADsB,GAMpB,IANJ;AAOD,CAZD;;AAcA,MAAMC,4BAA4B,gBAAGR,IAAI,CACvCE,qCADuC,CAAzC;AAGAM,4BAA4B,CAACC,WAA7B,GAA2C,8BAA3C;AAEA,eAAeD,4BAAf","sourcesContent":["import React, { memo } from 'react';\nimport type { BottomSheetBackdropContainerProps } from './types';\nimport { styles } from './styles';\n\nconst BottomSheetBackdropContainerComponent = ({\n animatedIndex,\n animatedPosition,\n backdropComponent: BackdropComponent,\n}: BottomSheetBackdropContainerProps) => {\n return BackdropComponent ? (\n \n ) : null;\n};\n\nconst BottomSheetBackdropContainer = memo(\n BottomSheetBackdropContainerComponent\n);\nBottomSheetBackdropContainer.displayName = 'BottomSheetBackdropContainer';\n\nexport default BottomSheetBackdropContainer;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackdropContainer/index.js b/lib/module/components/bottomSheetBackdropContainer/index.js new file mode 100644 index 000000000..4aaabaac8 --- /dev/null +++ b/lib/module/components/bottomSheetBackdropContainer/index.js @@ -0,0 +1,2 @@ +export { default } from './BottomSheetBackdropContainer'; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackdropContainer/index.js.map b/lib/module/components/bottomSheetBackdropContainer/index.js.map new file mode 100644 index 000000000..d482b18dd --- /dev/null +++ b/lib/module/components/bottomSheetBackdropContainer/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":["default"],"mappings":"AAAA,SAASA,OAAT,QAAwB,gCAAxB","sourcesContent":["export { default } from './BottomSheetBackdropContainer';\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackdropContainer/styles.js b/lib/module/components/bottomSheetBackdropContainer/styles.js new file mode 100644 index 000000000..2cdb32548 --- /dev/null +++ b/lib/module/components/bottomSheetBackdropContainer/styles.js @@ -0,0 +1,11 @@ +import { StyleSheet } from 'react-native'; +export const styles = StyleSheet.create({ + container: { + position: 'absolute', + top: 0, + left: 0, + right: 0, + bottom: 0 + } +}); +//# sourceMappingURL=styles.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackdropContainer/styles.js.map b/lib/module/components/bottomSheetBackdropContainer/styles.js.map new file mode 100644 index 000000000..633c8bcfc --- /dev/null +++ b/lib/module/components/bottomSheetBackdropContainer/styles.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["styles.ts"],"names":["StyleSheet","styles","create","container","position","top","left","right","bottom"],"mappings":"AAAA,SAASA,UAAT,QAA2B,cAA3B;AAEA,OAAO,MAAMC,MAAM,GAAGD,UAAU,CAACE,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE;AACTC,IAAAA,QAAQ,EAAE,UADD;AAETC,IAAAA,GAAG,EAAE,CAFI;AAGTC,IAAAA,IAAI,EAAE,CAHG;AAITC,IAAAA,KAAK,EAAE,CAJE;AAKTC,IAAAA,MAAM,EAAE;AALC;AAD2B,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\n\nexport const styles = StyleSheet.create({\n container: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n },\n});\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackground/BottomSheetBackground.js b/lib/module/components/bottomSheetBackground/BottomSheetBackground.js new file mode 100644 index 000000000..d72bcec69 --- /dev/null +++ b/lib/module/components/bottomSheetBackground/BottomSheetBackground.js @@ -0,0 +1,19 @@ +import React, { memo } from 'react'; +import { View } from 'react-native'; +import { styles } from './styles'; + +const BottomSheetBackgroundComponent = ({ + pointerEvents, + style +}) => /*#__PURE__*/React.createElement(View, { + pointerEvents: pointerEvents, + accessible: true, + accessibilityRole: "adjustable", + accessibilityLabel: "Bottom Sheet", + style: [styles.container, style] +}); + +const BottomSheetBackground = /*#__PURE__*/memo(BottomSheetBackgroundComponent); +BottomSheetBackground.displayName = 'BottomSheetBackground'; +export default BottomSheetBackground; +//# sourceMappingURL=BottomSheetBackground.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackground/BottomSheetBackground.js.map b/lib/module/components/bottomSheetBackground/BottomSheetBackground.js.map new file mode 100644 index 000000000..4da384991 --- /dev/null +++ b/lib/module/components/bottomSheetBackground/BottomSheetBackground.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheetBackground.tsx"],"names":["React","memo","View","styles","BottomSheetBackgroundComponent","pointerEvents","style","container","BottomSheetBackground","displayName"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,IAAhB,QAA4B,OAA5B;AACA,SAASC,IAAT,QAAqB,cAArB;AAEA,SAASC,MAAT,QAAuB,UAAvB;;AAEA,MAAMC,8BAA8B,GAAG,CAAC;AACtCC,EAAAA,aADsC;AAEtCC,EAAAA;AAFsC,CAAD,kBAIrC,oBAAC,IAAD;AACE,EAAA,aAAa,EAAED,aADjB;AAEE,EAAA,UAAU,EAAE,IAFd;AAGE,EAAA,iBAAiB,EAAC,YAHpB;AAIE,EAAA,kBAAkB,EAAC,cAJrB;AAKE,EAAA,KAAK,EAAE,CAACF,MAAM,CAACI,SAAR,EAAmBD,KAAnB;AALT,EAJF;;AAaA,MAAME,qBAAqB,gBAAGP,IAAI,CAACG,8BAAD,CAAlC;AACAI,qBAAqB,CAACC,WAAtB,GAAoC,uBAApC;AAEA,eAAeD,qBAAf","sourcesContent":["import React, { memo } from 'react';\nimport { View } from 'react-native';\nimport type { BottomSheetBackgroundProps } from './types';\nimport { styles } from './styles';\n\nconst BottomSheetBackgroundComponent = ({\n pointerEvents,\n style,\n}: BottomSheetBackgroundProps) => (\n \n);\n\nconst BottomSheetBackground = memo(BottomSheetBackgroundComponent);\nBottomSheetBackground.displayName = 'BottomSheetBackground';\n\nexport default BottomSheetBackground;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackground/index.js b/lib/module/components/bottomSheetBackground/index.js new file mode 100644 index 000000000..5a866c119 --- /dev/null +++ b/lib/module/components/bottomSheetBackground/index.js @@ -0,0 +1,2 @@ +export { default } from './BottomSheetBackground'; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackground/index.js.map b/lib/module/components/bottomSheetBackground/index.js.map new file mode 100644 index 000000000..bf16e5cb4 --- /dev/null +++ b/lib/module/components/bottomSheetBackground/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":["default"],"mappings":"AAAA,SAASA,OAAT,QAAwB,yBAAxB","sourcesContent":["export { default } from './BottomSheetBackground';\nexport type { BottomSheetBackgroundProps } from './types';\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackground/styles.js b/lib/module/components/bottomSheetBackground/styles.js new file mode 100644 index 000000000..7e7784bf3 --- /dev/null +++ b/lib/module/components/bottomSheetBackground/styles.js @@ -0,0 +1,8 @@ +import { StyleSheet } from 'react-native'; +export const styles = StyleSheet.create({ + container: { + backgroundColor: 'white', + borderRadius: 15 + } +}); +//# sourceMappingURL=styles.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackground/styles.js.map b/lib/module/components/bottomSheetBackground/styles.js.map new file mode 100644 index 000000000..40b0e9fa0 --- /dev/null +++ b/lib/module/components/bottomSheetBackground/styles.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["styles.ts"],"names":["StyleSheet","styles","create","container","backgroundColor","borderRadius"],"mappings":"AAAA,SAASA,UAAT,QAA2B,cAA3B;AAEA,OAAO,MAAMC,MAAM,GAAGD,UAAU,CAACE,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE;AACTC,IAAAA,eAAe,EAAE,OADR;AAETC,IAAAA,YAAY,EAAE;AAFL;AAD2B,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\n\nexport const styles = StyleSheet.create({\n container: {\n backgroundColor: 'white',\n borderRadius: 15,\n },\n});\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.js b/lib/module/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.js new file mode 100644 index 000000000..c8b735d32 --- /dev/null +++ b/lib/module/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.js @@ -0,0 +1,25 @@ +import React, { memo, useMemo } from 'react'; +import BottomSheetBackground from '../bottomSheetBackground'; +import { styles } from './styles'; +import { StyleSheet } from 'react-native'; + +const BottomSheetBackgroundContainerComponent = ({ + animatedIndex, + animatedPosition, + backgroundComponent: _providedBackgroundComponent, + backgroundStyle: _providedBackgroundStyle +}) => { + const BackgroundComponent = _providedBackgroundComponent || BottomSheetBackground; + const backgroundStyle = useMemo(() => StyleSheet.flatten([styles.container, _providedBackgroundStyle]), [_providedBackgroundStyle]); + return _providedBackgroundComponent === null ? null : /*#__PURE__*/React.createElement(BackgroundComponent, { + pointerEvents: "none", + animatedIndex: animatedIndex, + animatedPosition: animatedPosition, + style: backgroundStyle + }); +}; + +const BottomSheetBackgroundContainer = /*#__PURE__*/memo(BottomSheetBackgroundContainerComponent); +BottomSheetBackgroundContainer.displayName = 'BottomSheetBackgroundContainer'; +export default BottomSheetBackgroundContainer; +//# sourceMappingURL=BottomSheetBackgroundContainer.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.js.map b/lib/module/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.js.map new file mode 100644 index 000000000..66c660e8e --- /dev/null +++ b/lib/module/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheetBackgroundContainer.tsx"],"names":["React","memo","useMemo","BottomSheetBackground","styles","StyleSheet","BottomSheetBackgroundContainerComponent","animatedIndex","animatedPosition","backgroundComponent","_providedBackgroundComponent","backgroundStyle","_providedBackgroundStyle","BackgroundComponent","flatten","container","BottomSheetBackgroundContainer","displayName"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,IAAhB,EAAsBC,OAAtB,QAAqC,OAArC;AACA,OAAOC,qBAAP,MAAkC,0BAAlC;AAEA,SAASC,MAAT,QAAuB,UAAvB;AACA,SAASC,UAAT,QAA2B,cAA3B;;AAEA,MAAMC,uCAAuC,GAAG,CAAC;AAC/CC,EAAAA,aAD+C;AAE/CC,EAAAA,gBAF+C;AAG/CC,EAAAA,mBAAmB,EAAEC,4BAH0B;AAI/CC,EAAAA,eAAe,EAAEC;AAJ8B,CAAD,KAKL;AACzC,QAAMC,mBAAmB,GACvBH,4BAA4B,IAAIP,qBADlC;AAGA,QAAMQ,eAAe,GAAGT,OAAO,CAC7B,MAAMG,UAAU,CAACS,OAAX,CAAmB,CAACV,MAAM,CAACW,SAAR,EAAmBH,wBAAnB,CAAnB,CADuB,EAE7B,CAACA,wBAAD,CAF6B,CAA/B;AAKA,SAAOF,4BAA4B,KAAK,IAAjC,GAAwC,IAAxC,gBACL,oBAAC,mBAAD;AACE,IAAA,aAAa,EAAC,MADhB;AAEE,IAAA,aAAa,EAAEH,aAFjB;AAGE,IAAA,gBAAgB,EAAEC,gBAHpB;AAIE,IAAA,KAAK,EAAEG;AAJT,IADF;AAQD,CAtBD;;AAwBA,MAAMK,8BAA8B,gBAAGf,IAAI,CACzCK,uCADyC,CAA3C;AAGAU,8BAA8B,CAACC,WAA/B,GAA6C,gCAA7C;AAEA,eAAeD,8BAAf","sourcesContent":["import React, { memo, useMemo } from 'react';\nimport BottomSheetBackground from '../bottomSheetBackground';\nimport type { BottomSheetBackgroundContainerProps } from './types';\nimport { styles } from './styles';\nimport { StyleSheet } from 'react-native';\n\nconst BottomSheetBackgroundContainerComponent = ({\n animatedIndex,\n animatedPosition,\n backgroundComponent: _providedBackgroundComponent,\n backgroundStyle: _providedBackgroundStyle,\n}: BottomSheetBackgroundContainerProps) => {\n const BackgroundComponent =\n _providedBackgroundComponent || BottomSheetBackground;\n\n const backgroundStyle = useMemo(\n () => StyleSheet.flatten([styles.container, _providedBackgroundStyle]),\n [_providedBackgroundStyle]\n );\n\n return _providedBackgroundComponent === null ? null : (\n \n );\n};\n\nconst BottomSheetBackgroundContainer = memo(\n BottomSheetBackgroundContainerComponent\n);\nBottomSheetBackgroundContainer.displayName = 'BottomSheetBackgroundContainer';\n\nexport default BottomSheetBackgroundContainer;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackgroundContainer/index.js b/lib/module/components/bottomSheetBackgroundContainer/index.js new file mode 100644 index 000000000..09628f098 --- /dev/null +++ b/lib/module/components/bottomSheetBackgroundContainer/index.js @@ -0,0 +1,2 @@ +export { default } from './BottomSheetBackgroundContainer'; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackgroundContainer/index.js.map b/lib/module/components/bottomSheetBackgroundContainer/index.js.map new file mode 100644 index 000000000..4e9fbfa3b --- /dev/null +++ b/lib/module/components/bottomSheetBackgroundContainer/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":["default"],"mappings":"AAAA,SAASA,OAAT,QAAwB,kCAAxB","sourcesContent":["export { default } from './BottomSheetBackgroundContainer';\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackgroundContainer/styles.js b/lib/module/components/bottomSheetBackgroundContainer/styles.js new file mode 100644 index 000000000..2cdb32548 --- /dev/null +++ b/lib/module/components/bottomSheetBackgroundContainer/styles.js @@ -0,0 +1,11 @@ +import { StyleSheet } from 'react-native'; +export const styles = StyleSheet.create({ + container: { + position: 'absolute', + top: 0, + left: 0, + right: 0, + bottom: 0 + } +}); +//# sourceMappingURL=styles.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackgroundContainer/styles.js.map b/lib/module/components/bottomSheetBackgroundContainer/styles.js.map new file mode 100644 index 000000000..633c8bcfc --- /dev/null +++ b/lib/module/components/bottomSheetBackgroundContainer/styles.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["styles.ts"],"names":["StyleSheet","styles","create","container","position","top","left","right","bottom"],"mappings":"AAAA,SAASA,UAAT,QAA2B,cAA3B;AAEA,OAAO,MAAMC,MAAM,GAAGD,UAAU,CAACE,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE;AACTC,IAAAA,QAAQ,EAAE,UADD;AAETC,IAAAA,GAAG,EAAE,CAFI;AAGTC,IAAAA,IAAI,EAAE,CAHG;AAITC,IAAAA,KAAK,EAAE,CAJE;AAKTC,IAAAA,MAAM,EAAE;AALC;AAD2B,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\n\nexport const styles = StyleSheet.create({\n container: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n },\n});\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetContainer/BottomSheetContainer.js b/lib/module/components/bottomSheetContainer/BottomSheetContainer.js new file mode 100644 index 000000000..d1a5c5192 --- /dev/null +++ b/lib/module/components/bottomSheetContainer/BottomSheetContainer.js @@ -0,0 +1,69 @@ +import React, { memo, useCallback, useMemo, useRef } from 'react'; +import { StatusBar, View } from 'react-native'; +import { WINDOW_HEIGHT } from '../../constants'; +import { print } from '../../utilities'; +import { styles } from './styles'; + +function BottomSheetContainerComponent({ + containerHeight, + containerOffset, + topInset = 0, + bottomInset = 0, + shouldCalculateHeight = true, + detached, + style, + children +}) { + const containerRef = useRef(null); //#region styles + + const containerStyle = useMemo(() => [style, styles.container, { + top: topInset, + bottom: bottomInset, + overflow: detached ? 'visible' : 'hidden' + }], [style, detached, topInset, bottomInset]); //#endregion + //#region callbacks + + const handleContainerLayout = useCallback(function handleContainerLayout({ + nativeEvent: { + layout: { + height + } + } + }) { + var _containerRef$current; + + containerHeight.value = height; + (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.measure((_x, _y, _width, _height, _pageX, pageY) => { + var _StatusBar$currentHei; + + if (!containerOffset.value) return; + containerOffset.value = { + top: pageY !== null && pageY !== void 0 ? pageY : 0, + left: 0, + right: 0, + bottom: Math.max(0, WINDOW_HEIGHT - ((pageY !== null && pageY !== void 0 ? pageY : 0) + height + ((_StatusBar$currentHei = StatusBar.currentHeight) !== null && _StatusBar$currentHei !== void 0 ? _StatusBar$currentHei : 0))) + }; + }); + print({ + component: BottomSheetContainer.displayName, + method: 'handleContainerLayout', + params: { + height + } + }); + }, [containerHeight, containerOffset, containerRef]); //#endregion + //#region render + + return /*#__PURE__*/React.createElement(View, { + ref: containerRef, + pointerEvents: "box-none", + onLayout: shouldCalculateHeight ? handleContainerLayout : undefined, + style: containerStyle, + children: children + }); //#endregion +} + +const BottomSheetContainer = /*#__PURE__*/memo(BottomSheetContainerComponent); +BottomSheetContainer.displayName = 'BottomSheetContainer'; +export default BottomSheetContainer; +//# sourceMappingURL=BottomSheetContainer.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetContainer/BottomSheetContainer.js.map b/lib/module/components/bottomSheetContainer/BottomSheetContainer.js.map new file mode 100644 index 000000000..6aa524cc8 --- /dev/null +++ b/lib/module/components/bottomSheetContainer/BottomSheetContainer.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheetContainer.tsx"],"names":["React","memo","useCallback","useMemo","useRef","StatusBar","View","WINDOW_HEIGHT","print","styles","BottomSheetContainerComponent","containerHeight","containerOffset","topInset","bottomInset","shouldCalculateHeight","detached","style","children","containerRef","containerStyle","container","top","bottom","overflow","handleContainerLayout","nativeEvent","layout","height","value","current","measure","_x","_y","_width","_height","_pageX","pageY","left","right","Math","max","currentHeight","component","Bottom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ar,\n StyleProp,\n View,\n ViewStyle,\n} from 'react-native';\nimport { WINDOW_HEIGHT } from '../../constants';\nimport { print } from '../../utilities';\nimport { styles } from './styles';\nimport type { BottomSheetContainerProps } from './types';\n\nfunction BottomSheetContainerComponent({\n containerHeight,\n containerOffset,\n topInset = 0,\n bottomInset = 0,\n shouldCalculateHeight = true,\n detached,\n style,\n children,\n}: BottomSheetContainerProps) {\n const containerRef = useRef(null);\n //#region styles\n const containerStyle = useMemo>(\n () => [\n style,\n styles.container,\n {\n top: topInset,\n bottom: bottomInset,\n overflow: detached ? 'visible' : 'hidden',\n },\n ],\n [style, detached, topInset, bottomInset]\n );\n //#endregion\n\n //#region callbacks\n const handleContainerLayout = useCallback(\n function handleContainerLayout({\n nativeEvent: {\n layout: { height },\n },\n }: LayoutChangeEvent) {\n containerHeight.value = height;\n\n containerRef.current?.measure(\n (_x, _y, _width, _height, _pageX, pageY) => {\n if (!containerOffset.value) return;\n containerOffset.value = {\n top: pageY ?? 0,\n left: 0,\n right: 0,\n bottom: Math.max(\n 0,\n WINDOW_HEIGHT -\n ((pageY ?? 0) + height + (StatusBar.currentHeight ?? 0))\n ),\n };\n }\n );\n\n print({\n component: BottomSheetContainer.displayName,\n method: 'handleContainerLayout',\n params: {\n height,\n },\n });\n },\n [containerHeight, containerOffset, containerRef]\n );\n //#endregion\n\n //#region render\n return (\n \n );\n //#endregion\n}\n\nconst BottomSheetContainer = memo(BottomSheetContainerComponent);\nBottomSheetContainer.displayName = 'BottomSheetContainer';\n\nexport default BottomSheetContainer;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetContainer/index.js b/lib/module/components/bottomSheetContainer/index.js new file mode 100644 index 000000000..42198190e --- /dev/null +++ b/lib/module/components/bottomSheetContainer/index.js @@ -0,0 +1,2 @@ +export { default } from './BottomSheetContainer'; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetContainer/index.js.map b/lib/module/components/bottomSheetContainer/index.js.map new file mode 100644 index 000000000..8250bcb0d --- /dev/null +++ b/lib/module/components/bottomSheetContainer/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":["default"],"mappings":"AAAA,SAASA,OAAT,QAAwB,wBAAxB","sourcesContent":["export { default } from './BottomSheetContainer';\nexport type { BottomSheetContainerProps } from './types';\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetContainer/styles.js b/lib/module/components/bottomSheetContainer/styles.js new file mode 100644 index 000000000..e2b0343da --- /dev/null +++ b/lib/module/components/bottomSheetContainer/styles.js @@ -0,0 +1,6 @@ +import { StyleSheet } from 'react-native'; +export const styles = StyleSheet.create({ + container: { ...StyleSheet.absoluteFillObject + } +}); +//# sourceMappingURL=styles.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetContainer/styles.js.map b/lib/module/components/bottomSheetContainer/styles.js.map new file mode 100644 index 000000000..a3d759720 --- /dev/null +++ b/lib/module/components/bottomSheetContainer/styles.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["styles.ts"],"names":["StyleSheet","styles","create","container","absoluteFillObject"],"mappings":"AAAA,SAASA,UAAT,QAA2B,cAA3B;AAEA,OAAO,MAAMC,MAAM,GAAGD,UAAU,CAACE,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE,EACT,GAAGH,UAAU,CAACI;AADL;AAD2B,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\n\nexport const styles = StyleSheet.create({\n container: {\n ...StyleSheet.absoluteFillObject,\n },\n});\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetContainer/styles.web.js b/lib/module/components/bottomSheetContainer/styles.web.js new file mode 100644 index 000000000..7ea3f46e4 --- /dev/null +++ b/lib/module/components/bottomSheetContainer/styles.web.js @@ -0,0 +1,12 @@ +import { StyleSheet } from 'react-native'; +export const styles = StyleSheet.create({ + container: { + // @ts-ignore + position: 'fixed', + left: 0, + right: 0, + bottom: 0, + top: 0 + } +}); +//# sourceMappingURL=styles.web.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetContainer/styles.web.js.map b/lib/module/components/bottomSheetContainer/styles.web.js.map new file mode 100644 index 000000000..a1ca0fd87 --- /dev/null +++ b/lib/module/components/bottomSheetContainer/styles.web.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["styles.web.ts"],"names":["StyleSheet","styles","create","container","position","left","right","bottom","top"],"mappings":"AAAA,SAASA,UAAT,QAA2B,cAA3B;AAEA,OAAO,MAAMC,MAAM,GAAGD,UAAU,CAACE,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE;AACT;AACAC,IAAAA,QAAQ,EAAE,OAFD;AAGTC,IAAAA,IAAI,EAAE,CAHG;AAITC,IAAAA,KAAK,EAAE,CAJE;AAKTC,IAAAA,MAAM,EAAE,CALC;AAMTC,IAAAA,GAAG,EAAE;AANI;AAD2B,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\n\nexport const styles = StyleSheet.create({\n container: {\n // @ts-ignore\n position: 'fixed',\n left: 0,\n right: 0,\n bottom: 0,\n top: 0,\n },\n});\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetDraggableView/BottomSheetDraggableView.js b/lib/module/components/bottomSheetDraggableView/BottomSheetDraggableView.js new file mode 100644 index 000000000..179c135d5 --- /dev/null +++ b/lib/module/components/bottomSheetDraggableView/BottomSheetDraggableView.js @@ -0,0 +1,76 @@ +function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } + +import React, { useMemo, useRef, memo } from 'react'; +import Animated from 'react-native-reanimated'; +import { PanGestureHandler } from 'react-native-gesture-handler'; +import { useBottomSheetGestureHandlers, useBottomSheetInternal } from '../../hooks'; +import { GESTURE_SOURCE } from '../../constants'; + +const BottomSheetDraggableViewComponent = ({ + gestureType = GESTURE_SOURCE.CONTENT, + nativeGestureRef, + refreshControlGestureRef, + style, + children, + ...rest +}) => { + //#region hooks + const { + enableContentPanningGesture, + simultaneousHandlers: _providedSimultaneousHandlers, + waitFor, + activeOffsetX, + activeOffsetY, + failOffsetX, + failOffsetY + } = useBottomSheetInternal(); + const { + contentPanGestureHandler, + scrollablePanGestureHandler + } = useBottomSheetGestureHandlers(); //#endregion + //#region variables + + const panGestureRef = useRef(null); + const gestureHandler = useMemo(() => gestureType === GESTURE_SOURCE.CONTENT ? contentPanGestureHandler : scrollablePanGestureHandler, [gestureType, contentPanGestureHandler, scrollablePanGestureHandler]); + const simultaneousHandlers = useMemo(() => { + const refs = []; + + if (nativeGestureRef) { + refs.push(nativeGestureRef); + } + + if (refreshControlGestureRef) { + refs.push(refreshControlGestureRef); + } + + if (_providedSimultaneousHandlers) { + if (Array.isArray(_providedSimultaneousHandlers)) { + refs.push(..._providedSimultaneousHandlers); + } else { + refs.push(_providedSimultaneousHandlers); + } + } + + return refs; + }, [_providedSimultaneousHandlers, nativeGestureRef, refreshControlGestureRef]); //#endregion + + return /*#__PURE__*/React.createElement(PanGestureHandler, { + ref: panGestureRef, + enabled: enableContentPanningGesture, + simultaneousHandlers: simultaneousHandlers, + shouldCancelWhenOutside: false, + waitFor: waitFor, + onGestureEvent: gestureHandler, + activeOffsetX: activeOffsetX, + activeOffsetY: activeOffsetY, + failOffsetX: failOffsetX, + failOffsetY: failOffsetY + }, /*#__PURE__*/React.createElement(Animated.View, _extends({ + style: style + }, rest), children)); +}; + +const BottomSheetDraggableView = /*#__PURE__*/memo(BottomSheetDraggableViewComponent); +BottomSheetDraggableView.displayName = 'BottomSheetDraggableView'; +export default BottomSheetDraggableView; +//# sourceMappingURL=BottomSheetDraggableView.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetDraggableView/BottomSheetDraggableView.js.map b/lib/module/components/bottomSheetDraggableView/BottomSheetDraggableView.js.map new file mode 100644 index 000000000..1954fb0f9 --- /dev/null +++ b/lib/module/components/bottomSheetDraggableView/BottomSheetDraggableView.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheetDraggableView.tsx"],"names":["React","useMemo","useRef","memo","Animated","PanGestureHandler","useBottomSheetGestureHandlers","useBottomSheetInternal","GESTURE_SOURCE","BottomSheetDraggableViewComponent","gestureType","CONTENT","nativeGestureRef","refreshControlGestureRef","style","children","rest","enableContentPanningGesture","simultaneousHandlers","_providedSimultaneousHandlers","waitFor","activeOffsetX","activeOffsetY","failOffsetX","failOffsetY","contentPanGestureHandler","scrollablePanGestureHandler","panGestureRef","gestureHandler","refs","push","Array","isArray","BottomSheetDraggableView","displayName"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,OAAhB,EAAyBC,MAAzB,EAAiCC,IAAjC,QAA6C,OAA7C;AACA,OAAOC,QAAP,MAAqB,yBAArB;AACA,SAASC,iBAAT,QAAkC,8BAAlC;AACA,SACEC,6BADF,EAEEC,sBAFF,QAGO,aAHP;AAIA,SAASC,cAAT,QAA+B,iBAA/B;;AAGA,MAAMC,iCAAiC,GAAG,CAAC;AACzCC,EAAAA,WAAW,GAAGF,cAAc,CAACG,OADY;AAEzCC,EAAAA,gBAFyC;AAGzCC,EAAAA,wBAHyC;AAIzCC,EAAAA,KAJyC;AAKzCC,EAAAA,QALyC;AAMzC,KAAGC;AANsC,CAAD,KAOL;AACnC;AACA,QAAM;AACJC,IAAAA,2BADI;AAEJC,IAAAA,oBAAoB,EAAEC,6BAFlB;AAGJC,IAAAA,OAHI;AAIJC,IAAAA,aAJI;AAKJC,IAAAA,aALI;AAMJC,IAAAA,WANI;AAOJC,IAAAA;AAPI,MAQFjB,sBAAsB,EAR1B;AASA,QAAM;AAAEkB,IAAAA,wBAAF;AAA4BC,IAAAA;AAA5B,MACJpB,6BAA6B,EAD/B,CAXmC,CAanC;AAEA;;AACA,QAAMqB,aAAa,GAAGzB,MAAM,CAAoB,IAApB,CAA5B;AACA,QAAM0B,cAAc,GAAG3B,OAAO,CAC5B,MACES,WAAW,KAAKF,cAAc,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,GAAuC,0BAAvC;AAEA,eAAeD,wBAAf","sourcesContent":["import React, { useMemo, useRef, memo } from 'react';\nimport Animated from 'react-native-reanimated';\nimport { PanGestureHandler } from 'react-native-gesture-handler';\nimport {\n useBottomSheetGestureHandlers,\n useBottomSheetInternal,\n} from '../../hooks';\nimport { GESTURE_SOURCE } from '../../constants';\nimport type { BottomSheetDraggableViewProps } from './types';\n\nconst BottomSheetDraggableViewComponent = ({\n gestureType = GESTURE_SOURCE.CONTENT,\n nativeGestureRef,\n refreshControlGestureRef,\n style,\n children,\n ...rest\n}: BottomSheetDraggableViewProps) => {\n //#region hooks\n const {\n enableContentPanningGesture,\n simultaneousHandlers: _providedSimultaneousHandlers,\n waitFor,\n activeOffsetX,\n activeOffsetY,\n failOffsetX,\n failOffsetY,\n } = useBottomSheetInternal();\n const { contentPanGestureHandler, scrollablePanGestureHandler } =\n useBottomSheetGestureHandlers();\n //#endregion\n\n //#region variables\n const panGestureRef = useRef(null);\n const gestureHandler = useMemo(\n () =>\n gestureType === GESTURE_SOURCE.CONTENT\n ? contentPanGestureHandler\n : scrollablePanGestureHandler,\n [gestureType, contentPanGestureHandler, scrollablePanGestureHandler]\n );\n const simultaneousHandlers = useMemo(() => {\n const refs = [];\n\n if (nativeGestureRef) {\n refs.push(nativeGestureRef);\n }\n\n if (refreshControlGestureRef) {\n refs.push(refreshControlGestureRef);\n }\n\n if (_providedSimultaneousHandlers) {\n if (Array.isArray(_providedSimultaneousHandlers)) {\n refs.push(..._providedSimultaneousHandlers);\n } else {\n refs.push(_providedSimultaneousHandlers);\n }\n }\n\n return refs;\n }, [\n _providedSimultaneousHandlers,\n nativeGestureRef,\n refreshControlGestureRef,\n ]);\n //#endregion\n\n return (\n \n \n {children}\n \n \n );\n};\n\nconst BottomSheetDraggableView = memo(BottomSheetDraggableViewComponent);\nBottomSheetDraggableView.displayName = 'BottomSheetDraggableView';\n\nexport default BottomSheetDraggableView;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetDraggableView/index.js b/lib/module/components/bottomSheetDraggableView/index.js new file mode 100644 index 000000000..712845034 --- /dev/null +++ b/lib/module/components/bottomSheetDraggableView/index.js @@ -0,0 +1,2 @@ +export { default } from './BottomSheetDraggableView'; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetDraggableView/index.js.map b/lib/module/components/bottomSheetDraggableView/index.js.map new file mode 100644 index 000000000..f43b956e1 --- /dev/null +++ b/lib/module/components/bottomSheetDraggableView/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":["default"],"mappings":"AAAA,SAASA,OAAT,QAAwB,4BAAxB","sourcesContent":["export { default } from './BottomSheetDraggableView';\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetFooter/BottomSheetFooter.js b/lib/module/components/bottomSheetFooter/BottomSheetFooter.js new file mode 100644 index 000000000..195fe1e93 --- /dev/null +++ b/lib/module/components/bottomSheetFooter/BottomSheetFooter.js @@ -0,0 +1,59 @@ +import React, { memo, useCallback, useMemo } from 'react'; +import Animated, { useAnimatedStyle } from 'react-native-reanimated'; +import { KEYBOARD_STATE } from '../../constants'; +import { useBottomSheetInternal } from '../../hooks'; +import { styles } from './styles'; + +function BottomSheetFooterComponent({ + animatedFooterPosition, + bottomInset = 0, + style, + children +}) { + //#region hooks + const { + animatedFooterHeight, + animatedKeyboardState + } = useBottomSheetInternal(); //#endregion + //#region styles + + const containerAnimatedStyle = useAnimatedStyle(() => { + let footerTranslateY = animatedFooterPosition.value; + /** + * Offset the bottom inset only when keyboard is not shown + */ + + if (animatedKeyboardState.value !== KEYBOARD_STATE.SHOWN) { + footerTranslateY = footerTranslateY - bottomInset; + } + + return { + transform: [{ + translateY: Math.max(0, footerTranslateY) + }] + }; + }, [bottomInset, animatedKeyboardState, animatedFooterPosition]); + const containerStyle = useMemo(() => [styles.container, style, containerAnimatedStyle], [style, containerAnimatedStyle]); //#endregion + //#region callbacks + + const handleContainerLayout = useCallback(({ + nativeEvent: { + layout: { + height + } + } + }) => { + animatedFooterHeight.value = height; + }, [animatedFooterHeight]); //#endregion + + return children !== null ? /*#__PURE__*/React.createElement(Animated.View, { + pointerEvents: "box-none", + onLayout: handleContainerLayout, + style: containerStyle + }, typeof children === 'function' ? children() : children) : null; +} + +const BottomSheetFooter = /*#__PURE__*/memo(BottomSheetFooterComponent); +BottomSheetFooter.displayName = 'BottomSheetFooter'; +export default BottomSheetFooter; +//# sourceMappingURL=BottomSheetFooter.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetFooter/BottomSheetFooter.js.map b/lib/module/components/bottomSheetFooter/BottomSheetFooter.js.map new file mode 100644 index 000000000..bd151fde1 --- /dev/null +++ b/lib/module/components/bottomSheetFooter/BottomSheetFooter.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheetFooter.tsx"],"names":["React","memo","useCallback","useMemo","Animated","useAnimatedStyle","KEYBOARD_STATE","useBottomSheetInternal","styles","BottomSheetFooterComponent","animatedFooterPosition","bottomInset","style","children","animatedFooterHeight","animatedKeyboardState","containerAnimatedStyle","footerTranslateY","value","SHOWN","transform","translateY","Math","max","containerStyle","container","handleContainerLayout","nativeEvent","layout","height","BottomSheetFooter","displayName"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,IAAhB,EAAsBC,WAAtB,EAAmCC,OAAnC,QAAkD,OAAlD;AAEA,OAAOC,QAAP,IAAmBC,gBAAnB,QAA2C,yBAA3C;AACA,SAASC,cAAT,QAA+B,iBAA/B;AACA,SAASC,sBAAT,QAAuC,aAAvC;AAEA,SAASC,MAAT,QAAuB,UAAvB;;AAEA,SAASC,0BAAT,CAAoC;AAClCC,EAAAA,sBADkC;AAElCC,EAAAA,WAAW,GAAG,CAFoB;AAGlCC,EAAAA,KAHkC;AAIlCC,EAAAA;AAJkC,CAApC,EAKkC;AAChC;AACA,QAAM;AAAEC,IAAAA,oBAAF;AAAwBC,IAAAA;AAAxB,MACJR,sBAAsB,EADxB,CAFgC,CAIhC;AAEA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AACC,WAAlB,GAAgC,mBAAhC;AAEA,eAAeD,iBAAf","sourcesContent":["import React, { memo, useCallback, useMemo } from 'react';\nimport { LayoutChangeEvent } from 'react-native';\nimport Animated, { useAnimatedStyle } from 'react-native-reanimated';\nimport { KEYBOARD_STATE } from '../../constants';\nimport { useBottomSheetInternal } from '../../hooks';\nimport type { BottomSheetDefaultFooterProps } from './types';\nimport { styles } from './styles';\n\nfunction BottomSheetFooterComponent({\n animatedFooterPosition,\n bottomInset = 0,\n style,\n children,\n}: BottomSheetDefaultFooterProps) {\n //#region hooks\n const { animatedFooterHeight, animatedKeyboardState } =\n useBottomSheetInternal();\n //#endregion\n\n //#region styles\n const containerAnimatedStyle = useAnimatedStyle(() => {\n let footerTranslateY = animatedFooterPosition.value;\n\n /**\n * Offset the bottom inset only when keyboard is not shown\n */\n if (animatedKeyboardState.value !== KEYBOARD_STATE.SHOWN) {\n footerTranslateY = footerTranslateY - bottomInset;\n }\n\n return {\n transform: [\n {\n translateY: Math.max(0, footerTranslateY),\n },\n ],\n };\n }, [bottomInset, animatedKeyboardState, animatedFooterPosition]);\n const containerStyle = useMemo(\n () => [styles.container, style, containerAnimatedStyle],\n [style, containerAnimatedStyle]\n );\n //#endregion\n\n //#region callbacks\n const handleContainerLayout = useCallback(\n ({\n nativeEvent: {\n layout: { height },\n },\n }: LayoutChangeEvent) => {\n animatedFooterHeight.value = height;\n },\n [animatedFooterHeight]\n );\n //#endregion\n\n return children !== null ? (\n \n {typeof children === 'function' ? children() : children}\n \n ) : null;\n}\n\nconst BottomSheetFooter = memo(BottomSheetFooterComponent);\nBottomSheetFooter.displayName = 'BottomSheetFooter';\n\nexport default BottomSheetFooter;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetFooter/index.js b/lib/module/components/bottomSheetFooter/index.js new file mode 100644 index 000000000..46c501568 --- /dev/null +++ b/lib/module/components/bottomSheetFooter/index.js @@ -0,0 +1,2 @@ +export { default } from './BottomSheetFooter'; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetFooter/index.js.map b/lib/module/components/bottomSheetFooter/index.js.map new file mode 100644 index 000000000..a7d9ec329 --- /dev/null +++ b/lib/module/components/bottomSheetFooter/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":["default"],"mappings":"AAAA,SAASA,OAAT,QAAwB,qBAAxB","sourcesContent":["export { default } from './BottomSheetFooter';\nexport type { BottomSheetFooterProps } from './types';\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetFooter/styles.js b/lib/module/components/bottomSheetFooter/styles.js new file mode 100644 index 000000000..452741c55 --- /dev/null +++ b/lib/module/components/bottomSheetFooter/styles.js @@ -0,0 +1,11 @@ +import { StyleSheet } from 'react-native'; +export const styles = StyleSheet.create({ + container: { + position: 'absolute', + top: 0, + left: 0, + right: 0, + zIndex: 9999 + } +}); +//# sourceMappingURL=styles.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetFooter/styles.js.map b/lib/module/components/bottomSheetFooter/styles.js.map new file mode 100644 index 000000000..7c6f8adde --- /dev/null +++ b/lib/module/components/bottomSheetFooter/styles.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["styles.ts"],"names":["StyleSheet","styles","create","container","position","top","left","right","zIndex"],"mappings":"AAAA,SAASA,UAAT,QAA2B,cAA3B;AAEA,OAAO,MAAMC,MAAM,GAAGD,UAAU,CAACE,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE;AACTC,IAAAA,QAAQ,EAAE,UADD;AAETC,IAAAA,GAAG,EAAE,CAFI;AAGTC,IAAAA,IAAI,EAAE,CAHG;AAITC,IAAAA,KAAK,EAAE,CAJE;AAKTC,IAAAA,MAAM,EAAE;AALC;AAD2B,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\n\nexport const styles = StyleSheet.create({\n container: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n zIndex: 9999,\n },\n});\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetFooterContainer/BottomSheetFooterContainer.js b/lib/module/components/bottomSheetFooterContainer/BottomSheetFooterContainer.js new file mode 100644 index 000000000..ffb9461fa --- /dev/null +++ b/lib/module/components/bottomSheetFooterContainer/BottomSheetFooterContainer.js @@ -0,0 +1,40 @@ +import React, { memo } from 'react'; +import { useDerivedValue } from 'react-native-reanimated'; +import { useBottomSheetInternal } from '../../hooks'; +import { KEYBOARD_STATE } from '../../constants'; + +const BottomSheetFooterContainerComponent = ({ + footerComponent: FooterComponent +}) => { + //#region hooks + const { + animatedContainerHeight, + animatedHandleHeight, + animatedFooterHeight, + animatedPosition, + animatedKeyboardState, + animatedKeyboardHeightInContainer + } = useBottomSheetInternal(); //#endregion + //#region variables + + const animatedFooterPosition = useDerivedValue(() => { + const keyboardHeight = animatedKeyboardHeightInContainer.value; + let footerTranslateY = Math.max(0, animatedContainerHeight.value - animatedPosition.value); + + if (animatedKeyboardState.value === KEYBOARD_STATE.SHOWN) { + footerTranslateY = footerTranslateY - keyboardHeight; + } + + footerTranslateY = footerTranslateY - animatedFooterHeight.value - animatedHandleHeight.value; + return footerTranslateY; + }, [animatedKeyboardHeightInContainer, animatedContainerHeight, animatedPosition, animatedKeyboardState, animatedFooterHeight, animatedHandleHeight]); //#endregion + + return /*#__PURE__*/React.createElement(FooterComponent, { + animatedFooterPosition: animatedFooterPosition + }); +}; + +const BottomSheetFooterContainer = /*#__PURE__*/memo(BottomSheetFooterContainerComponent); +BottomSheetFooterContainer.displayName = 'BottomSheetFooterContainer'; +export default BottomSheetFooterContainer; +//# sourceMappingURL=BottomSheetFooterContainer.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetFooterContainer/BottomSheetFooterContainer.js.map b/lib/module/components/bottomSheetFooterContainer/BottomSheetFooterContainer.js.map new file mode 100644 index 000000000..d0d616cd2 --- /dev/null +++ b/lib/module/components/bottomSheetFooterContainer/BottomSheetFooterContainer.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheetFooterContainer.tsx"],"names":["React","memo","useDerivedValue","useBottomSheetInternal","KEYBOARD_STATE","BottomSheetFooterContainerComponent","footerComponent","FooterComponent","animatedContainerHeight","animatedHandleHeight","animatedFooterHeight","animatedPosition","animatedKeyboardState","animatedKeyboardHeightInContainer","animatedFooterPosition","keyboardHeight","value","footerTranslateY","Math","max","SHOWN","BottomSheetFooterContainer","displayName"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,IAAhB,QAA4B,OAA5B;AACA,SAASC,eAAT,QAAgC,yBAAhC;AACA,SAASC,sBAAT,QAAuC,aAAvC;AACA,SAASC,cAAT,QAA+B,iBAA/B;;AAGA,MAAMC,mCAAmC,GAAG,CAAC;AAC3CC,EAAAA,eAAe,EAAEC;AAD0B,CAAD,KAEL;AACrC;AACA,QAAM;AACJC,IAAAA,uBADI;AAEJC,IAAAA,oBAFI;AAGJC,IAAAA,oBAHI;AAIJC,IAAAA,gBAJI;AAKJC,IAAAA,qBALI;AAMJC,IAAAA;AANI,MAOFV,sBAAsB,EAP1B,CAFqC,CAUrC;AAEA;;AACA,QAAMW,sBAAsB,GAAGZ,eAAe,CAAC,MAAM;AACnD,UAAMa,cAAc,GAAGF,iCAAiC,CAACG,KAAzD;AACA,QAAIC,gBAAgB,GAAGC,IAAI,CAACC,GAAL,CACrB,CADqB,EAErBX,uBAAuB,CAACQ,KAAxB,GAAgCL,gBAAgB,CAACK,KAF5B,CAAvB;;AAKA,QAAIJ,qBAAqB,CAACI,KAAtB,KAAgCZ,cAAc,CAACgB,KAAnD,EAA0D;AACxDH,MAAAA,gBAAgB,GAAGA,gBAAgB,GAAGF,cAAtC;AACD;;AAEDE,IAAAA,gBAAgB,GACdA,gBAAgB,GAChBP,oBAAoB,CAACM,KADrB,GAEAP,oBAAoB,CAACO,KAHvB;AAKA,WAAOC,gBAAP;AACD,GAjB6C,EAiB3C,CACDJ,iCADC,EAEDL,uBAFC,EAGDG,gBAHC,EAIDC,qBAJC,EAKDF,oBALC,EAMDD,oBANC,CAjB2C,CAA9C,CAbqC,CAsCrC;;AAEA,sBAAO,oBAAC,eAAD;AAAiB,IAAA,sBAAsB,EAAEK;AAAzC,IAAP;AACD,CA3CD;;AA6CA,MAAMO,0BAA0B,gBAAGpB,IAAI,CAACI,mCAAD,CAAvC;AACAgB,0BAA0B,CAACC,WAA3B,GAAyC,4BAAzC;AAEA,eAAeD,0BAAf","sourcesContent":["import React, { memo } from 'react';\nimport { useDerivedValue } from 'react-native-reanimated';\nimport { useBottomSheetInternal } from '../../hooks';\nimport { KEYBOARD_STATE } from '../../constants';\nimport type { BottomSheetFooterContainerProps } from './types';\n\nconst BottomSheetFooterContainerComponent = ({\n footerComponent: FooterComponent,\n}: BottomSheetFooterContainerProps) => {\n //#region hooks\n const {\n animatedContainerHeight,\n animatedHandleHeight,\n animatedFooterHeight,\n animatedPosition,\n animatedKeyboardState,\n animatedKeyboardHeightInContainer,\n } = useBottomSheetInternal();\n //#endregion\n\n //#region variables\n const animatedFooterPosition = useDerivedValue(() => {\n const keyboardHeight = animatedKeyboardHeightInContainer.value;\n let footerTranslateY = Math.max(\n 0,\n animatedContainerHeight.value - animatedPosition.value\n );\n\n if (animatedKeyboardState.value === KEYBOARD_STATE.SHOWN) {\n footerTranslateY = footerTranslateY - keyboardHeight;\n }\n\n footerTranslateY =\n footerTranslateY -\n animatedFooterHeight.value -\n animatedHandleHeight.value;\n\n return footerTranslateY;\n }, [\n animatedKeyboardHeightInContainer,\n animatedContainerHeight,\n animatedPosition,\n animatedKeyboardState,\n animatedFooterHeight,\n animatedHandleHeight,\n ]);\n //#endregion\n\n return ;\n};\n\nconst BottomSheetFooterContainer = memo(BottomSheetFooterContainerComponent);\nBottomSheetFooterContainer.displayName = 'BottomSheetFooterContainer';\n\nexport default BottomSheetFooterContainer;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.js b/lib/module/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.js new file mode 100644 index 000000000..adf81e285 --- /dev/null +++ b/lib/module/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.js @@ -0,0 +1,44 @@ +import React, { useMemo } from 'react'; +import { GESTURE_SOURCE } from '../../constants'; +import { useGestureHandler, useBottomSheetInternal, useGestureEventsHandlersDefault } from '../../hooks'; +import { BottomSheetGestureHandlersContext } from '../../contexts'; +import { useSharedValue } from 'react-native-reanimated'; + +const BottomSheetGestureHandlersProvider = ({ + gestureEventsHandlersHook: useGestureEventsHandlers = useGestureEventsHandlersDefault, + children +}) => { + //#region variables + const animatedGestureSource = useSharedValue(GESTURE_SOURCE.UNDETERMINED); //#endregion + //#region hooks + + const { + animatedContentGestureState, + animatedHandleGestureState + } = useBottomSheetInternal(); + const { + handleOnStart, + handleOnActive, + handleOnEnd + } = useGestureEventsHandlers(); //#endregion + //#region gestures + + const contentPanGestureHandler = useGestureHandler(GESTURE_SOURCE.CONTENT, animatedContentGestureState, animatedGestureSource, handleOnStart, handleOnActive, handleOnEnd); + const scrollablePanGestureHandler = useGestureHandler(GESTURE_SOURCE.SCROLLABLE, animatedContentGestureState, animatedGestureSource, handleOnStart, handleOnActive, handleOnEnd); + const handlePanGestureHandler = useGestureHandler(GESTURE_SOURCE.HANDLE, animatedHandleGestureState, animatedGestureSource, handleOnStart, handleOnActive, handleOnEnd); //#endregion + //#region context + + const contextValue = useMemo(() => ({ + contentPanGestureHandler, + handlePanGestureHandler, + scrollablePanGestureHandler, + animatedGestureSource + }), [contentPanGestureHandler, handlePanGestureHandler, scrollablePanGestureHandler, animatedGestureSource]); //#endregion + + return /*#__PURE__*/React.createElement(BottomSheetGestureHandlersContext.Provider, { + value: contextValue + }, children); +}; + +export default BottomSheetGestureHandlersProvider; +//# sourceMappingURL=BottomSheetGestureHandlersProvider.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.js.map b/lib/module/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.js.map new file mode 100644 index 000000000..58c9619a3 --- /dev/null +++ b/lib/module/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheetGestureHandlersProvider.tsx"],"names":["React","useMemo","GESTURE_SOURCE","useGestureHandler","useBottomSheetInternal","useGestureEventsHandlersDefault","BottomSheetGestureHandlersContext","useSharedValue","BottomSheetGestureHandlersProvider","gestureEventsHandlersHook","useGestureEventsHandlers","children","animatedGestureSource","UNDETERMINED","animatedContentGestureState","animatedHandleGestureState","handleOnStart","handleOnActive","handleOnEnd","contentPanGestureHandler","CONTENT","scrollablePanGestureHandler","SCROLLABLE","handlePanGestureHandler","HANDLE","contextValue"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,OAAhB,QAA+B,OAA/B;AACA,SAASC,cAAT,QAA+B,iBAA/B;AACA,SACEC,iBADF,EAEEC,sBAFF,EAGEC,+BAHF,QAIO,aAJP;AAKA,SAASC,iCAAT,QAAkD,gBAAlD;AAEA,SAASC,cAAT,QAA+B,yBAA/B;;AAEA,MAAMC,kCAAkC,GAAG,CAAC;AAC1CC,EAAAA,yBAAyB,EACvBC,wBAAwB,GAAGL,+BAFa;AAG1CM,EAAAA;AAH0C,CAAD,KAII;AAC7C;AACA,QAAMC,qBAAqB,GAAGL,cAAc,CAC1CL,cAAc,CAACW,YAD2B,CAA5C,CAF6C,CAK7C;AAEA;;AACA,QAAM;AAAEC,IAAAA,2BAAF;AAA+BC,IAAAA;AAA/B,MACJX,sBAAsB,EADxB;AAEA,QAAM;AAAEY,IAAAA,aAAF;AAAiBC,IAAAA,cAAjB;AAAiCC,IAAAA;AAAjC,MACJR,wBAAwB,EAD1B,CAV6C,CAY7C;AAEA;;AACA,QAAMS,wBAAwB,GAAGhB,iBAAiB,CAChDD,cAAc,CAACkB,OADiC,EAEhDN,2BAFgD,EAGhDF,qBAHgD,EAIhDI,aAJgD,EAKhDC,cALgD,EAMhDC,WANgD,CAAlD;AASA,QAAMG,2BAA2B,GAAGlB,iBAAiB,CACnDD,cAAc,CAACoB,UADoC,EAEnDR,2BAFmD,EAGnDF,qBAHmD,EAInDI,aAJmD,EAKnDC,cALmD,EAMnDC,WANmD,CAArD;AASA,QAAMK,uBAAuB,GAAGpB,iBAAiB,CAC/CD,cAAc,CAACsB,MADgC,EAE/CT,0BAF+C,EAG/CH,qBAH+C,EAI/CI,aAJ+C,EAK/CC,cAL+C,EAM/CC,WAN+C,CAAjD,CAjC6C,CAyC7C;AAEA;;AACA,QAAMO,YAAY,GAAGxB,OAAO,CAC1B,OAAO;AACLkB,IAAAA,wBADK;AAELI,IAAAA,uBAFK;AAGLF,IAAAA,2BAHK;AAILT,IAAAA;AAJK,GAAP,CAD0B,EAO1B,CACEO,wBADF,EAEEI,uBAFF,EAGEF,2BAHF,EAIET,qBAJF,CAP0B,CAA5B,CA5C6C,CA0D7C;;AACA,sBACE,oBAAC,iCAAD,CAAmC,QAAnC;AAA4C,IAAA,KAAK,EAAEa;AAAnD,KACGd,QADH,CADF;AAKD,CApED;;AAsEA,eAAeH,kCAAf","sourcesContent":["import React, { useMemo } from 'react';\nimport { GESTURE_SOURCE } from '../../constants';\nimport {\n useGestureHandler,\n useBottomSheetInternal,\n useGestureEventsHandlersDefault,\n} from '../../hooks';\nimport { BottomSheetGestureHandlersContext } from '../../contexts';\nimport type { BottomSheetGestureHandlersProviderProps } from './types';\nimport { useSharedValue } from 'react-native-reanimated';\n\nconst BottomSheetGestureHandlersProvider = ({\n gestureEventsHandlersHook:\n useGestureEventsHandlers = useGestureEventsHandlersDefault,\n children,\n}: BottomSheetGestureHandlersProviderProps) => {\n //#region variables\n const animatedGestureSource = useSharedValue(\n GESTURE_SOURCE.UNDETERMINED\n );\n //#endregion\n\n //#region hooks\n const { animatedContentGestureState, animatedHandleGestureState } =\n useBottomSheetInternal();\n const { handleOnStart, handleOnActive, handleOnEnd } =\n useGestureEventsHandlers();\n //#endregion\n\n //#region gestures\n const contentPanGestureHandler = useGestureHandler(\n GESTURE_SOURCE.CONTENT,\n animatedContentGestureState,\n animatedGestureSource,\n handleOnStart,\n handleOnActive,\n handleOnEnd\n );\n\n const scrollablePanGestureHandler = useGestureHandler(\n GESTURE_SOURCE.SCROLLABLE,\n animatedContentGestureState,\n animatedGestureSource,\n handleOnStart,\n handleOnActive,\n handleOnEnd\n );\n\n const handlePanGestureHandler = useGestureHandler(\n GESTURE_SOURCE.HANDLE,\n animatedHandleGestureState,\n animatedGestureSource,\n handleOnStart,\n handleOnActive,\n handleOnEnd\n );\n //#endregion\n\n //#region context\n const contextValue = useMemo(\n () => ({\n contentPanGestureHandler,\n handlePanGestureHandler,\n scrollablePanGestureHandler,\n animatedGestureSource,\n }),\n [\n contentPanGestureHandler,\n handlePanGestureHandler,\n scrollablePanGestureHandler,\n animatedGestureSource,\n ]\n );\n //#endregion\n return (\n \n {children}\n \n );\n};\n\nexport default BottomSheetGestureHandlersProvider;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetGestureHandlersProvider/index.js b/lib/module/components/bottomSheetGestureHandlersProvider/index.js new file mode 100644 index 000000000..9986d5a8e --- /dev/null +++ b/lib/module/components/bottomSheetGestureHandlersProvider/index.js @@ -0,0 +1,2 @@ +export { default } from './BottomSheetGestureHandlersProvider'; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetGestureHandlersProvider/index.js.map b/lib/module/components/bottomSheetGestureHandlersProvider/index.js.map new file mode 100644 index 000000000..695b74941 --- /dev/null +++ b/lib/module/components/bottomSheetGestureHandlersProvider/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":["default"],"mappings":"AAAA,SAASA,OAAT,QAAwB,sCAAxB","sourcesContent":["export { default } from './BottomSheetGestureHandlersProvider';\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetHandle/BottomSheetHandle.js b/lib/module/components/bottomSheetHandle/BottomSheetHandle.js new file mode 100644 index 000000000..e62a6ee71 --- /dev/null +++ b/lib/module/components/bottomSheetHandle/BottomSheetHandle.js @@ -0,0 +1,24 @@ +import React, { memo, useMemo } from 'react'; +import Animated from 'react-native-reanimated'; +import { styles } from './styles'; + +const BottomSheetHandleComponent = ({ + style, + indicatorStyle: _indicatorStyle, + children +}) => { + // styles + const containerStyle = useMemo(() => [styles.container, ...[Array.isArray(style) ? style : [style]]], [style]); + const indicatorStyle = useMemo(() => [styles.indicator, ...[Array.isArray(_indicatorStyle) ? _indicatorStyle : [_indicatorStyle]]], [_indicatorStyle]); // render + + return /*#__PURE__*/React.createElement(Animated.View, { + style: containerStyle + }, /*#__PURE__*/React.createElement(Animated.View, { + style: indicatorStyle + }), children); +}; + +const BottomSheetHandle = /*#__PURE__*/memo(BottomSheetHandleComponent); +BottomSheetHandle.displayName = 'BottomSheetHandle'; +export default BottomSheetHandle; +//# sourceMappingURL=BottomSheetHandle.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetHandle/BottomSheetHandle.js.map b/lib/module/components/bottomSheetHandle/BottomSheetHandle.js.map new file mode 100644 index 000000000..a25caa4f5 --- /dev/null +++ b/lib/module/components/bottomSheetHandle/BottomSheetHandle.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheetHandle.tsx"],"names":["React","memo","useMemo","Animated","styles","BottomSheetHandleComponent","style","indicatorStyle","_indicatorStyle","children","containerStyle","container","Array","isArray","indicator","BottomSheetHandle","displayName"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,IAAhB,EAAsBC,OAAtB,QAAqC,OAArC;AACA,OAAOC,QAAP,MAAqB,yBAArB;AACA,SAASC,MAAT,QAAuB,UAAvB;;AAGA,MAAMC,0BAA0B,GAAG,CAAC;AAClCC,EAAAA,KADkC;AAElCC,EAAAA,cAAc,EAAEC,eAFkB;AAGlCC,EAAAA;AAHkC,CAAD,KAIE;AACnC;AACA,QAAMC,cAAc,GAAGR,OAAO,CAC5B,MAAM,CAACE,MAAM,CAACO,SAAR,EAAmB,GAAG,CAACC,KAAK,CAACC,OAAN,CAAcP,KAAd,IAAuBA,KAAvB,GAA+B,CAACA,KAAD,CAAhC,CAAtB,CADsB,EAE5B,CAACA,KAAD,CAF4B,CAA9B;AAIA,QAAMC,cAAc,GAAGL,OAAO,CAC5B,MAAM,CACJE,MAAM,CAACU,SADH,EAEJ,GAAG,CAACF,KAAK,CAACC,OAAN,CAAcL,eAAd,IAAiCA,eAAjC,GAAmD,CAACA,eAAD,CAApD,CAFC,CADsB,EAK5B,CAACA,eAAD,CAL4B,CAA9B,CANmC,CAcnC;;AACA,sBACE,oBAAC,QAAD,CAAU,IAAV;AAAe,IAAA,KAAK,EAAEE;AAAtB,kBACE,oBAAC,QAAD,CAAU,IAAV;AAAe,IAAA,KAAK,EAAEH;AAAtB,IADF,EAEGE,QAFH,CADF;AAMD,CAzBD;;AA2BA,MAAMM,iBAAiB,gBAAGd,IAAI,CAACI,0BAAD,CAA9B;AACAU,iBAAiB,CAACC,WAAlB,GAAgC,mBAAhC;AAEA,eAAeD,iBAAf","sourcesContent":["import React, { memo, useMemo } from 'react';\nimport Animated from 'react-native-reanimated';\nimport { styles } from './styles';\nimport type { BottomSheetDefaultHandleProps } from './types';\n\nconst BottomSheetHandleComponent = ({\n style,\n indicatorStyle: _indicatorStyle,\n children,\n}: BottomSheetDefaultHandleProps) => {\n // styles\n const containerStyle = useMemo(\n () => [styles.container, ...[Array.isArray(style) ? style : [style]]],\n [style]\n );\n const indicatorStyle = useMemo(\n () => [\n styles.indicator,\n ...[Array.isArray(_indicatorStyle) ? _indicatorStyle : [_indicatorStyle]],\n ],\n [_indicatorStyle]\n );\n\n // render\n return (\n \n \n {children}\n \n );\n};\n\nconst BottomSheetHandle = memo(BottomSheetHandleComponent);\nBottomSheetHandle.displayName = 'BottomSheetHandle';\n\nexport default BottomSheetHandle;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetHandle/index.js b/lib/module/components/bottomSheetHandle/index.js new file mode 100644 index 000000000..02fec0d5d --- /dev/null +++ b/lib/module/components/bottomSheetHandle/index.js @@ -0,0 +1,2 @@ +export { default } from './BottomSheetHandle'; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetHandle/index.js.map b/lib/module/components/bottomSheetHandle/index.js.map new file mode 100644 index 000000000..cb4ce2add --- /dev/null +++ b/lib/module/components/bottomSheetHandle/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":["default"],"mappings":"AAAA,SAASA,OAAT,QAAwB,qBAAxB","sourcesContent":["export { default } from './BottomSheetHandle';\nexport type { BottomSheetHandleProps } from './types';\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetHandle/styles.js b/lib/module/components/bottomSheetHandle/styles.js new file mode 100644 index 000000000..b699f8706 --- /dev/null +++ b/lib/module/components/bottomSheetHandle/styles.js @@ -0,0 +1,15 @@ +import { StyleSheet } from 'react-native'; +import { WINDOW_WIDTH } from '../../constants'; +export const styles = StyleSheet.create({ + container: { + padding: 10 + }, + indicator: { + alignSelf: 'center', + width: 7.5 * WINDOW_WIDTH / 100, + height: 4, + borderRadius: 4, + backgroundColor: 'rgba(0, 0, 0, 0.75)' + } +}); +//# sourceMappingURL=styles.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetHandle/styles.js.map b/lib/module/components/bottomSheetHandle/styles.js.map new file mode 100644 index 000000000..7c9590974 --- /dev/null +++ b/lib/module/components/bottomSheetHandle/styles.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["styles.ts"],"names":["StyleSheet","WINDOW_WIDTH","styles","create","container","padding","indicator","alignSelf","width","height","borderRadius","backgroundColor"],"mappings":"AAAA,SAASA,UAAT,QAA2B,cAA3B;AACA,SAASC,YAAT,QAA6B,iBAA7B;AAEA,OAAO,MAAMC,MAAM,GAAGF,UAAU,CAACG,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE;AACTC,IAAAA,OAAO,EAAE;AADA,GAD2B;AAKtCC,EAAAA,SAAS,EAAE;AACTC,IAAAA,SAAS,EAAE,QADF;AAETC,IAAAA,KAAK,EAAG,MAAMP,YAAP,GAAuB,GAFrB;AAGTQ,IAAAA,MAAM,EAAE,CAHC;AAITC,IAAAA,YAAY,EAAE,CAJL;AAKTC,IAAAA,eAAe,EAAE;AALR;AAL2B,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\nimport { WINDOW_WIDTH } from '../../constants';\n\nexport const styles = StyleSheet.create({\n container: {\n padding: 10,\n },\n\n indicator: {\n alignSelf: 'center',\n width: (7.5 * WINDOW_WIDTH) / 100,\n height: 4,\n borderRadius: 4,\n backgroundColor: 'rgba(0, 0, 0, 0.75)',\n },\n});\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetHandleContainer/BottomSheetHandleContainer.js b/lib/module/components/bottomSheetHandleContainer/BottomSheetHandleContainer.js new file mode 100644 index 000000000..bd555bc7f --- /dev/null +++ b/lib/module/components/bottomSheetHandleContainer/BottomSheetHandleContainer.js @@ -0,0 +1,98 @@ +import React, { memo, useCallback, useMemo } from 'react'; +import { PanGestureHandler } from 'react-native-gesture-handler'; +import Animated from 'react-native-reanimated'; +import BottomSheetHandle from '../bottomSheetHandle'; +import { useBottomSheetGestureHandlers, useBottomSheetInternal } from '../../hooks'; +import { print } from '../../utilities'; + +function BottomSheetHandleContainerComponent({ + animatedIndex, + animatedPosition, + simultaneousHandlers: _internalSimultaneousHandlers, + enableHandlePanningGesture, + handleHeight, + handleComponent: _providedHandleComponent, + handleStyle: _providedHandleStyle, + handleIndicatorStyle: _providedIndicatorStyle +}) { + //#region hooks + const { + activeOffsetX, + activeOffsetY, + failOffsetX, + failOffsetY, + waitFor, + simultaneousHandlers: _providedSimultaneousHandlers + } = useBottomSheetInternal(); + const { + handlePanGestureHandler + } = useBottomSheetGestureHandlers(); //#endregion + //#region variables + + const simultaneousHandlers = useMemo(() => { + const refs = []; + + if (_internalSimultaneousHandlers) { + refs.push(_internalSimultaneousHandlers); + } + + if (_providedSimultaneousHandlers) { + if (Array.isArray(_providedSimultaneousHandlers)) { + refs.push(..._providedSimultaneousHandlers); + } else { + refs.push(_providedSimultaneousHandlers); + } + } + + return refs; + }, [_providedSimultaneousHandlers, _internalSimultaneousHandlers]); //#endregion + //#region callbacks + + const handleContainerLayout = useCallback(function handleContainerLayout({ + nativeEvent: { + layout: { + height + } + } + }) { + handleHeight.value = height; + print({ + component: BottomSheetHandleContainer.displayName, + method: 'handleContainerLayout', + params: { + height + } + }); + }, [handleHeight]); //#endregion + //#region renders + + const HandleComponent = _providedHandleComponent === undefined ? BottomSheetHandle : _providedHandleComponent; + return HandleComponent !== null ? /*#__PURE__*/React.createElement(PanGestureHandler, { + enabled: enableHandlePanningGesture, + waitFor: waitFor, + simultaneousHandlers: simultaneousHandlers, + shouldCancelWhenOutside: false, + activeOffsetX: activeOffsetX, + activeOffsetY: activeOffsetY, + failOffsetX: failOffsetX, + failOffsetY: failOffsetY, + onGestureEvent: handlePanGestureHandler + }, /*#__PURE__*/React.createElement(Animated.View, { + key: "BottomSheetHandleContainer", + accessible: true, + accessibilityRole: "adjustable", + accessibilityLabel: "Bottom Sheet handle", + accessibilityHint: "Drag up or down to extend or minimize the Bottom Sheet", + onLayout: handleContainerLayout + }, /*#__PURE__*/React.createElement(HandleComponent, { + animatedIndex: animatedIndex, + animatedPosition: animatedPosition, + style: _providedHandleStyle, + indicatorStyle: _providedIndicatorStyle + }))) : null; //#endregion +} + +const BottomSheetHandleContainer = /*#__PURE__*/memo(BottomSheetHandleContainerComponent); +BottomSheetHandleContainer.displayName = 'BottomSheetHandleContainer'; +export default BottomSheetHandleContainer; +//# sourceMappingURL=BottomSheetHandleContainer.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetHandleContainer/BottomSheetHandleContainer.js.map b/lib/module/components/bottomSheetHandleContainer/BottomSheetHandleContainer.js.map new file mode 100644 index 000000000..6a2829365 --- /dev/null +++ b/lib/module/components/bottomSheetHandleContainer/BottomSheetHandleContainer.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheetHandleContainer.tsx"],"names":["React","memo","useCallback","useMemo","PanGestureHandler","Animated","BottomSheetHandle","useBottomSheetGestureHandlers","useBottomSheetInternal","print","BottomSheetHandleContainerComponent","animatedIndex","animatedPosition","simultaneousHandlers","_internalSimultaneousHandlers","enableHandlePanningGesture","handleHeight","handleComponent","_providedHandleComponent","handleStyle","_providedHandleStyle","handleIndicatorStyle","_providedIndicatorStyle","activeOffsetX","activeOffsetY","failOffsetX","failOffsetY","waitFor","_providedSimultaneousHandlers","handlePanGestureHandler","refs","push","Array","isArray","handleContainerLayout","nativeEvent","layout","height","value","component","BottomSheetHandleContainer","displayName","method","params","HandleComponent","undefined"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,IAAhB,EAAsBC,WAAtB,EAAmCC,OAAnC,QAAkD,OAAlD;AAEA,SAASC,iBAAT,QAAkC,8BAAlC;AACA,OAAOC,QAAP,MAAqB,yBAArB;AACA,OAAOC,iBAAP,MAA8B,sBAA9B;AACA,SACEC,6BADF,EAEEC,sBAFF,QAGO,aAHP;AAIA,SAASC,KAAT,QAAsB,iBAAtB;;AAGA,SAASC,mCAAT,CAA6C;AAC3CC,EAAAA,aAD2C;AAE3CC,EAAAA,gBAF2C;AAG3CC,EAAAA,oBAAoB,EAAEC,6BAHqB;AAI3CC,EAAAA,0BAJ2C;AAK3CC,EAAAA,YAL2C;AAM3CC,EAAAA,eAAe,EAAEC,wBAN0B;AAO3CC,EAAAA,WAAW,EAAEC,oBAP8B;AAQ3CC,EAAAA,oBAAoB,EAAEC;AARqB,CAA7C,EASoC;AAClC;AACA,QAAM;AACJC,IAAAA,aADI;AAEJC,IAAAA,aAFI;AAGJC,IAAAA,WAHI;AAIJC,IAAAA,WAJI;AAKJC,IAAAA,OALI;AAMJd,IAAAA,oBAAoB,EAAEe;AANlB,MAOFpB,sBAAsB,EAP1B;AAQA,QAAM;AAAEqB,IAAAA;AAAF,MAA8BtB,6BAA6B,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AE,KAJ3B;AAKE,IAAA,aAAa,EAAEU,aALjB;AAME,IAAA,aAAa,EAAEC,aANjB;AAOE,IAAA,WAAW,EAAEC,WAPf;AAQE,IAAA,WAAW,EAAEC,WARf;AASE,IAAA,cAAc,EAAEG;AATlB,kBAWE,oBAAC,QAAD,CAAU,IAAV;AACE,IAAA,GAAG,EAAC,4BADN;AAEE,IAAA,UAAU,EAAE,IAFd;AAGE,IAAA,iBAAiB,EAAC,YAHpB;AAIE,IAAA,kBAAkB,EAAC,qBAJrB;AAKE,IAAA,iBAAiB,EAAC,wDALpB;AAME,IAAA,QAAQ,EAAEK;AANZ,kBAQE,oBAAC,eAAD;AACE,IAAA,aAAa,EAAEvB,aADjB;AAEE,IAAA,gBAAgB,EAAEC,gBAFpB;AAGE,IAAA,KAAK,EAAEQ,oBAHT;AAIE,IAAA,cAAc,EAAEE;AAJlB,IARF,CAXF,CADK,GA4BH,IA5BJ,CA3DkC,CAwFlC;AACD;;AAED,MAAMkB,0BAA0B,gBAAGvC,IAAI,CAACS,mCAAD,CAAvC;AACA8B,0BAA0B,CAACC,WAA3B,GAAyC,4BAAzC;AAEA,eAAeD,0BAAf","sourcesContent":["import React, { memo, useCallback, useMemo } from 'react';\nimport type { LayoutChangeEvent } from 'react-native';\nimport { PanGestureHandler } from 'react-native-gesture-handler';\nimport Animated from 'react-native-reanimated';\nimport BottomSheetHandle from '../bottomSheetHandle';\nimport {\n useBottomSheetGestureHandlers,\n useBottomSheetInternal,\n} from '../../hooks';\nimport { print } from '../../utilities';\nimport type { BottomSheetHandleContainerProps } from './types';\n\nfunction BottomSheetHandleContainerComponent({\n animatedIndex,\n animatedPosition,\n simultaneousHandlers: _internalSimultaneousHandlers,\n enableHandlePanningGesture,\n handleHeight,\n handleComponent: _providedHandleComponent,\n handleStyle: _providedHandleStyle,\n handleIndicatorStyle: _providedIndicatorStyle,\n}: BottomSheetHandleContainerProps) {\n //#region hooks\n const {\n activeOffsetX,\n activeOffsetY,\n failOffsetX,\n failOffsetY,\n waitFor,\n simultaneousHandlers: _providedSimultaneousHandlers,\n } = useBottomSheetInternal();\n const { handlePanGestureHandler } = useBottomSheetGestureHandlers();\n //#endregion\n\n //#region variables\n const simultaneousHandlers = useMemo(() => {\n const refs = [];\n\n if (_internalSimultaneousHandlers) {\n refs.push(_internalSimultaneousHandlers);\n }\n\n if (_providedSimultaneousHandlers) {\n if (Array.isArray(_providedSimultaneousHandlers)) {\n refs.push(..._providedSimultaneousHandlers);\n } else {\n refs.push(_providedSimultaneousHandlers);\n }\n }\n\n return refs;\n }, [_providedSimultaneousHandlers, _internalSimultaneousHandlers]);\n //#endregion\n\n //#region callbacks\n const handleContainerLayout = useCallback(\n function handleContainerLayout({\n nativeEvent: {\n layout: { height },\n },\n }: LayoutChangeEvent) {\n handleHeight.value = height;\n\n print({\n component: BottomSheetHandleContainer.displayName,\n method: 'handleContainerLayout',\n params: {\n height,\n },\n });\n },\n [handleHeight]\n );\n //#endregion\n\n //#region renders\n const HandleComponent =\n _providedHandleComponent === undefined\n ? BottomSheetHandle\n : _providedHandleComponent;\n return HandleComponent !== null ? (\n \n \n \n \n \n ) : null;\n //#endregion\n}\n\nconst BottomSheetHandleContainer = memo(BottomSheetHandleContainerComponent);\nBottomSheetHandleContainer.displayName = 'BottomSheetHandleContainer';\n\nexport default BottomSheetHandleContainer;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetHandleContainer/index.js b/lib/module/components/bottomSheetHandleContainer/index.js new file mode 100644 index 000000000..32c15660e --- /dev/null +++ b/lib/module/components/bottomSheetHandleContainer/index.js @@ -0,0 +1,2 @@ +export { default } from './BottomSheetHandleContainer'; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetHandleContainer/index.js.map b/lib/module/components/bottomSheetHandleContainer/index.js.map new file mode 100644 index 000000000..0c9996858 --- /dev/null +++ b/lib/module/components/bottomSheetHandleContainer/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":["default"],"mappings":"AAAA,SAASA,OAAT,QAAwB,8BAAxB","sourcesContent":["export { default } from './BottomSheetHandleContainer';\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetModal/BottomSheetModal.js b/lib/module/components/bottomSheetModal/BottomSheetModal.js new file mode 100644 index 000000000..933f45031 --- /dev/null +++ b/lib/module/components/bottomSheetModal/BottomSheetModal.js @@ -0,0 +1,363 @@ +function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } + +import React, { forwardRef, memo, useCallback, useImperativeHandle, useMemo, useRef, useState } from 'react'; +import { Portal, usePortal } from '@gorhom/portal'; +import BottomSheet from '../bottomSheet'; +import { useBottomSheetModalInternal } from '../../hooks'; +import { print } from '../../utilities'; +import { DEFAULT_STACK_BEHAVIOR, DEFAULT_ENABLE_DISMISS_ON_CLOSE } from './constants'; +import { id } from '../../utilities/id'; +const INITIAL_STATE = { + mount: false, + data: undefined +}; +const BottomSheetModalComponent = /*#__PURE__*/forwardRef(function BottomSheetModal(props, ref) { + const { + // modal props + name, + stackBehavior = DEFAULT_STACK_BEHAVIOR, + enableDismissOnClose = DEFAULT_ENABLE_DISMISS_ON_CLOSE, + onDismiss: _providedOnDismiss, + // bottom sheet props + index = 0, + snapPoints, + enablePanDownToClose = true, + animateOnMount = true, + containerComponent: ContainerComponent = React.Fragment, + // callbacks + onChange: _providedOnChange, + // components + children: Content, + ...bottomSheetProps + } = props; //#region state + + const [{ + mount, + data + }, setState] = useState(INITIAL_STATE); //#endregion + //#region hooks + + const { + containerHeight, + containerOffset, + mountSheet, + unmountSheet, + willUnmountSheet + } = useBottomSheetModalInternal(); + const { + removePortal: unmountPortal + } = usePortal(); //#endregion + //#region refs + + const bottomSheetRef = useRef(null); + const currentIndexRef = useRef(!animateOnMount ? index : -1); + const restoreIndexRef = useRef(-1); + const minimized = useRef(false); + const forcedDismissed = useRef(false); + const mounted = useRef(false); + mounted.current = mount; //#endregion + //#region variables + + const key = useMemo(() => name || `bottom-sheet-modal-${id()}`, [name]); //#endregion + //#region private methods + + const resetVariables = useCallback(function resetVariables() { + print({ + component: BottomSheetModal.name, + method: resetVariables.name + }); + currentIndexRef.current = -1; + restoreIndexRef.current = -1; + minimized.current = false; + mounted.current = false; + forcedDismissed.current = false; + }, []); + const unmount = useCallback(function unmount() { + print({ + component: BottomSheetModal.name, + method: unmount.name + }); + const _mounted = mounted.current; // reset variables + + resetVariables(); // unmount sheet and portal + + unmountSheet(key); + unmountPortal(key); // unmount the node, if sheet is still mounted + + if (_mounted) { + setState(INITIAL_STATE); + } // fire `onDismiss` callback + + + if (_providedOnDismiss) { + _providedOnDismiss(); + } + }, [key, resetVariables, unmountSheet, unmountPortal, _providedOnDismiss]); //#endregion + //#region bottom sheet methods + + const handleSnapToIndex = useCallback((...args) => { + var _bottomSheetRef$curre; + + if (minimized.current) { + return; + } + + (_bottomSheetRef$curre = bottomSheetRef.current) === null || _bottomSheetRef$curre === void 0 ? void 0 : _bottomSheetRef$curre.snapToIndex(...args); + }, []); + const handleSnapToPosition = useCallback((...args) => { + var _bottomSheetRef$curre2; + + if (minimized.current) { + return; + } + + (_bottomSheetRef$curre2 = bottomSheetRef.current) === null || _bottomSheetRef$curre2 === void 0 ? void 0 : _bottomSheetRef$curre2.snapToPosition(...args); + }, []); + const handleExpand = useCallback((...args) => { + var _bottomSheetRef$curre3; + + if (minimized.current) { + return; + } + + (_bottomSheetRef$curre3 = bottomSheetRef.current) === null || _bottomSheetRef$curre3 === void 0 ? void 0 : _bottomSheetRef$curre3.expand(...args); + }, []); + const handleCollapse = useCallback((...args) => { + var _bottomSheetRef$curre4; + + if (minimized.current) { + return; + } + + (_bottomSheetRef$curre4 = bottomSheetRef.current) === null || _bottomSheetRef$curre4 === void 0 ? void 0 : _bottomSheetRef$curre4.collapse(...args); + }, []); + const handleClose = useCallback((...args) => { + var _bottomSheetRef$curre5; + + if (minimized.current) { + return; + } + + (_bottomSheetRef$curre5 = bottomSheetRef.current) === null || _bottomSheetRef$curre5 === void 0 ? void 0 : _bottomSheetRef$curre5.close(...args); + }, []); + const handleForceClose = useCallback((...args) => { + var _bottomSheetRef$curre6; + + if (minimized.current) { + return; + } + + (_bottomSheetRef$curre6 = bottomSheetRef.current) === null || _bottomSheetRef$curre6 === void 0 ? void 0 : _bottomSheetRef$curre6.forceClose(...args); + }, []); //#endregion + //#region bottom sheet modal methods + + const handlePresent = useCallback(function handlePresent(_data) { + requestAnimationFrame(() => { + setState({ + mount: true, + data: _data + }); + mountSheet(key, ref, stackBehavior); + print({ + component: BottomSheetModal.name, + method: handlePresent.name + }); + }); + }, // eslint-disable-next-line react-hooks/exhaustive-deps + [key, stackBehavior, mountSheet]); + const handleDismiss = useCallback(function handleDismiss(animationConfigs) { + var _bottomSheetRef$curre7; + + print({ + component: BottomSheetModal.name, + method: handleDismiss.name, + params: { + currentIndexRef: currentIndexRef.current, + minimized: minimized.current + } + }); + /** + * if modal is already been dismiss, we exit the method. + */ + + if (currentIndexRef.current === -1 && minimized.current === false) { + return; + } + + if (minimized.current || currentIndexRef.current === -1 && enablePanDownToClose) { + unmount(); + return; + } + + willUnmountSheet(key); + forcedDismissed.current = true; + (_bottomSheetRef$curre7 = bottomSheetRef.current) === null || _bottomSheetRef$curre7 === void 0 ? void 0 : _bottomSheetRef$curre7.forceClose(animationConfigs); + }, [willUnmountSheet, unmount, key, enablePanDownToClose]); + const handleMinimize = useCallback(function handleMinimize() { + var _bottomSheetRef$curre8; + + print({ + component: BottomSheetModal.name, + method: handleMinimize.name, + params: { + minimized: minimized.current + } + }); + + if (minimized.current) { + return; + } + + minimized.current = true; + /** + * if modal got minimized before it finish its mounting + * animation, we set the `restoreIndexRef` to the + * provided index. + */ + + if (currentIndexRef.current === -1) { + restoreIndexRef.current = index; + } else { + restoreIndexRef.current = currentIndexRef.current; + } + + (_bottomSheetRef$curre8 = bottomSheetRef.current) === null || _bottomSheetRef$curre8 === void 0 ? void 0 : _bottomSheetRef$curre8.close(); + }, [index]); + const handleRestore = useCallback(function handleRestore() { + var _bottomSheetRef$curre9; + + print({ + component: BottomSheetModal.name, + method: handleRestore.name, + params: { + minimized: minimized.current, + forcedDismissed: forcedDismissed.current + } + }); + + if (!minimized.current || forcedDismissed.current) { + return; + } + + minimized.current = false; + (_bottomSheetRef$curre9 = bottomSheetRef.current) === null || _bottomSheetRef$curre9 === void 0 ? void 0 : _bottomSheetRef$curre9.snapToIndex(restoreIndexRef.current); + }, []); //#endregion + //#region callbacks + + const handlePortalOnUnmount = useCallback(function handlePortalOnUnmount() { + var _bottomSheetRef$curre10; + + print({ + component: BottomSheetModal.name, + method: handlePortalOnUnmount.name, + params: { + minimized: minimized.current, + forcedDismissed: forcedDismissed.current + } + }); + /** + * if modal is already been dismiss, we exit the method. + */ + + if (currentIndexRef.current === -1 && minimized.current === false) { + return; + } + + mounted.current = false; + forcedDismissed.current = true; + + if (minimized.current) { + unmount(); + return; + } + + willUnmountSheet(key); + (_bottomSheetRef$curre10 = bottomSheetRef.current) === null || _bottomSheetRef$curre10 === void 0 ? void 0 : _bottomSheetRef$curre10.close(); + }, [key, unmount, willUnmountSheet]); + const handlePortalRender = useCallback(function handlePortalRender(render) { + if (mounted.current) { + render(); + } + }, []); + const handleBottomSheetOnChange = useCallback(function handleBottomSheetOnChange(_index) { + print({ + component: BottomSheetModal.name, + method: handleBottomSheetOnChange.name, + params: { + minimized: minimized.current, + forcedDismissed: forcedDismissed.current + } + }); + currentIndexRef.current = _index; + + if (_providedOnChange) { + _providedOnChange(_index); + } + }, [_providedOnChange]); + const handleBottomSheetOnClose = useCallback(function handleBottomSheetOnClose() { + print({ + component: BottomSheetModal.name, + method: handleBottomSheetOnClose.name, + params: { + minimized: minimized.current, + forcedDismissed: forcedDismissed.current + } + }); + + if (minimized.current) { + return; + } + + if (enableDismissOnClose) { + unmount(); + } + }, [enableDismissOnClose, unmount]); //#endregion + //#region expose methods + + useImperativeHandle(ref, () => ({ + // sheet + snapToIndex: handleSnapToIndex, + snapToPosition: handleSnapToPosition, + expand: handleExpand, + collapse: handleCollapse, + close: handleClose, + forceClose: handleForceClose, + // modal methods + dismiss: handleDismiss, + present: handlePresent, + // internal + minimize: handleMinimize, + restore: handleRestore + })); //#endregion + // render + // console.log('BottomSheetModal', index, mount, data); + + return mount ? /*#__PURE__*/React.createElement(Portal, { + key: key, + name: key, + handleOnMount: handlePortalRender, + handleOnUpdate: handlePortalRender, + handleOnUnmount: handlePortalOnUnmount + }, /*#__PURE__*/React.createElement(ContainerComponent, { + key: key + }, /*#__PURE__*/React.createElement(BottomSheet, _extends({}, bottomSheetProps, { + ref: bottomSheetRef, + key: key, + index: index, + snapPoints: snapPoints, + enablePanDownToClose: enablePanDownToClose, + animateOnMount: animateOnMount, + containerHeight: containerHeight, + containerOffset: containerOffset, + onChange: handleBottomSheetOnChange, + onClose: handleBottomSheetOnClose, + children: typeof Content === 'function' ? /*#__PURE__*/React.createElement(Content, { + data: data + }) : Content, + $modal: true + })))) : null; +}); +const BottomSheetModal = /*#__PURE__*/memo(BottomSheetModalComponent); +BottomSheetModal.displayName = 'BottomSheetModal'; +export default BottomSheetModal; +//# sourceMappingURL=BottomSheetModal.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetModal/BottomSheetModal.js.map b/lib/module/components/bottomSheetModal/BottomSheetModal.js.map new file mode 100644 index 000000000..13e2351b2 --- /dev/null +++ b/lib/module/components/bottomSheetModal/BottomSheetModal.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheetModal.tsx"],"names":["React","forwardRef","memo","useCallback","useImperativeHandle","useMemo","useRef","useState","Portal","usePortal","BottomSheet","useBottomSheetModalInternal","print","DEFAULT_STACK_BEHAVIOR","DEFAULT_ENABLE_DISMISS_ON_CLOSE","id","INITIAL_STATE","mount","data","undefined","BottomSheetModalComponent","BottomSheetModal","props","ref","name","stackBehavior","enableDismissOnClose","onDismiss","_providedOnDismiss","index","snapPoints","enablePanDownToClose","animateOnMount","containerComponent","ContainerComponent","Fragment","onChange","_providedOnChange","children","Content","bottomSheetProps","setState","containerHeight","containerOffset","mountSheet","unmountSheet","willUnmountSheet","removePortal","unmountPortal","bottomSheetRef","currentIndexRef","restoreIndexRef","minimized","forcedDismissed","mounted","current","key","resetVariables","component","method","unmount","_mounted","handleSnapToIndex","args","snapToIndex","handleSnapToPosition","snapToPosition","handleExpand","expand","handleCollapse","collapse","handleClose","close","handleForceClose","forceClose","handlePresent","_data","requestAnimationFrame","handleDismiss","animationConfigs","params","handleMinimize","handleRestore","handlePortalOnUnmount","handlePortalRender","render","handleBottomSheetOnChange","_index","handleBottomSheetOnClose","dismiss","present","minimize","restore","displayName"],"mappings":";;AAAA,OAAOA,KAAP,IACEC,UADF,EAEEC,IAFF,EAGEC,WAHF,EAIEC,mBAJF,EAKEC,OALF,EAMEC,MANF,EAOEC,QAPF,QAQO,OARP;AASA,SAASC,MAAT,EAAiBC,SAAjB,QAAkC,gBAAlC;AACA,OAAOC,WAAP,MAAwB,gBAAxB;AACA,SAASC,2BAAT,QAA4C,aAA5C;AACA,SAASC,KAAT,QAAsB,iBAAtB;AACA,SACEC,sBADF,EAEEC,+BAFF,QAGO,aAHP;AAMA,SAASC,EAAT,QAAmB,oBAAnB;AAIA,MAAMC,aAGL,GAAG;AACFC,EAAAA,KAAK,EAAE,KADL;AAEFC,EAAAA,IAAI,EAAEC;AAFJ,CAHJ;AAQA,MAAMC,yBAAyB,gBAAGnB,UAAU,CAG1C,SAASoB,gBAAT,CAA0BC,KAA1B,EAAiCC,GAAjC,EAAsC;AACtC,QAAM;AACJ;AACAC,IAAAA,IAFI;AAGJC,IAAAA,aAAa,GAAGZ,sBAHZ;AAIJa,IAAAA,oBAAoB,GAAGZ,+BAJnB;AAKJa,IAAAA,SAAS,EAAEC,kBALP;AAOJ;AACAC,IAAAA,KAAK,GAAG,CARJ;AASJC,IAAAA,UATI;A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CAACkB,yBAAD,CAA7B;AACAC,gBAAgB,CAACwE,WAAjB,GAA+B,kBAA/B;AAEA,eAAexE,gBAAf","sourcesContent":["import React, {\n forwardRef,\n memo,\n useCallback,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { Portal, usePortal } from '@gorhom/portal';\nimport BottomSheet from '../bottomSheet';\nimport { useBottomSheetModalInternal } from '../../hooks';\nimport { print } from '../../utilities';\nimport {\n DEFAULT_STACK_BEHAVIOR,\n DEFAULT_ENABLE_DISMISS_ON_CLOSE,\n} from './constants';\nimport type { BottomSheetModalMethods, BottomSheetMethods } from '../../types';\nimport type { BottomSheetModalProps } from './types';\nimport { id } from '../../utilities/id';\n\ntype BottomSheetModal = BottomSheetModalMethods;\n\nconst INITIAL_STATE: {\n mount: boolean;\n data: any;\n} = {\n mount: false,\n data: undefined,\n};\n\nconst BottomSheetModalComponent = forwardRef<\n BottomSheetModal,\n BottomSheetModalProps\n>(function BottomSheetModal(props, ref) {\n const {\n // modal props\n name,\n stackBehavior = DEFAULT_STACK_BEHAVIOR,\n enableDismissOnClose = DEFAULT_ENABLE_DISMISS_ON_CLOSE,\n onDismiss: _providedOnDismiss,\n\n // bottom sheet props\n index = 0,\n snapPoints,\n enablePanDownToClose = true,\n animateOnMount = true,\n containerComponent: ContainerComponent = React.Fragment,\n\n // callbacks\n onChange: _providedOnChange,\n\n // components\n children: Content,\n ...bottomSheetProps\n } = props;\n\n //#region state\n const [{ mount, data }, setState] = useState(INITIAL_STATE);\n //#endregion\n\n //#region hooks\n const {\n containerHeight,\n containerOffset,\n mountSheet,\n unmountSheet,\n willUnmountSheet,\n } = useBottomSheetModalInternal();\n const { removePortal: unmountPortal } = usePortal();\n //#endregion\n\n //#region refs\n const bottomSheetRef = useRef(null);\n const currentIndexRef = useRef(!animateOnMount ? index : -1);\n const restoreIndexRef = useRef(-1);\n const minimized = useRef(false);\n const forcedDismissed = useRef(false);\n const mounted = useRef(false);\n mounted.current = mount;\n //#endregion\n\n //#region variables\n const key = useMemo(() => name || `bottom-sheet-modal-${id()}`, [name]);\n //#endregion\n\n //#region private methods\n const resetVariables = useCallback(function resetVariables() {\n print({\n component: BottomSheetModal.name,\n method: resetVariables.name,\n });\n currentIndexRef.current = -1;\n restoreIndexRef.current = -1;\n minimized.current = false;\n mounted.current = false;\n forcedDismissed.current = false;\n }, []);\n const unmount = useCallback(\n function unmount() {\n print({\n component: BottomSheetModal.name,\n method: unmount.name,\n });\n const _mounted = mounted.current;\n\n // reset variables\n resetVariables();\n\n // unmount sheet and portal\n unmountSheet(key);\n unmountPortal(key);\n\n // unmount the node, if sheet is still mounted\n if (_mounted) {\n setState(INITIAL_STATE);\n }\n\n // fire `onDismiss` callback\n if (_providedOnDismiss) {\n _providedOnDismiss();\n }\n },\n [key, resetVariables, unmountSheet, unmountPortal, _providedOnDismiss]\n );\n //#endregion\n\n //#region bottom sheet methods\n const handleSnapToIndex = useCallback(\n (...args) => {\n if (minimized.current) {\n return;\n }\n bottomSheetRef.current?.snapToIndex(...args);\n },\n []\n );\n const handleSnapToPosition = useCallback<\n BottomSheetMethods['snapToPosition']\n >((...args) => {\n if (minimized.current) {\n return;\n }\n bottomSheetRef.current?.snapToPosition(...args);\n }, []);\n const handleExpand = useCallback((...args) => {\n if (minimized.current) {\n return;\n }\n bottomSheetRef.current?.expand(...args);\n }, []);\n const handleCollapse = useCallback(\n (...args) => {\n if (minimized.current) {\n return;\n }\n bottomSheetRef.current?.collapse(...args);\n },\n []\n );\n const handleClose = useCallback((...args) => {\n if (minimized.current) {\n return;\n }\n bottomSheetRef.current?.close(...args);\n }, []);\n const handleForceClose = useCallback(\n (...args) => {\n if (minimized.current) {\n return;\n }\n bottomSheetRef.current?.forceClose(...args);\n },\n []\n );\n //#endregion\n\n //#region bottom sheet modal methods\n const handlePresent = useCallback(\n function handlePresent(_data?: any) {\n requestAnimationFrame(() => {\n setState({\n mount: true,\n data: _data,\n });\n mountSheet(key, ref, stackBehavior);\n\n print({\n component: BottomSheetModal.name,\n method: handlePresent.name,\n });\n });\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [key, stackBehavior, mountSheet]\n );\n const handleDismiss = useCallback(\n function handleDismiss(animationConfigs) {\n print({\n component: BottomSheetModal.name,\n method: handleDismiss.name,\n params: {\n currentIndexRef: currentIndexRef.current,\n minimized: minimized.current,\n },\n });\n /**\n * if modal is already been dismiss, we exit the method.\n */\n if (currentIndexRef.current === -1 && minimized.current === false) {\n return;\n }\n\n if (\n minimized.current ||\n (currentIndexRef.current === -1 && enablePanDownToClose)\n ) {\n unmount();\n return;\n }\n willUnmountSheet(key);\n forcedDismissed.current = true;\n bottomSheetRef.current?.forceClose(animationConfigs);\n },\n [willUnmountSheet, unmount, key, enablePanDownToClose]\n );\n const handleMinimize = useCallback(\n function handleMinimize() {\n print({\n component: BottomSheetModal.name,\n method: handleMinimize.name,\n params: {\n minimized: minimized.current,\n },\n });\n if (minimized.current) {\n return;\n }\n minimized.current = true;\n\n /**\n * if modal got minimized before it finish its mounting\n * animation, we set the `restoreIndexRef` to the\n * provided index.\n */\n if (currentIndexRef.current === -1) {\n restoreIndexRef.current = index;\n } else {\n restoreIndexRef.current = currentIndexRef.current;\n }\n bottomSheetRef.current?.close();\n },\n [index]\n );\n const handleRestore = useCallback(function handleRestore() {\n print({\n component: BottomSheetModal.name,\n method: handleRestore.name,\n params: {\n minimized: minimized.current,\n forcedDismissed: forcedDismissed.current,\n },\n });\n if (!minimized.current || forcedDismissed.current) {\n return;\n }\n minimized.current = false;\n bottomSheetRef.current?.snapToIndex(restoreIndexRef.current);\n }, []);\n //#endregion\n\n //#region callbacks\n const handlePortalOnUnmount = useCallback(\n function handlePortalOnUnmount() {\n print({\n component: BottomSheetModal.name,\n method: handlePortalOnUnmount.name,\n params: {\n minimized: minimized.current,\n forcedDismissed: forcedDismissed.current,\n },\n });\n /**\n * if modal is already been dismiss, we exit the method.\n */\n if (currentIndexRef.current === -1 && minimized.current === false) {\n return;\n }\n\n mounted.current = false;\n forcedDismissed.current = true;\n\n if (minimized.current) {\n unmount();\n return;\n }\n willUnmountSheet(key);\n bottomSheetRef.current?.close();\n },\n [key, unmount, willUnmountSheet]\n );\n const handlePortalRender = useCallback(function handlePortalRender(\n render: () => void\n ) {\n if (mounted.current) {\n render();\n }\n },\n []);\n const handleBottomSheetOnChange = useCallback(\n function handleBottomSheetOnChange(_index: number) {\n print({\n component: BottomSheetModal.name,\n method: handleBottomSheetOnChange.name,\n params: {\n minimized: minimized.current,\n forcedDismissed: forcedDismissed.current,\n },\n });\n currentIndexRef.current = _index;\n\n if (_providedOnChange) {\n _providedOnChange(_index);\n }\n },\n [_providedOnChange]\n );\n const handleBottomSheetOnClose = useCallback(\n function handleBottomSheetOnClose() {\n print({\n component: BottomSheetModal.name,\n method: handleBottomSheetOnClose.name,\n params: {\n minimized: minimized.current,\n forcedDismissed: forcedDismissed.current,\n },\n });\n\n if (minimized.current) {\n return;\n }\n\n if (enableDismissOnClose) {\n unmount();\n }\n },\n [enableDismissOnClose, unmount]\n );\n //#endregion\n\n //#region expose methods\n useImperativeHandle(ref, () => ({\n // sheet\n snapToIndex: handleSnapToIndex,\n snapToPosition: handleSnapToPosition,\n expand: handleExpand,\n collapse: handleCollapse,\n close: handleClose,\n forceClose: handleForceClose,\n // modal methods\n dismiss: handleDismiss,\n present: handlePresent,\n // internal\n minimize: handleMinimize,\n restore: handleRestore,\n }));\n //#endregion\n\n // render\n // console.log('BottomSheetModal', index, mount, data);\n return mount ? (\n \n \n : Content\n }\n $modal={true}\n />\n \n \n ) : null;\n});\n\nconst BottomSheetModal = memo(BottomSheetModalComponent);\nBottomSheetModal.displayName = 'BottomSheetModal';\n\nexport default BottomSheetModal;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetModal/constants.js b/lib/module/components/bottomSheetModal/constants.js new file mode 100644 index 000000000..b50566d8b --- /dev/null +++ b/lib/module/components/bottomSheetModal/constants.js @@ -0,0 +1,4 @@ +const DEFAULT_STACK_BEHAVIOR = 'replace'; +const DEFAULT_ENABLE_DISMISS_ON_CLOSE = true; +export { DEFAULT_STACK_BEHAVIOR, DEFAULT_ENABLE_DISMISS_ON_CLOSE }; +//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetModal/constants.js.map b/lib/module/components/bottomSheetModal/constants.js.map new file mode 100644 index 000000000..772655d09 --- /dev/null +++ b/lib/module/components/bottomSheetModal/constants.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["constants.ts"],"names":["DEFAULT_STACK_BEHAVIOR","DEFAULT_ENABLE_DISMISS_ON_CLOSE"],"mappings":"AAAA,MAAMA,sBAAsB,GAAG,SAA/B;AACA,MAAMC,+BAA+B,GAAG,IAAxC;AAEA,SAASD,sBAAT,EAAiCC,+BAAjC","sourcesContent":["const DEFAULT_STACK_BEHAVIOR = 'replace';\nconst DEFAULT_ENABLE_DISMISS_ON_CLOSE = true;\n\nexport { DEFAULT_STACK_BEHAVIOR, DEFAULT_ENABLE_DISMISS_ON_CLOSE };\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetModal/index.js b/lib/module/components/bottomSheetModal/index.js new file mode 100644 index 000000000..de4e3cf14 --- /dev/null +++ b/lib/module/components/bottomSheetModal/index.js @@ -0,0 +1,2 @@ +export { default } from './BottomSheetModal'; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetModal/index.js.map b/lib/module/components/bottomSheetModal/index.js.map new file mode 100644 index 000000000..768887316 --- /dev/null +++ b/lib/module/components/bottomSheetModal/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":["default"],"mappings":"AAAA,SAASA,OAAT,QAAwB,oBAAxB","sourcesContent":["export { default } from './BottomSheetModal';\nexport type {\n BottomSheetModalProps,\n BottomSheetModalPrivateMethods,\n BottomSheetModalStackBehavior,\n} from './types';\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetModalProvider/BottomSheetModalProvider.js b/lib/module/components/bottomSheetModalProvider/BottomSheetModalProvider.js new file mode 100644 index 000000000..347fbc2ac --- /dev/null +++ b/lib/module/components/bottomSheetModalProvider/BottomSheetModalProvider.js @@ -0,0 +1,178 @@ +import React, { useCallback, useMemo, useRef } from 'react'; +import { useSharedValue } from 'react-native-reanimated'; +import { PortalProvider } from '@gorhom/portal'; +import { BottomSheetModalProvider, BottomSheetModalInternalProvider } from '../../contexts'; +import BottomSheetContainer from '../bottomSheetContainer'; +import { MODAL_STACK_BEHAVIOR } from '../../constants'; +import { INITIAL_CONTAINER_HEIGHT, INITIAL_CONTAINER_OFFSET } from '../bottomSheet/constants'; + +const BottomSheetModalProviderWrapper = ({ + children +}) => { + //#region layout variables + const animatedContainerHeight = useSharedValue(INITIAL_CONTAINER_HEIGHT); + const animatedContainerOffset = useSharedValue(INITIAL_CONTAINER_OFFSET); //#endregion + //#region variables + + const sheetsQueueRef = useRef([]); //#endregion + //#region private methods + + const handleMountSheet = useCallback((key, ref, stackBehavior) => { + const _sheetsQueue = sheetsQueueRef.current.slice(); + + const sheetIndex = _sheetsQueue.findIndex(item => item.key === key); + + const sheetOnTop = sheetIndex === _sheetsQueue.length - 1; + /** + * Exit the method, if sheet is already presented + * and at the top. + */ + + if (sheetIndex !== -1 && sheetOnTop) { + return; + } + /** + * Minimize the current sheet if: + * - it exists. + * - it is not unmounting. + * - stack behavior is 'replace'. + */ + + + const currentMountedSheet = _sheetsQueue[_sheetsQueue.length - 1]; + + if (currentMountedSheet && !currentMountedSheet.willUnmount && stackBehavior === MODAL_STACK_BEHAVIOR.replace) { + var _currentMountedSheet$, _currentMountedSheet$2; + + (_currentMountedSheet$ = currentMountedSheet.ref) === null || _currentMountedSheet$ === void 0 ? void 0 : (_currentMountedSheet$2 = _currentMountedSheet$.current) === null || _currentMountedSheet$2 === void 0 ? void 0 : _currentMountedSheet$2.minimize(); + } + /** + * Restore and remove incoming sheet from the queue, + * if it was registered. + */ + + + if (sheetIndex !== -1) { + var _ref$current; + + _sheetsQueue.splice(sheetIndex, 1); + + ref === null || ref === void 0 ? void 0 : (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.restore(); + } + + _sheetsQueue.push({ + key, + ref, + willUnmount: false + }); + + sheetsQueueRef.current = _sheetsQueue; + }, []); + const handleUnmountSheet = useCallback(key => { + const _sheetsQueue = sheetsQueueRef.current.slice(); + + const sheetIndex = _sheetsQueue.findIndex(item => item.key === key); + + const sheetOnTop = sheetIndex === _sheetsQueue.length - 1; + /** + * Here we remove the unmounted sheet and update + * the sheets queue. + */ + + _sheetsQueue.splice(sheetIndex, 1); + + sheetsQueueRef.current = _sheetsQueue; + /** + * Here we try to restore previous sheet position if unmounted + * sheet was on top. This is needed when user dismiss + * the modal by panning down. + */ + + const hasMinimizedSheet = sheetsQueueRef.current.length > 0; + const minimizedSheet = sheetsQueueRef.current[sheetsQueueRef.current.length - 1]; + + if (sheetOnTop && hasMinimizedSheet && minimizedSheet && !minimizedSheet.willUnmount) { + var _sheetsQueueRef$curre, _sheetsQueueRef$curre2; + + (_sheetsQueueRef$curre = sheetsQueueRef.current[sheetsQueueRef.current.length - 1].ref) === null || _sheetsQueueRef$curre === void 0 ? void 0 : (_sheetsQueueRef$curre2 = _sheetsQueueRef$curre.current) === null || _sheetsQueueRef$curre2 === void 0 ? void 0 : _sheetsQueueRef$curre2.restore(); + } + }, []); + const handleWillUnmountSheet = useCallback(key => { + const _sheetsQueue = sheetsQueueRef.current.slice(); + + const sheetIndex = _sheetsQueue.findIndex(item => item.key === key); + + const sheetOnTop = sheetIndex === _sheetsQueue.length - 1; + /** + * Here we mark the sheet that will unmount, + * so it won't be restored. + */ + + if (sheetIndex !== -1) { + _sheetsQueue[sheetIndex].willUnmount = true; + } + /** + * Here we try to restore previous sheet position, + * This is needed when user dismiss the modal by fire the dismiss action. + */ + + + const hasMinimizedSheet = _sheetsQueue.length > 1; + + if (sheetOnTop && hasMinimizedSheet) { + var _sheetsQueue$ref, _sheetsQueue$ref$curr; + + (_sheetsQueue$ref = _sheetsQueue[_sheetsQueue.length - 2].ref) === null || _sheetsQueue$ref === void 0 ? void 0 : (_sheetsQueue$ref$curr = _sheetsQueue$ref.current) === null || _sheetsQueue$ref$curr === void 0 ? void 0 : _sheetsQueue$ref$curr.restore(); + } + + sheetsQueueRef.current = _sheetsQueue; + }, []); //#endregion + //#region public methods + + const handleDismiss = useCallback(key => { + const sheetToBeDismissed = key ? sheetsQueueRef.current.find(item => item.key === key) : sheetsQueueRef.current[sheetsQueueRef.current.length - 1]; + + if (sheetToBeDismissed) { + var _sheetToBeDismissed$r, _sheetToBeDismissed$r2; + + (_sheetToBeDismissed$r = sheetToBeDismissed.ref) === null || _sheetToBeDismissed$r === void 0 ? void 0 : (_sheetToBeDismissed$r2 = _sheetToBeDismissed$r.current) === null || _sheetToBeDismissed$r2 === void 0 ? void 0 : _sheetToBeDismissed$r2.dismiss(); + return true; + } + + return false; + }, []); + const handleDismissAll = useCallback(() => { + sheetsQueueRef.current.map(item => { + var _item$ref, _item$ref$current; + + (_item$ref = item.ref) === null || _item$ref === void 0 ? void 0 : (_item$ref$current = _item$ref.current) === null || _item$ref$current === void 0 ? void 0 : _item$ref$current.dismiss(); + }); + }, []); //#endregion + //#region context variables + + const externalContextVariables = useMemo(() => ({ + dismiss: handleDismiss, + dismissAll: handleDismissAll + }), [handleDismiss, handleDismissAll]); + const internalContextVariables = useMemo(() => ({ + containerHeight: animatedContainerHeight, + containerOffset: animatedContainerOffset, + mountSheet: handleMountSheet, + unmountSheet: handleUnmountSheet, + willUnmountSheet: handleWillUnmountSheet + }), [animatedContainerHeight, animatedContainerOffset, handleMountSheet, handleUnmountSheet, handleWillUnmountSheet]); //#endregion + //#region renders + + return /*#__PURE__*/React.createElement(BottomSheetModalProvider, { + value: externalContextVariables + }, /*#__PURE__*/React.createElement(BottomSheetModalInternalProvider, { + value: internalContextVariables + }, /*#__PURE__*/React.createElement(BottomSheetContainer, { + containerOffset: animatedContainerOffset, + containerHeight: animatedContainerHeight, + children: null + }), /*#__PURE__*/React.createElement(PortalProvider, null, children))); //#endregion +}; + +export default BottomSheetModalProviderWrapper; +//# sourceMappingURL=BottomSheetModalProvider.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetModalProvider/BottomSheetModalProvider.js.map b/lib/module/components/bottomSheetModalProvider/BottomSheetModalProvider.js.map new file mode 100644 index 000000000..421016054 --- /dev/null +++ b/lib/module/components/bottomSheetModalProvider/BottomSheetModalProvider.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheetModalProvider.tsx"],"names":["React","useCallback","useMemo","useRef","useSharedValue","PortalProvider","BottomSheetModalProvider","BottomSheetModalInternalProvider","BottomSheetContainer","MODAL_STACK_BEHAVIOR","INITIAL_CONTAINER_HEIGHT","INITIAL_CONTAINER_OFFSET","BottomSheetModalProviderWrapper","children","animatedContainerHeight","animatedContainerOffset","sheetsQueueRef","handleMountSheet","key","ref","stackBehavior","_sheetsQueue","current","slice","sheetIndex","findIndex","item","sheetOnTop","length","currentMountedSheet","willUnmount","replace","minimize","splice","restore","push","handleUnmountSheet","hasMinimizedSheet","minimizedSheet","handleWillUnmountSheet","handleDismiss","sheetToBeDismissed","find","dismiss","handleDismissAll","map","externalContextVariables","dismissAll","internalContextVariables","containerHeight","containerOffset","mountSheet","unmountSheet","willUnmountSheet"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,WAAhB,EAA6BC,OAA7B,EAAsCC,MAAtC,QAAoD,OAApD;AACA,SAASC,cAAT,QAA+B,yBAA/B;AACA,SAASC,cAAT,QAA+B,gBAA/B;AACA,SACEC,wBADF,EAEEC,gCAFF,QAGO,gBAHP;AAIA,OAAOC,oBAAP,MAAiC,yBAAjC;AACA,SAASC,oBAAT,QAAqC,iBAArC;AACA,SACEC,wBADF,EAEEC,wBAFF,QAGO,0BAHP;;AAUA,MAAMC,+BAA+B,GAAG,CAAC;AACvCC,EAAAA;AADuC,CAAD,KAEH;AACnC;AACA,QAAMC,uBAAuB,GAA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EAAmBqB,OAAnB;AACD,KAFD;AAGD,GAJmC,EAIjC,EAJiC,CAApC,CA9HmC,CAmInC;AAEA;;AACA,QAAMG,wBAAwB,GAAG5C,OAAO,CACtC,OAAO;AACLyC,IAAAA,OAAO,EAAEH,aADJ;AAELO,IAAAA,UAAU,EAAEH;AAFP,GAAP,CADsC,EAKtC,CAACJ,aAAD,EAAgBI,gBAAhB,CALsC,CAAxC;AAOA,QAAMI,wBAAwB,GAAG9C,OAAO,CACtC,OAAO;AACL+C,IAAAA,eAAe,EAAEnC,uBADZ;AAELoC,IAAAA,eAAe,EAAEnC,uBAFZ;AAGLoC,IAAAA,UAAU,EAAElC,gBAHP;AAILmC,IAAAA,YAAY,EAAEhB,kBAJT;AAKLiB,IAAAA,gBAAgB,EAAEd;AALb,GAAP,CADsC,EAQtC,CACEzB,uBADF,EAEEC,uBAFF,EAGEE,gBAHF,EAIEmB,kBAJF,EAKEG,sBALF,CARsC,CAAxC,CA7ImC,CA6JnC;AAEA;;AACA,sBACE,oBAAC,wBAAD;AAA0B,IAAA,KAAK,EAAEO;AAAjC,kBACE,oBAAC,gCAAD;AAAkC,IAAA,KAAK,EAAEE;AAAzC,kBACE,oBAAC,oBAAD;AACE,IAAA,eAAe,EAAEjC,uBADnB;AAEE,IAAA,eAAe,EAAED,uBAFnB;AAGE,IAAA,QAAQ,EAAE;AAHZ,IADF,eAME,oBAAC,cAAD,QAAiBD,QAAjB,CANF,CADF,CADF,CAhKmC,CA4KnC;AACD,CA/KD;;AAiLA,eAAeD,+BAAf","sourcesContent":["import React, { useCallback, useMemo, useRef } from 'react';\nimport { useSharedValue } from 'react-native-reanimated';\nimport { PortalProvider } from '@gorhom/portal';\nimport {\n BottomSheetModalProvider,\n BottomSheetModalInternalProvider,\n} from '../../contexts';\nimport BottomSheetContainer from '../bottomSheetContainer';\nimport { MODAL_STACK_BEHAVIOR } from '../../constants';\nimport {\n INITIAL_CONTAINER_HEIGHT,\n INITIAL_CONTAINER_OFFSET,\n} from '../bottomSheet/constants';\nimport type { BottomSheetModalStackBehavior } from '../bottomSheetModal';\nimport type {\n BottomSheetModalProviderProps,\n BottomSheetModalRef,\n} from './types';\n\nconst BottomSheetModalProviderWrapper = ({\n children,\n}: BottomSheetModalProviderProps) => {\n //#region layout variables\n const animatedContainerHeight = useSharedValue(INITIAL_CONTAINER_HEIGHT);\n const animatedContainerOffset = useSharedValue(INITIAL_CONTAINER_OFFSET);\n //#endregion\n\n //#region variables\n const sheetsQueueRef = useRef([]);\n //#endregion\n\n //#region private methods\n const handleMountSheet = useCallback(\n (key: string, ref: any, stackBehavior: BottomSheetModalStackBehavior) => {\n const _sheetsQueue = sheetsQueueRef.current.slice();\n const sheetIndex = _sheetsQueue.findIndex(item => item.key === key);\n const sheetOnTop = sheetIndex === _sheetsQueue.length - 1;\n\n /**\n * Exit the method, if sheet is already presented\n * and at the top.\n */\n if (sheetIndex !== -1 && sheetOnTop) {\n return;\n }\n\n /**\n * Minimize the current sheet if:\n * - it exists.\n * - it is not unmounting.\n * - stack behavior is 'replace'.\n */\n const currentMountedSheet = _sheetsQueue[_sheetsQueue.length - 1];\n if (\n currentMountedSheet &&\n !currentMountedSheet.willUnmount &&\n stackBehavior === MODAL_STACK_BEHAVIOR.replace\n ) {\n currentMountedSheet.ref?.current?.minimize();\n }\n\n /**\n * Restore and remove incoming sheet from the queue,\n * if it was registered.\n */\n if (sheetIndex !== -1) {\n _sheetsQueue.splice(sheetIndex, 1);\n ref?.current?.restore();\n }\n\n _sheetsQueue.push({\n key,\n ref,\n willUnmount: false,\n });\n sheetsQueueRef.current = _sheetsQueue;\n },\n []\n );\n const handleUnmountSheet = useCallback((key: string) => {\n const _sheetsQueue = sheetsQueueRef.current.slice();\n const sheetIndex = _sheetsQueue.findIndex(item => item.key === key);\n const sheetOnTop = sheetIndex === _sheetsQueue.length - 1;\n\n /**\n * Here we remove the unmounted sheet and update\n * the sheets queue.\n */\n _sheetsQueue.splice(sheetIndex, 1);\n sheetsQueueRef.current = _sheetsQueue;\n\n /**\n * Here we try to restore previous sheet position if unmounted\n * sheet was on top. This is needed when user dismiss\n * the modal by panning down.\n */\n const hasMinimizedSheet = sheetsQueueRef.current.length > 0;\n const minimizedSheet =\n sheetsQueueRef.current[sheetsQueueRef.current.length - 1];\n if (\n sheetOnTop &&\n hasMinimizedSheet &&\n minimizedSheet &&\n !minimizedSheet.willUnmount\n ) {\n sheetsQueueRef.current[\n sheetsQueueRef.current.length - 1\n ].ref?.current?.restore();\n }\n }, []);\n const handleWillUnmountSheet = useCallback((key: string) => {\n const _sheetsQueue = sheetsQueueRef.current.slice();\n const sheetIndex = _sheetsQueue.findIndex(item => item.key === key);\n const sheetOnTop = sheetIndex === _sheetsQueue.length - 1;\n\n /**\n * Here we mark the sheet that will unmount,\n * so it won't be restored.\n */\n if (sheetIndex !== -1) {\n _sheetsQueue[sheetIndex].willUnmount = true;\n }\n\n /**\n * Here we try to restore previous sheet position,\n * This is needed when user dismiss the modal by fire the dismiss action.\n */\n const hasMinimizedSheet = _sheetsQueue.length > 1;\n if (sheetOnTop && hasMinimizedSheet) {\n _sheetsQueue[_sheetsQueue.length - 2].ref?.current?.restore();\n }\n\n sheetsQueueRef.current = _sheetsQueue;\n }, []);\n //#endregion\n\n //#region public methods\n const handleDismiss = useCallback((key?: string) => {\n const sheetToBeDismissed = key\n ? sheetsQueueRef.current.find(item => item.key === key)\n : sheetsQueueRef.current[sheetsQueueRef.current.length - 1];\n if (sheetToBeDismissed) {\n sheetToBeDismissed.ref?.current?.dismiss();\n return true;\n }\n return false;\n }, []);\n const handleDismissAll = useCallback(() => {\n sheetsQueueRef.current.map(item => {\n item.ref?.current?.dismiss();\n });\n }, []);\n //#endregion\n\n //#region context variables\n const externalContextVariables = useMemo(\n () => ({\n dismiss: handleDismiss,\n dismissAll: handleDismissAll,\n }),\n [handleDismiss, handleDismissAll]\n );\n const internalContextVariables = useMemo(\n () => ({\n containerHeight: animatedContainerHeight,\n containerOffset: animatedContainerOffset,\n mountSheet: handleMountSheet,\n unmountSheet: handleUnmountSheet,\n willUnmountSheet: handleWillUnmountSheet,\n }),\n [\n animatedContainerHeight,\n animatedContainerOffset,\n handleMountSheet,\n handleUnmountSheet,\n handleWillUnmountSheet,\n ]\n );\n //#endregion\n\n //#region renders\n return (\n \n \n \n {children}\n \n \n );\n //#endregion\n};\n\nexport default BottomSheetModalProviderWrapper;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetModalProvider/index.js b/lib/module/components/bottomSheetModalProvider/index.js new file mode 100644 index 000000000..a81da684b --- /dev/null +++ b/lib/module/components/bottomSheetModalProvider/index.js @@ -0,0 +1,2 @@ +export { default } from './BottomSheetModalProvider'; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetModalProvider/index.js.map b/lib/module/components/bottomSheetModalProvider/index.js.map new file mode 100644 index 000000000..5a4c2f3d1 --- /dev/null +++ b/lib/module/components/bottomSheetModalProvider/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":["default"],"mappings":"AAAA,SAASA,OAAT,QAAwB,4BAAxB","sourcesContent":["export { default } from './BottomSheetModalProvider';\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.js b/lib/module/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.js new file mode 100644 index 000000000..572a150f1 --- /dev/null +++ b/lib/module/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.js @@ -0,0 +1,34 @@ +function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } + +import React, { forwardRef, memo } from 'react'; +import { RefreshControl } from 'react-native'; +import { NativeViewGestureHandler } from 'react-native-gesture-handler'; +import Animated, { useAnimatedProps } from 'react-native-reanimated'; +import { SCROLLABLE_STATE } from '../../constants'; +import { useBottomSheetInternal } from '../../hooks'; +const AnimatedRefreshControl = Animated.createAnimatedComponent(RefreshControl); +const BottomSheetRefreshControlComponent = /*#__PURE__*/forwardRef(({ + onRefresh, + ...rest +}, ref) => { + // hooks + const { + animatedScrollableState + } = useBottomSheetInternal(); // variables + + const animatedProps = useAnimatedProps(() => ({ + enabled: animatedScrollableState.value === SCROLLABLE_STATE.UNLOCKED + })); // render + + return /*#__PURE__*/React.createElement(NativeViewGestureHandler, { + ref: ref, + shouldCancelWhenOutside: false + }, /*#__PURE__*/React.createElement(AnimatedRefreshControl, _extends({}, rest, { + onRefresh: onRefresh, + animatedProps: animatedProps + }))); +}); +const BottomSheetRefreshControl = /*#__PURE__*/memo(BottomSheetRefreshControlComponent); +BottomSheetRefreshControl.displayName = 'BottomSheetRefreshControl'; +export default BottomSheetRefreshControl; +//# sourceMappingURL=BottomSheetRefreshControl.android.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.js.map b/lib/module/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.js.map new file mode 100644 index 000000000..4a970b372 --- /dev/null +++ b/lib/module/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheetRefreshControl.android.tsx"],"names":["React","forwardRef","memo","RefreshControl","NativeViewGestureHandler","Animated","useAnimatedProps","SCROLLABLE_STATE","useBottomSheetInternal","AnimatedRefreshControl","createAnimatedComponent","BottomSheetRefreshControlComponent","onRefresh","rest","ref","animatedScrollableState","animatedProps","enabled","value","UNLOCKED","BottomSheetRefreshControl","displayName"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,UAAhB,EAA4BC,IAA5B,QAAwC,OAAxC;AACA,SAASC,cAAT,QAAoD,cAApD;AACA,SAASC,wBAAT,QAAyC,8BAAzC;AACA,OAAOC,QAAP,IAAmBC,gBAAnB,QAA2C,yBAA3C;AACA,SAASC,gBAAT,QAAiC,iBAAjC;AACA,SAASC,sBAAT,QAAuC,aAAvC;AAEA,MAAMC,sBAAsB,GAAGJ,QAAQ,CAACK,uBAAT,CAAiCP,cAAjC,CAA/B;AAEA,MAAMQ,kCAAkC,gBAAGV,UAAU,CAGnD,CAAC;AAAEW,EAAAA,SAAF;AAAa,KAAGC;AAAhB,CAAD,EAAyBC,GAAzB,KAAiC;AACjC;AACA,QAAM;AAAEC,IAAAA;AAAF,MAA8BP,sBAAsB,EAA1D,CAFiC,CAIjC;;AACA,QAAMQ,aAAa,GAAGV,gBAAgB,CAAC,OAAO;AAC5CW,IAAAA,OAAO,EAAEF,uBAAuB,CAACG,KAAxB,KAAkCX,gBAAgB,CAACY;AADhB,GAAP,CAAD,CAAtC,CALiC,CASjC;;AACA,sBACE,oBAAC,wBAAD;AAA0B,IAAA,GAAG,EAAEL,GAA/B;AAAoC,IAAA,uBAAuB,EAAE;AAA7D,kBACE,oBAAC,sBAAD,eACMD,IADN;AAEE,IAAA,SAAS,EAAED,SAFb;AAGE,IAAA,aAAa,EAAEI;AAHjB,KADF,CADF;AASD,CAtBoD,CAArD;AAwBA,MAAMI,yBAAyB,gBAAGlB,IAAI,CAACS,kCAAD,CAAtC;AACAS,yBAAyB,CAACC,WAA1B,GAAwC,2BAAxC;AAEA,eAAeD,yBAAf","sourcesContent":["import React, { forwardRef, memo } from 'react';\nimport { RefreshControl, RefreshControlProps } from 'react-native';\nimport { NativeViewGestureHandler } from 'react-native-gesture-handler';\nimport Animated, { useAnimatedProps } from 'react-native-reanimated';\nimport { SCROLLABLE_STATE } from '../../constants';\nimport { useBottomSheetInternal } from '../../hooks';\n\nconst AnimatedRefreshControl = Animated.createAnimatedComponent(RefreshControl);\n\nconst BottomSheetRefreshControlComponent = forwardRef<\n NativeViewGestureHandler,\n RefreshControlProps\n>(({ onRefresh, ...rest }, ref) => {\n // hooks\n const { animatedScrollableState } = useBottomSheetInternal();\n\n // variables\n const animatedProps = useAnimatedProps(() => ({\n enabled: animatedScrollableState.value === SCROLLABLE_STATE.UNLOCKED,\n }));\n\n // render\n return (\n \n \n \n );\n});\n\nconst BottomSheetRefreshControl = memo(BottomSheetRefreshControlComponent);\nBottomSheetRefreshControl.displayName = 'BottomSheetRefreshControl';\n\nexport default BottomSheetRefreshControl;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetRefreshControl/BottomSheetRefreshControl.js b/lib/module/components/bottomSheetRefreshControl/BottomSheetRefreshControl.js new file mode 100644 index 000000000..7b9fb2511 --- /dev/null +++ b/lib/module/components/bottomSheetRefreshControl/BottomSheetRefreshControl.js @@ -0,0 +1,2 @@ +export default (() => null); +//# sourceMappingURL=BottomSheetRefreshControl.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetRefreshControl/BottomSheetRefreshControl.js.map b/lib/module/components/bottomSheetRefreshControl/BottomSheetRefreshControl.js.map new file mode 100644 index 000000000..bbcb4623b --- /dev/null +++ b/lib/module/components/bottomSheetRefreshControl/BottomSheetRefreshControl.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheetRefreshControl.tsx"],"names":[],"mappings":"AAAA,gBAAe,MAAM,IAArB","sourcesContent":["export default () => null;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetRefreshControl/index.js b/lib/module/components/bottomSheetRefreshControl/index.js new file mode 100644 index 000000000..bba4151b7 --- /dev/null +++ b/lib/module/components/bottomSheetRefreshControl/index.js @@ -0,0 +1,3 @@ +import BottomSheetRefreshControl from './BottomSheetRefreshControl'; +export default BottomSheetRefreshControl; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetRefreshControl/index.js.map b/lib/module/components/bottomSheetRefreshControl/index.js.map new file mode 100644 index 000000000..be8cf517e --- /dev/null +++ b/lib/module/components/bottomSheetRefreshControl/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":["BottomSheetRefreshControl"],"mappings":"AAGA,OAAOA,yBAAP,MAAsC,6BAAtC;AAEA,eAAeA,yBAAf","sourcesContent":["import type React from 'react';\nimport type { RefreshControlProps } from 'react-native';\nimport type { NativeViewGestureHandlerProps } from 'react-native-gesture-handler';\nimport BottomSheetRefreshControl from './BottomSheetRefreshControl';\n\nexport default BottomSheetRefreshControl as any as React.MemoExoticComponent<\n React.ForwardRefExoticComponent<\n RefreshControlProps & {\n children: React.ReactNode | React.ReactNode[];\n } & React.RefAttributes<\n React.ComponentType<\n NativeViewGestureHandlerProps & React.RefAttributes\n >\n >\n >\n>;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetScrollable/BottomSheetFlatList.js b/lib/module/components/bottomSheetScrollable/BottomSheetFlatList.js new file mode 100644 index 000000000..85c1388af --- /dev/null +++ b/lib/module/components/bottomSheetScrollable/BottomSheetFlatList.js @@ -0,0 +1,11 @@ +import { memo } from 'react'; +import { FlatList as RNFlatList } from 'react-native'; +import Animated from 'react-native-reanimated'; +import { SCROLLABLE_TYPE } from '../../constants'; +import { createBottomSheetScrollableComponent } from './createBottomSheetScrollableComponent'; +const AnimatedFlatList = Animated.createAnimatedComponent(RNFlatList); +const BottomSheetFlatListComponent = createBottomSheetScrollableComponent(SCROLLABLE_TYPE.FLATLIST, AnimatedFlatList); +const BottomSheetFlatList = /*#__PURE__*/memo(BottomSheetFlatListComponent); +BottomSheetFlatList.displayName = 'BottomSheetFlatList'; +export default BottomSheetFlatList; +//# sourceMappingURL=BottomSheetFlatList.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetScrollable/BottomSheetFlatList.js.map b/lib/module/components/bottomSheetScrollable/BottomSheetFlatList.js.map new file mode 100644 index 000000000..69c5cb712 --- /dev/null +++ b/lib/module/components/bottomSheetScrollable/BottomSheetFlatList.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheetFlatList.tsx"],"names":["memo","FlatList","RNFlatList","Animated","SCROLLABLE_TYPE","createBottomSheetScrollableComponent","AnimatedFlatList","createAnimatedComponent","BottomSheetFlatListComponent","FLATLIST","BottomSheetFlatList","displayName"],"mappings":"AAAA,SAASA,IAAT,QAAqB,OAArB;AACA,SACEC,QAAQ,IAAIC,UADd,QAGO,cAHP;AAIA,OAAOC,QAAP,MAAqB,yBAArB;AACA,SAASC,eAAT,QAAgC,iBAAhC;AACA,SAASC,oCAAT,QAAqD,wCAArD;AAMA,MAAMC,gBAAgB,GACpBH,QAAQ,CAACI,uBAAT,CAAuDL,UAAvD,CADF;AAGA,MAAMM,4BAA4B,GAAGH,oCAAoC,CAGvED,eAAe,CAACK,QAHuD,EAG7CH,gBAH6C,CAAzE;AAKA,MAAMI,mBAAmB,gBAAGV,IAAI,CAACQ,4BAAD,CAAhC;AACAE,mBAAmB,CAACC,WAApB,GAAkC,qBAAlC;AAEA,eAAeD,mBAAf","sourcesContent":["import { memo } from 'react';\nimport {\n FlatList as RNFlatList,\n FlatListProps as RNFlatListProps,\n} from 'react-native';\nimport Animated from 'react-native-reanimated';\nimport { SCROLLABLE_TYPE } from '../../constants';\nimport { createBottomSheetScrollableComponent } from './createBottomSheetScrollableComponent';\nimport type {\n BottomSheetFlatListMethods,\n BottomSheetFlatListProps,\n} from './types';\n\nconst AnimatedFlatList =\n Animated.createAnimatedComponent>(RNFlatList);\n\nconst BottomSheetFlatListComponent = createBottomSheetScrollableComponent<\n BottomSheetFlatListMethods,\n BottomSheetFlatListProps\n>(SCROLLABLE_TYPE.FLATLIST, AnimatedFlatList);\n\nconst BottomSheetFlatList = memo(BottomSheetFlatListComponent);\nBottomSheetFlatList.displayName = 'BottomSheetFlatList';\n\nexport default BottomSheetFlatList as (\n props: BottomSheetFlatListProps\n) => ReturnType;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetScrollable/BottomSheetScrollView.js b/lib/module/components/bottomSheetScrollable/BottomSheetScrollView.js new file mode 100644 index 000000000..38907fd58 --- /dev/null +++ b/lib/module/components/bottomSheetScrollable/BottomSheetScrollView.js @@ -0,0 +1,11 @@ +import { memo } from 'react'; +import { ScrollView as RNScrollView } from 'react-native'; +import Animated from 'react-native-reanimated'; +import { SCROLLABLE_TYPE } from '../../constants'; +import { createBottomSheetScrollableComponent } from './createBottomSheetScrollableComponent'; +const AnimatedScrollView = Animated.createAnimatedComponent(RNScrollView); +const BottomSheetScrollViewComponent = createBottomSheetScrollableComponent(SCROLLABLE_TYPE.SCROLLVIEW, AnimatedScrollView); +const BottomSheetScrollView = /*#__PURE__*/memo(BottomSheetScrollViewComponent); +BottomSheetScrollView.displayName = 'BottomSheetScrollView'; +export default BottomSheetScrollView; +//# sourceMappingURL=BottomSheetScrollView.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetScrollable/BottomSheetScrollView.js.map b/lib/module/components/bottomSheetScrollable/BottomSheetScrollView.js.map new file mode 100644 index 000000000..76214e75a --- /dev/null +++ b/lib/module/components/bottomSheetScrollable/BottomSheetScrollView.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheetScrollView.tsx"],"names":["memo","ScrollView","RNScrollView","Animated","SCROLLABLE_TYPE","createBottomSheetScrollableComponent","AnimatedScrollView","createAnimatedComponent","BottomSheetScrollViewComponent","SCROLLVIEW","BottomSheetScrollView","displayName"],"mappings":"AAAA,SAASA,IAAT,QAAqB,OAArB;AACA,SACEC,UAAU,IAAIC,YADhB,QAGO,cAHP;AAIA,OAAOC,QAAP,MAAqB,yBAArB;AACA,SAASC,eAAT,QAAgC,iBAAhC;AACA,SAASC,oCAAT,QAAqD,wCAArD;AAMA,MAAMC,kBAAkB,GACtBH,QAAQ,CAACI,uBAAT,CAAoDL,YAApD,CADF;AAGA,MAAMM,8BAA8B,GAAGH,oCAAoC,CAGzED,eAAe,CAACK,UAHyD,EAG7CH,kBAH6C,CAA3E;AAKA,MAAMI,qBAAqB,gBAAGV,IAAI,CAACQ,8BAAD,CAAlC;AACAE,qBAAqB,CAACC,WAAtB,GAAoC,uBAApC;AAEA,eAAeD,qBAAf","sourcesContent":["import { memo } from 'react';\nimport {\n ScrollView as RNScrollView,\n ScrollViewProps as RNScrollViewProps,\n} from 'react-native';\nimport Animated from 'react-native-reanimated';\nimport { SCROLLABLE_TYPE } from '../../constants';\nimport { createBottomSheetScrollableComponent } from './createBottomSheetScrollableComponent';\nimport type {\n BottomSheetScrollViewMethods,\n BottomSheetScrollViewProps,\n} from './types';\n\nconst AnimatedScrollView =\n Animated.createAnimatedComponent(RNScrollView);\n\nconst BottomSheetScrollViewComponent = createBottomSheetScrollableComponent<\n BottomSheetScrollViewMethods,\n BottomSheetScrollViewProps\n>(SCROLLABLE_TYPE.SCROLLVIEW, AnimatedScrollView);\n\nconst BottomSheetScrollView = memo(BottomSheetScrollViewComponent);\nBottomSheetScrollView.displayName = 'BottomSheetScrollView';\n\nexport default BottomSheetScrollView as (\n props: BottomSheetScrollViewProps\n) => ReturnType;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetScrollable/BottomSheetSectionList.js b/lib/module/components/bottomSheetScrollable/BottomSheetSectionList.js new file mode 100644 index 000000000..6517c9013 --- /dev/null +++ b/lib/module/components/bottomSheetScrollable/BottomSheetSectionList.js @@ -0,0 +1,11 @@ +import { memo } from 'react'; +import { SectionList as RNSectionList } from 'react-native'; +import Animated from 'react-native-reanimated'; +import { SCROLLABLE_TYPE } from '../../constants'; +import { createBottomSheetScrollableComponent } from './createBottomSheetScrollableComponent'; +const AnimatedSectionList = Animated.createAnimatedComponent(RNSectionList); +const BottomSheetSectionListComponent = createBottomSheetScrollableComponent(SCROLLABLE_TYPE.SECTIONLIST, AnimatedSectionList); +const BottomSheetSectionList = /*#__PURE__*/memo(BottomSheetSectionListComponent); +BottomSheetSectionList.displayName = 'BottomSheetSectionList'; +export default BottomSheetSectionList; +//# sourceMappingURL=BottomSheetSectionList.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetScrollable/BottomSheetSectionList.js.map b/lib/module/components/bottomSheetScrollable/BottomSheetSectionList.js.map new file mode 100644 index 000000000..6f8f44c6c --- /dev/null +++ b/lib/module/components/bottomSheetScrollable/BottomSheetSectionList.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheetSectionList.tsx"],"names":["memo","SectionList","RNSectionList","Animated","SCROLLABLE_TYPE","createBottomSheetScrollableComponent","AnimatedSectionList","createAnimatedComponent","BottomSheetSectionListComponent","SECTIONLIST","BottomSheetSectionList","displayName"],"mappings":"AAAA,SAASA,IAAT,QAAqB,OAArB;AACA,SAEEC,WAAW,IAAIC,aAFjB,QAIO,cAJP;AAKA,OAAOC,QAAP,MAAqB,yBAArB;AACA,SAASC,eAAT,QAAgC,iBAAhC;AACA,SAASC,oCAAT,QAAqD,wCAArD;AAMA,MAAMC,mBAAmB,GACvBH,QAAQ,CAACI,uBAAT,CAA0DL,aAA1D,CADF;AAGA,MAAMM,+BAA+B,GAAGH,oCAAoC,CAG1ED,eAAe,CAACK,WAH0D,EAG7CH,mBAH6C,CAA5E;AAKA,MAAMI,sBAAsB,gBAAGV,IAAI,CAACQ,+BAAD,CAAnC;AACAE,sBAAsB,CAACC,WAAvB,GAAqC,wBAArC;AAEA,eAAeD,sBAAf","sourcesContent":["import { memo } from 'react';\nimport {\n DefaultSectionT,\n SectionList as RNSectionList,\n SectionListProps as RNSectionListProps,\n} from 'react-native';\nimport Animated from 'react-native-reanimated';\nimport { SCROLLABLE_TYPE } from '../../constants';\nimport { createBottomSheetScrollableComponent } from './createBottomSheetScrollableComponent';\nimport type {\n BottomSheetSectionListMethods,\n BottomSheetSectionListProps,\n} from './types';\n\nconst AnimatedSectionList =\n Animated.createAnimatedComponent>(RNSectionList);\n\nconst BottomSheetSectionListComponent = createBottomSheetScrollableComponent<\n BottomSheetSectionListMethods,\n BottomSheetSectionListProps\n>(SCROLLABLE_TYPE.SECTIONLIST, AnimatedSectionList);\n\nconst BottomSheetSectionList = memo(BottomSheetSectionListComponent);\nBottomSheetSectionList.displayName = 'BottomSheetSectionList';\n\nexport default BottomSheetSectionList as (\n props: BottomSheetSectionListProps\n) => ReturnType;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetScrollable/BottomSheetVirtualizedList.js b/lib/module/components/bottomSheetScrollable/BottomSheetVirtualizedList.js new file mode 100644 index 000000000..a91d87f58 --- /dev/null +++ b/lib/module/components/bottomSheetScrollable/BottomSheetVirtualizedList.js @@ -0,0 +1,11 @@ +import { memo } from 'react'; +import { VirtualizedList as RNVirtualizedList } from 'react-native'; +import Animated from 'react-native-reanimated'; +import { SCROLLABLE_TYPE } from '../../constants'; +import { createBottomSheetScrollableComponent } from './createBottomSheetScrollableComponent'; +const AnimatedVirtualizedList = Animated.createAnimatedComponent(RNVirtualizedList); +const BottomSheetVirtualizedListComponent = createBottomSheetScrollableComponent(SCROLLABLE_TYPE.VIRTUALIZEDLIST, AnimatedVirtualizedList); +const BottomSheetVirtualizedList = /*#__PURE__*/memo(BottomSheetVirtualizedListComponent); +BottomSheetVirtualizedList.displayName = 'BottomSheetVirtualizedList'; +export default BottomSheetVirtualizedList; +//# sourceMappingURL=BottomSheetVirtualizedList.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetScrollable/BottomSheetVirtualizedList.js.map b/lib/module/components/bottomSheetScrollable/BottomSheetVirtualizedList.js.map new file mode 100644 index 000000000..171a27a55 --- /dev/null +++ b/lib/module/components/bottomSheetScrollable/BottomSheetVirtualizedList.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheetVirtualizedList.tsx"],"names":["memo","VirtualizedList","RNVirtualizedList","Animated","SCROLLABLE_TYPE","createBottomSheetScrollableComponent","AnimatedVirtualizedList","createAnimatedComponent","BottomSheetVirtualizedListComponent","VIRTUALIZEDLIST","BottomSheetVirtualizedList","displayName"],"mappings":"AAAA,SAASA,IAAT,QAAqB,OAArB;AACA,SACEC,eAAe,IAAIC,iBADrB,QAGO,cAHP;AAIA,OAAOC,QAAP,MAAqB,yBAArB;AACA,SAASC,eAAT,QAAgC,iBAAhC;AACA,SAASC,oCAAT,QAAqD,wCAArD;AAMA,MAAMC,uBAAuB,GAC3BH,QAAQ,CAACI,uBAAT,CACEL,iBADF,CADF;AAKA,MAAMM,mCAAmC,GACvCH,oCAAoC,CAGlCD,eAAe,CAACK,eAHkB,EAGDH,uBAHC,CADtC;AAMA,MAAMI,0BAA0B,gBAAGV,IAAI,CAACQ,mCAAD,CAAvC;AACAE,0BAA0B,CAACC,WAA3B,GAAyC,4BAAzC;AAEA,eAAeD,0BAAf","sourcesContent":["import { memo } from 'react';\nimport {\n VirtualizedList as RNVirtualizedList,\n VirtualizedListProps as RNVirtualizedListProps,\n} from 'react-native';\nimport Animated from 'react-native-reanimated';\nimport { SCROLLABLE_TYPE } from '../../constants';\nimport { createBottomSheetScrollableComponent } from './createBottomSheetScrollableComponent';\nimport type {\n BottomSheetVirtualizedListMethods,\n BottomSheetVirtualizedListProps,\n} from './types';\n\nconst AnimatedVirtualizedList =\n Animated.createAnimatedComponent>(\n RNVirtualizedList\n );\n\nconst BottomSheetVirtualizedListComponent =\n createBottomSheetScrollableComponent<\n BottomSheetVirtualizedListMethods,\n BottomSheetVirtualizedListProps\n >(SCROLLABLE_TYPE.VIRTUALIZEDLIST, AnimatedVirtualizedList);\n\nconst BottomSheetVirtualizedList = memo(BottomSheetVirtualizedListComponent);\nBottomSheetVirtualizedList.displayName = 'BottomSheetVirtualizedList';\n\nexport default BottomSheetVirtualizedList as (\n props: BottomSheetVirtualizedListProps\n) => ReturnType;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetScrollable/createBottomSheetScrollableComponent.js b/lib/module/components/bottomSheetScrollable/createBottomSheetScrollableComponent.js new file mode 100644 index 000000000..83abb5601 --- /dev/null +++ b/lib/module/components/bottomSheetScrollable/createBottomSheetScrollableComponent.js @@ -0,0 +1,140 @@ +function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } + +import React, { forwardRef, useImperativeHandle, useMemo, useRef } from 'react'; +import { Platform } from 'react-native'; +import { useAnimatedProps, useAnimatedStyle } from 'react-native-reanimated'; +import { NativeViewGestureHandler } from 'react-native-gesture-handler'; +import BottomSheetDraggableView from '../bottomSheetDraggableView'; +import BottomSheetRefreshControl from '../bottomSheetRefreshControl'; +import { useScrollHandler, useScrollableSetter, useBottomSheetInternal, useStableCallback } from '../../hooks'; +import { GESTURE_SOURCE, SCROLLABLE_DECELERATION_RATE_MAPPER, SCROLLABLE_STATE } from '../../constants'; +import { styles } from './styles'; +export function createBottomSheetScrollableComponent(type, ScrollableComponent) { + return /*#__PURE__*/forwardRef((props, ref) => { + // props + const { + // hooks + focusHook, + scrollEventsHandlersHook, + // props + enableFooterMarginAdjustment = false, + overScrollMode = 'never', + keyboardDismissMode = 'interactive', + showsVerticalScrollIndicator = true, + style, + refreshing, + onRefresh, + progressViewOffset, + refreshControl, + // events + onScroll, + onScrollBeginDrag, + onScrollEndDrag, + onContentSizeChange, + ...rest + } = props; //#region refs + + const nativeGestureRef = useRef(null); + const refreshControlGestureRef = useRef(null); //#endregion + //#region hooks + + const { + scrollableRef, + scrollableContentOffsetY, + scrollHandler + } = useScrollHandler(scrollEventsHandlersHook, onScroll, onScrollBeginDrag, onScrollEndDrag); + const { + enableContentPanningGesture, + animatedFooterHeight, + animatedScrollableState, + animatedContentHeight, + enableDynamicSizing + } = useBottomSheetInternal(); //#endregion + //#region variables + + const scrollableAnimatedProps = useAnimatedProps(() => ({ + decelerationRate: SCROLLABLE_DECELERATION_RATE_MAPPER[animatedScrollableState.value], + showsVerticalScrollIndicator: showsVerticalScrollIndicator ? animatedScrollableState.value === SCROLLABLE_STATE.UNLOCKED : showsVerticalScrollIndicator + }), [showsVerticalScrollIndicator]); //#endregion + //#region callbacks + + const handleContentSizeChange = useStableCallback((contentWidth, contentHeight) => { + if (enableDynamicSizing) { + animatedContentHeight.value = contentHeight; + } + + if (onContentSizeChange) { + onContentSizeChange(contentWidth, contentHeight); + } + }); //#endregion + //#region styles + + const containerAnimatedStyle = useAnimatedStyle(() => ({ + marginBottom: enableFooterMarginAdjustment ? animatedFooterHeight.value : 0 + }), [enableFooterMarginAdjustment]); + const containerStyle = useMemo(() => { + return enableFooterMarginAdjustment ? [...(style ? 'length' in style ? style : [style] : []), containerAnimatedStyle] : style; + }, [enableFooterMarginAdjustment, style, containerAnimatedStyle]); //#endregion + //#region effects + // @ts-ignore + + useImperativeHandle(ref, () => scrollableRef.current); + useScrollableSetter(scrollableRef, type, scrollableContentOffsetY, onRefresh !== undefined, focusHook); //#endregion + //#region render + + if (Platform.OS === 'android') { + const scrollableContent = /*#__PURE__*/React.createElement(NativeViewGestureHandler, { + ref: nativeGestureRef, + enabled: enableContentPanningGesture, + shouldCancelWhenOutside: false + }, /*#__PURE__*/React.createElement(ScrollableComponent, _extends({ + animatedProps: scrollableAnimatedProps + }, rest, { + scrollEventThrottle: 16, + ref: scrollableRef, + overScrollMode: overScrollMode, + keyboardDismissMode: keyboardDismissMode, + onScroll: scrollHandler, + onContentSizeChange: handleContentSizeChange, + style: containerStyle + }))); + return /*#__PURE__*/React.createElement(BottomSheetDraggableView, { + nativeGestureRef: nativeGestureRef, + refreshControlGestureRef: refreshControlGestureRef, + gestureType: GESTURE_SOURCE.SCROLLABLE, + style: styles.container + }, onRefresh ? /*#__PURE__*/React.createElement(BottomSheetRefreshControl, { + ref: refreshControlGestureRef, + refreshing: refreshing, + onRefresh: onRefresh, + progressViewOffset: progressViewOffset, + style: styles.container + }, scrollableContent) : scrollableContent); + } + + return /*#__PURE__*/React.createElement(BottomSheetDraggableView, { + nativeGestureRef: nativeGestureRef, + gestureType: GESTURE_SOURCE.SCROLLABLE, + style: styles.container + }, /*#__PURE__*/React.createElement(NativeViewGestureHandler, { + ref: nativeGestureRef, + enabled: enableContentPanningGesture, + shouldCancelWhenOutside: false + }, /*#__PURE__*/React.createElement(ScrollableComponent, _extends({ + animatedProps: scrollableAnimatedProps + }, rest, { + scrollEventThrottle: 16, + ref: scrollableRef, + overScrollMode: overScrollMode, + keyboardDismissMode: keyboardDismissMode, + refreshing: refreshing, + onRefresh: onRefresh, + progressViewOffset: progressViewOffset, + refreshControl: refreshControl, + onScroll: scrollHandler, + onContentSizeChange: handleContentSizeChange, + style: containerStyle + })))); //#endregion + }); +} +//# sourceMappingURL=createBottomSheetScrollableComponent.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetScrollable/createBottomSheetScrollableComponent.js.map b/lib/module/components/bottomSheetScrollable/createBottomSheetScrollableComponent.js.map new file mode 100644 index 000000000..301f43be5 --- /dev/null +++ b/lib/module/components/bottomSheetScrollable/createBottomSheetScrollableComponent.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["createBottomSheetScrollableComponent.tsx"],"names":["React","forwardRef","useImperativeHandle","useMemo","useRef","Platform","useAnimatedProps","useAnimatedStyle","NativeViewGestureHandler","BottomSheetDraggableView","BottomSheetRefreshControl","useScrollHandler","useScrollableSetter","useBottomSheetInternal","useStableCallback","GESTURE_SOURCE","SCROLLABLE_DECELERATION_RATE_MAPPER","SCROLLABLE_STATE","styles","createBottomSheetScrollableComponent","type","ScrollableComponent","props","ref","focusHook","scrollEventsHandlersHook","enableFooterMarginAdjustment","overScrollMode","keyboardDismissMode","showsVerticalScrollIndicator","style","refreshing","onRefresh","progressViewOffset","refreshControl","onScroll","onScrollBeginDrag","onScrollEndDrag","onContentSizeChange","rest","nativeGestureRef","refreshControlGestureRef","scrollableRef","scrollableContentOffsetY","scrollHandler","enableContentPanningGesture","animatedFooterHeight","animatedScrollableState","animatedContentHeight","enableDynamicSizing","scrollableAnimatedProps","decelerationRate","value","UNLOCKED","handleContentSizeChange","contentWidth","contentHeight","containerAnimatedStyle","marginBottom","containerStyle","current","undefined","OS","scrollableContent","SCROLLABLE","container"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,UAAhB,EAA4BC,mBAA5B,EAAiDC,OAAjD,EAA0DC,MAA1D,QAAwE,OAAxE;AACA,SAASC,QAAT,QAAyB,cAAzB;AACA,SAASC,gBAAT,EAA2BC,gBAA3B,Q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zB,cAAc,CAACiD,UAF9B;AAGE,MAAA,KAAK,EAAE9C,MAAM,CAAC+C;AAHhB,oBAKE,oBAAC,wBAAD;AACE,MAAA,GAAG,EAAEzB,gBADP;AAEE,MAAA,OAAO,EAAEK,2BAFX;AAGE,MAAA,uBAAuB,EAAE;AAH3B,oBAKE,oBAAC,mBAAD;AACE,MAAA,aAAa,EAAEK;AADjB,OAEMX,IAFN;AAGE,MAAA,mBAAmB,EAAE,EAHvB;AAIE,MAAA,GAAG,EAAEG,aAJP;AAKE,MAAA,cAAc,EAAEf,cALlB;AAME,MAAA,mBAAmB,EAAEC,mBANvB;AAOE,MAAA,UAAU,EAAEG,UAPd;AAQE,MAAA,SAAS,EAAEC,SARb;AASE,MAAA,kBAAkB,EAAEC,kBATtB;AAUE,MAAA,cAAc,EAAEC,cAVlB;AAWE,MAAA,QAAQ,EAAEU,aAXZ;AAYE,MAAA,mBAAmB,EAAEU,uBAZvB;AAaE,MAAA,KAAK,EAAEK;AAbT,OALF,CALF,CADF,CApJsC,CAiLtC;AACD,GAlLgB,CAAjB;AAmLD","sourcesContent":["import React, { forwardRef, useImperativeHandle, useMemo, useRef } from 'react';\nimport { Platform } from 'react-native';\nimport { useAnimatedProps, useAnimatedStyle } from 'react-native-reanimated';\nimport { NativeViewGestureHandler } from 'react-native-gesture-handler';\nimport BottomSheetDraggableView from '../bottomSheetDraggableView';\nimport BottomSheetRefreshControl from '../bottomSheetRefreshControl';\nimport {\n useScrollHandler,\n useScrollableSetter,\n useBottomSheetInternal,\n useStableCallback,\n} from '../../hooks';\nimport {\n GESTURE_SOURCE,\n SCROLLABLE_DECELERATION_RATE_MAPPER,\n SCROLLABLE_STATE,\n SCROLLABLE_TYPE,\n} from '../../constants';\nimport { styles } from './styles';\n\nexport function createBottomSheetScrollableComponent(\n type: SCROLLABLE_TYPE,\n ScrollableComponent: any\n) {\n return forwardRef((props, ref) => {\n // props\n const {\n // hooks\n focusHook,\n scrollEventsHandlersHook,\n // props\n enableFooterMarginAdjustment = false,\n overScrollMode = 'never',\n keyboardDismissMode = 'interactive',\n showsVerticalScrollIndicator = true,\n style,\n refreshing,\n onRefresh,\n progressViewOffset,\n refreshControl,\n // events\n onScroll,\n onScrollBeginDrag,\n onScrollEndDrag,\n onContentSizeChange,\n ...rest\n }: any = props;\n\n //#region refs\n const nativeGestureRef = useRef(null);\n const refreshControlGestureRef = useRef(null);\n //#endregion\n\n //#region hooks\n const { scrollableRef, scrollableContentOffsetY, scrollHandler } =\n useScrollHandler(\n scrollEventsHandlersHook,\n onScroll,\n onScrollBeginDrag,\n onScrollEndDrag\n );\n const {\n enableContentPanningGesture,\n animatedFooterHeight,\n animatedScrollableState,\n animatedContentHeight,\n enableDynamicSizing,\n } = useBottomSheetInternal();\n //#endregion\n\n //#region variables\n const scrollableAnimatedProps = useAnimatedProps(\n () => ({\n decelerationRate:\n SCROLLABLE_DECELERATION_RATE_MAPPER[animatedScrollableState.value],\n showsVerticalScrollIndicator: showsVerticalScrollIndicator\n ? animatedScrollableState.value === SCROLLABLE_STATE.UNLOCKED\n : showsVerticalScrollIndicator,\n }),\n [showsVerticalScrollIndicator]\n );\n //#endregion\n\n //#region callbacks\n const handleContentSizeChange = useStableCallback(\n (contentWidth: number, contentHeight: number) => {\n if (enableDynamicSizing) {\n animatedContentHeight.value = contentHeight;\n }\n\n if (onContentSizeChange) {\n onContentSizeChange(contentWidth, contentHeight);\n }\n }\n );\n //#endregion\n\n //#region styles\n const containerAnimatedStyle = useAnimatedStyle(\n () => ({\n marginBottom: enableFooterMarginAdjustment\n ? animatedFooterHeight.value\n : 0,\n }),\n [enableFooterMarginAdjustment]\n );\n const containerStyle = useMemo(() => {\n return enableFooterMarginAdjustment\n ? [\n ...(style ? ('length' in style ? style : [style]) : []),\n containerAnimatedStyle,\n ]\n : style;\n }, [enableFooterMarginAdjustment, style, containerAnimatedStyle]);\n //#endregion\n\n //#region effects\n // @ts-ignore\n useImperativeHandle(ref, () => scrollableRef.current);\n useScrollableSetter(\n scrollableRef,\n type,\n scrollableContentOffsetY,\n onRefresh !== undefined,\n focusHook\n );\n //#endregion\n\n //#region render\n if (Platform.OS === 'android') {\n const scrollableContent = (\n \n \n \n );\n return (\n \n {onRefresh ? (\n \n {scrollableContent}\n \n ) : (\n scrollableContent\n )}\n \n );\n }\n return (\n \n \n \n \n \n );\n //#endregion\n });\n}\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetScrollable/index.js b/lib/module/components/bottomSheetScrollable/index.js new file mode 100644 index 000000000..3319ed0a4 --- /dev/null +++ b/lib/module/components/bottomSheetScrollable/index.js @@ -0,0 +1,6 @@ +export { createBottomSheetScrollableComponent } from './createBottomSheetScrollableComponent'; +export { default as BottomSheetSectionList } from './BottomSheetSectionList'; +export { default as BottomSheetFlatList } from './BottomSheetFlatList'; +export { default as BottomSheetScrollView } from './BottomSheetScrollView'; +export { default as BottomSheetVirtualizedList } from './BottomSheetVirtualizedList'; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetScrollable/index.js.map b/lib/module/components/bottomSheetScrollable/index.js.map new file mode 100644 index 000000000..304fab661 --- /dev/null +++ b/lib/module/components/bottomSheetScrollable/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":["createBottomSheetScrollableComponent","default","BottomSheetSectionList","BottomSheetFlatList","BottomSheetScrollView","BottomSheetVirtualizedList"],"mappings":"AAAA,SAASA,oCAAT,QAAqD,wCAArD;AACA,SAASC,OAAO,IAAIC,sBAApB,QAAkD,0BAAlD;AACA,SAASD,OAAO,IAAIE,mBAApB,QAA+C,uBAA/C;AACA,SAASF,OAAO,IAAIG,qBAApB,QAAiD,yBAAjD;AACA,SAASH,OAAO,IAAII,0BAApB,QAAsD,8BAAtD","sourcesContent":["export { createBottomSheetScrollableComponent } from './createBottomSheetScrollableComponent';\nexport { default as BottomSheetSectionList } from './BottomSheetSectionList';\nexport { default as BottomSheetFlatList } from './BottomSheetFlatList';\nexport { default as BottomSheetScrollView } from './BottomSheetScrollView';\nexport { default as BottomSheetVirtualizedList } from './BottomSheetVirtualizedList';\n\nexport type {\n BottomSheetFlatListMethods,\n BottomSheetScrollViewMethods,\n BottomSheetSectionListMethods,\n BottomSheetVirtualizedListMethods,\n BottomSheetScrollableProps,\n} from './types';\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetScrollable/styles.js b/lib/module/components/bottomSheetScrollable/styles.js new file mode 100644 index 000000000..3a7343f35 --- /dev/null +++ b/lib/module/components/bottomSheetScrollable/styles.js @@ -0,0 +1,8 @@ +import { StyleSheet } from 'react-native'; +export const styles = StyleSheet.create({ + container: { + flex: 1, + overflow: 'visible' + } +}); +//# sourceMappingURL=styles.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetScrollable/styles.js.map b/lib/module/components/bottomSheetScrollable/styles.js.map new file mode 100644 index 000000000..12239dad5 --- /dev/null +++ b/lib/module/components/bottomSheetScrollable/styles.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["styles.ts"],"names":["StyleSheet","styles","create","container","flex","overflow"],"mappings":"AAAA,SAASA,UAAT,QAA2B,cAA3B;AAEA,OAAO,MAAMC,MAAM,GAAGD,UAAU,CAACE,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE;AACTC,IAAAA,IAAI,EAAE,CADG;AAETC,IAAAA,QAAQ,EAAE;AAFD;AAD2B,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\n\nexport const styles = StyleSheet.create({\n container: {\n flex: 1,\n overflow: 'visible',\n },\n});\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetTextInput/BottomSheetTextInput.js b/lib/module/components/bottomSheetTextInput/BottomSheetTextInput.js new file mode 100644 index 000000000..d98f469a3 --- /dev/null +++ b/lib/module/components/bottomSheetTextInput/BottomSheetTextInput.js @@ -0,0 +1,47 @@ +function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } + +import React, { memo, useCallback, forwardRef, useEffect } from 'react'; +import { TextInput } from 'react-native-gesture-handler'; +import { useBottomSheetInternal } from '../../hooks'; +const BottomSheetTextInputComponent = /*#__PURE__*/forwardRef(({ + onFocus, + onBlur, + ...rest +}, ref) => { + //#region hooks + const { + shouldHandleKeyboardEvents + } = useBottomSheetInternal(); + useEffect(() => { + return () => { + // Reset the flag on unmount + shouldHandleKeyboardEvents.value = false; + }; + }, [shouldHandleKeyboardEvents]); //#endregion + //#region callbacks + + const handleOnFocus = useCallback(args => { + shouldHandleKeyboardEvents.value = true; + + if (onFocus) { + onFocus(args); + } + }, [onFocus, shouldHandleKeyboardEvents]); + const handleOnBlur = useCallback(args => { + shouldHandleKeyboardEvents.value = false; + + if (onBlur) { + onBlur(args); + } + }, [onBlur, shouldHandleKeyboardEvents]); //#endregion + + return /*#__PURE__*/React.createElement(TextInput, _extends({ + ref: ref, + onFocus: handleOnFocus, + onBlur: handleOnBlur + }, rest)); +}); +const BottomSheetTextInput = /*#__PURE__*/memo(BottomSheetTextInputComponent); +BottomSheetTextInput.displayName = 'BottomSheetTextInput'; +export default BottomSheetTextInput; +//# sourceMappingURL=BottomSheetTextInput.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetTextInput/BottomSheetTextInput.js.map b/lib/module/components/bottomSheetTextInput/BottomSheetTextInput.js.map new file mode 100644 index 000000000..53df50858 --- /dev/null +++ b/lib/module/components/bottomSheetTextInput/BottomSheetTextInput.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheetTextInput.tsx"],"names":["React","memo","useCallback","forwardRef","useEffect","TextInput","useBottomSheetInternal","BottomSheetTextInputComponent","onFocus","onBlur","rest","ref","shouldHandleKeyboardEvents","value","handleOnFocus","args","handleOnBlur","BottomSheetTextInput","displayName"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,IAAhB,EAAsBC,WAAtB,EAA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AAeD,oBAAf","sourcesContent":["import React, { memo, useCallback, forwardRef, useEffect } from 'react';\nimport { TextInput } from 'react-native-gesture-handler';\nimport { useBottomSheetInternal } from '../../hooks';\nimport type { BottomSheetTextInputProps } from './types';\n\nconst BottomSheetTextInputComponent = forwardRef<\n TextInput,\n BottomSheetTextInputProps\n>(({ onFocus, onBlur, ...rest }, ref) => {\n //#region hooks\n const { shouldHandleKeyboardEvents } = useBottomSheetInternal();\n\n useEffect(() => {\n return () => {\n // Reset the flag on unmount\n shouldHandleKeyboardEvents.value = false;\n };\n }, [shouldHandleKeyboardEvents]);\n //#endregion\n\n //#region callbacks\n const handleOnFocus = useCallback(\n args => {\n shouldHandleKeyboardEvents.value = true;\n if (onFocus) {\n onFocus(args);\n }\n },\n [onFocus, shouldHandleKeyboardEvents]\n );\n const handleOnBlur = useCallback(\n args => {\n shouldHandleKeyboardEvents.value = false;\n if (onBlur) {\n onBlur(args);\n }\n },\n [onBlur, shouldHandleKeyboardEvents]\n );\n //#endregion\n\n return (\n \n );\n});\n\nconst BottomSheetTextInput = memo(BottomSheetTextInputComponent);\nBottomSheetTextInput.displayName = 'BottomSheetTextInput';\n\nexport default BottomSheetTextInput;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetTextInput/index.js b/lib/module/components/bottomSheetTextInput/index.js new file mode 100644 index 000000000..4033c0d23 --- /dev/null +++ b/lib/module/components/bottomSheetTextInput/index.js @@ -0,0 +1,2 @@ +export { default } from './BottomSheetTextInput'; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetTextInput/index.js.map b/lib/module/components/bottomSheetTextInput/index.js.map new file mode 100644 index 000000000..c366b3aa9 --- /dev/null +++ b/lib/module/components/bottomSheetTextInput/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":["default"],"mappings":"AAAA,SAASA,OAAT,QAAwB,wBAAxB","sourcesContent":["export { default } from './BottomSheetTextInput';\nexport type { BottomSheetTextInputProps } from './types';\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetTextInput/types.js b/lib/module/components/bottomSheetTextInput/types.js new file mode 100644 index 000000000..718fd38ae --- /dev/null +++ b/lib/module/components/bottomSheetTextInput/types.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetTextInput/types.js.map b/lib/module/components/bottomSheetTextInput/types.js.map new file mode 100644 index 000000000..9ffd4b22f --- /dev/null +++ b/lib/module/components/bottomSheetTextInput/types.js.map @@ -0,0 +1 @@ +{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetView/BottomSheetView.js b/lib/module/components/bottomSheetView/BottomSheetView.js new file mode 100644 index 000000000..0eb5afe4a --- /dev/null +++ b/lib/module/components/bottomSheetView/BottomSheetView.js @@ -0,0 +1,73 @@ +function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } + +import React, { memo, useEffect, useCallback, useMemo } from 'react'; +import { StyleSheet } from 'react-native'; +import Animated, { useAnimatedStyle } from 'react-native-reanimated'; +import { SCROLLABLE_TYPE } from '../../constants'; +import { useBottomSheetInternal } from '../../hooks'; +import { print } from '../../utilities'; + +function BottomSheetViewComponent({ + focusHook: useFocusHook = useEffect, + enableFooterMarginAdjustment = false, + onLayout, + style, + children, + ...rest +}) { + //#region hooks + const { + animatedScrollableContentOffsetY, + animatedScrollableType, + animatedFooterHeight, + enableDynamicSizing, + animatedContentHeight + } = useBottomSheetInternal(); //#endregion + //#region styles + + const containerStylePaddingBottom = useMemo(() => { + const flattenStyle = StyleSheet.flatten(style); + const paddingBottom = flattenStyle && 'paddingBottom' in flattenStyle ? flattenStyle.paddingBottom : 0; + return typeof paddingBottom === 'number' ? paddingBottom : 0; + }, [style]); + const containerAnimatedStyle = useAnimatedStyle(() => ({ + paddingBottom: enableFooterMarginAdjustment ? animatedFooterHeight.value + containerStylePaddingBottom : containerStylePaddingBottom + }), [containerStylePaddingBottom, enableFooterMarginAdjustment]); + const containerStyle = useMemo(() => [style, containerAnimatedStyle], [style, containerAnimatedStyle]); //#endregion + //#region callbacks + + const handleSettingScrollable = useCallback(() => { + animatedScrollableContentOffsetY.value = 0; + animatedScrollableType.value = SCROLLABLE_TYPE.VIEW; + }, [animatedScrollableContentOffsetY, animatedScrollableType]); + const handleLayout = useCallback(event => { + if (enableDynamicSizing) { + animatedContentHeight.value = event.nativeEvent.layout.height; + } + + if (onLayout) { + onLayout(event); + } + + print({ + component: BottomSheetView.displayName, + method: 'handleLayout', + params: { + height: event.nativeEvent.layout.height + } + }); + }, [onLayout, animatedContentHeight, enableDynamicSizing]); //#endregion + // effects + + useFocusHook(handleSettingScrollable); //render + + return /*#__PURE__*/React.createElement(Animated.View, _extends({ + onLayout: handleLayout, + style: containerStyle + }, rest), children); +} + +const BottomSheetView = /*#__PURE__*/memo(BottomSheetViewComponent); +BottomSheetView.displayName = 'BottomSheetView'; +export default BottomSheetView; +//# sourceMappingURL=BottomSheetView.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetView/BottomSheetView.js.map b/lib/module/components/bottomSheetView/BottomSheetView.js.map new file mode 100644 index 000000000..2a64dda4f --- /dev/null +++ b/lib/module/components/bottomSheetView/BottomSheetView.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["BottomSheetView.tsx"],"names":["React","memo","useEffect","useCallback","useMemo","StyleSheet","Animated","useAnimatedStyle","SCROLLABLE_TYPE","useBottomSheetInternal","print","BottomSheetViewComponent","focusHook","useFocusHook","enableFooterMarginAdjustment","onLayout","style","children","rest","animatedScrollableContentOffsetY","animatedScrollableType","animatedFooterHeight","enableDynamicSizing","animatedContentHeight","containerStylePaddingBottom","flattenStyle","flatten","paddingBottom","containerAnimatedStyle","value","containerStyle","handleSettingScrollable","VIEW","handleLayout","event","nativeEvent","layout","height","component","BottomSheetView","displayName","method","params"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,IAAhB,EAAsBC,SAAtB,EAAiCC,WAAjC,EAA8CC,OAA9C,QAA6D,OAA7D;AACA,SAA4BC,UAA5B,QAA8C,cAA9C;AACA,OAAOC,QAAP,IAAmBC,gBAAnB,QAA2C,yBAA3C;AACA,SAASC,eAAT,QAAgC,iBAAhC;AACA,SAASC,sBAAT,QAAuC,aAAvC;AAEA,SAASC,KAAT,QAAsB,iBAAtB;;AAEA,SAASC,wBAAT,CAAkC;AAChCC,EAAAA,SAAS,EAAEC,YAAY,GAAGX,SADM;AAEhCY,EAAAA,4BAA4B,GAAG,KAFC;AAGhCC,EAAAA,QAHgC;AAIhCC,EAAAA,KAJgC;AAKhCC,EAAAA,QALgC;AAMhC,KAAGC;AAN6B,CAAlC,EAOyB;AACvB;AACA,QAAM;AACJC,IAAAA,gCADI;AAEJC,IAAAA,sBAFI;AAGJC,IAAAA,oBAHI;AAIJC,IAAAA,mBAJI;AAKJC,IAAAA;AALI,MAMFd,sBAAsB,EAN1B,CAFuB,CASvB;AAEA;;AACA,QAAMe,2BAA2B,GAAGpB,OAAO,CAAC,MAAM;AAChD,UAAMqB,YAAY,GAAGpB,UAAU,CAACqB,OAAX,CAAmBV,KAAnB,CAArB;AACA,UAAMW,aAAa,GACjBF,YAAY,IAAI,mBAAmBA,YAAnC,GACIA,YAAY,CAACE,aADjB,GAEI,CAHN;AAIA,WAAO,OAAOA,aAAP,KAAyB,QAAzB,GAAoCA,aAApC,GAAoD,CAA3D;AACD,GAP0C,EAOxC,CAACX,KAAD,CAPwC,CAA3C;AAQA,QAAMY,sBAAsB,GAAGrB,gBAAgB,CAC7C,OAAO;AACLoB,IAAAA,aAAa,EAAEb,4BAA4B,GACvCO,oBAAoB,CAACQ,KAArB,GAA6BL,2BADU,GAEvCA;AAHC,GAAP,CAD6C,EAM7C,CAACA,2BAAD,EAA8BV,4BAA9B,CA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,wBAAD,CAA5B;AACA4B,eAAe,CAACC,WAAhB,GAA8B,iBAA9B;AAEA,eAAeD,eAAf","sourcesContent":["import React, { memo, useEffect, useCallback, useMemo } from 'react';\nimport { LayoutChangeEvent, StyleSheet } from 'react-native';\nimport Animated, { useAnimatedStyle } from 'react-native-reanimated';\nimport { SCROLLABLE_TYPE } from '../../constants';\nimport { useBottomSheetInternal } from '../../hooks';\nimport type { BottomSheetViewProps } from './types';\nimport { print } from '../../utilities';\n\nfunction BottomSheetViewComponent({\n focusHook: useFocusHook = useEffect,\n enableFooterMarginAdjustment = false,\n onLayout,\n style,\n children,\n ...rest\n}: BottomSheetViewProps) {\n //#region hooks\n const {\n animatedScrollableContentOffsetY,\n animatedScrollableType,\n animatedFooterHeight,\n enableDynamicSizing,\n animatedContentHeight,\n } = useBottomSheetInternal();\n //#endregion\n\n //#region styles\n const containerStylePaddingBottom = useMemo(() => {\n const flattenStyle = StyleSheet.flatten(style);\n const paddingBottom =\n flattenStyle && 'paddingBottom' in flattenStyle\n ? flattenStyle.paddingBottom\n : 0;\n return typeof paddingBottom === 'number' ? paddingBottom : 0;\n }, [style]);\n const containerAnimatedStyle = useAnimatedStyle(\n () => ({\n paddingBottom: enableFooterMarginAdjustment\n ? animatedFooterHeight.value + containerStylePaddingBottom\n : containerStylePaddingBottom,\n }),\n [containerStylePaddingBottom, enableFooterMarginAdjustment]\n );\n const containerStyle = useMemo(\n () => [style, containerAnimatedStyle],\n [style, containerAnimatedStyle]\n );\n //#endregion\n\n //#region callbacks\n const handleSettingScrollable = useCallback(() => {\n animatedScrollableContentOffsetY.value = 0;\n animatedScrollableType.value = SCROLLABLE_TYPE.VIEW;\n }, [animatedScrollableContentOffsetY, animatedScrollableType]);\n const handleLayout = useCallback(\n (event: LayoutChangeEvent) => {\n if (enableDynamicSizing) {\n animatedContentHeight.value = event.nativeEvent.layout.height;\n }\n\n if (onLayout) {\n onLayout(event);\n }\n\n print({\n component: BottomSheetView.displayName,\n method: 'handleLayout',\n params: {\n height: event.nativeEvent.layout.height,\n },\n });\n },\n [onLayout, animatedContentHeight, enableDynamicSizing]\n );\n //#endregion\n\n // effects\n useFocusHook(handleSettingScrollable);\n\n //render\n return (\n \n {children}\n \n );\n}\n\nconst BottomSheetView = memo(BottomSheetViewComponent);\nBottomSheetView.displayName = 'BottomSheetView';\n\nexport default BottomSheetView;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetView/index.js b/lib/module/components/bottomSheetView/index.js new file mode 100644 index 000000000..298647bc6 --- /dev/null +++ b/lib/module/components/bottomSheetView/index.js @@ -0,0 +1,2 @@ +export { default } from './BottomSheetView'; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetView/index.js.map b/lib/module/components/bottomSheetView/index.js.map new file mode 100644 index 000000000..06e3cd60d --- /dev/null +++ b/lib/module/components/bottomSheetView/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":["default"],"mappings":"AAAA,SAASA,OAAT,QAAwB,mBAAxB","sourcesContent":["export { default } from './BottomSheetView';\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetView/styles.js b/lib/module/components/bottomSheetView/styles.js new file mode 100644 index 000000000..fbac29306 --- /dev/null +++ b/lib/module/components/bottomSheetView/styles.js @@ -0,0 +1,6 @@ +import { StyleSheet } from 'react-native'; +export const styles = StyleSheet.create({ + container: {// flex: 1, + } +}); +//# sourceMappingURL=styles.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetView/styles.js.map b/lib/module/components/bottomSheetView/styles.js.map new file mode 100644 index 000000000..388f35bba --- /dev/null +++ b/lib/module/components/bottomSheetView/styles.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["styles.ts"],"names":["StyleSheet","styles","create","container"],"mappings":"AAAA,SAASA,UAAT,QAA2B,cAA3B;AAEA,OAAO,MAAMC,MAAM,GAAGD,UAAU,CAACE,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE,CACT;AADS;AAD2B,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\n\nexport const styles = StyleSheet.create({\n container: {\n // flex: 1,\n },\n});\n"]} \ No newline at end of file diff --git a/lib/module/components/touchables/Touchables.ios.js b/lib/module/components/touchables/Touchables.ios.js new file mode 100644 index 000000000..f53e4cd94 --- /dev/null +++ b/lib/module/components/touchables/Touchables.ios.js @@ -0,0 +1,2 @@ +export { TouchableOpacity, TouchableHighlight, TouchableWithoutFeedback } from 'react-native'; +//# sourceMappingURL=Touchables.ios.js.map \ No newline at end of file diff --git a/lib/module/components/touchables/Touchables.ios.js.map b/lib/module/components/touchables/Touchables.ios.js.map new file mode 100644 index 000000000..c756bc4a9 --- /dev/null +++ b/lib/module/components/touchables/Touchables.ios.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["Touchables.ios.tsx"],"names":["TouchableOpacity","TouchableHighlight","TouchableWithoutFeedback"],"mappings":"AAAA,SACEA,gBADF,EAEEC,kBAFF,EAGEC,wBAHF,QAIO,cAJP","sourcesContent":["export {\n TouchableOpacity,\n TouchableHighlight,\n TouchableWithoutFeedback,\n} from 'react-native';\n"]} \ No newline at end of file diff --git a/lib/module/components/touchables/Touchables.js b/lib/module/components/touchables/Touchables.js new file mode 100644 index 000000000..b1edc977b --- /dev/null +++ b/lib/module/components/touchables/Touchables.js @@ -0,0 +1,2 @@ +export { TouchableOpacity, TouchableHighlight, TouchableWithoutFeedback } from 'react-native-gesture-handler'; +//# sourceMappingURL=Touchables.js.map \ No newline at end of file diff --git a/lib/module/components/touchables/Touchables.js.map b/lib/module/components/touchables/Touchables.js.map new file mode 100644 index 000000000..ac59a11c2 --- /dev/null +++ b/lib/module/components/touchables/Touchables.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["Touchables.tsx"],"names":["TouchableOpacity","TouchableHighlight","TouchableWithoutFeedback"],"mappings":"AAAA,SACEA,gBADF,EAEEC,kBAFF,EAGEC,wBAHF,QAIO,8BAJP","sourcesContent":["export {\n TouchableOpacity,\n TouchableHighlight,\n TouchableWithoutFeedback,\n} from 'react-native-gesture-handler';\n"]} \ No newline at end of file diff --git a/lib/module/components/touchables/index.js b/lib/module/components/touchables/index.js new file mode 100644 index 000000000..4c2049ac0 --- /dev/null +++ b/lib/module/components/touchables/index.js @@ -0,0 +1,8 @@ +import { TouchableOpacity, TouchableHighlight, TouchableWithoutFeedback // @ts-ignore +} from './Touchables'; +export default { + TouchableOpacity: TouchableOpacity, + TouchableHighlight: TouchableHighlight, + TouchableWithoutFeedback: TouchableWithoutFeedback +}; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/components/touchables/index.js.map b/lib/module/components/touchables/index.js.map new file mode 100644 index 000000000..ce2b7e92c --- /dev/null +++ b/lib/module/components/touchables/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":["TouchableOpacity","TouchableHighlight","TouchableWithoutFeedback"],"mappings":"AAMA,SACEA,gBADF,EAEEC,kBAFF,EAGEC,wBAHF,CAIE;AAJF,OAKO,cALP;AAOA,eAAe;AACbF,EAAAA,gBAAgB,EAAEA,gBADL;AAEbC,EAAAA,kBAAkB,EAAEA,kBAFP;AAGbC,EAAAA,wBAAwB,EACtBA;AAJW,CAAf","sourcesContent":["import type {\n TouchableOpacity as RNTouchableOpacity,\n TouchableHighlight as RNTouchableHighlight,\n TouchableWithoutFeedback as RNTouchableWithoutFeedback,\n} from 'react-native';\n\nimport {\n TouchableOpacity,\n TouchableHighlight,\n TouchableWithoutFeedback,\n // @ts-ignore\n} from './Touchables';\n\nexport default {\n TouchableOpacity: TouchableOpacity as any as typeof RNTouchableOpacity,\n TouchableHighlight: TouchableHighlight as any as typeof RNTouchableHighlight,\n TouchableWithoutFeedback:\n TouchableWithoutFeedback as any as typeof RNTouchableWithoutFeedback,\n};\n"]} \ No newline at end of file diff --git a/lib/module/constants.js b/lib/module/constants.js new file mode 100644 index 000000000..b5a576b1d --- /dev/null +++ b/lib/module/constants.js @@ -0,0 +1,128 @@ +import { Dimensions, Platform } from 'react-native'; +import { Easing } from 'react-native-reanimated'; +const { + height: WINDOW_HEIGHT, + width: WINDOW_WIDTH +} = Dimensions.get('window'); +const { + height: SCREEN_HEIGHT, + width: SCREEN_WIDTH +} = Dimensions.get('screen'); +var GESTURE_SOURCE; + +(function (GESTURE_SOURCE) { + GESTURE_SOURCE[GESTURE_SOURCE["UNDETERMINED"] = 0] = "UNDETERMINED"; + GESTURE_SOURCE[GESTURE_SOURCE["SCROLLABLE"] = 1] = "SCROLLABLE"; + GESTURE_SOURCE[GESTURE_SOURCE["HANDLE"] = 2] = "HANDLE"; + GESTURE_SOURCE[GESTURE_SOURCE["CONTENT"] = 3] = "CONTENT"; +})(GESTURE_SOURCE || (GESTURE_SOURCE = {})); + +var SHEET_STATE; + +(function (SHEET_STATE) { + SHEET_STATE[SHEET_STATE["CLOSED"] = 0] = "CLOSED"; + SHEET_STATE[SHEET_STATE["OPENED"] = 1] = "OPENED"; + SHEET_STATE[SHEET_STATE["EXTENDED"] = 2] = "EXTENDED"; + SHEET_STATE[SHEET_STATE["OVER_EXTENDED"] = 3] = "OVER_EXTENDED"; + SHEET_STATE[SHEET_STATE["FILL_PARENT"] = 4] = "FILL_PARENT"; +})(SHEET_STATE || (SHEET_STATE = {})); + +var SCROLLABLE_STATE; + +(function (SCROLLABLE_STATE) { + SCROLLABLE_STATE[SCROLLABLE_STATE["LOCKED"] = 0] = "LOCKED"; + SCROLLABLE_STATE[SCROLLABLE_STATE["UNLOCKED"] = 1] = "UNLOCKED"; + SCROLLABLE_STATE[SCROLLABLE_STATE["UNDETERMINED"] = 2] = "UNDETERMINED"; +})(SCROLLABLE_STATE || (SCROLLABLE_STATE = {})); + +var SCROLLABLE_TYPE; + +(function (SCROLLABLE_TYPE) { + SCROLLABLE_TYPE[SCROLLABLE_TYPE["UNDETERMINED"] = 0] = "UNDETERMINED"; + SCROLLABLE_TYPE[SCROLLABLE_TYPE["VIEW"] = 1] = "VIEW"; + SCROLLABLE_TYPE[SCROLLABLE_TYPE["FLATLIST"] = 2] = "FLATLIST"; + SCROLLABLE_TYPE[SCROLLABLE_TYPE["SCROLLVIEW"] = 3] = "SCROLLVIEW"; + SCROLLABLE_TYPE[SCROLLABLE_TYPE["SECTIONLIST"] = 4] = "SECTIONLIST"; + SCROLLABLE_TYPE[SCROLLABLE_TYPE["VIRTUALIZEDLIST"] = 5] = "VIRTUALIZEDLIST"; +})(SCROLLABLE_TYPE || (SCROLLABLE_TYPE = {})); + +var ANIMATION_STATE; + +(function (ANIMATION_STATE) { + ANIMATION_STATE[ANIMATION_STATE["UNDETERMINED"] = 0] = "UNDETERMINED"; + ANIMATION_STATE[ANIMATION_STATE["RUNNING"] = 1] = "RUNNING"; + ANIMATION_STATE[ANIMATION_STATE["STOPPED"] = 2] = "STOPPED"; + ANIMATION_STATE[ANIMATION_STATE["INTERRUPTED"] = 3] = "INTERRUPTED"; +})(ANIMATION_STATE || (ANIMATION_STATE = {})); + +var ANIMATION_SOURCE; + +(function (ANIMATION_SOURCE) { + ANIMATION_SOURCE[ANIMATION_SOURCE["NONE"] = 0] = "NONE"; + ANIMATION_SOURCE[ANIMATION_SOURCE["MOUNT"] = 1] = "MOUNT"; + ANIMATION_SOURCE[ANIMATION_SOURCE["GESTURE"] = 2] = "GESTURE"; + ANIMATION_SOURCE[ANIMATION_SOURCE["USER"] = 3] = "USER"; + ANIMATION_SOURCE[ANIMATION_SOURCE["CONTAINER_RESIZE"] = 4] = "CONTAINER_RESIZE"; + ANIMATION_SOURCE[ANIMATION_SOURCE["SNAP_POINT_CHANGE"] = 5] = "SNAP_POINT_CHANGE"; + ANIMATION_SOURCE[ANIMATION_SOURCE["KEYBOARD"] = 6] = "KEYBOARD"; +})(ANIMATION_SOURCE || (ANIMATION_SOURCE = {})); + +var ANIMATION_METHOD; + +(function (ANIMATION_METHOD) { + ANIMATION_METHOD[ANIMATION_METHOD["TIMING"] = 0] = "TIMING"; + ANIMATION_METHOD[ANIMATION_METHOD["SPRING"] = 1] = "SPRING"; +})(ANIMATION_METHOD || (ANIMATION_METHOD = {})); + +var KEYBOARD_STATE; + +(function (KEYBOARD_STATE) { + KEYBOARD_STATE[KEYBOARD_STATE["UNDETERMINED"] = 0] = "UNDETERMINED"; + KEYBOARD_STATE[KEYBOARD_STATE["SHOWN"] = 1] = "SHOWN"; + KEYBOARD_STATE[KEYBOARD_STATE["HIDDEN"] = 2] = "HIDDEN"; +})(KEYBOARD_STATE || (KEYBOARD_STATE = {})); + +const ANIMATION_EASING = Easing.out(Easing.exp); +const ANIMATION_DURATION = 250; +const ANIMATION_CONFIGS_IOS = { + damping: 500, + stiffness: 1000, + mass: 3, + overshootClamping: true, + restDisplacementThreshold: 10, + restSpeedThreshold: 10 +}; +const ANIMATION_CONFIGS_ANDROID = { + duration: ANIMATION_DURATION, + easing: ANIMATION_EASING +}; +const ANIMATION_CONFIGS = Platform.OS === 'ios' ? ANIMATION_CONFIGS_IOS : ANIMATION_CONFIGS_ANDROID; +const SCROLLABLE_DECELERATION_RATE_MAPPER = { + [SCROLLABLE_STATE.UNDETERMINED]: 0, + [SCROLLABLE_STATE.LOCKED]: 0, + [SCROLLABLE_STATE.UNLOCKED]: Platform.select({ + ios: 0.998, + android: 0.985, + default: 1 + }) +}; +const MODAL_STACK_BEHAVIOR = { + replace: 'replace', + push: 'push' +}; +const KEYBOARD_BEHAVIOR = { + interactive: 'interactive', + extend: 'extend', + fillParent: 'fillParent' +}; +const KEYBOARD_BLUR_BEHAVIOR = { + none: 'none', + restore: 'restore' +}; +const KEYBOARD_INPUT_MODE = { + adjustPan: 'adjustPan', + adjustResize: 'adjustResize' +}; +const KEYBOARD_DISMISS_THRESHOLD = 12.5; +export { GESTURE_SOURCE, SHEET_STATE, ANIMATION_STATE, ANIMATION_METHOD, ANIMATION_SOURCE, SCROLLABLE_TYPE, SCROLLABLE_STATE, KEYBOARD_STATE, WINDOW_HEIGHT, WINDOW_WIDTH, SCREEN_HEIGHT, SCREEN_WIDTH, SCROLLABLE_DECELERATION_RATE_MAPPER, MODAL_STACK_BEHAVIOR, KEYBOARD_BEHAVIOR, KEYBOARD_BLUR_BEHAVIOR, KEYBOARD_INPUT_MODE, KEYBOARD_DISMISS_THRESHOLD, ANIMATION_CONFIGS, ANIMATION_EASING, ANIMATION_DURATION }; +//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/lib/module/constants.js.map b/lib/module/constants.js.map new file mode 100644 index 000000000..ad6997b03 --- /dev/null +++ b/lib/module/constants.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["constants.ts"],"names":["Dimensions","Platform","Easing","height","WINDOW_HEIGHT","width","WINDOW_WIDTH","get","SCREEN_HEIGHT","SCREEN_WIDTH","GESTURE_SOURCE","SHEET_STATE","SCROLLABLE_STATE","SCROLLABLE_TYPE","ANIMATION_STATE","ANIMATION_SOURCE","ANIMATION_METHOD","KEYBOARD_STATE","ANIMATION_EASING","out","exp","ANIMATION_DURATION","ANIMATION_CONFIGS_IOS","damping","stiffness","mass","overshootClamping","restDisplacementThreshold","restSpeedThreshold","ANIMATION_CONFIGS_ANDROID","duration","easing","ANIMATION_CONFIGS","OS","SCROLLABLE_DECELERATION_RATE_MAPPER","UNDETERMINED","LOCKED","UNLOCKED","select","ios","android","default","MODAL_STACK_BEHAVIOR","replace","push","KEYBOARD_BEHAVIOR","interactive","extend","fillParent","KEYBOARD_BLUR_BEHAVIOR","none","restore","KEYBOARD_INPUT_MODE","adjustPan","adjustResize","KEYBOARD_DISMISS_THRESHOLD"],"mappings":"AAAA,SAASA,UAAT,EAAqBC,QAArB,QAAqC,cAArC;AACA,SAAmBC,MAAnB,QAAiC,yBAAjC;AAEA,MAAM;AAAEC,EAAAA,MAAM,EAAEC,aAAV;AAAyBC,EAAAA,KAAK,EAAEC;AAAhC,IAAiDN,UAAU,CAACO,GAAX,CAAe,QAAf,CAAvD;AACA,MAAM;AAAEJ,EAAAA,MAAM,EAAEK,aAAV;AAAyBH,EAAAA,KAAK,EAAEI;AAAhC,IA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AAG;AAC7BC,EAAAA,IAAI,EAAE,MADuB;AAE7BC,EAAAA,OAAO,EAAE;AAFoB,CAA/B;AAKA,MAAMC,mBAAmB,GAAG;AAC1BC,EAAAA,SAAS,EAAE,WADe;AAE1BC,EAAAA,YAAY,EAAE;AAFY,CAA5B;AAKA,MAAMC,0BAA0B,GAAG,IAAnC;AAEA,SACE7C,cADF,EAEEC,WAFF,EAGEG,eAHF,EAIEE,gBAJF,EAKED,gBALF,EAMEF,eANF,EAOED,gBAPF,EAQEK,cARF,EASEb,aATF,EAUEE,YAVF,EAWEE,aAXF,EAYEC,YAZF,EAaEyB,mCAbF,EAcEQ,oBAdF,EAeEG,iBAfF,EAgBEI,sBAhBF,EAiBEG,mBAjBF,EAkBEG,0BAlBF,EAmBEvB,iBAnBF,EAoBEd,gBApBF,EAqBEG,kBArBF","sourcesContent":["import { Dimensions, Platform } from 'react-native';\nimport Animated, { Easing } from 'react-native-reanimated';\n\nconst { height: WINDOW_HEIGHT, width: WINDOW_WIDTH } = Dimensions.get('window');\nconst { height: SCREEN_HEIGHT, width: SCREEN_WIDTH } = Dimensions.get('screen');\n\nenum GESTURE_SOURCE {\n UNDETERMINED = 0,\n SCROLLABLE,\n HANDLE,\n CONTENT,\n}\n\nenum SHEET_STATE {\n CLOSED = 0,\n OPENED,\n EXTENDED,\n OVER_EXTENDED,\n FILL_PARENT,\n}\n\nenum SCROLLABLE_STATE {\n LOCKED = 0,\n UNLOCKED,\n UNDETERMINED,\n}\n\nenum SCROLLABLE_TYPE {\n UNDETERMINED = 0,\n VIEW,\n FLATLIST,\n SCROLLVIEW,\n SECTIONLIST,\n VIRTUALIZEDLIST,\n}\n\nenum ANIMATION_STATE {\n UNDETERMINED = 0,\n RUNNING,\n STOPPED,\n INTERRUPTED,\n}\n\nenum ANIMATION_SOURCE {\n NONE = 0,\n MOUNT,\n GESTURE,\n USER,\n CONTAINER_RESIZE,\n SNAP_POINT_CHANGE,\n KEYBOARD,\n}\n\nenum ANIMATION_METHOD {\n TIMING,\n SPRING,\n}\n\nenum KEYBOARD_STATE {\n UNDETERMINED = 0,\n SHOWN,\n HIDDEN,\n}\n\nconst ANIMATION_EASING: Animated.EasingFunction = Easing.out(Easing.exp);\nconst ANIMATION_DURATION = 250;\n\nconst ANIMATION_CONFIGS_IOS = {\n damping: 500,\n stiffness: 1000,\n mass: 3,\n overshootClamping: true,\n restDisplacementThreshold: 10,\n restSpeedThreshold: 10,\n};\n\nconst ANIMATION_CONFIGS_ANDROID = {\n duration: ANIMATION_DURATION,\n easing: ANIMATION_EASING,\n};\n\nconst ANIMATION_CONFIGS =\n Platform.OS === 'ios' ? ANIMATION_CONFIGS_IOS : ANIMATION_CONFIGS_ANDROID;\n\nconst SCROLLABLE_DECELERATION_RATE_MAPPER = {\n [SCROLLABLE_STATE.UNDETERMINED]: 0,\n [SCROLLABLE_STATE.LOCKED]: 0,\n [SCROLLABLE_STATE.UNLOCKED]: Platform.select({\n ios: 0.998,\n android: 0.985,\n default: 1,\n }),\n};\n\nconst MODAL_STACK_BEHAVIOR = {\n replace: 'replace',\n push: 'push',\n};\n\nconst KEYBOARD_BEHAVIOR = {\n interactive: 'interactive',\n extend: 'extend',\n fillParent: 'fillParent',\n} as const;\n\nconst KEYBOARD_BLUR_BEHAVIOR = {\n none: 'none',\n restore: 'restore',\n} as const;\n\nconst KEYBOARD_INPUT_MODE = {\n adjustPan: 'adjustPan',\n adjustResize: 'adjustResize',\n} as const;\n\nconst KEYBOARD_DISMISS_THRESHOLD = 12.5;\n\nexport {\n GESTURE_SOURCE,\n SHEET_STATE,\n ANIMATION_STATE,\n ANIMATION_METHOD,\n ANIMATION_SOURCE,\n SCROLLABLE_TYPE,\n SCROLLABLE_STATE,\n KEYBOARD_STATE,\n WINDOW_HEIGHT,\n WINDOW_WIDTH,\n SCREEN_HEIGHT,\n SCREEN_WIDTH,\n SCROLLABLE_DECELERATION_RATE_MAPPER,\n MODAL_STACK_BEHAVIOR,\n KEYBOARD_BEHAVIOR,\n KEYBOARD_BLUR_BEHAVIOR,\n KEYBOARD_INPUT_MODE,\n KEYBOARD_DISMISS_THRESHOLD,\n ANIMATION_CONFIGS,\n ANIMATION_EASING,\n ANIMATION_DURATION,\n};\n"]} \ No newline at end of file diff --git a/lib/module/contexts/external.js b/lib/module/contexts/external.js new file mode 100644 index 000000000..fa5e24e89 --- /dev/null +++ b/lib/module/contexts/external.js @@ -0,0 +1,4 @@ +import { createContext } from 'react'; +export const BottomSheetContext = /*#__PURE__*/createContext(null); +export const BottomSheetProvider = BottomSheetContext.Provider; +//# sourceMappingURL=external.js.map \ No newline at end of file diff --git a/lib/module/contexts/external.js.map b/lib/module/contexts/external.js.map new file mode 100644 index 000000000..9cec4b916 --- /dev/null +++ b/lib/module/contexts/external.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["external.ts"],"names":["createContext","BottomSheetContext","BottomSheetProvider","Provider"],"mappings":"AAAA,SAASA,aAAT,QAA8B,OAA9B;AAGA,OAAO,MAAMC,kBAAkB,gBAAGD,aAAa,CAE7C,IAF6C,CAAxC;AAIP,OAAO,MAAME,mBAAmB,GAAGD,kBAAkB,CAACE,QAA/C","sourcesContent":["import { createContext } from 'react';\nimport type { BottomSheetMethods, BottomSheetVariables } from '../types';\n\nexport const BottomSheetContext = createContext<\n (BottomSheetMethods & BottomSheetVariables) | null\n>(null);\n\nexport const BottomSheetProvider = BottomSheetContext.Provider;\n"]} \ No newline at end of file diff --git a/lib/module/contexts/gesture.js b/lib/module/contexts/gesture.js new file mode 100644 index 000000000..8b82097e2 --- /dev/null +++ b/lib/module/contexts/gesture.js @@ -0,0 +1,3 @@ +import { createContext } from 'react'; +export const BottomSheetGestureHandlersContext = /*#__PURE__*/createContext(null); +//# sourceMappingURL=gesture.js.map \ No newline at end of file diff --git a/lib/module/contexts/gesture.js.map b/lib/module/contexts/gesture.js.map new file mode 100644 index 000000000..754f3c09b --- /dev/null +++ b/lib/module/contexts/gesture.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["gesture.ts"],"names":["createContext","BottomSheetGestureHandlersContext"],"mappings":"AAAA,SAASA,aAAT,QAA8B,OAA9B;AASA,OAAO,MAAMC,iCAAiC,gBAC5CD,aAAa,CAA+C,IAA/C,CADR","sourcesContent":["import { createContext } from 'react';\nimport type { PanGestureHandlerGestureEvent } from 'react-native-gesture-handler';\n\nexport interface BottomSheetGestureHandlersContextType {\n contentPanGestureHandler: (event: PanGestureHandlerGestureEvent) => void;\n handlePanGestureHandler: (event: PanGestureHandlerGestureEvent) => void;\n scrollablePanGestureHandler: (event: PanGestureHandlerGestureEvent) => void;\n}\n\nexport const BottomSheetGestureHandlersContext =\n createContext(null);\n"]} \ No newline at end of file diff --git a/lib/module/contexts/index.js b/lib/module/contexts/index.js new file mode 100644 index 000000000..a6f79061c --- /dev/null +++ b/lib/module/contexts/index.js @@ -0,0 +1,6 @@ +export { BottomSheetContext, BottomSheetProvider } from './external'; +export { BottomSheetInternalContext, BottomSheetInternalProvider } from './internal'; +export { BottomSheetGestureHandlersContext } from './gesture'; +export { BottomSheetModalContext, BottomSheetModalProvider } from './modal/external'; +export { BottomSheetModalInternalContext, BottomSheetModalInternalProvider } from './modal/internal'; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/contexts/index.js.map b/lib/module/contexts/index.js.map new file mode 100644 index 000000000..3d4bb1a9f --- /dev/null +++ b/lib/module/contexts/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":["BottomSheetContext","BottomSheetProvider","BottomSheetInternalContext","BottomSheetInternalProvider","BottomSheetGestureHandlersContext","BottomSheetModalContext","BottomSheetModalProvider","BottomSheetModalInternalContext","BottomSheetModalInternalProvider"],"mappings":"AAAA,SAASA,kBAAT,EAA6BC,mBAA7B,QAAwD,YAAxD;AACA,SACEC,0BADF,EAEEC,2BAFF,QAGO,YAHP;AAIA,SAASC,iCAAT,QAAkD,WAAlD;AACA,SACEC,uBADF,EAEEC,wBAFF,QAGO,kBAHP;AAIA,SACEC,+BADF,EAEEC,gCAFF,QAGO,kBAHP","sourcesContent":["export { BottomSheetContext, BottomSheetProvider } from './external';\nexport {\n BottomSheetInternalContext,\n BottomSheetInternalProvider,\n} from './internal';\nexport { BottomSheetGestureHandlersContext } from './gesture';\nexport {\n BottomSheetModalContext,\n BottomSheetModalProvider,\n} from './modal/external';\nexport {\n BottomSheetModalInternalContext,\n BottomSheetModalInternalProvider,\n} from './modal/internal';\nexport type { BottomSheetModalInternalContextType } from './modal/internal';\n"]} \ No newline at end of file diff --git a/lib/module/contexts/internal.js b/lib/module/contexts/internal.js new file mode 100644 index 000000000..0f014be5e --- /dev/null +++ b/lib/module/contexts/internal.js @@ -0,0 +1,4 @@ +import { createContext } from 'react'; +export const BottomSheetInternalContext = /*#__PURE__*/createContext(null); +export const BottomSheetInternalProvider = BottomSheetInternalContext.Provider; +//# sourceMappingURL=internal.js.map \ No newline at end of file diff --git a/lib/module/contexts/internal.js.map b/lib/module/contexts/internal.js.map new file mode 100644 index 000000000..61dac4523 --- /dev/null +++ b/lib/module/contexts/internal.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["internal.ts"],"names":["createContext","BottomSheetInternalContext","BottomSheetInternalProvider","Provider"],"mappings":"AAAA,SAASA,aAAT,QAAyC,OAAzC;AA0EA,OAAO,MAAMC,0BAA0B,gBACrCD,aAAa,CAAwC,IAAxC,CADR;AAGP,OAAO,MAAME,2BAA2B,GAAGD,0BAA0B,CAACE,QAA/D","sourcesContent":["import { createContext, RefObject } from 'react';\nimport type {\n PanGestureHandlerProps,\n State,\n} from 'react-native-gesture-handler';\nimport type Animated from 'react-native-reanimated';\nimport type {\n AnimateToPositionType,\n BottomSheetProps,\n} from '../components/bottomSheet/types';\nimport type {\n ANIMATION_STATE,\n KEYBOARD_STATE,\n SCROLLABLE_STATE,\n SCROLLABLE_TYPE,\n SHEET_STATE,\n} from '../constants';\nimport type { Scrollable, ScrollableRef } from '../types';\n\nexport interface BottomSheetInternalContextType\n extends Pick<\n PanGestureHandlerProps,\n | 'activeOffsetY'\n | 'activeOffsetX'\n | 'failOffsetY'\n | 'failOffsetX'\n | 'waitFor'\n | 'simultaneousHandlers'\n >,\n Required<\n Pick<\n BottomSheetProps,\n | 'enableContentPanningGesture'\n | 'enableOverDrag'\n | 'enablePanDownToClose'\n | 'enableDynamicSizing'\n | 'overDragResistanceFactor'\n >\n > {\n // animated states\n animatedAnimationState: Animated.SharedValue;\n animatedSheetState: Animated.SharedValue;\n animatedScrollableState: Animated.SharedValue;\n animatedKeyboardState: Animated.SharedValue;\n animatedContentGestureState: Animated.SharedValue;\n animatedHandleGestureState: Animated.SharedValue;\n\n // animated values\n animatedSnapPoints: Animated.SharedValue;\n animatedPosition: Animated.SharedValue;\n animatedIndex: Animated.SharedValue;\n animatedContainerHeight: Animated.SharedValue;\n animatedContentHeight: Animated.SharedValue;\n animatedHighestSnapPoint: Animated.SharedValue;\n animatedClosedPosition: Animated.SharedValue;\n animatedFooterHeight: Animated.SharedValue;\n animatedHandleHeight: Animated.SharedValue;\n animatedKeyboardHeight: Animated.SharedValue;\n animatedKeyboardHeightInContainer: Animated.SharedValue;\n animatedScrollableType: Animated.SharedValue;\n animatedScrollableContentOffsetY: Animated.SharedValue;\n animatedScrollableOverrideState: Animated.SharedValue;\n isScrollableRefreshable: Animated.SharedValue;\n isContentHeightFixed: Animated.SharedValue;\n isInTemporaryPosition: Animated.SharedValue;\n shouldHandleKeyboardEvents: Animated.SharedValue;\n\n // methods\n stopAnimation: () => void;\n animateToPosition: AnimateToPositionType;\n setScrollableRef: (ref: ScrollableRef) => void;\n removeScrollableRef: (ref: RefObject) => void;\n}\n\nexport const BottomSheetInternalContext =\n createContext(null);\n\nexport const BottomSheetInternalProvider = BottomSheetInternalContext.Provider;\n"]} \ No newline at end of file diff --git a/lib/module/contexts/modal/external.js b/lib/module/contexts/modal/external.js new file mode 100644 index 000000000..ab8d2dd2a --- /dev/null +++ b/lib/module/contexts/modal/external.js @@ -0,0 +1,4 @@ +import { createContext } from 'react'; +export const BottomSheetModalContext = /*#__PURE__*/createContext(null); +export const BottomSheetModalProvider = BottomSheetModalContext.Provider; +//# sourceMappingURL=external.js.map \ No newline at end of file diff --git a/lib/module/contexts/modal/external.js.map b/lib/module/contexts/modal/external.js.map new file mode 100644 index 000000000..3a7283fc7 --- /dev/null +++ b/lib/module/contexts/modal/external.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["external.ts"],"names":["createContext","BottomSheetModalContext","BottomSheetModalProvider","Provider"],"mappings":"AAAA,SAASA,aAAT,QAA8B,OAA9B;AAOA,OAAO,MAAMC,uBAAuB,gBAClCD,aAAa,CAAqC,IAArC,CADR;AAGP,OAAO,MAAME,wBAAwB,GAAGD,uBAAuB,CAACE,QAAzD","sourcesContent":["import { createContext } from 'react';\n\nexport interface BottomSheetModalContextType {\n dismiss: (key?: string) => boolean;\n dismissAll: () => void;\n}\n\nexport const BottomSheetModalContext =\n createContext(null);\n\nexport const BottomSheetModalProvider = BottomSheetModalContext.Provider;\n"]} \ No newline at end of file diff --git a/lib/module/contexts/modal/internal.js b/lib/module/contexts/modal/internal.js new file mode 100644 index 000000000..86eac195d --- /dev/null +++ b/lib/module/contexts/modal/internal.js @@ -0,0 +1,4 @@ +import { createContext } from 'react'; +export const BottomSheetModalInternalContext = /*#__PURE__*/createContext(null); +export const BottomSheetModalInternalProvider = BottomSheetModalInternalContext.Provider; +//# sourceMappingURL=internal.js.map \ No newline at end of file diff --git a/lib/module/contexts/modal/internal.js.map b/lib/module/contexts/modal/internal.js.map new file mode 100644 index 000000000..df89efdcb --- /dev/null +++ b/lib/module/contexts/modal/internal.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["internal.ts"],"names":["createContext","BottomSheetModalInternalContext","BottomSheetModalInternalProvider","Provider"],"mappings":"AAAA,SAASA,aAAT,QAAmC,OAAnC;AAkBA,OAAO,MAAMC,+BAA+B,gBAC1CD,aAAa,CAA6C,IAA7C,CADR;AAGP,OAAO,MAAME,gCAAgC,GAC3CD,+BAA+B,CAACE,QAD3B","sourcesContent":["import { createContext, Ref } from 'react';\nimport type { Insets } from 'react-native';\nimport type Animated from 'react-native-reanimated';\nimport type BottomSheet from '../../components/bottomSheet';\nimport type { BottomSheetModalStackBehavior } from '../../components/bottomSheetModal';\n\nexport interface BottomSheetModalInternalContextType {\n containerHeight: Animated.SharedValue;\n containerOffset: Animated.SharedValue>;\n mountSheet: (\n key: string,\n ref: Ref,\n stackBehavior: BottomSheetModalStackBehavior\n ) => void;\n unmountSheet: (key: string) => void;\n willUnmountSheet: (key: string) => void;\n}\n\nexport const BottomSheetModalInternalContext =\n createContext(null);\n\nexport const BottomSheetModalInternalProvider =\n BottomSheetModalInternalContext.Provider;\n"]} \ No newline at end of file diff --git a/lib/module/hooks/index.js b/lib/module/hooks/index.js new file mode 100644 index 000000000..0acb902a1 --- /dev/null +++ b/lib/module/hooks/index.js @@ -0,0 +1,21 @@ +export { useBottomSheet } from './useBottomSheet'; +export { useBottomSheetInternal } from './useBottomSheetInternal'; // modal + +export { useBottomSheetModal } from './useBottomSheetModal'; +export { useBottomSheetModalInternal } from './useBottomSheetModalInternal'; // scrollable + +export { useScrollable } from './useScrollable'; +export { useScrollableSetter } from './useScrollableSetter'; +export { useScrollHandler } from './useScrollHandler'; // gestures + +export { useGestureHandler } from './useGestureHandler'; +export { useGestureEventsHandlersDefault } from './useGestureEventsHandlersDefault'; // utilities + +export { useKeyboard } from './useKeyboard'; +export { useStableCallback } from './useStableCallback'; +export { usePropsValidator } from './usePropsValidator'; +export { useNormalizedSnapPoints } from './useNormalizedSnapPoints'; +export { useReactiveSharedValue } from './useReactiveSharedValue'; +export { useBottomSheetDynamicSnapPoints } from './useBottomSheetDynamicSnapPoints'; +export { useBottomSheetGestureHandlers } from './useBottomSheetGestureHandlers'; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/hooks/index.js.map b/lib/module/hooks/index.js.map new file mode 100644 index 000000000..098ee80e4 --- /dev/null +++ b/lib/module/hooks/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":["useBottomSheet","useBottomSheetInternal","useBottomSheetModal","useBottomSheetModalInternal","useScrollable","useScrollableSetter","useScrollHandler","useGestureHandler","useGestureEventsHandlersDefault","useKeyboard","useStableCallback","usePropsValidator","useNormalizedSnapPoints","useReactiveSharedValue","useBottomSheetDynamicSnapPoints","useBottomSheetGestureHandlers"],"mappings":"AAAA,SAASA,cAAT,QAA+B,kBAA/B;AACA,SAASC,sBAAT,QAAuC,0BAAvC,C,CAEA;;AACA,SAASC,mBAAT,QAAoC,uBAApC;AACA,SAASC,2BAAT,QAA4C,+BAA5C,C,CAEA;;AACA,SAASC,aAAT,QAA8B,iBAA9B;AACA,SAASC,mBAAT,QAAoC,uBAApC;AACA,SAASC,gBAAT,QAAiC,oBAAjC,C,CAEA;;AACA,SAASC,iBAAT,QAAkC,qBAAlC;AACA,SAASC,+BAAT,QAAgD,mCAAhD,C,CAEA;;AACA,SAASC,WAAT,QAA4B,eAA5B;AACA,SAASC,iBAAT,QAAkC,qBAAlC;AACA,SAASC,iBAAT,QAAkC,qBAAlC;AACA,SAASC,uBAAT,QAAwC,2BAAxC;AACA,SAASC,sBAAT,QAAuC,0BAAvC;AACA,SAASC,+BAAT,QAAgD,mCAAhD;AACA,SAASC,6BAAT,QAA8C,iCAA9C","sourcesContent":["export { useBottomSheet } from './useBottomSheet';\nexport { useBottomSheetInternal } from './useBottomSheetInternal';\n\n// modal\nexport { useBottomSheetModal } from './useBottomSheetModal';\nexport { useBottomSheetModalInternal } from './useBottomSheetModalInternal';\n\n// scrollable\nexport { useScrollable } from './useScrollable';\nexport { useScrollableSetter } from './useScrollableSetter';\nexport { useScrollHandler } from './useScrollHandler';\n\n// gestures\nexport { useGestureHandler } from './useGestureHandler';\nexport { useGestureEventsHandlersDefault } from './useGestureEventsHandlersDefault';\n\n// utilities\nexport { useKeyboard } from './useKeyboard';\nexport { useStableCallback } from './useStableCallback';\nexport { usePropsValidator } from './usePropsValidator';\nexport { useNormalizedSnapPoints } from './useNormalizedSnapPoints';\nexport { useReactiveSharedValue } from './useReactiveSharedValue';\nexport { useBottomSheetDynamicSnapPoints } from './useBottomSheetDynamicSnapPoints';\nexport { useBottomSheetGestureHandlers } from './useBottomSheetGestureHandlers';\n"]} \ No newline at end of file diff --git a/lib/module/hooks/useBottomSheet.js b/lib/module/hooks/useBottomSheet.js new file mode 100644 index 000000000..0f3e384c4 --- /dev/null +++ b/lib/module/hooks/useBottomSheet.js @@ -0,0 +1,12 @@ +import { useContext } from 'react'; +import { BottomSheetContext } from '../contexts/external'; +export const useBottomSheet = () => { + const context = useContext(BottomSheetContext); + + if (context === null) { + throw "'useBottomSheet' cannot be used out of the BottomSheet!"; + } + + return context; +}; +//# sourceMappingURL=useBottomSheet.js.map \ No newline at end of file diff --git a/lib/module/hooks/useBottomSheet.js.map b/lib/module/hooks/useBottomSheet.js.map new file mode 100644 index 000000000..584ac4b0e --- /dev/null +++ b/lib/module/hooks/useBottomSheet.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["useBottomSheet.ts"],"names":["useContext","BottomSheetContext","useBottomSheet","context"],"mappings":"AAAA,SAASA,UAAT,QAA2B,OAA3B;AACA,SAASC,kBAAT,QAAmC,sBAAnC;AAEA,OAAO,MAAMC,cAAc,GAAG,MAAM;AAClC,QAAMC,OAAO,GAAGH,UAAU,CAACC,kBAAD,CAA1B;;AAEA,MAAIE,OAAO,KAAK,IAAhB,EAAsB;AACpB,UAAM,yDAAN;AACD;;AAED,SAAOA,OAAP;AACD,CARM","sourcesContent":["import { useContext } from 'react';\nimport { BottomSheetContext } from '../contexts/external';\n\nexport const useBottomSheet = () => {\n const context = useContext(BottomSheetContext);\n\n if (context === null) {\n throw \"'useBottomSheet' cannot be used out of the BottomSheet!\";\n }\n\n return context;\n};\n"]} \ No newline at end of file diff --git a/lib/module/hooks/useBottomSheetDynamicSnapPoints.js b/lib/module/hooks/useBottomSheetDynamicSnapPoints.js new file mode 100644 index 000000000..0dbc9e8a4 --- /dev/null +++ b/lib/module/hooks/useBottomSheetDynamicSnapPoints.js @@ -0,0 +1,53 @@ +import { useCallback, useEffect } from 'react'; +import { useDerivedValue, useSharedValue } from 'react-native-reanimated'; +import { INITIAL_HANDLE_HEIGHT, INITIAL_SNAP_POINT } from '../components/bottomSheet/constants'; +/** + * Provides dynamic content height calculating functionalities, by + * replacing the placeholder `CONTENT_HEIGHT` with calculated layout. + * @example + * [0, 'CONTENT_HEIGHT', '100%'] + * @param initialSnapPoints your snap point with content height placeholder. + * @returns { + * - animatedSnapPoints: an animated snap points to be set on `BottomSheet` or `BottomSheetModal`. + * - animatedHandleHeight: an animated handle height callback node to be set on `BottomSheet` or `BottomSheetModal`. + * - animatedContentHeight: an animated content height callback node to be set on `BottomSheet` or `BottomSheetModal`. + * - handleContentLayout: a `onLayout` callback method to be set on `BottomSheetView` component. + * } + * @deprecated will be deprecated in the next major release! please use the new introduce prop `enableDynamicSizing`. + */ + +export const useBottomSheetDynamicSnapPoints = initialSnapPoints => { + // variables + const animatedContentHeight = useSharedValue(0); + const animatedHandleHeight = useSharedValue(INITIAL_HANDLE_HEIGHT); + const animatedSnapPoints = useDerivedValue(() => { + if (animatedHandleHeight.value === INITIAL_HANDLE_HEIGHT || animatedContentHeight.value === 0) { + return initialSnapPoints.map(() => INITIAL_SNAP_POINT); + } + + const contentWithHandleHeight = animatedContentHeight.value + animatedHandleHeight.value; + return initialSnapPoints.map(snapPoint => snapPoint === 'CONTENT_HEIGHT' ? contentWithHandleHeight : snapPoint); + }, []); + // callbacks + const handleContentLayout = useCallback(({ + nativeEvent: { + layout: { + height + } + } + }) => { + animatedContentHeight.value = height; + }, [animatedContentHeight]); //#region effects + + useEffect(() => { + console.warn('`useBottomSheetDynamicSnapPoints` will be deprecated in the next major release! please use the new introduce prop `enableDynamicSizing`.'); + }, []); //#endregion + + return { + animatedSnapPoints, + animatedHandleHeight, + animatedContentHeight, + handleContentLayout + }; +}; +//# sourceMappingURL=useBottomSheetDynamicSnapPoints.js.map \ No newline at end of file diff --git a/lib/module/hooks/useBottomSheetDynamicSnapPoints.js.map b/lib/module/hooks/useBottomSheetDynamicSnapPoints.js.map new file mode 100644 index 000000000..948cf3dbe --- /dev/null +++ b/lib/module/hooks/useBottomSheetDynamicSnapPoints.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["useBottomSheetDynamicSnapPoints.ts"],"names":["useCallback","useEffect","useDerivedValue","useSharedValue","INITIAL_HANDLE_HEIGHT","INITIAL_SNAP_POINT","useBottomSheetDynamicSnapPoints","initialSnapPoints","animatedContentHeight","animatedHandleHeight","animatedSnapPoints","value","map","contentWithHandleHeight","snapPoint","handleContentLayout","nativeEvent","layout","height","console","warn"],"mappings":"AAAA,SAASA,WAAT,EAAsBC,SAAtB,QAAuC,OAAvC;AACA,SAASC,eAAT,EAA0BC,cAA1B,QAAgD,yBAAhD;AACA,SACEC,qBADF,EAEEC,kBAFF,QAGO,qCAHP;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,+BAA+B,GAC1CC,iBAD6C,IAE1C;AACH;AACA,QAAMC,qBAAqB,GAAGL,cAAc,CAAC,CAAD,CAA5C;AACA,QAAMM,oBAAoB,GAAGN,cAAc,CAACC,qBAAD,CAA3C;AACA,QAAMM,kBAAkB,GAAGR,eAAe,CAAC,MAAM;AAC/C,QACEO,oBAAoB,CAACE,KAArB,KAA+BP,qBAA/B,IACAI,qBAAqB,CAACG,KAAtB,KAAgC,CAFlC,EAGE;AACA,aAAOJ,iBAAiB,CAACK,GAAlB,CAAsB,MAAMP,kBAA5B,CAAP;AACD;;AACD,UAAMQ,uBAAuB,GAC3BL,qBAAqB,CAACG,KAAtB,GAA8BF,oBAAoB,CAACE,KADrD;AAGA,WAAOJ,iBAAiB,CAACK,GAAlB,CAAsBE,SAAS,IACpCA,SAAS,KAAK,gBAAd,GAAiCD,uBAAjC,GAA2DC,SADtD,CAAP;AAGD,GAbyC,EAavC,EAbuC,CAA1C;AAoBA;AACA,QAAMC,mBAAmB,GAAGf,WAAW,CACrC,CAAC;AACCgB,IAAAA,WAAW,EAAE;AACXC,MAAAA,MAAM,EAAE;AAAEC,QAAAA;AAAF;AADG;AADd,GAAD,KAIgC;AAC9BV,IAAAA,qBAAqB,CAACG,KAAtB,GAA8BO,MAA9B;AACD,GAPoC,EAQrC,CAACV,qBAAD,CARqC,CAAvC,CAzBG,CAoCH;;AACAP,EAAAA,SAAS,CAAC,MAAM;AACdkB,IAAAA,OAAO,CAACC,IAAR,CACE,0IADF;AAGD,GAJQ,EAIN,EAJM,CAAT,CArCG,CA0CH;;AACA,SAAO;AACLV,IAAAA,kBADK;AAELD,IAAAA,oBAFK;AAGLD,IAAAA,qBAHK;AAILO,IAAAA;AAJK,GAAP;AAMD,CAnDM","sourcesContent":["import { useCallback, useEffect } from 'react';\nimport { useDerivedValue, useSharedValue } from 'react-native-reanimated';\nimport {\n INITIAL_HANDLE_HEIGHT,\n INITIAL_SNAP_POINT,\n} from '../components/bottomSheet/constants';\n\n/**\n * Provides dynamic content height calculating functionalities, by\n * replacing the placeholder `CONTENT_HEIGHT` with calculated layout.\n * @example\n * [0, 'CONTENT_HEIGHT', '100%']\n * @param initialSnapPoints your snap point with content height placeholder.\n * @returns {\n * - animatedSnapPoints: an animated snap points to be set on `BottomSheet` or `BottomSheetModal`.\n * - animatedHandleHeight: an animated handle height callback node to be set on `BottomSheet` or `BottomSheetModal`.\n * - animatedContentHeight: an animated content height callback node to be set on `BottomSheet` or `BottomSheetModal`.\n * - handleContentLayout: a `onLayout` callback method to be set on `BottomSheetView` component.\n * }\n * @deprecated will be deprecated in the next major release! please use the new introduce prop `enableDynamicSizing`.\n */\nexport const useBottomSheetDynamicSnapPoints = (\n initialSnapPoints: Array\n) => {\n // variables\n const animatedContentHeight = useSharedValue(0);\n const animatedHandleHeight = useSharedValue(INITIAL_HANDLE_HEIGHT);\n const animatedSnapPoints = useDerivedValue(() => {\n if (\n animatedHandleHeight.value === INITIAL_HANDLE_HEIGHT ||\n animatedContentHeight.value === 0\n ) {\n return initialSnapPoints.map(() => INITIAL_SNAP_POINT);\n }\n const contentWithHandleHeight =\n animatedContentHeight.value + animatedHandleHeight.value;\n\n return initialSnapPoints.map(snapPoint =>\n snapPoint === 'CONTENT_HEIGHT' ? contentWithHandleHeight : snapPoint\n );\n }, []);\n\n type HandleContentLayoutProps = {\n nativeEvent: {\n layout: { height: number };\n };\n };\n // callbacks\n const handleContentLayout = useCallback(\n ({\n nativeEvent: {\n layout: { height },\n },\n }: HandleContentLayoutProps) => {\n animatedContentHeight.value = height;\n },\n [animatedContentHeight]\n );\n\n //#region effects\n useEffect(() => {\n console.warn(\n '`useBottomSheetDynamicSnapPoints` will be deprecated in the next major release! please use the new introduce prop `enableDynamicSizing`.'\n );\n }, []);\n //#endregion\n return {\n animatedSnapPoints,\n animatedHandleHeight,\n animatedContentHeight,\n handleContentLayout,\n };\n};\n"]} \ No newline at end of file diff --git a/lib/module/hooks/useBottomSheetGestureHandlers.js b/lib/module/hooks/useBottomSheetGestureHandlers.js new file mode 100644 index 000000000..c9a3df458 --- /dev/null +++ b/lib/module/hooks/useBottomSheetGestureHandlers.js @@ -0,0 +1,12 @@ +import { useContext } from 'react'; +import { BottomSheetGestureHandlersContext } from '../contexts/gesture'; +export const useBottomSheetGestureHandlers = () => { + const context = useContext(BottomSheetGestureHandlersContext); + + if (context === null) { + throw "'useBottomSheetGestureHandlers' cannot be used out of the BottomSheet!"; + } + + return context; +}; +//# sourceMappingURL=useBottomSheetGestureHandlers.js.map \ No newline at end of file diff --git a/lib/module/hooks/useBottomSheetGestureHandlers.js.map b/lib/module/hooks/useBottomSheetGestureHandlers.js.map new file mode 100644 index 000000000..7a3105a5d --- /dev/null +++ b/lib/module/hooks/useBottomSheetGestureHandlers.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["useBottomSheetGestureHandlers.ts"],"names":["useContext","BottomSheetGestureHandlersContext","useBottomSheetGestureHandlers","context"],"mappings":"AAAA,SAASA,UAAT,QAA2B,OAA3B;AACA,SAASC,iCAAT,QAAkD,qBAAlD;AAEA,OAAO,MAAMC,6BAA6B,GAAG,MAAM;AACjD,QAAMC,OAAO,GAAGH,UAAU,CAACC,iCAAD,CAA1B;;AAEA,MAAIE,OAAO,KAAK,IAAhB,EAAsB;AACpB,UAAM,wEAAN;AACD;;AAED,SAAOA,OAAP;AACD,CARM","sourcesContent":["import { useContext } from 'react';\nimport { BottomSheetGestureHandlersContext } from '../contexts/gesture';\n\nexport const useBottomSheetGestureHandlers = () => {\n const context = useContext(BottomSheetGestureHandlersContext);\n\n if (context === null) {\n throw \"'useBottomSheetGestureHandlers' cannot be used out of the BottomSheet!\";\n }\n\n return context;\n};\n"]} \ No newline at end of file diff --git a/lib/module/hooks/useBottomSheetInternal.js b/lib/module/hooks/useBottomSheetInternal.js new file mode 100644 index 000000000..9c0714881 --- /dev/null +++ b/lib/module/hooks/useBottomSheetInternal.js @@ -0,0 +1,12 @@ +import { useContext } from 'react'; +import { BottomSheetInternalContext } from '../contexts/internal'; +export function useBottomSheetInternal(unsafe) { + const context = useContext(BottomSheetInternalContext); + + if (unsafe !== true && context === null) { + throw "'useBottomSheetInternal' cannot be used out of the BottomSheet!"; + } + + return context; +} +//# sourceMappingURL=useBottomSheetInternal.js.map \ No newline at end of file diff --git a/lib/module/hooks/useBottomSheetInternal.js.map b/lib/module/hooks/useBottomSheetInternal.js.map new file mode 100644 index 000000000..c4574ce96 --- /dev/null +++ b/lib/module/hooks/useBottomSheetInternal.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["useBottomSheetInternal.ts"],"names":["useContext","BottomSheetInternalContext","useBottomSheetInternal","unsafe","context"],"mappings":"AAAA,SAASA,UAAT,QAA2B,OAA3B;AACA,SACEC,0BADF,QAGO,sBAHP;AAaA,OAAO,SAASC,sBAAT,CACLC,MADK,EAEkC;AACvC,QAAMC,OAAO,GAAGJ,UAAU,CAACC,0BAAD,CAA1B;;AAEA,MAAIE,MAAM,KAAK,IAAX,IAAmBC,OAAO,KAAK,IAAnC,EAAyC;AACvC,UAAM,iEAAN;AACD;;AAED,SAAOA,OAAP;AACD","sourcesContent":["import { useContext } from 'react';\nimport {\n BottomSheetInternalContext,\n BottomSheetInternalContextType,\n} from '../contexts/internal';\n\nexport function useBottomSheetInternal(\n unsafe?: false\n): BottomSheetInternalContextType;\n\nexport function useBottomSheetInternal(\n unsafe: true\n): BottomSheetInternalContextType | null;\n\nexport function useBottomSheetInternal(\n unsafe?: boolean\n): BottomSheetInternalContextType | null {\n const context = useContext(BottomSheetInternalContext);\n\n if (unsafe !== true && context === null) {\n throw \"'useBottomSheetInternal' cannot be used out of the BottomSheet!\";\n }\n\n return context;\n}\n"]} \ No newline at end of file diff --git a/lib/module/hooks/useBottomSheetModal.js b/lib/module/hooks/useBottomSheetModal.js new file mode 100644 index 000000000..78de0c192 --- /dev/null +++ b/lib/module/hooks/useBottomSheetModal.js @@ -0,0 +1,12 @@ +import { useContext } from 'react'; +import { BottomSheetModalContext } from '../contexts'; +export const useBottomSheetModal = () => { + const context = useContext(BottomSheetModalContext); + + if (context === null) { + throw "'BottomSheetModalContext' cannot be null!"; + } + + return context; +}; +//# sourceMappingURL=useBottomSheetModal.js.map \ No newline at end of file diff --git a/lib/module/hooks/useBottomSheetModal.js.map b/lib/module/hooks/useBottomSheetModal.js.map new file mode 100644 index 000000000..0d21a8e39 --- /dev/null +++ b/lib/module/hooks/useBottomSheetModal.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["useBottomSheetModal.ts"],"names":["useContext","BottomSheetModalContext","useBottomSheetModal","context"],"mappings":"AAAA,SAASA,UAAT,QAA2B,OAA3B;AACA,SAASC,uBAAT,QAAwC,aAAxC;AAEA,OAAO,MAAMC,mBAAmB,GAAG,MAAM;AACvC,QAAMC,OAAO,GAAGH,UAAU,CAACC,uBAAD,CAA1B;;AAEA,MAAIE,OAAO,KAAK,IAAhB,EAAsB;AACpB,UAAM,2CAAN;AACD;;AAED,SAAOA,OAAP;AACD,CARM","sourcesContent":["import { useContext } from 'react';\nimport { BottomSheetModalContext } from '../contexts';\n\nexport const useBottomSheetModal = () => {\n const context = useContext(BottomSheetModalContext);\n\n if (context === null) {\n throw \"'BottomSheetModalContext' cannot be null!\";\n }\n\n return context;\n};\n"]} \ No newline at end of file diff --git a/lib/module/hooks/useBottomSheetModalInternal.js b/lib/module/hooks/useBottomSheetModalInternal.js new file mode 100644 index 000000000..e8ada5721 --- /dev/null +++ b/lib/module/hooks/useBottomSheetModalInternal.js @@ -0,0 +1,12 @@ +import { useContext } from 'react'; +import { BottomSheetModalInternalContext } from '../contexts'; +export function useBottomSheetModalInternal(unsafe) { + const context = useContext(BottomSheetModalInternalContext); + + if (unsafe !== true && context === null) { + throw "'BottomSheetModalInternalContext' cannot be null!"; + } + + return context; +} +//# sourceMappingURL=useBottomSheetModalInternal.js.map \ No newline at end of file diff --git a/lib/module/hooks/useBottomSheetModalInternal.js.map b/lib/module/hooks/useBottomSheetModalInternal.js.map new file mode 100644 index 000000000..a744e44ab --- /dev/null +++ b/lib/module/hooks/useBottomSheetModalInternal.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["useBottomSheetModalInternal.ts"],"names":["useContext","BottomSheetModalInternalContext","useBottomSheetModalInternal","unsafe","context"],"mappings":"AAAA,SAASA,UAAT,QAA2B,OAA3B;AACA,SACEC,+BADF,QAGO,aAHP;AAaA,OAAO,SAASC,2BAAT,CACLC,MADK,EAEuC;AAC5C,QAAMC,OAAO,GAAGJ,UAAU,CAACC,+BAAD,CAA1B;;AAEA,MAAIE,MAAM,KAAK,IAAX,IAAmBC,OAAO,KAAK,IAAnC,EAAyC;AACvC,UAAM,mDAAN;AACD;;AAED,SAAOA,OAAP;AACD","sourcesContent":["import { useContext } from 'react';\nimport {\n BottomSheetModalInternalContext,\n BottomSheetModalInternalContextType,\n} from '../contexts';\n\nexport function useBottomSheetModalInternal(\n unsafe?: false\n): BottomSheetModalInternalContextType;\n\nexport function useBottomSheetModalInternal(\n unsafe: true\n): BottomSheetModalInternalContextType | null;\n\nexport function useBottomSheetModalInternal(\n unsafe?: boolean\n): BottomSheetModalInternalContextType | null {\n const context = useContext(BottomSheetModalInternalContext);\n\n if (unsafe !== true && context === null) {\n throw \"'BottomSheetModalInternalContext' cannot be null!\";\n }\n\n return context;\n}\n"]} \ No newline at end of file diff --git a/lib/module/hooks/useBottomSheetSpringConfigs.js b/lib/module/hooks/useBottomSheetSpringConfigs.js new file mode 100644 index 000000000..d2632aa5c --- /dev/null +++ b/lib/module/hooks/useBottomSheetSpringConfigs.js @@ -0,0 +1,10 @@ +import { useMemo } from 'react'; + +/** + * Generate spring animation configs. + * @param configs overridable configs. + */ +export const useBottomSheetSpringConfigs = configs => { + return useMemo(() => configs, [configs]); +}; +//# sourceMappingURL=useBottomSheetSpringConfigs.js.map \ No newline at end of file diff --git a/lib/module/hooks/useBottomSheetSpringConfigs.js.map b/lib/module/hooks/useBottomSheetSpringConfigs.js.map new file mode 100644 index 000000000..4f8e161c3 --- /dev/null +++ b/lib/module/hooks/useBottomSheetSpringConfigs.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["useBottomSheetSpringConfigs.ts"],"names":["useMemo","useBottomSheetSpringConfigs","configs"],"mappings":"AAAA,SAASA,OAAT,QAAwB,OAAxB;;AAGA;AACA;AACA;AACA;AACA,OAAO,MAAMC,2BAA2B,GACtCC,OADyC,IAEtC;AACH,SAAOF,OAAO,CAAC,MAAME,OAAP,EAAgB,CAACA,OAAD,CAAhB,CAAd;AACD,CAJM","sourcesContent":["import { useMemo } from 'react';\nimport type { WithSpringConfig } from 'react-native-reanimated';\n\n/**\n * Generate spring animation configs.\n * @param configs overridable configs.\n */\nexport const useBottomSheetSpringConfigs = (\n configs: Omit\n) => {\n return useMemo(() => configs, [configs]);\n};\n"]} \ No newline at end of file diff --git a/lib/module/hooks/useBottomSheetTimingConfigs.js b/lib/module/hooks/useBottomSheetTimingConfigs.js new file mode 100644 index 000000000..69cb8555d --- /dev/null +++ b/lib/module/hooks/useBottomSheetTimingConfigs.js @@ -0,0 +1,20 @@ +import { useMemo } from 'react'; +import { ANIMATION_DURATION, ANIMATION_EASING } from '../constants'; +/** + * Generate timing animation configs. + * @default + * - easing: Easing.out(Easing.exp) + * - duration 250 + * @param configs overridable configs. + */ + +export const useBottomSheetTimingConfigs = configs => { + return useMemo(() => { + const _configs = { + easing: configs.easing || ANIMATION_EASING, + duration: configs.duration || ANIMATION_DURATION + }; + return _configs; + }, [configs.duration, configs.easing]); +}; +//# sourceMappingURL=useBottomSheetTimingConfigs.js.map \ No newline at end of file diff --git a/lib/module/hooks/useBottomSheetTimingConfigs.js.map b/lib/module/hooks/useBottomSheetTimingConfigs.js.map new file mode 100644 index 000000000..c1c6950a3 --- /dev/null +++ b/lib/module/hooks/useBottomSheetTimingConfigs.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["useBottomSheetTimingConfigs.ts"],"names":["useMemo","ANIMATION_DURATION","ANIMATION_EASING","useBottomSheetTimingConfigs","configs","_configs","easing","duration"],"mappings":"AAAA,SAASA,OAAT,QAAwB,OAAxB;AAEA,SAASC,kBAAT,EAA6BC,gBAA7B,QAAqD,cAArD;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,2BAA2B,GAAIC,OAAD,IAA+B;AACxE,SAAOJ,OAAO,CAAC,MAAM;AACnB,UAAMK,QAA0B,GAAG;AACjCC,MAAAA,MAAM,EAAEF,OAAO,CAACE,MAAR,IAAkBJ,gBADO;AAEjCK,MAAAA,QAAQ,EAAEH,OAAO,CAACG,QAAR,IAAoBN;AAFG,KAAnC;AAKA,WAAOI,QAAP;AACD,GAPa,EAOX,CAACD,OAAO,CAACG,QAAT,EAAmBH,OAAO,CAACE,MAA3B,CAPW,CAAd;AAQD,CATM","sourcesContent":["import { useMemo } from 'react';\nimport type { WithTimingConfig } from 'react-native-reanimated';\nimport { ANIMATION_DURATION, ANIMATION_EASING } from '../constants';\n\n/**\n * Generate timing animation configs.\n * @default\n * - easing: Easing.out(Easing.exp)\n * - duration 250\n * @param configs overridable configs.\n */\nexport const useBottomSheetTimingConfigs = (configs: WithTimingConfig) => {\n return useMemo(() => {\n const _configs: WithTimingConfig = {\n easing: configs.easing || ANIMATION_EASING,\n duration: configs.duration || ANIMATION_DURATION,\n };\n\n return _configs;\n }, [configs.duration, configs.easing]);\n};\n"]} \ No newline at end of file diff --git a/lib/module/hooks/useGestureEventsHandlersDefault.js b/lib/module/hooks/useGestureEventsHandlersDefault.js new file mode 100644 index 000000000..4b8d9626f --- /dev/null +++ b/lib/module/hooks/useGestureEventsHandlersDefault.js @@ -0,0 +1,242 @@ +import { Keyboard, Platform } from 'react-native'; +import { runOnJS, useWorkletCallback } from 'react-native-reanimated'; +import { useBottomSheetInternal } from './useBottomSheetInternal'; +import { ANIMATION_SOURCE, GESTURE_SOURCE, KEYBOARD_STATE, SCROLLABLE_TYPE, WINDOW_HEIGHT } from '../constants'; +import { clamp } from '../utilities/clamp'; +import { snapPoint } from '../utilities/snapPoint'; +const dismissKeyboard = Keyboard.dismiss; +export const useGestureEventsHandlersDefault = () => { + //#region variables + const { + animatedPosition, + animatedSnapPoints, + animatedKeyboardState, + animatedKeyboardHeight, + animatedContainerHeight, + animatedScrollableType, + animatedHighestSnapPoint, + animatedClosedPosition, + animatedScrollableContentOffsetY, + enableOverDrag, + enablePanDownToClose, + overDragResistanceFactor, + isInTemporaryPosition, + isScrollableRefreshable, + animateToPosition, + stopAnimation + } = useBottomSheetInternal(); //#endregion + //#region gesture methods + + const handleOnStart = useWorkletCallback(function handleOnStart(__, _, context) { + // cancel current animation + stopAnimation(); // store current animated position + + context.initialPosition = animatedPosition.value; + context.initialKeyboardState = animatedKeyboardState.value; + /** + * if the scrollable content is scrolled, then + * we lock the position. + */ + + if (animatedScrollableContentOffsetY.value > 0) { + context.isScrollablePositionLocked = true; + } + }, [stopAnimation, animatedPosition, animatedKeyboardState, animatedScrollableContentOffsetY]); + const handleOnActive = useWorkletCallback(function handleOnActive(source, { + translationY + }, context) { + let highestSnapPoint = animatedHighestSnapPoint.value; + /** + * if keyboard is shown, then we set the highest point to the current + * position which includes the keyboard height. + */ + + if (isInTemporaryPosition.value && context.initialKeyboardState === KEYBOARD_STATE.SHOWN) { + highestSnapPoint = context.initialPosition; + } + /** + * if current position is out of provided `snapPoints` and smaller then + * highest snap pont, then we set the highest point to the current position. + */ + + + if (isInTemporaryPosition.value && context.initialPosition < highestSnapPoint) { + highestSnapPoint = context.initialPosition; + } + + const lowestSnapPoint = enablePanDownToClose ? animatedContainerHeight.value : animatedSnapPoints.value[0]; + /** + * if scrollable is refreshable and sheet position at the highest + * point, then do not interact with current gesture. + */ + + if (source === GESTURE_SOURCE.SCROLLABLE && isScrollableRefreshable.value && animatedPosition.value === highestSnapPoint) { + return; + } + /** + * a negative scrollable content offset to be subtracted from accumulated + * current position and gesture translation Y to allow user to drag the sheet, + * when scrollable position at the top. + * a negative scrollable content offset when the scrollable is not locked. + */ + + + const negativeScrollableContentOffset = context.initialPosition === highestSnapPoint && source === GESTURE_SOURCE.SCROLLABLE || !context.isScrollablePositionLocked ? animatedScrollableContentOffsetY.value * -1 : 0; + /** + * an accumulated value of starting position with gesture translation y. + */ + + const draggedPosition = context.initialPosition + translationY; + /** + * an accumulated value of dragged position and negative scrollable content offset, + * this will insure locking sheet position when user is scrolling the scrollable until, + * they reach to the top of the scrollable. + */ + + const accumulatedDraggedPosition = draggedPosition + negativeScrollableContentOffset; + /** + * a clamped value of the accumulated dragged position, to insure keeping the dragged + * position between the highest and lowest snap points. + */ + + const clampedPosition = clamp(accumulatedDraggedPosition, highestSnapPoint, lowestSnapPoint); + /** + * if scrollable position is locked and the animated position + * reaches the highest point, then we unlock the scrollable position. + */ + + if (context.isScrollablePositionLocked && source === GESTURE_SOURCE.SCROLLABLE && animatedPosition.value === highestSnapPoint) { + context.isScrollablePositionLocked = false; + } + /** + * over-drag implementation. + */ + + + if (enableOverDrag) { + if ((source === GESTURE_SOURCE.HANDLE || animatedScrollableType.value === SCROLLABLE_TYPE.VIEW) && draggedPosition < highestSnapPoint) { + const resistedPosition = highestSnapPoint - Math.sqrt(1 + (highestSnapPoint - draggedPosition)) * overDragResistanceFactor; + animatedPosition.value = resistedPosition; + return; + } + + if (source === GESTURE_SOURCE.HANDLE && draggedPosition > lowestSnapPoint) { + const resistedPosition = lowestSnapPoint + Math.sqrt(1 + (draggedPosition - lowestSnapPoint)) * overDragResistanceFactor; + animatedPosition.value = resistedPosition; + return; + } + + if (source === GESTURE_SOURCE.SCROLLABLE && draggedPosition + negativeScrollableContentOffset > lowestSnapPoint) { + const resistedPosition = lowestSnapPoint + Math.sqrt(1 + (draggedPosition + negativeScrollableContentOffset - lowestSnapPoint)) * overDragResistanceFactor; + animatedPosition.value = resistedPosition; + return; + } + } + + animatedPosition.value = clampedPosition; + }, [enableOverDrag, enablePanDownToClose, overDragResistanceFactor, isInTemporaryPosition, isScrollableRefreshable, animatedHighestSnapPoint, animatedContainerHeight, animatedSnapPoints, animatedPosition, animatedScrollableType, animatedScrollableContentOffsetY]); + const handleOnEnd = useWorkletCallback(function handleOnEnd(source, { + translationY, + absoluteY, + velocityY + }, context) { + const highestSnapPoint = animatedHighestSnapPoint.value; + const isSheetAtHighestSnapPoint = animatedPosition.value === highestSnapPoint; + /** + * if scrollable is refreshable and sheet position at the highest + * point, then do not interact with current gesture. + */ + + if (source === GESTURE_SOURCE.SCROLLABLE && isScrollableRefreshable.value && isSheetAtHighestSnapPoint) { + return; + } + /** + * if the sheet is in a temporary position and the gesture ended above + * the current position, then we snap back to the temporary position. + */ + + + if (isInTemporaryPosition.value && context.initialPosition >= animatedPosition.value) { + if (context.initialPosition > animatedPosition.value) { + animateToPosition(context.initialPosition, ANIMATION_SOURCE.GESTURE, velocityY / 2); + } + + return; + } + /** + * close keyboard if current position is below the recorded + * start position and keyboard still shown. + */ + + + const isScrollable = animatedScrollableType.value !== SCROLLABLE_TYPE.UNDETERMINED && animatedScrollableType.value !== SCROLLABLE_TYPE.VIEW; + /** + * if keyboard is shown and the sheet is dragged down, + * then we dismiss the keyboard. + */ + + if (context.initialKeyboardState === KEYBOARD_STATE.SHOWN && animatedPosition.value > context.initialPosition) { + /** + * if the platform is ios, current content is scrollable and + * the end touch point is below the keyboard position then + * we exit the method. + * + * because the the keyboard dismiss is interactive in iOS. + */ + if (!(Platform.OS === 'ios' && isScrollable && absoluteY > WINDOW_HEIGHT - animatedKeyboardHeight.value)) { + runOnJS(dismissKeyboard)(); + } + } + /** + * reset isInTemporaryPosition value + */ + + + if (isInTemporaryPosition.value) { + isInTemporaryPosition.value = false; + } + /** + * clone snap points array, and insert the container height + * if pan down to close is enabled. + */ + + + const snapPoints = animatedSnapPoints.value.slice(); + + if (enablePanDownToClose) { + snapPoints.unshift(animatedClosedPosition.value); + } + /** + * calculate the destination point, using redash. + */ + + + const destinationPoint = snapPoint(translationY + context.initialPosition, velocityY, snapPoints); + /** + * if destination point is the same as the current position, + * then no need to perform animation. + */ + + if (destinationPoint === animatedPosition.value) { + return; + } + + const wasGestureHandledByScrollView = source === GESTURE_SOURCE.SCROLLABLE && animatedScrollableContentOffsetY.value > 0; + /** + * prevents snapping from top to middle / bottom with repeated interrupted scrolls + */ + + if (wasGestureHandledByScrollView && isSheetAtHighestSnapPoint) { + return; + } + + animateToPosition(destinationPoint, ANIMATION_SOURCE.GESTURE, velocityY / 2); + }, [enablePanDownToClose, isInTemporaryPosition, isScrollableRefreshable, animatedClosedPosition, animatedHighestSnapPoint, animatedKeyboardHeight, animatedPosition, animatedScrollableType, animatedSnapPoints, animatedScrollableContentOffsetY, animateToPosition]); //#endregion + + return { + handleOnStart, + handleOnActive, + handleOnEnd + }; +}; +//# sourceMappingURL=useGestureEventsHandlersDefault.js.map \ No newline at end of file diff --git a/lib/module/hooks/useGestureEventsHandlersDefault.js.map b/lib/module/hooks/useGestureEventsHandlersDefault.js.map new file mode 100644 index 000000000..c6bf30554 --- /dev/null +++ b/lib/module/hooks/useGestureEventsHandlersDefault.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["useGestureEventsHandlersDefault.tsx"],"names":["Keyboard","Platform","runOnJS","useWorkletCallback","useBottomSheetInternal","ANIMATION_SOURCE","GESTURE_SOURCE","KEYBOARD_STATE","SCROLLABLE_TYPE","WINDOW_HEIGHT","clamp","snapPoint","dismissKeyboard","dismiss","useGestureEventsHandlersDefault","animatedPosition","animatedSnapPoints","animatedKeyboardState","animatedKeyboardHeight","animatedContainerHeight","animatedScrollableType","animatedHighestSnapPoint","animatedClosedPosition","animatedScrollableContentOffsetY","enableOverDrag","enablePanDownToClose","overDragResistanceFactor","isInTemporaryPosition","isScrollableRefreshable","animateToPosition","stopAnimation","handleOnStart","__","_","context","initialPosition","value","initialKeyboardState","isScrollablePositionLocked","handleOnActive","source","translationY","highestSnapPoint","SHOWN","lowestSnapPoint","SCROLLABLE","negativeScrollableContentOffset","draggedPosition","accumulatedDraggedPosition","clampedPosition","HANDLE","VIEW","resistedPosition","Math","sqrt","handleOnEnd","absoluteY","velocityY","isSheetAtHighestSnapPoint","GESTURE","isScrollable","UNDETERMINED","OS","snapPoints","slice","unshift","destinationPoint","wasGestureHandledByScrollView"],"mappings":"AAAA,SAASA,QAAT,EAAmBC,QAAnB,QAAmC,cAAnC;AACA,SAASC,OAAT,EAAkBC,kBAAlB,QAA4C,yBAA5C;AACA,SAASC,sBAAT,QAAuC,0BAAvC;AACA,SACEC,gBADF,EAEEC,cAFF,EAGEC,cAHF,EAIEC,eAJF,EAKEC,aALF,QAMO,cANP;AAWA,SAASC,KAAT,QAAsB,oBAAtB;AACA,SAASC,SAAT,QAA0B,wBAA1B;AAQA,MAAMC,eAAe,GAAGZ,QAAQ,CAACa,OAAjC;AAEA,OAAO,MAAMC,+BAA8D,GACzE,MAAM;AACJ;AACA,QAAM;AACJC,IAAAA,gBADI;AAEJC,IAAAA,kBAFI;AAGJC,IAAAA,qBA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A,QAAIvC,oBAAJ,EAA0B;AACxBsC,MAAAA,UAAU,CAACE,OAAX,CAAmB3C,sBAAsB,CAACc,KAA1C;AACD;AAED;AACV;AACA;;;AACU,UAAM8B,gBAAgB,GAAGvD,SAAS,CAChC8B,YAAY,GAAGP,OAAO,CAACC,eADS,EAEhCsB,SAFgC,EAGhCM,UAHgC,CAAlC;AAMA;AACV;AACA;AACA;;AACU,QAAIG,gBAAgB,KAAKnD,gBAAgB,CAACqB,KAA1C,EAAiD;AAC/C;AACD;;AAED,UAAM+B,6BAA6B,GACjC3B,MAAM,KAAKlC,cAAc,CAACuC,UAA1B,IACAtB,gCAAgC,CAACa,KAAjC,GAAyC,CAF3C;AAGA;AACV;AACA;;AACU,QAAI+B,6BAA6B,IAAIT,yBAArC,EAAgE;AAC9D;AACD;;AAED7B,IAAAA,iBAAiB,CACfqC,gBADe,EAEf7D,gBAAgB,CAACsD,OAFF,EAGfF,SAAS,GAAG,CAHG,CAAjB;AAKD,GA1He,EA2HhB,CACEhC,oBADF,EAEEE,qBAFF,EAGEC,uBAHF,EAIEN,sBAJF,EAKED,wBALF,EAMEH,sBANF,EAOEH,gBAPF,EAQEK,sBARF,EASEJ,kBATF,EAUEO,gCAVF,EAWEM,iBAXF,CA3HgB,CADpB,CA3MI,CAqVJ;;AAEA,SAAO;AACLE,IAAAA,aADK;AAELQ,IAAAA,cAFK;AAGLgB,IAAAA;AAHK,GAAP;AAKD,CA7VI","sourcesContent":["import { Keyboard, Platform } from 'react-native';\nimport { runOnJS, useWorkletCallback } from 'react-native-reanimated';\nimport { useBottomSheetInternal } from './useBottomSheetInternal';\nimport {\n ANIMATION_SOURCE,\n GESTURE_SOURCE,\n KEYBOARD_STATE,\n SCROLLABLE_TYPE,\n WINDOW_HEIGHT,\n} from '../constants';\nimport type {\n GestureEventsHandlersHookType,\n GestureEventHandlerCallbackType,\n} from '../types';\nimport { clamp } from '../utilities/clamp';\nimport { snapPoint } from '../utilities/snapPoint';\n\ntype GestureEventContextType = {\n initialPosition: number;\n initialKeyboardState: KEYBOARD_STATE;\n isScrollablePositionLocked: boolean;\n};\n\nconst dismissKeyboard = Keyboard.dismiss;\n\nexport const useGestureEventsHandlersDefault: GestureEventsHandlersHookType =\n () => {\n //#region variables\n const {\n animatedPosition,\n animatedSnapPoints,\n animatedKeyboardState,\n animatedKeyboardHeight,\n animatedContainerHeight,\n animatedScrollableType,\n animatedHighestSnapPoint,\n animatedClosedPosition,\n animatedScrollableContentOffsetY,\n enableOverDrag,\n enablePanDownToClose,\n overDragResistanceFactor,\n isInTemporaryPosition,\n isScrollableRefreshable,\n animateToPosition,\n stopAnimation,\n } = useBottomSheetInternal();\n //#endregion\n\n //#region gesture methods\n const handleOnStart: GestureEventHandlerCallbackType =\n useWorkletCallback(\n function handleOnStart(__, _, context) {\n // cancel current animation\n stopAnimation();\n\n // store current animated position\n context.initialPosition = animatedPosition.value;\n context.initialKeyboardState = animatedKeyboardState.value;\n\n /**\n * if the scrollable content is scrolled, then\n * we lock the position.\n */\n if (animatedScrollableContentOffsetY.value > 0) {\n context.isScrollablePositionLocked = true;\n }\n },\n [\n stopAnimation,\n animatedPosition,\n animatedKeyboardState,\n animatedScrollableContentOffsetY,\n ]\n );\n const handleOnActive: GestureEventHandlerCallbackType =\n useWorkletCallback(\n function handleOnActive(source, { translationY }, context) {\n let highestSnapPoint = animatedHighestSnapPoint.value;\n\n /**\n * if keyboard is shown, then we set the highest point to the current\n * position which includes the keyboard height.\n */\n if (\n isInTemporaryPosition.value &&\n context.initialKeyboardState === KEYBOARD_STATE.SHOWN\n ) {\n highestSnapPoint = context.initialPosition;\n }\n\n /**\n * if current position is out of provided `snapPoints` and smaller then\n * highest snap pont, then we set the highest point to the current position.\n */\n if (\n isInTemporaryPosition.value &&\n context.initialPosition < highestSnapPoint\n ) {\n highestSnapPoint = context.initialPosition;\n }\n\n const lowestSnapPoint = enablePanDownToClose\n ? animatedContainerHeight.value\n : animatedSnapPoints.value[0];\n\n /**\n * if scrollable is refreshable and sheet position at the highest\n * point, then do not interact with current gesture.\n */\n if (\n source === GESTURE_SOURCE.SCROLLABLE &&\n isScrollableRefreshable.value &&\n animatedPosition.value === highestSnapPoint\n ) {\n return;\n }\n\n /**\n * a negative scrollable content offset to be subtracted from accumulated\n * current position and gesture translation Y to allow user to drag the sheet,\n * when scrollable position at the top.\n * a negative scrollable content offset when the scrollable is not locked.\n */\n const negativeScrollableContentOffset =\n (context.initialPosition === highestSnapPoint &&\n source === GESTURE_SOURCE.SCROLLABLE) ||\n !context.isScrollablePositionLocked\n ? animatedScrollableContentOffsetY.value * -1\n : 0;\n\n /**\n * an accumulated value of starting position with gesture translation y.\n */\n const draggedPosition = context.initialPosition + translationY;\n\n /**\n * an accumulated value of dragged position and negative scrollable content offset,\n * this will insure locking sheet position when user is scrolling the scrollable until,\n * they reach to the top of the scrollable.\n */\n const accumulatedDraggedPosition =\n draggedPosition + negativeScrollableContentOffset;\n\n /**\n * a clamped value of the accumulated dragged position, to insure keeping the dragged\n * position between the highest and lowest snap points.\n */\n const clampedPosition = clamp(\n accumulatedDraggedPosition,\n highestSnapPoint,\n lowestSnapPoint\n );\n\n /**\n * if scrollable position is locked and the animated position\n * reaches the highest point, then we unlock the scrollable position.\n */\n if (\n context.isScrollablePositionLocked &&\n source === GESTURE_SOURCE.SCROLLABLE &&\n animatedPosition.value === highestSnapPoint\n ) {\n context.isScrollablePositionLocked = false;\n }\n\n /**\n * over-drag implementation.\n */\n if (enableOverDrag) {\n if (\n (source === GESTURE_SOURCE.HANDLE ||\n animatedScrollableType.value === SCROLLABLE_TYPE.VIEW) &&\n draggedPosition < highestSnapPoint\n ) {\n const resistedPosition =\n highestSnapPoint -\n Math.sqrt(1 + (highestSnapPoint - draggedPosition)) *\n overDragResistanceFactor;\n animatedPosition.value = resistedPosition;\n return;\n }\n\n if (\n source === GESTURE_SOURCE.HANDLE &&\n draggedPosition > lowestSnapPoint\n ) {\n const resistedPosition =\n lowestSnapPoint +\n Math.sqrt(1 + (draggedPosition - lowestSnapPoint)) *\n overDragResistanceFactor;\n animatedPosition.value = resistedPosition;\n return;\n }\n\n if (\n source === GESTURE_SOURCE.SCROLLABLE &&\n draggedPosition + negativeScrollableContentOffset >\n lowestSnapPoint\n ) {\n const resistedPosition =\n lowestSnapPoint +\n Math.sqrt(\n 1 +\n (draggedPosition +\n negativeScrollableContentOffset -\n lowestSnapPoint)\n ) *\n overDragResistanceFactor;\n animatedPosition.value = resistedPosition;\n return;\n }\n }\n\n animatedPosition.value = clampedPosition;\n },\n [\n enableOverDrag,\n enablePanDownToClose,\n overDragResistanceFactor,\n isInTemporaryPosition,\n isScrollableRefreshable,\n animatedHighestSnapPoint,\n animatedContainerHeight,\n animatedSnapPoints,\n animatedPosition,\n animatedScrollableType,\n animatedScrollableContentOffsetY,\n ]\n );\n const handleOnEnd: GestureEventHandlerCallbackType =\n useWorkletCallback(\n function handleOnEnd(\n source,\n { translationY, absoluteY, velocityY },\n context\n ) {\n const highestSnapPoint = animatedHighestSnapPoint.value;\n const isSheetAtHighestSnapPoint =\n animatedPosition.value === highestSnapPoint;\n\n /**\n * if scrollable is refreshable and sheet position at the highest\n * point, then do not interact with current gesture.\n */\n if (\n source === GESTURE_SOURCE.SCROLLABLE &&\n isScrollableRefreshable.value &&\n isSheetAtHighestSnapPoint\n ) {\n return;\n }\n\n /**\n * if the sheet is in a temporary position and the gesture ended above\n * the current position, then we snap back to the temporary position.\n */\n if (\n isInTemporaryPosition.value &&\n context.initialPosition >= animatedPosition.value\n ) {\n if (context.initialPosition > animatedPosition.value) {\n animateToPosition(\n context.initialPosition,\n ANIMATION_SOURCE.GESTURE,\n velocityY / 2\n );\n }\n return;\n }\n\n /**\n * close keyboard if current position is below the recorded\n * start position and keyboard still shown.\n */\n const isScrollable =\n animatedScrollableType.value !== SCROLLABLE_TYPE.UNDETERMINED &&\n animatedScrollableType.value !== SCROLLABLE_TYPE.VIEW;\n\n /**\n * if keyboard is shown and the sheet is dragged down,\n * then we dismiss the keyboard.\n */\n if (\n context.initialKeyboardState === KEYBOARD_STATE.SHOWN &&\n animatedPosition.value > context.initialPosition\n ) {\n /**\n * if the platform is ios, current content is scrollable and\n * the end touch point is below the keyboard position then\n * we exit the method.\n *\n * because the the keyboard dismiss is interactive in iOS.\n */\n if (\n !(\n Platform.OS === 'ios' &&\n isScrollable &&\n absoluteY > WINDOW_HEIGHT - animatedKeyboardHeight.value\n )\n ) {\n runOnJS(dismissKeyboard)();\n }\n }\n\n /**\n * reset isInTemporaryPosition value\n */\n if (isInTemporaryPosition.value) {\n isInTemporaryPosition.value = false;\n }\n\n /**\n * clone snap points array, and insert the container height\n * if pan down to close is enabled.\n */\n const snapPoints = animatedSnapPoints.value.slice();\n if (enablePanDownToClose) {\n snapPoints.unshift(animatedClosedPosition.value);\n }\n\n /**\n * calculate the destination point, using redash.\n */\n const destinationPoint = snapPoint(\n translationY + context.initialPosition,\n velocityY,\n snapPoints\n );\n\n /**\n * if destination point is the same as the current position,\n * then no need to perform animation.\n */\n if (destinationPoint === animatedPosition.value) {\n return;\n }\n\n const wasGestureHandledByScrollView =\n source === GESTURE_SOURCE.SCROLLABLE &&\n animatedScrollableContentOffsetY.value > 0;\n /**\n * prevents snapping from top to middle / bottom with repeated interrupted scrolls\n */\n if (wasGestureHandledByScrollView && isSheetAtHighestSnapPoint) {\n return;\n }\n\n animateToPosition(\n destinationPoint,\n ANIMATION_SOURCE.GESTURE,\n velocityY / 2\n );\n },\n [\n enablePanDownToClose,\n isInTemporaryPosition,\n isScrollableRefreshable,\n animatedClosedPosition,\n animatedHighestSnapPoint,\n animatedKeyboardHeight,\n animatedPosition,\n animatedScrollableType,\n animatedSnapPoints,\n animatedScrollableContentOffsetY,\n animateToPosition,\n ]\n );\n //#endregion\n\n return {\n handleOnStart,\n handleOnActive,\n handleOnEnd,\n };\n };\n"]} \ No newline at end of file diff --git a/lib/module/hooks/useGestureHandler.js b/lib/module/hooks/useGestureHandler.js new file mode 100644 index 000000000..0ca37d09d --- /dev/null +++ b/lib/module/hooks/useGestureHandler.js @@ -0,0 +1,71 @@ +import { useAnimatedGestureHandler } from 'react-native-reanimated'; +import { State } from 'react-native-gesture-handler'; +import { GESTURE_SOURCE } from '../constants'; + +const resetContext = context => { + 'worklet'; + + Object.keys(context).map(key => { + context[key] = undefined; + }); +}; + +export const useGestureHandler = (type, state, gestureSource, handleOnStart, handleOnActive, handleOnEnd) => { + const gestureHandler = useAnimatedGestureHandler({ + onActive: (payload, context) => { + if (!context.didStart) { + context.didStart = true; + state.value = State.BEGAN; + gestureSource.value = type; + handleOnStart(type, payload, context); + return; + } + + if (gestureSource.value !== type) { + return; + } + + state.value = payload.state; + handleOnActive(type, payload, context); + }, + onEnd: (payload, context) => { + if (gestureSource.value !== type) { + return; + } + + state.value = payload.state; + gestureSource.value = GESTURE_SOURCE.UNDETERMINED; + handleOnEnd(type, payload, context); + resetContext(context); + }, + onCancel: (payload, context) => { + if (gestureSource.value !== type) { + return; + } + + state.value = payload.state; + gestureSource.value = GESTURE_SOURCE.UNDETERMINED; + resetContext(context); + }, + onFail: (payload, context) => { + if (gestureSource.value !== type) { + return; + } + + state.value = payload.state; + gestureSource.value = GESTURE_SOURCE.UNDETERMINED; + resetContext(context); + }, + onFinish: (payload, context) => { + if (gestureSource.value !== type) { + return; + } + + state.value = payload.state; + gestureSource.value = GESTURE_SOURCE.UNDETERMINED; + resetContext(context); + } + }, [type, state, handleOnStart, handleOnActive, handleOnEnd]); + return gestureHandler; +}; +//# sourceMappingURL=useGestureHandler.js.map \ No newline at end of file diff --git a/lib/module/hooks/useGestureHandler.js.map b/lib/module/hooks/useGestureHandler.js.map new file mode 100644 index 000000000..ef48dbb79 --- /dev/null +++ b/lib/module/hooks/useGestureHandler.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["useGestureHandler.ts"],"names":["useAnimatedGestureHandler","State","GESTURE_SOURCE","resetContext","context","Object","keys","map","key","undefined","useGestureHandler","type","state","gestureSource","handleOnStart","handleOnActive","handleOnEn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CC,WAA7C,CAjE8C,CAAhD;AAmEA,SAAOC,cAAP;AACD,CA5EM","sourcesContent":["import Animated, { useAnimatedGestureHandler } from 'react-native-reanimated';\nimport {\n State,\n PanGestureHandlerGestureEvent,\n} from 'react-native-gesture-handler';\nimport { GESTURE_SOURCE } from '../constants';\nimport type {\n GestureEventContextType,\n GestureEventHandlerCallbackType,\n} from '../types';\n\nconst resetContext = (context: any) => {\n 'worklet';\n\n Object.keys(context).map(key => {\n context[key] = undefined;\n });\n};\n\nexport const useGestureHandler = (\n type: GESTURE_SOURCE,\n state: Animated.SharedValue,\n gestureSource: Animated.SharedValue,\n handleOnStart: GestureEventHandlerCallbackType,\n handleOnActive: GestureEventHandlerCallbackType,\n handleOnEnd: GestureEventHandlerCallbackType\n): ((event: PanGestureHandlerGestureEvent) => void) => {\n const gestureHandler = useAnimatedGestureHandler<\n PanGestureHandlerGestureEvent,\n GestureEventContextType\n >(\n {\n onActive: (payload, context) => {\n if (!context.didStart) {\n context.didStart = true;\n\n state.value = State.BEGAN;\n gestureSource.value = type;\n\n handleOnStart(type, payload, context);\n return;\n }\n\n if (gestureSource.value !== type) {\n return;\n }\n\n state.value = payload.state;\n handleOnActive(type, payload, context);\n },\n onEnd: (payload, context) => {\n if (gestureSource.value !== type) {\n return;\n }\n\n state.value = payload.state;\n gestureSource.value = GESTURE_SOURCE.UNDETERMINED;\n\n handleOnEnd(type, payload, context);\n resetContext(context);\n },\n onCancel: (payload, context) => {\n if (gestureSource.value !== type) {\n return;\n }\n\n state.value = payload.state;\n gestureSource.value = GESTURE_SOURCE.UNDETERMINED;\n\n resetContext(context);\n },\n onFail: (payload, context) => {\n if (gestureSource.value !== type) {\n return;\n }\n\n state.value = payload.state;\n gestureSource.value = GESTURE_SOURCE.UNDETERMINED;\n\n resetContext(context);\n },\n onFinish: (payload, context) => {\n if (gestureSource.value !== type) {\n return;\n }\n\n state.value = payload.state;\n gestureSource.value = GESTURE_SOURCE.UNDETERMINED;\n\n resetContext(context);\n },\n },\n [type, state, handleOnStart, handleOnActive, handleOnEnd]\n );\n return gestureHandler;\n};\n"]} \ No newline at end of file diff --git a/lib/module/hooks/useKeyboard.js b/lib/module/hooks/useKeyboard.js new file mode 100644 index 000000000..23008f350 --- /dev/null +++ b/lib/module/hooks/useKeyboard.js @@ -0,0 +1,84 @@ +import { useEffect } from 'react'; +import { Keyboard, Platform } from 'react-native'; +import { runOnUI, useAnimatedReaction, useSharedValue, useWorkletCallback } from 'react-native-reanimated'; +import { KEYBOARD_STATE } from '../constants'; +const KEYBOARD_EVENT_MAPPER = { + KEYBOARD_SHOW: Platform.select({ + ios: 'keyboardWillShow', + android: 'keyboardDidShow', + default: '' + }), + KEYBOARD_HIDE: Platform.select({ + ios: 'keyboardWillHide', + android: 'keyboardDidHide', + default: '' + }) +}; +export const useKeyboard = () => { + //#region variables + const shouldHandleKeyboardEvents = useSharedValue(false); + const keyboardState = useSharedValue(KEYBOARD_STATE.UNDETERMINED); + const keyboardHeight = useSharedValue(0); + const keyboardAnimationEasing = useSharedValue('keyboard'); + const keyboardAnimationDuration = useSharedValue(500); + const temporaryCachedKeyboardEvent = useSharedValue([]); //#endregion + //#region worklets + + const handleKeyboardEvent = useWorkletCallback((state, height, duration, easing) => { + if (state === KEYBOARD_STATE.SHOWN && !shouldHandleKeyboardEvents.value) { + /** + * if the keyboard event was fired before the `onFocus` on TextInput, + * then we cache the input, and wait till the `shouldHandleKeyboardEvents` + * to be updated then fire this function again. + */ + temporaryCachedKeyboardEvent.value = [state, height, duration, easing]; + return; + } + + keyboardHeight.value = state === KEYBOARD_STATE.SHOWN ? height : height === 0 ? keyboardHeight.value : height; + keyboardAnimationDuration.value = duration; + keyboardAnimationEasing.value = easing; + keyboardState.value = state; + temporaryCachedKeyboardEvent.value = []; + }, []); //#endregion + //#region effects + + useEffect(() => { + const handleOnKeyboardShow = event => { + runOnUI(handleKeyboardEvent)(KEYBOARD_STATE.SHOWN, event.endCoordinates.height, event.duration, event.easing); + }; + + const handleOnKeyboardHide = event => { + runOnUI(handleKeyboardEvent)(KEYBOARD_STATE.HIDDEN, event.endCoordinates.height, event.duration, event.easing); + }; + + const showSubscription = Keyboard.addListener(KEYBOARD_EVENT_MAPPER.KEYBOARD_SHOW, handleOnKeyboardShow); + const hideSubscription = Keyboard.addListener(KEYBOARD_EVENT_MAPPER.KEYBOARD_HIDE, handleOnKeyboardHide); + return () => { + showSubscription.remove(); + hideSubscription.remove(); + }; + }, [handleKeyboardEvent]); + /** + * This reaction is needed to handle the issue with multiline text input. + * + * @link https://github.com/gorhom/react-native-bottom-sheet/issues/411 + */ + + useAnimatedReaction(() => shouldHandleKeyboardEvents.value, result => { + const params = temporaryCachedKeyboardEvent.value; + + if (result && params.length > 0) { + handleKeyboardEvent(params[0], params[1], params[2], params[3]); + } + }); //#endregion + + return { + state: keyboardState, + height: keyboardHeight, + animationEasing: keyboardAnimationEasing, + animationDuration: keyboardAnimationDuration, + shouldHandleKeyboardEvents + }; +}; +//# sourceMappingURL=useKeyboard.js.map \ No newline at end of file diff --git a/lib/module/hooks/useKeyboard.js.map b/lib/module/hooks/useKeyboard.js.map new file mode 100644 index 000000000..bddd4a3cf --- /dev/null +++ b/lib/module/hooks/useKeyboard.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["useKeyboard.ts"],"names":["useEffect","Keyboard","Platform","runOnUI","useAnimatedReaction","useSharedValue","useWorkletCallback","KEYBOARD_STATE","KEYBOARD_EVENT_MAPPER","KEYBOARD_SHOW","select","ios","android","default","KEYBOARD_HIDE","useKeyboard","shouldHandleKeyboardEvents","keyboardState","UNDETERMINED","keyboardHeight","keyboardAnimationEasing","keyboardAnimationDuration","temporaryCachedKeyboardEvent","handleKeyboardEvent","state","height","duration","easing","SHOWN","value","handleOnKeyboardShow","event","endCoordinates","handleOnKeyboardHide","HIDDEN","showSubscription","addListener","hideSubscription","remove","result","params","length","animationEasing","animationDuration"],"mappings":"AAAA,SAASA,SAAT,QAA0B,OAA1B;AACA,SACEC,QADF,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,CAhCM,CAAT;AAkCA;AACF;AACA;AACA;AACA;;AACEnB,EAAAA,mBAAmB,CACjB,MAAMY,0BAA0B,CAACa,KADhB,EAEjBU,MAAM,IAAI;AACR,UAAMC,MAAM,GAAGlB,4BAA4B,CAACO,KAA5C;;AACA,QAAIU,MAAM,IAAIC,MAAM,CAACC,MAAP,GAAgB,CAA9B,EAAiC;AAC/BlB,MAAAA,mBAAmB,CAACiB,MAAM,CAAC,CAAD,CAAP,EAAYA,MAAM,CAAC,CAAD,CAAlB,EAAuBA,MAAM,CAAC,CAAD,CAA7B,EAAkCA,MAAM,CAAC,CAAD,CAAxC,CAAnB;AACD;AACF,GAPgB,CAAnB,CAhF+B,CAyF/B;;AAEA,SAAO;AACLhB,IAAAA,KAAK,EAAEP,aADF;AAELQ,IAAAA,MAAM,EAAEN,cAFH;AAGLuB,IAAAA,eAAe,EAAEtB,uBAHZ;AAILuB,IAAAA,iBAAiB,EAAEtB,yBAJd;AAKLL,IAAAA;AALK,GAAP;AAOD,CAlGM","sourcesContent":["import { useEffect } from 'react';\nimport {\n Keyboard,\n KeyboardEvent,\n KeyboardEventEasing,\n KeyboardEventName,\n Platform,\n} from 'react-native';\nimport {\n runOnUI,\n useAnimatedReaction,\n useSharedValue,\n useWorkletCallback,\n} from 'react-native-reanimated';\nimport { KEYBOARD_STATE } from '../constants';\n\nconst KEYBOARD_EVENT_MAPPER = {\n KEYBOARD_SHOW: Platform.select({\n ios: 'keyboardWillShow',\n android: 'keyboardDidShow',\n default: '',\n }) as KeyboardEventName,\n KEYBOARD_HIDE: Platform.select({\n ios: 'keyboardWillHide',\n android: 'keyboardDidHide',\n default: '',\n }) as KeyboardEventName,\n};\n\nexport const useKeyboard = () => {\n //#region variables\n const shouldHandleKeyboardEvents = useSharedValue(false);\n const keyboardState = useSharedValue(\n KEYBOARD_STATE.UNDETERMINED\n );\n const keyboardHeight = useSharedValue(0);\n const keyboardAnimationEasing =\n useSharedValue('keyboard');\n const keyboardAnimationDuration = useSharedValue(500);\n const temporaryCachedKeyboardEvent = useSharedValue([]);\n //#endregion\n\n //#region worklets\n const handleKeyboardEvent = useWorkletCallback(\n (state, height, duration, easing) => {\n if (state === KEYBOARD_STATE.SHOWN && !shouldHandleKeyboardEvents.value) {\n /**\n * if the keyboard event was fired before the `onFocus` on TextInput,\n * then we cache the input, and wait till the `shouldHandleKeyboardEvents`\n * to be updated then fire this function again.\n */\n temporaryCachedKeyboardEvent.value = [state, height, duration, easing];\n return;\n }\n keyboardHeight.value =\n state === KEYBOARD_STATE.SHOWN\n ? height\n : height === 0\n ? keyboardHeight.value\n : height;\n keyboardAnimationDuration.value = duration;\n keyboardAnimationEasing.value = easing;\n keyboardState.value = state;\n temporaryCachedKeyboardEvent.value = [];\n },\n []\n );\n //#endregion\n\n //#region effects\n useEffect(() => {\n const handleOnKeyboardShow = (event: KeyboardEvent) => {\n runOnUI(handleKeyboardEvent)(\n KEYBOARD_STATE.SHOWN,\n event.endCoordinates.height,\n event.duration,\n event.easing\n );\n };\n const handleOnKeyboardHide = (event: KeyboardEvent) => {\n runOnUI(handleKeyboardEvent)(\n KEYBOARD_STATE.HIDDEN,\n event.endCoordinates.height,\n event.duration,\n event.easing\n );\n };\n\n const showSubscription = Keyboard.addListener(\n KEYBOARD_EVENT_MAPPER.KEYBOARD_SHOW,\n handleOnKeyboardShow\n );\n\n const hideSubscription = Keyboard.addListener(\n KEYBOARD_EVENT_MAPPER.KEYBOARD_HIDE,\n handleOnKeyboardHide\n );\n\n return () => {\n showSubscription.remove();\n hideSubscription.remove();\n };\n }, [handleKeyboardEvent]);\n\n /**\n * This reaction is needed to handle the issue with multiline text input.\n *\n * @link https://github.com/gorhom/react-native-bottom-sheet/issues/411\n */\n useAnimatedReaction(\n () => shouldHandleKeyboardEvents.value,\n result => {\n const params = temporaryCachedKeyboardEvent.value;\n if (result && params.length > 0) {\n handleKeyboardEvent(params[0], params[1], params[2], params[3]);\n }\n }\n );\n //#endregion\n\n return {\n state: keyboardState,\n height: keyboardHeight,\n animationEasing: keyboardAnimationEasing,\n animationDuration: keyboardAnimationDuration,\n shouldHandleKeyboardEvents,\n };\n};\n"]} \ No newline at end of file diff --git a/lib/module/hooks/useNormalizedSnapPoints.js b/lib/module/hooks/useNormalizedSnapPoints.js new file mode 100644 index 000000000..d77d80d57 --- /dev/null +++ b/lib/module/hooks/useNormalizedSnapPoints.js @@ -0,0 +1,47 @@ +import { useDerivedValue } from 'react-native-reanimated'; +import { normalizeSnapPoint } from '../utilities'; +import { INITIAL_CONTAINER_HEIGHT, INITIAL_HANDLE_HEIGHT, INITIAL_SNAP_POINT } from '../components/bottomSheet/constants'; +/** + * Convert percentage snap points to pixels in screen and calculate + * the accurate snap points positions. + * @param snapPoints provided snap points. + * @param containerHeight BottomSheetContainer height. + * @param contentHeight content size. + * @param handleHeight handle size. + * @param enableDynamicSizing + * @param maxDynamicContentSize + * @returns {Animated.SharedValue} + */ + +export const useNormalizedSnapPoints = (snapPoints, containerHeight, contentHeight, handleHeight, enableDynamicSizing, maxDynamicContentSize) => { + const normalizedSnapPoints = useDerivedValue(() => { + // early exit, if container layout is not ready + const isContainerLayoutReady = containerHeight.value !== INITIAL_CONTAINER_HEIGHT; + + if (!isContainerLayoutReady) { + return [INITIAL_SNAP_POINT]; + } + + const _snapPoints = snapPoints ? 'value' in snapPoints ? snapPoints.value : snapPoints : []; + + let _normalizedSnapPoints = _snapPoints.map(snapPoint => normalizeSnapPoint(snapPoint, containerHeight.value)); + + if (enableDynamicSizing) { + if (handleHeight.value === INITIAL_HANDLE_HEIGHT) { + return [INITIAL_SNAP_POINT]; + } + + if (contentHeight.value === INITIAL_CONTAINER_HEIGHT) { + return [INITIAL_SNAP_POINT]; + } + + _normalizedSnapPoints.push(containerHeight.value - Math.min(contentHeight.value + handleHeight.value, maxDynamicContentSize !== undefined ? maxDynamicContentSize : containerHeight.value)); + + _normalizedSnapPoints = _normalizedSnapPoints.sort((a, b) => b - a); + } + + return _normalizedSnapPoints; + }, [snapPoints, enableDynamicSizing, maxDynamicContentSize]); + return normalizedSnapPoints; +}; +//# sourceMappingURL=useNormalizedSnapPoints.js.map \ No newline at end of file diff --git a/lib/module/hooks/useNormalizedSnapPoints.js.map b/lib/module/hooks/useNormalizedSnapPoints.js.map new file mode 100644 index 000000000..7c70bcace --- /dev/null +++ b/lib/module/hooks/useNormalizedSnapPoints.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["useNormalizedSnapPoints.ts"],"names":["useDerivedValue","normalizeSnapPoint","INITIAL_CONTAINER_HEIGHT","INITIAL_HANDLE_HEIGHT","INITIAL_SNAP_POINT","useNormalizedSnapPoints","snapPoints","containerHeight","contentHeight","handleHeight","enableDynamicSizing","maxDynamicContentSize","normalizedSnapPoints","isContainerLayoutReady","value","_snapPoints","_normalizedSnapPoints","map","snapPoint","push","Math","min","undefined","sort","a","b"],"mappings":"AAAA,SAAmBA,eAAnB,QAA0C,yBAA1C;AACA,SAASC,kBAAT,QAAmC,cAAnC;AAEA,SACEC,wBADF,EAEEC,qBAFF,EAGEC,kBAHF,QAIO,qCAJP;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,uBAAuB,GAAG,CACrCC,UADqC,EAErCC,eAFqC,EAGrCC,aAHqC,EAIrCC,YAJqC,EAKrCC,mBALqC,EAMrCC,qBANqC,KAOlC;AACH,QAAMC,oBAAoB,GAAGZ,eAAe,CAAC,MAAM;AACjD;AACA,UAAMa,sBAAsB,GAC1BN,eAAe,CAACO,KAAhB,KAA0BZ,wBAD5B;;AAEA,QAAI,CAACW,sBAAL,EAA6B;AAC3B,aAAO,CAACT,kBAAD,CAAP;AACD;;AAED,UAAMW,WAAW,GAAGT,UAAU,GAC1B,WAAWA,UAAX,GACEA,UAAU,CAACQ,KADb,GAEER,UAHwB,GAI1B,EAJJ;;AAMA,QAAIU,qBAAqB,GAAGD,WAAW,CAACE,GAAZ,CAAgBC,SAAS,IACnDjB,kBAAkB,CAACiB,SAAD,EAAYX,eAAe,CAACO,KAA5B,CADQ,CAA5B;;AAIA,QAAIJ,mBAAJ,EAAyB;AACvB,UAAID,YAAY,CAACK,KAAb,KAAuBX,qBAA3B,EAAkD;AAChD,eAAO,CAACC,kBAAD,CAAP;AACD;;AAED,UAAII,aAAa,CAACM,KAAd,KAAwBZ,wBAA5B,EAAsD;AACpD,eAAO,CAACE,kBAAD,CAAP;AACD;;AAEDY,MAAAA,qBAAqB,CAACG,IAAtB,CACEZ,eAAe,CAACO,KAAhB,GACEM,IAAI,CAACC,GAAL,CACEb,aAAa,CAACM,KAAd,GAAsBL,YAAY,CAACK,KADrC,EAEEH,qBAAqB,KAAKW,SAA1B,GACIX,qBADJ,GAEIJ,eAAe,CAACO,KAJtB,CAFJ;;AAUAE,MAAAA,qBAAqB,GAAGA,qBAAqB,CAACO,IAAtB,CAA2B,CAACC,CAAD,EAAIC,CAAJ,KAAUA,CAAC,GAAGD,CAAzC,CAAxB;AACD;;AACD,WAAOR,qBAAP;AACD,GAxC2C,EAwCzC,CAACV,UAAD,EAAaI,mBAAb,EAAkCC,qBAAlC,CAxCyC,CAA5C;AA0CA,SAAOC,oBAAP;AACD,CAnDM","sourcesContent":["import Animated, { useDerivedValue } from 'react-native-reanimated';\nimport { normalizeSnapPoint } from '../utilities';\nimport type { BottomSheetProps } from '../components/bottomSheet';\nimport {\n INITIAL_CONTAINER_HEIGHT,\n INITIAL_HANDLE_HEIGHT,\n INITIAL_SNAP_POINT,\n} from '../components/bottomSheet/constants';\n\n/**\n * Convert percentage snap points to pixels in screen and calculate\n * the accurate snap points positions.\n * @param snapPoints provided snap points.\n * @param containerHeight BottomSheetContainer height.\n * @param contentHeight content size.\n * @param handleHeight handle size.\n * @param enableDynamicSizing\n * @param maxDynamicContentSize\n * @returns {Animated.SharedValue}\n */\nexport const useNormalizedSnapPoints = (\n snapPoints: BottomSheetProps['snapPoints'],\n containerHeight: Animated.SharedValue,\n contentHeight: Animated.SharedValue,\n handleHeight: Animated.SharedValue,\n enableDynamicSizing: BottomSheetProps['enableDynamicSizing'],\n maxDynamicContentSize: BottomSheetProps['maxDynamicContentSize']\n) => {\n const normalizedSnapPoints = useDerivedValue(() => {\n // early exit, if container layout is not ready\n const isContainerLayoutReady =\n containerHeight.value !== INITIAL_CONTAINER_HEIGHT;\n if (!isContainerLayoutReady) {\n return [INITIAL_SNAP_POINT];\n }\n\n const _snapPoints = snapPoints\n ? 'value' in snapPoints\n ? snapPoints.value\n : snapPoints\n : [];\n\n let _normalizedSnapPoints = _snapPoints.map(snapPoint =>\n normalizeSnapPoint(snapPoint, containerHeight.value)\n ) as number[];\n\n if (enableDynamicSizing) {\n if (handleHeight.value === INITIAL_HANDLE_HEIGHT) {\n return [INITIAL_SNAP_POINT];\n }\n\n if (contentHeight.value === INITIAL_CONTAINER_HEIGHT) {\n return [INITIAL_SNAP_POINT];\n }\n\n _normalizedSnapPoints.push(\n containerHeight.value -\n Math.min(\n contentHeight.value + handleHeight.value,\n maxDynamicContentSize !== undefined\n ? maxDynamicContentSize\n : containerHeight.value\n )\n );\n\n _normalizedSnapPoints = _normalizedSnapPoints.sort((a, b) => b - a);\n }\n return _normalizedSnapPoints;\n }, [snapPoints, enableDynamicSizing, maxDynamicContentSize]);\n\n return normalizedSnapPoints;\n};\n"]} \ No newline at end of file diff --git a/lib/module/hooks/usePropsValidator.js b/lib/module/hooks/usePropsValidator.js new file mode 100644 index 000000000..2009ef8dc --- /dev/null +++ b/lib/module/hooks/usePropsValidator.js @@ -0,0 +1,40 @@ +import { useMemo } from 'react'; +import invariant from 'invariant'; +import { INITIAL_SNAP_POINT } from '../components/bottomSheet/constants'; + +/** + * @todo + * replace this with `prop-types`. + */ +export const usePropsValidator = ({ + index, + snapPoints, + enableDynamicSizing, + topInset, + bottomInset +}) => { + useMemo(() => { + //#region snap points + const _snapPoints = snapPoints ? 'value' in snapPoints ? snapPoints.value : snapPoints : []; + + invariant(_snapPoints || enableDynamicSizing, `'snapPoints' was not provided! please provide at least one snap point.`); + + _snapPoints.map(snapPoint => { + const _snapPoint = typeof snapPoint === 'number' ? snapPoint : parseInt(snapPoint.replace('%', ''), 10); + + invariant(_snapPoint > 0 || _snapPoint === INITIAL_SNAP_POINT, `Snap point '${snapPoint}' is invalid. if you want to allow user to close the sheet, Please use 'enablePanDownToClose' prop.`); + }); + + invariant('value' in _snapPoints || _snapPoints.length > 0 || enableDynamicSizing, `'snapPoints' was provided with no points! please provide at least one snap point.`); //#endregion + //#region index + + invariant(typeof index === 'number' || typeof index === 'undefined', `'index' was provided but with wrong type ! expected type is a number.`); + invariant(enableDynamicSizing || (typeof index === 'number' ? index >= -1 && index <= _snapPoints.length - 1 : true), `'index' was provided but out of the provided snap points range! expected value to be between -1, ${_snapPoints.length - 1}`); //#endregion + //#region insets + + invariant(typeof topInset === 'number' || typeof topInset === 'undefined', `'topInset' was provided but with wrong type ! expected type is a number.`); + invariant(typeof bottomInset === 'number' || typeof bottomInset === 'undefined', `'bottomInset' was provided but with wrong type ! expected type is a number.`); //#endregion + // animations + }, [index, snapPoints, topInset, bottomInset, enableDynamicSizing]); +}; +//# sourceMappingURL=usePropsValidator.js.map \ No newline at end of file diff --git a/lib/module/hooks/usePropsValidator.js.map b/lib/module/hooks/usePropsValidator.js.map new file mode 100644 index 000000000..e5a0d1d4f --- /dev/null +++ b/lib/module/hooks/usePropsValidator.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["usePropsValidator.ts"],"names":["useMemo","invariant","INITIAL_SNAP_POINT","usePropsValidator","index","snapPoints","enableDynamicSizing","topInset","bottomInset","_snapPoints","value","map","snapPoint","_snapPoint","parseInt","replace","length"],"mappings":"AAAA,SAASA,OAAT,QAAwB,OAAxB;AACA,OAAOC,SAAP,MAAsB,WAAtB;AACA,SAASC,kBAAT,QAAmC,qCAAnC;;AAGA;AACA;AACA;AACA;AAEA,OAAO,MAAMC,iBAAiB,GAAG,CAAC;AAChCC,EAAAA,KADgC;AAEhCC,EAAAA,UAFgC;AAGhC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A,SAAS,CACP,OAAOO,WAAP,KAAuB,QAAvB,IAAmC,OAAOA,WAAP,KAAuB,WADnD,EAEN,6EAFM,CAAT,CApDY,CAwDZ;AAEA;AACD,GA3DM,EA2DJ,CAACJ,KAAD,EAAQC,UAAR,EAAoBE,QAApB,EAA8BC,WAA9B,EAA2CF,mBAA3C,CA3DI,CAAP;AA4DD,CAnEM","sourcesContent":["import { useMemo } from 'react';\nimport invariant from 'invariant';\nimport { INITIAL_SNAP_POINT } from '../components/bottomSheet/constants';\nimport type { BottomSheetProps } from '../components/bottomSheet';\n\n/**\n * @todo\n * replace this with `prop-types`.\n */\n\nexport const usePropsValidator = ({\n index,\n snapPoints,\n enableDynamicSizing,\n topInset,\n bottomInset,\n}: BottomSheetProps) => {\n useMemo(() => {\n //#region snap points\n const _snapPoints = snapPoints\n ? 'value' in snapPoints\n ? snapPoints.value\n : snapPoints\n : [];\n invariant(\n _snapPoints || enableDynamicSizing,\n `'snapPoints' was not provided! please provide at least one snap point.`\n );\n\n _snapPoints.map(snapPoint => {\n const _snapPoint =\n typeof snapPoint === 'number'\n ? snapPoint\n : parseInt(snapPoint.replace('%', ''), 10);\n\n invariant(\n _snapPoint > 0 || _snapPoint === INITIAL_SNAP_POINT,\n `Snap point '${snapPoint}' is invalid. if you want to allow user to close the sheet, Please use 'enablePanDownToClose' prop.`\n );\n });\n\n invariant(\n 'value' in _snapPoints || _snapPoints.length > 0 || enableDynamicSizing,\n `'snapPoints' was provided with no points! please provide at least one snap point.`\n );\n //#endregion\n\n //#region index\n invariant(\n typeof index === 'number' || typeof index === 'undefined',\n `'index' was provided but with wrong type ! expected type is a number.`\n );\n\n invariant(\n enableDynamicSizing ||\n (typeof index === 'number'\n ? index >= -1 && index <= _snapPoints.length - 1\n : true),\n `'index' was provided but out of the provided snap points range! expected value to be between -1, ${\n _snapPoints.length - 1\n }`\n );\n //#endregion\n\n //#region insets\n invariant(\n typeof topInset === 'number' || typeof topInset === 'undefined',\n `'topInset' was provided but with wrong type ! expected type is a number.`\n );\n invariant(\n typeof bottomInset === 'number' || typeof bottomInset === 'undefined',\n `'bottomInset' was provided but with wrong type ! expected type is a number.`\n );\n //#endregion\n\n // animations\n }, [index, snapPoints, topInset, bottomInset, enableDynamicSizing]);\n};\n"]} \ No newline at end of file diff --git a/lib/module/hooks/useReactiveSharedValue.js b/lib/module/hooks/useReactiveSharedValue.js new file mode 100644 index 000000000..d8b0e1458 --- /dev/null +++ b/lib/module/hooks/useReactiveSharedValue.js @@ -0,0 +1,44 @@ +import { useEffect, useRef } from 'react'; +import { cancelAnimation, makeMutable } from 'react-native-reanimated'; +export const useReactiveSharedValue = value => { + var _valueRef$current; + + const initialValueRef = useRef(null); + const valueRef = useRef(null); + + if (value && typeof value === 'object' && 'value' in value) { + /** + * if provided value is a shared value, + * then we do not initialize another one. + */ + } else if (valueRef.current === null) { + // @ts-ignore + initialValueRef.current = value; + /** + * if value is an object, then we need to + * pass a clone. + */ + + if (typeof value === 'object') { + // @ts-ignore + valueRef.current = makeMutable({ ...value + }); + } else { + // @ts-ignore + valueRef.current = makeMutable(value); + } + } else if (initialValueRef.current !== value) { + valueRef.current.value = value; + } + + useEffect(() => { + return () => { + if (valueRef.current) { + cancelAnimation(valueRef.current); + } + }; + }, []); // @ts-ignore + + return (_valueRef$current = valueRef.current) !== null && _valueRef$current !== void 0 ? _valueRef$current : value; +}; +//# sourceMappingURL=useReactiveSharedValue.js.map \ No newline at end of file diff --git a/lib/module/hooks/useReactiveSharedValue.js.map b/lib/module/hooks/useReactiveSharedValue.js.map new file mode 100644 index 000000000..89acc7711 --- /dev/null +++ b/lib/module/hooks/useReactiveSharedValue.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["useReactiveSharedValue.ts"],"names":["useEffect","useRef","cancelAnimation","makeMutable","useReactiveSharedValue","value","initialValueRef","valueRef","current"],"mappings":"AAAA,SAASA,SAAT,EAAoBC,MAApB,QAAkC,OAAlC;AACA,SACEC,eADF,EAEEC,WAFF,QAGO,yBAHP;AAMA,OAAO,MAAMC,sBAAsB,GACjCC,KADoC,IAEkB;AAAA;;AACtD,QAAMC,eAAe,GAAGL,MAAM,CAAI,IAAJ,CAA9B;AACA,QAAMM,QAAQ,GAAGN,MAAM,CAA0B,IAA1B,CAAvB;;AAEA,MAAII,KAAK,IAAI,OAAOA,KAAP,KAAiB,QAA1B,IAAsC,WAAWA,KAArD,EAA4D;AAC1D;AACJ;AACA;AACA;AACG,GALD,MAKO,IAAIE,QAAQ,CAACC,OAAT,KAAqB,IAAzB,EAA+B;AACpC;AACAF,IAAAA,eAAe,CAACE,OAAhB,GAA0BH,KAA1B;AACA;AACJ;AACA;AACA;;AACI,QAAI,OAAOA,KAAP,KAAiB,QAArB,EAA+B;AAC7B;AACAE,MAAAA,QAAQ,CAACC,OAAT,GAAmBL,WAAW,CAAC,EAAE,GAAGE;AAAL,OAAD,CAA9B;AACD,KAHD,MAGO;AACL;AACAE,MAAAA,QAAQ,CAACC,OAAT,GAAmBL,WAAW,CAACE,KAAD,CAA9B;AACD;AACF,GAdM,MAcA,IAAIC,eAAe,CAACE,OAAhB,KAA4BH,KAAhC,EAAuC;AAC5CE,IAAAA,QAAQ,CAACC,OAAT,CAAiBH,KAAjB,GAAyBA,KAAzB;AACD;;AAEDL,EAAAA,SAAS,CAAC,MAAM;AACd,WAAO,MAAM;AACX,UAAIO,QAAQ,CAACC,OAAb,EAAsB;AACpBN,QAAAA,eAAe,CAACK,QAAQ,CAACC,OAAV,CAAf;AACD;AACF,KAJD;AAKD,GANQ,EAMN,EANM,CAAT,CA3BsD,CAmCtD;;AACA,8BAAOD,QAAQ,CAACC,OAAhB,iEAA2BH,KAA3B;AACD,CAvCM","sourcesContent":["import { useEffect, useRef } from 'react';\nimport Animated, {\n cancelAnimation,\n makeMutable,\n} from 'react-native-reanimated';\nimport type { Primitive } from '../types';\n\nexport const useReactiveSharedValue = (\n value: T\n): T extends Primitive ? Animated.SharedValue : T => {\n const initialValueRef = useRef(null);\n const valueRef = useRef>(null);\n\n if (value && typeof value === 'object' && 'value' in value) {\n /**\n * if provided value is a shared value,\n * then we do not initialize another one.\n */\n } else if (valueRef.current === null) {\n // @ts-ignore\n initialValueRef.current = value;\n /**\n * if value is an object, then we need to\n * pass a clone.\n */\n if (typeof value === 'object') {\n // @ts-ignore\n valueRef.current = makeMutable({ ...value });\n } else {\n // @ts-ignore\n valueRef.current = makeMutable(value);\n }\n } else if (initialValueRef.current !== value) {\n valueRef.current.value = value as T;\n }\n\n useEffect(() => {\n return () => {\n if (valueRef.current) {\n cancelAnimation(valueRef.current);\n }\n };\n }, []);\n\n // @ts-ignore\n return valueRef.current ?? value;\n};\n"]} \ No newline at end of file diff --git a/lib/module/hooks/useScrollEventsHandlersDefault.js b/lib/module/hooks/useScrollEventsHandlersDefault.js new file mode 100644 index 000000000..933a4a5ef --- /dev/null +++ b/lib/module/hooks/useScrollEventsHandlersDefault.js @@ -0,0 +1,99 @@ +import { scrollTo, useWorkletCallback } from 'react-native-reanimated'; +import { useBottomSheetInternal } from './useBottomSheetInternal'; +import { ANIMATION_STATE, SCROLLABLE_STATE, SHEET_STATE } from '../constants'; +export const useScrollEventsHandlersDefault = (scrollableRef, scrollableContentOffsetY) => { + // hooks + const { + animatedSheetState, + animatedScrollableState, + animatedAnimationState, + animatedScrollableContentOffsetY: rootScrollableContentOffsetY + } = useBottomSheetInternal(); //#region callbacks + + const handleOnScroll = useWorkletCallback((_, context) => { + /** + * if sheet position is extended or fill parent, then we reset + * `shouldLockInitialPosition` value to false. + */ + if (animatedSheetState.value === SHEET_STATE.EXTENDED || animatedSheetState.value === SHEET_STATE.FILL_PARENT) { + context.shouldLockInitialPosition = false; + } + + if (animatedScrollableState.value === SCROLLABLE_STATE.LOCKED) { + var _context$initialConte; + + const lockPosition = context.shouldLockInitialPosition ? (_context$initialConte = context.initialContentOffsetY) !== null && _context$initialConte !== void 0 ? _context$initialConte : 0 : 0; // @ts-ignore + + scrollTo(scrollableRef, 0, lockPosition, false); + scrollableContentOffsetY.value = lockPosition; + return; + } + }, [scrollableRef, scrollableContentOffsetY, animatedScrollableState, animatedSheetState]); + const handleOnBeginDrag = useWorkletCallback(({ + contentOffset: { + y + } + }, context) => { + scrollableContentOffsetY.value = y; + rootScrollableContentOffsetY.value = y; + context.initialContentOffsetY = y; + /** + * if sheet position not extended or fill parent and the scrollable position + * not at the top, then we should lock the initial scrollable position. + */ + + if (animatedSheetState.value !== SHEET_STATE.EXTENDED && animatedSheetState.value !== SHEET_STATE.FILL_PARENT && y > 0) { + context.shouldLockInitialPosition = true; + } else { + context.shouldLockInitialPosition = false; + } + }, [scrollableContentOffsetY, animatedSheetState, rootScrollableContentOffsetY]); + const handleOnEndDrag = useWorkletCallback(({ + contentOffset: { + y + } + }, context) => { + if (animatedScrollableState.value === SCROLLABLE_STATE.LOCKED) { + var _context$initialConte2; + + const lockPosition = context.shouldLockInitialPosition ? (_context$initialConte2 = context.initialContentOffsetY) !== null && _context$initialConte2 !== void 0 ? _context$initialConte2 : 0 : 0; // @ts-ignore + + scrollTo(scrollableRef, 0, lockPosition, false); + scrollableContentOffsetY.value = lockPosition; + return; + } + + if (animatedAnimationState.value !== ANIMATION_STATE.RUNNING) { + scrollableContentOffsetY.value = y; + rootScrollableContentOffsetY.value = y; + } + }, [scrollableRef, scrollableContentOffsetY, animatedAnimationState, animatedScrollableState, rootScrollableContentOffsetY]); + const handleOnMomentumEnd = useWorkletCallback(({ + contentOffset: { + y + } + }, context) => { + if (animatedScrollableState.value === SCROLLABLE_STATE.LOCKED) { + var _context$initialConte3; + + const lockPosition = context.shouldLockInitialPosition ? (_context$initialConte3 = context.initialContentOffsetY) !== null && _context$initialConte3 !== void 0 ? _context$initialConte3 : 0 : 0; // @ts-ignore + + scrollTo(scrollableRef, 0, lockPosition, false); + scrollableContentOffsetY.value = 0; + return; + } + + if (animatedAnimationState.value !== ANIMATION_STATE.RUNNING) { + scrollableContentOffsetY.value = y; + rootScrollableContentOffsetY.value = y; + } + }, [scrollableContentOffsetY, scrollableRef, animatedAnimationState, animatedScrollableState, rootScrollableContentOffsetY]); //#endregion + + return { + handleOnScroll, + handleOnBeginDrag, + handleOnEndDrag, + handleOnMomentumEnd + }; +}; +//# sourceMappingURL=useScrollEventsHandlersDefault.js.map \ No newline at end of file diff --git a/lib/module/hooks/useScrollEventsHandlersDefault.js.map b/lib/module/hooks/useScrollEventsHandlersDefault.js.map new file mode 100644 index 000000000..d680ebd41 --- /dev/null +++ b/lib/module/hooks/useScrollEventsHandlersDefault.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["useScrollEventsHandlersDefault.ts"],"names":["scrollTo","useWorkletCallback","useBottomSheetInternal","ANIMATION_STATE","SCROLLABLE_STATE","SHEET_STATE","useScrollEventsHandlersDefault","scrollableRef","scrollableContentOffsetY","animatedSheetState","animatedScrollableState","animatedAnimationState","animatedScrollableContentOffsetY","rootScrollableContentOffsetY","handleOnScroll","_","context","value","EXTENDED","FILL_PARENT","shouldLockInitialPosition","LOCKED","lockPosition","initialContentOffsetY","handleOnBeginDrag","contentOffset","y","handleOnEndDrag","RUNNING","handleOnMomentumEnd"],"mappings":"AAAA,SAASA,QAAT,EAAmBC,kBAAnB,QAA6C,yBAA7C;AACA,SAASC,sBAAT,QAAuC,0BAAvC;AACA,SAASC,eAAT,EAA0BC,gBAA1B,EAA4CC,WAA5C,QAA+D,cAA/D;AAWA,OAAO,MAAMC,8BAA4D,GAAG,CAC1EC,aAD0E,EAE1EC,wBAF0E,KAGvE;AACH;AACA,QAAM;AACJC,IAAAA,kBADI;AAEJC,IAAAA,uBAFI;AAGJC,IAAAA,sBAHI;AAIJC,IAAAA,gCAAgC,EAAEC;AAJ9B,MAKFX,sBAAsB,EAL1B,CAFG,CASH;;AACA,QAAMY,cAAsE,GAC1Eb,kBAAkB,CAChB,CAACc,CAAD,EAAIC,OAAJ,KAAgB;AACd;AACR;AACA;AACA;AACQ,QACEP,kBAAkB,CAACQ,KAAnB,KAA6BZ,WAAW,CAACa,QAAzC,IAC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,KAAiCd,eAAe,CAACyB,OAArD,EAA8D;AAC5DpB,MAAAA,wBAAwB,CAACS,KAAzB,GAAiCS,CAAjC;AACAb,MAAAA,4BAA4B,CAACI,KAA7B,GAAqCS,CAArC;AACD;AACF,GAfe,EAgBhB,CACElB,wBADF,EAEED,aAFF,EAGEI,sBAHF,EAIED,uBAJF,EAKEG,4BALF,CAhBgB,CADpB,CA7FG,CAsHH;;AAEA,SAAO;AACLC,IAAAA,cADK;AAELU,IAAAA,iBAFK;AAGLG,IAAAA,eAHK;AAILE,IAAAA;AAJK,GAAP;AAMD,CAjIM","sourcesContent":["import { scrollTo, useWorkletCallback } from 'react-native-reanimated';\nimport { useBottomSheetInternal } from './useBottomSheetInternal';\nimport { ANIMATION_STATE, SCROLLABLE_STATE, SHEET_STATE } from '../constants';\nimport type {\n ScrollEventsHandlersHookType,\n ScrollEventHandlerCallbackType,\n} from '../types';\n\nexport type ScrollEventContextType = {\n initialContentOffsetY: number;\n shouldLockInitialPosition: boolean;\n};\n\nexport const useScrollEventsHandlersDefault: ScrollEventsHandlersHookType = (\n scrollableRef,\n scrollableContentOffsetY\n) => {\n // hooks\n const {\n animatedSheetState,\n animatedScrollableState,\n animatedAnimationState,\n animatedScrollableContentOffsetY: rootScrollableContentOffsetY,\n } = useBottomSheetInternal();\n\n //#region callbacks\n const handleOnScroll: ScrollEventHandlerCallbackType =\n useWorkletCallback(\n (_, context) => {\n /**\n * if sheet position is extended or fill parent, then we reset\n * `shouldLockInitialPosition` value to false.\n */\n if (\n animatedSheetState.value === SHEET_STATE.EXTENDED ||\n animatedSheetState.value === SHEET_STATE.FILL_PARENT\n ) {\n context.shouldLockInitialPosition = false;\n }\n\n if (animatedScrollableState.value === SCROLLABLE_STATE.LOCKED) {\n const lockPosition = context.shouldLockInitialPosition\n ? context.initialContentOffsetY ?? 0\n : 0;\n // @ts-ignore\n scrollTo(scrollableRef, 0, lockPosition, false);\n scrollableContentOffsetY.value = lockPosition;\n return;\n }\n },\n [\n scrollableRef,\n scrollableContentOffsetY,\n animatedScrollableState,\n animatedSheetState,\n ]\n );\n const handleOnBeginDrag: ScrollEventHandlerCallbackType =\n useWorkletCallback(\n ({ contentOffset: { y } }, context) => {\n scrollableContentOffsetY.value = y;\n rootScrollableContentOffsetY.value = y;\n context.initialContentOffsetY = y;\n\n /**\n * if sheet position not extended or fill parent and the scrollable position\n * not at the top, then we should lock the initial scrollable position.\n */\n if (\n animatedSheetState.value !== SHEET_STATE.EXTENDED &&\n animatedSheetState.value !== SHEET_STATE.FILL_PARENT &&\n y > 0\n ) {\n context.shouldLockInitialPosition = true;\n } else {\n context.shouldLockInitialPosition = false;\n }\n },\n [\n scrollableContentOffsetY,\n animatedSheetState,\n rootScrollableContentOffsetY,\n ]\n );\n const handleOnEndDrag: ScrollEventHandlerCallbackType =\n useWorkletCallback(\n ({ contentOffset: { y } }, context) => {\n if (animatedScrollableState.value === SCROLLABLE_STATE.LOCKED) {\n const lockPosition = context.shouldLockInitialPosition\n ? context.initialContentOffsetY ?? 0\n : 0;\n // @ts-ignore\n scrollTo(scrollableRef, 0, lockPosition, false);\n scrollableContentOffsetY.value = lockPosition;\n return;\n }\n if (animatedAnimationState.value !== ANIMATION_STATE.RUNNING) {\n scrollableContentOffsetY.value = y;\n rootScrollableContentOffsetY.value = y;\n }\n },\n [\n scrollableRef,\n scrollableContentOffsetY,\n animatedAnimationState,\n animatedScrollableState,\n rootScrollableContentOffsetY,\n ]\n );\n const handleOnMomentumEnd: ScrollEventHandlerCallbackType =\n useWorkletCallback(\n ({ contentOffset: { y } }, context) => {\n if (animatedScrollableState.value === SCROLLABLE_STATE.LOCKED) {\n const lockPosition = context.shouldLockInitialPosition\n ? context.initialContentOffsetY ?? 0\n : 0;\n // @ts-ignore\n scrollTo(scrollableRef, 0, lockPosition, false);\n scrollableContentOffsetY.value = 0;\n return;\n }\n if (animatedAnimationState.value !== ANIMATION_STATE.RUNNING) {\n scrollableContentOffsetY.value = y;\n rootScrollableContentOffsetY.value = y;\n }\n },\n [\n scrollableContentOffsetY,\n scrollableRef,\n animatedAnimationState,\n animatedScrollableState,\n rootScrollableContentOffsetY,\n ]\n );\n //#endregion\n\n return {\n handleOnScroll,\n handleOnBeginDrag,\n handleOnEndDrag,\n handleOnMomentumEnd,\n };\n};\n"]} \ No newline at end of file diff --git a/lib/module/hooks/useScrollHandler.js b/lib/module/hooks/useScrollHandler.js new file mode 100644 index 000000000..98611677f --- /dev/null +++ b/lib/module/hooks/useScrollHandler.js @@ -0,0 +1,55 @@ +import { runOnJS, useAnimatedRef, useAnimatedScrollHandler, useSharedValue } from 'react-native-reanimated'; +import { useScrollEventsHandlersDefault } from './useScrollEventsHandlersDefault'; +import { workletNoop as noop } from '../utilities'; +export const useScrollHandler = (useScrollEventsHandlers = useScrollEventsHandlersDefault, onScroll, onScrollBeginDrag, onScrollEndDrag) => { + // refs + const scrollableRef = useAnimatedRef(); // variables + + const scrollableContentOffsetY = useSharedValue(0); // hooks + + const { + handleOnScroll = noop, + handleOnBeginDrag = noop, + handleOnEndDrag = noop, + handleOnMomentumEnd = noop, + handleOnMomentumBegin = noop + } = useScrollEventsHandlers(scrollableRef, scrollableContentOffsetY); // callbacks + + const scrollHandler = useAnimatedScrollHandler({ + onScroll: (event, context) => { + handleOnScroll(event, context); + + if (onScroll) { + runOnJS(onScroll)({ + nativeEvent: event + }); + } + }, + onBeginDrag: (event, context) => { + handleOnBeginDrag(event, context); + + if (onScrollBeginDrag) { + runOnJS(onScrollBeginDrag)({ + nativeEvent: event + }); + } + }, + onEndDrag: (event, context) => { + handleOnEndDrag(event, context); + + if (onScrollEndDrag) { + runOnJS(onScrollEndDrag)({ + nativeEvent: event + }); + } + }, + onMomentumBegin: handleOnMomentumBegin, + onMomentumEnd: handleOnMomentumEnd + }, [handleOnScroll, handleOnBeginDrag, handleOnEndDrag, handleOnMomentumBegin, handleOnMomentumEnd, onScroll, onScrollBeginDrag, onScrollEndDrag]); + return { + scrollHandler, + scrollableRef, + scrollableContentOffsetY + }; +}; +//# sourceMappingURL=useScrollHandler.js.map \ No newline at end of file diff --git a/lib/module/hooks/useScrollHandler.js.map b/lib/module/hooks/useScrollHandler.js.map new file mode 100644 index 000000000..d5bb73e93 --- /dev/null +++ b/lib/module/hooks/useScrollHandler.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["useScrollHandler.ts"],"names":["runOnJS","useAnimatedRef","useAnimatedScrollHandler","useSharedValue","useScrollEventsHandlersDefault","workletNoop","noop","useScrollHandler","useScrollEventsHandlers","onScroll","onScrollBeginDrag","onScrollEndDrag","scrollableRef","scrollableContentOffsetY","handleOnScroll","handleOnBeginDrag","handleOnEndDrag","handleOnMomentumEnd","handleOnMomentumBegin","scrollHandler","event","context","nativeEvent","onBeginDrag","onEndDrag","onMomentumBegin","onMomentumEnd"],"mappings":"AAAA,SACEA,OADF,EAEEC,cAFF,EAGEC,wBAHF,EAIEC,cAJF,QAKO,yBALP;AAMA,SAASC,8BAAT,QAA+C,kCAA/C;AACA,SAASC,WAAW,IAAIC,IAAxB,QAAoC,cAApC;AAGA,OAAO,MAAMC,gBAAgB,GAAG,CAC9BC,uBAAuB,GAAGJ,8BADI,EAE9BK,QAF8B,EAG9BC,iBAH8B,EAI9BC,eAJ8B,KAK3B;AACH;AACA,QAAMC,aAAa,GAAGX,cAAc,EAApC,CAFG,CAIH;;AACA,QAAMY,wBAAwB,GAAGV,cAAc,CAAS,CAAT,CAA/C,CALG,CAOH;;AACA,QAAM;AACJW,IAAAA,cAAc,GAAGR,IADb;AAEJS,IAAAA,iBAAiB,GAAGT,IAFhB;AAGJU,IAAAA,eAAe,GAAGV,IAHd;AAIJW,IAAAA,mBAAmB,GAAGX,IAJlB;AAKJY,IAAAA,qBAAqB,GAAGZ;AALpB,MAMFE,uBAAuB,CAACI,aAAD,EAAgBC,wBAAhB,CAN3B,CARG,CAgBH;;AACA,QAAMM,aAAa,GAAGjB,wBAAwB,CAC5C;AACEO,IAAAA,QAAQ,EAAE,CAACW,KAAD,EAAQC,OAAR,KAAoB;AAC5BP,MAAAA,cAAc,CAACM,KAAD,EAAQC,OAAR,CAAd;;AAEA,UAAIZ,QAAJ,EAAc;AACZT,QAAAA,OAAO,CAACS,QAAD,CAAP,CAAkB;AAAEa,UAAAA,WAAW,EAAEF;AAAf,SAAlB;AACD;AACF,KAPH;AAQEG,IAAAA,WAAW,EAAE,CAACH,KAAD,EAAQC,OAAR,KAAoB;AAC/BN,MAAAA,iBAAiB,CAACK,KAAD,EAAQC,OAAR,CAAjB;;AAEA,UAAIX,iBAAJ,EAAuB;AACrBV,QAAAA,OAAO,CAACU,iBAAD,CAAP,CAA2B;AAAEY,UAAAA,WAAW,EAAEF;AAAf,SAA3B;AACD;AACF,KAdH;AAeEI,IAAAA,SAAS,EAAE,CAACJ,KAAD,EAAQC,OAAR,KAAoB;AAC7BL,MAAAA,eAAe,CAACI,KAAD,EAAQC,OAAR,CAAf;;AAEA,UAAIV,eAAJ,EAAqB;AACnBX,QAAAA,OAAO,CAACW,eAAD,CAAP,CAAyB;AAAEW,UAAAA,WAAW,EAAEF;AAAf,SAAzB;AACD;AACF,KArBH;AAsBEK,IAAAA,eAAe,EAAEP,qBAtBnB;AAuBEQ,IAAAA,aAAa,EAAET;AAvBjB,GAD4C,EA0B5C,CACEH,cADF,EAEEC,iBAFF,EAGEC,eAHF,EAIEE,qBAJF,EAKED,mBALF,EAMER,QANF,EAOEC,iBAPF,EAQEC,eARF,CA1B4C,CAA9C;AAsCA,SAAO;AAAEQ,IAAAA,aAAF;AAAiBP,IAAAA,aAAjB;AAAgCC,IAAAA;AAAhC,GAAP;AACD,CA7DM","sourcesContent":["import {\n runOnJS,\n useAnimatedRef,\n useAnimatedScrollHandler,\n useSharedValue,\n} from 'react-native-reanimated';\nimport { useScrollEventsHandlersDefault } from './useScrollEventsHandlersDefault';\nimport { workletNoop as noop } from '../utilities';\nimport type { Scrollable, ScrollableEvent } from '../types';\n\nexport const useScrollHandler = (\n useScrollEventsHandlers = useScrollEventsHandlersDefault,\n onScroll?: ScrollableEvent,\n onScrollBeginDrag?: ScrollableEvent,\n onScrollEndDrag?: ScrollableEvent\n) => {\n // refs\n const scrollableRef = useAnimatedRef();\n\n // variables\n const scrollableContentOffsetY = useSharedValue(0);\n\n // hooks\n const {\n handleOnScroll = noop,\n handleOnBeginDrag = noop,\n handleOnEndDrag = noop,\n handleOnMomentumEnd = noop,\n handleOnMomentumBegin = noop,\n } = useScrollEventsHandlers(scrollableRef, scrollableContentOffsetY);\n\n // callbacks\n const scrollHandler = useAnimatedScrollHandler(\n {\n onScroll: (event, context) => {\n handleOnScroll(event, context);\n\n if (onScroll) {\n runOnJS(onScroll)({ nativeEvent: event });\n }\n },\n onBeginDrag: (event, context) => {\n handleOnBeginDrag(event, context);\n\n if (onScrollBeginDrag) {\n runOnJS(onScrollBeginDrag)({ nativeEvent: event });\n }\n },\n onEndDrag: (event, context) => {\n handleOnEndDrag(event, context);\n\n if (onScrollEndDrag) {\n runOnJS(onScrollEndDrag)({ nativeEvent: event });\n }\n },\n onMomentumBegin: handleOnMomentumBegin,\n onMomentumEnd: handleOnMomentumEnd,\n },\n [\n handleOnScroll,\n handleOnBeginDrag,\n handleOnEndDrag,\n handleOnMomentumBegin,\n handleOnMomentumEnd,\n onScroll,\n onScrollBeginDrag,\n onScrollEndDrag,\n ]\n );\n\n return { scrollHandler, scrollableRef, scrollableContentOffsetY };\n};\n"]} \ No newline at end of file diff --git a/lib/module/hooks/useScrollable.js b/lib/module/hooks/useScrollable.js new file mode 100644 index 000000000..f0a869b9a --- /dev/null +++ b/lib/module/hooks/useScrollable.js @@ -0,0 +1,66 @@ +import { useCallback, useRef } from 'react'; +import { useSharedValue } from 'react-native-reanimated'; +import { getRefNativeTag } from '../utilities/getRefNativeTag'; +import { SCROLLABLE_STATE, SCROLLABLE_TYPE } from '../constants'; +export const useScrollable = () => { + // refs + const scrollableRef = useRef(null); + const previousScrollableRef = useRef(null); // variables + + const animatedScrollableType = useSharedValue(SCROLLABLE_TYPE.UNDETERMINED); + const animatedScrollableContentOffsetY = useSharedValue(0); + const animatedScrollableOverrideState = useSharedValue(SCROLLABLE_STATE.UNDETERMINED); + const isScrollableRefreshable = useSharedValue(false); // callbacks + + const setScrollableRef = useCallback(ref => { + var _scrollableRef$curren, _scrollableRef$curren2; + + // get current node handle id + let currentRefId = (_scrollableRef$curren = (_scrollableRef$curren2 = scrollableRef.current) === null || _scrollableRef$curren2 === void 0 ? void 0 : _scrollableRef$curren2.id) !== null && _scrollableRef$curren !== void 0 ? _scrollableRef$curren : null; + + if (currentRefId !== ref.id) { + if (scrollableRef.current) { + // @ts-ignore + previousScrollableRef.current = scrollableRef.current; + } // @ts-ignore + + + scrollableRef.current = ref; + } + }, []); + const removeScrollableRef = useCallback(ref => { + var _scrollableRef$curren3, _scrollableRef$curren4; + + // find node handle id + let id; + + try { + id = getRefNativeTag(ref); + } catch { + return; + } // get current node handle id + + + let currentRefId = (_scrollableRef$curren3 = (_scrollableRef$curren4 = scrollableRef.current) === null || _scrollableRef$curren4 === void 0 ? void 0 : _scrollableRef$curren4.id) !== null && _scrollableRef$curren3 !== void 0 ? _scrollableRef$curren3 : null; + /** + * @DEV + * when the incoming node is actually the current node, we reset + * the current scrollable ref to the previous one. + */ + + if (id === currentRefId) { + // @ts-ignore + scrollableRef.current = previousScrollableRef.current; + } + }, []); + return { + scrollableRef, + animatedScrollableType, + animatedScrollableContentOffsetY, + animatedScrollableOverrideState, + isScrollableRefreshable, + setScrollableRef, + removeScrollableRef + }; +}; +//# sourceMappingURL=useScrollable.js.map \ No newline at end of file diff --git a/lib/module/hooks/useScrollable.js.map b/lib/module/hooks/useScrollable.js.map new file mode 100644 index 000000000..1af0ce48d --- /dev/null +++ b/lib/module/hooks/useScrollable.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["useScrollable.ts"],"names":["useCallback","useRef","useSharedValue","getRefNativeTag","SCROLLABLE_STATE","SCROLLABLE_TYPE","useScrollable","scrollableRef","previousScrollableRef","animatedScrollableType","UNDETERMINED","animatedScrollableContentOffsetY","animatedScrollableOverrideState","isScrollableRefreshable","setScrollableRef","ref","currentRefId","current","id","removeScrollableRef"],"mappings":"AAAA,SAASA,WAAT,EAAiCC,MAAjC,QAA+C,OAA/C;AACA,SAASC,cAAT,QAA+B,yBAA/B;AACA,SAASC,eAAT,QAAgC,8BAAhC;AACA,SAASC,gBAAT,EAA2BC,eAA3B,QAAkD,cAAlD;AAGA,OAAO,MAAMC,aAAa,GAAG,MAAM;AACjC;AACA,QAAMC,aAAa,GAAGN,MAAM,CAAgB,IAAhB,CAA5B;AACA,QAAMO,qBAAqB,GAAGP,MAAM,CAAgB,IAAhB,CAApC,CAHiC,CAKjC;;AACA,QAAMQ,sBAAsB,GAAGP,cAAc,CAC3CG,eAAe,CAACK,YAD2B,CAA7C;AAGA,QAAMC,gCAAgC,GAAGT,cAAc,CAAS,CAAT,CAAvD;AACA,QAAMU,+BAA+B,GAAGV,cAAc,CACpDE,gBAAgB,CAACM,YADmC,CAAtD;AAGA,QAAMG,uBAAuB,GAAGX,cAAc,CAAU,KAAV,CAA9C,CAbiC,CAejC;;AACA,QAAMY,gBAAgB,GAAGd,WAAW,CAAEe,GAAD,IAAwB;AAAA;;AAC3D;AACA,QAAIC,YAAY,sDAAGT,aAAa,CAACU,OAAjB,2DAAG,uBAAuBC,EAA1B,yEAAgC,IAAhD;;AAEA,QAAIF,YAAY,KAAKD,GAAG,CAACG,EAAzB,EAA6B;AAC3B,UAAIX,aAAa,CAACU,OAAlB,EAA2B;AACzB;AACAT,QAAAA,qBAAqB,CAACS,OAAtB,GAAgCV,aAAa,CAACU,OAA9C;AACD,OAJ0B,CAK3B;;;AACAV,MAAAA,aAAa,CAACU,OAAd,GAAwBF,GAAxB;AACD;AACF,GAZmC,EAYjC,EAZiC,CAApC;AAcA,QAAMI,mBAAmB,GAAGnB,WAAW,CAAEe,GAAD,IAAgC;AAAA;;AACtE;AACA,QAAIG,EAAJ;;AACA,QAAI;AACFA,MAAAA,EAAE,GAAGf,eAAe,CAACY,GAAD,CAApB;AACD,KAFD,CAEE,MAAM;AACN;AACD,KAPqE,CAStE;;;AACA,QAAIC,YAAY,uDAAGT,aAAa,CAACU,OAAjB,2DAAG,uBAAuBC,EAA1B,2EAAgC,IAAhD;AAEA;AACJ;AACA;AACA;AACA;;AACI,QAAIA,EAAE,KAAKF,YAAX,EAAyB;AACvB;AACAT,MAAAA,aAAa,CAACU,OAAd,GAAwBT,qBAAqB,CAACS,OAA9C;AACD;AACF,GArBsC,EAqBpC,EArBoC,CAAvC;AAuBA,SAAO;AACLV,IAAAA,aADK;AAELE,IAAAA,sBAFK;AAGLE,IAAAA,gCAHK;AAILC,IAAAA,+BAJK;AAKLC,IAAAA,uBALK;AAMLC,IAAAA,gBANK;AAOLK,IAAAA;AAPK,GAAP;AASD,CA9DM","sourcesContent":["import { useCallback, RefObject, useRef } from 'react';\nimport { useSharedValue } from 'react-native-reanimated';\nimport { getRefNativeTag } from '../utilities/getRefNativeTag';\nimport { SCROLLABLE_STATE, SCROLLABLE_TYPE } from '../constants';\nimport type { ScrollableRef, Scrollable } from '../types';\n\nexport const useScrollable = () => {\n // refs\n const scrollableRef = useRef(null);\n const previousScrollableRef = useRef(null);\n\n // variables\n const animatedScrollableType = useSharedValue(\n SCROLLABLE_TYPE.UNDETERMINED\n );\n const animatedScrollableContentOffsetY = useSharedValue(0);\n const animatedScrollableOverrideState = useSharedValue(\n SCROLLABLE_STATE.UNDETERMINED\n );\n const isScrollableRefreshable = useSharedValue(false);\n\n // callbacks\n const setScrollableRef = useCallback((ref: ScrollableRef) => {\n // get current node handle id\n let currentRefId = scrollableRef.current?.id ?? null;\n\n if (currentRefId !== ref.id) {\n if (scrollableRef.current) {\n // @ts-ignore\n previousScrollableRef.current = scrollableRef.current;\n }\n // @ts-ignore\n scrollableRef.current = ref;\n }\n }, []);\n\n const removeScrollableRef = useCallback((ref: RefObject) => {\n // find node handle id\n let id;\n try {\n id = getRefNativeTag(ref);\n } catch {\n return;\n }\n\n // get current node handle id\n let currentRefId = scrollableRef.current?.id ?? null;\n\n /**\n * @DEV\n * when the incoming node is actually the current node, we reset\n * the current scrollable ref to the previous one.\n */\n if (id === currentRefId) {\n // @ts-ignore\n scrollableRef.current = previousScrollableRef.current;\n }\n }, []);\n\n return {\n scrollableRef,\n animatedScrollableType,\n animatedScrollableContentOffsetY,\n animatedScrollableOverrideState,\n isScrollableRefreshable,\n setScrollableRef,\n removeScrollableRef,\n };\n};\n"]} \ No newline at end of file diff --git a/lib/module/hooks/useScrollableSetter.js b/lib/module/hooks/useScrollableSetter.js new file mode 100644 index 000000000..f1748be9a --- /dev/null +++ b/lib/module/hooks/useScrollableSetter.js @@ -0,0 +1,40 @@ +import { useCallback, useEffect } from 'react'; +import { useBottomSheetInternal } from './useBottomSheetInternal'; +import { getRefNativeTag } from '../utilities/getRefNativeTag'; +export const useScrollableSetter = (ref, type, contentOffsetY, refreshable, useFocusHook = useEffect) => { + // hooks + const { + animatedScrollableType, + animatedScrollableContentOffsetY: rootScrollableContentOffsetY, + isContentHeightFixed, + isScrollableRefreshable, + setScrollableRef, + removeScrollableRef + } = useBottomSheetInternal(); // callbacks + + const handleSettingScrollable = useCallback(() => { + // set current content offset + rootScrollableContentOffsetY.value = contentOffsetY.value; + animatedScrollableType.value = type; + isScrollableRefreshable.value = refreshable; + isContentHeightFixed.value = false; // set current scrollable ref + + const id = getRefNativeTag(ref); + + if (id) { + setScrollableRef({ + id: id, + node: ref + }); + } else { + console.warn(`Couldn't find the scrollable node handle id!`); + } + + return () => { + removeScrollableRef(ref); + }; + }, [ref, type, refreshable, animatedScrollableType, rootScrollableContentOffsetY, contentOffsetY, isScrollableRefreshable, isContentHeightFixed, setScrollableRef, removeScrollableRef]); // effects + + useFocusHook(handleSettingScrollable); +}; +//# sourceMappingURL=useScrollableSetter.js.map \ No newline at end of file diff --git a/lib/module/hooks/useScrollableSetter.js.map b/lib/module/hooks/useScrollableSetter.js.map new file mode 100644 index 000000000..a5902cae6 --- /dev/null +++ b/lib/module/hooks/useScrollableSetter.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["useScrollableSetter.ts"],"names":["useCallback","useEffect","useBottomSheetInternal","getRefNativeTag","useScrollableSetter","ref","type","contentOffsetY","refreshable","useFocusHook","animatedScrollableType","animatedScrollableContentOffsetY","rootScrollableContentOffsetY","isContentHeightFixed","isScrollableRefreshable","setScrollableRef","removeScrollableRef","handleSettingScrollable","value","id","node","console","warn"],"mappings":"AAAA,SAAgBA,WAAhB,EAA6BC,SAA7B,QAA8C,OAA9C;AAEA,SAASC,sBAAT,QAAuC,0BAAvC;AACA,SAASC,eAAT,QAAgC,8BAAhC;AAIA,OAAO,MAAMC,mBAAmB,GAAG,CACjCC,GADiC,EAEjCC,IAFiC,EAGjCC,cAHiC,EAIjCC,WAJiC,EAKjCC,YAAY,GAAGR,SALkB,KAM9B;AACH;AACA,QAAM;AACJS,IAAAA,sBADI;AAEJC,IAAAA,gCAAgC,EAAEC,4BAF9B;AAGJC,IAAAA,oBAHI;AAIJC,IAAAA,uBAJI;AAKJC,IAAAA,gBALI;AAMJC,IAAAA;AANI,MAOFd,sBAAsB,EAP1B,CAFG,CAWH;;AACA,QAAMe,uBAAuB,GAAGjB,WAAW,CAAC,MAAM;AAChD;AACAY,IAAAA,4BAA4B,CAACM,KAA7B,GAAqCX,cAAc,CAACW,KAApD;AACAR,IAAAA,sBAAsB,CAACQ,KAAvB,GAA+BZ,IAA/B;AACAQ,IAAAA,uBAAuB,CAACI,KAAxB,GAAgCV,WAAhC;AACAK,IAAAA,oBAAoB,CAACK,KAArB,GAA6B,KAA7B,CALgD,CAOhD;;AACA,UAAMC,EAAE,GAAGhB,eAAe,CAACE,GAAD,CAA1B;;AACA,QAAIc,EAAJ,EAAQ;AACNJ,MAAAA,gBAAgB,CAAC;AACfI,QAAAA,EAAE,EAAEA,EADW;AAEfC,QAAAA,IAAI,EAAEf;AAFS,OAAD,CAAhB;AAID,KALD,MAKO;AACLgB,MAAAA,OAAO,CAACC,IAAR,CAAc,8CAAd;AACD;;AAED,WAAO,MAAM;AACXN,MAAAA,mBAAmB,CAACX,GAAD,CAAnB;AACD,KAFD;AAGD,GArB0C,EAqBxC,CACDA,GADC,EAEDC,IAFC,EAGDE,WAHC,EAIDE,sBAJC,EAKDE,4BALC,EAMDL,cANC,EAODO,uBAPC,EAQDD,oBARC,EASDE,gBATC,EAUDC,mBAVC,CArBwC,CAA3C,CAZG,CA8CH;;AACAP,EAAAA,YAAY,CAACQ,uBAAD,CAAZ;AACD,CAtDM","sourcesContent":["import React, { useCallback, useEffect } from 'react';\nimport Animated from 'react-native-reanimated';\nimport { useBottomSheetInternal } from './useBottomSheetInternal';\nimport { getRefNativeTag } from '../utilities/getRefNativeTag';\nimport { SCROLLABLE_TYPE } from '../constants';\nimport type { Scrollable } from '../types';\n\nexport const useScrollableSetter = (\n ref: React.RefObject,\n type: SCROLLABLE_TYPE,\n contentOffsetY: Animated.SharedValue,\n refreshable: boolean,\n useFocusHook = useEffect\n) => {\n // hooks\n const {\n animatedScrollableType,\n animatedScrollableContentOffsetY: rootScrollableContentOffsetY,\n isContentHeightFixed,\n isScrollableRefreshable,\n setScrollableRef,\n removeScrollableRef,\n } = useBottomSheetInternal();\n\n // callbacks\n const handleSettingScrollable = useCallback(() => {\n // set current content offset\n rootScrollableContentOffsetY.value = contentOffsetY.value;\n animatedScrollableType.value = type;\n isScrollableRefreshable.value = refreshable;\n isContentHeightFixed.value = false;\n\n // set current scrollable ref\n const id = getRefNativeTag(ref);\n if (id) {\n setScrollableRef({\n id: id,\n node: ref,\n });\n } else {\n console.warn(`Couldn't find the scrollable node handle id!`);\n }\n\n return () => {\n removeScrollableRef(ref);\n };\n }, [\n ref,\n type,\n refreshable,\n animatedScrollableType,\n rootScrollableContentOffsetY,\n contentOffsetY,\n isScrollableRefreshable,\n isContentHeightFixed,\n setScrollableRef,\n removeScrollableRef,\n ]);\n\n // effects\n useFocusHook(handleSettingScrollable);\n};\n"]} \ No newline at end of file diff --git a/lib/module/hooks/useStableCallback.js b/lib/module/hooks/useStableCallback.js new file mode 100644 index 000000000..91a679d96 --- /dev/null +++ b/lib/module/hooks/useStableCallback.js @@ -0,0 +1,16 @@ +import { useRef, useCallback, useEffect } from 'react'; + +/** + * Provide a stable version of useCallback + * https://gist.github.com/JakeCoxon/c7ebf6e6496f8468226fd36b596e1985 + */ +export const useStableCallback = callback => { + const callbackRef = useRef(); + const memoCallback = useCallback((...args) => callbackRef.current && callbackRef.current(...args), []); + useEffect(() => { + callbackRef.current = callback; + return () => callbackRef.current = undefined; + }); + return memoCallback; +}; +//# sourceMappingURL=useStableCallback.js.map \ No newline at end of file diff --git a/lib/module/hooks/useStableCallback.js.map b/lib/module/hooks/useStableCallback.js.map new file mode 100644 index 000000000..d6fb52e72 --- /dev/null +++ b/lib/module/hooks/useStableCallback.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["useStableCallback.ts"],"names":["useRef","useCallback","useEffect","useStableCallback","callback","callbackRef","memoCallback","args","current","undefined"],"mappings":"AAAA,SAASA,MAAT,EAAiBC,WAAjB,EAA8BC,SAA9B,QAA+C,OAA/C;;AAGA;AACA;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,GAAIC,QAAD,IAAwB;AACvD,QAAMC,WAAW,GAAGL,MAAM,EAA1B;AACA,QAAMM,YAAY,GAAGL,WAAW,CAC9B,CAAC,GAAGM,IAAJ,KAAkBF,WAAW,CAACG,OAAZ,IAAuBH,WAAW,CAACG,OAAZ,CAAoB,GAAGD,IAAvB,CADX,EAE9B,EAF8B,CAAhC;AAIAL,EAAAA,SAAS,CAAC,MAAM;AACdG,IAAAA,WAAW,CAACG,OAAZ,GAAsBJ,QAAtB;AACA,WAAO,MAAOC,WAAW,CAACG,OAAZ,GAAsBC,SAApC;AACD,GAHQ,CAAT;AAIA,SAAOH,YAAP;AACD,CAXM","sourcesContent":["import { useRef, useCallback, useEffect } from 'react';\n\ntype Callback = (...args: any[]) => any;\n/**\n * Provide a stable version of useCallback\n * https://gist.github.com/JakeCoxon/c7ebf6e6496f8468226fd36b596e1985\n */\nexport const useStableCallback = (callback: Callback) => {\n const callbackRef = useRef();\n const memoCallback = useCallback(\n (...args: any) => callbackRef.current && callbackRef.current(...args),\n []\n );\n useEffect(() => {\n callbackRef.current = callback;\n return () => (callbackRef.current = undefined);\n });\n return memoCallback;\n};\n"]} \ No newline at end of file diff --git a/lib/module/index.js b/lib/module/index.js new file mode 100644 index 000000000..906885637 --- /dev/null +++ b/lib/module/index.js @@ -0,0 +1,44 @@ +// bottom sheet +export { default } from './components/bottomSheet'; // bottom sheet modal + +export { default as BottomSheetModal } from './components/bottomSheetModal'; +export { default as BottomSheetModalProvider } from './components/bottomSheetModalProvider'; //#region hooks + +export { useBottomSheet } from './hooks/useBottomSheet'; +export { useBottomSheetModal } from './hooks/useBottomSheetModal'; +export { useBottomSheetSpringConfigs } from './hooks/useBottomSheetSpringConfigs'; +export { useBottomSheetTimingConfigs } from './hooks/useBottomSheetTimingConfigs'; +export { useBottomSheetInternal } from './hooks/useBottomSheetInternal'; +export { useBottomSheetModalInternal } from './hooks/useBottomSheetModalInternal'; +export { useBottomSheetDynamicSnapPoints } from './hooks/useBottomSheetDynamicSnapPoints'; +export { useScrollEventsHandlersDefault } from './hooks/useScrollEventsHandlersDefault'; +export { useGestureEventsHandlersDefault } from './hooks/useGestureEventsHandlersDefault'; +export { useBottomSheetGestureHandlers } from './hooks/useBottomSheetGestureHandlers'; +export { useScrollHandler } from './hooks/useScrollHandler'; +export { useScrollableSetter } from './hooks/useScrollableSetter'; //#endregion +//#region components + +export { BottomSheetScrollView, BottomSheetSectionList, BottomSheetFlatList, BottomSheetVirtualizedList } from './components/bottomSheetScrollable'; +export { default as BottomSheetHandle } from './components/bottomSheetHandle'; +export { default as BottomSheetDraggableView } from './components/bottomSheetDraggableView'; +export { default as BottomSheetView } from './components/bottomSheetView'; +export { default as BottomSheetTextInput } from './components/bottomSheetTextInput'; +export { default as BottomSheetBackdrop } from './components/bottomSheetBackdrop'; +export { default as BottomSheetFooter } from './components/bottomSheetFooter'; +export { default as BottomSheetFooterContainer } from './components/bottomSheetFooterContainer/BottomSheetFooterContainer'; // touchables + +import BottomSheetTouchable from './components/touchables'; +export const { + TouchableHighlight, + TouchableOpacity, + TouchableWithoutFeedback +} = BottomSheetTouchable; // utils + +export { createBottomSheetScrollableComponent } from './components/bottomSheetScrollable'; //#endregion +//#region types + +//#endregion +//#region utilities +export * from './constants'; +export { enableLogging } from './utilities/logger'; //#endregion +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/index.js.map b/lib/module/index.js.map new file mode 100644 index 000000000..8d6162efb --- /dev/null +++ b/lib/module/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":["default","BottomSheetModal","BottomSheetModalProvider","useBottomSheet","useBottomSheetModal","useBottomSheetSpringConfigs","useBottomSheetTimingConfigs","useBottomSheetInternal","useBottomSheetModalInternal","useBottomSheetDynamicSnapPoints","useScrollEventsHandlersDefault","useGestureEventsHandlersDefault","useBottomSheetGestureHandlers","useScrollHandler","useScrollableSetter","BottomSheetScrollView","BottomSheetSectionList","BottomSheetFlatList","BottomSheetVirtualizedList","BottomSheetHandle","BottomSheetDraggableView","BottomSheetView","BottomSheetTextInput","BottomSheetBackdrop","BottomSheetFooter","BottomSheetFooterContainer","BottomSheetTouchable","TouchableHighlight","TouchableOpacity","TouchableWithoutFeedback","createBottomSheetScrollableComponent","enableLogging"],"mappings":"AAAA;AACA,SAASA,OAAT,QAAwB,0BAAxB,C,CAEA;;AACA,SAASA,OAAO,IAAIC,gBAApB,QAA4C,+BAA5C;AACA,SAASD,OAAO,IAAIE,wBAApB,QAAoD,uCAApD,C,CAEA;;AACA,SAASC,cAAT,QAA+B,wBAA/B;AACA,SAASC,mBAAT,QAAoC,6BAApC;AACA,SAASC,2BAAT,QAA4C,qCAA5C;AACA,SAASC,2BAAT,QAA4C,qCAA5C;AACA,SAASC,sBAAT,QAAuC,gCAAvC;AACA,SAASC,2BAAT,QAA4C,qCAA5C;AACA,SAASC,+BAAT,QAAgD,yCAAhD;AACA,SAASC,8BAAT,QAA+C,wCAA/C;AACA,SAASC,+BAAT,QAAgD,yCAAhD;AACA,SAASC,6BAAT,QAA8C,uCAA9C;AACA,SAASC,gBAAT,QAAiC,0BAAjC;AACA,SAASC,mBAAT,QAAoC,6BAApC,C,CACA;AAEA;;AACA,SACEC,qBADF,EAEEC,sBAFF,EAGEC,mBAHF,EAIEC,0BAJF,QAKO,oCALP;AAMA,SAASlB,OAAO,IAAImB,iBAApB,QAA6C,gCAA7C;AACA,SAASnB,OAAO,IAAIoB,wBAApB,QAAoD,uCAApD;AACA,SAASpB,OAAO,IAAIqB,eAApB,QAA2C,8BAA3C;AACA,SAASrB,OAAO,IAAIsB,oBAApB,QAAgD,mCAAhD;AACA,SAAStB,OAAO,IAAIuB,mBAApB,QAA+C,kCAA/C;AACA,SAASvB,OAAO,IAAIwB,iBAApB,QAA6C,gCAA7C;AACA,SAASxB,OAAO,IAAIyB,0BAApB,QAAsD,oEAAtD,C,CAEA;;AACA,OAAOC,oBAAP,MAAiC,yBAAjC;AACA,OAAO,MAAM;AACXC,EAAAA,kBADW;AAEXC,EAAAA,gBAFW;AAGXC,EAAAA;AAHW,IAITH,oBAJG,C,CAKP;;AACA,SAASI,oCAAT,QAAqD,oCAArD,C,CACA;AAEA;;AAsBA;AAEA;AACA,cAAc,aAAd;AACA,SAASC,aAAT,QAA8B,oBAA9B,C,CACA","sourcesContent":["// bottom sheet\nexport { default } from './components/bottomSheet';\n\n// bottom sheet modal\nexport { default as BottomSheetModal } from './components/bottomSheetModal';\nexport { default as BottomSheetModalProvider } from './components/bottomSheetModalProvider';\n\n//#region hooks\nexport { useBottomSheet } from './hooks/useBottomSheet';\nexport { useBottomSheetModal } from './hooks/useBottomSheetModal';\nexport { useBottomSheetSpringConfigs } from './hooks/useBottomSheetSpringConfigs';\nexport { useBottomSheetTimingConfigs } from './hooks/useBottomSheetTimingConfigs';\nexport { useBottomSheetInternal } from './hooks/useBottomSheetInternal';\nexport { useBottomSheetModalInternal } from './hooks/useBottomSheetModalInternal';\nexport { useBottomSheetDynamicSnapPoints } from './hooks/useBottomSheetDynamicSnapPoints';\nexport { useScrollEventsHandlersDefault } from './hooks/useScrollEventsHandlersDefault';\nexport { useGestureEventsHandlersDefault } from './hooks/useGestureEventsHandlersDefault';\nexport { useBottomSheetGestureHandlers } from './hooks/useBottomSheetGestureHandlers';\nexport { useScrollHandler } from './hooks/useScrollHandler';\nexport { useScrollableSetter } from './hooks/useScrollableSetter';\n//#endregion\n\n//#region components\nexport {\n BottomSheetScrollView,\n BottomSheetSectionList,\n BottomSheetFlatList,\n BottomSheetVirtualizedList,\n} from './components/bottomSheetScrollable';\nexport { default as BottomSheetHandle } from './components/bottomSheetHandle';\nexport { default as BottomSheetDraggableView } from './components/bottomSheetDraggableView';\nexport { default as BottomSheetView } from './components/bottomSheetView';\nexport { default as BottomSheetTextInput } from './components/bottomSheetTextInput';\nexport { default as BottomSheetBackdrop } from './components/bottomSheetBackdrop';\nexport { default as BottomSheetFooter } from './components/bottomSheetFooter';\nexport { default as BottomSheetFooterContainer } from './components/bottomSheetFooterContainer/BottomSheetFooterContainer';\n\n// touchables\nimport BottomSheetTouchable from './components/touchables';\nexport const {\n TouchableHighlight,\n TouchableOpacity,\n TouchableWithoutFeedback,\n} = BottomSheetTouchable;\n// utils\nexport { createBottomSheetScrollableComponent } from './components/bottomSheetScrollable';\n//#endregion\n\n//#region types\nexport type { BottomSheetProps } from './components/bottomSheet';\nexport type { BottomSheetModalProps } from './components/bottomSheetModal';\nexport type { BottomSheetHandleProps } from './components/bottomSheetHandle';\nexport type { BottomSheetBackgroundProps } from './components/bottomSheetBackground';\nexport type { BottomSheetBackdropProps } from './components/bottomSheetBackdrop';\nexport type { BottomSheetFooterProps } from './components/bottomSheetFooter';\n\nexport type {\n BottomSheetFlatListMethods,\n BottomSheetScrollViewMethods,\n BottomSheetSectionListMethods,\n BottomSheetVirtualizedListMethods,\n BottomSheetScrollableProps,\n} from './components/bottomSheetScrollable';\n\nexport type {\n ScrollEventsHandlersHookType,\n GestureEventsHandlersHookType,\n ScrollEventHandlerCallbackType,\n GestureEventHandlerCallbackType,\n} from './types';\n//#endregion\n\n//#region utilities\nexport * from './constants';\nexport { enableLogging } from './utilities/logger';\n//#endregion\n"]} \ No newline at end of file diff --git a/lib/module/utilities/animate.js b/lib/module/utilities/animate.js new file mode 100644 index 000000000..a22725abc --- /dev/null +++ b/lib/module/utilities/animate.js @@ -0,0 +1,26 @@ +import { withTiming, withSpring } from 'react-native-reanimated'; +import { ANIMATION_CONFIGS, ANIMATION_METHOD } from '../constants'; +export const animate = ({ + point, + configs = undefined, + velocity = 0, + onComplete +}) => { + 'worklet'; + + if (!configs) { + configs = ANIMATION_CONFIGS; + } // detect animation type + + + const type = 'duration' in configs || 'easing' in configs ? ANIMATION_METHOD.TIMING : ANIMATION_METHOD.SPRING; + + if (type === ANIMATION_METHOD.TIMING) { + return withTiming(point, configs, onComplete); + } else { + return withSpring(point, Object.assign({ + velocity + }, configs), onComplete); + } +}; +//# sourceMappingURL=animate.js.map \ No newline at end of file diff --git a/lib/module/utilities/animate.js.map b/lib/module/utilities/animate.js.map new file mode 100644 index 000000000..5ec06f0dc --- /dev/null +++ b/lib/module/utilities/animate.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["animate.ts"],"names":["withTiming","withSpring","ANIMATION_CONFIGS","ANIMATION_METHOD","animate","point","configs","undefined","velocity","onComplete","type","TIMING","SPRING","Object","assign"],"mappings":"AAAA,SAGEA,UAHF,EAIEC,UAJF,QAMO,yBANP;AAOA,SAASC,iBAAT,EAA4BC,gBAA5B,QAAoD,cAApD;AASA,OAAO,MAAMC,OAAO,GAAG,CAAC;AACtBC,EAAAA,KADsB;AAEtBC,EAAAA,OAAO,GAAGC,SAFY;AAGtBC,EAAAA,QAAQ,GAAG,CAHW;AAItBC,EAAAA;AAJsB,CAAD,KAKF;AACnB;;AAEA,MAAI,CAACH,OAAL,EAAc;AACZA,IAAAA,OAAO,GAAGJ,iBAAV;AACD,GALkB,CAOnB;;;AACA,QAAMQ,IAAI,GACR,cAAcJ,OAAd,IAAyB,YAAYA,OAArC,GACIH,gBAAgB,CAACQ,MADrB,GAEIR,gBAAgB,CAACS,MAHvB;;AAKA,MAAIF,IAAI,KAAKP,gBAAgB,CAACQ,MAA9B,EAAsC;AACpC,WAAOX,UAAU,CAACK,KAAD,EAAQC,OAAR,EAAqCG,UAArC,CAAjB;AACD,GAFD,MAEO;AACL,WAAOR,UAAU,CACfI,KADe,EAEfQ,MAAM,CAACC,MAAP,CAAc;AAAEN,MAAAA;AAAF,KAAd,EAA4BF,OAA5B,CAFe,EAGfG,UAHe,CAAjB;AAKD;AACF,CA3BM","sourcesContent":["import {\n WithSpringConfig,\n WithTimingConfig,\n withTiming,\n withSpring,\n AnimationCallback,\n} from 'react-native-reanimated';\nimport { ANIMATION_CONFIGS, ANIMATION_METHOD } from '../constants';\n\ninterface AnimateParams {\n point: number;\n velocity?: number;\n configs?: WithSpringConfig | WithTimingConfig;\n onComplete?: AnimationCallback;\n}\n\nexport const animate = ({\n point,\n configs = undefined,\n velocity = 0,\n onComplete,\n}: AnimateParams) => {\n 'worklet';\n\n if (!configs) {\n configs = ANIMATION_CONFIGS;\n }\n\n // detect animation type\n const type =\n 'duration' in configs || 'easing' in configs\n ? ANIMATION_METHOD.TIMING\n : ANIMATION_METHOD.SPRING;\n\n if (type === ANIMATION_METHOD.TIMING) {\n return withTiming(point, configs as WithTimingConfig, onComplete);\n } else {\n return withSpring(\n point,\n Object.assign({ velocity }, configs) as WithSpringConfig,\n onComplete\n );\n }\n};\n"]} \ No newline at end of file diff --git a/lib/module/utilities/clamp.js b/lib/module/utilities/clamp.js new file mode 100644 index 000000000..2f84379b9 --- /dev/null +++ b/lib/module/utilities/clamp.js @@ -0,0 +1,6 @@ +export const clamp = (value, lowerBound, upperBound) => { + 'worklet'; + + return Math.min(Math.max(lowerBound, value), upperBound); +}; +//# sourceMappingURL=clamp.js.map \ No newline at end of file diff --git a/lib/module/utilities/clamp.js.map b/lib/module/utilities/clamp.js.map new file mode 100644 index 000000000..011f6f24f --- /dev/null +++ b/lib/module/utilities/clamp.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["clamp.ts"],"names":["clamp","value","lowerBound","upperBound","Math","min","max"],"mappings":"AAAA,OAAO,MAAMA,KAAK,GAAG,CACnBC,KADmB,EAEnBC,UAFmB,EAGnBC,UAHmB,KAIhB;AACH;;AACA,SAAOC,IAAI,CAACC,GAAL,CAASD,IAAI,CAACE,GAAL,CAASJ,UAAT,EAAqBD,KAArB,CAAT,EAAsCE,UAAtC,CAAP;AACD,CAPM","sourcesContent":["export const clamp = (\n value: number,\n lowerBound: number,\n upperBound: number\n) => {\n 'worklet';\n return Math.min(Math.max(lowerBound, value), upperBound);\n};\n"]} \ No newline at end of file diff --git a/lib/module/utilities/easingExp.js b/lib/module/utilities/easingExp.js new file mode 100644 index 000000000..e4e3eb8b3 --- /dev/null +++ b/lib/module/utilities/easingExp.js @@ -0,0 +1,12 @@ +/** + * A modified version of the default AnimatedEasing.exp, + * to insure its value never goes below `0`. + * @see https://github.com/software-mansion/react-native-reanimated/issues/1610 + * @param t number + */ +export const exp = t => { + 'worklet'; + + return Math.min(Math.max(0, Math.pow(2, 10 * (t - 1))), 1); +}; +//# sourceMappingURL=easingExp.js.map \ No newline at end of file diff --git a/lib/module/utilities/easingExp.js.map b/lib/module/utilities/easingExp.js.map new file mode 100644 index 000000000..143baa079 --- /dev/null +++ b/lib/module/utilities/easingExp.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["easingExp.ts"],"names":["exp","t","Math","min","max","pow"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,GAAG,GAAIC,CAAD,IAAe;AAChC;;AACA,SAAOC,IAAI,CAACC,GAAL,CAASD,IAAI,CAACE,GAAL,CAAS,CAAT,EAAYF,IAAI,CAACG,GAAL,CAAS,CAAT,EAAY,MAAMJ,CAAC,GAAG,CAAV,CAAZ,CAAZ,CAAT,EAAiD,CAAjD,CAAP;AACD,CAHM","sourcesContent":["/**\n * A modified version of the default AnimatedEasing.exp,\n * to insure its value never goes below `0`.\n * @see https://github.com/software-mansion/react-native-reanimated/issues/1610\n * @param t number\n */\nexport const exp = (t: number) => {\n 'worklet';\n return Math.min(Math.max(0, Math.pow(2, 10 * (t - 1))), 1);\n};\n"]} \ No newline at end of file diff --git a/lib/module/utilities/getKeyboardAnimationConfigs.js b/lib/module/utilities/getKeyboardAnimationConfigs.js new file mode 100644 index 000000000..dfac85c3a --- /dev/null +++ b/lib/module/utilities/getKeyboardAnimationConfigs.js @@ -0,0 +1,41 @@ +import { Easing } from 'react-native-reanimated'; +export const getKeyboardAnimationConfigs = (easing, duration) => { + 'worklet'; + + switch (easing) { + case 'easeIn': + return { + easing: Easing.in(Easing.ease), + duration + }; + + case 'easeOut': + return { + easing: Easing.out(Easing.ease), + duration + }; + + case 'easeInEaseOut': + return { + easing: Easing.inOut(Easing.ease), + duration + }; + + case 'linear': + return { + easing: Easing.linear, + duration + }; + + case 'keyboard': + return { + damping: 500, + stiffness: 1000, + mass: 3, + overshootClamping: true, + restDisplacementThreshold: 10, + restSpeedThreshold: 10 + }; + } +}; +//# sourceMappingURL=getKeyboardAnimationConfigs.js.map \ No newline at end of file diff --git a/lib/module/utilities/getKeyboardAnimationConfigs.js.map b/lib/module/utilities/getKeyboardAnimationConfigs.js.map new file mode 100644 index 000000000..2a1a9cf66 --- /dev/null +++ b/lib/module/utilities/getKeyboardAnimationConfigs.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["getKeyboardAnimationConfigs.ts"],"names":["Easing","getKeyboardAnimationConfigs","easing","duration","in","ease","out","inOut","linear","damping","stiffness","mass","overshootClamping","restDisplacementThreshold","restSpeedThreshold"],"mappings":"AAAA,SAASA,MAAT,QAAuB,yBAAvB;AAGA,OAAO,MAAMC,2BAA2B,GAAG,CACzCC,MADyC,EAEzCC,QAFyC,KAGtC;AACH;;AACA,UAAQD,MAAR;AACE,SAAK,QAAL;AACE,aAAO;AACLA,QAAAA,MAAM,EAAEF,MAAM,CAACI,EAAP,CAAUJ,MAAM,CAACK,IAAjB,CADH;AAELF,QAAAA;AAFK,OAAP;;AAKF,SAAK,SAAL;AACE,aAAO;AACLD,QAAAA,MAAM,EAAEF,MAAM,CAACM,GAAP,CAAWN,MAAM,CAACK,IAAlB,CADH;AAELF,QAAAA;AAFK,OAAP;;AAKF,SAAK,eAAL;AACE,aAAO;AACLD,QAAAA,MAAM,EAAEF,MAAM,CAACO,KAAP,CAAaP,MAAM,CAACK,IAApB,CADH;AAELF,QAAAA;AAFK,OAAP;;AAKF,SAAK,QAAL;AACE,aAAO;AACLD,QAAAA,MAAM,EAAEF,MAAM,CAACQ,MADV;AAELL,QAAAA;AAFK,OAAP;;AAKF,SAAK,UAAL;AACE,aAAO;AACLM,QAAAA,OAAO,EAAE,GADJ;AAELC,QAAAA,SAAS,EAAE,IAFN;AAGLC,QAAAA,IAAI,EAAE,CAHD;AAILC,QAAAA,iBAAiB,EAAE,IAJd;AAKLC,QAAAA,yBAAyB,EAAE,EALtB;AAMLC,QAAAA,kBAAkB,EAAE;AANf,OAAP;AA1BJ;AAmCD,CAxCM","sourcesContent":["import { Easing } from 'react-native-reanimated';\nimport type { KeyboardEventEasing } from 'react-native';\n\nexport const getKeyboardAnimationConfigs = (\n easing: KeyboardEventEasing,\n duration: number\n) => {\n 'worklet';\n switch (easing) {\n case 'easeIn':\n return {\n easing: Easing.in(Easing.ease),\n duration,\n };\n\n case 'easeOut':\n return {\n easing: Easing.out(Easing.ease),\n duration,\n };\n\n case 'easeInEaseOut':\n return {\n easing: Easing.inOut(Easing.ease),\n duration,\n };\n\n case 'linear':\n return {\n easing: Easing.linear,\n duration,\n };\n\n case 'keyboard':\n return {\n damping: 500,\n stiffness: 1000,\n mass: 3,\n overshootClamping: true,\n restDisplacementThreshold: 10,\n restSpeedThreshold: 10,\n };\n }\n};\n"]} \ No newline at end of file diff --git a/lib/module/utilities/getRefNativeTag.js b/lib/module/utilities/getRefNativeTag.js new file mode 100644 index 000000000..5f30f74da --- /dev/null +++ b/lib/module/utilities/getRefNativeTag.js @@ -0,0 +1,38 @@ +const isFunction = ref => typeof ref === 'function'; + +const hasNativeTag = ref => !!ref && typeof ref === 'object' && 'current' in (ref || {}) && '_nativeTag' in ((ref === null || ref === void 0 ? void 0 : ref.current) || {}); +/* + * getRefNativeTag is an internal utility used by createBottomSheetScrollableComponent + * to grab the native tag from the native host component. It only works when the ref + * is pointing to a native Host component. + * + * Internally in the bottom-sheet library ref can be a function that returns a native tag + * this seems to happen due to the usage of Reanimated's animated scroll components. + * + * This should be Fabric compatible as long as the ref is a native host component. + * */ + + +export function getRefNativeTag(ref) { + const refType = typeof ref; + let nativeTag; + + if (isFunction(ref)) { + nativeTag = ref(); + } else if (hasNativeTag(ref)) { + nativeTag = ref.current._nativeTag; + } + + if (!nativeTag || typeof nativeTag !== 'number') { + throw new Error(`Unexpected nativeTag: ${refType}; nativeTag=${nativeTag} + + createBottomSheetScrollableComponent's ScrollableComponent needs to return + a reference that contains a nativeTag to a Native HostComponent. + + ref=${ref} + `); + } + + return nativeTag; +} +//# sourceMappingURL=getRefNativeTag.js.map \ No newline at end of file diff --git a/lib/module/utilities/getRefNativeTag.js.map b/lib/module/utilities/getRefNativeTag.js.map new file mode 100644 index 000000000..c8d36c976 --- /dev/null +++ b/lib/module/utilities/getRefNativeTag.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["getRefNativeTag.ts"],"names":["isFunction","ref","hasNativeTag","current","getRefNativeTag","refType","nativeTag","_nativeTag","Error"],"mappings":"AAAA,MAAMA,UAAU,GAAIC,GAAD,IAAmC,OAAOA,GAAP,KAAe,UAArE;;AAEA,MAAMC,YAAY,GAChBD,GADmB,IAGnB,CAAC,CAACA,GAAF,IACA,OAAOA,GAAP,KAAe,QADf,IAEA,cAAcA,GAAG,IAAI,EAArB,CAFA,IAGA,iBAAiB,CAACA,GAAD,aAACA,GAAD,uBAACA,GAAD,CAAcE,OAAd,KAAyB,EAA1C,CANF;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,SAASC,eAAT,CAAyBH,GAAzB,EAAuC;AAC5C,QAAMI,OAAO,GAAG,OAAOJ,GAAvB;AACA,MAAIK,SAAJ;;AACA,MAAIN,UAAU,CAACC,GAAD,CAAd,EAAqB;AACnBK,IAAAA,SAAS,GAAGL,GAAG,EAAf;AACD,GAFD,MAEO,IAAIC,YAAY,CAACD,GAAD,CAAhB,EAAuB;AAC5BK,IAAAA,SAAS,GAAGL,GAAG,CAACE,OAAJ,CAAYI,UAAxB;AACD;;AAED,MAAI,CAACD,SAAD,IAAc,OAAOA,SAAP,KAAqB,QAAvC,EAAiD;AAC/C,UAAM,IAAIE,KAAJ,CACH,yBAAwBH,OAAQ,eAAcC,SAAU;AAC/D;AACA;AACA;AACA;AACA,SAASL,GAAI;AACb,IAPU,CAAN;AASD;;AAED,SAAOK,SAAP;AACD","sourcesContent":["const isFunction = (ref: unknown): ref is Function => typeof ref === 'function';\n\nconst hasNativeTag = (\n ref: unknown\n): ref is { current: { _nativeTag: number } } =>\n !!ref &&\n typeof ref === 'object' &&\n 'current' in (ref || {}) &&\n '_nativeTag' in ((ref as any)?.current || {});\n\n/*\n * getRefNativeTag is an internal utility used by createBottomSheetScrollableComponent\n * to grab the native tag from the native host component. It only works when the ref\n * is pointing to a native Host component.\n *\n * Internally in the bottom-sheet library ref can be a function that returns a native tag\n * this seems to happen due to the usage of Reanimated's animated scroll components.\n *\n * This should be Fabric compatible as long as the ref is a native host component.\n * */\nexport function getRefNativeTag(ref: unknown) {\n const refType = typeof ref;\n let nativeTag: undefined | number;\n if (isFunction(ref)) {\n nativeTag = ref();\n } else if (hasNativeTag(ref)) {\n nativeTag = ref.current._nativeTag;\n }\n\n if (!nativeTag || typeof nativeTag !== 'number') {\n throw new Error(\n `Unexpected nativeTag: ${refType}; nativeTag=${nativeTag} \n\n\t\t\tcreateBottomSheetScrollableComponent's ScrollableComponent needs to return \n\t\t\ta reference that contains a nativeTag to a Native HostComponent.\n\n\t\t\tref=${ref}\n\t\t\t`\n );\n }\n\n return nativeTag;\n}\n"]} \ No newline at end of file diff --git a/lib/module/utilities/id.js b/lib/module/utilities/id.js new file mode 100644 index 000000000..ed49b21ad --- /dev/null +++ b/lib/module/utilities/id.js @@ -0,0 +1,6 @@ +let current = 0; +export const id = () => { + current = (current + 1) % Number.MAX_SAFE_INTEGER; + return current; +}; +//# sourceMappingURL=id.js.map \ No newline at end of file diff --git a/lib/module/utilities/id.js.map b/lib/module/utilities/id.js.map new file mode 100644 index 000000000..9f76b77c6 --- /dev/null +++ b/lib/module/utilities/id.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["id.ts"],"names":["current","id","Number","MAX_SAFE_INTEGER"],"mappings":"AAAA,IAAIA,OAAO,GAAG,CAAd;AAEA,OAAO,MAAMC,EAAE,GAAG,MAAM;AACtBD,EAAAA,OAAO,GAAG,CAACA,OAAO,GAAG,CAAX,IAAgBE,MAAM,CAACC,gBAAjC;AACA,SAAOH,OAAP;AACD,CAHM","sourcesContent":["let current = 0;\n\nexport const id = () => {\n current = (current + 1) % Number.MAX_SAFE_INTEGER;\n return current;\n};\n"]} \ No newline at end of file diff --git a/lib/module/utilities/index.js b/lib/module/utilities/index.js new file mode 100644 index 000000000..59c1d6261 --- /dev/null +++ b/lib/module/utilities/index.js @@ -0,0 +1,6 @@ +export { normalizeSnapPoint } from './normalizeSnapPoint'; +export { animate } from './animate'; +export { getKeyboardAnimationConfigs } from './getKeyboardAnimationConfigs'; +export { print } from './logger'; +export { noop, workletNoop } from './noop'; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/utilities/index.js.map b/lib/module/utilities/index.js.map new file mode 100644 index 000000000..a8f15bc43 --- /dev/null +++ b/lib/module/utilities/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"names":["normalizeSnapPoint","animate","getKeyboardAnimationConfigs","print","noop","workletNoop"],"mappings":"AAAA,SAASA,kBAAT,QAAmC,sBAAnC;AACA,SAASC,OAAT,QAAwB,WAAxB;AACA,SAASC,2BAAT,QAA4C,+BAA5C;AACA,SAASC,KAAT,QAAsB,UAAtB;AACA,SAASC,IAAT,EAAeC,WAAf,QAAkC,QAAlC","sourcesContent":["export { normalizeSnapPoint } from './normalizeSnapPoint';\nexport { animate } from './animate';\nexport { getKeyboardAnimationConfigs } from './getKeyboardAnimationConfigs';\nexport { print } from './logger';\nexport { noop, workletNoop } from './noop';\n"]} \ No newline at end of file diff --git a/lib/module/utilities/logger.js b/lib/module/utilities/logger.js new file mode 100644 index 000000000..94647a6aa --- /dev/null +++ b/lib/module/utilities/logger.js @@ -0,0 +1,39 @@ +let isLoggingEnabled = false; + +const enableLogging = () => { + if (!__DEV__) { + console.warn('[BottomSheet] could not enable logging on production!'); + return; + } + + isLoggingEnabled = true; +}; + +let print = () => {}; + +if (__DEV__) { + print = ({ + component, + method, + params + }) => { + if (!isLoggingEnabled) { + return; + } + + let message = ''; + + if (typeof params === 'object') { + message = Object.keys(params).map(key => `${key}:${params[key]}`).join(' '); + } else { + message = `${params !== null && params !== void 0 ? params : ''}`; + } // eslint-disable-next-line no-console + + + console.log(`[${[component, method].filter(Boolean).join('::')}]`, message); + }; +} + +Object.freeze(print); +export { print, enableLogging }; +//# sourceMappingURL=logger.js.map \ No newline at end of file diff --git a/lib/module/utilities/logger.js.map b/lib/module/utilities/logger.js.map new file mode 100644 index 000000000..8348b94e2 --- /dev/null +++ b/lib/module/utilities/logger.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["logger.ts"],"names":["isLoggingEnabled","enableLogging","__DEV__","console","warn","print","component","method","params","message","Object","keys","map","key","join","log","filter","Boolean","freeze"],"mappings":"AAQA,IAAIA,gBAAgB,GAAG,KAAvB;;AAEA,MAAMC,aAAa,GAAG,MAAM;AAC1B,MAAI,CAACC,OAAL,EAAc;AACZC,IAAAA,OAAO,CAACC,IAAR,CAAa,uDAAb;AACA;AACD;;AACDJ,EAAAA,gBAAgB,GAAG,IAAnB;AACD,CAND;;AAQA,IAAIK,KAAY,GAAG,MAAM,CAAE,CAA3B;;AAEA,IAAIH,OAAJ,EAAa;AACXG,EAAAA,KAAK,GAAG,CAAC;AAAEC,IAAAA,SAAF;AAAaC,IAAAA,MAAb;AAAqBC,IAAAA;AAArB,GAAD,KAAmC;AACzC,QAAI,CAACR,gBAAL,EAAuB;AACrB;AACD;;AACD,QAAIS,OAAO,GAAG,EAAd;;AAEA,QAAI,OAAOD,MAAP,KAAkB,QAAtB,EAAgC;AAC9BC,MAAAA,OAAO,GAAGC,MAAM,CAACC,IAAP,CAAYH,MAAZ,EACPI,GADO,CACHC,GAAG,IAAK,GAAEA,GAAI,IAAGL,MAAM,CAACK,GAAD,CAAM,EAD1B,EAEPC,IAFO,CAEF,GAFE,CAAV;AAGD,KAJD,MAIO;AACLL,MAAAA,OAAO,GAAI,GAAED,MAAH,aAAGA,MAAH,cAAGA,MAAH,GAAa,EAAG,EAA1B;AACD,KAZwC,CAazC;;;AACAL,IAAAA,OAAO,CAACY,GAAR,CAAa,IAAG,CAACT,SAAD,EAAYC,MAAZ,EAAoBS,MAApB,CAA2BC,OAA3B,EAAoCH,IAApC,CAAyC,IAAzC,CAA+C,GAA/D,EAAmEL,OAAnE;AACD,GAfD;AAgBD;;AAEDC,MAAM,CAACQ,MAAP,CAAcb,KAAd;AAEA,SAASA,KAAT,EAAgBJ,aAAhB","sourcesContent":["interface PrintOptions {\n component?: string;\n method?: string;\n params?: Record | string | number | boolean;\n}\n\ntype Print = (options: PrintOptions) => void;\n\nlet isLoggingEnabled = false;\n\nconst enableLogging = () => {\n if (!__DEV__) {\n console.warn('[BottomSheet] could not enable logging on production!');\n return;\n }\n isLoggingEnabled = true;\n};\n\nlet print: Print = () => {};\n\nif (__DEV__) {\n print = ({ component, method, params }) => {\n if (!isLoggingEnabled) {\n return;\n }\n let message = '';\n\n if (typeof params === 'object') {\n message = Object.keys(params)\n .map(key => `${key}:${params[key]}`)\n .join(' ');\n } else {\n message = `${params ?? ''}`;\n }\n // eslint-disable-next-line no-console\n console.log(`[${[component, method].filter(Boolean).join('::')}]`, message);\n };\n}\n\nObject.freeze(print);\n\nexport { print, enableLogging };\n"]} \ No newline at end of file diff --git a/lib/module/utilities/noop.js b/lib/module/utilities/noop.js new file mode 100644 index 000000000..b9bcedf3d --- /dev/null +++ b/lib/module/utilities/noop.js @@ -0,0 +1,8 @@ +const workletNoop = () => { + 'worklet'; +}; + +const noop = () => {}; + +export { noop, workletNoop }; +//# sourceMappingURL=noop.js.map \ No newline at end of file diff --git a/lib/module/utilities/noop.js.map b/lib/module/utilities/noop.js.map new file mode 100644 index 000000000..3fa335019 --- /dev/null +++ b/lib/module/utilities/noop.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["noop.ts"],"names":["workletNoop","noop"],"mappings":"AAAA,MAAMA,WAAW,GAAG,MAAM;AACxB;AACD,CAFD;;AAIA,MAAMC,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEA,SAASA,IAAT,EAAeD,WAAf","sourcesContent":["const workletNoop = () => {\n 'worklet';\n};\n\nconst noop = () => {};\n\nexport { noop, workletNoop };\n"]} \ No newline at end of file diff --git a/lib/module/utilities/normalizeSnapPoint.js b/lib/module/utilities/normalizeSnapPoint.js new file mode 100644 index 000000000..64836932f --- /dev/null +++ b/lib/module/utilities/normalizeSnapPoint.js @@ -0,0 +1,15 @@ +/** + * Converts a snap point to fixed numbers. + */ +export const normalizeSnapPoint = (snapPoint, containerHeight) => { + 'worklet'; + + let normalizedSnapPoint = snapPoint; // percentage snap point + + if (typeof normalizedSnapPoint === 'string') { + normalizedSnapPoint = Number(normalizedSnapPoint.split('%')[0]) * containerHeight / 100; + } + + return Math.max(0, containerHeight - normalizedSnapPoint); +}; +//# sourceMappingURL=normalizeSnapPoint.js.map \ No newline at end of file diff --git a/lib/module/utilities/normalizeSnapPoint.js.map b/lib/module/utilities/normalizeSnapPoint.js.map new file mode 100644 index 000000000..3570f6985 --- /dev/null +++ b/lib/module/utilities/normalizeSnapPoint.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["normalizeSnapPoint.ts"],"names":["normalizeSnapPoint","snapPoint","containerHeight","normalizedSnapPoint","Number","split","Math","max"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,MAAMA,kBAAkB,GAAG,CAChCC,SADgC,EAEhCC,eAFgC,KAG7B;AACH;;AACA,MAAIC,mBAAmB,GAAGF,SAA1B,CAFG,CAIH;;AACA,MAAI,OAAOE,mBAAP,KAA+B,QAAnC,EAA6C;AAC3CA,IAAAA,mBAAmB,GAChBC,MAAM,CAACD,mBAAmB,CAACE,KAApB,CAA0B,GAA1B,EAA+B,CAA/B,CAAD,CAAN,GAA4CH,eAA7C,GAAgE,GADlE;AAED;;AACD,SAAOI,IAAI,CAACC,GAAL,CAAS,CAAT,EAAYL,eAAe,GAAGC,mBAA9B,CAAP;AACD,CAbM","sourcesContent":["/**\n * Converts a snap point to fixed numbers.\n */\nexport const normalizeSnapPoint = (\n snapPoint: number | string,\n containerHeight: number\n) => {\n 'worklet';\n let normalizedSnapPoint = snapPoint;\n\n // percentage snap point\n if (typeof normalizedSnapPoint === 'string') {\n normalizedSnapPoint =\n (Number(normalizedSnapPoint.split('%')[0]) * containerHeight) / 100;\n }\n return Math.max(0, containerHeight - normalizedSnapPoint);\n};\n"]} \ No newline at end of file diff --git a/lib/module/utilities/snapPoint.js b/lib/module/utilities/snapPoint.js new file mode 100644 index 000000000..c4c3f1303 --- /dev/null +++ b/lib/module/utilities/snapPoint.js @@ -0,0 +1,9 @@ +export const snapPoint = (value, velocity, points) => { + 'worklet'; + + const point = value + 0.2 * velocity; + const deltas = points.map(p => Math.abs(point - p)); + const minDelta = Math.min.apply(null, deltas); + return points.filter(p => Math.abs(point - p) === minDelta)[0]; +}; +//# sourceMappingURL=snapPoint.js.map \ No newline at end of file diff --git a/lib/module/utilities/snapPoint.js.map b/lib/module/utilities/snapPoint.js.map new file mode 100644 index 000000000..deb7e9f37 --- /dev/null +++ b/lib/module/utilities/snapPoint.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["snapPoint.ts"],"names":["snapPoint","value","velocity","points","point","deltas","map","p","Math","abs","minDelta","min","apply","filter"],"mappings":"AAAA,OAAO,MAAMA,SAAS,GAAG,CACvBC,KADuB,EAEvBC,QAFuB,EAGvBC,MAHuB,KAIZ;AACX;;AACA,QAAMC,KAAK,GAAGH,KAAK,GAAG,MAAMC,QAA5B;AACA,QAAMG,MAAM,GAAGF,MAAM,CAACG,GAAP,CAAWC,CAAC,IAAIC,IAAI,CAACC,GAAL,CAASL,KAAK,GAAGG,CAAjB,CAAhB,CAAf;AACA,QAAMG,QAAQ,GAAGF,IAAI,CAACG,GAAL,CAASC,KAAT,CAAe,IAAf,EAAqBP,MAArB,CAAjB;AACA,SAAOF,MAAM,CAACU,MAAP,CAAcN,CAAC,IAAIC,IAAI,CAACC,GAAL,CAASL,KAAK,GAAGG,CAAjB,MAAwBG,QAA3C,EAAqD,CAArD,CAAP;AACD,CAVM","sourcesContent":["export const snapPoint = (\n value: number,\n velocity: number,\n points: ReadonlyArray\n): number => {\n 'worklet';\n const point = value + 0.2 * velocity;\n const deltas = points.map(p => Math.abs(point - p));\n const minDelta = Math.min.apply(null, deltas);\n return points.filter(p => Math.abs(point - p) === minDelta)[0];\n};\n"]} \ No newline at end of file diff --git a/lib/module/utilities/validateSnapPoint.js b/lib/module/utilities/validateSnapPoint.js new file mode 100644 index 000000000..e06e657e2 --- /dev/null +++ b/lib/module/utilities/validateSnapPoint.js @@ -0,0 +1,7 @@ +import invariant from 'invariant'; +export const validateSnapPoint = snapPoint => { + invariant(typeof snapPoint === 'number' || typeof snapPoint === 'string', `'${snapPoint}' is not a valid snap point! expected types are string or number.`); + invariant(typeof snapPoint === 'number' || typeof snapPoint === 'string' && snapPoint.includes('%'), `'${snapPoint}' is not a valid percentage snap point! expected percentage snap point must include '%'. e.g. '50%'`); + invariant(typeof snapPoint === 'number' || typeof snapPoint === 'string' && Number(snapPoint.split('%')[0]), `'${snapPoint}' is not a valid percentage snap point! expected percentage snap point must be only numbers and '%'. e.g. '50%'`); +}; +//# sourceMappingURL=validateSnapPoint.js.map \ No newline at end of file diff --git a/lib/module/utilities/validateSnapPoint.js.map b/lib/module/utilities/validateSnapPoint.js.map new file mode 100644 index 000000000..14eb4576c --- /dev/null +++ b/lib/module/utilities/validateSnapPoint.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["validateSnapPoint.ts"],"names":["invariant","validateSnapPoint","snapPoint","includes","Number","split"],"mappings":"AAAA,OAAOA,SAAP,MAAsB,WAAtB;AAEA,OAAO,MAAMC,iBAAiB,GAAIC,SAAD,IAAoB;AACnDF,EAAAA,SAAS,CACP,OAAOE,SAAP,KAAqB,QAArB,IAAiC,OAAOA,SAAP,KAAqB,QAD/C,EAEN,IAAGA,SAAU,mEAFP,CAAT;AAKAF,EAAAA,SAAS,CACP,OAAOE,SAAP,KAAqB,QAArB,IACG,OAAOA,SAAP,KAAqB,QAArB,IAAiCA,SAAS,CAACC,QAAV,CAAmB,GAAnB,CAF7B,EAGN,IAAGD,SAAU,qGAHP,CAAT;AAMAF,EAAAA,SAAS,CACP,OAAOE,SAAP,KAAqB,QAArB,IACG,OAAOA,SAAP,KAAqB,QAArB,IAAiCE,MAAM,CAACF,SAAS,CAACG,KAAV,CAAgB,GAAhB,EAAqB,CAArB,CAAD,CAFnC,EAGN,IAAGH,SAAU,iHAHP,CAAT;AAKD,CAjBM","sourcesContent":["import invariant from 'invariant';\n\nexport const validateSnapPoint = (snapPoint: any) => {\n invariant(\n typeof snapPoint === 'number' || typeof snapPoint === 'string',\n `'${snapPoint}' is not a valid snap point! expected types are string or number.`\n );\n\n invariant(\n typeof snapPoint === 'number' ||\n (typeof snapPoint === 'string' && snapPoint.includes('%')),\n `'${snapPoint}' is not a valid percentage snap point! expected percentage snap point must include '%'. e.g. '50%'`\n );\n\n invariant(\n typeof snapPoint === 'number' ||\n (typeof snapPoint === 'string' && Number(snapPoint.split('%')[0])),\n `'${snapPoint}' is not a valid percentage snap point! expected percentage snap point must be only numbers and '%'. e.g. '50%'`\n );\n};\n"]} \ No newline at end of file diff --git a/lib/typescript/components/bottomSheet/BottomSheet.d.ts b/lib/typescript/components/bottomSheet/BottomSheet.d.ts new file mode 100644 index 000000000..f6abd37b8 --- /dev/null +++ b/lib/typescript/components/bottomSheet/BottomSheet.d.ts @@ -0,0 +1,6 @@ +import React from 'react'; +import type { BottomSheetMethods } from '../../types'; +import type { BottomSheetProps } from './types'; +declare type BottomSheet = BottomSheetMethods; +declare const BottomSheet: React.MemoExoticComponent>>; +export default BottomSheet; diff --git a/lib/typescript/components/bottomSheet/constants.d.ts b/lib/typescript/components/bottomSheet/constants.d.ts new file mode 100644 index 000000000..187bc6eeb --- /dev/null +++ b/lib/typescript/components/bottomSheet/constants.d.ts @@ -0,0 +1,23 @@ +declare const DEFAULT_HANDLE_HEIGHT = 24; +declare const DEFAULT_OVER_DRAG_RESISTANCE_FACTOR = 2.5; +declare const DEFAULT_ENABLE_CONTENT_PANNING_GESTURE = true; +declare const DEFAULT_ENABLE_HANDLE_PANNING_GESTURE = true; +declare const DEFAULT_ENABLE_OVER_DRAG = true; +declare const DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE = false; +declare const DEFAULT_ANIMATE_ON_MOUNT = true; +declare const DEFAULT_DYNAMIC_SIZING = false; +declare const DEFAULT_KEYBOARD_BEHAVIOR: "interactive"; +declare const DEFAULT_KEYBOARD_BLUR_BEHAVIOR: "none"; +declare const DEFAULT_KEYBOARD_INPUT_MODE: "adjustPan"; +declare const INITIAL_VALUE: number; +declare const INITIAL_SNAP_POINT = -999; +declare const INITIAL_CONTAINER_HEIGHT = -999; +declare const INITIAL_CONTAINER_OFFSET: { + top: number; + bottom: number; + left: number; + right: number; +}; +declare const INITIAL_HANDLE_HEIGHT = -999; +declare const INITIAL_POSITION: number; +export { DEFAULT_HANDLE_HEIGHT, DEFAULT_OVER_DRAG_RESISTANCE_FACTOR, DEFAULT_ENABLE_CONTENT_PANNING_GESTURE, DEFAULT_ENABLE_HANDLE_PANNING_GESTURE, DEFAULT_ENABLE_OVER_DRAG, DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE, DEFAULT_DYNAMIC_SIZING, DEFAULT_ANIMATE_ON_MOUNT, DEFAULT_KEYBOARD_BEHAVIOR, DEFAULT_KEYBOARD_BLUR_BEHAVIOR, DEFAULT_KEYBOARD_INPUT_MODE, INITIAL_POSITION, INITIAL_CONTAINER_HEIGHT, INITIAL_CONTAINER_OFFSET, INITIAL_HANDLE_HEIGHT, INITIAL_SNAP_POINT, INITIAL_VALUE, }; diff --git a/lib/typescript/components/bottomSheet/index.d.ts b/lib/typescript/components/bottomSheet/index.d.ts new file mode 100644 index 000000000..fce453ad5 --- /dev/null +++ b/lib/typescript/components/bottomSheet/index.d.ts @@ -0,0 +1,2 @@ +export { default } from './BottomSheet'; +export type { BottomSheetProps } from './types'; diff --git a/lib/typescript/components/bottomSheet/styles.d.ts b/lib/typescript/components/bottomSheet/styles.d.ts new file mode 100644 index 000000000..df97caab9 --- /dev/null +++ b/lib/typescript/components/bottomSheet/styles.d.ts @@ -0,0 +1,13 @@ +export declare const styles: { + container: { + flexDirection: "column-reverse"; + position: "absolute"; + top: number; + left: number; + right: number; + }; + contentContainer: {}; + contentMaskContainer: { + overflow: "hidden"; + }; +}; diff --git a/lib/typescript/components/bottomSheet/types.d.ts b/lib/typescript/components/bottomSheet/types.d.ts new file mode 100644 index 000000000..575ca3035 --- /dev/null +++ b/lib/typescript/components/bottomSheet/types.d.ts @@ -0,0 +1,334 @@ +import type React from 'react'; +import type { ViewStyle, Insets, StyleProp } from 'react-native'; +import type { + SharedValue, + AnimateStyle, + WithSpringConfig, + WithTimingConfig, +} from 'react-native-reanimated'; +import type { PanGestureHandlerProps } from 'react-native-gesture-handler'; +import type { BottomSheetHandleProps } from '../bottomSheetHandle'; +import type { BottomSheetBackdropProps } from '../bottomSheetBackdrop'; +import type { BottomSheetBackgroundProps } from '../bottomSheetBackground'; +import type { BottomSheetFooterProps } from '../bottomSheetFooter'; +import type { + ANIMATION_SOURCE, + KEYBOARD_BEHAVIOR, + KEYBOARD_BLUR_BEHAVIOR, + KEYBOARD_INPUT_MODE, +} from '../../constants'; +import type { GestureEventsHandlersHookType } from '../../types'; + +export interface BottomSheetProps + extends BottomSheetAnimationConfigs, + Partial< + Pick< + PanGestureHandlerProps, + | 'activeOffsetY' + | 'activeOffsetX' + | 'failOffsetY' + | 'failOffsetX' + | 'waitFor' + | 'simultaneousHandlers' + > + > { + //#region configuration + /** + * Initial snap point index, provide `-1` to initiate bottom sheet in closed state. + * @type number + * @default 0 + */ + index?: number; + /** + * Points for the bottom sheet to snap to. It accepts array of number, string or mix. + * String values should be a percentage. + * + * ⚠️ This prop is required unless you set `enableDynamicSizing` to `true`. + * @example + * snapPoints={[200, 500]} + * snapPoints={[200, '%50']} + * snapPoints={['%100']} + * @type Array + */ + snapPoints?: + | Array + | SharedValue> + | Readonly<(string | number)[] | SharedValue<(string | number)[]>>; + /** + * Defines how violently sheet has to be stopped while over dragging. + * @type number + * @default 2.5 + */ + overDragResistanceFactor?: number; + /** + * Defines whether the bottom sheet is attached to the bottom or no. + * @type boolean + * @default false + */ + detached?: boolean; + /** + * Enable content panning gesture interaction. + * @type boolean + * @default true + */ + enableContentPanningGesture?: boolean; + /** + * Enable handle panning gesture interaction. + * @type boolean + * @default true + */ + enableHandlePanningGesture?: boolean; + /** + * Enable over drag for the sheet. + * @type boolean + * @default true + */ + enableOverDrag?: boolean; + /** + * Enable pan down gesture to close the sheet. + * @type boolean + * @default false + */ + enablePanDownToClose?: boolean; + /** + * Enable dynamic sizing for content view and scrollable + * content size. + * @type boolean + * @default false + */ + enableDynamicSizing?: boolean; + /** + * To start the sheet closed and snap to initial index when it's mounted. + * @type boolean + * @default true + */ + animateOnMount?: boolean; + //#endregion + + //#region layout + /** + * Handle height helps to calculate the internal container and sheet layouts, + * if `handleComponent` is provided, the library internally will calculate its layout, + * unless `handleHeight` is provided. + * @type number + */ + handleHeight?: number | SharedValue; + /** + * Container height helps to calculate the internal sheet layouts, + * if `containerHeight` not provided, the library internally will calculate it, + * however this will cause an extra re-rendering. + * @type number | SharedValue; + */ + containerHeight?: number | SharedValue; + /** + * Content height helps dynamic snap points calculation. + * @type number | SharedValue; + */ + contentHeight?: number | SharedValue; + /** + * Container offset helps to accurately detect container offsets. + * @type SharedValue; + */ + containerOffset?: SharedValue>; + /** + * Top inset value helps to calculate percentage snap points values, + * usually comes from `@react-navigation/stack` hook `useHeaderHeight` or + * from `react-native-safe-area-context` hook `useSafeArea`. + * @type number + * @default 0 + */ + topInset?: number; + /** + * Bottom inset value helps to calculate percentage snap points values, + * usually comes from `react-native-safe-area-context` hook `useSafeArea`. + * @type number + * @default 0 + */ + bottomInset?: number; + /** + * Max dynamic content size height to limit the bottom sheet height + * from exceeding a provided size. + * @type number + * @default container height + */ + maxDynamicContentSize?: number; + //#endregion + + //#region keyboard + /** + * Defines the keyboard appearance behavior. + * @enum + * - `interactive`: offset the sheet by the size of the keyboard. + * - `extend`: extend the sheet to its maximum snap point. + * - `fillParent`: extend the sheet to fill parent. + * @type `interactive` | `extend` | `fillParent` + * @default interactive + */ + keyboardBehavior?: keyof typeof KEYBOARD_BEHAVIOR; + /** + * Defines the keyboard blur behavior. + * - `none`: do nothing. + * - `restore`: restore sheet position. + */ + keyboardBlurBehavior?: keyof typeof KEYBOARD_BLUR_BEHAVIOR; + /** + * Defines keyboard input mode for Android only. + * @link {https://developer.android.com/guide/topics/manifest/activity-element#wsoft} + * @type `adjustPan` | `adjustResize` + * @default `adjustPan` + */ + android_keyboardInputMode?: keyof typeof KEYBOARD_INPUT_MODE; + + //#endregion + + //#region styles + /** + * View style to be applied to the container. + * @type ViewStyle + * @default undefined + */ + containerStyle?: StyleProp; + /** + * View style to be applied to the sheet container component, + * it also could be an Animated Style. + * @type AnimateStyle + * @default undefined + */ + style?: StyleProp< + AnimateStyle< + Omit< + ViewStyle, + | 'flexDirection' + | 'position' + | 'top' + | 'left' + | 'bottom' + | 'right' + | 'opacity' + | 'transform' + > + > + >; + /** + * View style to be applied to the background component. + * @type ViewStyle + * @default undefined + */ + backgroundStyle?: StyleProp< + Omit + >; + /** + * View style to be applied to the handle component. + * @type ViewStyle + * @default undefined + */ + handleStyle?: StyleProp; + /** + * View style to be applied to the handle indicator component. + * @type ViewStyle + * @default undefined + */ + handleIndicatorStyle?: StyleProp; + //#endregion + + /** + * Custom hook to provide pan gesture events handler, which will allow advance and + * customize handling for pan gesture. + * @warning this is an experimental feature and the hook signature can change without a major version bump. + * @type GestureEventsHandlersHookType + * @default useGestureEventsHandlersDefault + */ + gestureEventsHandlersHook?: GestureEventsHandlersHookType; + + //#region animated nodes + /** + * Animated value to be used as a callback of the position node internally. + * @type SharedValue + */ + animatedPosition?: SharedValue; + /** + * Animated value to be used as a callback for the position index node internally. + * @type SharedValue + */ + animatedIndex?: SharedValue; + //#endregion + + //#region callbacks + /** + * Callback when the sheet position changed to a provided point. + * + * @type (index: number) => void; + */ + onChange?: (index: number) => void; + /** + * Callback when the sheet close. + * + * @type () => void; + */ + onClose?: () => void; + /** + * Callback when the sheet about to animate to a new position. + * + * @type (fromIndex: number, toIndex: number) => void; + */ + onAnimate?: (fromIndex: number, toIndex: number) => void; + //#endregion + + //#region components + /** + * Component to be placed as a sheet handle. + * @see {BottomSheetHandleProps} + * @type React.FC\ + */ + handleComponent?: React.FC | null; + /** + * Component to be placed as a sheet backdrop. + * @see {BottomSheetBackdropProps} + * @type React.FC\ + * @default null + */ + backdropComponent?: React.FC | null; + /** + * Component to be placed as a background. + * @see {BottomSheetBackgroundProps} + * @type React.FC\ + */ + backgroundComponent?: React.FC | null; + /** + * Component to be placed as a footer. + * @see {BottomSheetFooterProps} + * @type React.FC\ + */ + footerComponent?: React.FC; + /** + * A scrollable node or normal view. + * @type (() => React.ReactElement) | React.ReactNode[] | React.ReactNode + */ + children: (() => React.ReactElement) | React.ReactNode[] | React.ReactNode; + //#endregion + + //#region private + /** + * An indicator whether if the sheet running in a modal. + * @type boolean + */ + $modal?: boolean; + //#endregion +} + +export interface BottomSheetAnimationConfigs { + /** + * Animation configs, this could be created by: + * - `useBottomSheetSpringConfigs` + * - `useBottomSheetTimingConfigs` + * @type WithSpringConfig | WithTimingConfig + */ + animationConfigs?: WithSpringConfig | WithTimingConfig; +} + +export type AnimateToPositionType = ( + position: number, + source: ANIMATION_SOURCE, + velocity?: number, + configs?: WithTimingConfig | WithSpringConfig +) => void; diff --git a/lib/typescript/components/bottomSheetBackdrop/BottomSheetBackdrop.d.ts b/lib/typescript/components/bottomSheetBackdrop/BottomSheetBackdrop.d.ts new file mode 100644 index 000000000..cdffb3560 --- /dev/null +++ b/lib/typescript/components/bottomSheetBackdrop/BottomSheetBackdrop.d.ts @@ -0,0 +1,4 @@ +import React from 'react'; +import type { BottomSheetDefaultBackdropProps } from './types'; +declare const BottomSheetBackdrop: React.MemoExoticComponent<({ animatedIndex, opacity: _providedOpacity, appearsOnIndex: _providedAppearsOnIndex, disappearsOnIndex: _providedDisappearsOnIndex, enableTouchThrough: _providedEnableTouchThrough, pressBehavior, onPress, style, children, }: BottomSheetDefaultBackdropProps) => JSX.Element>; +export default BottomSheetBackdrop; diff --git a/lib/typescript/components/bottomSheetBackdrop/constants.d.ts b/lib/typescript/components/bottomSheetBackdrop/constants.d.ts new file mode 100644 index 000000000..607e4f1aa --- /dev/null +++ b/lib/typescript/components/bottomSheetBackdrop/constants.d.ts @@ -0,0 +1,6 @@ +declare const DEFAULT_OPACITY = 0.5; +declare const DEFAULT_APPEARS_ON_INDEX = 1; +declare const DEFAULT_DISAPPEARS_ON_INDEX = 0; +declare const DEFAULT_ENABLE_TOUCH_THROUGH = false; +declare const DEFAULT_PRESS_BEHAVIOR: "close"; +export { DEFAULT_OPACITY, DEFAULT_APPEARS_ON_INDEX, DEFAULT_DISAPPEARS_ON_INDEX, DEFAULT_ENABLE_TOUCH_THROUGH, DEFAULT_PRESS_BEHAVIOR, }; diff --git a/lib/typescript/components/bottomSheetBackdrop/index.d.ts b/lib/typescript/components/bottomSheetBackdrop/index.d.ts new file mode 100644 index 000000000..2ee0ef56c --- /dev/null +++ b/lib/typescript/components/bottomSheetBackdrop/index.d.ts @@ -0,0 +1,2 @@ +export { default } from './BottomSheetBackdrop'; +export type { BottomSheetBackdropProps } from './types'; diff --git a/lib/typescript/components/bottomSheetBackdrop/styles.d.ts b/lib/typescript/components/bottomSheetBackdrop/styles.d.ts new file mode 100644 index 000000000..a015593bd --- /dev/null +++ b/lib/typescript/components/bottomSheetBackdrop/styles.d.ts @@ -0,0 +1,5 @@ +export declare const styles: { + container: { + backgroundColor: string; + }; +}; diff --git a/lib/typescript/components/bottomSheetBackdrop/types.d.ts b/lib/typescript/components/bottomSheetBackdrop/types.d.ts new file mode 100644 index 000000000..6a33b9a73 --- /dev/null +++ b/lib/typescript/components/bottomSheetBackdrop/types.d.ts @@ -0,0 +1,53 @@ +import { ReactNode } from 'react'; +import type { ViewProps } from 'react-native'; +import type { BottomSheetVariables } from '../../types'; + +export interface BottomSheetBackdropProps + extends Pick, + BottomSheetVariables {} + +export type BackdropPressBehavior = 'none' | 'close' | 'collapse' | number; + +export interface BottomSheetDefaultBackdropProps + extends BottomSheetBackdropProps { + /** + * Backdrop opacity. + * @type number + * @default 0.5 + */ + opacity?: number; + /** + * Snap point index when backdrop will appears on. + * @type number + * @default 1 + */ + appearsOnIndex?: number; + /** + * Snap point index when backdrop will disappears on. + * @type number + * @default 0 + */ + disappearsOnIndex?: number; + /** + * Enable touch through backdrop component. + * @type boolean + * @default false + */ + enableTouchThrough?: boolean; + /** + * What should happen when user press backdrop? + * @type BackdropPressBehavior + * @default 'close' + */ + pressBehavior?: BackdropPressBehavior; + + /** + * Function which will be executed on pressing backdrop component + * @type {Function} + */ + onPress?: () => void; + /** + * Child component that will be rendered on backdrop. + */ + children?: ReactNode | ReactNode[]; +} diff --git a/lib/typescript/components/bottomSheetBackdropContainer/BottomSheetBackdropContainer.d.ts b/lib/typescript/components/bottomSheetBackdropContainer/BottomSheetBackdropContainer.d.ts new file mode 100644 index 000000000..649f9b489 --- /dev/null +++ b/lib/typescript/components/bottomSheetBackdropContainer/BottomSheetBackdropContainer.d.ts @@ -0,0 +1,4 @@ +import React from 'react'; +import type { BottomSheetBackdropContainerProps } from './types'; +declare const BottomSheetBackdropContainer: React.MemoExoticComponent<({ animatedIndex, animatedPosition, backdropComponent: BackdropComponent, }: BottomSheetBackdropContainerProps) => JSX.Element | null>; +export default BottomSheetBackdropContainer; diff --git a/lib/typescript/components/bottomSheetBackdropContainer/index.d.ts b/lib/typescript/components/bottomSheetBackdropContainer/index.d.ts new file mode 100644 index 000000000..3db6d12f8 --- /dev/null +++ b/lib/typescript/components/bottomSheetBackdropContainer/index.d.ts @@ -0,0 +1 @@ +export { default } from './BottomSheetBackdropContainer'; diff --git a/lib/typescript/components/bottomSheetBackdropContainer/styles.d.ts b/lib/typescript/components/bottomSheetBackdropContainer/styles.d.ts new file mode 100644 index 000000000..1499ffb3b --- /dev/null +++ b/lib/typescript/components/bottomSheetBackdropContainer/styles.d.ts @@ -0,0 +1,9 @@ +export declare const styles: { + container: { + position: "absolute"; + top: number; + left: number; + right: number; + bottom: number; + }; +}; diff --git a/lib/typescript/components/bottomSheetBackdropContainer/types.d.ts b/lib/typescript/components/bottomSheetBackdropContainer/types.d.ts new file mode 100644 index 000000000..de06232d1 --- /dev/null +++ b/lib/typescript/components/bottomSheetBackdropContainer/types.d.ts @@ -0,0 +1,6 @@ +import type { BottomSheetProps } from '../bottomSheet'; +import type { BottomSheetBackdropProps } from '../bottomSheetBackdrop'; + +export interface BottomSheetBackdropContainerProps + extends Pick, + BottomSheetBackdropProps {} diff --git a/lib/typescript/components/bottomSheetBackground/BottomSheetBackground.d.ts b/lib/typescript/components/bottomSheetBackground/BottomSheetBackground.d.ts new file mode 100644 index 000000000..388ff926c --- /dev/null +++ b/lib/typescript/components/bottomSheetBackground/BottomSheetBackground.d.ts @@ -0,0 +1,4 @@ +import React from 'react'; +import type { BottomSheetBackgroundProps } from './types'; +declare const BottomSheetBackground: React.MemoExoticComponent<({ pointerEvents, style, }: BottomSheetBackgroundProps) => JSX.Element>; +export default BottomSheetBackground; diff --git a/lib/typescript/components/bottomSheetBackground/index.d.ts b/lib/typescript/components/bottomSheetBackground/index.d.ts new file mode 100644 index 000000000..14964f214 --- /dev/null +++ b/lib/typescript/components/bottomSheetBackground/index.d.ts @@ -0,0 +1,2 @@ +export { default } from './BottomSheetBackground'; +export type { BottomSheetBackgroundProps } from './types'; diff --git a/lib/typescript/components/bottomSheetBackground/styles.d.ts b/lib/typescript/components/bottomSheetBackground/styles.d.ts new file mode 100644 index 000000000..5505fe350 --- /dev/null +++ b/lib/typescript/components/bottomSheetBackground/styles.d.ts @@ -0,0 +1,6 @@ +export declare const styles: { + container: { + backgroundColor: string; + borderRadius: number; + }; +}; diff --git a/lib/typescript/components/bottomSheetBackground/types.d.ts b/lib/typescript/components/bottomSheetBackground/types.d.ts new file mode 100644 index 000000000..37d2e20db --- /dev/null +++ b/lib/typescript/components/bottomSheetBackground/types.d.ts @@ -0,0 +1,6 @@ +import type { ViewProps } from 'react-native'; +import type { BottomSheetVariables } from '../../types'; + +export interface BottomSheetBackgroundProps + extends Pick, + BottomSheetVariables {} diff --git a/lib/typescript/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.d.ts b/lib/typescript/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.d.ts new file mode 100644 index 000000000..d01f03343 --- /dev/null +++ b/lib/typescript/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.d.ts @@ -0,0 +1,4 @@ +import React from 'react'; +import type { BottomSheetBackgroundContainerProps } from './types'; +declare const BottomSheetBackgroundContainer: React.MemoExoticComponent<({ animatedIndex, animatedPosition, backgroundComponent: _providedBackgroundComponent, backgroundStyle: _providedBackgroundStyle, }: BottomSheetBackgroundContainerProps) => JSX.Element | null>; +export default BottomSheetBackgroundContainer; diff --git a/lib/typescript/components/bottomSheetBackgroundContainer/index.d.ts b/lib/typescript/components/bottomSheetBackgroundContainer/index.d.ts new file mode 100644 index 000000000..929b5e06f --- /dev/null +++ b/lib/typescript/components/bottomSheetBackgroundContainer/index.d.ts @@ -0,0 +1 @@ +export { default } from './BottomSheetBackgroundContainer'; diff --git a/lib/typescript/components/bottomSheetBackgroundContainer/styles.d.ts b/lib/typescript/components/bottomSheetBackgroundContainer/styles.d.ts new file mode 100644 index 000000000..1499ffb3b --- /dev/null +++ b/lib/typescript/components/bottomSheetBackgroundContainer/styles.d.ts @@ -0,0 +1,9 @@ +export declare const styles: { + container: { + position: "absolute"; + top: number; + left: number; + right: number; + bottom: number; + }; +}; diff --git a/lib/typescript/components/bottomSheetBackgroundContainer/types.d.ts b/lib/typescript/components/bottomSheetBackgroundContainer/types.d.ts new file mode 100644 index 000000000..3b0978311 --- /dev/null +++ b/lib/typescript/components/bottomSheetBackgroundContainer/types.d.ts @@ -0,0 +1,6 @@ +import type { BottomSheetProps } from '../bottomSheet'; +import type { BottomSheetBackgroundProps } from '../bottomSheetBackground'; + +export interface BottomSheetBackgroundContainerProps + extends Pick, + BottomSheetBackgroundProps {} diff --git a/lib/typescript/components/bottomSheetContainer/BottomSheetContainer.d.ts b/lib/typescript/components/bottomSheetContainer/BottomSheetContainer.d.ts new file mode 100644 index 000000000..b12778c29 --- /dev/null +++ b/lib/typescript/components/bottomSheetContainer/BottomSheetContainer.d.ts @@ -0,0 +1,5 @@ +import React from 'react'; +import type { BottomSheetContainerProps } from './types'; +declare function BottomSheetContainerComponent({ containerHeight, containerOffset, topInset, bottomInset, shouldCalculateHeight, detached, style, children, }: BottomSheetContainerProps): JSX.Element; +declare const BottomSheetContainer: React.MemoExoticComponent; +export default BottomSheetContainer; diff --git a/lib/typescript/components/bottomSheetContainer/index.d.ts b/lib/typescript/components/bottomSheetContainer/index.d.ts new file mode 100644 index 000000000..ff4646d1a --- /dev/null +++ b/lib/typescript/components/bottomSheetContainer/index.d.ts @@ -0,0 +1,2 @@ +export { default } from './BottomSheetContainer'; +export type { BottomSheetContainerProps } from './types'; diff --git a/lib/typescript/components/bottomSheetContainer/styles.d.ts b/lib/typescript/components/bottomSheetContainer/styles.d.ts new file mode 100644 index 000000000..428d90e9f --- /dev/null +++ b/lib/typescript/components/bottomSheetContainer/styles.d.ts @@ -0,0 +1,9 @@ +export declare const styles: { + container: { + position: "absolute"; + left: 0; + right: 0; + top: 0; + bottom: 0; + }; +}; diff --git a/lib/typescript/components/bottomSheetContainer/styles.web.d.ts b/lib/typescript/components/bottomSheetContainer/styles.web.d.ts new file mode 100644 index 000000000..206640490 --- /dev/null +++ b/lib/typescript/components/bottomSheetContainer/styles.web.d.ts @@ -0,0 +1,10 @@ +import { StyleSheet } from 'react-native'; +export declare const styles: StyleSheet.NamedStyles | StyleSheet.NamedStyles<{ + container: { + position: "fixed"; + left: number; + right: number; + bottom: number; + top: number; + }; +}>; diff --git a/lib/typescript/components/bottomSheetContainer/types.d.ts b/lib/typescript/components/bottomSheetContainer/types.d.ts new file mode 100644 index 000000000..a2193eddb --- /dev/null +++ b/lib/typescript/components/bottomSheetContainer/types.d.ts @@ -0,0 +1,15 @@ +import type { ReactNode } from 'react'; +import type { Insets, StyleProp, ViewStyle } from 'react-native'; +import type Animated from 'react-native-reanimated'; +import type { BottomSheetProps } from '../bottomSheet/types'; + +export interface BottomSheetContainerProps + extends Partial< + Pick + > { + containerHeight: Animated.SharedValue; + containerOffset: Animated.SharedValue; + shouldCalculateHeight?: boolean; + style?: StyleProp; + children: ReactNode; +} diff --git a/lib/typescript/components/bottomSheetDraggableView/BottomSheetDraggableView.d.ts b/lib/typescript/components/bottomSheetDraggableView/BottomSheetDraggableView.d.ts new file mode 100644 index 000000000..29526753a --- /dev/null +++ b/lib/typescript/components/bottomSheetDraggableView/BottomSheetDraggableView.d.ts @@ -0,0 +1,4 @@ +import React from 'react'; +import type { BottomSheetDraggableViewProps } from './types'; +declare const BottomSheetDraggableView: React.MemoExoticComponent<({ gestureType, nativeGestureRef, refreshControlGestureRef, style, children, ...rest }: BottomSheetDraggableViewProps) => JSX.Element>; +export default BottomSheetDraggableView; diff --git a/lib/typescript/components/bottomSheetDraggableView/index.d.ts b/lib/typescript/components/bottomSheetDraggableView/index.d.ts new file mode 100644 index 000000000..3d86cb044 --- /dev/null +++ b/lib/typescript/components/bottomSheetDraggableView/index.d.ts @@ -0,0 +1 @@ +export { default } from './BottomSheetDraggableView'; diff --git a/lib/typescript/components/bottomSheetDraggableView/types.d.ts b/lib/typescript/components/bottomSheetDraggableView/types.d.ts new file mode 100644 index 000000000..8d38987e2 --- /dev/null +++ b/lib/typescript/components/bottomSheetDraggableView/types.d.ts @@ -0,0 +1,17 @@ +import type { ReactNode, Ref } from 'react'; +import type { ViewProps as RNViewProps } from 'react-native'; +import type { NativeViewGestureHandler } from 'react-native-gesture-handler'; +import type { GESTURE_SOURCE } from '../../constants'; + +export type BottomSheetDraggableViewProps = RNViewProps & { + /** + * Defines the gesture type of the draggable view. + * + * @default GESTURE_SOURCE.CONTENT + * @type GESTURE_SOURCE + */ + gestureType?: GESTURE_SOURCE; + nativeGestureRef?: Ref | null; + refreshControlGestureRef?: Ref | null; + children: ReactNode[] | ReactNode; +}; diff --git a/lib/typescript/components/bottomSheetFooter/BottomSheetFooter.d.ts b/lib/typescript/components/bottomSheetFooter/BottomSheetFooter.d.ts new file mode 100644 index 000000000..fd24e4437 --- /dev/null +++ b/lib/typescript/components/bottomSheetFooter/BottomSheetFooter.d.ts @@ -0,0 +1,5 @@ +import React from 'react'; +import type { BottomSheetDefaultFooterProps } from './types'; +declare function BottomSheetFooterComponent({ animatedFooterPosition, bottomInset, style, children, }: BottomSheetDefaultFooterProps): JSX.Element | null; +declare const BottomSheetFooter: React.MemoExoticComponent; +export default BottomSheetFooter; diff --git a/lib/typescript/components/bottomSheetFooter/index.d.ts b/lib/typescript/components/bottomSheetFooter/index.d.ts new file mode 100644 index 000000000..f20231923 --- /dev/null +++ b/lib/typescript/components/bottomSheetFooter/index.d.ts @@ -0,0 +1,2 @@ +export { default } from './BottomSheetFooter'; +export type { BottomSheetFooterProps } from './types'; diff --git a/lib/typescript/components/bottomSheetFooter/styles.d.ts b/lib/typescript/components/bottomSheetFooter/styles.d.ts new file mode 100644 index 000000000..567feaf16 --- /dev/null +++ b/lib/typescript/components/bottomSheetFooter/styles.d.ts @@ -0,0 +1,9 @@ +export declare const styles: { + container: { + position: "absolute"; + top: number; + left: number; + right: number; + zIndex: number; + }; +}; diff --git a/lib/typescript/components/bottomSheetFooter/types.d.ts b/lib/typescript/components/bottomSheetFooter/types.d.ts new file mode 100644 index 000000000..14c52e86d --- /dev/null +++ b/lib/typescript/components/bottomSheetFooter/types.d.ts @@ -0,0 +1,37 @@ +import type { ReactElement, ReactNode } from 'react'; +import { ViewStyle } from 'react-native'; +import type Animated from 'react-native-reanimated'; + +export interface BottomSheetFooterProps { + /** + * Calculated footer animated position. + * + * @type Animated.SharedValue + */ + animatedFooterPosition: Animated.SharedValue; +} + +export interface BottomSheetDefaultFooterProps extends BottomSheetFooterProps { + /** + * Bottom inset to be added below the footer, usually comes + * from `react-native-safe-area-context` hook `useSafeArea`. + * + * @type number + * @default 0 + */ + bottomInset?: number; + + /** + * Container style. + * + * @type ViewStyle + */ + style?: ViewStyle; + + /** + * Component to be placed in the footer. + * + * @type {ReactNode | ReactNode[] | (() => ReactElement)} + */ + children?: ReactNode | ReactNode[] | (() => ReactElement); +} diff --git a/lib/typescript/components/bottomSheetFooterContainer/BottomSheetFooterContainer.d.ts b/lib/typescript/components/bottomSheetFooterContainer/BottomSheetFooterContainer.d.ts new file mode 100644 index 000000000..25f4a50e4 --- /dev/null +++ b/lib/typescript/components/bottomSheetFooterContainer/BottomSheetFooterContainer.d.ts @@ -0,0 +1,4 @@ +import React from 'react'; +import type { BottomSheetFooterContainerProps } from './types'; +declare const BottomSheetFooterContainer: React.MemoExoticComponent<({ footerComponent: FooterComponent, }: BottomSheetFooterContainerProps) => JSX.Element>; +export default BottomSheetFooterContainer; diff --git a/lib/typescript/components/bottomSheetFooterContainer/types.d.ts b/lib/typescript/components/bottomSheetFooterContainer/types.d.ts new file mode 100644 index 000000000..2ba8cf705 --- /dev/null +++ b/lib/typescript/components/bottomSheetFooterContainer/types.d.ts @@ -0,0 +1,4 @@ +import type { BottomSheetProps } from '../bottomSheet'; + +export interface BottomSheetFooterContainerProps + extends Required> {} diff --git a/lib/typescript/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.d.ts b/lib/typescript/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.d.ts new file mode 100644 index 000000000..38461be9f --- /dev/null +++ b/lib/typescript/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.d.ts @@ -0,0 +1,3 @@ +import type { BottomSheetGestureHandlersProviderProps } from './types'; +declare const BottomSheetGestureHandlersProvider: ({ gestureEventsHandlersHook: useGestureEventsHandlers, children, }: BottomSheetGestureHandlersProviderProps) => JSX.Element; +export default BottomSheetGestureHandlersProvider; diff --git a/lib/typescript/components/bottomSheetGestureHandlersProvider/index.d.ts b/lib/typescript/components/bottomSheetGestureHandlersProvider/index.d.ts new file mode 100644 index 000000000..ab5338f64 --- /dev/null +++ b/lib/typescript/components/bottomSheetGestureHandlersProvider/index.d.ts @@ -0,0 +1 @@ +export { default } from './BottomSheetGestureHandlersProvider'; diff --git a/lib/typescript/components/bottomSheetGestureHandlersProvider/types.d.ts b/lib/typescript/components/bottomSheetGestureHandlersProvider/types.d.ts new file mode 100644 index 000000000..9898f1b8b --- /dev/null +++ b/lib/typescript/components/bottomSheetGestureHandlersProvider/types.d.ts @@ -0,0 +1,7 @@ +import type { ReactChild } from 'react'; +import type { BottomSheetProps } from '../bottomSheet/types'; + +export interface BottomSheetGestureHandlersProviderProps + extends Pick { + children: ReactChild | ReactChild[]; +} diff --git a/lib/typescript/components/bottomSheetHandle/BottomSheetHandle.d.ts b/lib/typescript/components/bottomSheetHandle/BottomSheetHandle.d.ts new file mode 100644 index 000000000..0cf78f454 --- /dev/null +++ b/lib/typescript/components/bottomSheetHandle/BottomSheetHandle.d.ts @@ -0,0 +1,4 @@ +import React from 'react'; +import type { BottomSheetDefaultHandleProps } from './types'; +declare const BottomSheetHandle: React.MemoExoticComponent<({ style, indicatorStyle: _indicatorStyle, children, }: BottomSheetDefaultHandleProps) => JSX.Element>; +export default BottomSheetHandle; diff --git a/lib/typescript/components/bottomSheetHandle/index.d.ts b/lib/typescript/components/bottomSheetHandle/index.d.ts new file mode 100644 index 000000000..442097b11 --- /dev/null +++ b/lib/typescript/components/bottomSheetHandle/index.d.ts @@ -0,0 +1,2 @@ +export { default } from './BottomSheetHandle'; +export type { BottomSheetHandleProps } from './types'; diff --git a/lib/typescript/components/bottomSheetHandle/styles.d.ts b/lib/typescript/components/bottomSheetHandle/styles.d.ts new file mode 100644 index 000000000..4ea04c9d3 --- /dev/null +++ b/lib/typescript/components/bottomSheetHandle/styles.d.ts @@ -0,0 +1,12 @@ +export declare const styles: { + container: { + padding: number; + }; + indicator: { + alignSelf: "center"; + width: number; + height: number; + borderRadius: number; + backgroundColor: string; + }; +}; diff --git a/lib/typescript/components/bottomSheetHandle/types.d.ts b/lib/typescript/components/bottomSheetHandle/types.d.ts new file mode 100644 index 000000000..20cc2bc20 --- /dev/null +++ b/lib/typescript/components/bottomSheetHandle/types.d.ts @@ -0,0 +1,27 @@ +import type React from 'react'; +import type { ViewProps } from 'react-native'; +import type { AnimateProps } from 'react-native-reanimated'; +import type { BottomSheetVariables } from '../../types'; + +export interface BottomSheetHandleProps extends BottomSheetVariables {} + +export interface BottomSheetDefaultHandleProps extends BottomSheetHandleProps { + /** + * View style to be applied to the handle container. + * @type Animated.AnimateStyle | ViewStyle + * @default undefined + */ + style?: AnimateProps['style']; + /** + * View style to be applied to the handle indicator. + * @type Animated.AnimateStyle | ViewStyle + * @default undefined + */ + indicatorStyle?: AnimateProps['style']; + /** + * Content to be added below the indicator. + * @type React.ReactNode | React.ReactNode[]; + * @default undefined + */ + children?: React.ReactNode | React.ReactNode[]; +} diff --git a/lib/typescript/components/bottomSheetHandleContainer/BottomSheetHandleContainer.d.ts b/lib/typescript/components/bottomSheetHandleContainer/BottomSheetHandleContainer.d.ts new file mode 100644 index 000000000..5db7ca68c --- /dev/null +++ b/lib/typescript/components/bottomSheetHandleContainer/BottomSheetHandleContainer.d.ts @@ -0,0 +1,5 @@ +import React from 'react'; +import type { BottomSheetHandleContainerProps } from './types'; +declare function BottomSheetHandleContainerComponent({ animatedIndex, animatedPosition, simultaneousHandlers: _internalSimultaneousHandlers, enableHandlePanningGesture, handleHeight, handleComponent: _providedHandleComponent, handleStyle: _providedHandleStyle, handleIndicatorStyle: _providedIndicatorStyle, }: BottomSheetHandleContainerProps): JSX.Element | null; +declare const BottomSheetHandleContainer: React.MemoExoticComponent; +export default BottomSheetHandleContainer; diff --git a/lib/typescript/components/bottomSheetHandleContainer/index.d.ts b/lib/typescript/components/bottomSheetHandleContainer/index.d.ts new file mode 100644 index 000000000..959f0ad03 --- /dev/null +++ b/lib/typescript/components/bottomSheetHandleContainer/index.d.ts @@ -0,0 +1 @@ +export { default } from './BottomSheetHandleContainer'; diff --git a/lib/typescript/components/bottomSheetHandleContainer/types.d.ts b/lib/typescript/components/bottomSheetHandleContainer/types.d.ts new file mode 100644 index 000000000..c3c2ae928 --- /dev/null +++ b/lib/typescript/components/bottomSheetHandleContainer/types.d.ts @@ -0,0 +1,25 @@ +import type { PanGestureHandlerProperties } from 'react-native-gesture-handler'; +import type Animated from 'react-native-reanimated'; +import type { BottomSheetProps } from '../bottomSheet'; +import type { BottomSheetHandleProps } from '../bottomSheetHandle'; +import type { useInteractivePanGestureHandlerConfigs } from '../../hooks/useGestureHandler'; + +export interface BottomSheetHandleContainerProps + extends Pick, + Pick< + BottomSheetProps, + | 'handleComponent' + | 'enableHandlePanningGesture' + | 'handleIndicatorStyle' + | 'handleStyle' + >, + Pick< + useInteractivePanGestureHandlerConfigs, + | 'enableOverDrag' + | 'enablePanDownToClose' + | 'overDragResistanceFactor' + | 'keyboardBehavior' + >, + BottomSheetHandleProps { + handleHeight: Animated.SharedValue; +} diff --git a/lib/typescript/components/bottomSheetModal/BottomSheetModal.d.ts b/lib/typescript/components/bottomSheetModal/BottomSheetModal.d.ts new file mode 100644 index 000000000..6475e6d77 --- /dev/null +++ b/lib/typescript/components/bottomSheetModal/BottomSheetModal.d.ts @@ -0,0 +1,6 @@ +import React from 'react'; +import type { BottomSheetModalMethods } from '../../types'; +import type { BottomSheetModalProps } from './types'; +declare type BottomSheetModal = BottomSheetModalMethods; +declare const BottomSheetModal: React.MemoExoticComponent>>; +export default BottomSheetModal; diff --git a/lib/typescript/components/bottomSheetModal/constants.d.ts b/lib/typescript/components/bottomSheetModal/constants.d.ts new file mode 100644 index 000000000..c355a699e --- /dev/null +++ b/lib/typescript/components/bottomSheetModal/constants.d.ts @@ -0,0 +1,3 @@ +declare const DEFAULT_STACK_BEHAVIOR = "replace"; +declare const DEFAULT_ENABLE_DISMISS_ON_CLOSE = true; +export { DEFAULT_STACK_BEHAVIOR, DEFAULT_ENABLE_DISMISS_ON_CLOSE }; diff --git a/lib/typescript/components/bottomSheetModal/index.d.ts b/lib/typescript/components/bottomSheetModal/index.d.ts new file mode 100644 index 000000000..46ca7733b --- /dev/null +++ b/lib/typescript/components/bottomSheetModal/index.d.ts @@ -0,0 +1,2 @@ +export { default } from './BottomSheetModal'; +export type { BottomSheetModalProps, BottomSheetModalPrivateMethods, BottomSheetModalStackBehavior, } from './types'; diff --git a/lib/typescript/components/bottomSheetModal/types.d.ts b/lib/typescript/components/bottomSheetModal/types.d.ts new file mode 100644 index 000000000..bc1e71a4e --- /dev/null +++ b/lib/typescript/components/bottomSheetModal/types.d.ts @@ -0,0 +1,61 @@ +import type React from 'react'; +import type { BottomSheetProps } from '../bottomSheet'; +import type { MODAL_STACK_BEHAVIOR } from '../../constants'; + +export interface BottomSheetModalPrivateMethods { + dismiss: (force?: boolean) => void; + minimize: () => void; + restore: () => void; +} + +export type BottomSheetModalStackBehavior = keyof typeof MODAL_STACK_BEHAVIOR; + +export interface BottomSheetModalProps + extends Omit { + /** + * Modal name to help identify the modal for later on. + * @type string + * @default nanoid generated unique key. + */ + name?: string; + + /** + * Defines the stack behavior when modal mount. + * - `push` it will mount the modal on top of current modal. + * - `replace` it will minimize the current modal then mount the modal. + * @type `push` | `replace` + * @default replace + */ + stackBehavior?: BottomSheetModalStackBehavior; + + /** + * Enable dismiss the modal when it is closed. + * @type boolean + * @default true + */ + enableDismissOnClose?: boolean; + + /** + * Add a custom container like FullWindowOverlay + * allow to fix issue like https://github.com/gorhom/react-native-bottom-sheet/issues/832 + * @type React.ComponentType + * @default undefined + */ + containerComponent?: React.ComponentType>; + + // callbacks + /** + * Callback when the modal dismissed. + * @type () => void; + */ + onDismiss?: () => void; + + /** + * A scrollable node or normal view. + * @type React.ReactNode[] | React.ReactNode | (({ data: any }?) => React.ReactElement) + */ + children: + | (({ data: any }?) => React.ReactElement) + | React.ReactNode[] + | React.ReactNode; +} diff --git a/lib/typescript/components/bottomSheetModalProvider/BottomSheetModalProvider.d.ts b/lib/typescript/components/bottomSheetModalProvider/BottomSheetModalProvider.d.ts new file mode 100644 index 000000000..1246e05fe --- /dev/null +++ b/lib/typescript/components/bottomSheetModalProvider/BottomSheetModalProvider.d.ts @@ -0,0 +1,3 @@ +import type { BottomSheetModalProviderProps } from './types'; +declare const BottomSheetModalProviderWrapper: ({ children, }: BottomSheetModalProviderProps) => JSX.Element; +export default BottomSheetModalProviderWrapper; diff --git a/lib/typescript/components/bottomSheetModalProvider/index.d.ts b/lib/typescript/components/bottomSheetModalProvider/index.d.ts new file mode 100644 index 000000000..31ec2b8e1 --- /dev/null +++ b/lib/typescript/components/bottomSheetModalProvider/index.d.ts @@ -0,0 +1 @@ +export { default } from './BottomSheetModalProvider'; diff --git a/lib/typescript/components/bottomSheetModalProvider/types.d.ts b/lib/typescript/components/bottomSheetModalProvider/types.d.ts new file mode 100644 index 000000000..78f2464c6 --- /dev/null +++ b/lib/typescript/components/bottomSheetModalProvider/types.d.ts @@ -0,0 +1,14 @@ +import type { ReactNode } from 'react'; +import type { BottomSheetModalPrivateMethods } from '../bottomSheetModal'; + +export interface BottomSheetModalRef { + key: string; + ref: { + current: BottomSheetModalPrivateMethods; + }; + willUnmount: boolean; +} + +export interface BottomSheetModalProviderProps { + children?: ReactNode; +} diff --git a/lib/typescript/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.d.ts b/lib/typescript/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.d.ts new file mode 100644 index 000000000..038ea811c --- /dev/null +++ b/lib/typescript/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.d.ts @@ -0,0 +1,4 @@ +import React from 'react'; +import { RefreshControlProps } from 'react-native'; +declare const BottomSheetRefreshControl: React.MemoExoticComponent>>>>; +export default BottomSheetRefreshControl; diff --git a/lib/typescript/components/bottomSheetRefreshControl/BottomSheetRefreshControl.d.ts b/lib/typescript/components/bottomSheetRefreshControl/BottomSheetRefreshControl.d.ts new file mode 100644 index 000000000..04adc0874 --- /dev/null +++ b/lib/typescript/components/bottomSheetRefreshControl/BottomSheetRefreshControl.d.ts @@ -0,0 +1,2 @@ +declare const _default: () => null; +export default _default; diff --git a/lib/typescript/components/bottomSheetRefreshControl/index.d.ts b/lib/typescript/components/bottomSheetRefreshControl/index.d.ts new file mode 100644 index 000000000..7d09eeec2 --- /dev/null +++ b/lib/typescript/components/bottomSheetRefreshControl/index.d.ts @@ -0,0 +1,7 @@ +import type React from 'react'; +import type { RefreshControlProps } from 'react-native'; +import type { NativeViewGestureHandlerProps } from 'react-native-gesture-handler'; +declare const _default: React.MemoExoticComponent>>>>; +export default _default; diff --git a/lib/typescript/components/bottomSheetScrollable/BottomSheetFlatList.d.ts b/lib/typescript/components/bottomSheetScrollable/BottomSheetFlatList.d.ts new file mode 100644 index 000000000..bebcdc8e0 --- /dev/null +++ b/lib/typescript/components/bottomSheetScrollable/BottomSheetFlatList.d.ts @@ -0,0 +1,5 @@ +/// +import type { BottomSheetFlatListMethods, BottomSheetFlatListProps } from './types'; +declare const BottomSheetFlatList: import("react").MemoExoticComponent, "children" | "style" | "hitSlop" | "onLayout" | "pointerEvents" | "removeClippedSubviews" | "testID" | "nativeID" | "collapsable" | "needsOffscreenAlphaCompositing" | "renderToHardwareTextureAndroid" | "focusable" | "shouldRasterizeIOS" | "isTVSelectable" | "hasTVPreferredFocus" | "tvParallaxProperties" | "tvParallaxShiftDistanceX" | "tvParallaxShiftDistanceY" | "tvParallaxTiltAngle" | "tvParallaxMagnification" | "onStartShouldSetResponder" | "onMoveShouldSetResponder" | "onResponderEnd" | "onResponderGrant" | "onResponderReject" | "onResponderMove" | "onResponderRelease" | "onResponderStart" | "onResponderTerminationRequest" | "onResponderTerminate" | "onStartShouldSetResponderCapture" | "onMoveShouldSetResponderCapture" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "onTouchCancel" | "onTouchEndCapture" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "accessibilityRole" | "accessibilityState" | "accessibilityHint" | "accessibilityValue" | "onAccessibilityAction" | "accessibilityLiveRegion" | "importantForAccessibility" | "accessibilityElementsHidden" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors" | "indicatorStyle" | "animatedProps" | "layout" | "entering" | "exiting" | "data" | "contentOffset" | "ItemSeparatorComponent" | "ListEmptyComponent" | "ListFooterComponent" | "ListFooterComponentStyle" | "ListHeaderComponent" | "ListHeaderComponentStyle" | "columnWrapperStyle" | "keyboardShouldPersistTaps" | "extraData" | "getItemLayout" | "horizontal" | "initialNumToRender" | "initialScrollIndex" | "keyExtractor" | "legacyImplementation" | "numColumns" | "onEndReached" | "onEndReachedThreshold" | "onRefresh" | "onViewableItemsChanged" | "refreshing" | "renderItem" | "viewabilityConfig" | "fadingEdgeLength" | "debug" | "disableVirtualization" | "getItem" | "getItemCount" | "inverted" | "listKey" | "maxToRenderPerBatch" | "onScrollToIndexFailed" | "progressViewOffset" | "renderScrollComponent" | "updateCellsBatchingPeriod" | "viewabilityConfigCallbackPairs" | "windowSize" | "CellRendererComponent" | "contentContainerStyle" | "invertStickyHeaders" | "keyboardDismissMode" | "onContentSizeChange" | "onScrollBeginDrag" | "onScrollEndDrag" | "onMomentumScrollEnd" | "onMomentumScrollBegin" | "pagingEnabled" | "scrollEnabled" | "showsHorizontalScrollIndicator" | "showsVerticalScrollIndicator" | "stickyHeaderHiddenOnScroll" | "refreshControl" | "snapToInterval" | "snapToOffsets" | "snapToStart" | "snapToEnd" | "stickyHeaderIndices" | "disableIntervalMomentum" | "disableScrollViewPanResponder" | "StickyHeaderComponent" | "alwaysBounceHorizontal" | "alwaysBounceVertical" | "automaticallyAdjustContentInsets" | "automaticallyAdjustKeyboardInsets" | "automaticallyAdjustsScrollIndicatorInsets" | "bounces" | "bouncesZoom" | "canCancelContentTouches" | "centerContent" | "contentInset" | "contentInsetAdjustmentBehavior" | "directionalLockEnabled" | "maintainVisibleContentPosition" | "maximumZoomScale" | "minimumZoomScale" | "onScrollAnimationEnd" | "pinchGestureEnabled" | "scrollIndicatorInsets" | "scrollToOverflowEnabled" | "scrollsToTop" | "snapToAlignment" | "onScrollToTop" | "zoomScale" | "endFillColor" | "scrollPerfTag" | "overScrollMode" | "nestedScrollEnabled" | "persistentScrollbar" | keyof import("./types").BottomSheetScrollableProps> & import("react").RefAttributes>>; +declare const _default: (props: BottomSheetFlatListProps) => ReturnType; +export default _default; diff --git a/lib/typescript/components/bottomSheetScrollable/BottomSheetScrollView.d.ts b/lib/typescript/components/bottomSheetScrollable/BottomSheetScrollView.d.ts new file mode 100644 index 000000000..87a54af5d --- /dev/null +++ b/lib/typescript/components/bottomSheetScrollable/BottomSheetScrollView.d.ts @@ -0,0 +1,5 @@ +/// +import type { BottomSheetScrollViewMethods, BottomSheetScrollViewProps } from './types'; +declare const BottomSheetScrollView: import("react").MemoExoticComponent & import("react").RefAttributes>>; +declare const _default: (props: BottomSheetScrollViewProps) => ReturnType; +export default _default; diff --git a/lib/typescript/components/bottomSheetScrollable/BottomSheetSectionList.d.ts b/lib/typescript/components/bottomSheetScrollable/BottomSheetSectionList.d.ts new file mode 100644 index 000000000..d010a869b --- /dev/null +++ b/lib/typescript/components/bottomSheetScrollable/BottomSheetSectionList.d.ts @@ -0,0 +1,6 @@ +/// +import { DefaultSectionT } from 'react-native'; +import type { BottomSheetSectionListMethods, BottomSheetSectionListProps } from './types'; +declare const BottomSheetSectionList: import("react").MemoExoticComponent, "children" | "style" | "hitSlop" | "onLayout" | "pointerEvents" | "removeClippedSubviews" | "testID" | "nativeID" | "collapsable" | "needsOffscreenAlphaCompositing" | "renderToHardwareTextureAndroid" | "focusable" | "shouldRasterizeIOS" | "isTVSelectable" | "hasTVPreferredFocus" | "tvParallaxProperties" | "tvParallaxShiftDistanceX" | "tvParallaxShiftDistanceY" | "tvParallaxTiltAngle" | "tvParallaxMagnification" | "onStartShouldSetResponder" | "onMoveShouldSetResponder" | "onResponderEnd" | "onResponderGrant" | "onResponderReject" | "onResponderMove" | "onResponderRelease" | "onResponderStart" | "onResponderTerminationRequest" | "onResponderTerminate" | "onStartShouldSetResponderCapture" | "onMoveShouldSetResponderCapture" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "onTouchCancel" | "onTouchEndCapture" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "accessibilityRole" | "accessibilityState" | "accessibilityHint" | "accessibilityValue" | "onAccessibilityAction" | "accessibilityLiveRegion" | "importantForAccessibility" | "accessibilityElementsHidden" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors" | "indicatorStyle" | "animatedProps" | "layout" | "entering" | "exiting" | "data" | "contentOffset" | "ItemSeparatorComponent" | "ListEmptyComponent" | "ListFooterComponent" | "ListFooterComponentStyle" | "ListHeaderComponent" | "ListHeaderComponentStyle" | "keyboardShouldPersistTaps" | "extraData" | "getItemLayout" | "horizontal" | "initialNumToRender" | "initialScrollIndex" | "keyExtractor" | "legacyImplementation" | "onEndReached" | "onEndReachedThreshold" | "onRefresh" | "onViewableItemsChanged" | "refreshing" | "renderItem" | "viewabilityConfig" | "fadingEdgeLength" | "debug" | "disableVirtualization" | "getItem" | "getItemCount" | "inverted" | "listKey" | "maxToRenderPerBatch" | "onScrollToIndexFailed" | "progressViewOffset" | "renderScrollComponent" | "updateCellsBatchingPeriod" | "viewabilityConfigCallbackPairs" | "windowSize" | "CellRendererComponent" | "contentContainerStyle" | "invertStickyHeaders" | "keyboardDismissMode" | "onContentSizeChange" | "onScroll" | "onScrollBeginDrag" | "onScrollEndDrag" | "onMomentumScrollEnd" | "onMomentumScrollBegin" | "pagingEnabled" | "scrollEnabled" | "showsHorizontalScrollIndicator" | "showsVerticalScrollIndicator" | "stickyHeaderHiddenOnScroll" | "refreshControl" | "snapToInterval" | "snapToOffsets" | "snapToStart" | "snapToEnd" | "stickyHeaderIndices" | "disableIntervalMomentum" | "disableScrollViewPanResponder" | "StickyHeaderComponent" | "alwaysBounceHorizontal" | "alwaysBounceVertical" | "automaticallyAdjustContentInsets" | "automaticallyAdjustKeyboardInsets" | "automaticallyAdjustsScrollIndicatorInsets" | "bounces" | "bouncesZoom" | "canCancelContentTouches" | "centerContent" | "contentInset" | "contentInsetAdjustmentBehavior" | "directionalLockEnabled" | "maintainVisibleContentPosition" | "maximumZoomScale" | "minimumZoomScale" | "onScrollAnimationEnd" | "pinchGestureEnabled" | "scrollIndicatorInsets" | "scrollToOverflowEnabled" | "scrollsToTop" | "snapToAlignment" | "onScrollToTop" | "zoomScale" | "endFillColor" | "scrollPerfTag" | "overScrollMode" | "nestedScrollEnabled" | "persistentScrollbar" | "SectionSeparatorComponent" | "renderSectionHeader" | "renderSectionFooter" | "sections" | "stickySectionHeadersEnabled" | keyof import("./types").BottomSheetScrollableProps> & import("react").RefAttributes>>; +declare const _default: (props: BottomSheetSectionListProps) => ReturnType; +export default _default; diff --git a/lib/typescript/components/bottomSheetScrollable/BottomSheetVirtualizedList.d.ts b/lib/typescript/components/bottomSheetScrollable/BottomSheetVirtualizedList.d.ts new file mode 100644 index 000000000..56cf93803 --- /dev/null +++ b/lib/typescript/components/bottomSheetScrollable/BottomSheetVirtualizedList.d.ts @@ -0,0 +1,5 @@ +/// +import type { BottomSheetVirtualizedListMethods, BottomSheetVirtualizedListProps } from './types'; +declare const BottomSheetVirtualizedList: import("react").MemoExoticComponent, "children" | "style" | "hitSlop" | "onLayout" | "pointerEvents" | "removeClippedSubviews" | "testID" | "nativeID" | "collapsable" | "needsOffscreenAlphaCompositing" | "renderToHardwareTextureAndroid" | "focusable" | "shouldRasterizeIOS" | "isTVSelectable" | "hasTVPreferredFocus" | "tvParallaxProperties" | "tvParallaxShiftDistanceX" | "tvParallaxShiftDistanceY" | "tvParallaxTiltAngle" | "tvParallaxMagnification" | "onStartShouldSetResponder" | "onMoveShouldSetResponder" | "onResponderEnd" | "onResponderGrant" | "onResponderReject" | "onResponderMove" | "onResponderRelease" | "onResponderStart" | "onResponderTerminationRequest" | "onResponderTerminate" | "onStartShouldSetResponderCapture" | "onMoveShouldSetResponderCapture" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "onTouchCancel" | "onTouchEndCapture" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "accessibilityRole" | "accessibilityState" | "accessibilityHint" | "accessibilityValue" | "onAccessibilityAction" | "accessibilityLiveRegion" | "importantForAccessibility" | "accessibilityElementsHidden" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors" | "indicatorStyle" | "animatedProps" | "layout" | "entering" | "exiting" | "data" | "contentOffset" | "ListEmptyComponent" | "ListFooterComponent" | "ListHeaderComponent" | "keyboardShouldPersistTaps" | "extraData" | "getItemLayout" | "horizontal" | "initialNumToRender" | "initialScrollIndex" | "keyExtractor" | "onEndReached" | "onEndReachedThreshold" | "onRefresh" | "onViewableItemsChanged" | "refreshing" | "renderItem" | "viewabilityConfig" | "fadingEdgeLength" | "debug" | "disableVirtualization" | "getItem" | "getItemCount" | "inverted" | "listKey" | "maxToRenderPerBatch" | "onScrollToIndexFailed" | "progressViewOffset" | "renderScrollComponent" | "updateCellsBatchingPeriod" | "viewabilityConfigCallbackPairs" | "windowSize" | "CellRendererComponent" | "contentContainerStyle" | "invertStickyHeaders" | "keyboardDismissMode" | "onContentSizeChange" | "onScroll" | "onScrollBeginDrag" | "onScrollEndDrag" | "onMomentumScrollEnd" | "onMomentumScrollBegin" | "pagingEnabled" | "scrollEnabled" | "showsHorizontalScrollIndicator" | "showsVerticalScrollIndicator" | "stickyHeaderHiddenOnScroll" | "refreshControl" | "snapToInterval" | "snapToOffsets" | "snapToStart" | "snapToEnd" | "stickyHeaderIndices" | "disableIntervalMomentum" | "disableScrollViewPanResponder" | "StickyHeaderComponent" | "alwaysBounceHorizontal" | "alwaysBounceVertical" | "automaticallyAdjustContentInsets" | "automaticallyAdjustKeyboardInsets" | "automaticallyAdjustsScrollIndicatorInsets" | "bounces" | "bouncesZoom" | "canCancelContentTouches" | "centerContent" | "contentInset" | "contentInsetAdjustmentBehavior" | "directionalLockEnabled" | "maintainVisibleContentPosition" | "maximumZoomScale" | "minimumZoomScale" | "onScrollAnimationEnd" | "pinchGestureEnabled" | "scrollIndicatorInsets" | "scrollToOverflowEnabled" | "scrollsToTop" | "snapToAlignment" | "onScrollToTop" | "zoomScale" | "endFillColor" | "scrollPerfTag" | "overScrollMode" | "nestedScrollEnabled" | "persistentScrollbar" | keyof import("./types").BottomSheetScrollableProps> & import("react").RefAttributes>>; +declare const _default: (props: BottomSheetVirtualizedListProps) => ReturnType; +export default _default; diff --git a/lib/typescript/components/bottomSheetScrollable/createBottomSheetScrollableComponent.d.ts b/lib/typescript/components/bottomSheetScrollable/createBottomSheetScrollableComponent.d.ts new file mode 100644 index 000000000..7fdd0895b --- /dev/null +++ b/lib/typescript/components/bottomSheetScrollable/createBottomSheetScrollableComponent.d.ts @@ -0,0 +1,3 @@ +import React from 'react'; +import { SCROLLABLE_TYPE } from '../../constants'; +export declare function createBottomSheetScrollableComponent(type: SCROLLABLE_TYPE, ScrollableComponent: any): React.ForwardRefExoticComponent & React.RefAttributes>; diff --git a/lib/typescript/components/bottomSheetScrollable/index.d.ts b/lib/typescript/components/bottomSheetScrollable/index.d.ts new file mode 100644 index 000000000..87f61734e --- /dev/null +++ b/lib/typescript/components/bottomSheetScrollable/index.d.ts @@ -0,0 +1,6 @@ +export { createBottomSheetScrollableComponent } from './createBottomSheetScrollableComponent'; +export { default as BottomSheetSectionList } from './BottomSheetSectionList'; +export { default as BottomSheetFlatList } from './BottomSheetFlatList'; +export { default as BottomSheetScrollView } from './BottomSheetScrollView'; +export { default as BottomSheetVirtualizedList } from './BottomSheetVirtualizedList'; +export type { BottomSheetFlatListMethods, BottomSheetScrollViewMethods, BottomSheetSectionListMethods, BottomSheetVirtualizedListMethods, BottomSheetScrollableProps, } from './types'; diff --git a/lib/typescript/components/bottomSheetScrollable/styles.d.ts b/lib/typescript/components/bottomSheetScrollable/styles.d.ts new file mode 100644 index 000000000..efb2494d9 --- /dev/null +++ b/lib/typescript/components/bottomSheetScrollable/styles.d.ts @@ -0,0 +1,6 @@ +export declare const styles: { + container: { + flex: number; + overflow: "visible"; + }; +}; diff --git a/lib/typescript/components/bottomSheetScrollable/types.d.ts b/lib/typescript/components/bottomSheetScrollable/types.d.ts new file mode 100644 index 000000000..f5763681c --- /dev/null +++ b/lib/typescript/components/bottomSheetScrollable/types.d.ts @@ -0,0 +1,276 @@ +import type { + DependencyList, + EffectCallback, + ReactNode, + Ref, + RefObject, +} from 'react'; +import type { + VirtualizedListProps, + ScrollViewProps, + FlatListProps, + SectionListProps, + SectionListScrollParams, + View, + ScrollViewComponent, + NodeHandle, + ScrollResponderMixin, +} from 'react-native'; +import type Animated from 'react-native-reanimated'; +import type { ScrollEventsHandlersHookType } from '../../types'; + +export interface BottomSheetScrollableProps { + /** + * Adjust the scrollable bottom margin to avoid the animated footer. + * + * @type boolean + * @default false + */ + enableFooterMarginAdjustment?: boolean; + + /** + * This needed when bottom sheet used with multiple scrollables to allow bottom sheet + * detect the current scrollable ref, especially when used with `React Navigation`. + * You will need to provide `useFocusEffect` from `@react-navigation/native`. + * + * @type (effect: EffectCallback, deps?: DependencyList) => void + * @default useEffect + */ + focusHook?: (effect: EffectCallback, deps?: DependencyList) => void; + + /** + * Custom hook to provide scroll events handler, which will allow advance and + * customize handling for scrollables. + * + * @warning this is an experimental feature and the hook signature can change without a major version bump. + * @type ScrollEventsHandlersHookType + * @default useScrollEventsHandlersDefault + */ + scrollEventsHandlersHook?: ScrollEventsHandlersHookType; +} + +export type ScrollableProps = + | ScrollViewProps + | FlatListProps + | SectionListProps; + +//#region FlatList +export type BottomSheetFlatListProps = Omit< + Animated.AnimateProps>, + 'decelerationRate' | 'onScroll' | 'scrollEventThrottle' +> & + BottomSheetScrollableProps & { + ref?: Ref; + }; + +export interface BottomSheetFlatListMethods { + /** + * Scrolls to the end of the content. May be janky without `getItemLayout` prop. + */ + scrollToEnd: (params?: { animated?: boolean | null }) => void; + + /** + * Scrolls to the item at the specified index such that it is positioned in the viewable area + * such that viewPosition 0 places it at the top, 1 at the bottom, and 0.5 centered in the middle. + * Cannot scroll to locations outside the render window without specifying the getItemLayout prop. + */ + scrollToIndex: (params: { + animated?: boolean | null; + index: number; + viewOffset?: number; + viewPosition?: number; + }) => void; + + /** + * Requires linear scan through data - use `scrollToIndex` instead if possible. + * May be janky without `getItemLayout` prop. + */ + scrollToItem: (params: { + animated?: boolean | null; + item: any; + viewPosition?: number; + }) => void; + + /** + * Scroll to a specific content pixel offset, like a normal `ScrollView`. + */ + scrollToOffset: (params: { + animated?: boolean | null; + offset: number; + }) => void; + + /** + * Tells the list an interaction has occured, which should trigger viewability calculations, + * e.g. if waitForInteractions is true and the user has not scrolled. This is typically called + * by taps on items or by navigation actions. + */ + recordInteraction: () => void; + + /** + * Displays the scroll indicators momentarily. + */ + flashScrollIndicators: () => void; + + /** + * Provides a handle to the underlying scroll responder. + */ + getScrollResponder: () => ScrollResponderMixin | null | undefined; + + /** + * Provides a reference to the underlying host component + */ + getNativeScrollRef: () => + | RefObject + | RefObject + | null + | undefined; + + getScrollableNode: () => any; + + // TODO: use `unknown` instead of `any` for Typescript >= 3.0 + setNativeProps: (props: { [key: string]: any }) => void; +} +//#endregion + +//#region ScrollView +export type BottomSheetScrollViewProps = Omit< + Animated.AnimateProps, + 'decelerationRate' | 'scrollEventThrottle' +> & + BottomSheetScrollableProps & { + ref?: Ref; + children: ReactNode | ReactNode[]; + }; + +export interface BottomSheetScrollViewMethods { + /** + * Scrolls to a given x, y offset, either immediately or with a smooth animation. + * Syntax: + * + * scrollTo(options: {x: number = 0; y: number = 0; animated: boolean = true}) + * + * Note: The weird argument signature is due to the fact that, for historical reasons, + * the function also accepts separate arguments as an alternative to the options object. + * This is deprecated due to ambiguity (y before x), and SHOULD NOT BE USED. + */ + scrollTo( + y?: number | { x?: number; y?: number; animated?: boolean }, + x?: number, + animated?: boolean + ): void; + + /** + * A helper function that scrolls to the end of the scrollview; + * If this is a vertical ScrollView, it scrolls to the bottom. + * If this is a horizontal ScrollView scrolls to the right. + * + * The options object has an animated prop, that enables the scrolling animation or not. + * The animated prop defaults to true + */ + scrollToEnd(options?: { animated: boolean }): void; + + /** + * Returns a reference to the underlying scroll responder, which supports + * operations like `scrollTo`. All ScrollView-like components should + * implement this method so that they can be composed while providing access + * to the underlying scroll responder's methods. + */ + getScrollResponder(): ScrollResponderMixin; + + getScrollableNode(): any; + + // Undocumented + getInnerViewNode(): any; + + /** + * @deprecated Use scrollTo instead + */ + scrollWithoutAnimationTo?: (y: number, x: number) => void; + + /** + * This function sends props straight to native. They will not participate in + * future diff process - this means that if you do not include them in the + * next render, they will remain active (see [Direct + * Manipulation](https://reactnative.dev/docs/direct-manipulation)). + */ + setNativeProps(nativeProps: object): void; +} +//#endregion + +//#region SectionList +type BottomSheetSectionListProps = Omit< + Animated.AnimateProps>, + 'decelerationRate' | 'scrollEventThrottle' +> & + BottomSheetScrollableProps & { + ref?: Ref; + }; + +export interface BottomSheetSectionListMethods { + /** + * Scrolls to the item at the specified sectionIndex and itemIndex (within the section) + * positioned in the viewable area such that viewPosition 0 places it at the top + * (and may be covered by a sticky header), 1 at the bottom, and 0.5 centered in the middle. + */ + scrollToLocation(params: SectionListScrollParams): void; + + /** + * Tells the list an interaction has occurred, which should trigger viewability calculations, e.g. + * if `waitForInteractions` is true and the user has not scrolled. This is typically called by + * taps on items or by navigation actions. + */ + recordInteraction(): void; + + /** + * Displays the scroll indicators momentarily. + * + * @platform ios + */ + flashScrollIndicators(): void; + + /** + * Provides a handle to the underlying scroll responder. + */ + getScrollResponder(): ScrollResponderMixin | undefined; + + /** + * Provides a handle to the underlying scroll node. + */ + getScrollableNode(): NodeHandle | undefined; +} +//#endregion + +//#region +export type BottomSheetVirtualizedListProps = Omit< + Animated.AnimateProps>, + 'decelerationRate' | 'scrollEventThrottle' +> & + BottomSheetScrollableProps & { + ref?: Ref; + }; + +export interface BottomSheetVirtualizedListMethods { + scrollToEnd: (params?: { animated?: boolean }) => void; + scrollToIndex: (params: { + animated?: boolean; + index: number; + viewOffset?: number; + viewPosition?: number; + }) => void; + scrollToItem: (params: { + animated?: boolean; + item: any; + viewPosition?: number; + }) => void; + + /** + * Scroll to a specific content pixel offset in the list. + * Param `offset` expects the offset to scroll to. In case of horizontal is true, the + * offset is the x-value, in any other case the offset is the y-value. + * Param `animated` (true by default) defines whether the list should do an animation while scrolling. + */ + scrollToOffset: (params: { animated?: boolean; offset: number }) => void; + + recordInteraction: () => void; +} +//#endregion diff --git a/lib/typescript/components/bottomSheetTextInput/BottomSheetTextInput.d.ts b/lib/typescript/components/bottomSheetTextInput/BottomSheetTextInput.d.ts new file mode 100644 index 000000000..121b45f56 --- /dev/null +++ b/lib/typescript/components/bottomSheetTextInput/BottomSheetTextInput.d.ts @@ -0,0 +1,4 @@ +import React from 'react'; +import type { BottomSheetTextInputProps } from './types'; +declare const BottomSheetTextInput: React.MemoExoticComponent>>>>>; +export default BottomSheetTextInput; diff --git a/lib/typescript/components/bottomSheetTextInput/index.d.ts b/lib/typescript/components/bottomSheetTextInput/index.d.ts new file mode 100644 index 000000000..fc7fc37ee --- /dev/null +++ b/lib/typescript/components/bottomSheetTextInput/index.d.ts @@ -0,0 +1,2 @@ +export { default } from './BottomSheetTextInput'; +export type { BottomSheetTextInputProps } from './types'; diff --git a/lib/typescript/components/bottomSheetTextInput/types.d.ts b/lib/typescript/components/bottomSheetTextInput/types.d.ts new file mode 100644 index 000000000..fcc75c4ea --- /dev/null +++ b/lib/typescript/components/bottomSheetTextInput/types.d.ts @@ -0,0 +1,3 @@ +import type { TextInputProps } from 'react-native'; +export interface BottomSheetTextInputProps extends TextInputProps { +} diff --git a/lib/typescript/components/bottomSheetView/BottomSheetView.d.ts b/lib/typescript/components/bottomSheetView/BottomSheetView.d.ts new file mode 100644 index 000000000..d600ce5d9 --- /dev/null +++ b/lib/typescript/components/bottomSheetView/BottomSheetView.d.ts @@ -0,0 +1,5 @@ +import React from 'react'; +import type { BottomSheetViewProps } from './types'; +declare function BottomSheetViewComponent({ focusHook: useFocusHook, enableFooterMarginAdjustment, onLayout, style, children, ...rest }: BottomSheetViewProps): JSX.Element; +declare const BottomSheetView: React.MemoExoticComponent; +export default BottomSheetView; diff --git a/lib/typescript/components/bottomSheetView/index.d.ts b/lib/typescript/components/bottomSheetView/index.d.ts new file mode 100644 index 000000000..0cbb27a09 --- /dev/null +++ b/lib/typescript/components/bottomSheetView/index.d.ts @@ -0,0 +1 @@ +export { default } from './BottomSheetView'; diff --git a/lib/typescript/components/bottomSheetView/styles.d.ts b/lib/typescript/components/bottomSheetView/styles.d.ts new file mode 100644 index 000000000..49983eda3 --- /dev/null +++ b/lib/typescript/components/bottomSheetView/styles.d.ts @@ -0,0 +1,3 @@ +export declare const styles: { + container: {}; +}; diff --git a/lib/typescript/components/bottomSheetView/types.d.ts b/lib/typescript/components/bottomSheetView/types.d.ts new file mode 100644 index 000000000..989a8f0f9 --- /dev/null +++ b/lib/typescript/components/bottomSheetView/types.d.ts @@ -0,0 +1,24 @@ +import type { EffectCallback, DependencyList, ReactNode } from 'react'; +import type { ViewProps as RNViewProps } from 'react-native'; + +export interface BottomSheetViewProps extends RNViewProps { + /** + * Adjust the scrollable bottom margin to avoid the animated footer. + * + * @type boolean + * @default false + */ + enableFooterMarginAdjustment?: boolean; + + /** + * This needed when bottom sheet used with multiple scrollables to allow bottom sheet + * detect the current scrollable ref, especially when used with `React Navigation`. + * You will need to provide `useFocusEffect` from `@react-navigation/native`. + * + * @type (effect: EffectCallback, deps?: DependencyList) => void + * @default useEffect + */ + focusHook?: (effect: EffectCallback, deps?: DependencyList) => void; + + children: ReactNode[] | ReactNode; +} diff --git a/lib/typescript/components/touchables/Touchables.d.ts b/lib/typescript/components/touchables/Touchables.d.ts new file mode 100644 index 000000000..67b0085d0 --- /dev/null +++ b/lib/typescript/components/touchables/Touchables.d.ts @@ -0,0 +1 @@ +export { TouchableOpacity, TouchableHighlight, TouchableWithoutFeedback, } from 'react-native-gesture-handler'; diff --git a/lib/typescript/components/touchables/Touchables.ios.d.ts b/lib/typescript/components/touchables/Touchables.ios.d.ts new file mode 100644 index 000000000..76a6869c3 --- /dev/null +++ b/lib/typescript/components/touchables/Touchables.ios.d.ts @@ -0,0 +1 @@ +export { TouchableOpacity, TouchableHighlight, TouchableWithoutFeedback, } from 'react-native'; diff --git a/lib/typescript/components/touchables/index.d.ts b/lib/typescript/components/touchables/index.d.ts new file mode 100644 index 000000000..6b1384d78 --- /dev/null +++ b/lib/typescript/components/touchables/index.d.ts @@ -0,0 +1,7 @@ +import type { TouchableOpacity as RNTouchableOpacity, TouchableHighlight as RNTouchableHighlight, TouchableWithoutFeedback as RNTouchableWithoutFeedback } from 'react-native'; +declare const _default: { + TouchableOpacity: typeof RNTouchableOpacity; + TouchableHighlight: typeof RNTouchableHighlight; + TouchableWithoutFeedback: typeof RNTouchableWithoutFeedback; +}; +export default _default; diff --git a/lib/typescript/constants.d.ts b/lib/typescript/constants.d.ts new file mode 100644 index 000000000..49d4b6ac6 --- /dev/null +++ b/lib/typescript/constants.d.ts @@ -0,0 +1,90 @@ +import Animated from 'react-native-reanimated'; +declare const WINDOW_HEIGHT: number, WINDOW_WIDTH: number; +declare const SCREEN_HEIGHT: number, SCREEN_WIDTH: number; +declare enum GESTURE_SOURCE { + UNDETERMINED = 0, + SCROLLABLE = 1, + HANDLE = 2, + CONTENT = 3 +} +declare enum SHEET_STATE { + CLOSED = 0, + OPENED = 1, + EXTENDED = 2, + OVER_EXTENDED = 3, + FILL_PARENT = 4 +} +declare enum SCROLLABLE_STATE { + LOCKED = 0, + UNLOCKED = 1, + UNDETERMINED = 2 +} +declare enum SCROLLABLE_TYPE { + UNDETERMINED = 0, + VIEW = 1, + FLATLIST = 2, + SCROLLVIEW = 3, + SECTIONLIST = 4, + VIRTUALIZEDLIST = 5 +} +declare enum ANIMATION_STATE { + UNDETERMINED = 0, + RUNNING = 1, + STOPPED = 2, + INTERRUPTED = 3 +} +declare enum ANIMATION_SOURCE { + NONE = 0, + MOUNT = 1, + GESTURE = 2, + USER = 3, + CONTAINER_RESIZE = 4, + SNAP_POINT_CHANGE = 5, + KEYBOARD = 6 +} +declare enum ANIMATION_METHOD { + TIMING = 0, + SPRING = 1 +} +declare enum KEYBOARD_STATE { + UNDETERMINED = 0, + SHOWN = 1, + HIDDEN = 2 +} +declare const ANIMATION_EASING: Animated.EasingFunction; +declare const ANIMATION_DURATION = 250; +declare const ANIMATION_CONFIGS: { + damping: number; + stiffness: number; + mass: number; + overshootClamping: boolean; + restDisplacementThreshold: number; + restSpeedThreshold: number; +} | { + duration: number; + easing: Animated.EasingFunction; +}; +declare const SCROLLABLE_DECELERATION_RATE_MAPPER: { + 2: number; + 0: number; + 1: number; +}; +declare const MODAL_STACK_BEHAVIOR: { + replace: string; + push: string; +}; +declare const KEYBOARD_BEHAVIOR: { + readonly interactive: "interactive"; + readonly extend: "extend"; + readonly fillParent: "fillParent"; +}; +declare const KEYBOARD_BLUR_BEHAVIOR: { + readonly none: "none"; + readonly restore: "restore"; +}; +declare const KEYBOARD_INPUT_MODE: { + readonly adjustPan: "adjustPan"; + readonly adjustResize: "adjustResize"; +}; +declare const KEYBOARD_DISMISS_THRESHOLD = 12.5; +export { GESTURE_SOURCE, SHEET_STATE, ANIMATION_STATE, ANIMATION_METHOD, ANIMATION_SOURCE, SCROLLABLE_TYPE, SCROLLABLE_STATE, KEYBOARD_STATE, WINDOW_HEIGHT, WINDOW_WIDTH, SCREEN_HEIGHT, SCREEN_WIDTH, SCROLLABLE_DECELERATION_RATE_MAPPER, MODAL_STACK_BEHAVIOR, KEYBOARD_BEHAVIOR, KEYBOARD_BLUR_BEHAVIOR, KEYBOARD_INPUT_MODE, KEYBOARD_DISMISS_THRESHOLD, ANIMATION_CONFIGS, ANIMATION_EASING, ANIMATION_DURATION, }; diff --git a/lib/typescript/contexts/external.d.ts b/lib/typescript/contexts/external.d.ts new file mode 100644 index 000000000..1677edad9 --- /dev/null +++ b/lib/typescript/contexts/external.d.ts @@ -0,0 +1,4 @@ +/// +import type { BottomSheetMethods, BottomSheetVariables } from '../types'; +export declare const BottomSheetContext: import("react").Context<(BottomSheetMethods & BottomSheetVariables) | null>; +export declare const BottomSheetProvider: import("react").Provider<(BottomSheetMethods & BottomSheetVariables) | null>; diff --git a/lib/typescript/contexts/gesture.d.ts b/lib/typescript/contexts/gesture.d.ts new file mode 100644 index 000000000..d6abb440b --- /dev/null +++ b/lib/typescript/contexts/gesture.d.ts @@ -0,0 +1,8 @@ +/// +import type { PanGestureHandlerGestureEvent } from 'react-native-gesture-handler'; +export interface BottomSheetGestureHandlersContextType { + contentPanGestureHandler: (event: PanGestureHandlerGestureEvent) => void; + handlePanGestureHandler: (event: PanGestureHandlerGestureEvent) => void; + scrollablePanGestureHandler: (event: PanGestureHandlerGestureEvent) => void; +} +export declare const BottomSheetGestureHandlersContext: import("react").Context; diff --git a/lib/typescript/contexts/index.d.ts b/lib/typescript/contexts/index.d.ts new file mode 100644 index 000000000..99e74deee --- /dev/null +++ b/lib/typescript/contexts/index.d.ts @@ -0,0 +1,6 @@ +export { BottomSheetContext, BottomSheetProvider } from './external'; +export { BottomSheetInternalContext, BottomSheetInternalProvider, } from './internal'; +export { BottomSheetGestureHandlersContext } from './gesture'; +export { BottomSheetModalContext, BottomSheetModalProvider, } from './modal/external'; +export { BottomSheetModalInternalContext, BottomSheetModalInternalProvider, } from './modal/internal'; +export type { BottomSheetModalInternalContextType } from './modal/internal'; diff --git a/lib/typescript/contexts/internal.d.ts b/lib/typescript/contexts/internal.d.ts new file mode 100644 index 000000000..0ef41a63a --- /dev/null +++ b/lib/typescript/contexts/internal.d.ts @@ -0,0 +1,38 @@ +import { RefObject } from 'react'; +import type { PanGestureHandlerProps, State } from 'react-native-gesture-handler'; +import type Animated from 'react-native-reanimated'; +import type { AnimateToPositionType, BottomSheetProps } from '../components/bottomSheet/types'; +import type { ANIMATION_STATE, KEYBOARD_STATE, SCROLLABLE_STATE, SCROLLABLE_TYPE, SHEET_STATE } from '../constants'; +import type { Scrollable, ScrollableRef } from '../types'; +export interface BottomSheetInternalContextType extends Pick, Required> { + animatedAnimationState: Animated.SharedValue; + animatedSheetState: Animated.SharedValue; + animatedScrollableState: Animated.SharedValue; + animatedKeyboardState: Animated.SharedValue; + animatedContentGestureState: Animated.SharedValue; + animatedHandleGestureState: Animated.SharedValue; + animatedSnapPoints: Animated.SharedValue; + animatedPosition: Animated.SharedValue; + animatedIndex: Animated.SharedValue; + animatedContainerHeight: Animated.SharedValue; + animatedContentHeight: Animated.SharedValue; + animatedHighestSnapPoint: Animated.SharedValue; + animatedClosedPosition: Animated.SharedValue; + animatedFooterHeight: Animated.SharedValue; + animatedHandleHeight: Animated.SharedValue; + animatedKeyboardHeight: Animated.SharedValue; + animatedKeyboardHeightInContainer: Animated.SharedValue; + animatedScrollableType: Animated.SharedValue; + animatedScrollableContentOffsetY: Animated.SharedValue; + animatedScrollableOverrideState: Animated.SharedValue; + isScrollableRefreshable: Animated.SharedValue; + isContentHeightFixed: Animated.SharedValue; + isInTemporaryPosition: Animated.SharedValue; + shouldHandleKeyboardEvents: Animated.SharedValue; + stopAnimation: () => void; + animateToPosition: AnimateToPositionType; + setScrollableRef: (ref: ScrollableRef) => void; + removeScrollableRef: (ref: RefObject) => void; +} +export declare const BottomSheetInternalContext: import("react").Context; +export declare const BottomSheetInternalProvider: import("react").Provider; diff --git a/lib/typescript/contexts/modal/external.d.ts b/lib/typescript/contexts/modal/external.d.ts new file mode 100644 index 000000000..ac9f1a620 --- /dev/null +++ b/lib/typescript/contexts/modal/external.d.ts @@ -0,0 +1,7 @@ +/// +export interface BottomSheetModalContextType { + dismiss: (key?: string) => boolean; + dismissAll: () => void; +} +export declare const BottomSheetModalContext: import("react").Context; +export declare const BottomSheetModalProvider: import("react").Provider; diff --git a/lib/typescript/contexts/modal/internal.d.ts b/lib/typescript/contexts/modal/internal.d.ts new file mode 100644 index 000000000..7efa216fe --- /dev/null +++ b/lib/typescript/contexts/modal/internal.d.ts @@ -0,0 +1,14 @@ +import { Ref } from 'react'; +import type { Insets } from 'react-native'; +import type Animated from 'react-native-reanimated'; +import type BottomSheet from '../../components/bottomSheet'; +import type { BottomSheetModalStackBehavior } from '../../components/bottomSheetModal'; +export interface BottomSheetModalInternalContextType { + containerHeight: Animated.SharedValue; + containerOffset: Animated.SharedValue>; + mountSheet: (key: string, ref: Ref, stackBehavior: BottomSheetModalStackBehavior) => void; + unmountSheet: (key: string) => void; + willUnmountSheet: (key: string) => void; +} +export declare const BottomSheetModalInternalContext: import("react").Context; +export declare const BottomSheetModalInternalProvider: import("react").Provider; diff --git a/lib/typescript/hooks/index.d.ts b/lib/typescript/hooks/index.d.ts new file mode 100644 index 000000000..e26873f68 --- /dev/null +++ b/lib/typescript/hooks/index.d.ts @@ -0,0 +1,16 @@ +export { useBottomSheet } from './useBottomSheet'; +export { useBottomSheetInternal } from './useBottomSheetInternal'; +export { useBottomSheetModal } from './useBottomSheetModal'; +export { useBottomSheetModalInternal } from './useBottomSheetModalInternal'; +export { useScrollable } from './useScrollable'; +export { useScrollableSetter } from './useScrollableSetter'; +export { useScrollHandler } from './useScrollHandler'; +export { useGestureHandler } from './useGestureHandler'; +export { useGestureEventsHandlersDefault } from './useGestureEventsHandlersDefault'; +export { useKeyboard } from './useKeyboard'; +export { useStableCallback } from './useStableCallback'; +export { usePropsValidator } from './usePropsValidator'; +export { useNormalizedSnapPoints } from './useNormalizedSnapPoints'; +export { useReactiveSharedValue } from './useReactiveSharedValue'; +export { useBottomSheetDynamicSnapPoints } from './useBottomSheetDynamicSnapPoints'; +export { useBottomSheetGestureHandlers } from './useBottomSheetGestureHandlers'; diff --git a/lib/typescript/hooks/useBottomSheet.d.ts b/lib/typescript/hooks/useBottomSheet.d.ts new file mode 100644 index 000000000..8f657033e --- /dev/null +++ b/lib/typescript/hooks/useBottomSheet.d.ts @@ -0,0 +1 @@ +export declare const useBottomSheet: () => import("../types").BottomSheetMethods & import("../types").BottomSheetVariables; diff --git a/lib/typescript/hooks/useBottomSheetDynamicSnapPoints.d.ts b/lib/typescript/hooks/useBottomSheetDynamicSnapPoints.d.ts new file mode 100644 index 000000000..36db692d0 --- /dev/null +++ b/lib/typescript/hooks/useBottomSheetDynamicSnapPoints.d.ts @@ -0,0 +1,29 @@ +/// +/** + * Provides dynamic content height calculating functionalities, by + * replacing the placeholder `CONTENT_HEIGHT` with calculated layout. + * @example + * [0, 'CONTENT_HEIGHT', '100%'] + * @param initialSnapPoints your snap point with content height placeholder. + * @returns { + * - animatedSnapPoints: an animated snap points to be set on `BottomSheet` or `BottomSheetModal`. + * - animatedHandleHeight: an animated handle height callback node to be set on `BottomSheet` or `BottomSheetModal`. + * - animatedContentHeight: an animated content height callback node to be set on `BottomSheet` or `BottomSheetModal`. + * - handleContentLayout: a `onLayout` callback method to be set on `BottomSheetView` component. + * } + * @deprecated will be deprecated in the next major release! please use the new introduce prop `enableDynamicSizing`. + */ +export declare const useBottomSheetDynamicSnapPoints: (initialSnapPoints: Array) => { + animatedSnapPoints: Readonly<{ + value: (string | number)[]; + }>; + animatedHandleHeight: import("react-native-reanimated").SharedValue; + animatedContentHeight: import("react-native-reanimated").SharedValue; + handleContentLayout: ({ nativeEvent: { layout: { height }, }, }: { + nativeEvent: { + layout: { + height: number; + }; + }; + }) => void; +}; diff --git a/lib/typescript/hooks/useBottomSheetGestureHandlers.d.ts b/lib/typescript/hooks/useBottomSheetGestureHandlers.d.ts new file mode 100644 index 000000000..3e101b681 --- /dev/null +++ b/lib/typescript/hooks/useBottomSheetGestureHandlers.d.ts @@ -0,0 +1 @@ +export declare const useBottomSheetGestureHandlers: () => import("../contexts/gesture").BottomSheetGestureHandlersContextType; diff --git a/lib/typescript/hooks/useBottomSheetInternal.d.ts b/lib/typescript/hooks/useBottomSheetInternal.d.ts new file mode 100644 index 000000000..b0f278645 --- /dev/null +++ b/lib/typescript/hooks/useBottomSheetInternal.d.ts @@ -0,0 +1,3 @@ +import { BottomSheetInternalContextType } from '../contexts/internal'; +export declare function useBottomSheetInternal(unsafe?: false): BottomSheetInternalContextType; +export declare function useBottomSheetInternal(unsafe: true): BottomSheetInternalContextType | null; diff --git a/lib/typescript/hooks/useBottomSheetModal.d.ts b/lib/typescript/hooks/useBottomSheetModal.d.ts new file mode 100644 index 000000000..25ddcfd2e --- /dev/null +++ b/lib/typescript/hooks/useBottomSheetModal.d.ts @@ -0,0 +1 @@ +export declare const useBottomSheetModal: () => import("../contexts/modal/external").BottomSheetModalContextType; diff --git a/lib/typescript/hooks/useBottomSheetModalInternal.d.ts b/lib/typescript/hooks/useBottomSheetModalInternal.d.ts new file mode 100644 index 000000000..fc6511e91 --- /dev/null +++ b/lib/typescript/hooks/useBottomSheetModalInternal.d.ts @@ -0,0 +1,3 @@ +import { BottomSheetModalInternalContextType } from '../contexts'; +export declare function useBottomSheetModalInternal(unsafe?: false): BottomSheetModalInternalContextType; +export declare function useBottomSheetModalInternal(unsafe: true): BottomSheetModalInternalContextType | null; diff --git a/lib/typescript/hooks/useBottomSheetSpringConfigs.d.ts b/lib/typescript/hooks/useBottomSheetSpringConfigs.d.ts new file mode 100644 index 000000000..4c6f55160 --- /dev/null +++ b/lib/typescript/hooks/useBottomSheetSpringConfigs.d.ts @@ -0,0 +1,6 @@ +import type { WithSpringConfig } from 'react-native-reanimated'; +/** + * Generate spring animation configs. + * @param configs overridable configs. + */ +export declare const useBottomSheetSpringConfigs: (configs: Omit) => Omit; diff --git a/lib/typescript/hooks/useBottomSheetTimingConfigs.d.ts b/lib/typescript/hooks/useBottomSheetTimingConfigs.d.ts new file mode 100644 index 000000000..0a4a2bff5 --- /dev/null +++ b/lib/typescript/hooks/useBottomSheetTimingConfigs.d.ts @@ -0,0 +1,9 @@ +import type { WithTimingConfig } from 'react-native-reanimated'; +/** + * Generate timing animation configs. + * @default + * - easing: Easing.out(Easing.exp) + * - duration 250 + * @param configs overridable configs. + */ +export declare const useBottomSheetTimingConfigs: (configs: WithTimingConfig) => WithTimingConfig; diff --git a/lib/typescript/hooks/useGestureEventsHandlersDefault.d.ts b/lib/typescript/hooks/useGestureEventsHandlersDefault.d.ts new file mode 100644 index 000000000..86b8e7ef9 --- /dev/null +++ b/lib/typescript/hooks/useGestureEventsHandlersDefault.d.ts @@ -0,0 +1,2 @@ +import type { GestureEventsHandlersHookType } from '../types'; +export declare const useGestureEventsHandlersDefault: GestureEventsHandlersHookType; diff --git a/lib/typescript/hooks/useGestureHandler.d.ts b/lib/typescript/hooks/useGestureHandler.d.ts new file mode 100644 index 000000000..4139eeca6 --- /dev/null +++ b/lib/typescript/hooks/useGestureHandler.d.ts @@ -0,0 +1,5 @@ +import Animated from 'react-native-reanimated'; +import { State, PanGestureHandlerGestureEvent } from 'react-native-gesture-handler'; +import { GESTURE_SOURCE } from '../constants'; +import type { GestureEventHandlerCallbackType } from '../types'; +export declare const useGestureHandler: (type: GESTURE_SOURCE, state: Animated.SharedValue, gestureSource: Animated.SharedValue, handleOnStart: GestureEventHandlerCallbackType, handleOnActive: GestureEventHandlerCallbackType, handleOnEnd: GestureEventHandlerCallbackType) => (event: PanGestureHandlerGestureEvent) => void; diff --git a/lib/typescript/hooks/useKeyboard.d.ts b/lib/typescript/hooks/useKeyboard.d.ts new file mode 100644 index 000000000..0b8a7b71f --- /dev/null +++ b/lib/typescript/hooks/useKeyboard.d.ts @@ -0,0 +1,10 @@ +/// +import { KeyboardEventEasing } from 'react-native'; +import { KEYBOARD_STATE } from '../constants'; +export declare const useKeyboard: () => { + state: import("react-native-reanimated").SharedValue; + height: import("react-native-reanimated").SharedValue; + animationEasing: import("react-native-reanimated").SharedValue; + animationDuration: import("react-native-reanimated").SharedValue; + shouldHandleKeyboardEvents: import("react-native-reanimated").SharedValue; +}; diff --git a/lib/typescript/hooks/useNormalizedSnapPoints.d.ts b/lib/typescript/hooks/useNormalizedSnapPoints.d.ts new file mode 100644 index 000000000..a39f96d7b --- /dev/null +++ b/lib/typescript/hooks/useNormalizedSnapPoints.d.ts @@ -0,0 +1,14 @@ +import Animated from 'react-native-reanimated'; +import type { BottomSheetProps } from '../components/bottomSheet'; +/** + * Convert percentage snap points to pixels in screen and calculate + * the accurate snap points positions. + * @param snapPoints provided snap points. + * @param containerHeight BottomSheetContainer height. + * @param contentHeight content size. + * @param handleHeight handle size. + * @param enableDynamicSizing + * @param maxDynamicContentSize + * @returns {Animated.SharedValue} + */ +export declare const useNormalizedSnapPoints: (snapPoints: BottomSheetProps['snapPoints'], containerHeight: Animated.SharedValue, contentHeight: Animated.SharedValue, handleHeight: Animated.SharedValue, enableDynamicSizing: BottomSheetProps['enableDynamicSizing'], maxDynamicContentSize: BottomSheetProps['maxDynamicContentSize']) => Readonly>; diff --git a/lib/typescript/hooks/usePropsValidator.d.ts b/lib/typescript/hooks/usePropsValidator.d.ts new file mode 100644 index 000000000..c4c52504f --- /dev/null +++ b/lib/typescript/hooks/usePropsValidator.d.ts @@ -0,0 +1,6 @@ +import type { BottomSheetProps } from '../components/bottomSheet'; +/** + * @todo + * replace this with `prop-types`. + */ +export declare const usePropsValidator: ({ index, snapPoints, enableDynamicSizing, topInset, bottomInset, }: BottomSheetProps) => void; diff --git a/lib/typescript/hooks/useReactiveSharedValue.d.ts b/lib/typescript/hooks/useReactiveSharedValue.d.ts new file mode 100644 index 000000000..dc907a513 --- /dev/null +++ b/lib/typescript/hooks/useReactiveSharedValue.d.ts @@ -0,0 +1,3 @@ +import Animated from 'react-native-reanimated'; +import type { Primitive } from '../types'; +export declare const useReactiveSharedValue: (value: T) => T extends Primitive ? Animated.SharedValue : T; diff --git a/lib/typescript/hooks/useScrollEventsHandlersDefault.d.ts b/lib/typescript/hooks/useScrollEventsHandlersDefault.d.ts new file mode 100644 index 000000000..7509b0992 --- /dev/null +++ b/lib/typescript/hooks/useScrollEventsHandlersDefault.d.ts @@ -0,0 +1,6 @@ +import type { ScrollEventsHandlersHookType } from '../types'; +export declare type ScrollEventContextType = { + initialContentOffsetY: number; + shouldLockInitialPosition: boolean; +}; +export declare const useScrollEventsHandlersDefault: ScrollEventsHandlersHookType; diff --git a/lib/typescript/hooks/useScrollHandler.d.ts b/lib/typescript/hooks/useScrollHandler.d.ts new file mode 100644 index 000000000..f33479f40 --- /dev/null +++ b/lib/typescript/hooks/useScrollHandler.d.ts @@ -0,0 +1,8 @@ +/// +/// +import type { Scrollable, ScrollableEvent } from '../types'; +export declare const useScrollHandler: (useScrollEventsHandlers?: import("../types").ScrollEventsHandlersHookType, onScroll?: ScrollableEvent | undefined, onScrollBeginDrag?: ScrollableEvent | undefined, onScrollEndDrag?: ScrollableEvent | undefined) => { + scrollHandler: (event: import("react-native").NativeSyntheticEvent) => void; + scrollableRef: import("react").RefObject; + scrollableContentOffsetY: import("react-native-reanimated").SharedValue; +}; diff --git a/lib/typescript/hooks/useScrollable.d.ts b/lib/typescript/hooks/useScrollable.d.ts new file mode 100644 index 000000000..006906f8b --- /dev/null +++ b/lib/typescript/hooks/useScrollable.d.ts @@ -0,0 +1,13 @@ +/// +import { RefObject } from 'react'; +import { SCROLLABLE_STATE, SCROLLABLE_TYPE } from '../constants'; +import type { ScrollableRef, Scrollable } from '../types'; +export declare const useScrollable: () => { + scrollableRef: RefObject; + animatedScrollableType: import("react-native-reanimated").SharedValue; + animatedScrollableContentOffsetY: import("react-native-reanimated").SharedValue; + animatedScrollableOverrideState: import("react-native-reanimated").SharedValue; + isScrollableRefreshable: import("react-native-reanimated").SharedValue; + setScrollableRef: (ref: ScrollableRef) => void; + removeScrollableRef: (ref: RefObject) => void; +}; diff --git a/lib/typescript/hooks/useScrollableSetter.d.ts b/lib/typescript/hooks/useScrollableSetter.d.ts new file mode 100644 index 000000000..18dabef22 --- /dev/null +++ b/lib/typescript/hooks/useScrollableSetter.d.ts @@ -0,0 +1,5 @@ +import React from 'react'; +import Animated from 'react-native-reanimated'; +import { SCROLLABLE_TYPE } from '../constants'; +import type { Scrollable } from '../types'; +export declare const useScrollableSetter: (ref: React.RefObject, type: SCROLLABLE_TYPE, contentOffsetY: Animated.SharedValue, refreshable: boolean, useFocusHook?: typeof React.useEffect) => void; diff --git a/lib/typescript/hooks/useStableCallback.d.ts b/lib/typescript/hooks/useStableCallback.d.ts new file mode 100644 index 000000000..92d4f1f74 --- /dev/null +++ b/lib/typescript/hooks/useStableCallback.d.ts @@ -0,0 +1,7 @@ +declare type Callback = (...args: any[]) => any; +/** + * Provide a stable version of useCallback + * https://gist.github.com/JakeCoxon/c7ebf6e6496f8468226fd36b596e1985 + */ +export declare const useStableCallback: (callback: Callback) => (...args: any) => any; +export {}; diff --git a/lib/typescript/index.d.ts b/lib/typescript/index.d.ts new file mode 100644 index 000000000..de0359718 --- /dev/null +++ b/lib/typescript/index.d.ts @@ -0,0 +1,35 @@ +export { default } from './components/bottomSheet'; +export { default as BottomSheetModal } from './components/bottomSheetModal'; +export { default as BottomSheetModalProvider } from './components/bottomSheetModalProvider'; +export { useBottomSheet } from './hooks/useBottomSheet'; +export { useBottomSheetModal } from './hooks/useBottomSheetModal'; +export { useBottomSheetSpringConfigs } from './hooks/useBottomSheetSpringConfigs'; +export { useBottomSheetTimingConfigs } from './hooks/useBottomSheetTimingConfigs'; +export { useBottomSheetInternal } from './hooks/useBottomSheetInternal'; +export { useBottomSheetModalInternal } from './hooks/useBottomSheetModalInternal'; +export { useBottomSheetDynamicSnapPoints } from './hooks/useBottomSheetDynamicSnapPoints'; +export { useScrollEventsHandlersDefault } from './hooks/useScrollEventsHandlersDefault'; +export { useGestureEventsHandlersDefault } from './hooks/useGestureEventsHandlersDefault'; +export { useBottomSheetGestureHandlers } from './hooks/useBottomSheetGestureHandlers'; +export { useScrollHandler } from './hooks/useScrollHandler'; +export { useScrollableSetter } from './hooks/useScrollableSetter'; +export { BottomSheetScrollView, BottomSheetSectionList, BottomSheetFlatList, BottomSheetVirtualizedList, } from './components/bottomSheetScrollable'; +export { default as BottomSheetHandle } from './components/bottomSheetHandle'; +export { default as BottomSheetDraggableView } from './components/bottomSheetDraggableView'; +export { default as BottomSheetView } from './components/bottomSheetView'; +export { default as BottomSheetTextInput } from './components/bottomSheetTextInput'; +export { default as BottomSheetBackdrop } from './components/bottomSheetBackdrop'; +export { default as BottomSheetFooter } from './components/bottomSheetFooter'; +export { default as BottomSheetFooterContainer } from './components/bottomSheetFooterContainer/BottomSheetFooterContainer'; +export declare const TouchableHighlight: typeof import("react-native").TouchableHighlight, TouchableOpacity: typeof import("react-native").TouchableOpacity, TouchableWithoutFeedback: typeof import("react-native").TouchableWithoutFeedback; +export { createBottomSheetScrollableComponent } from './components/bottomSheetScrollable'; +export type { BottomSheetProps } from './components/bottomSheet'; +export type { BottomSheetModalProps } from './components/bottomSheetModal'; +export type { BottomSheetHandleProps } from './components/bottomSheetHandle'; +export type { BottomSheetBackgroundProps } from './components/bottomSheetBackground'; +export type { BottomSheetBackdropProps } from './components/bottomSheetBackdrop'; +export type { BottomSheetFooterProps } from './components/bottomSheetFooter'; +export type { BottomSheetFlatListMethods, BottomSheetScrollViewMethods, BottomSheetSectionListMethods, BottomSheetVirtualizedListMethods, BottomSheetScrollableProps, } from './components/bottomSheetScrollable'; +export type { ScrollEventsHandlersHookType, GestureEventsHandlersHookType, ScrollEventHandlerCallbackType, GestureEventHandlerCallbackType, } from './types'; +export * from './constants'; +export { enableLogging } from './utilities/logger'; diff --git a/lib/typescript/types.d.ts b/lib/typescript/types.d.ts new file mode 100644 index 000000000..803ac5097 --- /dev/null +++ b/lib/typescript/types.d.ts @@ -0,0 +1,165 @@ +import type React from 'react'; +import type { + FlatList, + ScrollView, + SectionList, + NativeScrollEvent, + NativeSyntheticEvent, +} from 'react-native'; +import type { + GestureEventPayload, + PanGestureHandlerEventPayload, +} from 'react-native-gesture-handler'; +import type { + SharedValue, + WithSpringConfig, + WithTimingConfig, +} from 'react-native-reanimated'; +import type { GESTURE_SOURCE } from './constants'; + +//#region Methods +export interface BottomSheetMethods { + /** + * Snap to one of the provided points from `snapPoints`. + * @param index snap point index. + * @param animationConfigs snap animation configs. + * + * @see {WithSpringConfig} + * @see {WithTimingConfig} + */ + snapToIndex: ( + index: number, + animationConfigs?: WithSpringConfig | WithTimingConfig + ) => void; + /** + * Snap to a position out of provided `snapPoints`. + * @param position position in pixel or percentage. + * @param animationConfigs snap animation configs. + * + * @see {WithSpringConfig} + * @see {WithTimingConfig} + */ + snapToPosition: ( + position: number | string, + animationConfigs?: WithSpringConfig | WithTimingConfig + ) => void; + /** + * Snap to the maximum provided point from `snapPoints`. + * @param animationConfigs snap animation configs. + * + * @see {WithSpringConfig} + * @see {WithTimingConfig} + */ + expand: (animationConfigs?: WithSpringConfig | WithTimingConfig) => void; + /** + * Snap to the minimum provided point from `snapPoints`. + * @param animationConfigs snap animation configs. + * + * @see {WithSpringConfig} + * @see {WithTimingConfig} + */ + collapse: (animationConfigs?: WithSpringConfig | WithTimingConfig) => void; + /** + * Close the bottom sheet. + * @param animationConfigs snap animation configs. + * + * @see {WithSpringConfig} + * @see {WithTimingConfig} + */ + close: (animationConfigs?: WithSpringConfig | WithTimingConfig) => void; + /** + * Force close the bottom sheet, this prevent any interruptions till the sheet is closed. + * @param animationConfigs snap animation configs. + * + * @see {WithSpringConfig} + * @see {WithTimingConfig} + */ + forceClose: (animationConfigs?: WithSpringConfig | WithTimingConfig) => void; +} +export interface BottomSheetModalMethods extends BottomSheetMethods { + /** + * Mount and present the bottom sheet modal to the initial snap point. + * @param data to be passed to the modal. + */ + present: (data?: any) => void; + /** + * Close and unmount the bottom sheet modal. + * @param animationConfigs snap animation configs. + * + * @see {WithSpringConfig} + * @see {WithTimingConfig} + */ + dismiss: (animationConfigs?: WithSpringConfig | WithTimingConfig) => void; +} +//#endregion + +export interface BottomSheetVariables { + /** + * Current sheet position index. + * @type SharedValue + */ + animatedIndex: SharedValue; + /** + * Current sheet position. + * @type SharedValue + */ + animatedPosition: SharedValue; +} + +//#region scrollables +export type Scrollable = FlatList | ScrollView | SectionList; +export type ScrollableRef = { + id: number; + node: React.RefObject; +}; +export type ScrollableEvent = ( + event: Pick, 'nativeEvent'> +) => void; +//#endregion + +//#region utils +export type Primitive = string | number | boolean; +export interface Insets { + top: number; + bottom: number; + left: number; + right: number; +} +//#endregion + +//#region hooks +export type GestureEventPayloadType = GestureEventPayload & + PanGestureHandlerEventPayload; + +export type GestureEventContextType = { + didStart?: boolean; +}; + +export type GestureEventHandlerCallbackType = ( + source: GESTURE_SOURCE, + payload: GestureEventPayloadType, + context: C +) => void; + +export type GestureEventsHandlersHookType = () => { + handleOnStart: GestureEventHandlerCallbackType; + handleOnActive: GestureEventHandlerCallbackType; + handleOnEnd: GestureEventHandlerCallbackType; +}; + +type ScrollEventHandlerCallbackType = ( + payload: NativeScrollEvent, + context: C +) => void; + +export type ScrollEventsHandlersHookType = ( + ref: React.RefObject, + contentOffsetY: SharedValue +) => { + handleOnScroll?: ScrollEventHandlerCallbackType; + handleOnBeginDrag?: ScrollEventHandlerCallbackType; + handleOnEndDrag?: ScrollEventHandlerCallbackType; + handleOnMomentumBegin?: ScrollEventHandlerCallbackType; + handleOnMomentumEnd?: ScrollEventHandlerCallbackType; +}; +//#endregion diff --git a/lib/typescript/utilities/animate.d.ts b/lib/typescript/utilities/animate.d.ts new file mode 100644 index 000000000..2657d12a9 --- /dev/null +++ b/lib/typescript/utilities/animate.d.ts @@ -0,0 +1,9 @@ +import { WithSpringConfig, WithTimingConfig, AnimationCallback } from 'react-native-reanimated'; +interface AnimateParams { + point: number; + velocity?: number; + configs?: WithSpringConfig | WithTimingConfig; + onComplete?: AnimationCallback; +} +export declare const animate: ({ point, configs, velocity, onComplete, }: AnimateParams) => number; +export {}; diff --git a/lib/typescript/utilities/clamp.d.ts b/lib/typescript/utilities/clamp.d.ts new file mode 100644 index 000000000..23e0f07c0 --- /dev/null +++ b/lib/typescript/utilities/clamp.d.ts @@ -0,0 +1 @@ +export declare const clamp: (value: number, lowerBound: number, upperBound: number) => number; diff --git a/lib/typescript/utilities/easingExp.d.ts b/lib/typescript/utilities/easingExp.d.ts new file mode 100644 index 000000000..717ba69de --- /dev/null +++ b/lib/typescript/utilities/easingExp.d.ts @@ -0,0 +1,7 @@ +/** + * A modified version of the default AnimatedEasing.exp, + * to insure its value never goes below `0`. + * @see https://github.com/software-mansion/react-native-reanimated/issues/1610 + * @param t number + */ +export declare const exp: (t: number) => number; diff --git a/lib/typescript/utilities/getKeyboardAnimationConfigs.d.ts b/lib/typescript/utilities/getKeyboardAnimationConfigs.d.ts new file mode 100644 index 000000000..d9fcd5454 --- /dev/null +++ b/lib/typescript/utilities/getKeyboardAnimationConfigs.d.ts @@ -0,0 +1,20 @@ +import type { KeyboardEventEasing } from 'react-native'; +export declare const getKeyboardAnimationConfigs: (easing: KeyboardEventEasing, duration: number) => { + easing: (value: number) => number; + duration: number; + damping?: undefined; + stiffness?: undefined; + mass?: undefined; + overshootClamping?: undefined; + restDisplacementThreshold?: undefined; + restSpeedThreshold?: undefined; +} | { + damping: number; + stiffness: number; + mass: number; + overshootClamping: boolean; + restDisplacementThreshold: number; + restSpeedThreshold: number; + easing?: undefined; + duration?: undefined; +}; diff --git a/lib/typescript/utilities/getRefNativeTag.d.ts b/lib/typescript/utilities/getRefNativeTag.d.ts new file mode 100644 index 000000000..691c489b5 --- /dev/null +++ b/lib/typescript/utilities/getRefNativeTag.d.ts @@ -0,0 +1 @@ +export declare function getRefNativeTag(ref: unknown): number; diff --git a/lib/typescript/utilities/id.d.ts b/lib/typescript/utilities/id.d.ts new file mode 100644 index 000000000..9e9ac9216 --- /dev/null +++ b/lib/typescript/utilities/id.d.ts @@ -0,0 +1 @@ +export declare const id: () => number; diff --git a/lib/typescript/utilities/index.d.ts b/lib/typescript/utilities/index.d.ts new file mode 100644 index 000000000..a50b4da63 --- /dev/null +++ b/lib/typescript/utilities/index.d.ts @@ -0,0 +1,5 @@ +export { normalizeSnapPoint } from './normalizeSnapPoint'; +export { animate } from './animate'; +export { getKeyboardAnimationConfigs } from './getKeyboardAnimationConfigs'; +export { print } from './logger'; +export { noop, workletNoop } from './noop'; diff --git a/lib/typescript/utilities/logger.d.ts b/lib/typescript/utilities/logger.d.ts new file mode 100644 index 000000000..ac1a2af97 --- /dev/null +++ b/lib/typescript/utilities/logger.d.ts @@ -0,0 +1,9 @@ +interface PrintOptions { + component?: string; + method?: string; + params?: Record | string | number | boolean; +} +declare type Print = (options: PrintOptions) => void; +declare const enableLogging: () => void; +declare let print: Print; +export { print, enableLogging }; diff --git a/lib/typescript/utilities/noop.d.ts b/lib/typescript/utilities/noop.d.ts new file mode 100644 index 000000000..00569af52 --- /dev/null +++ b/lib/typescript/utilities/noop.d.ts @@ -0,0 +1,3 @@ +declare const workletNoop: () => void; +declare const noop: () => void; +export { noop, workletNoop }; diff --git a/lib/typescript/utilities/normalizeSnapPoint.d.ts b/lib/typescript/utilities/normalizeSnapPoint.d.ts new file mode 100644 index 000000000..03dbc29cd --- /dev/null +++ b/lib/typescript/utilities/normalizeSnapPoint.d.ts @@ -0,0 +1,4 @@ +/** + * Converts a snap point to fixed numbers. + */ +export declare const normalizeSnapPoint: (snapPoint: number | string, containerHeight: number) => number; diff --git a/lib/typescript/utilities/snapPoint.d.ts b/lib/typescript/utilities/snapPoint.d.ts new file mode 100644 index 000000000..bb7a8c3ca --- /dev/null +++ b/lib/typescript/utilities/snapPoint.d.ts @@ -0,0 +1 @@ +export declare const snapPoint: (value: number, velocity: number, points: ReadonlyArray) => number; diff --git a/lib/typescript/utilities/validateSnapPoint.d.ts b/lib/typescript/utilities/validateSnapPoint.d.ts new file mode 100644 index 000000000..b24411781 --- /dev/null +++ b/lib/typescript/utilities/validateSnapPoint.d.ts @@ -0,0 +1 @@ +export declare const validateSnapPoint: (snapPoint: any) => void; From ed7d8205edc5b925932477e008ccc25c322272b1 Mon Sep 17 00:00:00 2001 From: MoritzCooks Date: Tue, 5 Dec 2023 10:57:38 +0100 Subject: [PATCH 3/3] Revert "fix(BottomSheetContainer): upload lib" This reverts commit 5ab27b636019056d8342a24cde94ff467481d6d8. --- .gitignore | 2 +- .../components/bottomSheet/BottomSheet.js | 1160 ----------------- .../components/bottomSheet/BottomSheet.js.map | 1 - .../components/bottomSheet/constants.js | 52 - .../components/bottomSheet/constants.js.map | 1 - lib/commonjs/components/bottomSheet/index.js | 16 - .../components/bottomSheet/index.js.map | 1 - lib/commonjs/components/bottomSheet/styles.js | 25 - .../components/bottomSheet/styles.js.map | 1 - .../BottomSheetBackdrop.js | 108 -- .../BottomSheetBackdrop.js.map | 1 - .../bottomSheetBackdrop/constants.js | 17 - .../bottomSheetBackdrop/constants.js.map | 1 - .../components/bottomSheetBackdrop/index.js | 16 - .../bottomSheetBackdrop/index.js.map | 1 - .../components/bottomSheetBackdrop/styles.js | 17 - .../bottomSheetBackdrop/styles.js.map | 1 - .../BottomSheetBackdropContainer.js | 32 - .../BottomSheetBackdropContainer.js.map | 1 - .../bottomSheetBackdropContainer/index.js | 16 - .../bottomSheetBackdropContainer/index.js.map | 1 - .../bottomSheetBackdropContainer/styles.js | 21 - .../styles.js.map | 1 - .../BottomSheetBackground.js | 33 - .../BottomSheetBackground.js.map | 1 - .../components/bottomSheetBackground/index.js | 16 - .../bottomSheetBackground/index.js.map | 1 - .../bottomSheetBackground/styles.js | 18 - .../bottomSheetBackground/styles.js.map | 1 - .../BottomSheetBackgroundContainer.js | 42 - .../BottomSheetBackgroundContainer.js.map | 1 - .../bottomSheetBackgroundContainer/index.js | 16 - .../index.js.map | 1 - .../bottomSheetBackgroundContainer/styles.js | 21 - .../styles.js.map | 1 - .../BottomSheetContainer.js | 85 -- .../BottomSheetContainer.js.map | 1 - .../components/bottomSheetContainer/index.js | 16 - .../bottomSheetContainer/index.js.map | 1 - .../components/bottomSheetContainer/styles.js | 16 - .../bottomSheetContainer/styles.js.map | 1 - .../bottomSheetContainer/styles.web.js | 22 - .../bottomSheetContainer/styles.web.js.map | 1 - .../BottomSheetDraggableView.js | 94 -- .../BottomSheetDraggableView.js.map | 1 - .../bottomSheetDraggableView/index.js | 16 - .../bottomSheetDraggableView/index.js.map | 1 - .../bottomSheetFooter/BottomSheetFooter.js | 75 -- .../BottomSheetFooter.js.map | 1 - .../components/bottomSheetFooter/index.js | 16 - .../components/bottomSheetFooter/index.js.map | 1 - .../components/bottomSheetFooter/styles.js | 21 - .../bottomSheetFooter/styles.js.map | 1 - .../BottomSheetFooterContainer.js | 55 - .../BottomSheetFooterContainer.js.map | 1 - .../BottomSheetGestureHandlersProvider.js | 60 - .../BottomSheetGestureHandlersProvider.js.map | 1 - .../index.js | 16 - .../index.js.map | 1 - .../bottomSheetHandle/BottomSheetHandle.js | 40 - .../BottomSheetHandle.js.map | 1 - .../components/bottomSheetHandle/index.js | 16 - .../components/bottomSheetHandle/index.js.map | 1 - .../components/bottomSheetHandle/styles.js | 26 - .../bottomSheetHandle/styles.js.map | 1 - .../BottomSheetHandleContainer.js | 117 -- .../BottomSheetHandleContainer.js.map | 1 - .../bottomSheetHandleContainer/index.js | 16 - .../bottomSheetHandleContainer/index.js.map | 1 - .../bottomSheetModal/BottomSheetModal.js | 384 ------ .../bottomSheetModal/BottomSheetModal.js.map | 1 - .../components/bottomSheetModal/constants.js | 11 - .../bottomSheetModal/constants.js.map | 1 - .../components/bottomSheetModal/index.js | 16 - .../components/bottomSheetModal/index.js.map | 1 - .../BottomSheetModalProvider.js | 198 --- .../BottomSheetModalProvider.js.map | 1 - .../bottomSheetModalProvider/index.js | 16 - .../bottomSheetModalProvider/index.js.map | 1 - .../BottomSheetRefreshControl.android.js | 53 - .../BottomSheetRefreshControl.android.js.map | 1 - .../BottomSheetRefreshControl.js | 11 - .../BottomSheetRefreshControl.js.map | 1 - .../bottomSheetRefreshControl/index.js | 14 - .../bottomSheetRefreshControl/index.js.map | 1 - .../BottomSheetFlatList.js | 27 - .../BottomSheetFlatList.js.map | 1 - .../BottomSheetScrollView.js | 27 - .../BottomSheetScrollView.js.map | 1 - .../BottomSheetSectionList.js | 27 - .../BottomSheetSectionList.js.map | 1 - .../BottomSheetVirtualizedList.js | 27 - .../BottomSheetVirtualizedList.js.map | 1 - .../createBottomSheetScrollableComponent.js | 163 --- ...reateBottomSheetScrollableComponent.js.map | 1 - .../components/bottomSheetScrollable/index.js | 48 - .../bottomSheetScrollable/index.js.map | 1 - .../bottomSheetScrollable/styles.js | 18 - .../bottomSheetScrollable/styles.js.map | 1 - .../BottomSheetTextInput.js | 62 - .../BottomSheetTextInput.js.map | 1 - .../components/bottomSheetTextInput/index.js | 16 - .../bottomSheetTextInput/index.js.map | 1 - .../components/bottomSheetTextInput/types.js | 6 - .../bottomSheetTextInput/types.js.map | 1 - .../bottomSheetView/BottomSheetView.js | 91 -- .../bottomSheetView/BottomSheetView.js.map | 1 - .../components/bottomSheetView/index.js | 16 - .../components/bottomSheetView/index.js.map | 1 - .../components/bottomSheetView/styles.js | 16 - .../components/bottomSheetView/styles.js.map | 1 - .../components/touchables/Touchables.ios.js | 26 - .../touchables/Touchables.ios.js.map | 1 - .../components/touchables/Touchables.js | 26 - .../components/touchables/Touchables.js.map | 1 - lib/commonjs/components/touchables/index.js | 16 - .../components/touchables/index.js.map | 1 - lib/commonjs/constants.js | 161 --- lib/commonjs/constants.js.map | 1 - lib/commonjs/contexts/external.js | 14 - lib/commonjs/contexts/external.js.map | 1 - lib/commonjs/contexts/gesture.js | 12 - lib/commonjs/contexts/gesture.js.map | 1 - lib/commonjs/contexts/index.js | 70 - lib/commonjs/contexts/index.js.map | 1 - lib/commonjs/contexts/internal.js | 14 - lib/commonjs/contexts/internal.js.map | 1 - lib/commonjs/contexts/modal/external.js | 14 - lib/commonjs/contexts/modal/external.js.map | 1 - lib/commonjs/contexts/modal/internal.js | 14 - lib/commonjs/contexts/modal/internal.js.map | 1 - lib/commonjs/hooks/index.js | 134 -- lib/commonjs/hooks/index.js.map | 1 - lib/commonjs/hooks/useBottomSheet.js | 23 - lib/commonjs/hooks/useBottomSheet.js.map | 1 - .../hooks/useBottomSheetDynamicSnapPoints.js | 64 - .../useBottomSheetDynamicSnapPoints.js.map | 1 - .../hooks/useBottomSheetGestureHandlers.js | 23 - .../useBottomSheetGestureHandlers.js.map | 1 - lib/commonjs/hooks/useBottomSheetInternal.js | 21 - .../hooks/useBottomSheetInternal.js.map | 1 - lib/commonjs/hooks/useBottomSheetModal.js | 23 - lib/commonjs/hooks/useBottomSheetModal.js.map | 1 - .../hooks/useBottomSheetModalInternal.js | 21 - .../hooks/useBottomSheetModalInternal.js.map | 1 - .../hooks/useBottomSheetSpringConfigs.js | 19 - .../hooks/useBottomSheetSpringConfigs.js.map | 1 - .../hooks/useBottomSheetTimingConfigs.js | 30 - .../hooks/useBottomSheetTimingConfigs.js.map | 1 - .../hooks/useGestureEventsHandlersDefault.js | 258 ---- .../useGestureEventsHandlersDefault.js.map | 1 - lib/commonjs/hooks/useGestureHandler.js | 82 -- lib/commonjs/hooks/useGestureHandler.js.map | 1 - lib/commonjs/hooks/useKeyboard.js | 100 -- lib/commonjs/hooks/useKeyboard.js.map | 1 - lib/commonjs/hooks/useNormalizedSnapPoints.js | 58 - .../hooks/useNormalizedSnapPoints.js.map | 1 - lib/commonjs/hooks/usePropsValidator.js | 53 - lib/commonjs/hooks/usePropsValidator.js.map | 1 - lib/commonjs/hooks/useReactiveSharedValue.js | 55 - .../hooks/useReactiveSharedValue.js.map | 1 - .../hooks/useScrollEventsHandlersDefault.js | 111 -- .../useScrollEventsHandlersDefault.js.map | 1 - lib/commonjs/hooks/useScrollHandler.js | 67 - lib/commonjs/hooks/useScrollHandler.js.map | 1 - lib/commonjs/hooks/useScrollable.js | 79 -- lib/commonjs/hooks/useScrollable.js.map | 1 - lib/commonjs/hooks/useScrollableSetter.js | 52 - lib/commonjs/hooks/useScrollableSetter.js.map | 1 - lib/commonjs/hooks/useStableCallback.js | 25 - lib/commonjs/hooks/useStableCallback.js.map | 1 - lib/commonjs/index.js | 290 ----- lib/commonjs/index.js.map | 1 - lib/commonjs/utilities/animate.js | 37 - lib/commonjs/utilities/animate.js.map | 1 - lib/commonjs/utilities/clamp.js | 15 - lib/commonjs/utilities/clamp.js.map | 1 - lib/commonjs/utilities/easingExp.js | 21 - lib/commonjs/utilities/easingExp.js.map | 1 - .../utilities/getKeyboardAnimationConfigs.js | 51 - .../getKeyboardAnimationConfigs.js.map | 1 - lib/commonjs/utilities/getRefNativeTag.js | 45 - lib/commonjs/utilities/getRefNativeTag.js.map | 1 - lib/commonjs/utilities/id.js | 15 - lib/commonjs/utilities/id.js.map | 1 - lib/commonjs/utilities/index.js | 52 - lib/commonjs/utilities/index.js.map | 1 - lib/commonjs/utilities/logger.js | 48 - lib/commonjs/utilities/logger.js.map | 1 - lib/commonjs/utilities/noop.js | 17 - lib/commonjs/utilities/noop.js.map | 1 - lib/commonjs/utilities/normalizeSnapPoint.js | 24 - .../utilities/normalizeSnapPoint.js.map | 1 - lib/commonjs/utilities/snapPoint.js | 18 - lib/commonjs/utilities/snapPoint.js.map | 1 - lib/commonjs/utilities/validateSnapPoint.js | 19 - .../utilities/validateSnapPoint.js.map | 1 - .../components/bottomSheet/BottomSheet.js | 1127 ---------------- .../components/bottomSheet/BottomSheet.js.map | 1 - .../components/bottomSheet/constants.js | 30 - .../components/bottomSheet/constants.js.map | 1 - lib/module/components/bottomSheet/index.js | 2 - .../components/bottomSheet/index.js.map | 1 - lib/module/components/bottomSheet/styles.js | 15 - .../components/bottomSheet/styles.js.map | 1 - .../BottomSheetBackdrop.js | 91 -- .../BottomSheetBackdrop.js.map | 1 - .../bottomSheetBackdrop/constants.js | 7 - .../bottomSheetBackdrop/constants.js.map | 1 - .../components/bottomSheetBackdrop/index.js | 2 - .../bottomSheetBackdrop/index.js.map | 1 - .../components/bottomSheetBackdrop/styles.js | 7 - .../bottomSheetBackdrop/styles.js.map | 1 - .../BottomSheetBackdropContainer.js | 19 - .../BottomSheetBackdropContainer.js.map | 1 - .../bottomSheetBackdropContainer/index.js | 2 - .../bottomSheetBackdropContainer/index.js.map | 1 - .../bottomSheetBackdropContainer/styles.js | 11 - .../styles.js.map | 1 - .../BottomSheetBackground.js | 19 - .../BottomSheetBackground.js.map | 1 - .../components/bottomSheetBackground/index.js | 2 - .../bottomSheetBackground/index.js.map | 1 - .../bottomSheetBackground/styles.js | 8 - .../bottomSheetBackground/styles.js.map | 1 - .../BottomSheetBackgroundContainer.js | 25 - .../BottomSheetBackgroundContainer.js.map | 1 - .../bottomSheetBackgroundContainer/index.js | 2 - .../index.js.map | 1 - .../bottomSheetBackgroundContainer/styles.js | 11 - .../styles.js.map | 1 - .../BottomSheetContainer.js | 69 - .../BottomSheetContainer.js.map | 1 - .../components/bottomSheetContainer/index.js | 2 - .../bottomSheetContainer/index.js.map | 1 - .../components/bottomSheetContainer/styles.js | 6 - .../bottomSheetContainer/styles.js.map | 1 - .../bottomSheetContainer/styles.web.js | 12 - .../bottomSheetContainer/styles.web.js.map | 1 - .../BottomSheetDraggableView.js | 76 -- .../BottomSheetDraggableView.js.map | 1 - .../bottomSheetDraggableView/index.js | 2 - .../bottomSheetDraggableView/index.js.map | 1 - .../bottomSheetFooter/BottomSheetFooter.js | 59 - .../BottomSheetFooter.js.map | 1 - .../components/bottomSheetFooter/index.js | 2 - .../components/bottomSheetFooter/index.js.map | 1 - .../components/bottomSheetFooter/styles.js | 11 - .../bottomSheetFooter/styles.js.map | 1 - .../BottomSheetFooterContainer.js | 40 - .../BottomSheetFooterContainer.js.map | 1 - .../BottomSheetGestureHandlersProvider.js | 44 - .../BottomSheetGestureHandlersProvider.js.map | 1 - .../index.js | 2 - .../index.js.map | 1 - .../bottomSheetHandle/BottomSheetHandle.js | 24 - .../BottomSheetHandle.js.map | 1 - .../components/bottomSheetHandle/index.js | 2 - .../components/bottomSheetHandle/index.js.map | 1 - .../components/bottomSheetHandle/styles.js | 15 - .../bottomSheetHandle/styles.js.map | 1 - .../BottomSheetHandleContainer.js | 98 -- .../BottomSheetHandleContainer.js.map | 1 - .../bottomSheetHandleContainer/index.js | 2 - .../bottomSheetHandleContainer/index.js.map | 1 - .../bottomSheetModal/BottomSheetModal.js | 363 ------ .../bottomSheetModal/BottomSheetModal.js.map | 1 - .../components/bottomSheetModal/constants.js | 4 - .../bottomSheetModal/constants.js.map | 1 - .../components/bottomSheetModal/index.js | 2 - .../components/bottomSheetModal/index.js.map | 1 - .../BottomSheetModalProvider.js | 178 --- .../BottomSheetModalProvider.js.map | 1 - .../bottomSheetModalProvider/index.js | 2 - .../bottomSheetModalProvider/index.js.map | 1 - .../BottomSheetRefreshControl.android.js | 34 - .../BottomSheetRefreshControl.android.js.map | 1 - .../BottomSheetRefreshControl.js | 2 - .../BottomSheetRefreshControl.js.map | 1 - .../bottomSheetRefreshControl/index.js | 3 - .../bottomSheetRefreshControl/index.js.map | 1 - .../BottomSheetFlatList.js | 11 - .../BottomSheetFlatList.js.map | 1 - .../BottomSheetScrollView.js | 11 - .../BottomSheetScrollView.js.map | 1 - .../BottomSheetSectionList.js | 11 - .../BottomSheetSectionList.js.map | 1 - .../BottomSheetVirtualizedList.js | 11 - .../BottomSheetVirtualizedList.js.map | 1 - .../createBottomSheetScrollableComponent.js | 140 -- ...reateBottomSheetScrollableComponent.js.map | 1 - .../components/bottomSheetScrollable/index.js | 6 - .../bottomSheetScrollable/index.js.map | 1 - .../bottomSheetScrollable/styles.js | 8 - .../bottomSheetScrollable/styles.js.map | 1 - .../BottomSheetTextInput.js | 47 - .../BottomSheetTextInput.js.map | 1 - .../components/bottomSheetTextInput/index.js | 2 - .../bottomSheetTextInput/index.js.map | 1 - .../components/bottomSheetTextInput/types.js | 2 - .../bottomSheetTextInput/types.js.map | 1 - .../bottomSheetView/BottomSheetView.js | 73 -- .../bottomSheetView/BottomSheetView.js.map | 1 - .../components/bottomSheetView/index.js | 2 - .../components/bottomSheetView/index.js.map | 1 - .../components/bottomSheetView/styles.js | 6 - .../components/bottomSheetView/styles.js.map | 1 - .../components/touchables/Touchables.ios.js | 2 - .../touchables/Touchables.ios.js.map | 1 - .../components/touchables/Touchables.js | 2 - .../components/touchables/Touchables.js.map | 1 - lib/module/components/touchables/index.js | 8 - lib/module/components/touchables/index.js.map | 1 - lib/module/constants.js | 128 -- lib/module/constants.js.map | 1 - lib/module/contexts/external.js | 4 - lib/module/contexts/external.js.map | 1 - lib/module/contexts/gesture.js | 3 - lib/module/contexts/gesture.js.map | 1 - lib/module/contexts/index.js | 6 - lib/module/contexts/index.js.map | 1 - lib/module/contexts/internal.js | 4 - lib/module/contexts/internal.js.map | 1 - lib/module/contexts/modal/external.js | 4 - lib/module/contexts/modal/external.js.map | 1 - lib/module/contexts/modal/internal.js | 4 - lib/module/contexts/modal/internal.js.map | 1 - lib/module/hooks/index.js | 21 - lib/module/hooks/index.js.map | 1 - lib/module/hooks/useBottomSheet.js | 12 - lib/module/hooks/useBottomSheet.js.map | 1 - .../hooks/useBottomSheetDynamicSnapPoints.js | 53 - .../useBottomSheetDynamicSnapPoints.js.map | 1 - .../hooks/useBottomSheetGestureHandlers.js | 12 - .../useBottomSheetGestureHandlers.js.map | 1 - lib/module/hooks/useBottomSheetInternal.js | 12 - .../hooks/useBottomSheetInternal.js.map | 1 - lib/module/hooks/useBottomSheetModal.js | 12 - lib/module/hooks/useBottomSheetModal.js.map | 1 - .../hooks/useBottomSheetModalInternal.js | 12 - .../hooks/useBottomSheetModalInternal.js.map | 1 - .../hooks/useBottomSheetSpringConfigs.js | 10 - .../hooks/useBottomSheetSpringConfigs.js.map | 1 - .../hooks/useBottomSheetTimingConfigs.js | 20 - .../hooks/useBottomSheetTimingConfigs.js.map | 1 - .../hooks/useGestureEventsHandlersDefault.js | 242 ---- .../useGestureEventsHandlersDefault.js.map | 1 - lib/module/hooks/useGestureHandler.js | 71 - lib/module/hooks/useGestureHandler.js.map | 1 - lib/module/hooks/useKeyboard.js | 84 -- lib/module/hooks/useKeyboard.js.map | 1 - lib/module/hooks/useNormalizedSnapPoints.js | 47 - .../hooks/useNormalizedSnapPoints.js.map | 1 - lib/module/hooks/usePropsValidator.js | 40 - lib/module/hooks/usePropsValidator.js.map | 1 - lib/module/hooks/useReactiveSharedValue.js | 44 - .../hooks/useReactiveSharedValue.js.map | 1 - .../hooks/useScrollEventsHandlersDefault.js | 99 -- .../useScrollEventsHandlersDefault.js.map | 1 - lib/module/hooks/useScrollHandler.js | 55 - lib/module/hooks/useScrollHandler.js.map | 1 - lib/module/hooks/useScrollable.js | 66 - lib/module/hooks/useScrollable.js.map | 1 - lib/module/hooks/useScrollableSetter.js | 40 - lib/module/hooks/useScrollableSetter.js.map | 1 - lib/module/hooks/useStableCallback.js | 16 - lib/module/hooks/useStableCallback.js.map | 1 - lib/module/index.js | 44 - lib/module/index.js.map | 1 - lib/module/utilities/animate.js | 26 - lib/module/utilities/animate.js.map | 1 - lib/module/utilities/clamp.js | 6 - lib/module/utilities/clamp.js.map | 1 - lib/module/utilities/easingExp.js | 12 - lib/module/utilities/easingExp.js.map | 1 - .../utilities/getKeyboardAnimationConfigs.js | 41 - .../getKeyboardAnimationConfigs.js.map | 1 - lib/module/utilities/getRefNativeTag.js | 38 - lib/module/utilities/getRefNativeTag.js.map | 1 - lib/module/utilities/id.js | 6 - lib/module/utilities/id.js.map | 1 - lib/module/utilities/index.js | 6 - lib/module/utilities/index.js.map | 1 - lib/module/utilities/logger.js | 39 - lib/module/utilities/logger.js.map | 1 - lib/module/utilities/noop.js | 8 - lib/module/utilities/noop.js.map | 1 - lib/module/utilities/normalizeSnapPoint.js | 15 - .../utilities/normalizeSnapPoint.js.map | 1 - lib/module/utilities/snapPoint.js | 9 - lib/module/utilities/snapPoint.js.map | 1 - lib/module/utilities/validateSnapPoint.js | 7 - lib/module/utilities/validateSnapPoint.js.map | 1 - .../components/bottomSheet/BottomSheet.d.ts | 6 - .../components/bottomSheet/constants.d.ts | 23 - .../components/bottomSheet/index.d.ts | 2 - .../components/bottomSheet/styles.d.ts | 13 - .../components/bottomSheet/types.d.ts | 334 ----- .../BottomSheetBackdrop.d.ts | 4 - .../bottomSheetBackdrop/constants.d.ts | 6 - .../components/bottomSheetBackdrop/index.d.ts | 2 - .../bottomSheetBackdrop/styles.d.ts | 5 - .../components/bottomSheetBackdrop/types.d.ts | 53 - .../BottomSheetBackdropContainer.d.ts | 4 - .../bottomSheetBackdropContainer/index.d.ts | 1 - .../bottomSheetBackdropContainer/styles.d.ts | 9 - .../bottomSheetBackdropContainer/types.d.ts | 6 - .../BottomSheetBackground.d.ts | 4 - .../bottomSheetBackground/index.d.ts | 2 - .../bottomSheetBackground/styles.d.ts | 6 - .../bottomSheetBackground/types.d.ts | 6 - .../BottomSheetBackgroundContainer.d.ts | 4 - .../bottomSheetBackgroundContainer/index.d.ts | 1 - .../styles.d.ts | 9 - .../bottomSheetBackgroundContainer/types.d.ts | 6 - .../BottomSheetContainer.d.ts | 5 - .../bottomSheetContainer/index.d.ts | 2 - .../bottomSheetContainer/styles.d.ts | 9 - .../bottomSheetContainer/styles.web.d.ts | 10 - .../bottomSheetContainer/types.d.ts | 15 - .../BottomSheetDraggableView.d.ts | 4 - .../bottomSheetDraggableView/index.d.ts | 1 - .../bottomSheetDraggableView/types.d.ts | 17 - .../bottomSheetFooter/BottomSheetFooter.d.ts | 5 - .../components/bottomSheetFooter/index.d.ts | 2 - .../components/bottomSheetFooter/styles.d.ts | 9 - .../components/bottomSheetFooter/types.d.ts | 37 - .../BottomSheetFooterContainer.d.ts | 4 - .../bottomSheetFooterContainer/types.d.ts | 4 - .../BottomSheetGestureHandlersProvider.d.ts | 3 - .../index.d.ts | 1 - .../types.d.ts | 7 - .../bottomSheetHandle/BottomSheetHandle.d.ts | 4 - .../components/bottomSheetHandle/index.d.ts | 2 - .../components/bottomSheetHandle/styles.d.ts | 12 - .../components/bottomSheetHandle/types.d.ts | 27 - .../BottomSheetHandleContainer.d.ts | 5 - .../bottomSheetHandleContainer/index.d.ts | 1 - .../bottomSheetHandleContainer/types.d.ts | 25 - .../bottomSheetModal/BottomSheetModal.d.ts | 6 - .../bottomSheetModal/constants.d.ts | 3 - .../components/bottomSheetModal/index.d.ts | 2 - .../components/bottomSheetModal/types.d.ts | 61 - .../BottomSheetModalProvider.d.ts | 3 - .../bottomSheetModalProvider/index.d.ts | 1 - .../bottomSheetModalProvider/types.d.ts | 14 - .../BottomSheetRefreshControl.android.d.ts | 4 - .../BottomSheetRefreshControl.d.ts | 2 - .../bottomSheetRefreshControl/index.d.ts | 7 - .../BottomSheetFlatList.d.ts | 5 - .../BottomSheetScrollView.d.ts | 5 - .../BottomSheetSectionList.d.ts | 6 - .../BottomSheetVirtualizedList.d.ts | 5 - .../createBottomSheetScrollableComponent.d.ts | 3 - .../bottomSheetScrollable/index.d.ts | 6 - .../bottomSheetScrollable/styles.d.ts | 6 - .../bottomSheetScrollable/types.d.ts | 276 ---- .../BottomSheetTextInput.d.ts | 4 - .../bottomSheetTextInput/index.d.ts | 2 - .../bottomSheetTextInput/types.d.ts | 3 - .../bottomSheetView/BottomSheetView.d.ts | 5 - .../components/bottomSheetView/index.d.ts | 1 - .../components/bottomSheetView/styles.d.ts | 3 - .../components/bottomSheetView/types.d.ts | 24 - .../components/touchables/Touchables.d.ts | 1 - .../components/touchables/Touchables.ios.d.ts | 1 - .../components/touchables/index.d.ts | 7 - lib/typescript/constants.d.ts | 90 -- lib/typescript/contexts/external.d.ts | 4 - lib/typescript/contexts/gesture.d.ts | 8 - lib/typescript/contexts/index.d.ts | 6 - lib/typescript/contexts/internal.d.ts | 38 - lib/typescript/contexts/modal/external.d.ts | 7 - lib/typescript/contexts/modal/internal.d.ts | 14 - lib/typescript/hooks/index.d.ts | 16 - lib/typescript/hooks/useBottomSheet.d.ts | 1 - .../useBottomSheetDynamicSnapPoints.d.ts | 29 - .../hooks/useBottomSheetGestureHandlers.d.ts | 1 - .../hooks/useBottomSheetInternal.d.ts | 3 - lib/typescript/hooks/useBottomSheetModal.d.ts | 1 - .../hooks/useBottomSheetModalInternal.d.ts | 3 - .../hooks/useBottomSheetSpringConfigs.d.ts | 6 - .../hooks/useBottomSheetTimingConfigs.d.ts | 9 - .../useGestureEventsHandlersDefault.d.ts | 2 - lib/typescript/hooks/useGestureHandler.d.ts | 5 - lib/typescript/hooks/useKeyboard.d.ts | 10 - .../hooks/useNormalizedSnapPoints.d.ts | 14 - lib/typescript/hooks/usePropsValidator.d.ts | 6 - .../hooks/useReactiveSharedValue.d.ts | 3 - .../hooks/useScrollEventsHandlersDefault.d.ts | 6 - lib/typescript/hooks/useScrollHandler.d.ts | 8 - lib/typescript/hooks/useScrollable.d.ts | 13 - lib/typescript/hooks/useScrollableSetter.d.ts | 5 - lib/typescript/hooks/useStableCallback.d.ts | 7 - lib/typescript/index.d.ts | 35 - lib/typescript/types.d.ts | 165 --- lib/typescript/utilities/animate.d.ts | 9 - lib/typescript/utilities/clamp.d.ts | 1 - lib/typescript/utilities/easingExp.d.ts | 7 - .../getKeyboardAnimationConfigs.d.ts | 20 - lib/typescript/utilities/getRefNativeTag.d.ts | 1 - lib/typescript/utilities/id.d.ts | 1 - lib/typescript/utilities/index.d.ts | 5 - lib/typescript/utilities/logger.d.ts | 9 - lib/typescript/utilities/noop.d.ts | 3 - .../utilities/normalizeSnapPoint.d.ts | 4 - lib/typescript/utilities/snapPoint.d.ts | 1 - .../utilities/validateSnapPoint.d.ts | 1 - 508 files changed, 1 insertion(+), 12008 deletions(-) delete mode 100644 lib/commonjs/components/bottomSheet/BottomSheet.js delete mode 100644 lib/commonjs/components/bottomSheet/BottomSheet.js.map delete mode 100644 lib/commonjs/components/bottomSheet/constants.js delete mode 100644 lib/commonjs/components/bottomSheet/constants.js.map delete mode 100644 lib/commonjs/components/bottomSheet/index.js delete mode 100644 lib/commonjs/components/bottomSheet/index.js.map delete mode 100644 lib/commonjs/components/bottomSheet/styles.js delete mode 100644 lib/commonjs/components/bottomSheet/styles.js.map delete mode 100644 lib/commonjs/components/bottomSheetBackdrop/BottomSheetBackdrop.js delete mode 100644 lib/commonjs/components/bottomSheetBackdrop/BottomSheetBackdrop.js.map delete mode 100644 lib/commonjs/components/bottomSheetBackdrop/constants.js delete mode 100644 lib/commonjs/components/bottomSheetBackdrop/constants.js.map delete mode 100644 lib/commonjs/components/bottomSheetBackdrop/index.js delete mode 100644 lib/commonjs/components/bottomSheetBackdrop/index.js.map delete mode 100644 lib/commonjs/components/bottomSheetBackdrop/styles.js delete mode 100644 lib/commonjs/components/bottomSheetBackdrop/styles.js.map delete mode 100644 lib/commonjs/components/bottomSheetBackdropContainer/BottomSheetBackdropContainer.js delete mode 100644 lib/commonjs/components/bottomSheetBackdropContainer/BottomSheetBackdropContainer.js.map delete mode 100644 lib/commonjs/components/bottomSheetBackdropContainer/index.js delete mode 100644 lib/commonjs/components/bottomSheetBackdropContainer/index.js.map delete mode 100644 lib/commonjs/components/bottomSheetBackdropContainer/styles.js delete mode 100644 lib/commonjs/components/bottomSheetBackdropContainer/styles.js.map delete mode 100644 lib/commonjs/components/bottomSheetBackground/BottomSheetBackground.js delete mode 100644 lib/commonjs/components/bottomSheetBackground/BottomSheetBackground.js.map delete mode 100644 lib/commonjs/components/bottomSheetBackground/index.js delete mode 100644 lib/commonjs/components/bottomSheetBackground/index.js.map delete mode 100644 lib/commonjs/components/bottomSheetBackground/styles.js delete mode 100644 lib/commonjs/components/bottomSheetBackground/styles.js.map delete mode 100644 lib/commonjs/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.js delete mode 100644 lib/commonjs/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.js.map delete mode 100644 lib/commonjs/components/bottomSheetBackgroundContainer/index.js delete mode 100644 lib/commonjs/components/bottomSheetBackgroundContainer/index.js.map delete mode 100644 lib/commonjs/components/bottomSheetBackgroundContainer/styles.js delete mode 100644 lib/commonjs/components/bottomSheetBackgroundContainer/styles.js.map delete mode 100644 lib/commonjs/components/bottomSheetContainer/BottomSheetContainer.js delete mode 100644 lib/commonjs/components/bottomSheetContainer/BottomSheetContainer.js.map delete mode 100644 lib/commonjs/components/bottomSheetContainer/index.js delete mode 100644 lib/commonjs/components/bottomSheetContainer/index.js.map delete mode 100644 lib/commonjs/components/bottomSheetContainer/styles.js delete mode 100644 lib/commonjs/components/bottomSheetContainer/styles.js.map delete mode 100644 lib/commonjs/components/bottomSheetContainer/styles.web.js delete mode 100644 lib/commonjs/components/bottomSheetContainer/styles.web.js.map delete mode 100644 lib/commonjs/components/bottomSheetDraggableView/BottomSheetDraggableView.js delete mode 100644 lib/commonjs/components/bottomSheetDraggableView/BottomSheetDraggableView.js.map delete mode 100644 lib/commonjs/components/bottomSheetDraggableView/index.js delete mode 100644 lib/commonjs/components/bottomSheetDraggableView/index.js.map delete mode 100644 lib/commonjs/components/bottomSheetFooter/BottomSheetFooter.js delete mode 100644 lib/commonjs/components/bottomSheetFooter/BottomSheetFooter.js.map delete mode 100644 lib/commonjs/components/bottomSheetFooter/index.js delete mode 100644 lib/commonjs/components/bottomSheetFooter/index.js.map delete mode 100644 lib/commonjs/components/bottomSheetFooter/styles.js delete mode 100644 lib/commonjs/components/bottomSheetFooter/styles.js.map delete mode 100644 lib/commonjs/components/bottomSheetFooterContainer/BottomSheetFooterContainer.js delete mode 100644 lib/commonjs/components/bottomSheetFooterContainer/BottomSheetFooterContainer.js.map delete mode 100644 lib/commonjs/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.js delete mode 100644 lib/commonjs/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.js.map delete mode 100644 lib/commonjs/components/bottomSheetGestureHandlersProvider/index.js delete mode 100644 lib/commonjs/components/bottomSheetGestureHandlersProvider/index.js.map delete mode 100644 lib/commonjs/components/bottomSheetHandle/BottomSheetHandle.js delete mode 100644 lib/commonjs/components/bottomSheetHandle/BottomSheetHandle.js.map delete mode 100644 lib/commonjs/components/bottomSheetHandle/index.js delete mode 100644 lib/commonjs/components/bottomSheetHandle/index.js.map delete mode 100644 lib/commonjs/components/bottomSheetHandle/styles.js delete mode 100644 lib/commonjs/components/bottomSheetHandle/styles.js.map delete mode 100644 lib/commonjs/components/bottomSheetHandleContainer/BottomSheetHandleContainer.js delete mode 100644 lib/commonjs/components/bottomSheetHandleContainer/BottomSheetHandleContainer.js.map delete mode 100644 lib/commonjs/components/bottomSheetHandleContainer/index.js delete mode 100644 lib/commonjs/components/bottomSheetHandleContainer/index.js.map delete mode 100644 lib/commonjs/components/bottomSheetModal/BottomSheetModal.js delete mode 100644 lib/commonjs/components/bottomSheetModal/BottomSheetModal.js.map delete mode 100644 lib/commonjs/components/bottomSheetModal/constants.js delete mode 100644 lib/commonjs/components/bottomSheetModal/constants.js.map delete mode 100644 lib/commonjs/components/bottomSheetModal/index.js delete mode 100644 lib/commonjs/components/bottomSheetModal/index.js.map delete mode 100644 lib/commonjs/components/bottomSheetModalProvider/BottomSheetModalProvider.js delete mode 100644 lib/commonjs/components/bottomSheetModalProvider/BottomSheetModalProvider.js.map delete mode 100644 lib/commonjs/components/bottomSheetModalProvider/index.js delete mode 100644 lib/commonjs/components/bottomSheetModalProvider/index.js.map delete mode 100644 lib/commonjs/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.js delete mode 100644 lib/commonjs/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.js.map delete mode 100644 lib/commonjs/components/bottomSheetRefreshControl/BottomSheetRefreshControl.js delete mode 100644 lib/commonjs/components/bottomSheetRefreshControl/BottomSheetRefreshControl.js.map delete mode 100644 lib/commonjs/components/bottomSheetRefreshControl/index.js delete mode 100644 lib/commonjs/components/bottomSheetRefreshControl/index.js.map delete mode 100644 lib/commonjs/components/bottomSheetScrollable/BottomSheetFlatList.js delete mode 100644 lib/commonjs/components/bottomSheetScrollable/BottomSheetFlatList.js.map delete mode 100644 lib/commonjs/components/bottomSheetScrollable/BottomSheetScrollView.js delete mode 100644 lib/commonjs/components/bottomSheetScrollable/BottomSheetScrollView.js.map delete mode 100644 lib/commonjs/components/bottomSheetScrollable/BottomSheetSectionList.js delete mode 100644 lib/commonjs/components/bottomSheetScrollable/BottomSheetSectionList.js.map delete mode 100644 lib/commonjs/components/bottomSheetScrollable/BottomSheetVirtualizedList.js delete mode 100644 lib/commonjs/components/bottomSheetScrollable/BottomSheetVirtualizedList.js.map delete mode 100644 lib/commonjs/components/bottomSheetScrollable/createBottomSheetScrollableComponent.js delete mode 100644 lib/commonjs/components/bottomSheetScrollable/createBottomSheetScrollableComponent.js.map delete mode 100644 lib/commonjs/components/bottomSheetScrollable/index.js delete mode 100644 lib/commonjs/components/bottomSheetScrollable/index.js.map delete mode 100644 lib/commonjs/components/bottomSheetScrollable/styles.js delete mode 100644 lib/commonjs/components/bottomSheetScrollable/styles.js.map delete mode 100644 lib/commonjs/components/bottomSheetTextInput/BottomSheetTextInput.js delete mode 100644 lib/commonjs/components/bottomSheetTextInput/BottomSheetTextInput.js.map delete mode 100644 lib/commonjs/components/bottomSheetTextInput/index.js delete mode 100644 lib/commonjs/components/bottomSheetTextInput/index.js.map delete mode 100644 lib/commonjs/components/bottomSheetTextInput/types.js delete mode 100644 lib/commonjs/components/bottomSheetTextInput/types.js.map delete mode 100644 lib/commonjs/components/bottomSheetView/BottomSheetView.js delete mode 100644 lib/commonjs/components/bottomSheetView/BottomSheetView.js.map delete mode 100644 lib/commonjs/components/bottomSheetView/index.js delete mode 100644 lib/commonjs/components/bottomSheetView/index.js.map delete mode 100644 lib/commonjs/components/bottomSheetView/styles.js delete mode 100644 lib/commonjs/components/bottomSheetView/styles.js.map delete mode 100644 lib/commonjs/components/touchables/Touchables.ios.js delete mode 100644 lib/commonjs/components/touchables/Touchables.ios.js.map delete mode 100644 lib/commonjs/components/touchables/Touchables.js delete mode 100644 lib/commonjs/components/touchables/Touchables.js.map delete mode 100644 lib/commonjs/components/touchables/index.js delete mode 100644 lib/commonjs/components/touchables/index.js.map delete mode 100644 lib/commonjs/constants.js delete mode 100644 lib/commonjs/constants.js.map delete mode 100644 lib/commonjs/contexts/external.js delete mode 100644 lib/commonjs/contexts/external.js.map delete mode 100644 lib/commonjs/contexts/gesture.js delete mode 100644 lib/commonjs/contexts/gesture.js.map delete mode 100644 lib/commonjs/contexts/index.js delete mode 100644 lib/commonjs/contexts/index.js.map delete mode 100644 lib/commonjs/contexts/internal.js delete mode 100644 lib/commonjs/contexts/internal.js.map delete mode 100644 lib/commonjs/contexts/modal/external.js delete mode 100644 lib/commonjs/contexts/modal/external.js.map delete mode 100644 lib/commonjs/contexts/modal/internal.js delete mode 100644 lib/commonjs/contexts/modal/internal.js.map delete mode 100644 lib/commonjs/hooks/index.js delete mode 100644 lib/commonjs/hooks/index.js.map delete mode 100644 lib/commonjs/hooks/useBottomSheet.js delete mode 100644 lib/commonjs/hooks/useBottomSheet.js.map delete mode 100644 lib/commonjs/hooks/useBottomSheetDynamicSnapPoints.js delete mode 100644 lib/commonjs/hooks/useBottomSheetDynamicSnapPoints.js.map delete mode 100644 lib/commonjs/hooks/useBottomSheetGestureHandlers.js delete mode 100644 lib/commonjs/hooks/useBottomSheetGestureHandlers.js.map delete mode 100644 lib/commonjs/hooks/useBottomSheetInternal.js delete mode 100644 lib/commonjs/hooks/useBottomSheetInternal.js.map delete mode 100644 lib/commonjs/hooks/useBottomSheetModal.js delete mode 100644 lib/commonjs/hooks/useBottomSheetModal.js.map delete mode 100644 lib/commonjs/hooks/useBottomSheetModalInternal.js delete mode 100644 lib/commonjs/hooks/useBottomSheetModalInternal.js.map delete mode 100644 lib/commonjs/hooks/useBottomSheetSpringConfigs.js delete mode 100644 lib/commonjs/hooks/useBottomSheetSpringConfigs.js.map delete mode 100644 lib/commonjs/hooks/useBottomSheetTimingConfigs.js delete mode 100644 lib/commonjs/hooks/useBottomSheetTimingConfigs.js.map delete mode 100644 lib/commonjs/hooks/useGestureEventsHandlersDefault.js delete mode 100644 lib/commonjs/hooks/useGestureEventsHandlersDefault.js.map delete mode 100644 lib/commonjs/hooks/useGestureHandler.js delete mode 100644 lib/commonjs/hooks/useGestureHandler.js.map delete mode 100644 lib/commonjs/hooks/useKeyboard.js delete mode 100644 lib/commonjs/hooks/useKeyboard.js.map delete mode 100644 lib/commonjs/hooks/useNormalizedSnapPoints.js delete mode 100644 lib/commonjs/hooks/useNormalizedSnapPoints.js.map delete mode 100644 lib/commonjs/hooks/usePropsValidator.js delete mode 100644 lib/commonjs/hooks/usePropsValidator.js.map delete mode 100644 lib/commonjs/hooks/useReactiveSharedValue.js delete mode 100644 lib/commonjs/hooks/useReactiveSharedValue.js.map delete mode 100644 lib/commonjs/hooks/useScrollEventsHandlersDefault.js delete mode 100644 lib/commonjs/hooks/useScrollEventsHandlersDefault.js.map delete mode 100644 lib/commonjs/hooks/useScrollHandler.js delete mode 100644 lib/commonjs/hooks/useScrollHandler.js.map delete mode 100644 lib/commonjs/hooks/useScrollable.js delete mode 100644 lib/commonjs/hooks/useScrollable.js.map delete mode 100644 lib/commonjs/hooks/useScrollableSetter.js delete mode 100644 lib/commonjs/hooks/useScrollableSetter.js.map delete mode 100644 lib/commonjs/hooks/useStableCallback.js delete mode 100644 lib/commonjs/hooks/useStableCallback.js.map delete mode 100644 lib/commonjs/index.js delete mode 100644 lib/commonjs/index.js.map delete mode 100644 lib/commonjs/utilities/animate.js delete mode 100644 lib/commonjs/utilities/animate.js.map delete mode 100644 lib/commonjs/utilities/clamp.js delete mode 100644 lib/commonjs/utilities/clamp.js.map delete mode 100644 lib/commonjs/utilities/easingExp.js delete mode 100644 lib/commonjs/utilities/easingExp.js.map delete mode 100644 lib/commonjs/utilities/getKeyboardAnimationConfigs.js delete mode 100644 lib/commonjs/utilities/getKeyboardAnimationConfigs.js.map delete mode 100644 lib/commonjs/utilities/getRefNativeTag.js delete mode 100644 lib/commonjs/utilities/getRefNativeTag.js.map delete mode 100644 lib/commonjs/utilities/id.js delete mode 100644 lib/commonjs/utilities/id.js.map delete mode 100644 lib/commonjs/utilities/index.js delete mode 100644 lib/commonjs/utilities/index.js.map delete mode 100644 lib/commonjs/utilities/logger.js delete mode 100644 lib/commonjs/utilities/logger.js.map delete mode 100644 lib/commonjs/utilities/noop.js delete mode 100644 lib/commonjs/utilities/noop.js.map delete mode 100644 lib/commonjs/utilities/normalizeSnapPoint.js delete mode 100644 lib/commonjs/utilities/normalizeSnapPoint.js.map delete mode 100644 lib/commonjs/utilities/snapPoint.js delete mode 100644 lib/commonjs/utilities/snapPoint.js.map delete mode 100644 lib/commonjs/utilities/validateSnapPoint.js delete mode 100644 lib/commonjs/utilities/validateSnapPoint.js.map delete mode 100644 lib/module/components/bottomSheet/BottomSheet.js delete mode 100644 lib/module/components/bottomSheet/BottomSheet.js.map delete mode 100644 lib/module/components/bottomSheet/constants.js delete mode 100644 lib/module/components/bottomSheet/constants.js.map delete mode 100644 lib/module/components/bottomSheet/index.js delete mode 100644 lib/module/components/bottomSheet/index.js.map delete mode 100644 lib/module/components/bottomSheet/styles.js delete mode 100644 lib/module/components/bottomSheet/styles.js.map delete mode 100644 lib/module/components/bottomSheetBackdrop/BottomSheetBackdrop.js delete mode 100644 lib/module/components/bottomSheetBackdrop/BottomSheetBackdrop.js.map delete mode 100644 lib/module/components/bottomSheetBackdrop/constants.js delete mode 100644 lib/module/components/bottomSheetBackdrop/constants.js.map delete mode 100644 lib/module/components/bottomSheetBackdrop/index.js delete mode 100644 lib/module/components/bottomSheetBackdrop/index.js.map delete mode 100644 lib/module/components/bottomSheetBackdrop/styles.js delete mode 100644 lib/module/components/bottomSheetBackdrop/styles.js.map delete mode 100644 lib/module/components/bottomSheetBackdropContainer/BottomSheetBackdropContainer.js delete mode 100644 lib/module/components/bottomSheetBackdropContainer/BottomSheetBackdropContainer.js.map delete mode 100644 lib/module/components/bottomSheetBackdropContainer/index.js delete mode 100644 lib/module/components/bottomSheetBackdropContainer/index.js.map delete mode 100644 lib/module/components/bottomSheetBackdropContainer/styles.js delete mode 100644 lib/module/components/bottomSheetBackdropContainer/styles.js.map delete mode 100644 lib/module/components/bottomSheetBackground/BottomSheetBackground.js delete mode 100644 lib/module/components/bottomSheetBackground/BottomSheetBackground.js.map delete mode 100644 lib/module/components/bottomSheetBackground/index.js delete mode 100644 lib/module/components/bottomSheetBackground/index.js.map delete mode 100644 lib/module/components/bottomSheetBackground/styles.js delete mode 100644 lib/module/components/bottomSheetBackground/styles.js.map delete mode 100644 lib/module/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.js delete mode 100644 lib/module/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.js.map delete mode 100644 lib/module/components/bottomSheetBackgroundContainer/index.js delete mode 100644 lib/module/components/bottomSheetBackgroundContainer/index.js.map delete mode 100644 lib/module/components/bottomSheetBackgroundContainer/styles.js delete mode 100644 lib/module/components/bottomSheetBackgroundContainer/styles.js.map delete mode 100644 lib/module/components/bottomSheetContainer/BottomSheetContainer.js delete mode 100644 lib/module/components/bottomSheetContainer/BottomSheetContainer.js.map delete mode 100644 lib/module/components/bottomSheetContainer/index.js delete mode 100644 lib/module/components/bottomSheetContainer/index.js.map delete mode 100644 lib/module/components/bottomSheetContainer/styles.js delete mode 100644 lib/module/components/bottomSheetContainer/styles.js.map delete mode 100644 lib/module/components/bottomSheetContainer/styles.web.js delete mode 100644 lib/module/components/bottomSheetContainer/styles.web.js.map delete mode 100644 lib/module/components/bottomSheetDraggableView/BottomSheetDraggableView.js delete mode 100644 lib/module/components/bottomSheetDraggableView/BottomSheetDraggableView.js.map delete mode 100644 lib/module/components/bottomSheetDraggableView/index.js delete mode 100644 lib/module/components/bottomSheetDraggableView/index.js.map delete mode 100644 lib/module/components/bottomSheetFooter/BottomSheetFooter.js delete mode 100644 lib/module/components/bottomSheetFooter/BottomSheetFooter.js.map delete mode 100644 lib/module/components/bottomSheetFooter/index.js delete mode 100644 lib/module/components/bottomSheetFooter/index.js.map delete mode 100644 lib/module/components/bottomSheetFooter/styles.js delete mode 100644 lib/module/components/bottomSheetFooter/styles.js.map delete mode 100644 lib/module/components/bottomSheetFooterContainer/BottomSheetFooterContainer.js delete mode 100644 lib/module/components/bottomSheetFooterContainer/BottomSheetFooterContainer.js.map delete mode 100644 lib/module/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.js delete mode 100644 lib/module/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.js.map delete mode 100644 lib/module/components/bottomSheetGestureHandlersProvider/index.js delete mode 100644 lib/module/components/bottomSheetGestureHandlersProvider/index.js.map delete mode 100644 lib/module/components/bottomSheetHandle/BottomSheetHandle.js delete mode 100644 lib/module/components/bottomSheetHandle/BottomSheetHandle.js.map delete mode 100644 lib/module/components/bottomSheetHandle/index.js delete mode 100644 lib/module/components/bottomSheetHandle/index.js.map delete mode 100644 lib/module/components/bottomSheetHandle/styles.js delete mode 100644 lib/module/components/bottomSheetHandle/styles.js.map delete mode 100644 lib/module/components/bottomSheetHandleContainer/BottomSheetHandleContainer.js delete mode 100644 lib/module/components/bottomSheetHandleContainer/BottomSheetHandleContainer.js.map delete mode 100644 lib/module/components/bottomSheetHandleContainer/index.js delete mode 100644 lib/module/components/bottomSheetHandleContainer/index.js.map delete mode 100644 lib/module/components/bottomSheetModal/BottomSheetModal.js delete mode 100644 lib/module/components/bottomSheetModal/BottomSheetModal.js.map delete mode 100644 lib/module/components/bottomSheetModal/constants.js delete mode 100644 lib/module/components/bottomSheetModal/constants.js.map delete mode 100644 lib/module/components/bottomSheetModal/index.js delete mode 100644 lib/module/components/bottomSheetModal/index.js.map delete mode 100644 lib/module/components/bottomSheetModalProvider/BottomSheetModalProvider.js delete mode 100644 lib/module/components/bottomSheetModalProvider/BottomSheetModalProvider.js.map delete mode 100644 lib/module/components/bottomSheetModalProvider/index.js delete mode 100644 lib/module/components/bottomSheetModalProvider/index.js.map delete mode 100644 lib/module/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.js delete mode 100644 lib/module/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.js.map delete mode 100644 lib/module/components/bottomSheetRefreshControl/BottomSheetRefreshControl.js delete mode 100644 lib/module/components/bottomSheetRefreshControl/BottomSheetRefreshControl.js.map delete mode 100644 lib/module/components/bottomSheetRefreshControl/index.js delete mode 100644 lib/module/components/bottomSheetRefreshControl/index.js.map delete mode 100644 lib/module/components/bottomSheetScrollable/BottomSheetFlatList.js delete mode 100644 lib/module/components/bottomSheetScrollable/BottomSheetFlatList.js.map delete mode 100644 lib/module/components/bottomSheetScrollable/BottomSheetScrollView.js delete mode 100644 lib/module/components/bottomSheetScrollable/BottomSheetScrollView.js.map delete mode 100644 lib/module/components/bottomSheetScrollable/BottomSheetSectionList.js delete mode 100644 lib/module/components/bottomSheetScrollable/BottomSheetSectionList.js.map delete mode 100644 lib/module/components/bottomSheetScrollable/BottomSheetVirtualizedList.js delete mode 100644 lib/module/components/bottomSheetScrollable/BottomSheetVirtualizedList.js.map delete mode 100644 lib/module/components/bottomSheetScrollable/createBottomSheetScrollableComponent.js delete mode 100644 lib/module/components/bottomSheetScrollable/createBottomSheetScrollableComponent.js.map delete mode 100644 lib/module/components/bottomSheetScrollable/index.js delete mode 100644 lib/module/components/bottomSheetScrollable/index.js.map delete mode 100644 lib/module/components/bottomSheetScrollable/styles.js delete mode 100644 lib/module/components/bottomSheetScrollable/styles.js.map delete mode 100644 lib/module/components/bottomSheetTextInput/BottomSheetTextInput.js delete mode 100644 lib/module/components/bottomSheetTextInput/BottomSheetTextInput.js.map delete mode 100644 lib/module/components/bottomSheetTextInput/index.js delete mode 100644 lib/module/components/bottomSheetTextInput/index.js.map delete mode 100644 lib/module/components/bottomSheetTextInput/types.js delete mode 100644 lib/module/components/bottomSheetTextInput/types.js.map delete mode 100644 lib/module/components/bottomSheetView/BottomSheetView.js delete mode 100644 lib/module/components/bottomSheetView/BottomSheetView.js.map delete mode 100644 lib/module/components/bottomSheetView/index.js delete mode 100644 lib/module/components/bottomSheetView/index.js.map delete mode 100644 lib/module/components/bottomSheetView/styles.js delete mode 100644 lib/module/components/bottomSheetView/styles.js.map delete mode 100644 lib/module/components/touchables/Touchables.ios.js delete mode 100644 lib/module/components/touchables/Touchables.ios.js.map delete mode 100644 lib/module/components/touchables/Touchables.js delete mode 100644 lib/module/components/touchables/Touchables.js.map delete mode 100644 lib/module/components/touchables/index.js delete mode 100644 lib/module/components/touchables/index.js.map delete mode 100644 lib/module/constants.js delete mode 100644 lib/module/constants.js.map delete mode 100644 lib/module/contexts/external.js delete mode 100644 lib/module/contexts/external.js.map delete mode 100644 lib/module/contexts/gesture.js delete mode 100644 lib/module/contexts/gesture.js.map delete mode 100644 lib/module/contexts/index.js delete mode 100644 lib/module/contexts/index.js.map delete mode 100644 lib/module/contexts/internal.js delete mode 100644 lib/module/contexts/internal.js.map delete mode 100644 lib/module/contexts/modal/external.js delete mode 100644 lib/module/contexts/modal/external.js.map delete mode 100644 lib/module/contexts/modal/internal.js delete mode 100644 lib/module/contexts/modal/internal.js.map delete mode 100644 lib/module/hooks/index.js delete mode 100644 lib/module/hooks/index.js.map delete mode 100644 lib/module/hooks/useBottomSheet.js delete mode 100644 lib/module/hooks/useBottomSheet.js.map delete mode 100644 lib/module/hooks/useBottomSheetDynamicSnapPoints.js delete mode 100644 lib/module/hooks/useBottomSheetDynamicSnapPoints.js.map delete mode 100644 lib/module/hooks/useBottomSheetGestureHandlers.js delete mode 100644 lib/module/hooks/useBottomSheetGestureHandlers.js.map delete mode 100644 lib/module/hooks/useBottomSheetInternal.js delete mode 100644 lib/module/hooks/useBottomSheetInternal.js.map delete mode 100644 lib/module/hooks/useBottomSheetModal.js delete mode 100644 lib/module/hooks/useBottomSheetModal.js.map delete mode 100644 lib/module/hooks/useBottomSheetModalInternal.js delete mode 100644 lib/module/hooks/useBottomSheetModalInternal.js.map delete mode 100644 lib/module/hooks/useBottomSheetSpringConfigs.js delete mode 100644 lib/module/hooks/useBottomSheetSpringConfigs.js.map delete mode 100644 lib/module/hooks/useBottomSheetTimingConfigs.js delete mode 100644 lib/module/hooks/useBottomSheetTimingConfigs.js.map delete mode 100644 lib/module/hooks/useGestureEventsHandlersDefault.js delete mode 100644 lib/module/hooks/useGestureEventsHandlersDefault.js.map delete mode 100644 lib/module/hooks/useGestureHandler.js delete mode 100644 lib/module/hooks/useGestureHandler.js.map delete mode 100644 lib/module/hooks/useKeyboard.js delete mode 100644 lib/module/hooks/useKeyboard.js.map delete mode 100644 lib/module/hooks/useNormalizedSnapPoints.js delete mode 100644 lib/module/hooks/useNormalizedSnapPoints.js.map delete mode 100644 lib/module/hooks/usePropsValidator.js delete mode 100644 lib/module/hooks/usePropsValidator.js.map delete mode 100644 lib/module/hooks/useReactiveSharedValue.js delete mode 100644 lib/module/hooks/useReactiveSharedValue.js.map delete mode 100644 lib/module/hooks/useScrollEventsHandlersDefault.js delete mode 100644 lib/module/hooks/useScrollEventsHandlersDefault.js.map delete mode 100644 lib/module/hooks/useScrollHandler.js delete mode 100644 lib/module/hooks/useScrollHandler.js.map delete mode 100644 lib/module/hooks/useScrollable.js delete mode 100644 lib/module/hooks/useScrollable.js.map delete mode 100644 lib/module/hooks/useScrollableSetter.js delete mode 100644 lib/module/hooks/useScrollableSetter.js.map delete mode 100644 lib/module/hooks/useStableCallback.js delete mode 100644 lib/module/hooks/useStableCallback.js.map delete mode 100644 lib/module/index.js delete mode 100644 lib/module/index.js.map delete mode 100644 lib/module/utilities/animate.js delete mode 100644 lib/module/utilities/animate.js.map delete mode 100644 lib/module/utilities/clamp.js delete mode 100644 lib/module/utilities/clamp.js.map delete mode 100644 lib/module/utilities/easingExp.js delete mode 100644 lib/module/utilities/easingExp.js.map delete mode 100644 lib/module/utilities/getKeyboardAnimationConfigs.js delete mode 100644 lib/module/utilities/getKeyboardAnimationConfigs.js.map delete mode 100644 lib/module/utilities/getRefNativeTag.js delete mode 100644 lib/module/utilities/getRefNativeTag.js.map delete mode 100644 lib/module/utilities/id.js delete mode 100644 lib/module/utilities/id.js.map delete mode 100644 lib/module/utilities/index.js delete mode 100644 lib/module/utilities/index.js.map delete mode 100644 lib/module/utilities/logger.js delete mode 100644 lib/module/utilities/logger.js.map delete mode 100644 lib/module/utilities/noop.js delete mode 100644 lib/module/utilities/noop.js.map delete mode 100644 lib/module/utilities/normalizeSnapPoint.js delete mode 100644 lib/module/utilities/normalizeSnapPoint.js.map delete mode 100644 lib/module/utilities/snapPoint.js delete mode 100644 lib/module/utilities/snapPoint.js.map delete mode 100644 lib/module/utilities/validateSnapPoint.js delete mode 100644 lib/module/utilities/validateSnapPoint.js.map delete mode 100644 lib/typescript/components/bottomSheet/BottomSheet.d.ts delete mode 100644 lib/typescript/components/bottomSheet/constants.d.ts delete mode 100644 lib/typescript/components/bottomSheet/index.d.ts delete mode 100644 lib/typescript/components/bottomSheet/styles.d.ts delete mode 100644 lib/typescript/components/bottomSheet/types.d.ts delete mode 100644 lib/typescript/components/bottomSheetBackdrop/BottomSheetBackdrop.d.ts delete mode 100644 lib/typescript/components/bottomSheetBackdrop/constants.d.ts delete mode 100644 lib/typescript/components/bottomSheetBackdrop/index.d.ts delete mode 100644 lib/typescript/components/bottomSheetBackdrop/styles.d.ts delete mode 100644 lib/typescript/components/bottomSheetBackdrop/types.d.ts delete mode 100644 lib/typescript/components/bottomSheetBackdropContainer/BottomSheetBackdropContainer.d.ts delete mode 100644 lib/typescript/components/bottomSheetBackdropContainer/index.d.ts delete mode 100644 lib/typescript/components/bottomSheetBackdropContainer/styles.d.ts delete mode 100644 lib/typescript/components/bottomSheetBackdropContainer/types.d.ts delete mode 100644 lib/typescript/components/bottomSheetBackground/BottomSheetBackground.d.ts delete mode 100644 lib/typescript/components/bottomSheetBackground/index.d.ts delete mode 100644 lib/typescript/components/bottomSheetBackground/styles.d.ts delete mode 100644 lib/typescript/components/bottomSheetBackground/types.d.ts delete mode 100644 lib/typescript/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.d.ts delete mode 100644 lib/typescript/components/bottomSheetBackgroundContainer/index.d.ts delete mode 100644 lib/typescript/components/bottomSheetBackgroundContainer/styles.d.ts delete mode 100644 lib/typescript/components/bottomSheetBackgroundContainer/types.d.ts delete mode 100644 lib/typescript/components/bottomSheetContainer/BottomSheetContainer.d.ts delete mode 100644 lib/typescript/components/bottomSheetContainer/index.d.ts delete mode 100644 lib/typescript/components/bottomSheetContainer/styles.d.ts delete mode 100644 lib/typescript/components/bottomSheetContainer/styles.web.d.ts delete mode 100644 lib/typescript/components/bottomSheetContainer/types.d.ts delete mode 100644 lib/typescript/components/bottomSheetDraggableView/BottomSheetDraggableView.d.ts delete mode 100644 lib/typescript/components/bottomSheetDraggableView/index.d.ts delete mode 100644 lib/typescript/components/bottomSheetDraggableView/types.d.ts delete mode 100644 lib/typescript/components/bottomSheetFooter/BottomSheetFooter.d.ts delete mode 100644 lib/typescript/components/bottomSheetFooter/index.d.ts delete mode 100644 lib/typescript/components/bottomSheetFooter/styles.d.ts delete mode 100644 lib/typescript/components/bottomSheetFooter/types.d.ts delete mode 100644 lib/typescript/components/bottomSheetFooterContainer/BottomSheetFooterContainer.d.ts delete mode 100644 lib/typescript/components/bottomSheetFooterContainer/types.d.ts delete mode 100644 lib/typescript/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.d.ts delete mode 100644 lib/typescript/components/bottomSheetGestureHandlersProvider/index.d.ts delete mode 100644 lib/typescript/components/bottomSheetGestureHandlersProvider/types.d.ts delete mode 100644 lib/typescript/components/bottomSheetHandle/BottomSheetHandle.d.ts delete mode 100644 lib/typescript/components/bottomSheetHandle/index.d.ts delete mode 100644 lib/typescript/components/bottomSheetHandle/styles.d.ts delete mode 100644 lib/typescript/components/bottomSheetHandle/types.d.ts delete mode 100644 lib/typescript/components/bottomSheetHandleContainer/BottomSheetHandleContainer.d.ts delete mode 100644 lib/typescript/components/bottomSheetHandleContainer/index.d.ts delete mode 100644 lib/typescript/components/bottomSheetHandleContainer/types.d.ts delete mode 100644 lib/typescript/components/bottomSheetModal/BottomSheetModal.d.ts delete mode 100644 lib/typescript/components/bottomSheetModal/constants.d.ts delete mode 100644 lib/typescript/components/bottomSheetModal/index.d.ts delete mode 100644 lib/typescript/components/bottomSheetModal/types.d.ts delete mode 100644 lib/typescript/components/bottomSheetModalProvider/BottomSheetModalProvider.d.ts delete mode 100644 lib/typescript/components/bottomSheetModalProvider/index.d.ts delete mode 100644 lib/typescript/components/bottomSheetModalProvider/types.d.ts delete mode 100644 lib/typescript/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.d.ts delete mode 100644 lib/typescript/components/bottomSheetRefreshControl/BottomSheetRefreshControl.d.ts delete mode 100644 lib/typescript/components/bottomSheetRefreshControl/index.d.ts delete mode 100644 lib/typescript/components/bottomSheetScrollable/BottomSheetFlatList.d.ts delete mode 100644 lib/typescript/components/bottomSheetScrollable/BottomSheetScrollView.d.ts delete mode 100644 lib/typescript/components/bottomSheetScrollable/BottomSheetSectionList.d.ts delete mode 100644 lib/typescript/components/bottomSheetScrollable/BottomSheetVirtualizedList.d.ts delete mode 100644 lib/typescript/components/bottomSheetScrollable/createBottomSheetScrollableComponent.d.ts delete mode 100644 lib/typescript/components/bottomSheetScrollable/index.d.ts delete mode 100644 lib/typescript/components/bottomSheetScrollable/styles.d.ts delete mode 100644 lib/typescript/components/bottomSheetScrollable/types.d.ts delete mode 100644 lib/typescript/components/bottomSheetTextInput/BottomSheetTextInput.d.ts delete mode 100644 lib/typescript/components/bottomSheetTextInput/index.d.ts delete mode 100644 lib/typescript/components/bottomSheetTextInput/types.d.ts delete mode 100644 lib/typescript/components/bottomSheetView/BottomSheetView.d.ts delete mode 100644 lib/typescript/components/bottomSheetView/index.d.ts delete mode 100644 lib/typescript/components/bottomSheetView/styles.d.ts delete mode 100644 lib/typescript/components/bottomSheetView/types.d.ts delete mode 100644 lib/typescript/components/touchables/Touchables.d.ts delete mode 100644 lib/typescript/components/touchables/Touchables.ios.d.ts delete mode 100644 lib/typescript/components/touchables/index.d.ts delete mode 100644 lib/typescript/constants.d.ts delete mode 100644 lib/typescript/contexts/external.d.ts delete mode 100644 lib/typescript/contexts/gesture.d.ts delete mode 100644 lib/typescript/contexts/index.d.ts delete mode 100644 lib/typescript/contexts/internal.d.ts delete mode 100644 lib/typescript/contexts/modal/external.d.ts delete mode 100644 lib/typescript/contexts/modal/internal.d.ts delete mode 100644 lib/typescript/hooks/index.d.ts delete mode 100644 lib/typescript/hooks/useBottomSheet.d.ts delete mode 100644 lib/typescript/hooks/useBottomSheetDynamicSnapPoints.d.ts delete mode 100644 lib/typescript/hooks/useBottomSheetGestureHandlers.d.ts delete mode 100644 lib/typescript/hooks/useBottomSheetInternal.d.ts delete mode 100644 lib/typescript/hooks/useBottomSheetModal.d.ts delete mode 100644 lib/typescript/hooks/useBottomSheetModalInternal.d.ts delete mode 100644 lib/typescript/hooks/useBottomSheetSpringConfigs.d.ts delete mode 100644 lib/typescript/hooks/useBottomSheetTimingConfigs.d.ts delete mode 100644 lib/typescript/hooks/useGestureEventsHandlersDefault.d.ts delete mode 100644 lib/typescript/hooks/useGestureHandler.d.ts delete mode 100644 lib/typescript/hooks/useKeyboard.d.ts delete mode 100644 lib/typescript/hooks/useNormalizedSnapPoints.d.ts delete mode 100644 lib/typescript/hooks/usePropsValidator.d.ts delete mode 100644 lib/typescript/hooks/useReactiveSharedValue.d.ts delete mode 100644 lib/typescript/hooks/useScrollEventsHandlersDefault.d.ts delete mode 100644 lib/typescript/hooks/useScrollHandler.d.ts delete mode 100644 lib/typescript/hooks/useScrollable.d.ts delete mode 100644 lib/typescript/hooks/useScrollableSetter.d.ts delete mode 100644 lib/typescript/hooks/useStableCallback.d.ts delete mode 100644 lib/typescript/index.d.ts delete mode 100644 lib/typescript/types.d.ts delete mode 100644 lib/typescript/utilities/animate.d.ts delete mode 100644 lib/typescript/utilities/clamp.d.ts delete mode 100644 lib/typescript/utilities/easingExp.d.ts delete mode 100644 lib/typescript/utilities/getKeyboardAnimationConfigs.d.ts delete mode 100644 lib/typescript/utilities/getRefNativeTag.d.ts delete mode 100644 lib/typescript/utilities/id.d.ts delete mode 100644 lib/typescript/utilities/index.d.ts delete mode 100644 lib/typescript/utilities/logger.d.ts delete mode 100644 lib/typescript/utilities/noop.d.ts delete mode 100644 lib/typescript/utilities/normalizeSnapPoint.d.ts delete mode 100644 lib/typescript/utilities/snapPoint.d.ts delete mode 100644 lib/typescript/utilities/validateSnapPoint.d.ts diff --git a/.gitignore b/.gitignore index 1616285c4..27dd6343a 100644 --- a/.gitignore +++ b/.gitignore @@ -56,4 +56,4 @@ android/app/libs android/keystores/debug.keystore # generated by bob -#lib/ +lib/ diff --git a/lib/commonjs/components/bottomSheet/BottomSheet.js b/lib/commonjs/components/bottomSheet/BottomSheet.js deleted file mode 100644 index bdc5082a6..000000000 --- a/lib/commonjs/components/bottomSheet/BottomSheet.js +++ /dev/null @@ -1,1160 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _react = _interopRequireWildcard(require("react")); - -var _reactNative = require("react-native"); - -var _invariant = _interopRequireDefault(require("invariant")); - -var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated")); - -var _reactNativeGestureHandler = require("react-native-gesture-handler"); - -var _hooks = require("../../hooks"); - -var _contexts = require("../../contexts"); - -var _bottomSheetContainer = _interopRequireDefault(require("../bottomSheetContainer")); - -var _bottomSheetGestureHandlersProvider = _interopRequireDefault(require("../bottomSheetGestureHandlersProvider")); - -var _bottomSheetBackdropContainer = _interopRequireDefault(require("../bottomSheetBackdropContainer")); - -var _bottomSheetHandleContainer = _interopRequireDefault(require("../bottomSheetHandleContainer")); - -var _bottomSheetBackgroundContainer = _interopRequireDefault(require("../bottomSheetBackgroundContainer")); - -var _BottomSheetFooterContainer = _interopRequireDefault(require("../bottomSheetFooterContainer/BottomSheetFooterContainer")); - -var _bottomSheetDraggableView = _interopRequireDefault(require("../bottomSheetDraggableView")); - -var _constants = require("../../constants"); - -var _utilities = require("../../utilities"); - -var _constants2 = require("./constants"); - -var _styles = require("./styles"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - -// import BottomSheetDebugView from '../bottomSheetDebugView'; -_reactNativeReanimated.default.addWhitelistedUIProps({ - decelerationRate: true -}); - -const BottomSheetComponent = /*#__PURE__*/(0, _react.forwardRef)(function BottomSheet(props, ref) { - //#region validate props - (0, _hooks.usePropsValidator)(props); //#endregion - //#region extract props - - const { - // animations configurations - animationConfigs: _providedAnimationConfigs, - // configurations - index: _providedIndex = 0, - snapPoints: _providedSnapPoints, - animateOnMount = _constants2.DEFAULT_ANIMATE_ON_MOUNT, - enableContentPanningGesture = _constants2.DEFAULT_ENABLE_CONTENT_PANNING_GESTURE, - enableHandlePanningGesture = _constants2.DEFAULT_ENABLE_HANDLE_PANNING_GESTURE, - enableOverDrag = _constants2.DEFAULT_ENABLE_OVER_DRAG, - enablePanDownToClose = _constants2.DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE, - enableDynamicSizing = _constants2.DEFAULT_DYNAMIC_SIZING, - overDragResistanceFactor = _constants2.DEFAULT_OVER_DRAG_RESISTANCE_FACTOR, - // styles - style: _providedStyle, - containerStyle: _providedContainerStyle, - backgroundStyle: _providedBackgroundStyle, - handleStyle: _providedHandleStyle, - handleIndicatorStyle: _providedHandleIndicatorStyle, - // hooks - gestureEventsHandlersHook, - // keyboard - keyboardBehavior = _constants2.DEFAULT_KEYBOARD_BEHAVIOR, - keyboardBlurBehavior = _constants2.DEFAULT_KEYBOARD_BLUR_BEHAVIOR, - android_keyboardInputMode = _constants2.DEFAULT_KEYBOARD_INPUT_MODE, - // layout - handleHeight: _providedHandleHeight, - containerHeight: _providedContainerHeight, - contentHeight: _providedContentHeight, - containerOffset: _providedContainerOffset, - topInset = 0, - bottomInset = 0, - maxDynamicContentSize, - // animated callback shared values - animatedPosition: _providedAnimatedPosition, - animatedIndex: _providedAnimatedIndex, - // gestures - simultaneousHandlers: _providedSimultaneousHandlers, - waitFor: _providedWaitFor, - activeOffsetX: _providedActiveOffsetX, - activeOffsetY: _providedActiveOffsetY, - failOffsetX: _providedFailOffsetX, - failOffsetY: _providedFailOffsetY, - // callbacks - onChange: _providedOnChange, - onClose: _providedOnClose, - onAnimate: _providedOnAnimate, - // private - $modal = false, - detached = false, - // components - handleComponent, - backdropComponent, - backgroundComponent, - footerComponent, - children: Content - } = props; //#endregion - //#region layout variables - - /** - * This variable is consider an internal variable, - * that will be used conditionally in `animatedContainerHeight` - */ - - const _animatedContainerHeight = (0, _hooks.useReactiveSharedValue)(_providedContainerHeight !== null && _providedContainerHeight !== void 0 ? _providedContainerHeight : _constants2.INITIAL_CONTAINER_HEIGHT); - /** - * This is a conditional variable, where if the `BottomSheet` is used - * in a modal, then it will subset vertical insets (top+bottom) from - * provided container height. - */ - - - const animatedContainerHeight = (0, _reactNativeReanimated.useDerivedValue)(() => { - const verticalInset = topInset + bottomInset; - return $modal ? _animatedContainerHeight.value - verticalInset : _animatedContainerHeight.value; - }, [$modal, topInset, bottomInset]); - const animatedContainerOffset = (0, _hooks.useReactiveSharedValue)(_providedContainerOffset !== null && _providedContainerOffset !== void 0 ? _providedContainerOffset : _constants2.INITIAL_CONTAINER_OFFSET); - const animatedHandleHeight = (0, _hooks.useReactiveSharedValue)(_providedHandleHeight !== null && _providedHandleHeight !== void 0 ? _providedHandleHeight : _constants2.INITIAL_HANDLE_HEIGHT); - const animatedFooterHeight = (0, _reactNativeReanimated.useSharedValue)(0); - const animatedContentHeight = (0, _reactNativeReanimated.useSharedValue)(_constants2.INITIAL_CONTAINER_HEIGHT); - const animatedSnapPoints = (0, _hooks.useNormalizedSnapPoints)(_providedSnapPoints, animatedContainerHeight, animatedContentHeight, animatedHandleHeight, enableDynamicSizing, maxDynamicContentSize); - const animatedHighestSnapPoint = (0, _reactNativeReanimated.useDerivedValue)(() => animatedSnapPoints.value[animatedSnapPoints.value.length - 1]); - const animatedClosedPosition = (0, _reactNativeReanimated.useDerivedValue)(() => { - let closedPosition = animatedContainerHeight.value; - - if ($modal || detached) { - closedPosition = animatedContainerHeight.value + bottomInset; - } - - return closedPosition; - }, [$modal, detached, bottomInset]); - const animatedSheetHeight = (0, _reactNativeReanimated.useDerivedValue)(() => animatedContainerHeight.value - animatedHighestSnapPoint.value); - const animatedCurrentIndex = (0, _hooks.useReactiveSharedValue)(animateOnMount ? -1 : _providedIndex); - const animatedPosition = (0, _reactNativeReanimated.useSharedValue)(_constants2.INITIAL_POSITION); - const animatedNextPosition = (0, _reactNativeReanimated.useSharedValue)(_constants2.INITIAL_VALUE); - const animatedNextPositionIndex = (0, _reactNativeReanimated.useSharedValue)(0); // conditional - - const isAnimatedOnMount = (0, _reactNativeReanimated.useSharedValue)(false); - const isContentHeightFixed = (0, _reactNativeReanimated.useSharedValue)(false); - const isLayoutCalculated = (0, _reactNativeReanimated.useDerivedValue)(() => { - let isContainerHeightCalculated = false; //container height was provided. - - if (_providedContainerHeight !== null || _providedContainerHeight !== undefined) { - isContainerHeightCalculated = true; - } // container height did set. - - - if (animatedContainerHeight.value !== _constants2.INITIAL_CONTAINER_HEIGHT) { - isContainerHeightCalculated = true; - } - - let isHandleHeightCalculated = false; // handle height is provided. - - if (_providedHandleHeight !== null && _providedHandleHeight !== undefined && typeof _providedHandleHeight === 'number') { - isHandleHeightCalculated = true; - } // handle component is null. - - - if (handleComponent === null) { - animatedHandleHeight.value = 0; - isHandleHeightCalculated = true; - } // handle height did set. - - - if (animatedHandleHeight.value !== _constants2.INITIAL_HANDLE_HEIGHT) { - isHandleHeightCalculated = true; - } - - let isSnapPointsNormalized = false; // the first snap point did normalized - - if (animatedSnapPoints.value[0] !== _constants2.INITIAL_SNAP_POINT) { - isSnapPointsNormalized = true; - } - - return isContainerHeightCalculated && isHandleHeightCalculated && isSnapPointsNormalized; - }); - const isInTemporaryPosition = (0, _reactNativeReanimated.useSharedValue)(false); - const isForcedClosing = (0, _reactNativeReanimated.useSharedValue)(false); // gesture - - const animatedContentGestureState = (0, _reactNativeReanimated.useSharedValue)(_reactNativeGestureHandler.State.UNDETERMINED); - const animatedHandleGestureState = (0, _reactNativeReanimated.useSharedValue)(_reactNativeGestureHandler.State.UNDETERMINED); //#endregion - //#region hooks variables - // scrollable variables - - const { - animatedScrollableType, - animatedScrollableContentOffsetY, - animatedScrollableOverrideState, - isScrollableRefreshable, - setScrollableRef, - removeScrollableRef - } = (0, _hooks.useScrollable)(); // keyboard - - const { - state: animatedKeyboardState, - height: animatedKeyboardHeight, - animationDuration: keyboardAnimationDuration, - animationEasing: keyboardAnimationEasing, - shouldHandleKeyboardEvents - } = (0, _hooks.useKeyboard)(); - const animatedKeyboardHeightInContainer = (0, _reactNativeReanimated.useSharedValue)(0); //#endregion - //#region state/dynamic variables - // states - - const animatedAnimationState = (0, _reactNativeReanimated.useSharedValue)(_constants.ANIMATION_STATE.UNDETERMINED); - const animatedAnimationSource = (0, _reactNativeReanimated.useSharedValue)(_constants.ANIMATION_SOURCE.MOUNT); - const animatedSheetState = (0, _reactNativeReanimated.useDerivedValue)(() => { - // closed position = position >= container height - if (animatedPosition.value >= animatedClosedPosition.value) return _constants.SHEET_STATE.CLOSED; // extended position = container height - sheet height - - const extendedPosition = animatedContainerHeight.value - animatedSheetHeight.value; - if (animatedPosition.value === extendedPosition) return _constants.SHEET_STATE.EXTENDED; // extended position with keyboard = - // container height - (sheet height + keyboard height in root container) - - const keyboardHeightInContainer = animatedKeyboardHeightInContainer.value; - const extendedPositionWithKeyboard = Math.max(0, animatedContainerHeight.value - (animatedSheetHeight.value + keyboardHeightInContainer)); // detect if keyboard is open and the sheet is in temporary position - - if (keyboardBehavior === _constants.KEYBOARD_BEHAVIOR.interactive && isInTemporaryPosition.value && animatedPosition.value === extendedPositionWithKeyboard) { - return _constants.SHEET_STATE.EXTENDED; - } // fill parent = 0 - - - if (animatedPosition.value === 0) { - return _constants.SHEET_STATE.FILL_PARENT; - } // detect if position is below extended point - - - if (animatedPosition.value < extendedPosition) { - return _constants.SHEET_STATE.OVER_EXTENDED; - } - - return _constants.SHEET_STATE.OPENED; - }, [animatedClosedPosition, animatedContainerHeight, animatedKeyboardHeightInContainer, animatedPosition, animatedSheetHeight, isInTemporaryPosition, keyboardBehavior]); - const animatedScrollableState = (0, _reactNativeReanimated.useDerivedValue)(() => { - /** - * if scrollable override state is set, then we just return its value. - */ - if (animatedScrollableOverrideState.value !== _constants.SCROLLABLE_STATE.UNDETERMINED) { - return animatedScrollableOverrideState.value; - } - /** - * if sheet state is fill parent, then unlock scrolling - */ - - - if (animatedSheetState.value === _constants.SHEET_STATE.FILL_PARENT) { - return _constants.SCROLLABLE_STATE.UNLOCKED; - } - /** - * if sheet state is extended, then unlock scrolling - */ - - - if (animatedSheetState.value === _constants.SHEET_STATE.EXTENDED) { - return _constants.SCROLLABLE_STATE.UNLOCKED; - } - /** - * if keyboard is shown and sheet is animating - * then we do not lock the scrolling to not lose - * current scrollable scroll position. - */ - - - if (animatedKeyboardState.value === _constants.KEYBOARD_STATE.SHOWN && animatedAnimationState.value === _constants.ANIMATION_STATE.RUNNING) { - return _constants.SCROLLABLE_STATE.UNLOCKED; - } - - return _constants.SCROLLABLE_STATE.LOCKED; - }); // dynamic - - const animatedContentHeightMax = (0, _reactNativeReanimated.useDerivedValue)(() => { - const keyboardHeightInContainer = animatedKeyboardHeightInContainer.value; - const handleHeight = Math.max(0, animatedHandleHeight.value); - let contentHeight = animatedSheetHeight.value - handleHeight; - - if (keyboardBehavior === _constants.KEYBOARD_BEHAVIOR.extend && animatedKeyboardState.value === _constants.KEYBOARD_STATE.SHOWN) { - contentHeight = contentHeight - keyboardHeightInContainer; - } else if (keyboardBehavior === _constants.KEYBOARD_BEHAVIOR.fillParent && isInTemporaryPosition.value) { - if (animatedKeyboardState.value === _constants.KEYBOARD_STATE.SHOWN) { - contentHeight = animatedContainerHeight.value - handleHeight - keyboardHeightInContainer; - } else { - contentHeight = animatedContainerHeight.value - handleHeight; - } - } else if (keyboardBehavior === _constants.KEYBOARD_BEHAVIOR.interactive && isInTemporaryPosition.value) { - const contentWithKeyboardHeight = contentHeight + keyboardHeightInContainer; - - if (animatedKeyboardState.value === _constants.KEYBOARD_STATE.SHOWN) { - if (keyboardHeightInContainer + animatedSheetHeight.value > animatedContainerHeight.value) { - contentHeight = animatedContainerHeight.value - keyboardHeightInContainer - handleHeight; - } - } else if (contentWithKeyboardHeight + handleHeight > animatedContainerHeight.value) { - contentHeight = animatedContainerHeight.value - handleHeight; - } else { - contentHeight = contentWithKeyboardHeight; - } - } - /** - * before the container is measured, `contentHeight` value will be below zero, - * which will lead to freeze the scrollable. - * - * @link (https://github.com/gorhom/react-native-bottom-sheet/issues/470) - */ - - - return Math.max(contentHeight, 0); - }, [animatedContainerHeight, animatedHandleHeight, animatedKeyboardHeightInContainer, animatedKeyboardState, animatedSheetHeight, isInTemporaryPosition, keyboardBehavior]); - const animatedIndex = (0, _reactNativeReanimated.useDerivedValue)(() => { - const adjustedSnapPoints = animatedSnapPoints.value.slice().reverse(); - const adjustedSnapPointsIndexes = animatedSnapPoints.value.slice().map((_, index) => index).reverse(); - /** - * we add the close state index `-1` - */ - - adjustedSnapPoints.push(animatedContainerHeight.value); - adjustedSnapPointsIndexes.push(-1); - const currentIndex = isLayoutCalculated.value ? (0, _reactNativeReanimated.interpolate)(animatedPosition.value, adjustedSnapPoints, adjustedSnapPointsIndexes, _reactNativeReanimated.Extrapolate.CLAMP) : -1; - /** - * if the sheet is currently running an animation by the keyboard opening, - * then we clamp the index on android with resize keyboard mode. - */ - - if (android_keyboardInputMode === _constants.KEYBOARD_INPUT_MODE.adjustResize && animatedAnimationSource.value === _constants.ANIMATION_SOURCE.KEYBOARD && animatedAnimationState.value === _constants.ANIMATION_STATE.RUNNING && isInTemporaryPosition.value) { - return Math.max(animatedCurrentIndex.value, currentIndex); - } - /** - * if the sheet is currently running an animation by snap point change - usually caused - * by dynamic content height -, then we return the next position index. - */ - - - if (animatedAnimationSource.value === _constants.ANIMATION_SOURCE.SNAP_POINT_CHANGE && animatedAnimationState.value === _constants.ANIMATION_STATE.RUNNING) { - return animatedNextPositionIndex.value; - } - - return currentIndex; - }, [android_keyboardInputMode]); //#endregion - //#region private methods - - /** - * Calculate the next position based on keyboard state. - */ - - const getNextPosition = (0, _reactNativeReanimated.useWorkletCallback)(function getNextPosition() { - 'worklet'; - - const currentIndex = animatedCurrentIndex.value; - const snapPoints = animatedSnapPoints.value; - const keyboardState = animatedKeyboardState.value; - const highestSnapPoint = animatedHighestSnapPoint.value; - /** - * Handle restore sheet position on blur - */ - - if (keyboardBlurBehavior === _constants.KEYBOARD_BLUR_BEHAVIOR.restore && keyboardState === _constants.KEYBOARD_STATE.HIDDEN && animatedContentGestureState.value !== _reactNativeGestureHandler.State.ACTIVE && animatedHandleGestureState.value !== _reactNativeGestureHandler.State.ACTIVE) { - isInTemporaryPosition.value = false; - const nextPosition = snapPoints[currentIndex]; - return nextPosition; - } - /** - * Handle extend behavior - */ - - - if (keyboardBehavior === _constants.KEYBOARD_BEHAVIOR.extend && keyboardState === _constants.KEYBOARD_STATE.SHOWN) { - return highestSnapPoint; - } - /** - * Handle full screen behavior - */ - - - if (keyboardBehavior === _constants.KEYBOARD_BEHAVIOR.fillParent && keyboardState === _constants.KEYBOARD_STATE.SHOWN) { - isInTemporaryPosition.value = true; - return 0; - } - /** - * handle interactive behavior - */ - - - if (keyboardBehavior === _constants.KEYBOARD_BEHAVIOR.interactive && keyboardState === _constants.KEYBOARD_STATE.SHOWN) { - isInTemporaryPosition.value = true; - const keyboardHeightInContainer = animatedKeyboardHeightInContainer.value; - return Math.max(0, highestSnapPoint - keyboardHeightInContainer); - } - - if (isInTemporaryPosition.value) { - return animatedPosition.value; - } - - return snapPoints[currentIndex]; - }, [animatedContentGestureState, animatedCurrentIndex, animatedHandleGestureState, animatedHighestSnapPoint, animatedKeyboardHeightInContainer, animatedKeyboardState, animatedPosition, animatedSnapPoints, isInTemporaryPosition, keyboardBehavior, keyboardBlurBehavior]); - const handleOnChange = (0, _react.useCallback)(function handleOnChange(index) { - (0, _utilities.print)({ - component: BottomSheet.name, - method: handleOnChange.name, - params: { - index, - animatedCurrentIndex: animatedCurrentIndex.value - } - }); - - if (_providedOnChange) { - _providedOnChange(index); - } - }, [_providedOnChange, animatedCurrentIndex]); - const handleOnAnimate = (0, _react.useCallback)(function handleOnAnimate(toPoint) { - const snapPoints = animatedSnapPoints.value; - const toIndex = snapPoints.indexOf(toPoint); - (0, _utilities.print)({ - component: BottomSheet.name, - method: handleOnAnimate.name, - params: { - toIndex, - fromIndex: animatedCurrentIndex.value - } - }); - - if (!_providedOnAnimate) { - return; - } - - if (toIndex !== animatedCurrentIndex.value) { - _providedOnAnimate(animatedCurrentIndex.value, toIndex); - } - }, [_providedOnAnimate, animatedSnapPoints, animatedCurrentIndex]); //#endregion - //#region animation - - const stopAnimation = (0, _reactNativeReanimated.useWorkletCallback)(() => { - (0, _reactNativeReanimated.cancelAnimation)(animatedPosition); - isForcedClosing.value = false; - animatedAnimationSource.value = _constants.ANIMATION_SOURCE.NONE; - animatedAnimationState.value = _constants.ANIMATION_STATE.STOPPED; - }, [animatedPosition, animatedAnimationState, animatedAnimationSource]); - const animateToPositionCompleted = (0, _reactNativeReanimated.useWorkletCallback)(function animateToPositionCompleted(isFinished) { - isForcedClosing.value = false; - - if (!isFinished) { - return; - } - - (0, _reactNativeReanimated.runOnJS)(_utilities.print)({ - component: BottomSheet.name, - method: animateToPositionCompleted.name, - params: { - animatedCurrentIndex: animatedCurrentIndex.value, - animatedNextPosition: animatedNextPosition.value, - animatedNextPositionIndex: animatedNextPositionIndex.value - } - }); - animatedAnimationSource.value = _constants.ANIMATION_SOURCE.NONE; - animatedAnimationState.value = _constants.ANIMATION_STATE.STOPPED; - animatedNextPosition.value = _constants2.INITIAL_VALUE; - animatedNextPositionIndex.value = _constants2.INITIAL_VALUE; - }); - const animateToPosition = (0, _reactNativeReanimated.useWorkletCallback)(function animateToPosition(position, source, velocity = 0, configs) { - if (position === animatedPosition.value || position === undefined || animatedAnimationState.value === _constants.ANIMATION_STATE.RUNNING && position === animatedNextPosition.value) { - return; - } - - (0, _reactNativeReanimated.runOnJS)(_utilities.print)({ - component: BottomSheet.name, - method: animateToPosition.name, - params: { - currentPosition: animatedPosition.value, - position, - velocity, - animatedContainerHeight: animatedContainerHeight.value - } - }); - stopAnimation(); - /** - * set animation state to running, and source - */ - - animatedAnimationState.value = _constants.ANIMATION_STATE.RUNNING; - animatedAnimationSource.value = source; - /** - * store next position - */ - - animatedNextPosition.value = position; - animatedNextPositionIndex.value = animatedSnapPoints.value.indexOf(position); - /** - * fire `onAnimate` callback - */ - - (0, _reactNativeReanimated.runOnJS)(handleOnAnimate)(position); - /** - * force animation configs from parameters, if provided - */ - - if (configs !== undefined) { - animatedPosition.value = (0, _utilities.animate)({ - point: position, - configs, - velocity, - onComplete: animateToPositionCompleted - }); - } else { - /** - * use animationConfigs callback, if provided - */ - animatedPosition.value = (0, _utilities.animate)({ - point: position, - velocity, - configs: _providedAnimationConfigs, - onComplete: animateToPositionCompleted - }); - } - }, [handleOnAnimate, _providedAnimationConfigs]); //#endregion - //#region public methods - - const handleSnapToIndex = (0, _react.useCallback)(function handleSnapToIndex(index, animationConfigs) { - const snapPoints = animatedSnapPoints.value; - (0, _invariant.default)(index >= -1 && index <= snapPoints.length - 1, `'index' was provided but out of the provided snap points range! expected value to be between -1, ${snapPoints.length - 1}`); - (0, _utilities.print)({ - component: BottomSheet.name, - method: handleSnapToIndex.name, - params: { - index - } - }); - const nextPosition = snapPoints[index]; - /** - * exit method if : - * - layout is not calculated. - * - already animating to next position. - * - sheet is forced closing. - */ - - if (!isLayoutCalculated.value || index === animatedNextPositionIndex.value || nextPosition === animatedNextPosition.value || isForcedClosing.value) { - return; - } - /** - * reset temporary position boolean. - */ - - - isInTemporaryPosition.value = false; - (0, _reactNativeReanimated.runOnUI)(animateToPosition)(nextPosition, _constants.ANIMATION_SOURCE.USER, 0, animationConfigs); - }, [animateToPosition, isLayoutCalculated, isInTemporaryPosition, isForcedClosing, animatedSnapPoints, animatedNextPosition, animatedNextPositionIndex]); - const handleSnapToPosition = (0, _reactNativeReanimated.useWorkletCallback)(function handleSnapToPosition(position, animationConfigs) { - (0, _utilities.print)({ - component: BottomSheet.name, - method: handleSnapToPosition.name, - params: { - position - } - }); - /** - * normalized provided position. - */ - - const nextPosition = (0, _utilities.normalizeSnapPoint)(position, animatedContainerHeight.value); - /** - * exit method if : - * - layout is not calculated. - * - already animating to next position. - * - sheet is forced closing. - */ - - if (!isLayoutCalculated || nextPosition === animatedNextPosition.value || isForcedClosing.value) { - return; - } - /** - * mark the new position as temporary. - */ - - - isInTemporaryPosition.value = true; - (0, _reactNativeReanimated.runOnUI)(animateToPosition)(nextPosition, _constants.ANIMATION_SOURCE.USER, 0, animationConfigs); - }, [animateToPosition, bottomInset, topInset, isLayoutCalculated, isForcedClosing, animatedContainerHeight, animatedPosition]); - const handleClose = (0, _react.useCallback)(function handleClose(animationConfigs) { - (0, _utilities.print)({ - component: BottomSheet.name, - method: handleClose.name - }); - const nextPosition = animatedClosedPosition.value; - /** - * exit method if : - * - layout is not calculated. - * - already animating to next position. - * - sheet is forced closing. - */ - - if (!isLayoutCalculated.value || nextPosition === animatedNextPosition.value || isForcedClosing.value) { - return; - } - /** - * reset temporary position variable. - */ - - - isInTemporaryPosition.value = false; - (0, _reactNativeReanimated.runOnUI)(animateToPosition)(nextPosition, _constants.ANIMATION_SOURCE.USER, 0, animationConfigs); - }, [animateToPosition, isForcedClosing, isLayoutCalculated, isInTemporaryPosition, animatedNextPosition, animatedClosedPosition]); - const handleForceClose = (0, _react.useCallback)(function handleForceClose(animationConfigs) { - (0, _utilities.print)({ - component: BottomSheet.name, - method: handleForceClose.name - }); - const nextPosition = animatedClosedPosition.value; - /** - * exit method if : - * - already animating to next position. - * - sheet is forced closing. - */ - - if (nextPosition === animatedNextPosition.value || isForcedClosing.value) { - return; - } - /** - * reset temporary position variable. - */ - - - isInTemporaryPosition.value = false; - /** - * set force closing variable. - */ - - isForcedClosing.value = true; - (0, _reactNativeReanimated.runOnUI)(animateToPosition)(nextPosition, _constants.ANIMATION_SOURCE.USER, 0, animationConfigs); - }, [animateToPosition, isForcedClosing, isInTemporaryPosition, animatedNextPosition, animatedClosedPosition]); - const handleExpand = (0, _react.useCallback)(function handleExpand(animationConfigs) { - (0, _utilities.print)({ - component: BottomSheet.name, - method: handleExpand.name - }); - const snapPoints = animatedSnapPoints.value; - const nextPosition = snapPoints[snapPoints.length - 1]; - /** - * exit method if : - * - layout is not calculated. - * - already animating to next position. - * - sheet is forced closing. - */ - - if (!isLayoutCalculated.value || snapPoints.length - 1 === animatedNextPositionIndex.value || nextPosition === animatedNextPosition.value || isForcedClosing.value) { - return; - } - /** - * reset temporary position boolean. - */ - - - isInTemporaryPosition.value = false; - (0, _reactNativeReanimated.runOnUI)(animateToPosition)(nextPosition, _constants.ANIMATION_SOURCE.USER, 0, animationConfigs); - }, [animateToPosition, isInTemporaryPosition, isLayoutCalculated, isForcedClosing, animatedSnapPoints, animatedNextPosition, animatedNextPositionIndex]); - const handleCollapse = (0, _react.useCallback)(function handleCollapse(animationConfigs) { - (0, _utilities.print)({ - component: BottomSheet.name, - method: handleCollapse.name - }); - const nextPosition = animatedSnapPoints.value[0]; - /** - * exit method if : - * - layout is not calculated. - * - already animating to next position. - * - sheet is forced closing. - */ - - if (!isLayoutCalculated || animatedNextPositionIndex.value === 0 || nextPosition === animatedNextPosition.value || isForcedClosing.value) { - return; - } - /** - * reset temporary position boolean. - */ - - - isInTemporaryPosition.value = false; - (0, _reactNativeReanimated.runOnUI)(animateToPosition)(nextPosition, _constants.ANIMATION_SOURCE.USER, 0, animationConfigs); - }, [animateToPosition, isForcedClosing, isLayoutCalculated, isInTemporaryPosition, animatedSnapPoints, animatedNextPosition, animatedNextPositionIndex]); - (0, _react.useImperativeHandle)(ref, () => ({ - snapToIndex: handleSnapToIndex, - snapToPosition: handleSnapToPosition, - expand: handleExpand, - collapse: handleCollapse, - close: handleClose, - forceClose: handleForceClose - })); //#endregion - //#region contexts variables - - const internalContextVariables = (0, _react.useMemo)(() => ({ - enableContentPanningGesture, - enableDynamicSizing, - overDragResistanceFactor, - enableOverDrag, - enablePanDownToClose, - animatedAnimationState, - animatedSheetState, - animatedScrollableState, - animatedScrollableOverrideState, - animatedContentGestureState, - animatedHandleGestureState, - animatedKeyboardState, - animatedScrollableType, - animatedIndex, - animatedPosition, - animatedContentHeight, - animatedClosedPosition, - animatedHandleHeight, - animatedFooterHeight, - animatedKeyboardHeight, - animatedKeyboardHeightInContainer, - animatedContainerHeight, - animatedSnapPoints, - animatedHighestSnapPoint, - animatedScrollableContentOffsetY, - isInTemporaryPosition, - isContentHeightFixed, - isScrollableRefreshable, - shouldHandleKeyboardEvents, - simultaneousHandlers: _providedSimultaneousHandlers, - waitFor: _providedWaitFor, - activeOffsetX: _providedActiveOffsetX, - activeOffsetY: _providedActiveOffsetY, - failOffsetX: _providedFailOffsetX, - failOffsetY: _providedFailOffsetY, - animateToPosition, - stopAnimation, - setScrollableRef, - removeScrollableRef - }), [animatedIndex, animatedPosition, animatedContentHeight, animatedScrollableType, animatedContentGestureState, animatedHandleGestureState, animatedClosedPosition, animatedFooterHeight, animatedContainerHeight, animatedHandleHeight, animatedAnimationState, animatedKeyboardState, animatedKeyboardHeight, animatedKeyboardHeightInContainer, animatedSheetState, animatedHighestSnapPoint, animatedScrollableState, animatedScrollableOverrideState, animatedSnapPoints, shouldHandleKeyboardEvents, animatedScrollableContentOffsetY, isScrollableRefreshable, isContentHeightFixed, isInTemporaryPosition, enableContentPanningGesture, overDragResistanceFactor, enableOverDrag, enablePanDownToClose, enableDynamicSizing, _providedSimultaneousHandlers, _providedWaitFor, _providedActiveOffsetX, _providedActiveOffsetY, _providedFailOffsetX, _providedFailOffsetY, setScrollableRef, removeScrollableRef, animateToPosition, stopAnimation]); - const externalContextVariables = (0, _react.useMemo)(() => ({ - animatedIndex, - animatedPosition, - snapToIndex: handleSnapToIndex, - snapToPosition: handleSnapToPosition, - expand: handleExpand, - collapse: handleCollapse, - close: handleClose, - forceClose: handleForceClose - }), [animatedIndex, animatedPosition, handleSnapToIndex, handleSnapToPosition, handleExpand, handleCollapse, handleClose, handleForceClose]); //#endregion - //#region styles - - const containerAnimatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({ - opacity: _reactNative.Platform.OS === 'android' && animatedIndex.value === -1 ? 0 : 1, - transform: [{ - translateY: animatedPosition.value - }] - }), [animatedPosition, animatedIndex]); - const containerStyle = (0, _react.useMemo)(() => [_providedStyle, _styles.styles.container, containerAnimatedStyle], [_providedStyle, containerAnimatedStyle]); - const contentContainerAnimatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => { - /** - * if content height was provided, then we skip setting - * calculated height. - */ - if (_providedContentHeight) { - return {}; - } - - return { - height: (0, _utilities.animate)({ - point: animatedContentHeightMax.value, - configs: _providedAnimationConfigs - }) - }; - }, [animatedContentHeightMax, enableDynamicSizing, animatedContentHeight]); - const contentContainerStyle = (0, _react.useMemo)(() => [_styles.styles.contentContainer, contentContainerAnimatedStyle], [contentContainerAnimatedStyle]); - /** - * added safe area to prevent the sheet from floating above - * the bottom of the screen, when sheet being over dragged or - * when the sheet is resized. - */ - - const contentMaskContainerAnimatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => { - if (detached) { - return { - overflow: 'visible' - }; - } - - return { - paddingBottom: animatedContainerHeight.value - }; - }, [detached]); - const contentMaskContainerStyle = (0, _react.useMemo)(() => [_styles.styles.contentMaskContainer, contentMaskContainerAnimatedStyle], [contentMaskContainerAnimatedStyle]); //#endregion - //#region effects - - /** - * React to `isLayoutCalculated` change, to insure that the sheet will - * appears/mounts only when all layout is been calculated. - * - * @alias OnMount - */ - - (0, _reactNativeReanimated.useAnimatedReaction)(() => isLayoutCalculated.value, _isLayoutCalculated => { - /** - * exit method if: - * - layout is not calculated yet. - * - already did animate on mount. - */ - if (!_isLayoutCalculated || isAnimatedOnMount.value) { - return; - } - - let nextPosition; - - if (_providedIndex === -1) { - nextPosition = animatedClosedPosition.value; - animatedNextPositionIndex.value = -1; - } else { - nextPosition = animatedSnapPoints.value[_providedIndex]; - } - - (0, _reactNativeReanimated.runOnJS)(_utilities.print)({ - component: BottomSheet.name, - method: 'useAnimatedReaction::OnMount', - params: { - isLayoutCalculated: _isLayoutCalculated, - animatedSnapPoints: animatedSnapPoints.value, - nextPosition - } - }); - /** - * here we exit method early because the next position - * is out of the screen, this happens when `snapPoints` - * still being calculated. - */ - - if (nextPosition === _constants2.INITIAL_POSITION || nextPosition === animatedClosedPosition.value) { - isAnimatedOnMount.value = true; - animatedCurrentIndex.value = _providedIndex; - return; - } - - if (animateOnMount) { - animateToPosition(nextPosition, _constants.ANIMATION_SOURCE.MOUNT); - } else { - animatedPosition.value = nextPosition; - } - - isAnimatedOnMount.value = true; - }, [_providedIndex, animateOnMount]); - /** - * React to `snapPoints` change, to insure that the sheet position reflect - * to the current point correctly. - * - * @alias OnSnapPointsChange - */ - - (0, _reactNativeReanimated.useAnimatedReaction)(() => ({ - snapPoints: animatedSnapPoints.value, - containerHeight: animatedContainerHeight.value - }), (result, _previousResult) => { - const { - snapPoints, - containerHeight - } = result; - - const _previousSnapPoints = _previousResult === null || _previousResult === void 0 ? void 0 : _previousResult.snapPoints; - - const _previousContainerHeight = _previousResult === null || _previousResult === void 0 ? void 0 : _previousResult.containerHeight; - - let nextPosition; - let animationConfig; - let animationSource = _constants.ANIMATION_SOURCE.SNAP_POINT_CHANGE; - /** - * if the bottom sheet is closing and the container gets resized, - * then we restart the closing animation to the new position. - */ - - if (animatedAnimationState.value === _constants.ANIMATION_STATE.RUNNING && animatedNextPositionIndex.value === -1 && _previousContainerHeight !== containerHeight) { - animationSource = _constants.ANIMATION_SOURCE.CONTAINER_RESIZE; - animationConfig = { - duration: 0 - }; - animateToPosition(containerHeight, animationSource, 0, animationConfig); - } - - if (JSON.stringify(snapPoints) === JSON.stringify(_previousSnapPoints) || !isLayoutCalculated.value || !isAnimatedOnMount.value || containerHeight <= 0) { - return; - } - - (0, _reactNativeReanimated.runOnJS)(_utilities.print)({ - component: BottomSheet.name, - method: 'useAnimatedReaction::OnSnapPointChange', - params: { - snapPoints - } - }); - /** - * if snap points changed while sheet is animating, then - * we stop the animation and animate to the updated point. - */ - - if (animatedAnimationState.value === _constants.ANIMATION_STATE.RUNNING && animatedNextPositionIndex.value !== animatedCurrentIndex.value) { - nextPosition = animatedNextPositionIndex.value !== -1 ? snapPoints[animatedNextPositionIndex.value] : animatedNextPosition.value; - } else if (animatedCurrentIndex.value === -1) { - nextPosition = animatedClosedPosition.value; - } else if (isInTemporaryPosition.value) { - nextPosition = getNextPosition(); - } else { - nextPosition = snapPoints[animatedCurrentIndex.value]; - /** - * if snap points changes because of the container height change, - * then we skip the snap animation by setting the duration to 0. - */ - - if (containerHeight !== _previousContainerHeight) { - animationSource = _constants.ANIMATION_SOURCE.CONTAINER_RESIZE; - animationConfig = { - duration: 0 - }; - } - } - - animateToPosition(nextPosition, animationSource, 0, animationConfig); - }); - /** - * React to keyboard appearance state. - * - * @alias OnKeyboardStateChange - */ - - (0, _reactNativeReanimated.useAnimatedReaction)(() => ({ - _keyboardState: animatedKeyboardState.value, - _keyboardHeight: animatedKeyboardHeight.value - }), (result, _previousResult) => { - const { - _keyboardState, - _keyboardHeight - } = result; - - const _previousKeyboardState = _previousResult === null || _previousResult === void 0 ? void 0 : _previousResult._keyboardState; - - const _previousKeyboardHeight = _previousResult === null || _previousResult === void 0 ? void 0 : _previousResult._keyboardHeight; - /** - * Calculate the keyboard height in the container. - */ - - - animatedKeyboardHeightInContainer.value = $modal ? Math.abs(_keyboardHeight - Math.abs(bottomInset - animatedContainerOffset.value.bottom)) : Math.abs(_keyboardHeight - animatedContainerOffset.value.bottom); - const hasActiveGesture = animatedContentGestureState.value === _reactNativeGestureHandler.State.ACTIVE || animatedContentGestureState.value === _reactNativeGestureHandler.State.BEGAN || animatedHandleGestureState.value === _reactNativeGestureHandler.State.ACTIVE || animatedHandleGestureState.value === _reactNativeGestureHandler.State.BEGAN; - - if ( - /** - * if keyboard state is equal to the previous state, then exit the method - */ - _keyboardState === _previousKeyboardState && _keyboardHeight === _previousKeyboardHeight || - /** - * if user is interacting with sheet, then exit the method - */ - hasActiveGesture || - /** - * if sheet not animated on mount yet, then exit the method - */ - !isAnimatedOnMount.value || _keyboardState === _constants.KEYBOARD_STATE.HIDDEN && keyboardBlurBehavior === _constants.KEYBOARD_BLUR_BEHAVIOR.none || _reactNative.Platform.OS === 'android' && keyboardBehavior === _constants.KEYBOARD_BEHAVIOR.interactive && android_keyboardInputMode === _constants.KEYBOARD_INPUT_MODE.adjustResize) { - animatedKeyboardHeightInContainer.value = 0; - return; - } - - (0, _reactNativeReanimated.runOnJS)(_utilities.print)({ - component: BottomSheet.name, - method: 'useAnimatedReaction::OnKeyboardStateChange', - params: { - keyboardState: _keyboardState, - keyboardHeight: _keyboardHeight - } - }); - let animationConfigs = (0, _utilities.getKeyboardAnimationConfigs)(keyboardAnimationEasing.value, keyboardAnimationDuration.value); - const nextPosition = getNextPosition(); - animateToPosition(nextPosition, _constants.ANIMATION_SOURCE.KEYBOARD, 0, animationConfigs); - }, [$modal, bottomInset, keyboardBehavior, keyboardBlurBehavior, android_keyboardInputMode, animatedContainerOffset, getNextPosition]); - /** - * sets provided animated position - */ - - (0, _reactNativeReanimated.useAnimatedReaction)(() => animatedPosition.value, _animatedPosition => { - if (_providedAnimatedPosition) { - _providedAnimatedPosition.value = _animatedPosition + topInset; - } - }); - /** - * sets provided animated index - */ - - (0, _reactNativeReanimated.useAnimatedReaction)(() => animatedIndex.value, _animatedIndex => { - if (_providedAnimatedIndex) { - _providedAnimatedIndex.value = _animatedIndex; - } - }); - /** - * React to internal variables to detect change in snap position. - * - * @alias OnChange - */ - - (0, _reactNativeReanimated.useAnimatedReaction)(() => ({ - _animatedIndex: animatedIndex.value, - _animatedPosition: animatedPosition.value, - _animationState: animatedAnimationState.value, - _contentGestureState: animatedContentGestureState.value, - _handleGestureState: animatedHandleGestureState.value - }), ({ - _animatedIndex, - _animationState, - _contentGestureState, - _handleGestureState - }) => { - /** - * exit the method if animation state is not stopped. - */ - if (_animationState !== _constants.ANIMATION_STATE.STOPPED) { - return; - } - /** - * exit the method if animated index value - * has fraction, e.g. 1.99, 0.52 - */ - - - if (_animatedIndex % 1 !== 0) { - return; - } - /** - * exit the method if there any active gesture. - */ - - - const hasNoActiveGesture = (_contentGestureState === _reactNativeGestureHandler.State.END || _contentGestureState === _reactNativeGestureHandler.State.UNDETERMINED || _contentGestureState === _reactNativeGestureHandler.State.CANCELLED) && (_handleGestureState === _reactNativeGestureHandler.State.END || _handleGestureState === _reactNativeGestureHandler.State.UNDETERMINED || _handleGestureState === _reactNativeGestureHandler.State.CANCELLED); - - if (!hasNoActiveGesture) { - return; - } - /** - * if the index is not equal to the current index, - * than the sheet position had changed and we trigger - * the `onChange` callback. - */ - - - if (_animatedIndex !== animatedCurrentIndex.value) { - (0, _reactNativeReanimated.runOnJS)(_utilities.print)({ - component: BottomSheet.name, - method: 'useAnimatedReaction::OnChange', - params: { - animatedCurrentIndex: animatedCurrentIndex.value, - animatedIndex: _animatedIndex - } - }); - animatedCurrentIndex.value = _animatedIndex; - (0, _reactNativeReanimated.runOnJS)(handleOnChange)(_animatedIndex); - } - /** - * if index is `-1` than we fire the `onClose` callback. - */ - - - if (_animatedIndex === -1 && _providedOnClose) { - (0, _reactNativeReanimated.runOnJS)(_utilities.print)({ - component: BottomSheet.name, - method: 'useAnimatedReaction::onClose', - params: { - animatedCurrentIndex: animatedCurrentIndex.value, - animatedIndex: _animatedIndex - } - }); - (0, _reactNativeReanimated.runOnJS)(_providedOnClose)(); - } - }, [handleOnChange, _providedOnClose]); - /** - * React to `index` prop to snap the sheet to the new position. - * - * @alias onIndexChange - */ - - (0, _react.useEffect)(() => { - if (isAnimatedOnMount.value) { - handleSnapToIndex(_providedIndex); - } - }, [_providedIndex, animatedCurrentIndex, isAnimatedOnMount, handleSnapToIndex]); //#endregion - // render - - (0, _utilities.print)({ - component: BottomSheet.name, - method: 'render', - params: { - animatedSnapPoints: animatedSnapPoints.value, - animatedCurrentIndex: animatedCurrentIndex.value, - providedIndex: _providedIndex - } - }); - return /*#__PURE__*/_react.default.createElement(_contexts.BottomSheetProvider, { - value: externalContextVariables - }, /*#__PURE__*/_react.default.createElement(_contexts.BottomSheetInternalProvider, { - value: internalContextVariables - }, /*#__PURE__*/_react.default.createElement(_bottomSheetGestureHandlersProvider.default, { - gestureEventsHandlersHook: gestureEventsHandlersHook - }, /*#__PURE__*/_react.default.createElement(_bottomSheetBackdropContainer.default, { - key: "BottomSheetBackdropContainer", - animatedIndex: animatedIndex, - animatedPosition: animatedPosition, - backdropComponent: backdropComponent - }), /*#__PURE__*/_react.default.createElement(_bottomSheetContainer.default, { - key: "BottomSheetContainer", - shouldCalculateHeight: !$modal, - containerHeight: _animatedContainerHeight, - containerOffset: animatedContainerOffset, - topInset: topInset, - bottomInset: bottomInset, - detached: detached, - style: _providedContainerStyle - }, /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, { - style: containerStyle - }, /*#__PURE__*/_react.default.createElement(_bottomSheetBackgroundContainer.default, { - key: "BottomSheetBackgroundContainer", - animatedIndex: animatedIndex, - animatedPosition: animatedPosition, - backgroundComponent: backgroundComponent, - backgroundStyle: _providedBackgroundStyle - }), /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, { - pointerEvents: "box-none", - style: contentMaskContainerStyle - }, /*#__PURE__*/_react.default.createElement(_bottomSheetDraggableView.default, { - key: "BottomSheetRootDraggableView", - style: contentContainerStyle - }, typeof Content === 'function' ? /*#__PURE__*/_react.default.createElement(Content, null) : Content, footerComponent && /*#__PURE__*/_react.default.createElement(_BottomSheetFooterContainer.default, { - footerComponent: footerComponent - }))), /*#__PURE__*/_react.default.createElement(_bottomSheetHandleContainer.default, { - key: "BottomSheetHandleContainer", - animatedIndex: animatedIndex, - animatedPosition: animatedPosition, - handleHeight: animatedHandleHeight, - enableHandlePanningGesture: enableHandlePanningGesture, - enableOverDrag: enableOverDrag, - enablePanDownToClose: enablePanDownToClose, - overDragResistanceFactor: overDragResistanceFactor, - keyboardBehavior: keyboardBehavior, - handleComponent: handleComponent, - handleStyle: _providedHandleStyle, - handleIndicatorStyle: _providedHandleIndicatorStyle - })))))); -}); -const BottomSheet = /*#__PURE__*/(0, _react.memo)(BottomSheetComponent); -BottomSheet.displayName = 'BottomSheet'; -var _default = BottomSheet; -exports.default = _default; -//# sourceMappingURL=BottomSheet.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheet/BottomSheet.js.map b/lib/commonjs/components/bottomSheet/BottomSheet.js.map deleted file mode 100644 index 6e668a4cd..000000000 --- a/lib/commonjs/components/bottomSheet/BottomSheet.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheet.tsx"],"names":["Animated","addWhitelistedUIProps","decelerationRate","BottomSheetComponent","BottomSheet","props","ref","animationConfigs","_providedAnimationConfigs","index","_providedIndex","snapPoints","_providedSnapPoints","animateOnMount","DEFAULT_ANIMATE_ON_MOUNT","enableContentPanningGesture","DEFAULT_ENABLE_CONTENT_PANNING_GESTURE","enableHandlePanningGesture","DEFAULT_ENABLE_HANDLE_PANNING_GESTURE","enableOverDrag","DEFAULT_ENABLE_OVER_DRAG","enablePanDownToClose","DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE","enableDynamicSizing","DEFAULT_DYNAMIC_SIZING","overDragResistanceFactor","DEFAULT_OVER_DRAG_RESISTANCE_FACTOR","style","_providedStyle","containerStyle","_providedContainerStyle","backgroundStyle","_providedBackgroundStyle","handleStyle","_providedHandleStyle","handleIndicatorStyle","_providedHandleIndicatorStyle","gestureEventsHandlersHook","keyboardBehavior","DEFAULT_KEYBOARD_BEHAVIOR","keyboardBlurBehavior","DEFAULT_KEYBOARD_BLUR_BEHAVIOR","android_keyboardInputMode","DEFAULT_KEYBOARD_INPUT_MODE","handleHeight","_providedHandleHeight","containerHeight","_providedContainerHeight","contentHeight","_providedContentHeight","containerOffset","_providedContainerOffset","topInset","bottomInset","maxDynamicContentSize","animatedPosition","_providedAnimatedPosition","animatedIndex","_providedAnimatedIndex","simultaneousHandlers","_providedSimultaneousHandlers","waitFor","_providedWaitFor","activeOffsetX","_providedActiveOffsetX","activeOffsetY","_providedActiveOffsetY","failOffsetX","_providedFailOffsetX","failOffsetY","_providedFailOffsetY","onChange","_providedOnChange","onClose","_providedOnClose","onAnimate","_providedOnAnimate","$modal","detached","handleComponent","backdropComponent","backgroundComponent","footerComponent","children","Content","_animatedContainerHeight","INITIAL_CONTAINER_HEIGHT","animatedContainerHeight","verticalInset","value","animatedContainerOffset","INITIAL_CONTAINER_OFFSET","animatedHandleHeight","INITIAL_HANDLE_HEIGHT","animatedFooterHeight","animatedContentHeight","animatedSnapPoints","animatedHighestSnapPoint","length","animatedClosedPosition","closedPosition","animatedSheetHeight","animatedCurrentIndex","INITIAL_POSITION","animatedNextPosition","INITIAL_VALUE","animatedNextPositionIndex","isAnimatedOnMount","isContentHeightFixed","isLayoutCalculated","isContainerHeightCalculated","undefined","isHandleHeightCalculated","isSnapPointsNormalized","INITIAL_SNAP_POINT","isInTemporaryPosition","isForcedClosing","animatedContentGestureState","State","UNDETERMINED","animatedHandleGestureState","animatedScrollableType","animatedScrollableContentOffsetY","animatedScrollableOverrideState","isScrollableRefreshable","setScrollableRef","removeScrollableRef","state","animatedKeyboardState","height","animatedKeyboardHeight","animationDuration","keyboardAnimationDuration","animationEasing","keyboardAnimationEasing","shouldHandleKeyboardEvents","animatedKeyboardHeightInContainer","animatedAnimationState","ANIMATION_STATE","animatedAnimationSource","ANIMATION_SOURCE","MOUNT","animatedSheetState","SHEET_STATE","CLOSED","extendedPosition","EXTENDED","keyboardHeightInContainer","extendedPositionWithKeyboard","Math","max","KEYBOARD_BEHAVIOR","interactive","FILL_PARENT","OVER_EXTENDED","OPENED","animatedScrollableState","SCROLLABLE_STATE","UNLOCKED","KEYBOARD_STATE","SHOWN","RUNNING","LOCKED","animatedContentHeightMax","extend","fillParent","contentWithKeyboardHeight","adjustedSnapPoints","slice","reverse","adjustedSnapPointsIndexes","map","_","push","currentIndex","Extrapolate","CLAMP","KEYBOARD_INPUT_MODE","adjustResize","KEYBOARD","SNAP_POINT_CHANGE","getNextPosition","keyboardState","highestSnapPoint","KEYBOARD_BLUR_BEHAVIOR","restore","HIDDEN","ACTIVE","nextPosition","handleOnChange","component","name","method","params","handleOnAnimate","toPoint","toIndex","indexOf","fromIndex","stopAnimation","NONE","STOPPED","animateToPositionCompleted","isFinished","print","animateToPosition","position","source","velocity","configs","currentPosition","point","onComplete","handleSnapToIndex","USER","handleSnapToPosition","handleClose","handleForceClose","handleExpand","handleCollapse","snapToIndex","snapToPosition","expand","collapse","close","forceClose","internalContextVariables","externalContextVariables","containerAnimatedStyle","opacity","Platform","OS","transform","translateY","styles","container","contentContainerAnimatedStyle","contentContainerStyle","contentContainer","contentMaskContainerAnimatedStyle","overflow","paddingBottom","contentMaskContainerStyle","contentMaskContainer","_isLayoutCalculated","result","_previousResult","_previousSnapPoints","_previousContainerHeight","animationConfig","animationSource","CONTAINER_RESIZE","duration","JSON","stringify","_keyboardState","_keyboardHeight","_previousKeyboardState","_previousKeyboardHeight","abs","bottom","hasActiveGesture","BEGAN","none","keyboardHeight","_animatedPosition","_animatedIndex","_animationState","_contentGestureState","_handleGestureState","hasNoActiveGesture","END","CANCELLED","providedIndex","displayName"],"mappings":";;;;;;;AAAA;;AAQA;;AACA;;AACA;;AAcA;;AACA;;AAOA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AAUA;;AAMA;;AAoBA;;;;;;;;AArCA;AAuCAA,+BAASC,qBAAT,CAA+B;AAC7BC,EAAAA,gBAAgB,EAAE;AADW,CAA/B;;AAMA,MAAMC,oBAAoB,gBAAG,uBAC3B,SAASC,WAAT,CAAqBC,KAArB,EAA4BC,GAA5B,EAAiC;AAC/B;AACA,gCAA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EI,wBAR5B;AASE,IAAA,gBAAgB,EAAEa,gBATpB;AAUE,IAAA,eAAe,EAAEyC,eAVnB;AAWE,IAAA,WAAW,EAAE7C,oBAXf;AAYE,IAAA,oBAAoB,EAAEE;AAZxB,IAzBF,CAVF,CATF,CADF,CADF,CADF;AA0FD,CAtkD0B,CAA7B;AAykDA,MAAMhC,WAAW,gBAAG,iBAAKD,oBAAL,CAApB;AACAC,WAAW,CAAC8Q,WAAZ,GAA0B,aAA1B;eAEe9Q,W","sourcesContent":["import React, {\n useMemo,\n useCallback,\n forwardRef,\n useImperativeHandle,\n memo,\n useEffect,\n} from 'react';\nimport { Platform } from 'react-native';\nimport invariant from 'invariant';\nimport Animated, {\n useAnimatedReaction,\n useSharedValue,\n useAnimatedStyle,\n useDerivedValue,\n runOnJS,\n interpolate,\n Extrapolate,\n runOnUI,\n cancelAnimation,\n useWorkletCallback,\n WithSpringConfig,\n WithTimingConfig,\n} from 'react-native-reanimated';\nimport { State } from 'react-native-gesture-handler';\nimport {\n useScrollable,\n usePropsValidator,\n useReactiveSharedValue,\n useNormalizedSnapPoints,\n useKeyboard,\n} from '../../hooks';\nimport {\n BottomSheetInternalProvider,\n BottomSheetProvider,\n} from '../../contexts';\nimport BottomSheetContainer from '../bottomSheetContainer';\nimport BottomSheetGestureHandlersProvider from '../bottomSheetGestureHandlersProvider';\nimport BottomSheetBackdropContainer from '../bottomSheetBackdropContainer';\nimport BottomSheetHandleContainer from '../bottomSheetHandleContainer';\nimport BottomSheetBackgroundContainer from '../bottomSheetBackgroundContainer';\nimport BottomSheetFooterContainer from '../bottomSheetFooterContainer/BottomSheetFooterContainer';\nimport BottomSheetDraggableView from '../bottomSheetDraggableView';\n// import BottomSheetDebugView from '../bottomSheetDebugView';\nimport {\n ANIMATION_STATE,\n KEYBOARD_STATE,\n KEYBOARD_BEHAVIOR,\n SHEET_STATE,\n SCROLLABLE_STATE,\n KEYBOARD_BLUR_BEHAVIOR,\n KEYBOARD_INPUT_MODE,\n ANIMATION_SOURCE,\n} from '../../constants';\nimport {\n animate,\n getKeyboardAnimationConfigs,\n normalizeSnapPoint,\n print,\n} from '../../utilities';\nimport {\n DEFAULT_OVER_DRAG_RESISTANCE_FACTOR,\n DEFAULT_ENABLE_CONTENT_PANNING_GESTURE,\n DEFAULT_ENABLE_HANDLE_PANNING_GESTURE,\n DEFAULT_ENABLE_OVER_DRAG,\n DEFAULT_ANIMATE_ON_MOUNT,\n DEFAULT_KEYBOARD_BEHAVIOR,\n DEFAULT_KEYBOARD_BLUR_BEHAVIOR,\n DEFAULT_KEYBOARD_INPUT_MODE,\n INITIAL_CONTAINER_HEIGHT,\n INITIAL_HANDLE_HEIGHT,\n INITIAL_POSITION,\n INITIAL_SNAP_POINT,\n DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE,\n INITIAL_CONTAINER_OFFSET,\n INITIAL_VALUE,\n DEFAULT_DYNAMIC_SIZING,\n} from './constants';\nimport type { BottomSheetMethods, Insets } from '../../types';\nimport type { BottomSheetProps, AnimateToPositionType } from './types';\nimport { styles } from './styles';\n\nAnimated.addWhitelistedUIProps({\n decelerationRate: true,\n});\n\ntype BottomSheet = BottomSheetMethods;\n\nconst BottomSheetComponent = forwardRef(\n function BottomSheet(props, ref) {\n //#region validate props\n usePropsValidator(props);\n //#endregion\n\n //#region extract props\n const {\n // animations configurations\n animationConfigs: _providedAnimationConfigs,\n\n // configurations\n index: _providedIndex = 0,\n snapPoints: _providedSnapPoints,\n animateOnMount = DEFAULT_ANIMATE_ON_MOUNT,\n enableContentPanningGesture = DEFAULT_ENABLE_CONTENT_PANNING_GESTURE,\n enableHandlePanningGesture = DEFAULT_ENABLE_HANDLE_PANNING_GESTURE,\n enableOverDrag = DEFAULT_ENABLE_OVER_DRAG,\n enablePanDownToClose = DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE,\n enableDynamicSizing = DEFAULT_DYNAMIC_SIZING,\n overDragResistanceFactor = DEFAULT_OVER_DRAG_RESISTANCE_FACTOR,\n\n // styles\n style: _providedStyle,\n containerStyle: _providedContainerStyle,\n backgroundStyle: _providedBackgroundStyle,\n handleStyle: _providedHandleStyle,\n handleIndicatorStyle: _providedHandleIndicatorStyle,\n\n // hooks\n gestureEventsHandlersHook,\n\n // keyboard\n keyboardBehavior = DEFAULT_KEYBOARD_BEHAVIOR,\n keyboardBlurBehavior = DEFAULT_KEYBOARD_BLUR_BEHAVIOR,\n android_keyboardInputMode = DEFAULT_KEYBOARD_INPUT_MODE,\n\n // layout\n handleHeight: _providedHandleHeight,\n containerHeight: _providedContainerHeight,\n contentHeight: _providedContentHeight,\n containerOffset: _providedContainerOffset,\n topInset = 0,\n bottomInset = 0,\n maxDynamicContentSize,\n\n // animated callback shared values\n animatedPosition: _providedAnimatedPosition,\n animatedIndex: _providedAnimatedIndex,\n\n // gestures\n simultaneousHandlers: _providedSimultaneousHandlers,\n waitFor: _providedWaitFor,\n activeOffsetX: _providedActiveOffsetX,\n activeOffsetY: _providedActiveOffsetY,\n failOffsetX: _providedFailOffsetX,\n failOffsetY: _providedFailOffsetY,\n\n // callbacks\n onChange: _providedOnChange,\n onClose: _providedOnClose,\n onAnimate: _providedOnAnimate,\n\n // private\n $modal = false,\n detached = false,\n\n // components\n handleComponent,\n backdropComponent,\n backgroundComponent,\n footerComponent,\n children: Content,\n } = props;\n //#endregion\n\n //#region layout variables\n /**\n * This variable is consider an internal variable,\n * that will be used conditionally in `animatedContainerHeight`\n */\n const _animatedContainerHeight = useReactiveSharedValue(\n _providedContainerHeight ?? INITIAL_CONTAINER_HEIGHT\n );\n /**\n * This is a conditional variable, where if the `BottomSheet` is used\n * in a modal, then it will subset vertical insets (top+bottom) from\n * provided container height.\n */\n const animatedContainerHeight = useDerivedValue(() => {\n const verticalInset = topInset + bottomInset;\n return $modal\n ? _animatedContainerHeight.value - verticalInset\n : _animatedContainerHeight.value;\n }, [$modal, topInset, bottomInset]);\n const animatedContainerOffset = useReactiveSharedValue(\n _providedContainerOffset ?? INITIAL_CONTAINER_OFFSET\n ) as Animated.SharedValue;\n const animatedHandleHeight = useReactiveSharedValue(\n _providedHandleHeight ?? INITIAL_HANDLE_HEIGHT\n );\n const animatedFooterHeight = useSharedValue(0);\n const animatedContentHeight = useSharedValue(INITIAL_CONTAINER_HEIGHT);\n const animatedSnapPoints = useNormalizedSnapPoints(\n _providedSnapPoints,\n animatedContainerHeight,\n animatedContentHeight,\n animatedHandleHeight,\n enableDynamicSizing,\n maxDynamicContentSize\n );\n const animatedHighestSnapPoint = useDerivedValue(\n () => animatedSnapPoints.value[animatedSnapPoints.value.length - 1]\n );\n const animatedClosedPosition = useDerivedValue(() => {\n let closedPosition = animatedContainerHeight.value;\n\n if ($modal || detached) {\n closedPosition = animatedContainerHeight.value + bottomInset;\n }\n\n return closedPosition;\n }, [$modal, detached, bottomInset]);\n const animatedSheetHeight = useDerivedValue(\n () => animatedContainerHeight.value - animatedHighestSnapPoint.value\n );\n const animatedCurrentIndex = useReactiveSharedValue(\n animateOnMount ? -1 : _providedIndex\n );\n const animatedPosition = useSharedValue(INITIAL_POSITION);\n const animatedNextPosition = useSharedValue(INITIAL_VALUE);\n const animatedNextPositionIndex = useSharedValue(0);\n\n // conditional\n const isAnimatedOnMount = useSharedValue(false);\n const isContentHeightFixed = useSharedValue(false);\n const isLayoutCalculated = useDerivedValue(() => {\n let isContainerHeightCalculated = false;\n //container height was provided.\n if (\n _providedContainerHeight !== null ||\n _providedContainerHeight !== undefined\n ) {\n isContainerHeightCalculated = true;\n }\n // container height did set.\n if (animatedContainerHeight.value !== INITIAL_CONTAINER_HEIGHT) {\n isContainerHeightCalculated = true;\n }\n\n let isHandleHeightCalculated = false;\n // handle height is provided.\n if (\n _providedHandleHeight !== null &&\n _providedHandleHeight !== undefined &&\n typeof _providedHandleHeight === 'number'\n ) {\n isHandleHeightCalculated = true;\n }\n // handle component is null.\n if (handleComponent === null) {\n animatedHandleHeight.value = 0;\n isHandleHeightCalculated = true;\n }\n // handle height did set.\n if (animatedHandleHeight.value !== INITIAL_HANDLE_HEIGHT) {\n isHandleHeightCalculated = true;\n }\n\n let isSnapPointsNormalized = false;\n // the first snap point did normalized\n if (animatedSnapPoints.value[0] !== INITIAL_SNAP_POINT) {\n isSnapPointsNormalized = true;\n }\n\n return (\n isContainerHeightCalculated &&\n isHandleHeightCalculated &&\n isSnapPointsNormalized\n );\n });\n const isInTemporaryPosition = useSharedValue(false);\n const isForcedClosing = useSharedValue(false);\n\n // gesture\n const animatedContentGestureState = useSharedValue(\n State.UNDETERMINED\n );\n const animatedHandleGestureState = useSharedValue(\n State.UNDETERMINED\n );\n //#endregion\n\n //#region hooks variables\n // scrollable variables\n const {\n animatedScrollableType,\n animatedScrollableContentOffsetY,\n animatedScrollableOverrideState,\n isScrollableRefreshable,\n setScrollableRef,\n removeScrollableRef,\n } = useScrollable();\n // keyboard\n const {\n state: animatedKeyboardState,\n height: animatedKeyboardHeight,\n animationDuration: keyboardAnimationDuration,\n animationEasing: keyboardAnimationEasing,\n shouldHandleKeyboardEvents,\n } = useKeyboard();\n const animatedKeyboardHeightInContainer = useSharedValue(0);\n //#endregion\n\n //#region state/dynamic variables\n // states\n const animatedAnimationState = useSharedValue(ANIMATION_STATE.UNDETERMINED);\n const animatedAnimationSource = useSharedValue(\n ANIMATION_SOURCE.MOUNT\n );\n const animatedSheetState = useDerivedValue(() => {\n // closed position = position >= container height\n if (animatedPosition.value >= animatedClosedPosition.value)\n return SHEET_STATE.CLOSED;\n\n // extended position = container height - sheet height\n const extendedPosition =\n animatedContainerHeight.value - animatedSheetHeight.value;\n if (animatedPosition.value === extendedPosition)\n return SHEET_STATE.EXTENDED;\n\n // extended position with keyboard =\n // container height - (sheet height + keyboard height in root container)\n const keyboardHeightInContainer = animatedKeyboardHeightInContainer.value;\n const extendedPositionWithKeyboard = Math.max(\n 0,\n animatedContainerHeight.value -\n (animatedSheetHeight.value + keyboardHeightInContainer)\n );\n\n // detect if keyboard is open and the sheet is in temporary position\n if (\n keyboardBehavior === KEYBOARD_BEHAVIOR.interactive &&\n isInTemporaryPosition.value &&\n animatedPosition.value === extendedPositionWithKeyboard\n ) {\n return SHEET_STATE.EXTENDED;\n }\n\n // fill parent = 0\n if (animatedPosition.value === 0) {\n return SHEET_STATE.FILL_PARENT;\n }\n\n // detect if position is below extended point\n if (animatedPosition.value < extendedPosition) {\n return SHEET_STATE.OVER_EXTENDED;\n }\n\n return SHEET_STATE.OPENED;\n }, [\n animatedClosedPosition,\n animatedContainerHeight,\n animatedKeyboardHeightInContainer,\n animatedPosition,\n animatedSheetHeight,\n isInTemporaryPosition,\n keyboardBehavior,\n ]);\n const animatedScrollableState = useDerivedValue(() => {\n /**\n * if scrollable override state is set, then we just return its value.\n */\n if (\n animatedScrollableOverrideState.value !== SCROLLABLE_STATE.UNDETERMINED\n ) {\n return animatedScrollableOverrideState.value;\n }\n /**\n * if sheet state is fill parent, then unlock scrolling\n */\n if (animatedSheetState.value === SHEET_STATE.FILL_PARENT) {\n return SCROLLABLE_STATE.UNLOCKED;\n }\n\n /**\n * if sheet state is extended, then unlock scrolling\n */\n if (animatedSheetState.value === SHEET_STATE.EXTENDED) {\n return SCROLLABLE_STATE.UNLOCKED;\n }\n\n /**\n * if keyboard is shown and sheet is animating\n * then we do not lock the scrolling to not lose\n * current scrollable scroll position.\n */\n if (\n animatedKeyboardState.value === KEYBOARD_STATE.SHOWN &&\n animatedAnimationState.value === ANIMATION_STATE.RUNNING\n ) {\n return SCROLLABLE_STATE.UNLOCKED;\n }\n\n return SCROLLABLE_STATE.LOCKED;\n });\n // dynamic\n const animatedContentHeightMax = useDerivedValue(() => {\n const keyboardHeightInContainer = animatedKeyboardHeightInContainer.value;\n const handleHeight = Math.max(0, animatedHandleHeight.value);\n let contentHeight = animatedSheetHeight.value - handleHeight;\n\n if (\n keyboardBehavior === KEYBOARD_BEHAVIOR.extend &&\n animatedKeyboardState.value === KEYBOARD_STATE.SHOWN\n ) {\n contentHeight = contentHeight - keyboardHeightInContainer;\n } else if (\n keyboardBehavior === KEYBOARD_BEHAVIOR.fillParent &&\n isInTemporaryPosition.value\n ) {\n if (animatedKeyboardState.value === KEYBOARD_STATE.SHOWN) {\n contentHeight =\n animatedContainerHeight.value -\n handleHeight -\n keyboardHeightInContainer;\n } else {\n contentHeight = animatedContainerHeight.value - handleHeight;\n }\n } else if (\n keyboardBehavior === KEYBOARD_BEHAVIOR.interactive &&\n isInTemporaryPosition.value\n ) {\n const contentWithKeyboardHeight =\n contentHeight + keyboardHeightInContainer;\n\n if (animatedKeyboardState.value === KEYBOARD_STATE.SHOWN) {\n if (\n keyboardHeightInContainer + animatedSheetHeight.value >\n animatedContainerHeight.value\n ) {\n contentHeight =\n animatedContainerHeight.value -\n keyboardHeightInContainer -\n handleHeight;\n }\n } else if (\n contentWithKeyboardHeight + handleHeight >\n animatedContainerHeight.value\n ) {\n contentHeight = animatedContainerHeight.value - handleHeight;\n } else {\n contentHeight = contentWithKeyboardHeight;\n }\n }\n\n /**\n * before the container is measured, `contentHeight` value will be below zero,\n * which will lead to freeze the scrollable.\n *\n * @link (https://github.com/gorhom/react-native-bottom-sheet/issues/470)\n */\n return Math.max(contentHeight, 0);\n }, [\n animatedContainerHeight,\n animatedHandleHeight,\n animatedKeyboardHeightInContainer,\n animatedKeyboardState,\n animatedSheetHeight,\n isInTemporaryPosition,\n keyboardBehavior,\n ]);\n const animatedIndex = useDerivedValue(() => {\n const adjustedSnapPoints = animatedSnapPoints.value.slice().reverse();\n const adjustedSnapPointsIndexes = animatedSnapPoints.value\n .slice()\n .map((_: any, index: number) => index)\n .reverse();\n\n /**\n * we add the close state index `-1`\n */\n adjustedSnapPoints.push(animatedContainerHeight.value);\n adjustedSnapPointsIndexes.push(-1);\n\n const currentIndex = isLayoutCalculated.value\n ? interpolate(\n animatedPosition.value,\n adjustedSnapPoints,\n adjustedSnapPointsIndexes,\n Extrapolate.CLAMP\n )\n : -1;\n\n /**\n * if the sheet is currently running an animation by the keyboard opening,\n * then we clamp the index on android with resize keyboard mode.\n */\n if (\n android_keyboardInputMode === KEYBOARD_INPUT_MODE.adjustResize &&\n animatedAnimationSource.value === ANIMATION_SOURCE.KEYBOARD &&\n animatedAnimationState.value === ANIMATION_STATE.RUNNING &&\n isInTemporaryPosition.value\n ) {\n return Math.max(animatedCurrentIndex.value, currentIndex);\n }\n\n /**\n * if the sheet is currently running an animation by snap point change - usually caused\n * by dynamic content height -, then we return the next position index.\n */\n if (\n animatedAnimationSource.value === ANIMATION_SOURCE.SNAP_POINT_CHANGE &&\n animatedAnimationState.value === ANIMATION_STATE.RUNNING\n ) {\n return animatedNextPositionIndex.value;\n }\n\n return currentIndex;\n }, [android_keyboardInputMode]);\n //#endregion\n\n //#region private methods\n /**\n * Calculate the next position based on keyboard state.\n */\n const getNextPosition = useWorkletCallback(\n function getNextPosition() {\n 'worklet';\n const currentIndex = animatedCurrentIndex.value;\n const snapPoints = animatedSnapPoints.value;\n const keyboardState = animatedKeyboardState.value;\n const highestSnapPoint = animatedHighestSnapPoint.value;\n\n /**\n * Handle restore sheet position on blur\n */\n if (\n keyboardBlurBehavior === KEYBOARD_BLUR_BEHAVIOR.restore &&\n keyboardState === KEYBOARD_STATE.HIDDEN &&\n animatedContentGestureState.value !== State.ACTIVE &&\n animatedHandleGestureState.value !== State.ACTIVE\n ) {\n isInTemporaryPosition.value = false;\n const nextPosition = snapPoints[currentIndex];\n return nextPosition;\n }\n\n /**\n * Handle extend behavior\n */\n if (\n keyboardBehavior === KEYBOARD_BEHAVIOR.extend &&\n keyboardState === KEYBOARD_STATE.SHOWN\n ) {\n return highestSnapPoint;\n }\n\n /**\n * Handle full screen behavior\n */\n if (\n keyboardBehavior === KEYBOARD_BEHAVIOR.fillParent &&\n keyboardState === KEYBOARD_STATE.SHOWN\n ) {\n isInTemporaryPosition.value = true;\n return 0;\n }\n\n /**\n * handle interactive behavior\n */\n if (\n keyboardBehavior === KEYBOARD_BEHAVIOR.interactive &&\n keyboardState === KEYBOARD_STATE.SHOWN\n ) {\n isInTemporaryPosition.value = true;\n const keyboardHeightInContainer =\n animatedKeyboardHeightInContainer.value;\n return Math.max(0, highestSnapPoint - keyboardHeightInContainer);\n }\n\n if (isInTemporaryPosition.value) {\n return animatedPosition.value;\n }\n\n return snapPoints[currentIndex];\n },\n [\n animatedContentGestureState,\n animatedCurrentIndex,\n animatedHandleGestureState,\n animatedHighestSnapPoint,\n animatedKeyboardHeightInContainer,\n animatedKeyboardState,\n animatedPosition,\n animatedSnapPoints,\n isInTemporaryPosition,\n keyboardBehavior,\n keyboardBlurBehavior,\n ]\n );\n const handleOnChange = useCallback(\n function handleOnChange(index: number) {\n print({\n component: BottomSheet.name,\n method: handleOnChange.name,\n params: {\n index,\n animatedCurrentIndex: animatedCurrentIndex.value,\n },\n });\n\n if (_providedOnChange) {\n _providedOnChange(index);\n }\n },\n [_providedOnChange, animatedCurrentIndex]\n );\n const handleOnAnimate = useCallback(\n function handleOnAnimate(toPoint: number) {\n const snapPoints = animatedSnapPoints.value;\n const toIndex = snapPoints.indexOf(toPoint);\n\n print({\n component: BottomSheet.name,\n method: handleOnAnimate.name,\n params: {\n toIndex,\n fromIndex: animatedCurrentIndex.value,\n },\n });\n\n if (!_providedOnAnimate) {\n return;\n }\n\n if (toIndex !== animatedCurrentIndex.value) {\n _providedOnAnimate(animatedCurrentIndex.value, toIndex);\n }\n },\n [_providedOnAnimate, animatedSnapPoints, animatedCurrentIndex]\n );\n //#endregion\n\n //#region animation\n const stopAnimation = useWorkletCallback(() => {\n cancelAnimation(animatedPosition);\n isForcedClosing.value = false;\n animatedAnimationSource.value = ANIMATION_SOURCE.NONE;\n animatedAnimationState.value = ANIMATION_STATE.STOPPED;\n }, [animatedPosition, animatedAnimationState, animatedAnimationSource]);\n const animateToPositionCompleted = useWorkletCallback(\n function animateToPositionCompleted(isFinished?: boolean) {\n isForcedClosing.value = false;\n\n if (!isFinished) {\n return;\n }\n runOnJS(print)({\n component: BottomSheet.name,\n method: animateToPositionCompleted.name,\n params: {\n animatedCurrentIndex: animatedCurrentIndex.value,\n animatedNextPosition: animatedNextPosition.value,\n animatedNextPositionIndex: animatedNextPositionIndex.value,\n },\n });\n\n animatedAnimationSource.value = ANIMATION_SOURCE.NONE;\n animatedAnimationState.value = ANIMATION_STATE.STOPPED;\n animatedNextPosition.value = INITIAL_VALUE;\n animatedNextPositionIndex.value = INITIAL_VALUE;\n }\n );\n const animateToPosition: AnimateToPositionType = useWorkletCallback(\n function animateToPosition(\n position: number,\n source: ANIMATION_SOURCE,\n velocity: number = 0,\n configs?: WithTimingConfig | WithSpringConfig\n ) {\n if (\n position === animatedPosition.value ||\n position === undefined ||\n (animatedAnimationState.value === ANIMATION_STATE.RUNNING &&\n position === animatedNextPosition.value)\n ) {\n return;\n }\n\n runOnJS(print)({\n component: BottomSheet.name,\n method: animateToPosition.name,\n params: {\n currentPosition: animatedPosition.value,\n position,\n velocity,\n animatedContainerHeight: animatedContainerHeight.value,\n },\n });\n\n stopAnimation();\n\n /**\n * set animation state to running, and source\n */\n animatedAnimationState.value = ANIMATION_STATE.RUNNING;\n animatedAnimationSource.value = source;\n\n /**\n * store next position\n */\n animatedNextPosition.value = position;\n animatedNextPositionIndex.value =\n animatedSnapPoints.value.indexOf(position);\n\n /**\n * fire `onAnimate` callback\n */\n runOnJS(handleOnAnimate)(position);\n\n /**\n * force animation configs from parameters, if provided\n */\n if (configs !== undefined) {\n animatedPosition.value = animate({\n point: position,\n configs,\n velocity,\n onComplete: animateToPositionCompleted,\n });\n } else {\n /**\n * use animationConfigs callback, if provided\n */\n animatedPosition.value = animate({\n point: position,\n velocity,\n configs: _providedAnimationConfigs,\n onComplete: animateToPositionCompleted,\n });\n }\n },\n [handleOnAnimate, _providedAnimationConfigs]\n );\n //#endregion\n\n //#region public methods\n const handleSnapToIndex = useCallback(\n function handleSnapToIndex(\n index: number,\n animationConfigs?: WithSpringConfig | WithTimingConfig\n ) {\n const snapPoints = animatedSnapPoints.value;\n invariant(\n index >= -1 && index <= snapPoints.length - 1,\n `'index' was provided but out of the provided snap points range! expected value to be between -1, ${\n snapPoints.length - 1\n }`\n );\n print({\n component: BottomSheet.name,\n method: handleSnapToIndex.name,\n params: {\n index,\n },\n });\n\n const nextPosition = snapPoints[index];\n\n /**\n * exit method if :\n * - layout is not calculated.\n * - already animating to next position.\n * - sheet is forced closing.\n */\n if (\n !isLayoutCalculated.value ||\n index === animatedNextPositionIndex.value ||\n nextPosition === animatedNextPosition.value ||\n isForcedClosing.value\n ) {\n return;\n }\n\n /**\n * reset temporary position boolean.\n */\n isInTemporaryPosition.value = false;\n\n runOnUI(animateToPosition)(\n nextPosition,\n ANIMATION_SOURCE.USER,\n 0,\n animationConfigs\n );\n },\n [\n animateToPosition,\n isLayoutCalculated,\n isInTemporaryPosition,\n isForcedClosing,\n animatedSnapPoints,\n animatedNextPosition,\n animatedNextPositionIndex,\n ]\n );\n const handleSnapToPosition = useWorkletCallback(\n function handleSnapToPosition(\n position: number | string,\n animationConfigs?: WithSpringConfig | WithTimingConfig\n ) {\n print({\n component: BottomSheet.name,\n method: handleSnapToPosition.name,\n params: {\n position,\n },\n });\n\n /**\n * normalized provided position.\n */\n const nextPosition = normalizeSnapPoint(\n position,\n animatedContainerHeight.value\n );\n\n /**\n * exit method if :\n * - layout is not calculated.\n * - already animating to next position.\n * - sheet is forced closing.\n */\n if (\n !isLayoutCalculated ||\n nextPosition === animatedNextPosition.value ||\n isForcedClosing.value\n ) {\n return;\n }\n\n /**\n * mark the new position as temporary.\n */\n isInTemporaryPosition.value = true;\n\n runOnUI(animateToPosition)(\n nextPosition,\n ANIMATION_SOURCE.USER,\n 0,\n animationConfigs\n );\n },\n [\n animateToPosition,\n bottomInset,\n topInset,\n isLayoutCalculated,\n isForcedClosing,\n animatedContainerHeight,\n animatedPosition,\n ]\n );\n const handleClose = useCallback(\n function handleClose(\n animationConfigs?: WithSpringConfig | WithTimingConfig\n ) {\n print({\n component: BottomSheet.name,\n method: handleClose.name,\n });\n\n const nextPosition = animatedClosedPosition.value;\n\n /**\n * exit method if :\n * - layout is not calculated.\n * - already animating to next position.\n * - sheet is forced closing.\n */\n if (\n !isLayoutCalculated.value ||\n nextPosition === animatedNextPosition.value ||\n isForcedClosing.value\n ) {\n return;\n }\n\n /**\n * reset temporary position variable.\n */\n isInTemporaryPosition.value = false;\n\n runOnUI(animateToPosition)(\n nextPosition,\n ANIMATION_SOURCE.USER,\n 0,\n animationConfigs\n );\n },\n [\n animateToPosition,\n isForcedClosing,\n isLayoutCalculated,\n isInTemporaryPosition,\n animatedNextPosition,\n animatedClosedPosition,\n ]\n );\n const handleForceClose = useCallback(\n function handleForceClose(\n animationConfigs?: WithSpringConfig | WithTimingConfig\n ) {\n print({\n component: BottomSheet.name,\n method: handleForceClose.name,\n });\n\n const nextPosition = animatedClosedPosition.value;\n\n /**\n * exit method if :\n * - already animating to next position.\n * - sheet is forced closing.\n */\n if (\n nextPosition === animatedNextPosition.value ||\n isForcedClosing.value\n ) {\n return;\n }\n\n /**\n * reset temporary position variable.\n */\n isInTemporaryPosition.value = false;\n\n /**\n * set force closing variable.\n */\n isForcedClosing.value = true;\n\n runOnUI(animateToPosition)(\n nextPosition,\n ANIMATION_SOURCE.USER,\n 0,\n animationConfigs\n );\n },\n [\n animateToPosition,\n isForcedClosing,\n isInTemporaryPosition,\n animatedNextPosition,\n animatedClosedPosition,\n ]\n );\n const handleExpand = useCallback(\n function handleExpand(\n animationConfigs?: WithSpringConfig | WithTimingConfig\n ) {\n print({\n component: BottomSheet.name,\n method: handleExpand.name,\n });\n\n const snapPoints = animatedSnapPoints.value;\n const nextPosition = snapPoints[snapPoints.length - 1];\n\n /**\n * exit method if :\n * - layout is not calculated.\n * - already animating to next position.\n * - sheet is forced closing.\n */\n if (\n !isLayoutCalculated.value ||\n snapPoints.length - 1 === animatedNextPositionIndex.value ||\n nextPosition === animatedNextPosition.value ||\n isForcedClosing.value\n ) {\n return;\n }\n\n /**\n * reset temporary position boolean.\n */\n isInTemporaryPosition.value = false;\n\n runOnUI(animateToPosition)(\n nextPosition,\n ANIMATION_SOURCE.USER,\n 0,\n animationConfigs\n );\n },\n [\n animateToPosition,\n isInTemporaryPosition,\n isLayoutCalculated,\n isForcedClosing,\n animatedSnapPoints,\n animatedNextPosition,\n animatedNextPositionIndex,\n ]\n );\n const handleCollapse = useCallback(\n function handleCollapse(\n animationConfigs?: WithSpringConfig | WithTimingConfig\n ) {\n print({\n component: BottomSheet.name,\n method: handleCollapse.name,\n });\n\n const nextPosition = animatedSnapPoints.value[0];\n\n /**\n * exit method if :\n * - layout is not calculated.\n * - already animating to next position.\n * - sheet is forced closing.\n */\n if (\n !isLayoutCalculated ||\n animatedNextPositionIndex.value === 0 ||\n nextPosition === animatedNextPosition.value ||\n isForcedClosing.value\n ) {\n return;\n }\n\n /**\n * reset temporary position boolean.\n */\n isInTemporaryPosition.value = false;\n\n runOnUI(animateToPosition)(\n nextPosition,\n ANIMATION_SOURCE.USER,\n 0,\n animationConfigs\n );\n },\n [\n animateToPosition,\n isForcedClosing,\n isLayoutCalculated,\n isInTemporaryPosition,\n animatedSnapPoints,\n animatedNextPosition,\n animatedNextPositionIndex,\n ]\n );\n\n useImperativeHandle(ref, () => ({\n snapToIndex: handleSnapToIndex,\n snapToPosition: handleSnapToPosition,\n expand: handleExpand,\n collapse: handleCollapse,\n close: handleClose,\n forceClose: handleForceClose,\n }));\n //#endregion\n\n //#region contexts variables\n const internalContextVariables = useMemo(\n () => ({\n enableContentPanningGesture,\n enableDynamicSizing,\n overDragResistanceFactor,\n enableOverDrag,\n enablePanDownToClose,\n animatedAnimationState,\n animatedSheetState,\n animatedScrollableState,\n animatedScrollableOverrideState,\n animatedContentGestureState,\n animatedHandleGestureState,\n animatedKeyboardState,\n animatedScrollableType,\n animatedIndex,\n animatedPosition,\n animatedContentHeight,\n animatedClosedPosition,\n animatedHandleHeight,\n animatedFooterHeight,\n animatedKeyboardHeight,\n animatedKeyboardHeightInContainer,\n animatedContainerHeight,\n animatedSnapPoints,\n animatedHighestSnapPoint,\n animatedScrollableContentOffsetY,\n isInTemporaryPosition,\n isContentHeightFixed,\n isScrollableRefreshable,\n shouldHandleKeyboardEvents,\n simultaneousHandlers: _providedSimultaneousHandlers,\n waitFor: _providedWaitFor,\n activeOffsetX: _providedActiveOffsetX,\n activeOffsetY: _providedActiveOffsetY,\n failOffsetX: _providedFailOffsetX,\n failOffsetY: _providedFailOffsetY,\n animateToPosition,\n stopAnimation,\n setScrollableRef,\n removeScrollableRef,\n }),\n [\n animatedIndex,\n animatedPosition,\n animatedContentHeight,\n animatedScrollableType,\n animatedContentGestureState,\n animatedHandleGestureState,\n animatedClosedPosition,\n animatedFooterHeight,\n animatedContainerHeight,\n animatedHandleHeight,\n animatedAnimationState,\n animatedKeyboardState,\n animatedKeyboardHeight,\n animatedKeyboardHeightInContainer,\n animatedSheetState,\n animatedHighestSnapPoint,\n animatedScrollableState,\n animatedScrollableOverrideState,\n animatedSnapPoints,\n shouldHandleKeyboardEvents,\n animatedScrollableContentOffsetY,\n isScrollableRefreshable,\n isContentHeightFixed,\n isInTemporaryPosition,\n enableContentPanningGesture,\n overDragResistanceFactor,\n enableOverDrag,\n enablePanDownToClose,\n enableDynamicSizing,\n _providedSimultaneousHandlers,\n _providedWaitFor,\n _providedActiveOffsetX,\n _providedActiveOffsetY,\n _providedFailOffsetX,\n _providedFailOffsetY,\n setScrollableRef,\n removeScrollableRef,\n animateToPosition,\n stopAnimation,\n ]\n );\n const externalContextVariables = useMemo(\n () => ({\n animatedIndex,\n animatedPosition,\n snapToIndex: handleSnapToIndex,\n snapToPosition: handleSnapToPosition,\n expand: handleExpand,\n collapse: handleCollapse,\n close: handleClose,\n forceClose: handleForceClose,\n }),\n [\n animatedIndex,\n animatedPosition,\n handleSnapToIndex,\n handleSnapToPosition,\n handleExpand,\n handleCollapse,\n handleClose,\n handleForceClose,\n ]\n );\n //#endregion\n\n //#region styles\n const containerAnimatedStyle = useAnimatedStyle(\n () => ({\n opacity:\n Platform.OS === 'android' && animatedIndex.value === -1 ? 0 : 1,\n transform: [\n {\n translateY: animatedPosition.value,\n },\n ],\n }),\n [animatedPosition, animatedIndex]\n );\n const containerStyle = useMemo(\n () => [_providedStyle, styles.container, containerAnimatedStyle],\n [_providedStyle, containerAnimatedStyle]\n );\n const contentContainerAnimatedStyle = useAnimatedStyle(() => {\n /**\n * if content height was provided, then we skip setting\n * calculated height.\n */\n if (_providedContentHeight) {\n return {};\n }\n\n return {\n height: animate({\n point: animatedContentHeightMax.value,\n configs: _providedAnimationConfigs,\n }),\n };\n }, [animatedContentHeightMax, enableDynamicSizing, animatedContentHeight]);\n const contentContainerStyle = useMemo(\n () => [styles.contentContainer, contentContainerAnimatedStyle],\n [contentContainerAnimatedStyle]\n );\n /**\n * added safe area to prevent the sheet from floating above\n * the bottom of the screen, when sheet being over dragged or\n * when the sheet is resized.\n */\n const contentMaskContainerAnimatedStyle = useAnimatedStyle(() => {\n if (detached) {\n return {\n overflow: 'visible',\n };\n }\n return {\n paddingBottom: animatedContainerHeight.value,\n };\n }, [detached]);\n const contentMaskContainerStyle = useMemo(\n () => [styles.contentMaskContainer, contentMaskContainerAnimatedStyle],\n [contentMaskContainerAnimatedStyle]\n );\n //#endregion\n\n //#region effects\n /**\n * React to `isLayoutCalculated` change, to insure that the sheet will\n * appears/mounts only when all layout is been calculated.\n *\n * @alias OnMount\n */\n useAnimatedReaction(\n () => isLayoutCalculated.value,\n _isLayoutCalculated => {\n /**\n * exit method if:\n * - layout is not calculated yet.\n * - already did animate on mount.\n */\n if (!_isLayoutCalculated || isAnimatedOnMount.value) {\n return;\n }\n\n let nextPosition;\n if (_providedIndex === -1) {\n nextPosition = animatedClosedPosition.value;\n animatedNextPositionIndex.value = -1;\n } else {\n nextPosition = animatedSnapPoints.value[_providedIndex];\n }\n\n runOnJS(print)({\n component: BottomSheet.name,\n method: 'useAnimatedReaction::OnMount',\n params: {\n isLayoutCalculated: _isLayoutCalculated,\n animatedSnapPoints: animatedSnapPoints.value,\n nextPosition,\n },\n });\n\n /**\n * here we exit method early because the next position\n * is out of the screen, this happens when `snapPoints`\n * still being calculated.\n */\n if (\n nextPosition === INITIAL_POSITION ||\n nextPosition === animatedClosedPosition.value\n ) {\n isAnimatedOnMount.value = true;\n animatedCurrentIndex.value = _providedIndex;\n return;\n }\n\n if (animateOnMount) {\n animateToPosition(nextPosition, ANIMATION_SOURCE.MOUNT);\n } else {\n animatedPosition.value = nextPosition;\n }\n isAnimatedOnMount.value = true;\n },\n [_providedIndex, animateOnMount]\n );\n\n /**\n * React to `snapPoints` change, to insure that the sheet position reflect\n * to the current point correctly.\n *\n * @alias OnSnapPointsChange\n */\n useAnimatedReaction(\n () => ({\n snapPoints: animatedSnapPoints.value,\n containerHeight: animatedContainerHeight.value,\n }),\n (result, _previousResult) => {\n const { snapPoints, containerHeight } = result;\n const _previousSnapPoints = _previousResult?.snapPoints;\n const _previousContainerHeight = _previousResult?.containerHeight;\n\n let nextPosition;\n let animationConfig;\n let animationSource = ANIMATION_SOURCE.SNAP_POINT_CHANGE;\n\n /**\n * if the bottom sheet is closing and the container gets resized,\n * then we restart the closing animation to the new position.\n */\n if (\n animatedAnimationState.value === ANIMATION_STATE.RUNNING &&\n animatedNextPositionIndex.value === -1 &&\n _previousContainerHeight !== containerHeight\n ) {\n animationSource = ANIMATION_SOURCE.CONTAINER_RESIZE;\n animationConfig = {\n duration: 0,\n };\n animateToPosition(\n containerHeight,\n animationSource,\n 0,\n animationConfig\n );\n }\n\n if (\n JSON.stringify(snapPoints) === JSON.stringify(_previousSnapPoints) ||\n !isLayoutCalculated.value ||\n !isAnimatedOnMount.value ||\n containerHeight <= 0\n ) {\n return;\n }\n\n runOnJS(print)({\n component: BottomSheet.name,\n method: 'useAnimatedReaction::OnSnapPointChange',\n params: {\n snapPoints,\n },\n });\n\n /**\n * if snap points changed while sheet is animating, then\n * we stop the animation and animate to the updated point.\n */\n if (\n animatedAnimationState.value === ANIMATION_STATE.RUNNING &&\n animatedNextPositionIndex.value !== animatedCurrentIndex.value\n ) {\n nextPosition =\n animatedNextPositionIndex.value !== -1\n ? snapPoints[animatedNextPositionIndex.value]\n : animatedNextPosition.value;\n } else if (animatedCurrentIndex.value === -1) {\n nextPosition = animatedClosedPosition.value;\n } else if (isInTemporaryPosition.value) {\n nextPosition = getNextPosition();\n } else {\n nextPosition = snapPoints[animatedCurrentIndex.value];\n\n /**\n * if snap points changes because of the container height change,\n * then we skip the snap animation by setting the duration to 0.\n */\n if (containerHeight !== _previousContainerHeight) {\n animationSource = ANIMATION_SOURCE.CONTAINER_RESIZE;\n animationConfig = {\n duration: 0,\n };\n }\n }\n animateToPosition(nextPosition, animationSource, 0, animationConfig);\n }\n );\n\n /**\n * React to keyboard appearance state.\n *\n * @alias OnKeyboardStateChange\n */\n useAnimatedReaction(\n () => ({\n _keyboardState: animatedKeyboardState.value,\n _keyboardHeight: animatedKeyboardHeight.value,\n }),\n (result, _previousResult) => {\n const { _keyboardState, _keyboardHeight } = result;\n const _previousKeyboardState = _previousResult?._keyboardState;\n const _previousKeyboardHeight = _previousResult?._keyboardHeight;\n\n /**\n * Calculate the keyboard height in the container.\n */\n animatedKeyboardHeightInContainer.value = $modal\n ? Math.abs(\n _keyboardHeight -\n Math.abs(bottomInset - animatedContainerOffset.value.bottom)\n )\n : Math.abs(_keyboardHeight - animatedContainerOffset.value.bottom);\n\n const hasActiveGesture =\n animatedContentGestureState.value === State.ACTIVE ||\n animatedContentGestureState.value === State.BEGAN ||\n animatedHandleGestureState.value === State.ACTIVE ||\n animatedHandleGestureState.value === State.BEGAN;\n\n if (\n /**\n * if keyboard state is equal to the previous state, then exit the method\n */\n (_keyboardState === _previousKeyboardState &&\n _keyboardHeight === _previousKeyboardHeight) ||\n /**\n * if user is interacting with sheet, then exit the method\n */\n hasActiveGesture ||\n /**\n * if sheet not animated on mount yet, then exit the method\n */\n !isAnimatedOnMount.value ||\n /**\n * if new keyboard state is hidden and blur behavior is none, then exit the method\n */\n (_keyboardState === KEYBOARD_STATE.HIDDEN &&\n keyboardBlurBehavior === KEYBOARD_BLUR_BEHAVIOR.none) ||\n /**\n * if platform is android and the input mode is resize, then exit the method\n */\n (Platform.OS === 'android' &&\n keyboardBehavior === KEYBOARD_BEHAVIOR.interactive &&\n android_keyboardInputMode === KEYBOARD_INPUT_MODE.adjustResize)\n ) {\n animatedKeyboardHeightInContainer.value = 0;\n return;\n }\n\n runOnJS(print)({\n component: BottomSheet.name,\n method: 'useAnimatedReaction::OnKeyboardStateChange',\n params: {\n keyboardState: _keyboardState,\n keyboardHeight: _keyboardHeight,\n },\n });\n\n let animationConfigs = getKeyboardAnimationConfigs(\n keyboardAnimationEasing.value,\n keyboardAnimationDuration.value\n );\n const nextPosition = getNextPosition();\n animateToPosition(\n nextPosition,\n ANIMATION_SOURCE.KEYBOARD,\n 0,\n animationConfigs\n );\n },\n [\n $modal,\n bottomInset,\n keyboardBehavior,\n keyboardBlurBehavior,\n android_keyboardInputMode,\n animatedContainerOffset,\n getNextPosition,\n ]\n );\n\n /**\n * sets provided animated position\n */\n useAnimatedReaction(\n () => animatedPosition.value,\n _animatedPosition => {\n if (_providedAnimatedPosition) {\n _providedAnimatedPosition.value = _animatedPosition + topInset;\n }\n }\n );\n\n /**\n * sets provided animated index\n */\n useAnimatedReaction(\n () => animatedIndex.value,\n _animatedIndex => {\n if (_providedAnimatedIndex) {\n _providedAnimatedIndex.value = _animatedIndex;\n }\n }\n );\n\n /**\n * React to internal variables to detect change in snap position.\n *\n * @alias OnChange\n */\n useAnimatedReaction(\n () => ({\n _animatedIndex: animatedIndex.value,\n _animatedPosition: animatedPosition.value,\n _animationState: animatedAnimationState.value,\n _contentGestureState: animatedContentGestureState.value,\n _handleGestureState: animatedHandleGestureState.value,\n }),\n ({\n _animatedIndex,\n _animationState,\n _contentGestureState,\n _handleGestureState,\n }) => {\n /**\n * exit the method if animation state is not stopped.\n */\n if (_animationState !== ANIMATION_STATE.STOPPED) {\n return;\n }\n\n /**\n * exit the method if animated index value\n * has fraction, e.g. 1.99, 0.52\n */\n if (_animatedIndex % 1 !== 0) {\n return;\n }\n\n /**\n * exit the method if there any active gesture.\n */\n const hasNoActiveGesture =\n (_contentGestureState === State.END ||\n _contentGestureState === State.UNDETERMINED ||\n _contentGestureState === State.CANCELLED) &&\n (_handleGestureState === State.END ||\n _handleGestureState === State.UNDETERMINED ||\n _handleGestureState === State.CANCELLED);\n if (!hasNoActiveGesture) {\n return;\n }\n\n /**\n * if the index is not equal to the current index,\n * than the sheet position had changed and we trigger\n * the `onChange` callback.\n */\n if (_animatedIndex !== animatedCurrentIndex.value) {\n runOnJS(print)({\n component: BottomSheet.name,\n method: 'useAnimatedReaction::OnChange',\n params: {\n animatedCurrentIndex: animatedCurrentIndex.value,\n animatedIndex: _animatedIndex,\n },\n });\n\n animatedCurrentIndex.value = _animatedIndex;\n runOnJS(handleOnChange)(_animatedIndex);\n }\n\n /**\n * if index is `-1` than we fire the `onClose` callback.\n */\n if (_animatedIndex === -1 && _providedOnClose) {\n runOnJS(print)({\n component: BottomSheet.name,\n method: 'useAnimatedReaction::onClose',\n params: {\n animatedCurrentIndex: animatedCurrentIndex.value,\n animatedIndex: _animatedIndex,\n },\n });\n runOnJS(_providedOnClose)();\n }\n },\n [handleOnChange, _providedOnClose]\n );\n\n /**\n * React to `index` prop to snap the sheet to the new position.\n *\n * @alias onIndexChange\n */\n useEffect(() => {\n if (isAnimatedOnMount.value) {\n handleSnapToIndex(_providedIndex);\n }\n }, [\n _providedIndex,\n animatedCurrentIndex,\n isAnimatedOnMount,\n handleSnapToIndex,\n ]);\n //#endregion\n\n // render\n print({\n component: BottomSheet.name,\n method: 'render',\n params: {\n animatedSnapPoints: animatedSnapPoints.value,\n animatedCurrentIndex: animatedCurrentIndex.value,\n providedIndex: _providedIndex,\n },\n });\n return (\n \n \n \n \n \n \n \n \n \n {typeof Content === 'function' ? : Content}\n\n {footerComponent && (\n \n )}\n \n \n \n \n {/* */}\n \n \n \n \n );\n }\n);\n\nconst BottomSheet = memo(BottomSheetComponent);\nBottomSheet.displayName = 'BottomSheet';\n\nexport default BottomSheet;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheet/constants.js b/lib/commonjs/components/bottomSheet/constants.js deleted file mode 100644 index 8ab6b9974..000000000 --- a/lib/commonjs/components/bottomSheet/constants.js +++ /dev/null @@ -1,52 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.INITIAL_VALUE = exports.INITIAL_SNAP_POINT = exports.INITIAL_HANDLE_HEIGHT = exports.INITIAL_CONTAINER_OFFSET = exports.INITIAL_CONTAINER_HEIGHT = exports.INITIAL_POSITION = exports.DEFAULT_KEYBOARD_INPUT_MODE = exports.DEFAULT_KEYBOARD_BLUR_BEHAVIOR = exports.DEFAULT_KEYBOARD_BEHAVIOR = exports.DEFAULT_ANIMATE_ON_MOUNT = exports.DEFAULT_DYNAMIC_SIZING = exports.DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE = exports.DEFAULT_ENABLE_OVER_DRAG = exports.DEFAULT_ENABLE_HANDLE_PANNING_GESTURE = exports.DEFAULT_ENABLE_CONTENT_PANNING_GESTURE = exports.DEFAULT_OVER_DRAG_RESISTANCE_FACTOR = exports.DEFAULT_HANDLE_HEIGHT = void 0; - -var _constants = require("../../constants"); - -// default values -const DEFAULT_HANDLE_HEIGHT = 24; -exports.DEFAULT_HANDLE_HEIGHT = DEFAULT_HANDLE_HEIGHT; -const DEFAULT_OVER_DRAG_RESISTANCE_FACTOR = 2.5; -exports.DEFAULT_OVER_DRAG_RESISTANCE_FACTOR = DEFAULT_OVER_DRAG_RESISTANCE_FACTOR; -const DEFAULT_ENABLE_CONTENT_PANNING_GESTURE = true; -exports.DEFAULT_ENABLE_CONTENT_PANNING_GESTURE = DEFAULT_ENABLE_CONTENT_PANNING_GESTURE; -const DEFAULT_ENABLE_HANDLE_PANNING_GESTURE = true; -exports.DEFAULT_ENABLE_HANDLE_PANNING_GESTURE = DEFAULT_ENABLE_HANDLE_PANNING_GESTURE; -const DEFAULT_ENABLE_OVER_DRAG = true; -exports.DEFAULT_ENABLE_OVER_DRAG = DEFAULT_ENABLE_OVER_DRAG; -const DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE = false; -exports.DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE = DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE; -const DEFAULT_ANIMATE_ON_MOUNT = true; -exports.DEFAULT_ANIMATE_ON_MOUNT = DEFAULT_ANIMATE_ON_MOUNT; -const DEFAULT_DYNAMIC_SIZING = false; // keyboard - -exports.DEFAULT_DYNAMIC_SIZING = DEFAULT_DYNAMIC_SIZING; -const DEFAULT_KEYBOARD_BEHAVIOR = _constants.KEYBOARD_BEHAVIOR.interactive; -exports.DEFAULT_KEYBOARD_BEHAVIOR = DEFAULT_KEYBOARD_BEHAVIOR; -const DEFAULT_KEYBOARD_BLUR_BEHAVIOR = _constants.KEYBOARD_BLUR_BEHAVIOR.none; -exports.DEFAULT_KEYBOARD_BLUR_BEHAVIOR = DEFAULT_KEYBOARD_BLUR_BEHAVIOR; -const DEFAULT_KEYBOARD_INPUT_MODE = _constants.KEYBOARD_INPUT_MODE.adjustPan; // initial values - -exports.DEFAULT_KEYBOARD_INPUT_MODE = DEFAULT_KEYBOARD_INPUT_MODE; -const INITIAL_VALUE = Number.NEGATIVE_INFINITY; -exports.INITIAL_VALUE = INITIAL_VALUE; -const INITIAL_SNAP_POINT = -999; -exports.INITIAL_SNAP_POINT = INITIAL_SNAP_POINT; -const INITIAL_CONTAINER_HEIGHT = -999; -exports.INITIAL_CONTAINER_HEIGHT = INITIAL_CONTAINER_HEIGHT; -const INITIAL_CONTAINER_OFFSET = { - top: 0, - bottom: 0, - left: 0, - right: 0 -}; -exports.INITIAL_CONTAINER_OFFSET = INITIAL_CONTAINER_OFFSET; -const INITIAL_HANDLE_HEIGHT = -999; -exports.INITIAL_HANDLE_HEIGHT = INITIAL_HANDLE_HEIGHT; -const INITIAL_POSITION = _constants.SCREEN_HEIGHT; -exports.INITIAL_POSITION = INITIAL_POSITION; -//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheet/constants.js.map b/lib/commonjs/components/bottomSheet/constants.js.map deleted file mode 100644 index 1c6c0352a..000000000 --- a/lib/commonjs/components/bottomSheet/constants.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["constants.ts"],"names":["DEFAULT_HANDLE_HEIGHT","DEFAULT_OVER_DRAG_RESISTANCE_FACTOR","DEFAULT_ENABLE_CONTENT_PANNING_GESTURE","DEFAULT_ENABLE_HANDLE_PANNING_GESTURE","DEFAULT_ENABLE_OVER_DRAG","DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE","DEFAULT_ANIMATE_ON_MOUNT","DEFAULT_DYNAMIC_SIZING","DEFAULT_KEYBOARD_BEHAVIOR","KEYBOARD_BEHAVIOR","interactive","DEFAULT_KEYBOARD_BLUR_BEHAVIOR","KEYBOARD_BLUR_BEHAVIOR","none","DEFAULT_KEYBOARD_INPUT_MODE","KEYBOARD_INPUT_MODE","adjustPan","INITIAL_VALUE","Number","NEGATIVE_INFINITY","INITIAL_SNAP_POINT","INITIAL_CONTAINER_HEIGHT","INITIAL_CONTAINER_OFFSET","top","bottom","left","right","INITIAL_HANDLE_HEIGHT","INITIAL_POSITION","SCREEN_HEIGHT"],"mappings":";;;;;;;AAAA;;AAOA;AACA,MAAMA,qBAAqB,GAAG,EAA9B;;AACA,MAAMC,mCAAmC,GAAG,GAA5C;;AACA,MAAMC,sCAAsC,GAAG,IAA/C;;AACA,MAAMC,qCAAqC,GAAG,IAA9C;;AACA,MAAMC,wBAAwB,GAAG,IAAjC;;AACA,MAAMC,gCAAgC,GAAG,KAAzC;;AACA,MAAMC,wBAAwB,GAAG,IAAjC;;AACA,MAAMC,sBAAsB,GAAG,KAA/B,C,CAEA;;;AACA,MAAMC,yBAAyB,GAAGC,6BAAkBC,WAApD;;AACA,MAAMC,8BAA8B,GAAGC,kCAAuBC,IAA9D;;AACA,MAAMC,2BAA2B,GAAGC,+BAAoBC,SAAxD,C,CAEA;;;AACA,MAAMC,aAAa,GAAGC,MAAM,CAACC,iBAA7B;;AACA,MAAMC,kBAAkB,GAAG,CAAC,GAA5B;;AACA,MAAMC,wBAAwB,GAAG,CAAC,GAAlC;;AACA,MAAMC,wBAAwB,GAAG;AAC/BC,EAAAA,GAAG,EAAE,CAD0B;AAE/BC,EAAAA,MAAM,EAAE,CAFuB;AAG/BC,EAAAA,IAAI,EAAE,CAHyB;AAI/BC,EAAAA,KAAK,EAAE;AAJwB,CAAjC;;AAMA,MAAMC,qBAAqB,GAAG,CAAC,GAA/B;;AACA,MAAMC,gBAAgB,GAAGC,wBAAzB","sourcesContent":["import {\n KEYBOARD_BEHAVIOR,\n KEYBOARD_BLUR_BEHAVIOR,\n KEYBOARD_INPUT_MODE,\n SCREEN_HEIGHT,\n} from '../../constants';\n\n// default values\nconst DEFAULT_HANDLE_HEIGHT = 24;\nconst DEFAULT_OVER_DRAG_RESISTANCE_FACTOR = 2.5;\nconst DEFAULT_ENABLE_CONTENT_PANNING_GESTURE = true;\nconst DEFAULT_ENABLE_HANDLE_PANNING_GESTURE = true;\nconst DEFAULT_ENABLE_OVER_DRAG = true;\nconst DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE = false;\nconst DEFAULT_ANIMATE_ON_MOUNT = true;\nconst DEFAULT_DYNAMIC_SIZING = false;\n\n// keyboard\nconst DEFAULT_KEYBOARD_BEHAVIOR = KEYBOARD_BEHAVIOR.interactive;\nconst DEFAULT_KEYBOARD_BLUR_BEHAVIOR = KEYBOARD_BLUR_BEHAVIOR.none;\nconst DEFAULT_KEYBOARD_INPUT_MODE = KEYBOARD_INPUT_MODE.adjustPan;\n\n// initial values\nconst INITIAL_VALUE = Number.NEGATIVE_INFINITY;\nconst INITIAL_SNAP_POINT = -999;\nconst INITIAL_CONTAINER_HEIGHT = -999;\nconst INITIAL_CONTAINER_OFFSET = {\n top: 0,\n bottom: 0,\n left: 0,\n right: 0,\n};\nconst INITIAL_HANDLE_HEIGHT = -999;\nconst INITIAL_POSITION = SCREEN_HEIGHT;\n\nexport {\n DEFAULT_HANDLE_HEIGHT,\n DEFAULT_OVER_DRAG_RESISTANCE_FACTOR,\n DEFAULT_ENABLE_CONTENT_PANNING_GESTURE,\n DEFAULT_ENABLE_HANDLE_PANNING_GESTURE,\n DEFAULT_ENABLE_OVER_DRAG,\n DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE,\n DEFAULT_DYNAMIC_SIZING,\n DEFAULT_ANIMATE_ON_MOUNT,\n // keyboard\n DEFAULT_KEYBOARD_BEHAVIOR,\n DEFAULT_KEYBOARD_BLUR_BEHAVIOR,\n DEFAULT_KEYBOARD_INPUT_MODE,\n // layout\n INITIAL_POSITION,\n INITIAL_CONTAINER_HEIGHT,\n INITIAL_CONTAINER_OFFSET,\n INITIAL_HANDLE_HEIGHT,\n INITIAL_SNAP_POINT,\n INITIAL_VALUE,\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheet/index.js b/lib/commonjs/components/bottomSheet/index.js deleted file mode 100644 index d334aebd8..000000000 --- a/lib/commonjs/components/bottomSheet/index.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "default", { - enumerable: true, - get: function () { - return _BottomSheet.default; - } -}); - -var _BottomSheet = _interopRequireDefault(require("./BottomSheet")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheet/index.js.map b/lib/commonjs/components/bottomSheet/index.js.map deleted file mode 100644 index c39d4144d..000000000 --- a/lib/commonjs/components/bottomSheet/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { default } from './BottomSheet';\nexport type { BottomSheetProps } from './types';\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheet/styles.js b/lib/commonjs/components/bottomSheet/styles.js deleted file mode 100644 index 1305493f5..000000000 --- a/lib/commonjs/components/bottomSheet/styles.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.styles = void 0; - -var _reactNative = require("react-native"); - -const styles = _reactNative.StyleSheet.create({ - container: { - flexDirection: 'column-reverse', - position: 'absolute', - top: 0, - left: 0, - right: 0 - }, - contentContainer: {}, - contentMaskContainer: { - overflow: 'hidden' - } -}); - -exports.styles = styles; -//# sourceMappingURL=styles.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheet/styles.js.map b/lib/commonjs/components/bottomSheet/styles.js.map deleted file mode 100644 index 730aedddc..000000000 --- a/lib/commonjs/components/bottomSheet/styles.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["styles.ts"],"names":["styles","StyleSheet","create","container","flexDirection","position","top","left","right","contentContainer","contentMaskContainer","overflow"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,MAAM,GAAGC,wBAAWC,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE;AACTC,IAAAA,aAAa,EAAE,gBADN;AAETC,IAAAA,QAAQ,EAAE,UAFD;AAGTC,IAAAA,GAAG,EAAE,CAHI;AAITC,IAAAA,IAAI,EAAE,CAJG;AAKTC,IAAAA,KAAK,EAAE;AALE,GAD2B;AAQtCC,EAAAA,gBAAgB,EAAE,EARoB;AAStCC,EAAAA,oBAAoB,EAAE;AACpBC,IAAAA,QAAQ,EAAE;AADU;AATgB,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\n\nexport const styles = StyleSheet.create({\n container: {\n flexDirection: 'column-reverse',\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n },\n contentContainer: {},\n contentMaskContainer: {\n overflow: 'hidden',\n },\n});\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackdrop/BottomSheetBackdrop.js b/lib/commonjs/components/bottomSheetBackdrop/BottomSheetBackdrop.js deleted file mode 100644 index 200a7524e..000000000 --- a/lib/commonjs/components/bottomSheetBackdrop/BottomSheetBackdrop.js +++ /dev/null @@ -1,108 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _react = _interopRequireWildcard(require("react")); - -var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated")); - -var _reactNativeGestureHandler = require("react-native-gesture-handler"); - -var _hooks = require("../../hooks"); - -var _constants = require("./constants"); - -var _styles = require("./styles"); - -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - -const BottomSheetBackdropComponent = ({ - animatedIndex, - opacity: _providedOpacity, - appearsOnIndex: _providedAppearsOnIndex, - disappearsOnIndex: _providedDisappearsOnIndex, - enableTouchThrough: _providedEnableTouchThrough, - pressBehavior = _constants.DEFAULT_PRESS_BEHAVIOR, - onPress, - style, - children -}) => { - //#region hooks - const { - snapToIndex, - close - } = (0, _hooks.useBottomSheet)(); //#endregion - //#region defaults - - const opacity = _providedOpacity !== null && _providedOpacity !== void 0 ? _providedOpacity : _constants.DEFAULT_OPACITY; - const appearsOnIndex = _providedAppearsOnIndex !== null && _providedAppearsOnIndex !== void 0 ? _providedAppearsOnIndex : _constants.DEFAULT_APPEARS_ON_INDEX; - const disappearsOnIndex = _providedDisappearsOnIndex !== null && _providedDisappearsOnIndex !== void 0 ? _providedDisappearsOnIndex : _constants.DEFAULT_DISAPPEARS_ON_INDEX; - const enableTouchThrough = _providedEnableTouchThrough !== null && _providedEnableTouchThrough !== void 0 ? _providedEnableTouchThrough : _constants.DEFAULT_ENABLE_TOUCH_THROUGH; //#endregion - //#region variables - - const [pointerEvents, setPointerEvents] = (0, _react.useState)(enableTouchThrough ? 'none' : 'auto'); //#endregion - //#region callbacks - - const handleOnPress = (0, _react.useCallback)(() => { - onPress === null || onPress === void 0 ? void 0 : onPress(); - - if (pressBehavior === 'close') { - close(); - } else if (pressBehavior === 'collapse') { - snapToIndex(disappearsOnIndex); - } else if (typeof pressBehavior === 'number') { - snapToIndex(pressBehavior); - } - }, [snapToIndex, close, disappearsOnIndex, pressBehavior, onPress]); - const handleContainerTouchability = (0, _react.useCallback)(shouldDisableTouchability => { - setPointerEvents(shouldDisableTouchability ? 'none' : 'auto'); - }, []); //#endregion - //#region tap gesture - - const gestureHandler = (0, _reactNativeReanimated.useAnimatedGestureHandler)({ - onFinish: () => { - (0, _reactNativeReanimated.runOnJS)(handleOnPress)(); - } - }, [handleOnPress]); //#endregion - //#region styles - - const containerAnimatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({ - opacity: (0, _reactNativeReanimated.interpolate)(animatedIndex.value, [-1, disappearsOnIndex, appearsOnIndex], [0, 0, opacity], _reactNativeReanimated.Extrapolate.CLAMP), - flex: 1 - })); - const containerStyle = (0, _react.useMemo)(() => [_styles.styles.container, style, containerAnimatedStyle], [style, containerAnimatedStyle]); //#endregion - //#region effects - - (0, _reactNativeReanimated.useAnimatedReaction)(() => animatedIndex.value <= disappearsOnIndex, (shouldDisableTouchability, previous) => { - if (shouldDisableTouchability === previous) { - return; - } - - (0, _reactNativeReanimated.runOnJS)(handleContainerTouchability)(shouldDisableTouchability); - }, [disappearsOnIndex]); //#endregion - - return pressBehavior !== 'none' ? /*#__PURE__*/_react.default.createElement(_reactNativeGestureHandler.TapGestureHandler, { - onGestureEvent: gestureHandler - }, /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, { - style: containerStyle, - pointerEvents: pointerEvents, - accessible: true, - accessibilityRole: "button", - accessibilityLabel: "Bottom Sheet backdrop", - accessibilityHint: `Tap to ${typeof pressBehavior === 'string' ? pressBehavior : 'move'} the Bottom Sheet` - }, children)) : /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, { - pointerEvents: pointerEvents, - style: containerStyle - }, children); -}; - -const BottomSheetBackdrop = /*#__PURE__*/(0, _react.memo)(BottomSheetBackdropComponent); -BottomSheetBackdrop.displayName = 'BottomSheetBackdrop'; -var _default = BottomSheetBackdrop; -exports.default = _default; -//# sourceMappingURL=BottomSheetBackdrop.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackdrop/BottomSheetBackdrop.js.map b/lib/commonjs/components/bottomSheetBackdrop/BottomSheetBackdrop.js.map deleted file mode 100644 index b0ec1fc49..000000000 --- a/lib/commonjs/components/bottomSheetBackdrop/BottomSheetBackdrop.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheetBackdrop.tsx"],"names":["BottomSheetBackdropComponent","animatedIndex","opacity","_providedOpacity","appearsOnIndex","_providedAppearsOnIndex","disappearsOnIndex","_providedDisappearsOnIndex","enableTouchThrough","_providedEnableTouchThrough","pressBehavior","DEFAULT_PRESS_BEHAVIOR","onPress","style","children","snapToIndex","close","DEFAULT_OPACITY","DEFAULT_APPEARS_ON_INDEX","DEFAULT_DISAPPEARS_ON_INDEX","DEFAULT_ENABLE_TOUCH_THROUGH","pointerEvents","setPointerEvents","handleOnPress","handleContainerTouchability","shouldDisableTouchability","gestureHandler","onFinish","containerAnimatedStyle","value","Extrapolate","CLAMP","flex","containerStyle","styles","container","previous","BottomSheetBackdrop","displayName"],"mappings":";;;;;;;AAAA;;AAEA;;AAQA;;AAIA;;AACA;;AAOA;;;;;;AAGA,MAAMA,4BAA4B,GAAG,CAAC;AACpCC,EAAAA,aADoC;AAEpCC,EAAAA,OAAO,EAAEC,gBAF2B;AAGpCC,EAAAA,cAAc,EAAEC,uBAHoB;AAIpCC,EAAAA,iBAAiB,EAAEC,0BAJiB;AAKpCC,EAAAA,kBAAkB,EAAEC,2BALgB;AAMpCC,EAAAA,aAAa,GAAGC,iCANoB;AAOpCC,EAAAA,OAPoC;AAQpCC,EAAAA,KARoC;AASpCC,EAAAA;AAToC,CAAD,KAUE;AACrC;AACA,QAAM;AAAEC,IAAAA,WAAF;AAAeC,IAAAA;AAAf,MAAyB,4BAA/B,CAFqC,CAGrC;AAEA;;AACA,QAAMd,OAAO,GAAGC,gBAAH,aAAGA,gBAAH,cAAGA,gBAAH,GAAuBc,0BAApC;AACA,QAAMb,cAAc,GAAGC,uBAAH,aAAGA,uBAAH,cAAGA,uBAAH,GAA8Ba,mCAAlD;AACA,QAAMZ,iBAAiB,GACrBC,0BADqB,aACrBA,0BADqB,cACrBA,0BADqB,GACSY,sCADhC;AAEA,QAAMX,kBAAkB,GACtBC,2BADsB,aACtBA,2BADsB,cACtBA,2BADsB,GACSW,uCADjC,CAVqC,CAYrC;AAEA;;AACA,QAAM,CAACC,aAAD,EAAgBC,gBAAhB,IAAoC,qBAExCd,kBAAkB,GAAG,MAAH,GAAY,MAFU,CAA1C,CAfqC,CAkBrC;AAEA;;AACA,QAAMe,aAAa,GAAG,wBAAY,MAAM;AACtCX,IAAAA,OAAO,SAAP,IAAAA,OAAO,WAAP,YAAAA,OAAO;;AAEP,QAAIF,aAAa,KAAK,OAAtB,EAA+B;AAC7BM,MAAAA,KAAK;AACN,KAF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ACD,wCAAQZ,2BAAR,EAAqCC,yBAArC;AACD,GAPH,EAQE,CAACnB,iBAAD,CARF,EArEqC,CA+ErC;;AAEA,SAAOI,aAAa,KAAK,MAAlB,gBACL,6BAAC,4CAAD;AAAmB,IAAA,cAAc,EAAEgB;AAAnC,kBACE,6BAAC,8BAAD,CAAU,IAAV;AACE,IAAA,KAAK,EAAEO,cADT;AAEE,IAAA,aAAa,EAAEZ,aAFjB;AAGE,IAAA,UAAU,EAAE,IAHd;AAIE,IAAA,iBAAiB,EAAC,QAJpB;AAKE,IAAA,kBAAkB,EAAC,uBALrB;AAME,IAAA,iBAAiB,EAAG,UAClB,OAAOX,aAAP,KAAyB,QAAzB,GAAoCA,aAApC,GAAoD,MACrD;AARH,KAUGI,QAVH,CADF,CADK,gBAgBL,6BAAC,8BAAD,CAAU,IAAV;AAAe,IAAA,aAAa,EAAEO,aAA9B;AAA6C,IAAA,KAAK,EAAEY;AAApD,KACGnB,QADH,CAhBF;AAoBD,CA/GD;;AAiHA,MAAMuB,mBAAmB,gBAAG,iBAAKrC,4BAAL,CAA5B;AACAqC,mBAAmB,CAACC,WAApB,GAAkC,qBAAlC;eAEeD,mB","sourcesContent":["import React, { memo, useCallback, useMemo, useState } from 'react';\nimport { ViewProps } from 'react-native';\nimport Animated, {\n interpolate,\n Extrapolate,\n useAnimatedStyle,\n useAnimatedReaction,\n useAnimatedGestureHandler,\n runOnJS,\n} from 'react-native-reanimated';\nimport {\n TapGestureHandler,\n TapGestureHandlerGestureEvent,\n} from 'react-native-gesture-handler';\nimport { useBottomSheet } from '../../hooks';\nimport {\n DEFAULT_OPACITY,\n DEFAULT_APPEARS_ON_INDEX,\n DEFAULT_DISAPPEARS_ON_INDEX,\n DEFAULT_ENABLE_TOUCH_THROUGH,\n DEFAULT_PRESS_BEHAVIOR,\n} from './constants';\nimport { styles } from './styles';\nimport type { BottomSheetDefaultBackdropProps } from './types';\n\nconst BottomSheetBackdropComponent = ({\n animatedIndex,\n opacity: _providedOpacity,\n appearsOnIndex: _providedAppearsOnIndex,\n disappearsOnIndex: _providedDisappearsOnIndex,\n enableTouchThrough: _providedEnableTouchThrough,\n pressBehavior = DEFAULT_PRESS_BEHAVIOR,\n onPress,\n style,\n children,\n}: BottomSheetDefaultBackdropProps) => {\n //#region hooks\n const { snapToIndex, close } = useBottomSheet();\n //#endregion\n\n //#region defaults\n const opacity = _providedOpacity ?? DEFAULT_OPACITY;\n const appearsOnIndex = _providedAppearsOnIndex ?? DEFAULT_APPEARS_ON_INDEX;\n const disappearsOnIndex =\n _providedDisappearsOnIndex ?? DEFAULT_DISAPPEARS_ON_INDEX;\n const enableTouchThrough =\n _providedEnableTouchThrough ?? DEFAULT_ENABLE_TOUCH_THROUGH;\n //#endregion\n\n //#region variables\n const [pointerEvents, setPointerEvents] = useState<\n ViewProps['pointerEvents']\n >(enableTouchThrough ? 'none' : 'auto');\n //#endregion\n\n //#region callbacks\n const handleOnPress = useCallback(() => {\n onPress?.();\n\n if (pressBehavior === 'close') {\n close();\n } else if (pressBehavior === 'collapse') {\n snapToIndex(disappearsOnIndex as number);\n } else if (typeof pressBehavior === 'number') {\n snapToIndex(pressBehavior);\n }\n }, [snapToIndex, close, disappearsOnIndex, pressBehavior, onPress]);\n const handleContainerTouchability = useCallback(\n (shouldDisableTouchability: boolean) => {\n setPointerEvents(shouldDisableTouchability ? 'none' : 'auto');\n },\n []\n );\n //#endregion\n\n //#region tap gesture\n const gestureHandler =\n useAnimatedGestureHandler(\n {\n onFinish: () => {\n runOnJS(handleOnPress)();\n },\n },\n [handleOnPress]\n );\n //#endregion\n\n //#region styles\n const containerAnimatedStyle = useAnimatedStyle(() => ({\n opacity: interpolate(\n animatedIndex.value,\n [-1, disappearsOnIndex, appearsOnIndex],\n [0, 0, opacity],\n Extrapolate.CLAMP\n ),\n flex: 1,\n }));\n const containerStyle = useMemo(\n () => [styles.container, style, containerAnimatedStyle],\n [style, containerAnimatedStyle]\n );\n //#endregion\n\n //#region effects\n useAnimatedReaction(\n () => animatedIndex.value <= disappearsOnIndex,\n (shouldDisableTouchability, previous) => {\n if (shouldDisableTouchability === previous) {\n return;\n }\n runOnJS(handleContainerTouchability)(shouldDisableTouchability);\n },\n [disappearsOnIndex]\n );\n //#endregion\n\n return pressBehavior !== 'none' ? (\n \n \n {children}\n \n \n ) : (\n \n {children}\n \n );\n};\n\nconst BottomSheetBackdrop = memo(BottomSheetBackdropComponent);\nBottomSheetBackdrop.displayName = 'BottomSheetBackdrop';\n\nexport default BottomSheetBackdrop;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackdrop/constants.js b/lib/commonjs/components/bottomSheetBackdrop/constants.js deleted file mode 100644 index 0d4668160..000000000 --- a/lib/commonjs/components/bottomSheetBackdrop/constants.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.DEFAULT_PRESS_BEHAVIOR = exports.DEFAULT_ENABLE_TOUCH_THROUGH = exports.DEFAULT_DISAPPEARS_ON_INDEX = exports.DEFAULT_APPEARS_ON_INDEX = exports.DEFAULT_OPACITY = void 0; -const DEFAULT_OPACITY = 0.5; -exports.DEFAULT_OPACITY = DEFAULT_OPACITY; -const DEFAULT_APPEARS_ON_INDEX = 1; -exports.DEFAULT_APPEARS_ON_INDEX = DEFAULT_APPEARS_ON_INDEX; -const DEFAULT_DISAPPEARS_ON_INDEX = 0; -exports.DEFAULT_DISAPPEARS_ON_INDEX = DEFAULT_DISAPPEARS_ON_INDEX; -const DEFAULT_ENABLE_TOUCH_THROUGH = false; -exports.DEFAULT_ENABLE_TOUCH_THROUGH = DEFAULT_ENABLE_TOUCH_THROUGH; -const DEFAULT_PRESS_BEHAVIOR = 'close'; -exports.DEFAULT_PRESS_BEHAVIOR = DEFAULT_PRESS_BEHAVIOR; -//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackdrop/constants.js.map b/lib/commonjs/components/bottomSheetBackdrop/constants.js.map deleted file mode 100644 index 7f01a56c0..000000000 --- a/lib/commonjs/components/bottomSheetBackdrop/constants.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["constants.ts"],"names":["DEFAULT_OPACITY","DEFAULT_APPEARS_ON_INDEX","DEFAULT_DISAPPEARS_ON_INDEX","DEFAULT_ENABLE_TOUCH_THROUGH","DEFAULT_PRESS_BEHAVIOR"],"mappings":";;;;;;AAAA,MAAMA,eAAe,GAAG,GAAxB;;AACA,MAAMC,wBAAwB,GAAG,CAAjC;;AACA,MAAMC,2BAA2B,GAAG,CAApC;;AACA,MAAMC,4BAA4B,GAAG,KAArC;;AACA,MAAMC,sBAAsB,GAAG,OAA/B","sourcesContent":["const DEFAULT_OPACITY = 0.5;\nconst DEFAULT_APPEARS_ON_INDEX = 1;\nconst DEFAULT_DISAPPEARS_ON_INDEX = 0;\nconst DEFAULT_ENABLE_TOUCH_THROUGH = false;\nconst DEFAULT_PRESS_BEHAVIOR = 'close' as const;\n\nexport {\n DEFAULT_OPACITY,\n DEFAULT_APPEARS_ON_INDEX,\n DEFAULT_DISAPPEARS_ON_INDEX,\n DEFAULT_ENABLE_TOUCH_THROUGH,\n DEFAULT_PRESS_BEHAVIOR,\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackdrop/index.js b/lib/commonjs/components/bottomSheetBackdrop/index.js deleted file mode 100644 index d6a37282c..000000000 --- a/lib/commonjs/components/bottomSheetBackdrop/index.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "default", { - enumerable: true, - get: function () { - return _BottomSheetBackdrop.default; - } -}); - -var _BottomSheetBackdrop = _interopRequireDefault(require("./BottomSheetBackdrop")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackdrop/index.js.map b/lib/commonjs/components/bottomSheetBackdrop/index.js.map deleted file mode 100644 index de182520b..000000000 --- a/lib/commonjs/components/bottomSheetBackdrop/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { default } from './BottomSheetBackdrop';\nexport type { BottomSheetBackdropProps } from './types';\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackdrop/styles.js b/lib/commonjs/components/bottomSheetBackdrop/styles.js deleted file mode 100644 index e3e00ab7c..000000000 --- a/lib/commonjs/components/bottomSheetBackdrop/styles.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.styles = void 0; - -var _reactNative = require("react-native"); - -const styles = _reactNative.StyleSheet.create({ - container: { - backgroundColor: 'black' - } -}); - -exports.styles = styles; -//# sourceMappingURL=styles.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackdrop/styles.js.map b/lib/commonjs/components/bottomSheetBackdrop/styles.js.map deleted file mode 100644 index f37bc5f69..000000000 --- a/lib/commonjs/components/bottomSheetBackdrop/styles.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["styles.ts"],"names":["styles","StyleSheet","create","container","backgroundColor"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,MAAM,GAAGC,wBAAWC,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE;AACTC,IAAAA,eAAe,EAAE;AADR;AAD2B,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\n\nexport const styles = StyleSheet.create({\n container: {\n backgroundColor: 'black',\n },\n});\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackdropContainer/BottomSheetBackdropContainer.js b/lib/commonjs/components/bottomSheetBackdropContainer/BottomSheetBackdropContainer.js deleted file mode 100644 index 9d945ed34..000000000 --- a/lib/commonjs/components/bottomSheetBackdropContainer/BottomSheetBackdropContainer.js +++ /dev/null @@ -1,32 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _react = _interopRequireWildcard(require("react")); - -var _styles = require("./styles"); - -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - -const BottomSheetBackdropContainerComponent = ({ - animatedIndex, - animatedPosition, - backdropComponent: BackdropComponent -}) => { - return BackdropComponent ? /*#__PURE__*/_react.default.createElement(BackdropComponent, { - animatedIndex: animatedIndex, - animatedPosition: animatedPosition, - style: _styles.styles.container - }) : null; -}; - -const BottomSheetBackdropContainer = /*#__PURE__*/(0, _react.memo)(BottomSheetBackdropContainerComponent); -BottomSheetBackdropContainer.displayName = 'BottomSheetBackdropContainer'; -var _default = BottomSheetBackdropContainer; -exports.default = _default; -//# sourceMappingURL=BottomSheetBackdropContainer.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackdropContainer/BottomSheetBackdropContainer.js.map b/lib/commonjs/components/bottomSheetBackdropContainer/BottomSheetBackdropContainer.js.map deleted file mode 100644 index 591a53c90..000000000 --- a/lib/commonjs/components/bottomSheetBackdropContainer/BottomSheetBackdropContainer.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheetBackdropContainer.tsx"],"names":["BottomSheetBackdropContainerComponent","animatedIndex","animatedPosition","backdropComponent","BackdropComponent","styles","container","BottomSheetBackdropContainer","displayName"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;AAEA,MAAMA,qCAAqC,GAAG,CAAC;AAC7CC,EAAAA,aAD6C;AAE7CC,EAAAA,gBAF6C;AAG7CC,EAAAA,iBAAiB,EAAEC;AAH0B,CAAD,KAIL;AACvC,SAAOA,iBAAiB,gBACtB,6BAAC,iBAAD;AACE,IAAA,aAAa,EAAEH,aADjB;AAEE,IAAA,gBAAgB,EAAEC,gBAFpB;AAGE,IAAA,KAAK,EAAEG,eAAOC;AAHhB,IADsB,GAMpB,IANJ;AAOD,CAZD;;AAcA,MAAMC,4BAA4B,gBAAG,iBACnCP,qCADmC,CAArC;AAGAO,4BAA4B,CAACC,WAA7B,GAA2C,8BAA3C;eAEeD,4B","sourcesContent":["import React, { memo } from 'react';\nimport type { BottomSheetBackdropContainerProps } from './types';\nimport { styles } from './styles';\n\nconst BottomSheetBackdropContainerComponent = ({\n animatedIndex,\n animatedPosition,\n backdropComponent: BackdropComponent,\n}: BottomSheetBackdropContainerProps) => {\n return BackdropComponent ? (\n \n ) : null;\n};\n\nconst BottomSheetBackdropContainer = memo(\n BottomSheetBackdropContainerComponent\n);\nBottomSheetBackdropContainer.displayName = 'BottomSheetBackdropContainer';\n\nexport default BottomSheetBackdropContainer;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackdropContainer/index.js b/lib/commonjs/components/bottomSheetBackdropContainer/index.js deleted file mode 100644 index cd79d6ec7..000000000 --- a/lib/commonjs/components/bottomSheetBackdropContainer/index.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "default", { - enumerable: true, - get: function () { - return _BottomSheetBackdropContainer.default; - } -}); - -var _BottomSheetBackdropContainer = _interopRequireDefault(require("./BottomSheetBackdropContainer")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackdropContainer/index.js.map b/lib/commonjs/components/bottomSheetBackdropContainer/index.js.map deleted file mode 100644 index bc09f2088..000000000 --- a/lib/commonjs/components/bottomSheetBackdropContainer/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { default } from './BottomSheetBackdropContainer';\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackdropContainer/styles.js b/lib/commonjs/components/bottomSheetBackdropContainer/styles.js deleted file mode 100644 index b9e7d8f49..000000000 --- a/lib/commonjs/components/bottomSheetBackdropContainer/styles.js +++ /dev/null @@ -1,21 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.styles = void 0; - -var _reactNative = require("react-native"); - -const styles = _reactNative.StyleSheet.create({ - container: { - position: 'absolute', - top: 0, - left: 0, - right: 0, - bottom: 0 - } -}); - -exports.styles = styles; -//# sourceMappingURL=styles.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackdropContainer/styles.js.map b/lib/commonjs/components/bottomSheetBackdropContainer/styles.js.map deleted file mode 100644 index 1c074ebb0..000000000 --- a/lib/commonjs/components/bottomSheetBackdropContainer/styles.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["styles.ts"],"names":["styles","StyleSheet","create","container","position","top","left","right","bottom"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,MAAM,GAAGC,wBAAWC,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE;AACTC,IAAAA,QAAQ,EAAE,UADD;AAETC,IAAAA,GAAG,EAAE,CAFI;AAGTC,IAAAA,IAAI,EAAE,CAHG;AAITC,IAAAA,KAAK,EAAE,CAJE;AAKTC,IAAAA,MAAM,EAAE;AALC;AAD2B,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\n\nexport const styles = StyleSheet.create({\n container: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n },\n});\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackground/BottomSheetBackground.js b/lib/commonjs/components/bottomSheetBackground/BottomSheetBackground.js deleted file mode 100644 index 6f2c5799b..000000000 --- a/lib/commonjs/components/bottomSheetBackground/BottomSheetBackground.js +++ /dev/null @@ -1,33 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _react = _interopRequireWildcard(require("react")); - -var _reactNative = require("react-native"); - -var _styles = require("./styles"); - -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - -const BottomSheetBackgroundComponent = ({ - pointerEvents, - style -}) => /*#__PURE__*/_react.default.createElement(_reactNative.View, { - pointerEvents: pointerEvents, - accessible: true, - accessibilityRole: "adjustable", - accessibilityLabel: "Bottom Sheet", - style: [_styles.styles.container, style] -}); - -const BottomSheetBackground = /*#__PURE__*/(0, _react.memo)(BottomSheetBackgroundComponent); -BottomSheetBackground.displayName = 'BottomSheetBackground'; -var _default = BottomSheetBackground; -exports.default = _default; -//# sourceMappingURL=BottomSheetBackground.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackground/BottomSheetBackground.js.map b/lib/commonjs/components/bottomSheetBackground/BottomSheetBackground.js.map deleted file mode 100644 index d0f4a1186..000000000 --- a/lib/commonjs/components/bottomSheetBackground/BottomSheetBackground.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheetBackground.tsx"],"names":["BottomSheetBackgroundComponent","pointerEvents","style","styles","container","BottomSheetBackground","displayName"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;;;;;AAEA,MAAMA,8BAA8B,GAAG,CAAC;AACtCC,EAAAA,aADsC;AAEtCC,EAAAA;AAFsC,CAAD,kBAIrC,6BAAC,iBAAD;AACE,EAAA,aAAa,EAAED,aADjB;AAEE,EAAA,UAAU,EAAE,IAFd;AAGE,EAAA,iBAAiB,EAAC,YAHpB;AAIE,EAAA,kBAAkB,EAAC,cAJrB;AAKE,EAAA,KAAK,EAAE,CAACE,eAAOC,SAAR,EAAmBF,KAAnB;AALT,EAJF;;AAaA,MAAMG,qBAAqB,gBAAG,iBAAKL,8BAAL,CAA9B;AACAK,qBAAqB,CAACC,WAAtB,GAAoC,uBAApC;eAEeD,qB","sourcesContent":["import React, { memo } from 'react';\nimport { View } from 'react-native';\nimport type { BottomSheetBackgroundProps } from './types';\nimport { styles } from './styles';\n\nconst BottomSheetBackgroundComponent = ({\n pointerEvents,\n style,\n}: BottomSheetBackgroundProps) => (\n \n);\n\nconst BottomSheetBackground = memo(BottomSheetBackgroundComponent);\nBottomSheetBackground.displayName = 'BottomSheetBackground';\n\nexport default BottomSheetBackground;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackground/index.js b/lib/commonjs/components/bottomSheetBackground/index.js deleted file mode 100644 index aa13540ba..000000000 --- a/lib/commonjs/components/bottomSheetBackground/index.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "default", { - enumerable: true, - get: function () { - return _BottomSheetBackground.default; - } -}); - -var _BottomSheetBackground = _interopRequireDefault(require("./BottomSheetBackground")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackground/index.js.map b/lib/commonjs/components/bottomSheetBackground/index.js.map deleted file mode 100644 index 4c48802e2..000000000 --- a/lib/commonjs/components/bottomSheetBackground/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { default } from './BottomSheetBackground';\nexport type { BottomSheetBackgroundProps } from './types';\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackground/styles.js b/lib/commonjs/components/bottomSheetBackground/styles.js deleted file mode 100644 index d3f764b0b..000000000 --- a/lib/commonjs/components/bottomSheetBackground/styles.js +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.styles = void 0; - -var _reactNative = require("react-native"); - -const styles = _reactNative.StyleSheet.create({ - container: { - backgroundColor: 'white', - borderRadius: 15 - } -}); - -exports.styles = styles; -//# sourceMappingURL=styles.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackground/styles.js.map b/lib/commonjs/components/bottomSheetBackground/styles.js.map deleted file mode 100644 index 02077a671..000000000 --- a/lib/commonjs/components/bottomSheetBackground/styles.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["styles.ts"],"names":["styles","StyleSheet","create","container","backgroundColor","borderRadius"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,MAAM,GAAGC,wBAAWC,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE;AACTC,IAAAA,eAAe,EAAE,OADR;AAETC,IAAAA,YAAY,EAAE;AAFL;AAD2B,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\n\nexport const styles = StyleSheet.create({\n container: {\n backgroundColor: 'white',\n borderRadius: 15,\n },\n});\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.js b/lib/commonjs/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.js deleted file mode 100644 index de38b1397..000000000 --- a/lib/commonjs/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.js +++ /dev/null @@ -1,42 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _react = _interopRequireWildcard(require("react")); - -var _bottomSheetBackground = _interopRequireDefault(require("../bottomSheetBackground")); - -var _styles = require("./styles"); - -var _reactNative = require("react-native"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - -const BottomSheetBackgroundContainerComponent = ({ - animatedIndex, - animatedPosition, - backgroundComponent: _providedBackgroundComponent, - backgroundStyle: _providedBackgroundStyle -}) => { - const BackgroundComponent = _providedBackgroundComponent || _bottomSheetBackground.default; - const backgroundStyle = (0, _react.useMemo)(() => _reactNative.StyleSheet.flatten([_styles.styles.container, _providedBackgroundStyle]), [_providedBackgroundStyle]); - return _providedBackgroundComponent === null ? null : /*#__PURE__*/_react.default.createElement(BackgroundComponent, { - pointerEvents: "none", - animatedIndex: animatedIndex, - animatedPosition: animatedPosition, - style: backgroundStyle - }); -}; - -const BottomSheetBackgroundContainer = /*#__PURE__*/(0, _react.memo)(BottomSheetBackgroundContainerComponent); -BottomSheetBackgroundContainer.displayName = 'BottomSheetBackgroundContainer'; -var _default = BottomSheetBackgroundContainer; -exports.default = _default; -//# sourceMappingURL=BottomSheetBackgroundContainer.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.js.map b/lib/commonjs/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.js.map deleted file mode 100644 index f3fbad824..000000000 --- a/lib/commonjs/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheetBackgroundContainer.tsx"],"names":["BottomSheetBackgroundContainerComponent","animatedIndex","animatedPosition","backgroundComponent","_providedBackgroundComponent","backgroundStyle","_providedBackgroundStyle","BackgroundComponent","BottomSheetBackground","StyleSheet","flatten","styles","container","BottomSheetBackgroundContainer","displayName"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;;;;;;;AAEA,MAAMA,uCAAuC,GAAG,CAAC;AAC/CC,EAAAA,aAD+C;AAE/CC,EAAAA,gBAF+C;AAG/CC,EAAAA,mBAAmB,EAAEC,4BAH0B;AAI/CC,EAAAA,eAAe,EAAEC;AAJ8B,CAAD,KAKL;AACzC,QAAMC,mBAAmB,GACvBH,4BAA4B,IAAII,8BADlC;AAGA,QAAMH,eAAe,GAAG,oBACtB,MAAMI,wBAAWC,OAAX,CAAmB,CAACC,eAAOC,SAAR,EAAmBN,wBAAnB,CAAnB,CADgB,EAEtB,CAACA,wBAAD,CAFsB,CAAxB;AAKA,SAAOF,4BAA4B,KAAK,IAAjC,GAAwC,IAAxC,gBACL,6BAAC,mBAAD;AACE,IAAA,aAAa,EAAC,MADhB;AAEE,IAAA,aAAa,EAAEH,aAFjB;AAGE,IAAA,gBAAgB,EAAEC,gBAHpB;AAIE,IAAA,KAAK,EAAEG;AAJT,IADF;AAQD,CAtBD;;AAwBA,MAAMQ,8BAA8B,gBAAG,iBACrCb,uCADqC,CAAvC;AAGAa,8BAA8B,CAACC,WAA/B,GAA6C,gCAA7C;eAEeD,8B","sourcesContent":["import React, { memo, useMemo } from 'react';\nimport BottomSheetBackground from '../bottomSheetBackground';\nimport type { BottomSheetBackgroundContainerProps } from './types';\nimport { styles } from './styles';\nimport { StyleSheet } from 'react-native';\n\nconst BottomSheetBackgroundContainerComponent = ({\n animatedIndex,\n animatedPosition,\n backgroundComponent: _providedBackgroundComponent,\n backgroundStyle: _providedBackgroundStyle,\n}: BottomSheetBackgroundContainerProps) => {\n const BackgroundComponent =\n _providedBackgroundComponent || BottomSheetBackground;\n\n const backgroundStyle = useMemo(\n () => StyleSheet.flatten([styles.container, _providedBackgroundStyle]),\n [_providedBackgroundStyle]\n );\n\n return _providedBackgroundComponent === null ? null : (\n \n );\n};\n\nconst BottomSheetBackgroundContainer = memo(\n BottomSheetBackgroundContainerComponent\n);\nBottomSheetBackgroundContainer.displayName = 'BottomSheetBackgroundContainer';\n\nexport default BottomSheetBackgroundContainer;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackgroundContainer/index.js b/lib/commonjs/components/bottomSheetBackgroundContainer/index.js deleted file mode 100644 index 002ca423d..000000000 --- a/lib/commonjs/components/bottomSheetBackgroundContainer/index.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "default", { - enumerable: true, - get: function () { - return _BottomSheetBackgroundContainer.default; - } -}); - -var _BottomSheetBackgroundContainer = _interopRequireDefault(require("./BottomSheetBackgroundContainer")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackgroundContainer/index.js.map b/lib/commonjs/components/bottomSheetBackgroundContainer/index.js.map deleted file mode 100644 index 5ad573e78..000000000 --- a/lib/commonjs/components/bottomSheetBackgroundContainer/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { default } from './BottomSheetBackgroundContainer';\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackgroundContainer/styles.js b/lib/commonjs/components/bottomSheetBackgroundContainer/styles.js deleted file mode 100644 index b9e7d8f49..000000000 --- a/lib/commonjs/components/bottomSheetBackgroundContainer/styles.js +++ /dev/null @@ -1,21 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.styles = void 0; - -var _reactNative = require("react-native"); - -const styles = _reactNative.StyleSheet.create({ - container: { - position: 'absolute', - top: 0, - left: 0, - right: 0, - bottom: 0 - } -}); - -exports.styles = styles; -//# sourceMappingURL=styles.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetBackgroundContainer/styles.js.map b/lib/commonjs/components/bottomSheetBackgroundContainer/styles.js.map deleted file mode 100644 index 1c074ebb0..000000000 --- a/lib/commonjs/components/bottomSheetBackgroundContainer/styles.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["styles.ts"],"names":["styles","StyleSheet","create","container","position","top","left","right","bottom"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,MAAM,GAAGC,wBAAWC,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE;AACTC,IAAAA,QAAQ,EAAE,UADD;AAETC,IAAAA,GAAG,EAAE,CAFI;AAGTC,IAAAA,IAAI,EAAE,CAHG;AAITC,IAAAA,KAAK,EAAE,CAJE;AAKTC,IAAAA,MAAM,EAAE;AALC;AAD2B,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\n\nexport const styles = StyleSheet.create({\n container: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n },\n});\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetContainer/BottomSheetContainer.js b/lib/commonjs/components/bottomSheetContainer/BottomSheetContainer.js deleted file mode 100644 index a1aa99068..000000000 --- a/lib/commonjs/components/bottomSheetContainer/BottomSheetContainer.js +++ /dev/null @@ -1,85 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _react = _interopRequireWildcard(require("react")); - -var _reactNative = require("react-native"); - -var _constants = require("../../constants"); - -var _utilities = require("../../utilities"); - -var _styles = require("./styles"); - -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - -function BottomSheetContainerComponent({ - containerHeight, - containerOffset, - topInset = 0, - bottomInset = 0, - shouldCalculateHeight = true, - detached, - style, - children -}) { - const containerRef = (0, _react.useRef)(null); //#region styles - - const containerStyle = (0, _react.useMemo)(() => [style, _styles.styles.container, { - top: topInset, - bottom: bottomInset, - overflow: detached ? 'visible' : 'hidden' - }], [style, detached, topInset, bottomInset]); //#endregion - //#region callbacks - - const handleContainerLayout = (0, _react.useCallback)(function handleContainerLayout({ - nativeEvent: { - layout: { - height - } - } - }) { - var _containerRef$current; - - containerHeight.value = height; - (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.measure((_x, _y, _width, _height, _pageX, pageY) => { - var _StatusBar$currentHei; - - if (!containerOffset.value) return; - containerOffset.value = { - top: pageY !== null && pageY !== void 0 ? pageY : 0, - left: 0, - right: 0, - bottom: Math.max(0, _constants.WINDOW_HEIGHT - ((pageY !== null && pageY !== void 0 ? pageY : 0) + height + ((_StatusBar$currentHei = _reactNative.StatusBar.currentHeight) !== null && _StatusBar$currentHei !== void 0 ? _StatusBar$currentHei : 0))) - }; - }); - (0, _utilities.print)({ - component: BottomSheetContainer.displayName, - method: 'handleContainerLayout', - params: { - height - } - }); - }, [containerHeight, containerOffset, containerRef]); //#endregion - //#region render - - return /*#__PURE__*/_react.default.createElement(_reactNative.View, { - ref: containerRef, - pointerEvents: "box-none", - onLayout: shouldCalculateHeight ? handleContainerLayout : undefined, - style: containerStyle, - children: children - }); //#endregion -} - -const BottomSheetContainer = /*#__PURE__*/(0, _react.memo)(BottomSheetContainerComponent); -BottomSheetContainer.displayName = 'BottomSheetContainer'; -var _default = BottomSheetContainer; -exports.default = _default; -//# sourceMappingURL=BottomSheetContainer.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetContainer/BottomSheetContainer.js.map b/lib/commonjs/components/bottomSheetContainer/BottomSheetContainer.js.map deleted file mode 100644 index ad9daac47..000000000 --- a/lib/commonjs/components/bottomSheetContainer/BottomSheetContainer.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheetContainer.tsx"],"names":["BottomSheetContainerComponent","containerHeight","containerOffset","topInset","bottomInset","shouldCalculateHeight","detached","style","children","containerRef","containerStyle","styles","container","top","bottom","overflow","handleContainerLayout","nativeEvent","layout","height","value","current","measure","_x","_y","_width","_height","_pageX","pageY","left","right","Math","max","WINDOW_HEIGHT","StatusBar","currentHeight","component","BottomSheetContainer","displayName","method","params","undefined"],"mappings":";;;;;;;AAAA;;AACA;;AAOA;;AACA;;AACA;;;;;;AAGA,SAASA,6BAAT,CAAuC;AACrCC,EAAAA,eADqC;AAErCC,EAAAA,eAFqC;AAGrCC,EAAAA,QAAQ,GAAG,CAH0B;AAIrCC,EAAAA,WAAW,GAAG,CAJuB;AAKrCC,EAAAA,qBAAqB,GAAG,IALa;AAMrCC,EAAAA,QANqC;AAOrCC,EAAAA,KAPqC;AAQrCC,EAAAA;AARqC,CAAvC,EAS8B;AAC5B,QAAMC,YAAY,GAAG,mBAAa,IAAb,CAArB,CAD4B,CAE5B;;AACA,QAAMC,cAAc,GAAG,oBACrB,MAAM,CACJH,KADI,EAEJI,eAAOC,SAFH,EAGJ;AACEC,IAAAA,GAAG,EAAEV,QADP;AAEEW,IAAAA,MAAM,EAAEV,WAFV;AAGEW,IAAAA,QAAQ,EAAET,QAAQ,GAAG,SAAH,GAAe;AAHnC,GAHI,CADe,EAUrB,CAACC,KAAD,EAAQD,QAAR,EAAkBH,QAAlB,EAA4BC,WAA5B,CAVqB,CAAvB,CAH4B,CAe5B;AAEA;;AACA,QAAMY,qBAAqB,GAAG,wBAC5B,SAASA,qBAAT,CAA+B;AAC7BC,IAAAA,WAAW,EAAE;AACXC,MAAAA,MAAM,EAAE;AAAEC,QAAAA;AAAF;AADG;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B;AACAqC,oBAAoB,CAACC,WAArB,GAAmC,sBAAnC;eAEeD,oB","sourcesContent":["import React, { memo, useCallback, useMemo, useRef } from 'react';\nimport {\n LayoutChangeEvent,\n StatusBar,\n StyleProp,\n View,\n ViewStyle,\n} from 'react-native';\nimport { WINDOW_HEIGHT } from '../../constants';\nimport { print } from '../../utilities';\nimport { styles } from './styles';\nimport type { BottomSheetContainerProps } from './types';\n\nfunction BottomSheetContainerComponent({\n containerHeight,\n containerOffset,\n topInset = 0,\n bottomInset = 0,\n shouldCalculateHeight = true,\n detached,\n style,\n children,\n}: BottomSheetContainerProps) {\n const containerRef = useRef(null);\n //#region styles\n const containerStyle = useMemo>(\n () => [\n style,\n styles.container,\n {\n top: topInset,\n bottom: bottomInset,\n overflow: detached ? 'visible' : 'hidden',\n },\n ],\n [style, detached, topInset, bottomInset]\n );\n //#endregion\n\n //#region callbacks\n const handleContainerLayout = useCallback(\n function handleContainerLayout({\n nativeEvent: {\n layout: { height },\n },\n }: LayoutChangeEvent) {\n containerHeight.value = height;\n\n containerRef.current?.measure(\n (_x, _y, _width, _height, _pageX, pageY) => {\n if (!containerOffset.value) return;\n containerOffset.value = {\n top: pageY ?? 0,\n left: 0,\n right: 0,\n bottom: Math.max(\n 0,\n WINDOW_HEIGHT -\n ((pageY ?? 0) + height + (StatusBar.currentHeight ?? 0))\n ),\n };\n }\n );\n\n print({\n component: BottomSheetContainer.displayName,\n method: 'handleContainerLayout',\n params: {\n height,\n },\n });\n },\n [containerHeight, containerOffset, containerRef]\n );\n //#endregion\n\n //#region render\n return (\n \n );\n //#endregion\n}\n\nconst BottomSheetContainer = memo(BottomSheetContainerComponent);\nBottomSheetContainer.displayName = 'BottomSheetContainer';\n\nexport default BottomSheetContainer;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetContainer/index.js b/lib/commonjs/components/bottomSheetContainer/index.js deleted file mode 100644 index 2817384e4..000000000 --- a/lib/commonjs/components/bottomSheetContainer/index.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "default", { - enumerable: true, - get: function () { - return _BottomSheetContainer.default; - } -}); - -var _BottomSheetContainer = _interopRequireDefault(require("./BottomSheetContainer")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetContainer/index.js.map b/lib/commonjs/components/bottomSheetContainer/index.js.map deleted file mode 100644 index ab6858d88..000000000 --- a/lib/commonjs/components/bottomSheetContainer/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { default } from './BottomSheetContainer';\nexport type { BottomSheetContainerProps } from './types';\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetContainer/styles.js b/lib/commonjs/components/bottomSheetContainer/styles.js deleted file mode 100644 index e333cbaaf..000000000 --- a/lib/commonjs/components/bottomSheetContainer/styles.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.styles = void 0; - -var _reactNative = require("react-native"); - -const styles = _reactNative.StyleSheet.create({ - container: { ..._reactNative.StyleSheet.absoluteFillObject - } -}); - -exports.styles = styles; -//# sourceMappingURL=styles.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetContainer/styles.js.map b/lib/commonjs/components/bottomSheetContainer/styles.js.map deleted file mode 100644 index 3c14e6685..000000000 --- a/lib/commonjs/components/bottomSheetContainer/styles.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["styles.ts"],"names":["styles","StyleSheet","create","container","absoluteFillObject"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,MAAM,GAAGC,wBAAWC,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE,EACT,GAAGF,wBAAWG;AADL;AAD2B,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\n\nexport const styles = StyleSheet.create({\n container: {\n ...StyleSheet.absoluteFillObject,\n },\n});\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetContainer/styles.web.js b/lib/commonjs/components/bottomSheetContainer/styles.web.js deleted file mode 100644 index 34116d412..000000000 --- a/lib/commonjs/components/bottomSheetContainer/styles.web.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.styles = void 0; - -var _reactNative = require("react-native"); - -const styles = _reactNative.StyleSheet.create({ - container: { - // @ts-ignore - position: 'fixed', - left: 0, - right: 0, - bottom: 0, - top: 0 - } -}); - -exports.styles = styles; -//# sourceMappingURL=styles.web.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetContainer/styles.web.js.map b/lib/commonjs/components/bottomSheetContainer/styles.web.js.map deleted file mode 100644 index f46893508..000000000 --- a/lib/commonjs/components/bottomSheetContainer/styles.web.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["styles.web.ts"],"names":["styles","StyleSheet","create","container","position","left","right","bottom","top"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,MAAM,GAAGC,wBAAWC,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE;AACT;AACAC,IAAAA,QAAQ,EAAE,OAFD;AAGTC,IAAAA,IAAI,EAAE,CAHG;AAITC,IAAAA,KAAK,EAAE,CAJE;AAKTC,IAAAA,MAAM,EAAE,CALC;AAMTC,IAAAA,GAAG,EAAE;AANI;AAD2B,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\n\nexport const styles = StyleSheet.create({\n container: {\n // @ts-ignore\n position: 'fixed',\n left: 0,\n right: 0,\n bottom: 0,\n top: 0,\n },\n});\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetDraggableView/BottomSheetDraggableView.js b/lib/commonjs/components/bottomSheetDraggableView/BottomSheetDraggableView.js deleted file mode 100644 index 2a83d6e7a..000000000 --- a/lib/commonjs/components/bottomSheetDraggableView/BottomSheetDraggableView.js +++ /dev/null @@ -1,94 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _react = _interopRequireWildcard(require("react")); - -var _reactNativeReanimated = _interopRequireDefault(require("react-native-reanimated")); - -var _reactNativeGestureHandler = require("react-native-gesture-handler"); - -var _hooks = require("../../hooks"); - -var _constants = require("../../constants"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - -function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } - -const BottomSheetDraggableViewComponent = ({ - gestureType = _constants.GESTURE_SOURCE.CONTENT, - nativeGestureRef, - refreshControlGestureRef, - style, - children, - ...rest -}) => { - //#region hooks - const { - enableContentPanningGesture, - simultaneousHandlers: _providedSimultaneousHandlers, - waitFor, - activeOffsetX, - activeOffsetY, - failOffsetX, - failOffsetY - } = (0, _hooks.useBottomSheetInternal)(); - const { - contentPanGestureHandler, - scrollablePanGestureHandler - } = (0, _hooks.useBottomSheetGestureHandlers)(); //#endregion - //#region variables - - const panGestureRef = (0, _react.useRef)(null); - const gestureHandler = (0, _react.useMemo)(() => gestureType === _constants.GESTURE_SOURCE.CONTENT ? contentPanGestureHandler : scrollablePanGestureHandler, [gestureType, contentPanGestureHandler, scrollablePanGestureHandler]); - const simultaneousHandlers = (0, _react.useMemo)(() => { - const refs = []; - - if (nativeGestureRef) { - refs.push(nativeGestureRef); - } - - if (refreshControlGestureRef) { - refs.push(refreshControlGestureRef); - } - - if (_providedSimultaneousHandlers) { - if (Array.isArray(_providedSimultaneousHandlers)) { - refs.push(..._providedSimultaneousHandlers); - } else { - refs.push(_providedSimultaneousHandlers); - } - } - - return refs; - }, [_providedSimultaneousHandlers, nativeGestureRef, refreshControlGestureRef]); //#endregion - - return /*#__PURE__*/_react.default.createElement(_reactNativeGestureHandler.PanGestureHandler, { - ref: panGestureRef, - enabled: enableContentPanningGesture, - simultaneousHandlers: simultaneousHandlers, - shouldCancelWhenOutside: false, - waitFor: waitFor, - onGestureEvent: gestureHandler, - activeOffsetX: activeOffsetX, - activeOffsetY: activeOffsetY, - failOffsetX: failOffsetX, - failOffsetY: failOffsetY - }, /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, _extends({ - style: style - }, rest), children)); -}; - -const BottomSheetDraggableView = /*#__PURE__*/(0, _react.memo)(BottomSheetDraggableViewComponent); -BottomSheetDraggableView.displayName = 'BottomSheetDraggableView'; -var _default = BottomSheetDraggableView; -exports.default = _default; -//# sourceMappingURL=BottomSheetDraggableView.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetDraggableView/BottomSheetDraggableView.js.map b/lib/commonjs/components/bottomSheetDraggableView/BottomSheetDraggableView.js.map deleted file mode 100644 index 55c1d9757..000000000 --- a/lib/commonjs/components/bottomSheetDraggableView/BottomSheetDraggableView.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheetDraggableView.tsx"],"names":["BottomSheetDraggableViewComponent","gestureType","GESTURE_SOURCE","CONTENT","nativeGestureRef","refreshControlGestureRef","style","children","rest","enableContentPanningGesture","simultaneousHandlers","_providedSimultaneousHandlers","waitFor","activeOffsetX","activeOffsetY","failOffsetX","failOffsetY","contentPanGestureHandler","scrollablePanGestureHandler","panGestureRef","gestureHandler","refs","push","Array","isArray","BottomSheetDraggableView","displayName"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AAIA;;;;;;;;;;AAGA,MAAMA,iCAAiC,GAAG,CAAC;AACzCC,EAAAA,WAAW,GAAGC,0BAAeC,OADY;AAEzCC,EAAAA,gBAFyC;AAGzCC,EAAAA,wBAHyC;AAIzCC,EAAAA,KAJyC;AAKzCC,EAAAA,QALyC;AAMzC,KAAGC;AANsC,CAAD,KAOL;AACnC;AACA,QAAM;AACJC,IAAAA,2BADI;AAEJC,IAAAA,oBAAoB,EAAEC,6BAFlB;AAGJC,IAAAA,OAHI;AAIJC,IAAAA,aAJI;AAKJC,IAAAA,aALI;AAMJC,IAAAA,WANI;AAOJC,IAAAA;AAPI,MAQF,oCARJ;AASA,QAAM;AAAEC,IAAAA,wBAAF;AAA4BC,IAAAA;AAA5B,MACJ,2CADF,CAXmC,CAanC;AAEA;;AACA,QAAMC,aAAa,GAAG,mBAA0B,IAA1B,CAAtB;AACA,QAAMC,cAAc,GAAG,oBACrB,MACEnB,WAAW,KAAKC,0BAAeC,OAA/B,GACIc,wBADJ,GAEIC,2BAJe,EAKrB,CAACjB,WAAD,EAAcgB,wBAAd,EAAwCC,2BAAxC,CALqB,CAAvB;AAOA,QAAMR,oBAAoB,GAAG,oBAAQ,MAAM;AACzC,UAAMW,IAAI,GAAG,EAAb;;AAEA,QAAIjB,gBAAJ,EAAsB;AACpBiB,MAAAA,IAAI,CAACC,IAAL,CAAUlB,gBAAV;AACD;;AAED,QAAIC,wBAAJ,EAA8B;AAC5BgB,MAAAA,IAAI,CAACC,IAAL,CAAUjB,wBAAV;AACD;;AAED,QAAIM,6BAAJ,EAAmC;AACjC,UAAIY,KAAK,CAACC,OAAN,CAAcb,6BAAd,CAAJ,EAAkD;AAChDU,QAAAA,IAAI,CAACC,IAAL,CAAU,GAAGX,6BAAb;AACD,OAFD,MAEO;AACLU,QAAAA,IAAI,CAACC,IAAL,CAAUX,6BAAV;AACD;AACF;;AAED,WAAOU,IAAP;AACD,GApB4B,EAoB1B,CACDV,6BADC,EAEDP,gBAFC,EAGDC,wBAHC,CApB0B,CAA7B,CAxBmC,CAiDnC;;AAEA,sBACE,6BAAC,4CAAD;AACE,IAAA,GAAG,EAAEc,aADP;AAEE,IAAA,OAAO,EAAEV,2BAFX;AAGE,IAAA,oBAAoB,EAAEC,oBAHxB;AAIE,IAAA,uBAAuB,EAAE,KAJ3B;AAKE,IAAA,OAAO,EAAEE,OALX;AAME,IAAA,cAAc,EAAEQ,cANlB;AAOE,IAAA,aAAa,EAAEP,aAPjB;AAQE,IAAA,aAAa,EAAEC,aARjB;AASE,IAAA,WAAW,EAAEC,WATf;AAUE,IAAA,WAAW,EAAEC;AAVf,kBAYE,6BAAC,8BAAD,CAAU,IAAV;AAAe,IAAA,KAAK,EAAEV;AAAtB,KAAiCE,IAAjC,GACGD,QADH,CAZF,CADF;AAkBD,CA5ED;;AA8EA,MAAMkB,wBAAwB,gBAAG,iBAAKzB,iCAAL,CAAjC;AACAyB,wBAAwB,CAACC,WAAzB,GAAuC,0BAAvC;eAEeD,wB","sourcesContent":["import React, { useMemo, useRef, memo } from 'react';\nimport Animated from 'react-native-reanimated';\nimport { PanGestureHandler } from 'react-native-gesture-handler';\nimport {\n useBottomSheetGestureHandlers,\n useBottomSheetInternal,\n} from '../../hooks';\nimport { GESTURE_SOURCE } from '../../constants';\nimport type { BottomSheetDraggableViewProps } from './types';\n\nconst BottomSheetDraggableViewComponent = ({\n gestureType = GESTURE_SOURCE.CONTENT,\n nativeGestureRef,\n refreshControlGestureRef,\n style,\n children,\n ...rest\n}: BottomSheetDraggableViewProps) => {\n //#region hooks\n const {\n enableContentPanningGesture,\n simultaneousHandlers: _providedSimultaneousHandlers,\n waitFor,\n activeOffsetX,\n activeOffsetY,\n failOffsetX,\n failOffsetY,\n } = useBottomSheetInternal();\n const { contentPanGestureHandler, scrollablePanGestureHandler } =\n useBottomSheetGestureHandlers();\n //#endregion\n\n //#region variables\n const panGestureRef = useRef(null);\n const gestureHandler = useMemo(\n () =>\n gestureType === GESTURE_SOURCE.CONTENT\n ? contentPanGestureHandler\n : scrollablePanGestureHandler,\n [gestureType, contentPanGestureHandler, scrollablePanGestureHandler]\n );\n const simultaneousHandlers = useMemo(() => {\n const refs = [];\n\n if (nativeGestureRef) {\n refs.push(nativeGestureRef);\n }\n\n if (refreshControlGestureRef) {\n refs.push(refreshControlGestureRef);\n }\n\n if (_providedSimultaneousHandlers) {\n if (Array.isArray(_providedSimultaneousHandlers)) {\n refs.push(..._providedSimultaneousHandlers);\n } else {\n refs.push(_providedSimultaneousHandlers);\n }\n }\n\n return refs;\n }, [\n _providedSimultaneousHandlers,\n nativeGestureRef,\n refreshControlGestureRef,\n ]);\n //#endregion\n\n return (\n \n \n {children}\n \n \n );\n};\n\nconst BottomSheetDraggableView = memo(BottomSheetDraggableViewComponent);\nBottomSheetDraggableView.displayName = 'BottomSheetDraggableView';\n\nexport default BottomSheetDraggableView;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetDraggableView/index.js b/lib/commonjs/components/bottomSheetDraggableView/index.js deleted file mode 100644 index 0ecdbcf29..000000000 --- a/lib/commonjs/components/bottomSheetDraggableView/index.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "default", { - enumerable: true, - get: function () { - return _BottomSheetDraggableView.default; - } -}); - -var _BottomSheetDraggableView = _interopRequireDefault(require("./BottomSheetDraggableView")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetDraggableView/index.js.map b/lib/commonjs/components/bottomSheetDraggableView/index.js.map deleted file mode 100644 index 7c9605420..000000000 --- a/lib/commonjs/components/bottomSheetDraggableView/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { default } from './BottomSheetDraggableView';\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetFooter/BottomSheetFooter.js b/lib/commonjs/components/bottomSheetFooter/BottomSheetFooter.js deleted file mode 100644 index fe6f151ed..000000000 --- a/lib/commonjs/components/bottomSheetFooter/BottomSheetFooter.js +++ /dev/null @@ -1,75 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _react = _interopRequireWildcard(require("react")); - -var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated")); - -var _constants = require("../../constants"); - -var _hooks = require("../../hooks"); - -var _styles = require("./styles"); - -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - -function BottomSheetFooterComponent({ - animatedFooterPosition, - bottomInset = 0, - style, - children -}) { - //#region hooks - const { - animatedFooterHeight, - animatedKeyboardState - } = (0, _hooks.useBottomSheetInternal)(); //#endregion - //#region styles - - const containerAnimatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => { - let footerTranslateY = animatedFooterPosition.value; - /** - * Offset the bottom inset only when keyboard is not shown - */ - - if (animatedKeyboardState.value !== _constants.KEYBOARD_STATE.SHOWN) { - footerTranslateY = footerTranslateY - bottomInset; - } - - return { - transform: [{ - translateY: Math.max(0, footerTranslateY) - }] - }; - }, [bottomInset, animatedKeyboardState, animatedFooterPosition]); - const containerStyle = (0, _react.useMemo)(() => [_styles.styles.container, style, containerAnimatedStyle], [style, containerAnimatedStyle]); //#endregion - //#region callbacks - - const handleContainerLayout = (0, _react.useCallback)(({ - nativeEvent: { - layout: { - height - } - } - }) => { - animatedFooterHeight.value = height; - }, [animatedFooterHeight]); //#endregion - - return children !== null ? /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, { - pointerEvents: "box-none", - onLayout: handleContainerLayout, - style: containerStyle - }, typeof children === 'function' ? children() : children) : null; -} - -const BottomSheetFooter = /*#__PURE__*/(0, _react.memo)(BottomSheetFooterComponent); -BottomSheetFooter.displayName = 'BottomSheetFooter'; -var _default = BottomSheetFooter; -exports.default = _default; -//# sourceMappingURL=BottomSheetFooter.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetFooter/BottomSheetFooter.js.map b/lib/commonjs/components/bottomSheetFooter/BottomSheetFooter.js.map deleted file mode 100644 index d687aa378..000000000 --- a/lib/commonjs/components/bottomSheetFooter/BottomSheetFooter.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheetFooter.tsx"],"names":["BottomSheetFooterComponent","animatedFooterPosition","bottomInset","style","children","animatedFooterHeight","animatedKeyboardState","containerAnimatedStyle","footerTranslateY","value","KEYBOARD_STATE","SHOWN","transform","translateY","Math","max","containerStyle","styles","container","handleContainerLayout","nativeEvent","layout","height","BottomSheetFooter","displayName"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AACA;;AAEA;;;;;;AAEA,SAASA,0BAAT,CAAoC;AAClCC,EAAAA,sBADkC;AAElCC,EAAAA,WAAW,GAAG,CAFoB;AAGlCC,EAAAA,KAHkC;AAIlCC,EAAAA;AAJkC,CAApC,EAKkC;AAChC;AACA,QAAM;AAAEC,IAAAA,oBAAF;AAAwBC,IAAAA;AAAxB,MACJ,oCADF,CAFgC,CAIhC;AAEA;;AACA,QAAMC,sBAAsB,GAAG,6CAAiB,MAAM;AACpD,QAAIC,gBAAgB,GAAGP,sBAAsB,CAACQ,KAA9C;AAEA;AACJ;AACA;;AACI,QAAIH,qBAAqB,CAACG,KAAtB,KAAgCC,0BAAeC,KAAnD,EAA0D;AACxDH,MAAAA,gBAAgB,GAAGA,gBAAgB,GAAGN,WAAtC;AACD;;AAED,WAAO;AACLU,MAAAA,SAAS,EAAE,CACT;AACEC,QAAAA,UAAU,EAAEC,IAAI,CAACC,GAAL,CAAS,CAAT,EAAYP,gBAAZ;AADd,OADS;AADN,KAAP;AAOD,GAjB8B,EAiB5B,CAACN,WAAD,EAAcI,qBAAd,EAAqCL,sBAArC,CAjB4B,CAA/B;AAkBA,QAAMe,cAAc,GAAG,oBACrB,MAAM,CAACC,eAAOC,SAAR,EAAmBf,KAAnB,EAA0BI,sBAA1B,CADe,EAErB,CAACJ,KAAD,EAAQI,sBAAR,CAFqB,CAAvB,CAzBgC,CA6BhC;AAEA;;AACA,QAAMY,qBAAqB,GAAG,wBAC5B,CAAC;AACCC,IAAAA,WAAW,EAAE;AACXC,MAAAA,MAAM,EAAE;AAAEC,QAAAA;AAAF;AADG;AADd,GAAD,KAIyB;AACvBjB,IAAAA,oBAAoB,CAACI,KAArB,GAA6Ba,MAA7B;AACD,GAP2B,EAQ5B,CAACjB,oBAAD,CAR4B,CAA9B,CAhCgC,CA0ChC;;AAEA,SAAOD,QAAQ,KAAK,IAAb,gBACL,6BAAC,8BAAD,CAAU,IAAV;AACE,IAAA,aAAa,EAAC,UADhB;AAEE,IAAA,QAAQ,EAAEe,qBAFZ;AAGE,IAAA,KAAK,EAAEH;AAHT,KAKG,OAAOZ,QAAP,KAAoB,UAApB,GAAiCA,QAAQ,EAAzC,GAA8CA,QALjD,CADK,GAQH,IARJ;AASD;;AAED,MAAMmB,iBAAiB,gBAAG,iBAAKvB,0BAAL,CAA1B;AACAuB,iBAAiB,CAACC,WAAlB,GAAgC,mBAAhC;eAEeD,iB","sourcesContent":["import React, { memo, useCallback, useMemo } from 'react';\nimport { LayoutChangeEvent } from 'react-native';\nimport Animated, { useAnimatedStyle } from 'react-native-reanimated';\nimport { KEYBOARD_STATE } from '../../constants';\nimport { useBottomSheetInternal } from '../../hooks';\nimport type { BottomSheetDefaultFooterProps } from './types';\nimport { styles } from './styles';\n\nfunction BottomSheetFooterComponent({\n animatedFooterPosition,\n bottomInset = 0,\n style,\n children,\n}: BottomSheetDefaultFooterProps) {\n //#region hooks\n const { animatedFooterHeight, animatedKeyboardState } =\n useBottomSheetInternal();\n //#endregion\n\n //#region styles\n const containerAnimatedStyle = useAnimatedStyle(() => {\n let footerTranslateY = animatedFooterPosition.value;\n\n /**\n * Offset the bottom inset only when keyboard is not shown\n */\n if (animatedKeyboardState.value !== KEYBOARD_STATE.SHOWN) {\n footerTranslateY = footerTranslateY - bottomInset;\n }\n\n return {\n transform: [\n {\n translateY: Math.max(0, footerTranslateY),\n },\n ],\n };\n }, [bottomInset, animatedKeyboardState, animatedFooterPosition]);\n const containerStyle = useMemo(\n () => [styles.container, style, containerAnimatedStyle],\n [style, containerAnimatedStyle]\n );\n //#endregion\n\n //#region callbacks\n const handleContainerLayout = useCallback(\n ({\n nativeEvent: {\n layout: { height },\n },\n }: LayoutChangeEvent) => {\n animatedFooterHeight.value = height;\n },\n [animatedFooterHeight]\n );\n //#endregion\n\n return children !== null ? (\n \n {typeof children === 'function' ? children() : children}\n \n ) : null;\n}\n\nconst BottomSheetFooter = memo(BottomSheetFooterComponent);\nBottomSheetFooter.displayName = 'BottomSheetFooter';\n\nexport default BottomSheetFooter;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetFooter/index.js b/lib/commonjs/components/bottomSheetFooter/index.js deleted file mode 100644 index f6cfe529b..000000000 --- a/lib/commonjs/components/bottomSheetFooter/index.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "default", { - enumerable: true, - get: function () { - return _BottomSheetFooter.default; - } -}); - -var _BottomSheetFooter = _interopRequireDefault(require("./BottomSheetFooter")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetFooter/index.js.map b/lib/commonjs/components/bottomSheetFooter/index.js.map deleted file mode 100644 index daf04946d..000000000 --- a/lib/commonjs/components/bottomSheetFooter/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { default } from './BottomSheetFooter';\nexport type { BottomSheetFooterProps } from './types';\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetFooter/styles.js b/lib/commonjs/components/bottomSheetFooter/styles.js deleted file mode 100644 index b3f080509..000000000 --- a/lib/commonjs/components/bottomSheetFooter/styles.js +++ /dev/null @@ -1,21 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.styles = void 0; - -var _reactNative = require("react-native"); - -const styles = _reactNative.StyleSheet.create({ - container: { - position: 'absolute', - top: 0, - left: 0, - right: 0, - zIndex: 9999 - } -}); - -exports.styles = styles; -//# sourceMappingURL=styles.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetFooter/styles.js.map b/lib/commonjs/components/bottomSheetFooter/styles.js.map deleted file mode 100644 index 076e4205e..000000000 --- a/lib/commonjs/components/bottomSheetFooter/styles.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["styles.ts"],"names":["styles","StyleSheet","create","container","position","top","left","right","zIndex"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,MAAM,GAAGC,wBAAWC,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE;AACTC,IAAAA,QAAQ,EAAE,UADD;AAETC,IAAAA,GAAG,EAAE,CAFI;AAGTC,IAAAA,IAAI,EAAE,CAHG;AAITC,IAAAA,KAAK,EAAE,CAJE;AAKTC,IAAAA,MAAM,EAAE;AALC;AAD2B,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\n\nexport const styles = StyleSheet.create({\n container: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n zIndex: 9999,\n },\n});\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetFooterContainer/BottomSheetFooterContainer.js b/lib/commonjs/components/bottomSheetFooterContainer/BottomSheetFooterContainer.js deleted file mode 100644 index b38709b1e..000000000 --- a/lib/commonjs/components/bottomSheetFooterContainer/BottomSheetFooterContainer.js +++ /dev/null @@ -1,55 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _react = _interopRequireWildcard(require("react")); - -var _reactNativeReanimated = require("react-native-reanimated"); - -var _hooks = require("../../hooks"); - -var _constants = require("../../constants"); - -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - -const BottomSheetFooterContainerComponent = ({ - footerComponent: FooterComponent -}) => { - //#region hooks - const { - animatedContainerHeight, - animatedHandleHeight, - animatedFooterHeight, - animatedPosition, - animatedKeyboardState, - animatedKeyboardHeightInContainer - } = (0, _hooks.useBottomSheetInternal)(); //#endregion - //#region variables - - const animatedFooterPosition = (0, _reactNativeReanimated.useDerivedValue)(() => { - const keyboardHeight = animatedKeyboardHeightInContainer.value; - let footerTranslateY = Math.max(0, animatedContainerHeight.value - animatedPosition.value); - - if (animatedKeyboardState.value === _constants.KEYBOARD_STATE.SHOWN) { - footerTranslateY = footerTranslateY - keyboardHeight; - } - - footerTranslateY = footerTranslateY - animatedFooterHeight.value - animatedHandleHeight.value; - return footerTranslateY; - }, [animatedKeyboardHeightInContainer, animatedContainerHeight, animatedPosition, animatedKeyboardState, animatedFooterHeight, animatedHandleHeight]); //#endregion - - return /*#__PURE__*/_react.default.createElement(FooterComponent, { - animatedFooterPosition: animatedFooterPosition - }); -}; - -const BottomSheetFooterContainer = /*#__PURE__*/(0, _react.memo)(BottomSheetFooterContainerComponent); -BottomSheetFooterContainer.displayName = 'BottomSheetFooterContainer'; -var _default = BottomSheetFooterContainer; -exports.default = _default; -//# sourceMappingURL=BottomSheetFooterContainer.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetFooterContainer/BottomSheetFooterContainer.js.map b/lib/commonjs/components/bottomSheetFooterContainer/BottomSheetFooterContainer.js.map deleted file mode 100644 index d99cdc7fe..000000000 --- a/lib/commonjs/components/bottomSheetFooterContainer/BottomSheetFooterContainer.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheetFooterContainer.tsx"],"names":["BottomSheetFooterContainerComponent","footerComponent","FooterComponent","animatedContainerHeight","animatedHandleHeight","animatedFooterHeight","animatedPosition","animatedKeyboardState","animatedKeyboardHeightInContainer","animatedFooterPosition","keyboardHeight","value","footerTranslateY","Math","max","KEYBOARD_STATE","SHOWN","BottomSheetFooterContainer","displayName"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;AAGA,MAAMA,mCAAmC,GAAG,CAAC;AAC3CC,EAAAA,eAAe,EAAEC;AAD0B,CAAD,KAEL;AACrC;AACA,QAAM;AACJC,IAAAA,uBADI;AAEJC,IAAAA,oBAFI;AAGJC,IAAAA,oBAHI;AAIJC,IAAAA,gBAJI;AAKJC,IAAAA,qBALI;AAMJC,IAAAA;AANI,MAOF,oCAPJ,CAFqC,CAUrC;AAEA;;AACA,QAAMC,sBAAsB,GAAG,4CAAgB,MAAM;AACnD,UAAMC,cAAc,GAAGF,iCAAiC,CAACG,KAAzD;AACA,QAAIC,gBAAgB,GAAGC,IAAI,CAACC,GAAL,CACrB,CADqB,EAErBX,uBAAuB,CAACQ,KAAxB,GAAgCL,gBAAgB,CAACK,KAF5B,CAAvB;;AAKA,QAAIJ,qBAAqB,CAACI,KAAtB,KAAgCI,0BAAeC,KAAnD,EAA0D;AACxDJ,MAAAA,gBAAgB,GAAGA,gBAAgB,GAAGF,cAAtC;AACD;;AAEDE,IAAAA,gBAAgB,GACdA,gBAAgB,GAChBP,oBAAoB,CAACM,KADrB,GAEAP,oBAAoB,CAACO,KAHvB;AAKA,WAAOC,gBAAP;AACD,GAjB8B,EAiB5B,CACDJ,iCADC,EAEDL,uBAFC,EAGDG,gBAHC,EAIDC,qBAJC,EAKDF,oBALC,EAMDD,oBANC,CAjB4B,CAA/B,CAbqC,CAsCrC;;AAEA,sBAAO,6BAAC,eAAD;AAAiB,IAAA,sBAAsB,EAAEK;AAAzC,IAAP;AACD,CA3CD;;AA6CA,MAAMQ,0BAA0B,gBAAG,iBAAKjB,mCAAL,CAAnC;AACAiB,0BAA0B,CAACC,WAA3B,GAAyC,4BAAzC;eAEeD,0B","sourcesContent":["import React, { memo } from 'react';\nimport { useDerivedValue } from 'react-native-reanimated';\nimport { useBottomSheetInternal } from '../../hooks';\nimport { KEYBOARD_STATE } from '../../constants';\nimport type { BottomSheetFooterContainerProps } from './types';\n\nconst BottomSheetFooterContainerComponent = ({\n footerComponent: FooterComponent,\n}: BottomSheetFooterContainerProps) => {\n //#region hooks\n const {\n animatedContainerHeight,\n animatedHandleHeight,\n animatedFooterHeight,\n animatedPosition,\n animatedKeyboardState,\n animatedKeyboardHeightInContainer,\n } = useBottomSheetInternal();\n //#endregion\n\n //#region variables\n const animatedFooterPosition = useDerivedValue(() => {\n const keyboardHeight = animatedKeyboardHeightInContainer.value;\n let footerTranslateY = Math.max(\n 0,\n animatedContainerHeight.value - animatedPosition.value\n );\n\n if (animatedKeyboardState.value === KEYBOARD_STATE.SHOWN) {\n footerTranslateY = footerTranslateY - keyboardHeight;\n }\n\n footerTranslateY =\n footerTranslateY -\n animatedFooterHeight.value -\n animatedHandleHeight.value;\n\n return footerTranslateY;\n }, [\n animatedKeyboardHeightInContainer,\n animatedContainerHeight,\n animatedPosition,\n animatedKeyboardState,\n animatedFooterHeight,\n animatedHandleHeight,\n ]);\n //#endregion\n\n return ;\n};\n\nconst BottomSheetFooterContainer = memo(BottomSheetFooterContainerComponent);\nBottomSheetFooterContainer.displayName = 'BottomSheetFooterContainer';\n\nexport default BottomSheetFooterContainer;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.js b/lib/commonjs/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.js deleted file mode 100644 index 9263f22f9..000000000 --- a/lib/commonjs/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.js +++ /dev/null @@ -1,60 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _react = _interopRequireWildcard(require("react")); - -var _constants = require("../../constants"); - -var _hooks = require("../../hooks"); - -var _contexts = require("../../contexts"); - -var _reactNativeReanimated = require("react-native-reanimated"); - -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - -const BottomSheetGestureHandlersProvider = ({ - gestureEventsHandlersHook: useGestureEventsHandlers = _hooks.useGestureEventsHandlersDefault, - children -}) => { - //#region variables - const animatedGestureSource = (0, _reactNativeReanimated.useSharedValue)(_constants.GESTURE_SOURCE.UNDETERMINED); //#endregion - //#region hooks - - const { - animatedContentGestureState, - animatedHandleGestureState - } = (0, _hooks.useBottomSheetInternal)(); - const { - handleOnStart, - handleOnActive, - handleOnEnd - } = useGestureEventsHandlers(); //#endregion - //#region gestures - - const contentPanGestureHandler = (0, _hooks.useGestureHandler)(_constants.GESTURE_SOURCE.CONTENT, animatedContentGestureState, animatedGestureSource, handleOnStart, handleOnActive, handleOnEnd); - const scrollablePanGestureHandler = (0, _hooks.useGestureHandler)(_constants.GESTURE_SOURCE.SCROLLABLE, animatedContentGestureState, animatedGestureSource, handleOnStart, handleOnActive, handleOnEnd); - const handlePanGestureHandler = (0, _hooks.useGestureHandler)(_constants.GESTURE_SOURCE.HANDLE, animatedHandleGestureState, animatedGestureSource, handleOnStart, handleOnActive, handleOnEnd); //#endregion - //#region context - - const contextValue = (0, _react.useMemo)(() => ({ - contentPanGestureHandler, - handlePanGestureHandler, - scrollablePanGestureHandler, - animatedGestureSource - }), [contentPanGestureHandler, handlePanGestureHandler, scrollablePanGestureHandler, animatedGestureSource]); //#endregion - - return /*#__PURE__*/_react.default.createElement(_contexts.BottomSheetGestureHandlersContext.Provider, { - value: contextValue - }, children); -}; - -var _default = BottomSheetGestureHandlersProvider; -exports.default = _default; -//# sourceMappingURL=BottomSheetGestureHandlersProvider.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.js.map b/lib/commonjs/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.js.map deleted file mode 100644 index dd452a0cc..000000000 --- a/lib/commonjs/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheetGestureHandlersProvider.tsx"],"names":["BottomSheetGestureHandlersProvider","gestureEventsHandlersHook","useGestureEventsHandlers","useGestureEventsHandlersDefault","children","animatedGestureSource","GESTURE_SOURCE","UNDETERMINED","animatedContentGestureState","animatedHandleGestureState","handleOnStart","handleOnActive","handleOnEnd","contentPanGestureHandler","CONTENT","scrollablePanGestureHandler","SCROLLABLE","handlePanGestureHandler","HANDLE","contextValue"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAKA;;AAEA;;;;;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port {\n useGestureHandler,\n useBottomSheetInternal,\n useGestureEventsHandlersDefault,\n} from '../../hooks';\nimport { BottomSheetGestureHandlersContext } from '../../contexts';\nimport type { BottomSheetGestureHandlersProviderProps } from './types';\nimport { useSharedValue } from 'react-native-reanimated';\n\nconst BottomSheetGestureHandlersProvider = ({\n gestureEventsHandlersHook:\n useGestureEventsHandlers = useGestureEventsHandlersDefault,\n children,\n}: BottomSheetGestureHandlersProviderProps) => {\n //#region variables\n const animatedGestureSource = useSharedValue(\n GESTURE_SOURCE.UNDETERMINED\n );\n //#endregion\n\n //#region hooks\n const { animatedContentGestureState, animatedHandleGestureState } =\n useBottomSheetInternal();\n const { handleOnStart, handleOnActive, handleOnEnd } =\n useGestureEventsHandlers();\n //#endregion\n\n //#region gestures\n const contentPanGestureHandler = useGestureHandler(\n GESTURE_SOURCE.CONTENT,\n animatedContentGestureState,\n animatedGestureSource,\n handleOnStart,\n handleOnActive,\n handleOnEnd\n );\n\n const scrollablePanGestureHandler = useGestureHandler(\n GESTURE_SOURCE.SCROLLABLE,\n animatedContentGestureState,\n animatedGestureSource,\n handleOnStart,\n handleOnActive,\n handleOnEnd\n );\n\n const handlePanGestureHandler = useGestureHandler(\n GESTURE_SOURCE.HANDLE,\n animatedHandleGestureState,\n animatedGestureSource,\n handleOnStart,\n handleOnActive,\n handleOnEnd\n );\n //#endregion\n\n //#region context\n const contextValue = useMemo(\n () => ({\n contentPanGestureHandler,\n handlePanGestureHandler,\n scrollablePanGestureHandler,\n animatedGestureSource,\n }),\n [\n contentPanGestureHandler,\n handlePanGestureHandler,\n scrollablePanGestureHandler,\n animatedGestureSource,\n ]\n );\n //#endregion\n return (\n \n {children}\n \n );\n};\n\nexport default BottomSheetGestureHandlersProvider;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetGestureHandlersProvider/index.js b/lib/commonjs/components/bottomSheetGestureHandlersProvider/index.js deleted file mode 100644 index 0d0ad97f1..000000000 --- a/lib/commonjs/components/bottomSheetGestureHandlersProvider/index.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "default", { - enumerable: true, - get: function () { - return _BottomSheetGestureHandlersProvider.default; - } -}); - -var _BottomSheetGestureHandlersProvider = _interopRequireDefault(require("./BottomSheetGestureHandlersProvider")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetGestureHandlersProvider/index.js.map b/lib/commonjs/components/bottomSheetGestureHandlersProvider/index.js.map deleted file mode 100644 index 435db8036..000000000 --- a/lib/commonjs/components/bottomSheetGestureHandlersProvider/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { default } from './BottomSheetGestureHandlersProvider';\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetHandle/BottomSheetHandle.js b/lib/commonjs/components/bottomSheetHandle/BottomSheetHandle.js deleted file mode 100644 index df780a8cd..000000000 --- a/lib/commonjs/components/bottomSheetHandle/BottomSheetHandle.js +++ /dev/null @@ -1,40 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _react = _interopRequireWildcard(require("react")); - -var _reactNativeReanimated = _interopRequireDefault(require("react-native-reanimated")); - -var _styles = require("./styles"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - -const BottomSheetHandleComponent = ({ - style, - indicatorStyle: _indicatorStyle, - children -}) => { - // styles - const containerStyle = (0, _react.useMemo)(() => [_styles.styles.container, ...[Array.isArray(style) ? style : [style]]], [style]); - const indicatorStyle = (0, _react.useMemo)(() => [_styles.styles.indicator, ...[Array.isArray(_indicatorStyle) ? _indicatorStyle : [_indicatorStyle]]], [_indicatorStyle]); // render - - return /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, { - style: containerStyle - }, /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, { - style: indicatorStyle - }), children); -}; - -const BottomSheetHandle = /*#__PURE__*/(0, _react.memo)(BottomSheetHandleComponent); -BottomSheetHandle.displayName = 'BottomSheetHandle'; -var _default = BottomSheetHandle; -exports.default = _default; -//# sourceMappingURL=BottomSheetHandle.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetHandle/BottomSheetHandle.js.map b/lib/commonjs/components/bottomSheetHandle/BottomSheetHandle.js.map deleted file mode 100644 index 2cc9b31c8..000000000 --- a/lib/commonjs/components/bottomSheetHandle/BottomSheetHandle.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheetHandle.tsx"],"names":["BottomSheetHandleComponent","style","indicatorStyle","_indicatorStyle","children","containerStyle","styles","container","Array","isArray","indicator","BottomSheetHandle","displayName"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;;;;;AAGA,MAAMA,0BAA0B,GAAG,CAAC;AAClCC,EAAAA,KADkC;AAElCC,EAAAA,cAAc,EAAEC,eAFkB;AAGlCC,EAAAA;AAHkC,CAAD,KAIE;AACnC;AACA,QAAMC,cAAc,GAAG,oBACrB,MAAM,CAACC,eAAOC,SAAR,EAAmB,GAAG,CAACC,KAAK,CAACC,OAAN,CAAcR,KAAd,IAAuBA,KAAvB,GAA+B,CAACA,KAAD,CAAhC,CAAtB,CADe,EAErB,CAACA,KAAD,CAFqB,CAAvB;AAIA,QAAMC,cAAc,GAAG,oBACrB,MAAM,CACJI,eAAOI,SADH,EAEJ,GAAG,CAACF,KAAK,CAACC,OAAN,CAAcN,eAAd,IAAiCA,eAAjC,GAAmD,CAACA,eAAD,CAApD,CAFC,CADe,EAKrB,CAACA,eAAD,CALqB,CAAvB,CANmC,CAcnC;;AACA,sBACE,6BAAC,8BAAD,CAAU,IAAV;AAAe,IAAA,KAAK,EAAEE;AAAtB,kBACE,6BAAC,8BAAD,CAAU,IAAV;AAAe,IAAA,KAAK,EAAEH;AAAtB,IADF,EAEGE,QAFH,CADF;AAMD,CAzBD;;AA2BA,MAAMO,iBAAiB,gBAAG,iBAAKX,0BAAL,CAA1B;AACAW,iBAAiB,CAACC,WAAlB,GAAgC,mBAAhC;eAEeD,iB","sourcesContent":["import React, { memo, useMemo } from 'react';\nimport Animated from 'react-native-reanimated';\nimport { styles } from './styles';\nimport type { BottomSheetDefaultHandleProps } from './types';\n\nconst BottomSheetHandleComponent = ({\n style,\n indicatorStyle: _indicatorStyle,\n children,\n}: BottomSheetDefaultHandleProps) => {\n // styles\n const containerStyle = useMemo(\n () => [styles.container, ...[Array.isArray(style) ? style : [style]]],\n [style]\n );\n const indicatorStyle = useMemo(\n () => [\n styles.indicator,\n ...[Array.isArray(_indicatorStyle) ? _indicatorStyle : [_indicatorStyle]],\n ],\n [_indicatorStyle]\n );\n\n // render\n return (\n \n \n {children}\n \n );\n};\n\nconst BottomSheetHandle = memo(BottomSheetHandleComponent);\nBottomSheetHandle.displayName = 'BottomSheetHandle';\n\nexport default BottomSheetHandle;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetHandle/index.js b/lib/commonjs/components/bottomSheetHandle/index.js deleted file mode 100644 index 5f758bd29..000000000 --- a/lib/commonjs/components/bottomSheetHandle/index.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "default", { - enumerable: true, - get: function () { - return _BottomSheetHandle.default; - } -}); - -var _BottomSheetHandle = _interopRequireDefault(require("./BottomSheetHandle")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetHandle/index.js.map b/lib/commonjs/components/bottomSheetHandle/index.js.map deleted file mode 100644 index ea0d960c9..000000000 --- a/lib/commonjs/components/bottomSheetHandle/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { default } from './BottomSheetHandle';\nexport type { BottomSheetHandleProps } from './types';\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetHandle/styles.js b/lib/commonjs/components/bottomSheetHandle/styles.js deleted file mode 100644 index d544f5627..000000000 --- a/lib/commonjs/components/bottomSheetHandle/styles.js +++ /dev/null @@ -1,26 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.styles = void 0; - -var _reactNative = require("react-native"); - -var _constants = require("../../constants"); - -const styles = _reactNative.StyleSheet.create({ - container: { - padding: 10 - }, - indicator: { - alignSelf: 'center', - width: 7.5 * _constants.WINDOW_WIDTH / 100, - height: 4, - borderRadius: 4, - backgroundColor: 'rgba(0, 0, 0, 0.75)' - } -}); - -exports.styles = styles; -//# sourceMappingURL=styles.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetHandle/styles.js.map b/lib/commonjs/components/bottomSheetHandle/styles.js.map deleted file mode 100644 index 3d7f00468..000000000 --- a/lib/commonjs/components/bottomSheetHandle/styles.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["styles.ts"],"names":["styles","StyleSheet","create","container","padding","indicator","alignSelf","width","WINDOW_WIDTH","height","borderRadius","backgroundColor"],"mappings":";;;;;;;AAAA;;AACA;;AAEO,MAAMA,MAAM,GAAGC,wBAAWC,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE;AACTC,IAAAA,OAAO,EAAE;AADA,GAD2B;AAKtCC,EAAAA,SAAS,EAAE;AACTC,IAAAA,SAAS,EAAE,QADF;AAETC,IAAAA,KAAK,EAAG,MAAMC,uBAAP,GAAuB,GAFrB;AAGTC,IAAAA,MAAM,EAAE,CAHC;AAITC,IAAAA,YAAY,EAAE,CAJL;AAKTC,IAAAA,eAAe,EAAE;AALR;AAL2B,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\nimport { WINDOW_WIDTH } from '../../constants';\n\nexport const styles = StyleSheet.create({\n container: {\n padding: 10,\n },\n\n indicator: {\n alignSelf: 'center',\n width: (7.5 * WINDOW_WIDTH) / 100,\n height: 4,\n borderRadius: 4,\n backgroundColor: 'rgba(0, 0, 0, 0.75)',\n },\n});\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetHandleContainer/BottomSheetHandleContainer.js b/lib/commonjs/components/bottomSheetHandleContainer/BottomSheetHandleContainer.js deleted file mode 100644 index 0fb476847..000000000 --- a/lib/commonjs/components/bottomSheetHandleContainer/BottomSheetHandleContainer.js +++ /dev/null @@ -1,117 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _react = _interopRequireWildcard(require("react")); - -var _reactNativeGestureHandler = require("react-native-gesture-handler"); - -var _reactNativeReanimated = _interopRequireDefault(require("react-native-reanimated")); - -var _bottomSheetHandle = _interopRequireDefault(require("../bottomSheetHandle")); - -var _hooks = require("../../hooks"); - -var _utilities = require("../../utilities"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - -function BottomSheetHandleContainerComponent({ - animatedIndex, - animatedPosition, - simultaneousHandlers: _internalSimultaneousHandlers, - enableHandlePanningGesture, - handleHeight, - handleComponent: _providedHandleComponent, - handleStyle: _providedHandleStyle, - handleIndicatorStyle: _providedIndicatorStyle -}) { - //#region hooks - const { - activeOffsetX, - activeOffsetY, - failOffsetX, - failOffsetY, - waitFor, - simultaneousHandlers: _providedSimultaneousHandlers - } = (0, _hooks.useBottomSheetInternal)(); - const { - handlePanGestureHandler - } = (0, _hooks.useBottomSheetGestureHandlers)(); //#endregion - //#region variables - - const simultaneousHandlers = (0, _react.useMemo)(() => { - const refs = []; - - if (_internalSimultaneousHandlers) { - refs.push(_internalSimultaneousHandlers); - } - - if (_providedSimultaneousHandlers) { - if (Array.isArray(_providedSimultaneousHandlers)) { - refs.push(..._providedSimultaneousHandlers); - } else { - refs.push(_providedSimultaneousHandlers); - } - } - - return refs; - }, [_providedSimultaneousHandlers, _internalSimultaneousHandlers]); //#endregion - //#region callbacks - - const handleContainerLayout = (0, _react.useCallback)(function handleContainerLayout({ - nativeEvent: { - layout: { - height - } - } - }) { - handleHeight.value = height; - (0, _utilities.print)({ - component: BottomSheetHandleContainer.displayName, - method: 'handleContainerLayout', - params: { - height - } - }); - }, [handleHeight]); //#endregion - //#region renders - - const HandleComponent = _providedHandleComponent === undefined ? _bottomSheetHandle.default : _providedHandleComponent; - return HandleComponent !== null ? /*#__PURE__*/_react.default.createElement(_reactNativeGestureHandler.PanGestureHandler, { - enabled: enableHandlePanningGesture, - waitFor: waitFor, - simultaneousHandlers: simultaneousHandlers, - shouldCancelWhenOutside: false, - activeOffsetX: activeOffsetX, - activeOffsetY: activeOffsetY, - failOffsetX: failOffsetX, - failOffsetY: failOffsetY, - onGestureEvent: handlePanGestureHandler - }, /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, { - key: "BottomSheetHandleContainer", - accessible: true, - accessibilityRole: "adjustable", - accessibilityLabel: "Bottom Sheet handle", - accessibilityHint: "Drag up or down to extend or minimize the Bottom Sheet", - onLayout: handleContainerLayout - }, /*#__PURE__*/_react.default.createElement(HandleComponent, { - animatedIndex: animatedIndex, - animatedPosition: animatedPosition, - style: _providedHandleStyle, - indicatorStyle: _providedIndicatorStyle - }))) : null; //#endregion -} - -const BottomSheetHandleContainer = /*#__PURE__*/(0, _react.memo)(BottomSheetHandleContainerComponent); -BottomSheetHandleContainer.displayName = 'BottomSheetHandleContainer'; -var _default = BottomSheetHandleContainer; -exports.default = _default; -//# sourceMappingURL=BottomSheetHandleContainer.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetHandleContainer/BottomSheetHandleContainer.js.map b/lib/commonjs/components/bottomSheetHandleContainer/BottomSheetHandleContainer.js.map deleted file mode 100644 index a2b3bb3a0..000000000 --- a/lib/commonjs/components/bottomSheetHandleContainer/BottomSheetHandleContainer.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheetHandleContainer.tsx"],"names":["BottomSheetHandleContainerComponent","animatedIndex","animatedPosition","simultaneousHandlers","_internalSimultaneousHandlers","enableHandlePanningGesture","handleHeight","handleComponent","_providedHandleComponent","handleStyle","_providedHandleStyle","handleIndicatorStyle","_providedIndicatorStyle","activeOffsetX","activeOffsetY","failOffsetX","failOffsetY","waitFor","_providedSimultaneousHandlers","handlePanGestureHandler","refs","push","Array","isArray","handleContainerLayout","nativeEvent","layout","height","value","component","BottomSheetHandleContainer","displayName","method","params","HandleComponent","undefined","BottomSheetHandle"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AAIA;;;;;;;;AAGA,SAASA,mCAAT,CAA6C;AAC3CC,EAAAA,aAD2C;AAE3CC,EAAAA,gBAF2C;AAG3CC,EAAAA,oBAAoB,EAAEC,6BAHqB;AAI3CC,EAAAA,0BAJ2C;AAK3CC,EAAAA,YAL2C;AAM3CC,EAAAA,eAAe,EAAEC,wBAN0B;AAO3CC,EAAAA,WAAW,EAAEC,oBAP8B;AAQ3CC,EAAAA,oBAAoB,EAAEC;AARqB,CAA7C,EASoC;AAClC;AACA,QAAM;AACJC,IAAAA,aADI;AAEJC,IAAAA,aAFI;AAGJC,IAAAA,WAHI;AAIJC,IAAAA,WAJI;AAKJC,IAAAA,OALI;AAMJd,IAAAA,oBAAoB,EAAEe;AANlB,MAOF,oCAPJ;AAQA,QAAM;AAAEC,IAAAA;AAAF,MAA8B,2CAApC,CAVkC,CAWlC;AAEA;;AACA,QAAMhB,oBAAoB,GAAG,oBAAa,MAAM;AAC9C,UAAMiB,IAAI,GAAG,EAAb;;AAEA,QAAIhB,6BAAJ,EAAmC;AACjCgB,MAAAA,IAAI,CAACC,IAAL,CAAUjB,6BAAV;AACD;;AAED,QAAIc,6BAAJ,EAAmC;AACjC,UAAII,KAAK,CAACC,OAAN,CAAcL,6BAAd,CAAJ,EAAkD;AAChDE,QAAAA,IAAI,CAACC,I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iBAAiB,EAAC,wDALpB;AAME,IAAA,QAAQ,EAAEK;AANZ,kBAQE,6BAAC,eAAD;AACE,IAAA,aAAa,EAAEvB,aADjB;AAEE,IAAA,gBAAgB,EAAEC,gBAFpB;AAGE,IAAA,KAAK,EAAEQ,oBAHT;AAIE,IAAA,cAAc,EAAEE;AAJlB,IARF,CAXF,CADK,GA4BH,IA5BJ,CA3DkC,CAwFlC;AACD;;AAED,MAAMkB,0BAA0B,gBAAG,iBAAK9B,mCAAL,CAAnC;AACA8B,0BAA0B,CAACC,WAA3B,GAAyC,4BAAzC;eAEeD,0B","sourcesContent":["import React, { memo, useCallback, useMemo } from 'react';\nimport type { LayoutChangeEvent } from 'react-native';\nimport { PanGestureHandler } from 'react-native-gesture-handler';\nimport Animated from 'react-native-reanimated';\nimport BottomSheetHandle from '../bottomSheetHandle';\nimport {\n useBottomSheetGestureHandlers,\n useBottomSheetInternal,\n} from '../../hooks';\nimport { print } from '../../utilities';\nimport type { BottomSheetHandleContainerProps } from './types';\n\nfunction BottomSheetHandleContainerComponent({\n animatedIndex,\n animatedPosition,\n simultaneousHandlers: _internalSimultaneousHandlers,\n enableHandlePanningGesture,\n handleHeight,\n handleComponent: _providedHandleComponent,\n handleStyle: _providedHandleStyle,\n handleIndicatorStyle: _providedIndicatorStyle,\n}: BottomSheetHandleContainerProps) {\n //#region hooks\n const {\n activeOffsetX,\n activeOffsetY,\n failOffsetX,\n failOffsetY,\n waitFor,\n simultaneousHandlers: _providedSimultaneousHandlers,\n } = useBottomSheetInternal();\n const { handlePanGestureHandler } = useBottomSheetGestureHandlers();\n //#endregion\n\n //#region variables\n const simultaneousHandlers = useMemo(() => {\n const refs = [];\n\n if (_internalSimultaneousHandlers) {\n refs.push(_internalSimultaneousHandlers);\n }\n\n if (_providedSimultaneousHandlers) {\n if (Array.isArray(_providedSimultaneousHandlers)) {\n refs.push(..._providedSimultaneousHandlers);\n } else {\n refs.push(_providedSimultaneousHandlers);\n }\n }\n\n return refs;\n }, [_providedSimultaneousHandlers, _internalSimultaneousHandlers]);\n //#endregion\n\n //#region callbacks\n const handleContainerLayout = useCallback(\n function handleContainerLayout({\n nativeEvent: {\n layout: { height },\n },\n }: LayoutChangeEvent) {\n handleHeight.value = height;\n\n print({\n component: BottomSheetHandleContainer.displayName,\n method: 'handleContainerLayout',\n params: {\n height,\n },\n });\n },\n [handleHeight]\n );\n //#endregion\n\n //#region renders\n const HandleComponent =\n _providedHandleComponent === undefined\n ? BottomSheetHandle\n : _providedHandleComponent;\n return HandleComponent !== null ? (\n \n \n \n \n \n ) : null;\n //#endregion\n}\n\nconst BottomSheetHandleContainer = memo(BottomSheetHandleContainerComponent);\nBottomSheetHandleContainer.displayName = 'BottomSheetHandleContainer';\n\nexport default BottomSheetHandleContainer;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetHandleContainer/index.js b/lib/commonjs/components/bottomSheetHandleContainer/index.js deleted file mode 100644 index 170fcfa10..000000000 --- a/lib/commonjs/components/bottomSheetHandleContainer/index.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "default", { - enumerable: true, - get: function () { - return _BottomSheetHandleContainer.default; - } -}); - -var _BottomSheetHandleContainer = _interopRequireDefault(require("./BottomSheetHandleContainer")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetHandleContainer/index.js.map b/lib/commonjs/components/bottomSheetHandleContainer/index.js.map deleted file mode 100644 index b98bd3483..000000000 --- a/lib/commonjs/components/bottomSheetHandleContainer/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { default } from './BottomSheetHandleContainer';\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetModal/BottomSheetModal.js b/lib/commonjs/components/bottomSheetModal/BottomSheetModal.js deleted file mode 100644 index 5dca51fdf..000000000 --- a/lib/commonjs/components/bottomSheetModal/BottomSheetModal.js +++ /dev/null @@ -1,384 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _react = _interopRequireWildcard(require("react")); - -var _portal = require("@gorhom/portal"); - -var _bottomSheet = _interopRequireDefault(require("../bottomSheet")); - -var _hooks = require("../../hooks"); - -var _utilities = require("../../utilities"); - -var _constants = require("./constants"); - -var _id = require("../../utilities/id"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - -function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } - -const INITIAL_STATE = { - mount: false, - data: undefined -}; -const BottomSheetModalComponent = /*#__PURE__*/(0, _react.forwardRef)(function BottomSheetModal(props, ref) { - const { - // modal props - name, - stackBehavior = _constants.DEFAULT_STACK_BEHAVIOR, - enableDismissOnClose = _constants.DEFAULT_ENABLE_DISMISS_ON_CLOSE, - onDismiss: _providedOnDismiss, - // bottom sheet props - index = 0, - snapPoints, - enablePanDownToClose = true, - animateOnMount = true, - containerComponent: ContainerComponent = _react.default.Fragment, - // callbacks - onChange: _providedOnChange, - // components - children: Content, - ...bottomSheetProps - } = props; //#region state - - const [{ - mount, - data - }, setState] = (0, _react.useState)(INITIAL_STATE); //#endregion - //#region hooks - - const { - containerHeight, - containerOffset, - mountSheet, - unmountSheet, - willUnmountSheet - } = (0, _hooks.useBottomSheetModalInternal)(); - const { - removePortal: unmountPortal - } = (0, _portal.usePortal)(); //#endregion - //#region refs - - const bottomSheetRef = (0, _react.useRef)(null); - const currentIndexRef = (0, _react.useRef)(!animateOnMount ? index : -1); - const restoreIndexRef = (0, _react.useRef)(-1); - const minimized = (0, _react.useRef)(false); - const forcedDismissed = (0, _react.useRef)(false); - const mounted = (0, _react.useRef)(false); - mounted.current = mount; //#endregion - //#region variables - - const key = (0, _react.useMemo)(() => name || `bottom-sheet-modal-${(0, _id.id)()}`, [name]); //#endregion - //#region private methods - - const resetVariables = (0, _react.useCallback)(function resetVariables() { - (0, _utilities.print)({ - component: BottomSheetModal.name, - method: resetVariables.name - }); - currentIndexRef.current = -1; - restoreIndexRef.current = -1; - minimized.current = false; - mounted.current = false; - forcedDismissed.current = false; - }, []); - const unmount = (0, _react.useCallback)(function unmount() { - (0, _utilities.print)({ - component: BottomSheetModal.name, - method: unmount.name - }); - const _mounted = mounted.current; // reset variables - - resetVariables(); // unmount sheet and portal - - unmountSheet(key); - unmountPortal(key); // unmount the node, if sheet is still mounted - - if (_mounted) { - setState(INITIAL_STATE); - } // fire `onDismiss` callback - - - if (_providedOnDismiss) { - _providedOnDismiss(); - } - }, [key, resetVariables, unmountSheet, unmountPortal, _providedOnDismiss]); //#endregion - //#region bottom sheet methods - - const handleSnapToIndex = (0, _react.useCallback)((...args) => { - var _bottomSheetRef$curre; - - if (minimized.current) { - return; - } - - (_bottomSheetRef$curre = bottomSheetRef.current) === null || _bottomSheetRef$curre === void 0 ? void 0 : _bottomSheetRef$curre.snapToIndex(...args); - }, []); - const handleSnapToPosition = (0, _react.useCallback)((...args) => { - var _bottomSheetRef$curre2; - - if (minimized.current) { - return; - } - - (_bottomSheetRef$curre2 = bottomSheetRef.current) === null || _bottomSheetRef$curre2 === void 0 ? void 0 : _bottomSheetRef$curre2.snapToPosition(...args); - }, []); - const handleExpand = (0, _react.useCallback)((...args) => { - var _bottomSheetRef$curre3; - - if (minimized.current) { - return; - } - - (_bottomSheetRef$curre3 = bottomSheetRef.current) === null || _bottomSheetRef$curre3 === void 0 ? void 0 : _bottomSheetRef$curre3.expand(...args); - }, []); - const handleCollapse = (0, _react.useCallback)((...args) => { - var _bottomSheetRef$curre4; - - if (minimized.current) { - return; - } - - (_bottomSheetRef$curre4 = bottomSheetRef.current) === null || _bottomSheetRef$curre4 === void 0 ? void 0 : _bottomSheetRef$curre4.collapse(...args); - }, []); - const handleClose = (0, _react.useCallback)((...args) => { - var _bottomSheetRef$curre5; - - if (minimized.current) { - return; - } - - (_bottomSheetRef$curre5 = bottomSheetRef.current) === null || _bottomSheetRef$curre5 === void 0 ? void 0 : _bottomSheetRef$curre5.close(...args); - }, []); - const handleForceClose = (0, _react.useCallback)((...args) => { - var _bottomSheetRef$curre6; - - if (minimized.current) { - return; - } - - (_bottomSheetRef$curre6 = bottomSheetRef.current) === null || _bottomSheetRef$curre6 === void 0 ? void 0 : _bottomSheetRef$curre6.forceClose(...args); - }, []); //#endregion - //#region bottom sheet modal methods - - const handlePresent = (0, _react.useCallback)(function handlePresent(_data) { - requestAnimationFrame(() => { - setState({ - mount: true, - data: _data - }); - mountSheet(key, ref, stackBehavior); - (0, _utilities.print)({ - component: BottomSheetModal.name, - method: handlePresent.name - }); - }); - }, // eslint-disable-next-line react-hooks/exhaustive-deps - [key, stackBehavior, mountSheet]); - const handleDismiss = (0, _react.useCallback)(function handleDismiss(animationConfigs) { - var _bottomSheetRef$curre7; - - (0, _utilities.print)({ - component: BottomSheetModal.name, - method: handleDismiss.name, - params: { - currentIndexRef: currentIndexRef.current, - minimized: minimized.current - } - }); - /** - * if modal is already been dismiss, we exit the method. - */ - - if (currentIndexRef.current === -1 && minimized.current === false) { - return; - } - - if (minimized.current || currentIndexRef.current === -1 && enablePanDownToClose) { - unmount(); - return; - } - - willUnmountSheet(key); - forcedDismissed.current = true; - (_bottomSheetRef$curre7 = bottomSheetRef.current) === null || _bottomSheetRef$curre7 === void 0 ? void 0 : _bottomSheetRef$curre7.forceClose(animationConfigs); - }, [willUnmountSheet, unmount, key, enablePanDownToClose]); - const handleMinimize = (0, _react.useCallback)(function handleMinimize() { - var _bottomSheetRef$curre8; - - (0, _utilities.print)({ - component: BottomSheetModal.name, - method: handleMinimize.name, - params: { - minimized: minimized.current - } - }); - - if (minimized.current) { - return; - } - - minimized.current = true; - /** - * if modal got minimized before it finish its mounting - * animation, we set the `restoreIndexRef` to the - * provided index. - */ - - if (currentIndexRef.current === -1) { - restoreIndexRef.current = index; - } else { - restoreIndexRef.current = currentIndexRef.current; - } - - (_bottomSheetRef$curre8 = bottomSheetRef.current) === null || _bottomSheetRef$curre8 === void 0 ? void 0 : _bottomSheetRef$curre8.close(); - }, [index]); - const handleRestore = (0, _react.useCallback)(function handleRestore() { - var _bottomSheetRef$curre9; - - (0, _utilities.print)({ - component: BottomSheetModal.name, - method: handleRestore.name, - params: { - minimized: minimized.current, - forcedDismissed: forcedDismissed.current - } - }); - - if (!minimized.current || forcedDismissed.current) { - return; - } - - minimized.current = false; - (_bottomSheetRef$curre9 = bottomSheetRef.current) === null || _bottomSheetRef$curre9 === void 0 ? void 0 : _bottomSheetRef$curre9.snapToIndex(restoreIndexRef.current); - }, []); //#endregion - //#region callbacks - - const handlePortalOnUnmount = (0, _react.useCallback)(function handlePortalOnUnmount() { - var _bottomSheetRef$curre10; - - (0, _utilities.print)({ - component: BottomSheetModal.name, - method: handlePortalOnUnmount.name, - params: { - minimized: minimized.current, - forcedDismissed: forcedDismissed.current - } - }); - /** - * if modal is already been dismiss, we exit the method. - */ - - if (currentIndexRef.current === -1 && minimized.current === false) { - return; - } - - mounted.current = false; - forcedDismissed.current = true; - - if (minimized.current) { - unmount(); - return; - } - - willUnmountSheet(key); - (_bottomSheetRef$curre10 = bottomSheetRef.current) === null || _bottomSheetRef$curre10 === void 0 ? void 0 : _bottomSheetRef$curre10.close(); - }, [key, unmount, willUnmountSheet]); - const handlePortalRender = (0, _react.useCallback)(function handlePortalRender(render) { - if (mounted.current) { - render(); - } - }, []); - const handleBottomSheetOnChange = (0, _react.useCallback)(function handleBottomSheetOnChange(_index) { - (0, _utilities.print)({ - component: BottomSheetModal.name, - method: handleBottomSheetOnChange.name, - params: { - minimized: minimized.current, - forcedDismissed: forcedDismissed.current - } - }); - currentIndexRef.current = _index; - - if (_providedOnChange) { - _providedOnChange(_index); - } - }, [_providedOnChange]); - const handleBottomSheetOnClose = (0, _react.useCallback)(function handleBottomSheetOnClose() { - (0, _utilities.print)({ - component: BottomSheetModal.name, - method: handleBottomSheetOnClose.name, - params: { - minimized: minimized.current, - forcedDismissed: forcedDismissed.current - } - }); - - if (minimized.current) { - return; - } - - if (enableDismissOnClose) { - unmount(); - } - }, [enableDismissOnClose, unmount]); //#endregion - //#region expose methods - - (0, _react.useImperativeHandle)(ref, () => ({ - // sheet - snapToIndex: handleSnapToIndex, - snapToPosition: handleSnapToPosition, - expand: handleExpand, - collapse: handleCollapse, - close: handleClose, - forceClose: handleForceClose, - // modal methods - dismiss: handleDismiss, - present: handlePresent, - // internal - minimize: handleMinimize, - restore: handleRestore - })); //#endregion - // render - // console.log('BottomSheetModal', index, mount, data); - - return mount ? /*#__PURE__*/_react.default.createElement(_portal.Portal, { - key: key, - name: key, - handleOnMount: handlePortalRender, - handleOnUpdate: handlePortalRender, - handleOnUnmount: handlePortalOnUnmount - }, /*#__PURE__*/_react.default.createElement(ContainerComponent, { - key: key - }, /*#__PURE__*/_react.default.createElement(_bottomSheet.default, _extends({}, bottomSheetProps, { - ref: bottomSheetRef, - key: key, - index: index, - snapPoints: snapPoints, - enablePanDownToClose: enablePanDownToClose, - animateOnMount: animateOnMount, - containerHeight: containerHeight, - containerOffset: containerOffset, - onChange: handleBottomSheetOnChange, - onClose: handleBottomSheetOnClose, - children: typeof Content === 'function' ? /*#__PURE__*/_react.default.createElement(Content, { - data: data - }) : Content, - $modal: true - })))) : null; -}); -const BottomSheetModal = /*#__PURE__*/(0, _react.memo)(BottomSheetModalComponent); -BottomSheetModal.displayName = 'BottomSheetModal'; -var _default = BottomSheetModal; -exports.default = _default; -//# sourceMappingURL=BottomSheetModal.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetModal/BottomSheetModal.js.map b/lib/commonjs/components/bottomSheetModal/BottomSheetModal.js.map deleted file mode 100644 index 3aad70c0e..000000000 --- a/lib/commonjs/components/bottomSheetModal/BottomSheetModal.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheetModal.tsx"],"names":["INITIAL_STATE","mount","data","undefined","BottomSheetModalComponent","BottomSheetModal","props","ref","name","stackBehavior","DEFAULT_STACK_BEHAVIOR","enableDismissOnClose","DEFAULT_ENABLE_DISMISS_ON_CLOSE","onDismiss","_providedOnDismiss","index","snapPoints","enablePanDownToClose","animateOnMount","containerComponent","ContainerComponent","React","Fragment","onChange","_providedOnChange","children","Content","bottomSheetProps","setState","containerHeight","containerOffset","mountSheet","unmountSheet","willUnmountSheet","removePortal","unmountPortal","bottomSheetRef","currentIndexRef","restoreIndexRef","minimized","forcedDismissed","mounted","current","key","resetVariables","component","method","unmount","_mounted","handleSnapToIndex","args","snapToIndex","handleSnapToPosition","snapToPosition","handleExpand","expand","handleCollapse","collapse","handleClose","close","handleForceClose","forceClose","handlePresent","_data","requestAnimationFrame","handleDismiss","animationConfigs","params","handleMinimize","handleRestore","handlePortalOnUnmount","handlePortalRender","render","handleBottomSheetOnChange","_index","handleBottomSheetOnClose","dismiss","present","minimize","restore","displayName"],"mappings":";;;;;;;AAAA;;AASA;;AACA;;AACA;;AACA;;AACA;;AAMA;;;;;;;;;;AAIA,MAAMA,aAGL,GAAG;AACFC,EAAAA,KAAK,EAAE,KADL;AAEFC,EAAAA,IAAI,EAAEC;AAFJ,CAHJ;AAQA,MAAMC,yBAAyB,gBAAG,uBAGhC,SAASC,gBAAT,CAA0BC,KAA1B,EAAiCC,GAAjC,EAAsC;AACtC,QAAM;AACJ;AACAC,IAAAA,IAFI;AAGJC,IAAAA,aAAa,GAAGC,iCAHZ;AAIJC,IAAAA,oBAAoB,GAAGC,0CAJnB;AAKJC,IAAAA,SAAS,EAAEC,kBALP;AAOJ;AACAC,IAAAA,KAAK,GAAG,CARJ;AASJC,IAAAA,UATI;AAUJC,IAAAA,oBAAoB,GAAG,IAVnB;AAWJC,IAAAA,cAAc,GAAG,IAXb;AAYJC,IAAAA,kBAAkB,EAAEC,kBAAkB,GAAGC,eAAMC,QAZ3C;AAcJ;AACAC,IAAAA,QAAQ,EAAEC,iBAfN;AAiBJ;AACAC,IAAAA,QAAQ,EAAEC,OAlBN;AAmBJ,OAAGC;AAnBC,MAoBFrB,KApBJ,CADsC,CAuBtC;;AACA,QAAM,CAAC;AAAEL,IAAAA,KAAF;AAASC,IAAAA;AAAT,GAAD,EAAkB0B,QAAlB,IAA8B,qBAAS5B,aAAT,CAApC,CAxBsC,CAyBtC;AAEA;;AACA,QAAM;AACJ6B,IAAAA,eADI;AAEJC,IAAAA,eAFI;AAGJC,IAAAA,UAHI;AAIJC,IAAAA,YAJI;AAKJC,IAAAA;AALI,MAMF,yCANJ;AAOA,QAAM;AAAEC,IAAAA,YAAY,EAAEC;AAAhB,MAAkC,wBAAxC,CAnCsC,CAoCtC;AAEA;;AACA,QAAMC,cAAc,GAAG,mBAAoB,IAApB,CAAvB;AACA,QAAMC,eAAe,GAAG,mBAAO,CAACnB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PF,CADU,GA4BR,IA5BJ;AA6BD,CAhXiC,CAAlC;AAkXA,MAAMrB,gBAAgB,gBAAG,iBAAKD,yBAAL,CAAzB;AACAC,gBAAgB,CAAC2E,WAAjB,GAA+B,kBAA/B;eAEe3E,gB","sourcesContent":["import React, {\n forwardRef,\n memo,\n useCallback,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { Portal, usePortal } from '@gorhom/portal';\nimport BottomSheet from '../bottomSheet';\nimport { useBottomSheetModalInternal } from '../../hooks';\nimport { print } from '../../utilities';\nimport {\n DEFAULT_STACK_BEHAVIOR,\n DEFAULT_ENABLE_DISMISS_ON_CLOSE,\n} from './constants';\nimport type { BottomSheetModalMethods, BottomSheetMethods } from '../../types';\nimport type { BottomSheetModalProps } from './types';\nimport { id } from '../../utilities/id';\n\ntype BottomSheetModal = BottomSheetModalMethods;\n\nconst INITIAL_STATE: {\n mount: boolean;\n data: any;\n} = {\n mount: false,\n data: undefined,\n};\n\nconst BottomSheetModalComponent = forwardRef<\n BottomSheetModal,\n BottomSheetModalProps\n>(function BottomSheetModal(props, ref) {\n const {\n // modal props\n name,\n stackBehavior = DEFAULT_STACK_BEHAVIOR,\n enableDismissOnClose = DEFAULT_ENABLE_DISMISS_ON_CLOSE,\n onDismiss: _providedOnDismiss,\n\n // bottom sheet props\n index = 0,\n snapPoints,\n enablePanDownToClose = true,\n animateOnMount = true,\n containerComponent: ContainerComponent = React.Fragment,\n\n // callbacks\n onChange: _providedOnChange,\n\n // components\n children: Content,\n ...bottomSheetProps\n } = props;\n\n //#region state\n const [{ mount, data }, setState] = useState(INITIAL_STATE);\n //#endregion\n\n //#region hooks\n const {\n containerHeight,\n containerOffset,\n mountSheet,\n unmountSheet,\n willUnmountSheet,\n } = useBottomSheetModalInternal();\n const { removePortal: unmountPortal } = usePortal();\n //#endregion\n\n //#region refs\n const bottomSheetRef = useRef(null);\n const currentIndexRef = useRef(!animateOnMount ? index : -1);\n const restoreIndexRef = useRef(-1);\n const minimized = useRef(false);\n const forcedDismissed = useRef(false);\n const mounted = useRef(false);\n mounted.current = mount;\n //#endregion\n\n //#region variables\n const key = useMemo(() => name || `bottom-sheet-modal-${id()}`, [name]);\n //#endregion\n\n //#region private methods\n const resetVariables = useCallback(function resetVariables() {\n print({\n component: BottomSheetModal.name,\n method: resetVariables.name,\n });\n currentIndexRef.current = -1;\n restoreIndexRef.current = -1;\n minimized.current = false;\n mounted.current = false;\n forcedDismissed.current = false;\n }, []);\n const unmount = useCallback(\n function unmount() {\n print({\n component: BottomSheetModal.name,\n method: unmount.name,\n });\n const _mounted = mounted.current;\n\n // reset variables\n resetVariables();\n\n // unmount sheet and portal\n unmountSheet(key);\n unmountPortal(key);\n\n // unmount the node, if sheet is still mounted\n if (_mounted) {\n setState(INITIAL_STATE);\n }\n\n // fire `onDismiss` callback\n if (_providedOnDismiss) {\n _providedOnDismiss();\n }\n },\n [key, resetVariables, unmountSheet, unmountPortal, _providedOnDismiss]\n );\n //#endregion\n\n //#region bottom sheet methods\n const handleSnapToIndex = useCallback(\n (...args) => {\n if (minimized.current) {\n return;\n }\n bottomSheetRef.current?.snapToIndex(...args);\n },\n []\n );\n const handleSnapToPosition = useCallback<\n BottomSheetMethods['snapToPosition']\n >((...args) => {\n if (minimized.current) {\n return;\n }\n bottomSheetRef.current?.snapToPosition(...args);\n }, []);\n const handleExpand = useCallback((...args) => {\n if (minimized.current) {\n return;\n }\n bottomSheetRef.current?.expand(...args);\n }, []);\n const handleCollapse = useCallback(\n (...args) => {\n if (minimized.current) {\n return;\n }\n bottomSheetRef.current?.collapse(...args);\n },\n []\n );\n const handleClose = useCallback((...args) => {\n if (minimized.current) {\n return;\n }\n bottomSheetRef.current?.close(...args);\n }, []);\n const handleForceClose = useCallback(\n (...args) => {\n if (minimized.current) {\n return;\n }\n bottomSheetRef.current?.forceClose(...args);\n },\n []\n );\n //#endregion\n\n //#region bottom sheet modal methods\n const handlePresent = useCallback(\n function handlePresent(_data?: any) {\n requestAnimationFrame(() => {\n setState({\n mount: true,\n data: _data,\n });\n mountSheet(key, ref, stackBehavior);\n\n print({\n component: BottomSheetModal.name,\n method: handlePresent.name,\n });\n });\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [key, stackBehavior, mountSheet]\n );\n const handleDismiss = useCallback(\n function handleDismiss(animationConfigs) {\n print({\n component: BottomSheetModal.name,\n method: handleDismiss.name,\n params: {\n currentIndexRef: currentIndexRef.current,\n minimized: minimized.current,\n },\n });\n /**\n * if modal is already been dismiss, we exit the method.\n */\n if (currentIndexRef.current === -1 && minimized.current === false) {\n return;\n }\n\n if (\n minimized.current ||\n (currentIndexRef.current === -1 && enablePanDownToClose)\n ) {\n unmount();\n return;\n }\n willUnmountSheet(key);\n forcedDismissed.current = true;\n bottomSheetRef.current?.forceClose(animationConfigs);\n },\n [willUnmountSheet, unmount, key, enablePanDownToClose]\n );\n const handleMinimize = useCallback(\n function handleMinimize() {\n print({\n component: BottomSheetModal.name,\n method: handleMinimize.name,\n params: {\n minimized: minimized.current,\n },\n });\n if (minimized.current) {\n return;\n }\n minimized.current = true;\n\n /**\n * if modal got minimized before it finish its mounting\n * animation, we set the `restoreIndexRef` to the\n * provided index.\n */\n if (currentIndexRef.current === -1) {\n restoreIndexRef.current = index;\n } else {\n restoreIndexRef.current = currentIndexRef.current;\n }\n bottomSheetRef.current?.close();\n },\n [index]\n );\n const handleRestore = useCallback(function handleRestore() {\n print({\n component: BottomSheetModal.name,\n method: handleRestore.name,\n params: {\n minimized: minimized.current,\n forcedDismissed: forcedDismissed.current,\n },\n });\n if (!minimized.current || forcedDismissed.current) {\n return;\n }\n minimized.current = false;\n bottomSheetRef.current?.snapToIndex(restoreIndexRef.current);\n }, []);\n //#endregion\n\n //#region callbacks\n const handlePortalOnUnmount = useCallback(\n function handlePortalOnUnmount() {\n print({\n component: BottomSheetModal.name,\n method: handlePortalOnUnmount.name,\n params: {\n minimized: minimized.current,\n forcedDismissed: forcedDismissed.current,\n },\n });\n /**\n * if modal is already been dismiss, we exit the method.\n */\n if (currentIndexRef.current === -1 && minimized.current === false) {\n return;\n }\n\n mounted.current = false;\n forcedDismissed.current = true;\n\n if (minimized.current) {\n unmount();\n return;\n }\n willUnmountSheet(key);\n bottomSheetRef.current?.close();\n },\n [key, unmount, willUnmountSheet]\n );\n const handlePortalRender = useCallback(function handlePortalRender(\n render: () => void\n ) {\n if (mounted.current) {\n render();\n }\n },\n []);\n const handleBottomSheetOnChange = useCallback(\n function handleBottomSheetOnChange(_index: number) {\n print({\n component: BottomSheetModal.name,\n method: handleBottomSheetOnChange.name,\n params: {\n minimized: minimized.current,\n forcedDismissed: forcedDismissed.current,\n },\n });\n currentIndexRef.current = _index;\n\n if (_providedOnChange) {\n _providedOnChange(_index);\n }\n },\n [_providedOnChange]\n );\n const handleBottomSheetOnClose = useCallback(\n function handleBottomSheetOnClose() {\n print({\n component: BottomSheetModal.name,\n method: handleBottomSheetOnClose.name,\n params: {\n minimized: minimized.current,\n forcedDismissed: forcedDismissed.current,\n },\n });\n\n if (minimized.current) {\n return;\n }\n\n if (enableDismissOnClose) {\n unmount();\n }\n },\n [enableDismissOnClose, unmount]\n );\n //#endregion\n\n //#region expose methods\n useImperativeHandle(ref, () => ({\n // sheet\n snapToIndex: handleSnapToIndex,\n snapToPosition: handleSnapToPosition,\n expand: handleExpand,\n collapse: handleCollapse,\n close: handleClose,\n forceClose: handleForceClose,\n // modal methods\n dismiss: handleDismiss,\n present: handlePresent,\n // internal\n minimize: handleMinimize,\n restore: handleRestore,\n }));\n //#endregion\n\n // render\n // console.log('BottomSheetModal', index, mount, data);\n return mount ? (\n \n \n : Content\n }\n $modal={true}\n />\n \n \n ) : null;\n});\n\nconst BottomSheetModal = memo(BottomSheetModalComponent);\nBottomSheetModal.displayName = 'BottomSheetModal';\n\nexport default BottomSheetModal;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetModal/constants.js b/lib/commonjs/components/bottomSheetModal/constants.js deleted file mode 100644 index a9cce70e0..000000000 --- a/lib/commonjs/components/bottomSheetModal/constants.js +++ /dev/null @@ -1,11 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.DEFAULT_ENABLE_DISMISS_ON_CLOSE = exports.DEFAULT_STACK_BEHAVIOR = void 0; -const DEFAULT_STACK_BEHAVIOR = 'replace'; -exports.DEFAULT_STACK_BEHAVIOR = DEFAULT_STACK_BEHAVIOR; -const DEFAULT_ENABLE_DISMISS_ON_CLOSE = true; -exports.DEFAULT_ENABLE_DISMISS_ON_CLOSE = DEFAULT_ENABLE_DISMISS_ON_CLOSE; -//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetModal/constants.js.map b/lib/commonjs/components/bottomSheetModal/constants.js.map deleted file mode 100644 index ad599905a..000000000 --- a/lib/commonjs/components/bottomSheetModal/constants.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["constants.ts"],"names":["DEFAULT_STACK_BEHAVIOR","DEFAULT_ENABLE_DISMISS_ON_CLOSE"],"mappings":";;;;;;AAAA,MAAMA,sBAAsB,GAAG,SAA/B;;AACA,MAAMC,+BAA+B,GAAG,IAAxC","sourcesContent":["const DEFAULT_STACK_BEHAVIOR = 'replace';\nconst DEFAULT_ENABLE_DISMISS_ON_CLOSE = true;\n\nexport { DEFAULT_STACK_BEHAVIOR, DEFAULT_ENABLE_DISMISS_ON_CLOSE };\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetModal/index.js b/lib/commonjs/components/bottomSheetModal/index.js deleted file mode 100644 index f3b30a2a7..000000000 --- a/lib/commonjs/components/bottomSheetModal/index.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "default", { - enumerable: true, - get: function () { - return _BottomSheetModal.default; - } -}); - -var _BottomSheetModal = _interopRequireDefault(require("./BottomSheetModal")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetModal/index.js.map b/lib/commonjs/components/bottomSheetModal/index.js.map deleted file mode 100644 index a87df46b2..000000000 --- a/lib/commonjs/components/bottomSheetModal/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { default } from './BottomSheetModal';\nexport type {\n BottomSheetModalProps,\n BottomSheetModalPrivateMethods,\n BottomSheetModalStackBehavior,\n} from './types';\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetModalProvider/BottomSheetModalProvider.js b/lib/commonjs/components/bottomSheetModalProvider/BottomSheetModalProvider.js deleted file mode 100644 index 3aad04a50..000000000 --- a/lib/commonjs/components/bottomSheetModalProvider/BottomSheetModalProvider.js +++ /dev/null @@ -1,198 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _react = _interopRequireWildcard(require("react")); - -var _reactNativeReanimated = require("react-native-reanimated"); - -var _portal = require("@gorhom/portal"); - -var _contexts = require("../../contexts"); - -var _bottomSheetContainer = _interopRequireDefault(require("../bottomSheetContainer")); - -var _constants = require("../../constants"); - -var _constants2 = require("../bottomSheet/constants"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - -const BottomSheetModalProviderWrapper = ({ - children -}) => { - //#region layout variables - const animatedContainerHeight = (0, _reactNativeReanimated.useSharedValue)(_constants2.INITIAL_CONTAINER_HEIGHT); - const animatedContainerOffset = (0, _reactNativeReanimated.useSharedValue)(_constants2.INITIAL_CONTAINER_OFFSET); //#endregion - //#region variables - - const sheetsQueueRef = (0, _react.useRef)([]); //#endregion - //#region private methods - - const handleMountSheet = (0, _react.useCallback)((key, ref, stackBehavior) => { - const _sheetsQueue = sheetsQueueRef.current.slice(); - - const sheetIndex = _sheetsQueue.findIndex(item => item.key === key); - - const sheetOnTop = sheetIndex === _sheetsQueue.length - 1; - /** - * Exit the method, if sheet is already presented - * and at the top. - */ - - if (sheetIndex !== -1 && sheetOnTop) { - return; - } - /** - * Minimize the current sheet if: - * - it exists. - * - it is not unmounting. - * - stack behavior is 'replace'. - */ - - - const currentMountedSheet = _sheetsQueue[_sheetsQueue.length - 1]; - - if (currentMountedSheet && !currentMountedSheet.willUnmount && stackBehavior === _constants.MODAL_STACK_BEHAVIOR.replace) { - var _currentMountedSheet$, _currentMountedSheet$2; - - (_currentMountedSheet$ = currentMountedSheet.ref) === null || _currentMountedSheet$ === void 0 ? void 0 : (_currentMountedSheet$2 = _currentMountedSheet$.current) === null || _currentMountedSheet$2 === void 0 ? void 0 : _currentMountedSheet$2.minimize(); - } - /** - * Restore and remove incoming sheet from the queue, - * if it was registered. - */ - - - if (sheetIndex !== -1) { - var _ref$current; - - _sheetsQueue.splice(sheetIndex, 1); - - ref === null || ref === void 0 ? void 0 : (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.restore(); - } - - _sheetsQueue.push({ - key, - ref, - willUnmount: false - }); - - sheetsQueueRef.current = _sheetsQueue; - }, []); - const handleUnmountSheet = (0, _react.useCallback)(key => { - const _sheetsQueue = sheetsQueueRef.current.slice(); - - const sheetIndex = _sheetsQueue.findIndex(item => item.key === key); - - const sheetOnTop = sheetIndex === _sheetsQueue.length - 1; - /** - * Here we remove the unmounted sheet and update - * the sheets queue. - */ - - _sheetsQueue.splice(sheetIndex, 1); - - sheetsQueueRef.current = _sheetsQueue; - /** - * Here we try to restore previous sheet position if unmounted - * sheet was on top. This is needed when user dismiss - * the modal by panning down. - */ - - const hasMinimizedSheet = sheetsQueueRef.current.length > 0; - const minimizedSheet = sheetsQueueRef.current[sheetsQueueRef.current.length - 1]; - - if (sheetOnTop && hasMinimizedSheet && minimizedSheet && !minimizedSheet.willUnmount) { - var _sheetsQueueRef$curre, _sheetsQueueRef$curre2; - - (_sheetsQueueRef$curre = sheetsQueueRef.current[sheetsQueueRef.current.length - 1].ref) === null || _sheetsQueueRef$curre === void 0 ? void 0 : (_sheetsQueueRef$curre2 = _sheetsQueueRef$curre.current) === null || _sheetsQueueRef$curre2 === void 0 ? void 0 : _sheetsQueueRef$curre2.restore(); - } - }, []); - const handleWillUnmountSheet = (0, _react.useCallback)(key => { - const _sheetsQueue = sheetsQueueRef.current.slice(); - - const sheetIndex = _sheetsQueue.findIndex(item => item.key === key); - - const sheetOnTop = sheetIndex === _sheetsQueue.length - 1; - /** - * Here we mark the sheet that will unmount, - * so it won't be restored. - */ - - if (sheetIndex !== -1) { - _sheetsQueue[sheetIndex].willUnmount = true; - } - /** - * Here we try to restore previous sheet position, - * This is needed when user dismiss the modal by fire the dismiss action. - */ - - - const hasMinimizedSheet = _sheetsQueue.length > 1; - - if (sheetOnTop && hasMinimizedSheet) { - var _sheetsQueue$ref, _sheetsQueue$ref$curr; - - (_sheetsQueue$ref = _sheetsQueue[_sheetsQueue.length - 2].ref) === null || _sheetsQueue$ref === void 0 ? void 0 : (_sheetsQueue$ref$curr = _sheetsQueue$ref.current) === null || _sheetsQueue$ref$curr === void 0 ? void 0 : _sheetsQueue$ref$curr.restore(); - } - - sheetsQueueRef.current = _sheetsQueue; - }, []); //#endregion - //#region public methods - - const handleDismiss = (0, _react.useCallback)(key => { - const sheetToBeDismissed = key ? sheetsQueueRef.current.find(item => item.key === key) : sheetsQueueRef.current[sheetsQueueRef.current.length - 1]; - - if (sheetToBeDismissed) { - var _sheetToBeDismissed$r, _sheetToBeDismissed$r2; - - (_sheetToBeDismissed$r = sheetToBeDismissed.ref) === null || _sheetToBeDismissed$r === void 0 ? void 0 : (_sheetToBeDismissed$r2 = _sheetToBeDismissed$r.current) === null || _sheetToBeDismissed$r2 === void 0 ? void 0 : _sheetToBeDismissed$r2.dismiss(); - return true; - } - - return false; - }, []); - const handleDismissAll = (0, _react.useCallback)(() => { - sheetsQueueRef.current.map(item => { - var _item$ref, _item$ref$current; - - (_item$ref = item.ref) === null || _item$ref === void 0 ? void 0 : (_item$ref$current = _item$ref.current) === null || _item$ref$current === void 0 ? void 0 : _item$ref$current.dismiss(); - }); - }, []); //#endregion - //#region context variables - - const externalContextVariables = (0, _react.useMemo)(() => ({ - dismiss: handleDismiss, - dismissAll: handleDismissAll - }), [handleDismiss, handleDismissAll]); - const internalContextVariables = (0, _react.useMemo)(() => ({ - containerHeight: animatedContainerHeight, - containerOffset: animatedContainerOffset, - mountSheet: handleMountSheet, - unmountSheet: handleUnmountSheet, - willUnmountSheet: handleWillUnmountSheet - }), [animatedContainerHeight, animatedContainerOffset, handleMountSheet, handleUnmountSheet, handleWillUnmountSheet]); //#endregion - //#region renders - - return /*#__PURE__*/_react.default.createElement(_contexts.BottomSheetModalProvider, { - value: externalContextVariables - }, /*#__PURE__*/_react.default.createElement(_contexts.BottomSheetModalInternalProvider, { - value: internalContextVariables - }, /*#__PURE__*/_react.default.createElement(_bottomSheetContainer.default, { - containerOffset: animatedContainerOffset, - containerHeight: animatedContainerHeight, - children: null - }), /*#__PURE__*/_react.default.createElement(_portal.PortalProvider, null, children))); //#endregion -}; - -var _default = BottomSheetModalProviderWrapper; -exports.default = _default; -//# sourceMappingURL=BottomSheetModalProvider.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetModalProvider/BottomSheetModalProvider.js.map b/lib/commonjs/components/bottomSheetModalProvider/BottomSheetModalProvider.js.map deleted file mode 100644 index 0b3443dc7..000000000 --- a/lib/commonjs/components/bottomSheetModalProvider/BottomSheetModalProvider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheetModalProvider.tsx"],"names":["BottomSheetModalProviderWrapper","children","animatedContainerHeight","INITIAL_CONTAINER_HEIGHT","animatedContainerOffset","INITIAL_CONTAINER_OFFSET","sheetsQueueRef","handleMountSheet","key","ref","stackBehavior","_sheetsQueue","current","slice","sheetIndex","findIndex","item","sheetOnTop","length","currentMountedSheet","willUnmount","MODAL_STACK_BEHAVIOR","replace","minimize","splice","restore","push","handleUnmountSheet","hasMinimizedSheet","minimizedSheet","handleWillUnmountSheet","handleDismiss","sheetToBeDismissed","find","dismiss","handleDismissAll","map","externalContextVariables","dismissAll","internalContextVariables","containerHeight","containerOffset","mountSheet","unmountSheet","willUnmountSheet"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AAIA;;AACA;;AACA;;;;;;;;AAUA,MAAMA,+BAA+B,GAAG,CAAC;AACvCC,EAAAA;AADuC,CAAD,KAEH;AACnC;AACA,QAAMC,uBAAuB,GAAG,2CAAeC,oCAAf,CAAhC;AACA,QAAMC,uBAAuB,GAAG,2CAAeC,oCAAf,CAAhC,CAHmC,CAInC;AAEA;;AACA,QAAMC,cAAc,GAAG,mBAA8B,EAA9B,CAAvB,CAPmC,CAQnC;AAEA;;AACA,QAAMC,gBAAgB,GAAG,wBACvB,CAACC,GAAD,EAAcC,GAAd,EAAwBC,aAAxB,KAAyE;AACvE,UAAMC,YAAY,GAAGL,cAAc,CAACM,OAAf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Ae,EAAErC,uBAFZ;AAGLsC,IAAAA,UAAU,EAAEnC,gBAHP;AAILoC,IAAAA,YAAY,EAAEhB,kBAJT;AAKLiB,IAAAA,gBAAgB,EAAEd;AALb,GAAP,CAD+B,EAQ/B,CACE5B,uBADF,EAEEE,uBAFF,EAGEG,gBAHF,EAIEoB,kBAJF,EAKEG,sBALF,CAR+B,CAAjC,CA7ImC,CA6JnC;AAEA;;AACA,sBACE,6BAAC,kCAAD;AAA0B,IAAA,KAAK,EAAEO;AAAjC,kBACE,6BAAC,0CAAD;AAAkC,IAAA,KAAK,EAAEE;AAAzC,kBACE,6BAAC,6BAAD;AACE,IAAA,eAAe,EAAEnC,uBADnB;AAEE,IAAA,eAAe,EAAEF,uBAFnB;AAGE,IAAA,QAAQ,EAAE;AAHZ,IADF,eAME,6BAAC,sBAAD,QAAiBD,QAAjB,CANF,CADF,CADF,CAhKmC,CA4KnC;AACD,CA/KD;;eAiLeD,+B","sourcesContent":["import React, { useCallback, useMemo, useRef } from 'react';\nimport { useSharedValue } from 'react-native-reanimated';\nimport { PortalProvider } from '@gorhom/portal';\nimport {\n BottomSheetModalProvider,\n BottomSheetModalInternalProvider,\n} from '../../contexts';\nimport BottomSheetContainer from '../bottomSheetContainer';\nimport { MODAL_STACK_BEHAVIOR } from '../../constants';\nimport {\n INITIAL_CONTAINER_HEIGHT,\n INITIAL_CONTAINER_OFFSET,\n} from '../bottomSheet/constants';\nimport type { BottomSheetModalStackBehavior } from '../bottomSheetModal';\nimport type {\n BottomSheetModalProviderProps,\n BottomSheetModalRef,\n} from './types';\n\nconst BottomSheetModalProviderWrapper = ({\n children,\n}: BottomSheetModalProviderProps) => {\n //#region layout variables\n const animatedContainerHeight = useSharedValue(INITIAL_CONTAINER_HEIGHT);\n const animatedContainerOffset = useSharedValue(INITIAL_CONTAINER_OFFSET);\n //#endregion\n\n //#region variables\n const sheetsQueueRef = useRef([]);\n //#endregion\n\n //#region private methods\n const handleMountSheet = useCallback(\n (key: string, ref: any, stackBehavior: BottomSheetModalStackBehavior) => {\n const _sheetsQueue = sheetsQueueRef.current.slice();\n const sheetIndex = _sheetsQueue.findIndex(item => item.key === key);\n const sheetOnTop = sheetIndex === _sheetsQueue.length - 1;\n\n /**\n * Exit the method, if sheet is already presented\n * and at the top.\n */\n if (sheetIndex !== -1 && sheetOnTop) {\n return;\n }\n\n /**\n * Minimize the current sheet if:\n * - it exists.\n * - it is not unmounting.\n * - stack behavior is 'replace'.\n */\n const currentMountedSheet = _sheetsQueue[_sheetsQueue.length - 1];\n if (\n currentMountedSheet &&\n !currentMountedSheet.willUnmount &&\n stackBehavior === MODAL_STACK_BEHAVIOR.replace\n ) {\n currentMountedSheet.ref?.current?.minimize();\n }\n\n /**\n * Restore and remove incoming sheet from the queue,\n * if it was registered.\n */\n if (sheetIndex !== -1) {\n _sheetsQueue.splice(sheetIndex, 1);\n ref?.current?.restore();\n }\n\n _sheetsQueue.push({\n key,\n ref,\n willUnmount: false,\n });\n sheetsQueueRef.current = _sheetsQueue;\n },\n []\n );\n const handleUnmountSheet = useCallback((key: string) => {\n const _sheetsQueue = sheetsQueueRef.current.slice();\n const sheetIndex = _sheetsQueue.findIndex(item => item.key === key);\n const sheetOnTop = sheetIndex === _sheetsQueue.length - 1;\n\n /**\n * Here we remove the unmounted sheet and update\n * the sheets queue.\n */\n _sheetsQueue.splice(sheetIndex, 1);\n sheetsQueueRef.current = _sheetsQueue;\n\n /**\n * Here we try to restore previous sheet position if unmounted\n * sheet was on top. This is needed when user dismiss\n * the modal by panning down.\n */\n const hasMinimizedSheet = sheetsQueueRef.current.length > 0;\n const minimizedSheet =\n sheetsQueueRef.current[sheetsQueueRef.current.length - 1];\n if (\n sheetOnTop &&\n hasMinimizedSheet &&\n minimizedSheet &&\n !minimizedSheet.willUnmount\n ) {\n sheetsQueueRef.current[\n sheetsQueueRef.current.length - 1\n ].ref?.current?.restore();\n }\n }, []);\n const handleWillUnmountSheet = useCallback((key: string) => {\n const _sheetsQueue = sheetsQueueRef.current.slice();\n const sheetIndex = _sheetsQueue.findIndex(item => item.key === key);\n const sheetOnTop = sheetIndex === _sheetsQueue.length - 1;\n\n /**\n * Here we mark the sheet that will unmount,\n * so it won't be restored.\n */\n if (sheetIndex !== -1) {\n _sheetsQueue[sheetIndex].willUnmount = true;\n }\n\n /**\n * Here we try to restore previous sheet position,\n * This is needed when user dismiss the modal by fire the dismiss action.\n */\n const hasMinimizedSheet = _sheetsQueue.length > 1;\n if (sheetOnTop && hasMinimizedSheet) {\n _sheetsQueue[_sheetsQueue.length - 2].ref?.current?.restore();\n }\n\n sheetsQueueRef.current = _sheetsQueue;\n }, []);\n //#endregion\n\n //#region public methods\n const handleDismiss = useCallback((key?: string) => {\n const sheetToBeDismissed = key\n ? sheetsQueueRef.current.find(item => item.key === key)\n : sheetsQueueRef.current[sheetsQueueRef.current.length - 1];\n if (sheetToBeDismissed) {\n sheetToBeDismissed.ref?.current?.dismiss();\n return true;\n }\n return false;\n }, []);\n const handleDismissAll = useCallback(() => {\n sheetsQueueRef.current.map(item => {\n item.ref?.current?.dismiss();\n });\n }, []);\n //#endregion\n\n //#region context variables\n const externalContextVariables = useMemo(\n () => ({\n dismiss: handleDismiss,\n dismissAll: handleDismissAll,\n }),\n [handleDismiss, handleDismissAll]\n );\n const internalContextVariables = useMemo(\n () => ({\n containerHeight: animatedContainerHeight,\n containerOffset: animatedContainerOffset,\n mountSheet: handleMountSheet,\n unmountSheet: handleUnmountSheet,\n willUnmountSheet: handleWillUnmountSheet,\n }),\n [\n animatedContainerHeight,\n animatedContainerOffset,\n handleMountSheet,\n handleUnmountSheet,\n handleWillUnmountSheet,\n ]\n );\n //#endregion\n\n //#region renders\n return (\n \n \n \n {children}\n \n \n );\n //#endregion\n};\n\nexport default BottomSheetModalProviderWrapper;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetModalProvider/index.js b/lib/commonjs/components/bottomSheetModalProvider/index.js deleted file mode 100644 index 5ab630a1e..000000000 --- a/lib/commonjs/components/bottomSheetModalProvider/index.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "default", { - enumerable: true, - get: function () { - return _BottomSheetModalProvider.default; - } -}); - -var _BottomSheetModalProvider = _interopRequireDefault(require("./BottomSheetModalProvider")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetModalProvider/index.js.map b/lib/commonjs/components/bottomSheetModalProvider/index.js.map deleted file mode 100644 index fb1c86cea..000000000 --- a/lib/commonjs/components/bottomSheetModalProvider/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { default } from './BottomSheetModalProvider';\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.js b/lib/commonjs/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.js deleted file mode 100644 index 519900810..000000000 --- a/lib/commonjs/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.js +++ /dev/null @@ -1,53 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _react = _interopRequireWildcard(require("react")); - -var _reactNative = require("react-native"); - -var _reactNativeGestureHandler = require("react-native-gesture-handler"); - -var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated")); - -var _constants = require("../../constants"); - -var _hooks = require("../../hooks"); - -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - -function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } - -const AnimatedRefreshControl = _reactNativeReanimated.default.createAnimatedComponent(_reactNative.RefreshControl); - -const BottomSheetRefreshControlComponent = /*#__PURE__*/(0, _react.forwardRef)(({ - onRefresh, - ...rest -}, ref) => { - // hooks - const { - animatedScrollableState - } = (0, _hooks.useBottomSheetInternal)(); // variables - - const animatedProps = (0, _reactNativeReanimated.useAnimatedProps)(() => ({ - enabled: animatedScrollableState.value === _constants.SCROLLABLE_STATE.UNLOCKED - })); // render - - return /*#__PURE__*/_react.default.createElement(_reactNativeGestureHandler.NativeViewGestureHandler, { - ref: ref, - shouldCancelWhenOutside: false - }, /*#__PURE__*/_react.default.createElement(AnimatedRefreshControl, _extends({}, rest, { - onRefresh: onRefresh, - animatedProps: animatedProps - }))); -}); -const BottomSheetRefreshControl = /*#__PURE__*/(0, _react.memo)(BottomSheetRefreshControlComponent); -BottomSheetRefreshControl.displayName = 'BottomSheetRefreshControl'; -var _default = BottomSheetRefreshControl; -exports.default = _default; -//# sourceMappingURL=BottomSheetRefreshControl.android.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.js.map b/lib/commonjs/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.js.map deleted file mode 100644 index f4388a632..000000000 --- a/lib/commonjs/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheetRefreshControl.android.tsx"],"names":["AnimatedRefreshControl","Animated","createAnimatedComponent","RefreshControl","BottomSheetRefreshControlComponent","onRefresh","rest","ref","animatedScrollableState","animatedProps","enabled","value","SCROLLABLE_STATE","UNLOCKED","BottomSheetRefreshControl","displayName"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAEA,MAAMA,sBAAsB,GAAGC,+BAASC,uBAAT,CAAiCC,2BAAjC,CAA/B;;AAEA,MAAMC,kCAAkC,gBAAG,uBAGzC,CAAC;AAAEC,EAAAA,SAAF;AAAa,KAAGC;AAAhB,CAAD,EAAyBC,GAAzB,KAAiC;AACjC;AACA,QAAM;AAAEC,IAAAA;AAAF,MAA8B,oCAApC,CAFiC,CAIjC;;AACA,QAAMC,aAAa,GAAG,6CAAiB,OAAO;AAC5CC,IAAAA,OAAO,EAAEF,uBAAuB,CAACG,KAAxB,KAAkCC,4BAAiBC;AADhB,GAAP,CAAjB,CAAtB,CALiC,CASjC;;AACA,sBACE,6BAAC,mDAAD;AAA0B,IAAA,GAAG,EAAEN,GAA/B;AAAoC,IAAA,uBAAuB,EAAE;AAA7D,kBACE,6BAAC,sBAAD,eACMD,IADN;AAEE,IAAA,SAAS,EAAED,SAFb;AAGE,IAAA,aAAa,EAAEI;AAHjB,KADF,CADF;AASD,CAtB0C,CAA3C;AAwBA,MAAMK,yBAAyB,gBAAG,iBAAKV,kCAAL,CAAlC;AACAU,yBAAyB,CAACC,WAA1B,GAAwC,2BAAxC;eAEeD,yB","sourcesContent":["import React, { forwardRef, memo } from 'react';\nimport { RefreshControl, RefreshControlProps } from 'react-native';\nimport { NativeViewGestureHandler } from 'react-native-gesture-handler';\nimport Animated, { useAnimatedProps } from 'react-native-reanimated';\nimport { SCROLLABLE_STATE } from '../../constants';\nimport { useBottomSheetInternal } from '../../hooks';\n\nconst AnimatedRefreshControl = Animated.createAnimatedComponent(RefreshControl);\n\nconst BottomSheetRefreshControlComponent = forwardRef<\n NativeViewGestureHandler,\n RefreshControlProps\n>(({ onRefresh, ...rest }, ref) => {\n // hooks\n const { animatedScrollableState } = useBottomSheetInternal();\n\n // variables\n const animatedProps = useAnimatedProps(() => ({\n enabled: animatedScrollableState.value === SCROLLABLE_STATE.UNLOCKED,\n }));\n\n // render\n return (\n \n \n \n );\n});\n\nconst BottomSheetRefreshControl = memo(BottomSheetRefreshControlComponent);\nBottomSheetRefreshControl.displayName = 'BottomSheetRefreshControl';\n\nexport default BottomSheetRefreshControl;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetRefreshControl/BottomSheetRefreshControl.js b/lib/commonjs/components/bottomSheetRefreshControl/BottomSheetRefreshControl.js deleted file mode 100644 index d3f3b943c..000000000 --- a/lib/commonjs/components/bottomSheetRefreshControl/BottomSheetRefreshControl.js +++ /dev/null @@ -1,11 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _default = () => null; - -exports.default = _default; -//# sourceMappingURL=BottomSheetRefreshControl.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetRefreshControl/BottomSheetRefreshControl.js.map b/lib/commonjs/components/bottomSheetRefreshControl/BottomSheetRefreshControl.js.map deleted file mode 100644 index 1b6481996..000000000 --- a/lib/commonjs/components/bottomSheetRefreshControl/BottomSheetRefreshControl.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheetRefreshControl.tsx"],"names":[],"mappings":";;;;;;;eAAe,MAAM,I","sourcesContent":["export default () => null;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetRefreshControl/index.js b/lib/commonjs/components/bottomSheetRefreshControl/index.js deleted file mode 100644 index bed7760e9..000000000 --- a/lib/commonjs/components/bottomSheetRefreshControl/index.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _BottomSheetRefreshControl = _interopRequireDefault(require("./BottomSheetRefreshControl")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var _default = _BottomSheetRefreshControl.default; -exports.default = _default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetRefreshControl/index.js.map b/lib/commonjs/components/bottomSheetRefreshControl/index.js.map deleted file mode 100644 index b901195d9..000000000 --- a/lib/commonjs/components/bottomSheetRefreshControl/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":["BottomSheetRefreshControl"],"mappings":";;;;;;;AAGA;;;;eAEeA,kC","sourcesContent":["import type React from 'react';\nimport type { RefreshControlProps } from 'react-native';\nimport type { NativeViewGestureHandlerProps } from 'react-native-gesture-handler';\nimport BottomSheetRefreshControl from './BottomSheetRefreshControl';\n\nexport default BottomSheetRefreshControl as any as React.MemoExoticComponent<\n React.ForwardRefExoticComponent<\n RefreshControlProps & {\n children: React.ReactNode | React.ReactNode[];\n } & React.RefAttributes<\n React.ComponentType<\n NativeViewGestureHandlerProps & React.RefAttributes\n >\n >\n >\n>;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetScrollable/BottomSheetFlatList.js b/lib/commonjs/components/bottomSheetScrollable/BottomSheetFlatList.js deleted file mode 100644 index 1e04a5c59..000000000 --- a/lib/commonjs/components/bottomSheetScrollable/BottomSheetFlatList.js +++ /dev/null @@ -1,27 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _react = require("react"); - -var _reactNative = require("react-native"); - -var _reactNativeReanimated = _interopRequireDefault(require("react-native-reanimated")); - -var _constants = require("../../constants"); - -var _createBottomSheetScrollableComponent = require("./createBottomSheetScrollableComponent"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -const AnimatedFlatList = _reactNativeReanimated.default.createAnimatedComponent(_reactNative.FlatList); - -const BottomSheetFlatListComponent = (0, _createBottomSheetScrollableComponent.createBottomSheetScrollableComponent)(_constants.SCROLLABLE_TYPE.FLATLIST, AnimatedFlatList); -const BottomSheetFlatList = /*#__PURE__*/(0, _react.memo)(BottomSheetFlatListComponent); -BottomSheetFlatList.displayName = 'BottomSheetFlatList'; -var _default = BottomSheetFlatList; -exports.default = _default; -//# sourceMappingURL=BottomSheetFlatList.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetScrollable/BottomSheetFlatList.js.map b/lib/commonjs/components/bottomSheetScrollable/BottomSheetFlatList.js.map deleted file mode 100644 index 7dc60fefe..000000000 --- a/lib/commonjs/components/bottomSheetScrollable/BottomSheetFlatList.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheetFlatList.tsx"],"names":["AnimatedFlatList","Animated","createAnimatedComponent","RNFlatList","BottomSheetFlatListComponent","SCROLLABLE_TYPE","FLATLIST","BottomSheetFlatList","displayName"],"mappings":";;;;;;;AAAA;;AACA;;AAIA;;AACA;;AACA;;;;AAMA,MAAMA,gBAAgB,GACpBC,+BAASC,uBAAT,CAAuDC,qBAAvD,CADF;;AAGA,MAAMC,4BAA4B,GAAG,gFAGnCC,2BAAgBC,QAHmB,EAGTN,gBAHS,CAArC;AAKA,MAAMO,mBAAmB,gBAAG,iBAAKH,4BAAL,CAA5B;AACAG,mBAAmB,CAACC,WAApB,GAAkC,qBAAlC;eAEeD,mB","sourcesContent":["import { memo } from 'react';\nimport {\n FlatList as RNFlatList,\n FlatListProps as RNFlatListProps,\n} from 'react-native';\nimport Animated from 'react-native-reanimated';\nimport { SCROLLABLE_TYPE } from '../../constants';\nimport { createBottomSheetScrollableComponent } from './createBottomSheetScrollableComponent';\nimport type {\n BottomSheetFlatListMethods,\n BottomSheetFlatListProps,\n} from './types';\n\nconst AnimatedFlatList =\n Animated.createAnimatedComponent>(RNFlatList);\n\nconst BottomSheetFlatListComponent = createBottomSheetScrollableComponent<\n BottomSheetFlatListMethods,\n BottomSheetFlatListProps\n>(SCROLLABLE_TYPE.FLATLIST, AnimatedFlatList);\n\nconst BottomSheetFlatList = memo(BottomSheetFlatListComponent);\nBottomSheetFlatList.displayName = 'BottomSheetFlatList';\n\nexport default BottomSheetFlatList as (\n props: BottomSheetFlatListProps\n) => ReturnType;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetScrollable/BottomSheetScrollView.js b/lib/commonjs/components/bottomSheetScrollable/BottomSheetScrollView.js deleted file mode 100644 index bb0b0b443..000000000 --- a/lib/commonjs/components/bottomSheetScrollable/BottomSheetScrollView.js +++ /dev/null @@ -1,27 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _react = require("react"); - -var _reactNative = require("react-native"); - -var _reactNativeReanimated = _interopRequireDefault(require("react-native-reanimated")); - -var _constants = require("../../constants"); - -var _createBottomSheetScrollableComponent = require("./createBottomSheetScrollableComponent"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -const AnimatedScrollView = _reactNativeReanimated.default.createAnimatedComponent(_reactNative.ScrollView); - -const BottomSheetScrollViewComponent = (0, _createBottomSheetScrollableComponent.createBottomSheetScrollableComponent)(_constants.SCROLLABLE_TYPE.SCROLLVIEW, AnimatedScrollView); -const BottomSheetScrollView = /*#__PURE__*/(0, _react.memo)(BottomSheetScrollViewComponent); -BottomSheetScrollView.displayName = 'BottomSheetScrollView'; -var _default = BottomSheetScrollView; -exports.default = _default; -//# sourceMappingURL=BottomSheetScrollView.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetScrollable/BottomSheetScrollView.js.map b/lib/commonjs/components/bottomSheetScrollable/BottomSheetScrollView.js.map deleted file mode 100644 index de3d25111..000000000 --- a/lib/commonjs/components/bottomSheetScrollable/BottomSheetScrollView.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheetScrollView.tsx"],"names":["AnimatedScrollView","Animated","createAnimatedComponent","RNScrollView","BottomSheetScrollViewComponent","SCROLLABLE_TYPE","SCROLLVIEW","BottomSheetScrollView","displayName"],"mappings":";;;;;;;AAAA;;AACA;;AAIA;;AACA;;AACA;;;;AAMA,MAAMA,kBAAkB,GACtBC,+BAASC,uBAAT,CAAoDC,uBAApD,CADF;;AAGA,MAAMC,8BAA8B,GAAG,gFAGrCC,2BAAgBC,UAHqB,EAGTN,kBAHS,CAAvC;AAKA,MAAMO,qBAAqB,gBAAG,iBAAKH,8BAAL,CAA9B;AACAG,qBAAqB,CAACC,WAAtB,GAAoC,uBAApC;eAEeD,qB","sourcesContent":["import { memo } from 'react';\nimport {\n ScrollView as RNScrollView,\n ScrollViewProps as RNScrollViewProps,\n} from 'react-native';\nimport Animated from 'react-native-reanimated';\nimport { SCROLLABLE_TYPE } from '../../constants';\nimport { createBottomSheetScrollableComponent } from './createBottomSheetScrollableComponent';\nimport type {\n BottomSheetScrollViewMethods,\n BottomSheetScrollViewProps,\n} from './types';\n\nconst AnimatedScrollView =\n Animated.createAnimatedComponent(RNScrollView);\n\nconst BottomSheetScrollViewComponent = createBottomSheetScrollableComponent<\n BottomSheetScrollViewMethods,\n BottomSheetScrollViewProps\n>(SCROLLABLE_TYPE.SCROLLVIEW, AnimatedScrollView);\n\nconst BottomSheetScrollView = memo(BottomSheetScrollViewComponent);\nBottomSheetScrollView.displayName = 'BottomSheetScrollView';\n\nexport default BottomSheetScrollView as (\n props: BottomSheetScrollViewProps\n) => ReturnType;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetScrollable/BottomSheetSectionList.js b/lib/commonjs/components/bottomSheetScrollable/BottomSheetSectionList.js deleted file mode 100644 index 723dcfd5d..000000000 --- a/lib/commonjs/components/bottomSheetScrollable/BottomSheetSectionList.js +++ /dev/null @@ -1,27 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _react = require("react"); - -var _reactNative = require("react-native"); - -var _reactNativeReanimated = _interopRequireDefault(require("react-native-reanimated")); - -var _constants = require("../../constants"); - -var _createBottomSheetScrollableComponent = require("./createBottomSheetScrollableComponent"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -const AnimatedSectionList = _reactNativeReanimated.default.createAnimatedComponent(_reactNative.SectionList); - -const BottomSheetSectionListComponent = (0, _createBottomSheetScrollableComponent.createBottomSheetScrollableComponent)(_constants.SCROLLABLE_TYPE.SECTIONLIST, AnimatedSectionList); -const BottomSheetSectionList = /*#__PURE__*/(0, _react.memo)(BottomSheetSectionListComponent); -BottomSheetSectionList.displayName = 'BottomSheetSectionList'; -var _default = BottomSheetSectionList; -exports.default = _default; -//# sourceMappingURL=BottomSheetSectionList.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetScrollable/BottomSheetSectionList.js.map b/lib/commonjs/components/bottomSheetScrollable/BottomSheetSectionList.js.map deleted file mode 100644 index 03d933e80..000000000 --- a/lib/commonjs/components/bottomSheetScrollable/BottomSheetSectionList.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheetSectionList.tsx"],"names":["AnimatedSectionList","Animated","createAnimatedComponent","RNSectionList","BottomSheetSectionListComponent","SCROLLABLE_TYPE","SECTIONLIST","BottomSheetSectionList","displayName"],"mappings":";;;;;;;AAAA;;AACA;;AAKA;;AACA;;AACA;;;;AAMA,MAAMA,mBAAmB,GACvBC,+BAASC,uBAAT,CAA0DC,wBAA1D,CADF;;AAGA,MAAMC,+BAA+B,GAAG,gFAGtCC,2BAAgBC,WAHsB,EAGTN,mBAHS,CAAxC;AAKA,MAAMO,sBAAsB,gBAAG,iBAAKH,+BAAL,CAA/B;AACAG,sBAAsB,CAACC,WAAvB,GAAqC,wBAArC;eAEeD,sB","sourcesContent":["import { memo } from 'react';\nimport {\n DefaultSectionT,\n SectionList as RNSectionList,\n SectionListProps as RNSectionListProps,\n} from 'react-native';\nimport Animated from 'react-native-reanimated';\nimport { SCROLLABLE_TYPE } from '../../constants';\nimport { createBottomSheetScrollableComponent } from './createBottomSheetScrollableComponent';\nimport type {\n BottomSheetSectionListMethods,\n BottomSheetSectionListProps,\n} from './types';\n\nconst AnimatedSectionList =\n Animated.createAnimatedComponent>(RNSectionList);\n\nconst BottomSheetSectionListComponent = createBottomSheetScrollableComponent<\n BottomSheetSectionListMethods,\n BottomSheetSectionListProps\n>(SCROLLABLE_TYPE.SECTIONLIST, AnimatedSectionList);\n\nconst BottomSheetSectionList = memo(BottomSheetSectionListComponent);\nBottomSheetSectionList.displayName = 'BottomSheetSectionList';\n\nexport default BottomSheetSectionList as (\n props: BottomSheetSectionListProps\n) => ReturnType;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetScrollable/BottomSheetVirtualizedList.js b/lib/commonjs/components/bottomSheetScrollable/BottomSheetVirtualizedList.js deleted file mode 100644 index e37ed725c..000000000 --- a/lib/commonjs/components/bottomSheetScrollable/BottomSheetVirtualizedList.js +++ /dev/null @@ -1,27 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _react = require("react"); - -var _reactNative = require("react-native"); - -var _reactNativeReanimated = _interopRequireDefault(require("react-native-reanimated")); - -var _constants = require("../../constants"); - -var _createBottomSheetScrollableComponent = require("./createBottomSheetScrollableComponent"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -const AnimatedVirtualizedList = _reactNativeReanimated.default.createAnimatedComponent(_reactNative.VirtualizedList); - -const BottomSheetVirtualizedListComponent = (0, _createBottomSheetScrollableComponent.createBottomSheetScrollableComponent)(_constants.SCROLLABLE_TYPE.VIRTUALIZEDLIST, AnimatedVirtualizedList); -const BottomSheetVirtualizedList = /*#__PURE__*/(0, _react.memo)(BottomSheetVirtualizedListComponent); -BottomSheetVirtualizedList.displayName = 'BottomSheetVirtualizedList'; -var _default = BottomSheetVirtualizedList; -exports.default = _default; -//# sourceMappingURL=BottomSheetVirtualizedList.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetScrollable/BottomSheetVirtualizedList.js.map b/lib/commonjs/components/bottomSheetScrollable/BottomSheetVirtualizedList.js.map deleted file mode 100644 index 8fa472cb9..000000000 --- a/lib/commonjs/components/bottomSheetScrollable/BottomSheetVirtualizedList.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheetVirtualizedList.tsx"],"names":["AnimatedVirtualizedList","Animated","createAnimatedComponent","RNVirtualizedList","BottomSheetVirtualizedListComponent","SCROLLABLE_TYPE","VIRTUALIZEDLIST","BottomSheetVirtualizedList","displayName"],"mappings":";;;;;;;AAAA;;AACA;;AAIA;;AACA;;AACA;;;;AAMA,MAAMA,uBAAuB,GAC3BC,+BAASC,uBAAT,CACEC,4BADF,CADF;;AAKA,MAAMC,mCAAmC,GACvC,gFAGEC,2BAAgBC,eAHlB,EAGmCN,uBAHnC,CADF;AAMA,MAAMO,0BAA0B,gBAAG,iBAAKH,mCAAL,CAAnC;AACAG,0BAA0B,CAACC,WAA3B,GAAyC,4BAAzC;eAEeD,0B","sourcesContent":["import { memo } from 'react';\nimport {\n VirtualizedList as RNVirtualizedList,\n VirtualizedListProps as RNVirtualizedListProps,\n} from 'react-native';\nimport Animated from 'react-native-reanimated';\nimport { SCROLLABLE_TYPE } from '../../constants';\nimport { createBottomSheetScrollableComponent } from './createBottomSheetScrollableComponent';\nimport type {\n BottomSheetVirtualizedListMethods,\n BottomSheetVirtualizedListProps,\n} from './types';\n\nconst AnimatedVirtualizedList =\n Animated.createAnimatedComponent>(\n RNVirtualizedList\n );\n\nconst BottomSheetVirtualizedListComponent =\n createBottomSheetScrollableComponent<\n BottomSheetVirtualizedListMethods,\n BottomSheetVirtualizedListProps\n >(SCROLLABLE_TYPE.VIRTUALIZEDLIST, AnimatedVirtualizedList);\n\nconst BottomSheetVirtualizedList = memo(BottomSheetVirtualizedListComponent);\nBottomSheetVirtualizedList.displayName = 'BottomSheetVirtualizedList';\n\nexport default BottomSheetVirtualizedList as (\n props: BottomSheetVirtualizedListProps\n) => ReturnType;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetScrollable/createBottomSheetScrollableComponent.js b/lib/commonjs/components/bottomSheetScrollable/createBottomSheetScrollableComponent.js deleted file mode 100644 index 2927c7b51..000000000 --- a/lib/commonjs/components/bottomSheetScrollable/createBottomSheetScrollableComponent.js +++ /dev/null @@ -1,163 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.createBottomSheetScrollableComponent = createBottomSheetScrollableComponent; - -var _react = _interopRequireWildcard(require("react")); - -var _reactNative = require("react-native"); - -var _reactNativeReanimated = require("react-native-reanimated"); - -var _reactNativeGestureHandler = require("react-native-gesture-handler"); - -var _bottomSheetDraggableView = _interopRequireDefault(require("../bottomSheetDraggableView")); - -var _bottomSheetRefreshControl = _interopRequireDefault(require("../bottomSheetRefreshControl")); - -var _hooks = require("../../hooks"); - -var _constants = require("../../constants"); - -var _styles = require("./styles"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - -function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } - -function createBottomSheetScrollableComponent(type, ScrollableComponent) { - return /*#__PURE__*/(0, _react.forwardRef)((props, ref) => { - // props - const { - // hooks - focusHook, - scrollEventsHandlersHook, - // props - enableFooterMarginAdjustment = false, - overScrollMode = 'never', - keyboardDismissMode = 'interactive', - showsVerticalScrollIndicator = true, - style, - refreshing, - onRefresh, - progressViewOffset, - refreshControl, - // events - onScroll, - onScrollBeginDrag, - onScrollEndDrag, - onContentSizeChange, - ...rest - } = props; //#region refs - - const nativeGestureRef = (0, _react.useRef)(null); - const refreshControlGestureRef = (0, _react.useRef)(null); //#endregion - //#region hooks - - const { - scrollableRef, - scrollableContentOffsetY, - scrollHandler - } = (0, _hooks.useScrollHandler)(scrollEventsHandlersHook, onScroll, onScrollBeginDrag, onScrollEndDrag); - const { - enableContentPanningGesture, - animatedFooterHeight, - animatedScrollableState, - animatedContentHeight, - enableDynamicSizing - } = (0, _hooks.useBottomSheetInternal)(); //#endregion - //#region variables - - const scrollableAnimatedProps = (0, _reactNativeReanimated.useAnimatedProps)(() => ({ - decelerationRate: _constants.SCROLLABLE_DECELERATION_RATE_MAPPER[animatedScrollableState.value], - showsVerticalScrollIndicator: showsVerticalScrollIndicator ? animatedScrollableState.value === _constants.SCROLLABLE_STATE.UNLOCKED : showsVerticalScrollIndicator - }), [showsVerticalScrollIndicator]); //#endregion - //#region callbacks - - const handleContentSizeChange = (0, _hooks.useStableCallback)((contentWidth, contentHeight) => { - if (enableDynamicSizing) { - animatedContentHeight.value = contentHeight; - } - - if (onContentSizeChange) { - onContentSizeChange(contentWidth, contentHeight); - } - }); //#endregion - //#region styles - - const containerAnimatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({ - marginBottom: enableFooterMarginAdjustment ? animatedFooterHeight.value : 0 - }), [enableFooterMarginAdjustment]); - const containerStyle = (0, _react.useMemo)(() => { - return enableFooterMarginAdjustment ? [...(style ? 'length' in style ? style : [style] : []), containerAnimatedStyle] : style; - }, [enableFooterMarginAdjustment, style, containerAnimatedStyle]); //#endregion - //#region effects - // @ts-ignore - - (0, _react.useImperativeHandle)(ref, () => scrollableRef.current); - (0, _hooks.useScrollableSetter)(scrollableRef, type, scrollableContentOffsetY, onRefresh !== undefined, focusHook); //#endregion - //#region render - - if (_reactNative.Platform.OS === 'android') { - const scrollableContent = /*#__PURE__*/_react.default.createElement(_reactNativeGestureHandler.NativeViewGestureHandler, { - ref: nativeGestureRef, - enabled: enableContentPanningGesture, - shouldCancelWhenOutside: false - }, /*#__PURE__*/_react.default.createElement(ScrollableComponent, _extends({ - animatedProps: scrollableAnimatedProps - }, rest, { - scrollEventThrottle: 16, - ref: scrollableRef, - overScrollMode: overScrollMode, - keyboardDismissMode: keyboardDismissMode, - onScroll: scrollHandler, - onContentSizeChange: handleContentSizeChange, - style: containerStyle - }))); - - return /*#__PURE__*/_react.default.createElement(_bottomSheetDraggableView.default, { - nativeGestureRef: nativeGestureRef, - refreshControlGestureRef: refreshControlGestureRef, - gestureType: _constants.GESTURE_SOURCE.SCROLLABLE, - style: _styles.styles.container - }, onRefresh ? /*#__PURE__*/_react.default.createElement(_bottomSheetRefreshControl.default, { - ref: refreshControlGestureRef, - refreshing: refreshing, - onRefresh: onRefresh, - progressViewOffset: progressViewOffset, - style: _styles.styles.container - }, scrollableContent) : scrollableContent); - } - - return /*#__PURE__*/_react.default.createElement(_bottomSheetDraggableView.default, { - nativeGestureRef: nativeGestureRef, - gestureType: _constants.GESTURE_SOURCE.SCROLLABLE, - style: _styles.styles.container - }, /*#__PURE__*/_react.default.createElement(_reactNativeGestureHandler.NativeViewGestureHandler, { - ref: nativeGestureRef, - enabled: enableContentPanningGesture, - shouldCancelWhenOutside: false - }, /*#__PURE__*/_react.default.createElement(ScrollableComponent, _extends({ - animatedProps: scrollableAnimatedProps - }, rest, { - scrollEventThrottle: 16, - ref: scrollableRef, - overScrollMode: overScrollMode, - keyboardDismissMode: keyboardDismissMode, - refreshing: refreshing, - onRefresh: onRefresh, - progressViewOffset: progressViewOffset, - refreshControl: refreshControl, - onScroll: scrollHandler, - onContentSizeChange: handleContentSizeChange, - style: containerStyle - })))); //#endregion - }); -} -//# sourceMappingURL=createBottomSheetScrollableComponent.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetScrollable/createBottomSheetScrollableComponent.js.map b/lib/commonjs/components/bottomSheetScrollable/createBottomSheetScrollableComponent.js.map deleted file mode 100644 index 144635549..000000000 --- a/lib/commonjs/components/bottomSheetScrollable/createBottomSheetScrollableComponent.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["createBottomSheetScrollableComponent.tsx"],"names":["createBottomSheetScrollableComponent","type","ScrollableComponent","props","ref","focusHook","scrollEventsHandlersHook","enableFooterMarginAdjustment","overScrollMode","keyboardDismissMode","showsVerticalScrollIndicator","style","refreshing","onRefresh","progressViewOffset","refreshControl","onScroll","onScrollBeginDrag","onScrollEndDrag","onContentSizeChange","rest","nativeGestureRef","refreshControlGestureRef","scrollableRef","scrollableContentOffsetY","scrollHandler","enableContentPanningGesture","animatedFooterHeight","animatedScrollableState","animatedContentHeight","enableDynamicSizing","scrollableAnimatedProps","decelerationRate","SCROLLABLE_DECELERATION_RATE_MAPPER","value","SCROLLABLE_STATE","UNLOCKED","handleContentSizeChange","contentWidth","contentHeight","containerAnimatedStyle","marginBottom","containerStyle","current","undefined","Platform","OS","scrollableContent","GESTURE_SOURCE","SCROLLABLE","styles","container"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAMA;;AAM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kB,EAAEC,kBATtB;AAUE,MAAA,cAAc,EAAEC,cAVlB;AAWE,MAAA,QAAQ,EAAEU,aAXZ;AAYE,MAAA,mBAAmB,EAAEY,uBAZvB;AAaE,MAAA,KAAK,EAAEK;AAbT,OALF,CALF,CADF,CApJsC,CAiLtC;AACD,GAlLM,CAAP;AAmLD","sourcesContent":["import React, { forwardRef, useImperativeHandle, useMemo, useRef } from 'react';\nimport { Platform } from 'react-native';\nimport { useAnimatedProps, useAnimatedStyle } from 'react-native-reanimated';\nimport { NativeViewGestureHandler } from 'react-native-gesture-handler';\nimport BottomSheetDraggableView from '../bottomSheetDraggableView';\nimport BottomSheetRefreshControl from '../bottomSheetRefreshControl';\nimport {\n useScrollHandler,\n useScrollableSetter,\n useBottomSheetInternal,\n useStableCallback,\n} from '../../hooks';\nimport {\n GESTURE_SOURCE,\n SCROLLABLE_DECELERATION_RATE_MAPPER,\n SCROLLABLE_STATE,\n SCROLLABLE_TYPE,\n} from '../../constants';\nimport { styles } from './styles';\n\nexport function createBottomSheetScrollableComponent(\n type: SCROLLABLE_TYPE,\n ScrollableComponent: any\n) {\n return forwardRef((props, ref) => {\n // props\n const {\n // hooks\n focusHook,\n scrollEventsHandlersHook,\n // props\n enableFooterMarginAdjustment = false,\n overScrollMode = 'never',\n keyboardDismissMode = 'interactive',\n showsVerticalScrollIndicator = true,\n style,\n refreshing,\n onRefresh,\n progressViewOffset,\n refreshControl,\n // events\n onScroll,\n onScrollBeginDrag,\n onScrollEndDrag,\n onContentSizeChange,\n ...rest\n }: any = props;\n\n //#region refs\n const nativeGestureRef = useRef(null);\n const refreshControlGestureRef = useRef(null);\n //#endregion\n\n //#region hooks\n const { scrollableRef, scrollableContentOffsetY, scrollHandler } =\n useScrollHandler(\n scrollEventsHandlersHook,\n onScroll,\n onScrollBeginDrag,\n onScrollEndDrag\n );\n const {\n enableContentPanningGesture,\n animatedFooterHeight,\n animatedScrollableState,\n animatedContentHeight,\n enableDynamicSizing,\n } = useBottomSheetInternal();\n //#endregion\n\n //#region variables\n const scrollableAnimatedProps = useAnimatedProps(\n () => ({\n decelerationRate:\n SCROLLABLE_DECELERATION_RATE_MAPPER[animatedScrollableState.value],\n showsVerticalScrollIndicator: showsVerticalScrollIndicator\n ? animatedScrollableState.value === SCROLLABLE_STATE.UNLOCKED\n : showsVerticalScrollIndicator,\n }),\n [showsVerticalScrollIndicator]\n );\n //#endregion\n\n //#region callbacks\n const handleContentSizeChange = useStableCallback(\n (contentWidth: number, contentHeight: number) => {\n if (enableDynamicSizing) {\n animatedContentHeight.value = contentHeight;\n }\n\n if (onContentSizeChange) {\n onContentSizeChange(contentWidth, contentHeight);\n }\n }\n );\n //#endregion\n\n //#region styles\n const containerAnimatedStyle = useAnimatedStyle(\n () => ({\n marginBottom: enableFooterMarginAdjustment\n ? animatedFooterHeight.value\n : 0,\n }),\n [enableFooterMarginAdjustment]\n );\n const containerStyle = useMemo(() => {\n return enableFooterMarginAdjustment\n ? [\n ...(style ? ('length' in style ? style : [style]) : []),\n containerAnimatedStyle,\n ]\n : style;\n }, [enableFooterMarginAdjustment, style, containerAnimatedStyle]);\n //#endregion\n\n //#region effects\n // @ts-ignore\n useImperativeHandle(ref, () => scrollableRef.current);\n useScrollableSetter(\n scrollableRef,\n type,\n scrollableContentOffsetY,\n onRefresh !== undefined,\n focusHook\n );\n //#endregion\n\n //#region render\n if (Platform.OS === 'android') {\n const scrollableContent = (\n \n \n \n );\n return (\n \n {onRefresh ? (\n \n {scrollableContent}\n \n ) : (\n scrollableContent\n )}\n \n );\n }\n return (\n \n \n \n \n \n );\n //#endregion\n });\n}\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetScrollable/index.js b/lib/commonjs/components/bottomSheetScrollable/index.js deleted file mode 100644 index e913863af..000000000 --- a/lib/commonjs/components/bottomSheetScrollable/index.js +++ /dev/null @@ -1,48 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "createBottomSheetScrollableComponent", { - enumerable: true, - get: function () { - return _createBottomSheetScrollableComponent.createBottomSheetScrollableComponent; - } -}); -Object.defineProperty(exports, "BottomSheetSectionList", { - enumerable: true, - get: function () { - return _BottomSheetSectionList.default; - } -}); -Object.defineProperty(exports, "BottomSheetFlatList", { - enumerable: true, - get: function () { - return _BottomSheetFlatList.default; - } -}); -Object.defineProperty(exports, "BottomSheetScrollView", { - enumerable: true, - get: function () { - return _BottomSheetScrollView.default; - } -}); -Object.defineProperty(exports, "BottomSheetVirtualizedList", { - enumerable: true, - get: function () { - return _BottomSheetVirtualizedList.default; - } -}); - -var _createBottomSheetScrollableComponent = require("./createBottomSheetScrollableComponent"); - -var _BottomSheetSectionList = _interopRequireDefault(require("./BottomSheetSectionList")); - -var _BottomSheetFlatList = _interopRequireDefault(require("./BottomSheetFlatList")); - -var _BottomSheetScrollView = _interopRequireDefault(require("./BottomSheetScrollView")); - -var _BottomSheetVirtualizedList = _interopRequireDefault(require("./BottomSheetVirtualizedList")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetScrollable/index.js.map b/lib/commonjs/components/bottomSheetScrollable/index.js.map deleted file mode 100644 index 9468e9c8e..000000000 --- a/lib/commonjs/components/bottomSheetScrollable/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA","sourcesContent":["export { createBottomSheetScrollableComponent } from './createBottomSheetScrollableComponent';\nexport { default as BottomSheetSectionList } from './BottomSheetSectionList';\nexport { default as BottomSheetFlatList } from './BottomSheetFlatList';\nexport { default as BottomSheetScrollView } from './BottomSheetScrollView';\nexport { default as BottomSheetVirtualizedList } from './BottomSheetVirtualizedList';\n\nexport type {\n BottomSheetFlatListMethods,\n BottomSheetScrollViewMethods,\n BottomSheetSectionListMethods,\n BottomSheetVirtualizedListMethods,\n BottomSheetScrollableProps,\n} from './types';\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetScrollable/styles.js b/lib/commonjs/components/bottomSheetScrollable/styles.js deleted file mode 100644 index 9501d29d9..000000000 --- a/lib/commonjs/components/bottomSheetScrollable/styles.js +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.styles = void 0; - -var _reactNative = require("react-native"); - -const styles = _reactNative.StyleSheet.create({ - container: { - flex: 1, - overflow: 'visible' - } -}); - -exports.styles = styles; -//# sourceMappingURL=styles.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetScrollable/styles.js.map b/lib/commonjs/components/bottomSheetScrollable/styles.js.map deleted file mode 100644 index 09c6c7d55..000000000 --- a/lib/commonjs/components/bottomSheetScrollable/styles.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["styles.ts"],"names":["styles","StyleSheet","create","container","flex","overflow"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,MAAM,GAAGC,wBAAWC,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE;AACTC,IAAAA,IAAI,EAAE,CADG;AAETC,IAAAA,QAAQ,EAAE;AAFD;AAD2B,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\n\nexport const styles = StyleSheet.create({\n container: {\n flex: 1,\n overflow: 'visible',\n },\n});\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetTextInput/BottomSheetTextInput.js b/lib/commonjs/components/bottomSheetTextInput/BottomSheetTextInput.js deleted file mode 100644 index c0c0f6662..000000000 --- a/lib/commonjs/components/bottomSheetTextInput/BottomSheetTextInput.js +++ /dev/null @@ -1,62 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _react = _interopRequireWildcard(require("react")); - -var _reactNativeGestureHandler = require("react-native-gesture-handler"); - -var _hooks = require("../../hooks"); - -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - -function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } - -const BottomSheetTextInputComponent = /*#__PURE__*/(0, _react.forwardRef)(({ - onFocus, - onBlur, - ...rest -}, ref) => { - //#region hooks - const { - shouldHandleKeyboardEvents - } = (0, _hooks.useBottomSheetInternal)(); - (0, _react.useEffect)(() => { - return () => { - // Reset the flag on unmount - shouldHandleKeyboardEvents.value = false; - }; - }, [shouldHandleKeyboardEvents]); //#endregion - //#region callbacks - - const handleOnFocus = (0, _react.useCallback)(args => { - shouldHandleKeyboardEvents.value = true; - - if (onFocus) { - onFocus(args); - } - }, [onFocus, shouldHandleKeyboardEvents]); - const handleOnBlur = (0, _react.useCallback)(args => { - shouldHandleKeyboardEvents.value = false; - - if (onBlur) { - onBlur(args); - } - }, [onBlur, shouldHandleKeyboardEvents]); //#endregion - - return /*#__PURE__*/_react.default.createElement(_reactNativeGestureHandler.TextInput, _extends({ - ref: ref, - onFocus: handleOnFocus, - onBlur: handleOnBlur - }, rest)); -}); -const BottomSheetTextInput = /*#__PURE__*/(0, _react.memo)(BottomSheetTextInputComponent); -BottomSheetTextInput.displayName = 'BottomSheetTextInput'; -var _default = BottomSheetTextInput; -exports.default = _default; -//# sourceMappingURL=BottomSheetTextInput.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetTextInput/BottomSheetTextInput.js.map b/lib/commonjs/components/bottomSheetTextInput/BottomSheetTextInput.js.map deleted file mode 100644 index 3104517e6..000000000 --- a/lib/commonjs/components/bottomSheetTextInput/BottomSheetTextInput.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheetTextInput.tsx"],"names":["BottomSheetTextInputComponent","onFocus","onBlur","rest","ref","shouldHandleKeyboardEvents","value","handleOnFocus","args","handleOnBlur","BottomSheetTextInput","displayName"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;;;;;AAGA,MAAMA,6BAA6B,gBAAG,uBAGpC,CAAC;AAAEC,EAAAA,OAAF;AAAWC,EAAAA,MAAX;AAAmB,KAAGC;AAAtB,CAAD,EAA+BC,GAA/B,KAAuC;AACvC;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAiC,oCAAvC;AAEA,wBAAU,MAAM;AACd,WAAO,MAAM;AACX;AACAA,MAAAA,0BAA0B,CAACC,KAA3B,GAAmC,KAAnC;AACD,KAHD;AAID,GALD,EAKG,CAACD,0BAAD,CALH,EAJuC,CAUvC;AAEA;;AACA,QAAME,aAAa,GAAG,wBACpBC,IAAI,IAAI;AACNH,IAAAA,0BAA0B,CAACC,KAA3B,GAAmC,IAAnC;;AACA,QAAIL,OAAJ,EAAa;AACXA,MAAAA,OAAO,CAACO,IAAD,CAAP;AACD;AACF,GANmB,EAOpB,CAACP,OAAD,EAAUI,0BAAV,CAPoB,CAAtB;AASA,QAAMI,YAAY,GAAG,wBACnBD,IAAI,IAAI;AACNH,IAAAA,0BAA0B,CAACC,KAA3B,GAAmC,KAAnC;;AACA,QAAIJ,MAAJ,EAAY;AACVA,MAAAA,MAAM,CAACM,IAAD,CAAN;AACD;AACF,GANkB,EAOnB,CAACN,MAAD,EAASG,0BAAT,CAPmB,CAArB,CAtBuC,CA+BvC;;AAEA,sBACE,6BAAC,oCAAD;AACE,IAAA,GAAG,EAAED,GADP;AAEE,IAAA,OAAO,EAAEG,aAFX;AAGE,IAAA,MAAM,EAAEE;AAHV,KAIMN,IAJN,EADF;AAQD,CA5CqC,CAAtC;AA8CA,MAAMO,oBAAoB,gBAAG,iBAAKV,6BAAL,CAA7B;AACAU,oBAAoB,CAACC,WAArB,GAAmC,sBAAnC;eAEeD,oB","sourcesContent":["import React, { memo, useCallback, forwardRef, useEffect } from 'react';\nimport { TextInput } from 'react-native-gesture-handler';\nimport { useBottomSheetInternal } from '../../hooks';\nimport type { BottomSheetTextInputProps } from './types';\n\nconst BottomSheetTextInputComponent = forwardRef<\n TextInput,\n BottomSheetTextInputProps\n>(({ onFocus, onBlur, ...rest }, ref) => {\n //#region hooks\n const { shouldHandleKeyboardEvents } = useBottomSheetInternal();\n\n useEffect(() => {\n return () => {\n // Reset the flag on unmount\n shouldHandleKeyboardEvents.value = false;\n };\n }, [shouldHandleKeyboardEvents]);\n //#endregion\n\n //#region callbacks\n const handleOnFocus = useCallback(\n args => {\n shouldHandleKeyboardEvents.value = true;\n if (onFocus) {\n onFocus(args);\n }\n },\n [onFocus, shouldHandleKeyboardEvents]\n );\n const handleOnBlur = useCallback(\n args => {\n shouldHandleKeyboardEvents.value = false;\n if (onBlur) {\n onBlur(args);\n }\n },\n [onBlur, shouldHandleKeyboardEvents]\n );\n //#endregion\n\n return (\n \n );\n});\n\nconst BottomSheetTextInput = memo(BottomSheetTextInputComponent);\nBottomSheetTextInput.displayName = 'BottomSheetTextInput';\n\nexport default BottomSheetTextInput;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetTextInput/index.js b/lib/commonjs/components/bottomSheetTextInput/index.js deleted file mode 100644 index acd7d7566..000000000 --- a/lib/commonjs/components/bottomSheetTextInput/index.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "default", { - enumerable: true, - get: function () { - return _BottomSheetTextInput.default; - } -}); - -var _BottomSheetTextInput = _interopRequireDefault(require("./BottomSheetTextInput")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetTextInput/index.js.map b/lib/commonjs/components/bottomSheetTextInput/index.js.map deleted file mode 100644 index 97ea46b47..000000000 --- a/lib/commonjs/components/bottomSheetTextInput/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { default } from './BottomSheetTextInput';\nexport type { BottomSheetTextInputProps } from './types';\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetTextInput/types.js b/lib/commonjs/components/bottomSheetTextInput/types.js deleted file mode 100644 index 239667a3d..000000000 --- a/lib/commonjs/components/bottomSheetTextInput/types.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetTextInput/types.js.map b/lib/commonjs/components/bottomSheetTextInput/types.js.map deleted file mode 100644 index 9ffd4b22f..000000000 --- a/lib/commonjs/components/bottomSheetTextInput/types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetView/BottomSheetView.js b/lib/commonjs/components/bottomSheetView/BottomSheetView.js deleted file mode 100644 index 13401fa1a..000000000 --- a/lib/commonjs/components/bottomSheetView/BottomSheetView.js +++ /dev/null @@ -1,91 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _react = _interopRequireWildcard(require("react")); - -var _reactNative = require("react-native"); - -var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated")); - -var _constants = require("../../constants"); - -var _hooks = require("../../hooks"); - -var _utilities = require("../../utilities"); - -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - -function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } - -function BottomSheetViewComponent({ - focusHook: useFocusHook = _react.useEffect, - enableFooterMarginAdjustment = false, - onLayout, - style, - children, - ...rest -}) { - //#region hooks - const { - animatedScrollableContentOffsetY, - animatedScrollableType, - animatedFooterHeight, - enableDynamicSizing, - animatedContentHeight - } = (0, _hooks.useBottomSheetInternal)(); //#endregion - //#region styles - - const containerStylePaddingBottom = (0, _react.useMemo)(() => { - const flattenStyle = _reactNative.StyleSheet.flatten(style); - - const paddingBottom = flattenStyle && 'paddingBottom' in flattenStyle ? flattenStyle.paddingBottom : 0; - return typeof paddingBottom === 'number' ? paddingBottom : 0; - }, [style]); - const containerAnimatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({ - paddingBottom: enableFooterMarginAdjustment ? animatedFooterHeight.value + containerStylePaddingBottom : containerStylePaddingBottom - }), [containerStylePaddingBottom, enableFooterMarginAdjustment]); - const containerStyle = (0, _react.useMemo)(() => [style, containerAnimatedStyle], [style, containerAnimatedStyle]); //#endregion - //#region callbacks - - const handleSettingScrollable = (0, _react.useCallback)(() => { - animatedScrollableContentOffsetY.value = 0; - animatedScrollableType.value = _constants.SCROLLABLE_TYPE.VIEW; - }, [animatedScrollableContentOffsetY, animatedScrollableType]); - const handleLayout = (0, _react.useCallback)(event => { - if (enableDynamicSizing) { - animatedContentHeight.value = event.nativeEvent.layout.height; - } - - if (onLayout) { - onLayout(event); - } - - (0, _utilities.print)({ - component: BottomSheetView.displayName, - method: 'handleLayout', - params: { - height: event.nativeEvent.layout.height - } - }); - }, [onLayout, animatedContentHeight, enableDynamicSizing]); //#endregion - // effects - - useFocusHook(handleSettingScrollable); //render - - return /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, _extends({ - onLayout: handleLayout, - style: containerStyle - }, rest), children); -} - -const BottomSheetView = /*#__PURE__*/(0, _react.memo)(BottomSheetViewComponent); -BottomSheetView.displayName = 'BottomSheetView'; -var _default = BottomSheetView; -exports.default = _default; -//# sourceMappingURL=BottomSheetView.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetView/BottomSheetView.js.map b/lib/commonjs/components/bottomSheetView/BottomSheetView.js.map deleted file mode 100644 index f591c9ba8..000000000 --- a/lib/commonjs/components/bottomSheetView/BottomSheetView.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheetView.tsx"],"names":["BottomSheetViewComponent","focusHook","useFocusHook","useEffect","enableFooterMarginAdjustment","onLayout","style","children","rest","animatedScrollableContentOffsetY","animatedScrollableType","animatedFooterHeight","enableDynamicSizing","animatedContentHeight","containerStylePaddingBottom","flattenStyle","StyleSheet","flatten","paddingBottom","containerAnimatedStyle","value","containerStyle","handleSettingScrollable","SCROLLABLE_TYPE","VIEW","handleLayout","event","nativeEvent","layout","height","component","BottomSheetView","displayName","method","params"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;AAEA,SAASA,wBAAT,CAAkC;AAChCC,EAAAA,SAAS,EAAEC,YAAY,GAAGC,gBADM;AAEhCC,EAAAA,4BAA4B,GAAG,KAFC;AAGhCC,EAAAA,QAHgC;AAIhCC,EAAAA,KAJgC;AAKhCC,EAAAA,QALgC;AAMhC,KAAGC;AAN6B,CAAlC,EAOyB;AACvB;AACA,QAAM;AACJC,IAAAA,gCADI;AAEJC,IAAAA,sBAFI;AAGJC,IAAAA,oBAHI;AAIJC,IAAAA,mBAJI;AAKJC,IAAAA;AALI,MAMF,oCANJ,CAFuB,CASvB;AAEA;;AACA,QAAMC,2BAA2B,GAAG,oBAAQ,MAAM;AAChD,UAAMC,YAAY,GAAGC,wBAAWC,OAAX,CAAmBX,KAAnB,CAArB;;AACA,UAAMY,aAAa,GACjBH,YAAY,IAAI,mBAAmBA,YAAnC,GACIA,YAAY,CAACG,aADjB,GAEI,CAHN;AAIA,WAAO,OAAOA,aAAP,KAAyB,QAAzB,GAAoCA,aAApC,GAAoD,CAA3D;AACD,GAPmC,EAOjC,CAACZ,KAAD,CAPiC,CAApC;AAQA,QAAMa,sBAAsB,GAAG,6CAC7B,OAAO;AACLD,IAAAA,aAAa,EAAEd,4BAA4B,GACvCO,oBAAoB,CAACS,KAArB,GAA6BN,2BADU,GAEvCA;AAHC,GAAP,CAD6B,EAM7B,CAACA,2BAAD,EAA8BV,4BAA9B,CAN6B,CAA/B;AAQA,QAAMiB,cAAc,GAAG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} from 'react';\nimport { LayoutChangeEvent, StyleSheet } from 'react-native';\nimport Animated, { useAnimatedStyle } from 'react-native-reanimated';\nimport { SCROLLABLE_TYPE } from '../../constants';\nimport { useBottomSheetInternal } from '../../hooks';\nimport type { BottomSheetViewProps } from './types';\nimport { print } from '../../utilities';\n\nfunction BottomSheetViewComponent({\n focusHook: useFocusHook = useEffect,\n enableFooterMarginAdjustment = false,\n onLayout,\n style,\n children,\n ...rest\n}: BottomSheetViewProps) {\n //#region hooks\n const {\n animatedScrollableContentOffsetY,\n animatedScrollableType,\n animatedFooterHeight,\n enableDynamicSizing,\n animatedContentHeight,\n } = useBottomSheetInternal();\n //#endregion\n\n //#region styles\n const containerStylePaddingBottom = useMemo(() => {\n const flattenStyle = StyleSheet.flatten(style);\n const paddingBottom =\n flattenStyle && 'paddingBottom' in flattenStyle\n ? flattenStyle.paddingBottom\n : 0;\n return typeof paddingBottom === 'number' ? paddingBottom : 0;\n }, [style]);\n const containerAnimatedStyle = useAnimatedStyle(\n () => ({\n paddingBottom: enableFooterMarginAdjustment\n ? animatedFooterHeight.value + containerStylePaddingBottom\n : containerStylePaddingBottom,\n }),\n [containerStylePaddingBottom, enableFooterMarginAdjustment]\n );\n const containerStyle = useMemo(\n () => [style, containerAnimatedStyle],\n [style, containerAnimatedStyle]\n );\n //#endregion\n\n //#region callbacks\n const handleSettingScrollable = useCallback(() => {\n animatedScrollableContentOffsetY.value = 0;\n animatedScrollableType.value = SCROLLABLE_TYPE.VIEW;\n }, [animatedScrollableContentOffsetY, animatedScrollableType]);\n const handleLayout = useCallback(\n (event: LayoutChangeEvent) => {\n if (enableDynamicSizing) {\n animatedContentHeight.value = event.nativeEvent.layout.height;\n }\n\n if (onLayout) {\n onLayout(event);\n }\n\n print({\n component: BottomSheetView.displayName,\n method: 'handleLayout',\n params: {\n height: event.nativeEvent.layout.height,\n },\n });\n },\n [onLayout, animatedContentHeight, enableDynamicSizing]\n );\n //#endregion\n\n // effects\n useFocusHook(handleSettingScrollable);\n\n //render\n return (\n \n {children}\n \n );\n}\n\nconst BottomSheetView = memo(BottomSheetViewComponent);\nBottomSheetView.displayName = 'BottomSheetView';\n\nexport default BottomSheetView;\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetView/index.js b/lib/commonjs/components/bottomSheetView/index.js deleted file mode 100644 index bfeda7c44..000000000 --- a/lib/commonjs/components/bottomSheetView/index.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "default", { - enumerable: true, - get: function () { - return _BottomSheetView.default; - } -}); - -var _BottomSheetView = _interopRequireDefault(require("./BottomSheetView")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetView/index.js.map b/lib/commonjs/components/bottomSheetView/index.js.map deleted file mode 100644 index 52a6b5531..000000000 --- a/lib/commonjs/components/bottomSheetView/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { default } from './BottomSheetView';\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetView/styles.js b/lib/commonjs/components/bottomSheetView/styles.js deleted file mode 100644 index 9aaaa46d6..000000000 --- a/lib/commonjs/components/bottomSheetView/styles.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.styles = void 0; - -var _reactNative = require("react-native"); - -const styles = _reactNative.StyleSheet.create({ - container: {// flex: 1, - } -}); - -exports.styles = styles; -//# sourceMappingURL=styles.js.map \ No newline at end of file diff --git a/lib/commonjs/components/bottomSheetView/styles.js.map b/lib/commonjs/components/bottomSheetView/styles.js.map deleted file mode 100644 index 55fc8c05d..000000000 --- a/lib/commonjs/components/bottomSheetView/styles.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["styles.ts"],"names":["styles","StyleSheet","create","container"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,MAAM,GAAGC,wBAAWC,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE,CACT;AADS;AAD2B,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\n\nexport const styles = StyleSheet.create({\n container: {\n // flex: 1,\n },\n});\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/touchables/Touchables.ios.js b/lib/commonjs/components/touchables/Touchables.ios.js deleted file mode 100644 index 0163feae5..000000000 --- a/lib/commonjs/components/touchables/Touchables.ios.js +++ /dev/null @@ -1,26 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "TouchableOpacity", { - enumerable: true, - get: function () { - return _reactNative.TouchableOpacity; - } -}); -Object.defineProperty(exports, "TouchableHighlight", { - enumerable: true, - get: function () { - return _reactNative.TouchableHighlight; - } -}); -Object.defineProperty(exports, "TouchableWithoutFeedback", { - enumerable: true, - get: function () { - return _reactNative.TouchableWithoutFeedback; - } -}); - -var _reactNative = require("react-native"); -//# sourceMappingURL=Touchables.ios.js.map \ No newline at end of file diff --git a/lib/commonjs/components/touchables/Touchables.ios.js.map b/lib/commonjs/components/touchables/Touchables.ios.js.map deleted file mode 100644 index f1bff73b8..000000000 --- a/lib/commonjs/components/touchables/Touchables.ios.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["Touchables.ios.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA","sourcesContent":["export {\n TouchableOpacity,\n TouchableHighlight,\n TouchableWithoutFeedback,\n} from 'react-native';\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/touchables/Touchables.js b/lib/commonjs/components/touchables/Touchables.js deleted file mode 100644 index df97a9f1c..000000000 --- a/lib/commonjs/components/touchables/Touchables.js +++ /dev/null @@ -1,26 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "TouchableOpacity", { - enumerable: true, - get: function () { - return _reactNativeGestureHandler.TouchableOpacity; - } -}); -Object.defineProperty(exports, "TouchableHighlight", { - enumerable: true, - get: function () { - return _reactNativeGestureHandler.TouchableHighlight; - } -}); -Object.defineProperty(exports, "TouchableWithoutFeedback", { - enumerable: true, - get: function () { - return _reactNativeGestureHandler.TouchableWithoutFeedback; - } -}); - -var _reactNativeGestureHandler = require("react-native-gesture-handler"); -//# sourceMappingURL=Touchables.js.map \ No newline at end of file diff --git a/lib/commonjs/components/touchables/Touchables.js.map b/lib/commonjs/components/touchables/Touchables.js.map deleted file mode 100644 index a16bc7882..000000000 --- a/lib/commonjs/components/touchables/Touchables.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["Touchables.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA","sourcesContent":["export {\n TouchableOpacity,\n TouchableHighlight,\n TouchableWithoutFeedback,\n} from 'react-native-gesture-handler';\n"]} \ No newline at end of file diff --git a/lib/commonjs/components/touchables/index.js b/lib/commonjs/components/touchables/index.js deleted file mode 100644 index 6b0484d17..000000000 --- a/lib/commonjs/components/touchables/index.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _Touchables = require("./Touchables"); - -var _default = { - TouchableOpacity: _Touchables.TouchableOpacity, - TouchableHighlight: _Touchables.TouchableHighlight, - TouchableWithoutFeedback: _Touchables.TouchableWithoutFeedback -}; -exports.default = _default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/components/touchables/index.js.map b/lib/commonjs/components/touchables/index.js.map deleted file mode 100644 index 90a65edf7..000000000 --- a/lib/commonjs/components/touchables/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":["TouchableOpacity","TouchableHighlight","TouchableWithoutFeedback"],"mappings":";;;;;;;AAMA;;eAOe;AACbA,EAAAA,gBAAgB,EAAEA,4BADL;AAEbC,EAAAA,kBAAkB,EAAEA,8BAFP;AAGbC,EAAAA,wBAAwB,EACtBA;AAJW,C","sourcesContent":["import type {\n TouchableOpacity as RNTouchableOpacity,\n TouchableHighlight as RNTouchableHighlight,\n TouchableWithoutFeedback as RNTouchableWithoutFeedback,\n} from 'react-native';\n\nimport {\n TouchableOpacity,\n TouchableHighlight,\n TouchableWithoutFeedback,\n // @ts-ignore\n} from './Touchables';\n\nexport default {\n TouchableOpacity: TouchableOpacity as any as typeof RNTouchableOpacity,\n TouchableHighlight: TouchableHighlight as any as typeof RNTouchableHighlight,\n TouchableWithoutFeedback:\n TouchableWithoutFeedback as any as typeof RNTouchableWithoutFeedback,\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/constants.js b/lib/commonjs/constants.js deleted file mode 100644 index 47779dd76..000000000 --- a/lib/commonjs/constants.js +++ /dev/null @@ -1,161 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.ANIMATION_DURATION = exports.ANIMATION_EASING = exports.ANIMATION_CONFIGS = exports.KEYBOARD_DISMISS_THRESHOLD = exports.KEYBOARD_INPUT_MODE = exports.KEYBOARD_BLUR_BEHAVIOR = exports.KEYBOARD_BEHAVIOR = exports.MODAL_STACK_BEHAVIOR = exports.SCROLLABLE_DECELERATION_RATE_MAPPER = exports.SCREEN_WIDTH = exports.SCREEN_HEIGHT = exports.WINDOW_WIDTH = exports.WINDOW_HEIGHT = exports.KEYBOARD_STATE = exports.SCROLLABLE_STATE = exports.SCROLLABLE_TYPE = exports.ANIMATION_SOURCE = exports.ANIMATION_METHOD = exports.ANIMATION_STATE = exports.SHEET_STATE = exports.GESTURE_SOURCE = void 0; - -var _reactNative = require("react-native"); - -var _reactNativeReanimated = require("react-native-reanimated"); - -const { - height: WINDOW_HEIGHT, - width: WINDOW_WIDTH -} = _reactNative.Dimensions.get('window'); - -exports.WINDOW_WIDTH = WINDOW_WIDTH; -exports.WINDOW_HEIGHT = WINDOW_HEIGHT; - -const { - height: SCREEN_HEIGHT, - width: SCREEN_WIDTH -} = _reactNative.Dimensions.get('screen'); - -exports.SCREEN_WIDTH = SCREEN_WIDTH; -exports.SCREEN_HEIGHT = SCREEN_HEIGHT; -var GESTURE_SOURCE; -exports.GESTURE_SOURCE = GESTURE_SOURCE; - -(function (GESTURE_SOURCE) { - GESTURE_SOURCE[GESTURE_SOURCE["UNDETERMINED"] = 0] = "UNDETERMINED"; - GESTURE_SOURCE[GESTURE_SOURCE["SCROLLABLE"] = 1] = "SCROLLABLE"; - GESTURE_SOURCE[GESTURE_SOURCE["HANDLE"] = 2] = "HANDLE"; - GESTURE_SOURCE[GESTURE_SOURCE["CONTENT"] = 3] = "CONTENT"; -})(GESTURE_SOURCE || (exports.GESTURE_SOURCE = GESTURE_SOURCE = {})); - -var SHEET_STATE; -exports.SHEET_STATE = SHEET_STATE; - -(function (SHEET_STATE) { - SHEET_STATE[SHEET_STATE["CLOSED"] = 0] = "CLOSED"; - SHEET_STATE[SHEET_STATE["OPENED"] = 1] = "OPENED"; - SHEET_STATE[SHEET_STATE["EXTENDED"] = 2] = "EXTENDED"; - SHEET_STATE[SHEET_STATE["OVER_EXTENDED"] = 3] = "OVER_EXTENDED"; - SHEET_STATE[SHEET_STATE["FILL_PARENT"] = 4] = "FILL_PARENT"; -})(SHEET_STATE || (exports.SHEET_STATE = SHEET_STATE = {})); - -var SCROLLABLE_STATE; -exports.SCROLLABLE_STATE = SCROLLABLE_STATE; - -(function (SCROLLABLE_STATE) { - SCROLLABLE_STATE[SCROLLABLE_STATE["LOCKED"] = 0] = "LOCKED"; - SCROLLABLE_STATE[SCROLLABLE_STATE["UNLOCKED"] = 1] = "UNLOCKED"; - SCROLLABLE_STATE[SCROLLABLE_STATE["UNDETERMINED"] = 2] = "UNDETERMINED"; -})(SCROLLABLE_STATE || (exports.SCROLLABLE_STATE = SCROLLABLE_STATE = {})); - -var SCROLLABLE_TYPE; -exports.SCROLLABLE_TYPE = SCROLLABLE_TYPE; - -(function (SCROLLABLE_TYPE) { - SCROLLABLE_TYPE[SCROLLABLE_TYPE["UNDETERMINED"] = 0] = "UNDETERMINED"; - SCROLLABLE_TYPE[SCROLLABLE_TYPE["VIEW"] = 1] = "VIEW"; - SCROLLABLE_TYPE[SCROLLABLE_TYPE["FLATLIST"] = 2] = "FLATLIST"; - SCROLLABLE_TYPE[SCROLLABLE_TYPE["SCROLLVIEW"] = 3] = "SCROLLVIEW"; - SCROLLABLE_TYPE[SCROLLABLE_TYPE["SECTIONLIST"] = 4] = "SECTIONLIST"; - SCROLLABLE_TYPE[SCROLLABLE_TYPE["VIRTUALIZEDLIST"] = 5] = "VIRTUALIZEDLIST"; -})(SCROLLABLE_TYPE || (exports.SCROLLABLE_TYPE = SCROLLABLE_TYPE = {})); - -var ANIMATION_STATE; -exports.ANIMATION_STATE = ANIMATION_STATE; - -(function (ANIMATION_STATE) { - ANIMATION_STATE[ANIMATION_STATE["UNDETERMINED"] = 0] = "UNDETERMINED"; - ANIMATION_STATE[ANIMATION_STATE["RUNNING"] = 1] = "RUNNING"; - ANIMATION_STATE[ANIMATION_STATE["STOPPED"] = 2] = "STOPPED"; - ANIMATION_STATE[ANIMATION_STATE["INTERRUPTED"] = 3] = "INTERRUPTED"; -})(ANIMATION_STATE || (exports.ANIMATION_STATE = ANIMATION_STATE = {})); - -var ANIMATION_SOURCE; -exports.ANIMATION_SOURCE = ANIMATION_SOURCE; - -(function (ANIMATION_SOURCE) { - ANIMATION_SOURCE[ANIMATION_SOURCE["NONE"] = 0] = "NONE"; - ANIMATION_SOURCE[ANIMATION_SOURCE["MOUNT"] = 1] = "MOUNT"; - ANIMATION_SOURCE[ANIMATION_SOURCE["GESTURE"] = 2] = "GESTURE"; - ANIMATION_SOURCE[ANIMATION_SOURCE["USER"] = 3] = "USER"; - ANIMATION_SOURCE[ANIMATION_SOURCE["CONTAINER_RESIZE"] = 4] = "CONTAINER_RESIZE"; - ANIMATION_SOURCE[ANIMATION_SOURCE["SNAP_POINT_CHANGE"] = 5] = "SNAP_POINT_CHANGE"; - ANIMATION_SOURCE[ANIMATION_SOURCE["KEYBOARD"] = 6] = "KEYBOARD"; -})(ANIMATION_SOURCE || (exports.ANIMATION_SOURCE = ANIMATION_SOURCE = {})); - -var ANIMATION_METHOD; -exports.ANIMATION_METHOD = ANIMATION_METHOD; - -(function (ANIMATION_METHOD) { - ANIMATION_METHOD[ANIMATION_METHOD["TIMING"] = 0] = "TIMING"; - ANIMATION_METHOD[ANIMATION_METHOD["SPRING"] = 1] = "SPRING"; -})(ANIMATION_METHOD || (exports.ANIMATION_METHOD = ANIMATION_METHOD = {})); - -var KEYBOARD_STATE; -exports.KEYBOARD_STATE = KEYBOARD_STATE; - -(function (KEYBOARD_STATE) { - KEYBOARD_STATE[KEYBOARD_STATE["UNDETERMINED"] = 0] = "UNDETERMINED"; - KEYBOARD_STATE[KEYBOARD_STATE["SHOWN"] = 1] = "SHOWN"; - KEYBOARD_STATE[KEYBOARD_STATE["HIDDEN"] = 2] = "HIDDEN"; -})(KEYBOARD_STATE || (exports.KEYBOARD_STATE = KEYBOARD_STATE = {})); - -const ANIMATION_EASING = _reactNativeReanimated.Easing.out(_reactNativeReanimated.Easing.exp); - -exports.ANIMATION_EASING = ANIMATION_EASING; -const ANIMATION_DURATION = 250; -exports.ANIMATION_DURATION = ANIMATION_DURATION; -const ANIMATION_CONFIGS_IOS = { - damping: 500, - stiffness: 1000, - mass: 3, - overshootClamping: true, - restDisplacementThreshold: 10, - restSpeedThreshold: 10 -}; -const ANIMATION_CONFIGS_ANDROID = { - duration: ANIMATION_DURATION, - easing: ANIMATION_EASING -}; -const ANIMATION_CONFIGS = _reactNative.Platform.OS === 'ios' ? ANIMATION_CONFIGS_IOS : ANIMATION_CONFIGS_ANDROID; -exports.ANIMATION_CONFIGS = ANIMATION_CONFIGS; -const SCROLLABLE_DECELERATION_RATE_MAPPER = { - [SCROLLABLE_STATE.UNDETERMINED]: 0, - [SCROLLABLE_STATE.LOCKED]: 0, - [SCROLLABLE_STATE.UNLOCKED]: _reactNative.Platform.select({ - ios: 0.998, - android: 0.985, - default: 1 - }) -}; -exports.SCROLLABLE_DECELERATION_RATE_MAPPER = SCROLLABLE_DECELERATION_RATE_MAPPER; -const MODAL_STACK_BEHAVIOR = { - replace: 'replace', - push: 'push' -}; -exports.MODAL_STACK_BEHAVIOR = MODAL_STACK_BEHAVIOR; -const KEYBOARD_BEHAVIOR = { - interactive: 'interactive', - extend: 'extend', - fillParent: 'fillParent' -}; -exports.KEYBOARD_BEHAVIOR = KEYBOARD_BEHAVIOR; -const KEYBOARD_BLUR_BEHAVIOR = { - none: 'none', - restore: 'restore' -}; -exports.KEYBOARD_BLUR_BEHAVIOR = KEYBOARD_BLUR_BEHAVIOR; -const KEYBOARD_INPUT_MODE = { - adjustPan: 'adjustPan', - adjustResize: 'adjustResize' -}; -exports.KEYBOARD_INPUT_MODE = KEYBOARD_INPUT_MODE; -const KEYBOARD_DISMISS_THRESHOLD = 12.5; -exports.KEYBOARD_DISMISS_THRESHOLD = KEYBOARD_DISMISS_THRESHOLD; -//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/lib/commonjs/constants.js.map b/lib/commonjs/constants.js.map deleted file mode 100644 index b2956a8ad..000000000 --- a/lib/commonjs/constants.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["constants.ts"],"names":["height","WINDOW_HEIGHT","width","WINDOW_WIDTH","Dimensions","get","SCREEN_HEIGHT","SCREEN_WIDTH","GESTURE_SOURCE","SHEET_STATE","SCROLLABLE_STATE","SCROLLABLE_TYPE","ANIMATION_STATE","ANIMATION_SOURCE","ANIMATION_METHOD","KEYBOARD_STATE","ANIMATION_EASING","Easing","out","exp","ANIMATION_DURATION","ANIMATION_CONFIGS_IOS","damping","stiffness","mass","overshootClamping","restDisplacementThreshold","restSpeedThreshold","ANIMATION_CONFIGS_ANDROID","duration","easing","ANIMATION_CONFIGS","Platform","OS","SCROLLABLE_DECELERATION_RATE_MAPPER","UNDETERMINED","LOCKED","UNLOCKED","select","ios","android","default","MODAL_STACK_BEHAVIOR","replace","push","KEYBOARD_BEHAVIOR","interactive","extend","fillParent","KEYBOARD_BLUR_BEHAVIOR","none","restore","KEYBOARD_INPUT_MODE","adjustPan","adjustResize","KEYBOARD_DISMISS_THRESHOLD"],"mappings":";;;;;;;AAAA;;AACA;;AAEA,MAAM;AAAEA,EAAAA,MAAM,EAAEC,aAAV;AAAyBC,EAAAA,KAAK,EAAEC;AAAhC,IAAiDC,wBAAWC,GAAX,CAAe,QAAf,CAAvD;;;;;AACA,MAAM;AAAEL,EAAAA,MAAM,EAAEM,aAAV;AAAyBJ,EAAAA,KAAK,EAAEK;AAAhC,IAAiDH,wBAAWC,GAAX,CAAe,QAAf,CAAvD;;;;IAEKG,c;;;WAAAA,c;AAAAA,EAAAA,c,CAAAA,c;AAAAA,EAAAA,c,CAAAA,c;AAAAA,EAAAA,c,CAAAA,c;AAAAA,EAAAA,c,CAAAA,c;GAAAA,c,8BAAAA,c;;IAOAC,W;;;WAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;GAAAA,W,2BAAAA,W;;IAQAC,gB;;;WAAAA,gB;AAAAA,EAAAA,gB,CAAAA,gB;AAAAA,EAAAA,gB,CAAAA,gB;AAAAA,EAAAA,gB,CAAAA,gB;GAAAA,gB,gCAAAA,gB;;IAMAC,e;;;WAAAA,e;AAAAA,EAAAA,e,CAAAA,e;AAAAA,EAAAA,e,CAAAA,e;AAAAA,EAAAA,e,CAAAA,e;AAAAA,EAAAA,e,CAAAA,e;AAAAA,EAAAA,e,CAAAA,e;AAAAA,EAAAA,e,CAAAA,e;GAAAA,e,+BAAAA,e;;IASAC,e;;;WAAAA,e;AAAAA,EAAAA,e,CAAAA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B,CAAC0B,MAAlB,GAA2B,CAFe;AAG1C,GAAC1B,gBAAgB,CAAC2B,QAAlB,GAA6BL,sBAASM,MAAT,CAAgB;AAC3CC,IAAAA,GAAG,EAAE,KADsC;AAE3CC,IAAAA,OAAO,EAAE,KAFkC;AAG3CC,IAAAA,OAAO,EAAE;AAHkC,GAAhB;AAHa,CAA5C;;AAUA,MAAMC,oBAAoB,GAAG;AAC3BC,EAAAA,OAAO,EAAE,SADkB;AAE3BC,EAAAA,IAAI,EAAE;AAFqB,CAA7B;;AAKA,MAAMC,iBAAiB,GAAG;AACxBC,EAAAA,WAAW,EAAE,aADW;AAExBC,EAAAA,MAAM,EAAE,QAFgB;AAGxBC,EAAAA,UAAU,EAAE;AAHY,CAA1B;;AAMA,MAAMC,sBAAsB,GAAG;AAC7BC,EAAAA,IAAI,EAAE,MADuB;AAE7BC,EAAAA,OAAO,EAAE;AAFoB,CAA/B;;AAKA,MAAMC,mBAAmB,GAAG;AAC1BC,EAAAA,SAAS,EAAE,WADe;AAE1BC,EAAAA,YAAY,EAAE;AAFY,CAA5B;;AAKA,MAAMC,0BAA0B,GAAG,IAAnC","sourcesContent":["import { Dimensions, Platform } from 'react-native';\nimport Animated, { Easing } from 'react-native-reanimated';\n\nconst { height: WINDOW_HEIGHT, width: WINDOW_WIDTH } = Dimensions.get('window');\nconst { height: SCREEN_HEIGHT, width: SCREEN_WIDTH } = Dimensions.get('screen');\n\nenum GESTURE_SOURCE {\n UNDETERMINED = 0,\n SCROLLABLE,\n HANDLE,\n CONTENT,\n}\n\nenum SHEET_STATE {\n CLOSED = 0,\n OPENED,\n EXTENDED,\n OVER_EXTENDED,\n FILL_PARENT,\n}\n\nenum SCROLLABLE_STATE {\n LOCKED = 0,\n UNLOCKED,\n UNDETERMINED,\n}\n\nenum SCROLLABLE_TYPE {\n UNDETERMINED = 0,\n VIEW,\n FLATLIST,\n SCROLLVIEW,\n SECTIONLIST,\n VIRTUALIZEDLIST,\n}\n\nenum ANIMATION_STATE {\n UNDETERMINED = 0,\n RUNNING,\n STOPPED,\n INTERRUPTED,\n}\n\nenum ANIMATION_SOURCE {\n NONE = 0,\n MOUNT,\n GESTURE,\n USER,\n CONTAINER_RESIZE,\n SNAP_POINT_CHANGE,\n KEYBOARD,\n}\n\nenum ANIMATION_METHOD {\n TIMING,\n SPRING,\n}\n\nenum KEYBOARD_STATE {\n UNDETERMINED = 0,\n SHOWN,\n HIDDEN,\n}\n\nconst ANIMATION_EASING: Animated.EasingFunction = Easing.out(Easing.exp);\nconst ANIMATION_DURATION = 250;\n\nconst ANIMATION_CONFIGS_IOS = {\n damping: 500,\n stiffness: 1000,\n mass: 3,\n overshootClamping: true,\n restDisplacementThreshold: 10,\n restSpeedThreshold: 10,\n};\n\nconst ANIMATION_CONFIGS_ANDROID = {\n duration: ANIMATION_DURATION,\n easing: ANIMATION_EASING,\n};\n\nconst ANIMATION_CONFIGS =\n Platform.OS === 'ios' ? ANIMATION_CONFIGS_IOS : ANIMATION_CONFIGS_ANDROID;\n\nconst SCROLLABLE_DECELERATION_RATE_MAPPER = {\n [SCROLLABLE_STATE.UNDETERMINED]: 0,\n [SCROLLABLE_STATE.LOCKED]: 0,\n [SCROLLABLE_STATE.UNLOCKED]: Platform.select({\n ios: 0.998,\n android: 0.985,\n default: 1,\n }),\n};\n\nconst MODAL_STACK_BEHAVIOR = {\n replace: 'replace',\n push: 'push',\n};\n\nconst KEYBOARD_BEHAVIOR = {\n interactive: 'interactive',\n extend: 'extend',\n fillParent: 'fillParent',\n} as const;\n\nconst KEYBOARD_BLUR_BEHAVIOR = {\n none: 'none',\n restore: 'restore',\n} as const;\n\nconst KEYBOARD_INPUT_MODE = {\n adjustPan: 'adjustPan',\n adjustResize: 'adjustResize',\n} as const;\n\nconst KEYBOARD_DISMISS_THRESHOLD = 12.5;\n\nexport {\n GESTURE_SOURCE,\n SHEET_STATE,\n ANIMATION_STATE,\n ANIMATION_METHOD,\n ANIMATION_SOURCE,\n SCROLLABLE_TYPE,\n SCROLLABLE_STATE,\n KEYBOARD_STATE,\n WINDOW_HEIGHT,\n WINDOW_WIDTH,\n SCREEN_HEIGHT,\n SCREEN_WIDTH,\n SCROLLABLE_DECELERATION_RATE_MAPPER,\n MODAL_STACK_BEHAVIOR,\n KEYBOARD_BEHAVIOR,\n KEYBOARD_BLUR_BEHAVIOR,\n KEYBOARD_INPUT_MODE,\n KEYBOARD_DISMISS_THRESHOLD,\n ANIMATION_CONFIGS,\n ANIMATION_EASING,\n ANIMATION_DURATION,\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/contexts/external.js b/lib/commonjs/contexts/external.js deleted file mode 100644 index 3722572ca..000000000 --- a/lib/commonjs/contexts/external.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.BottomSheetProvider = exports.BottomSheetContext = void 0; - -var _react = require("react"); - -const BottomSheetContext = /*#__PURE__*/(0, _react.createContext)(null); -exports.BottomSheetContext = BottomSheetContext; -const BottomSheetProvider = BottomSheetContext.Provider; -exports.BottomSheetProvider = BottomSheetProvider; -//# sourceMappingURL=external.js.map \ No newline at end of file diff --git a/lib/commonjs/contexts/external.js.map b/lib/commonjs/contexts/external.js.map deleted file mode 100644 index 2da2b7655..000000000 --- a/lib/commonjs/contexts/external.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["external.ts"],"names":["BottomSheetContext","BottomSheetProvider","Provider"],"mappings":";;;;;;;AAAA;;AAGO,MAAMA,kBAAkB,gBAAG,0BAEhC,IAFgC,CAA3B;;AAIA,MAAMC,mBAAmB,GAAGD,kBAAkB,CAACE,QAA/C","sourcesContent":["import { createContext } from 'react';\nimport type { BottomSheetMethods, BottomSheetVariables } from '../types';\n\nexport const BottomSheetContext = createContext<\n (BottomSheetMethods & BottomSheetVariables) | null\n>(null);\n\nexport const BottomSheetProvider = BottomSheetContext.Provider;\n"]} \ No newline at end of file diff --git a/lib/commonjs/contexts/gesture.js b/lib/commonjs/contexts/gesture.js deleted file mode 100644 index 67d702039..000000000 --- a/lib/commonjs/contexts/gesture.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.BottomSheetGestureHandlersContext = void 0; - -var _react = require("react"); - -const BottomSheetGestureHandlersContext = /*#__PURE__*/(0, _react.createContext)(null); -exports.BottomSheetGestureHandlersContext = BottomSheetGestureHandlersContext; -//# sourceMappingURL=gesture.js.map \ No newline at end of file diff --git a/lib/commonjs/contexts/gesture.js.map b/lib/commonjs/contexts/gesture.js.map deleted file mode 100644 index fd960983a..000000000 --- a/lib/commonjs/contexts/gesture.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["gesture.ts"],"names":["BottomSheetGestureHandlersContext"],"mappings":";;;;;;;AAAA;;AASO,MAAMA,iCAAiC,gBAC5C,0BAA4D,IAA5D,CADK","sourcesContent":["import { createContext } from 'react';\nimport type { PanGestureHandlerGestureEvent } from 'react-native-gesture-handler';\n\nexport interface BottomSheetGestureHandlersContextType {\n contentPanGestureHandler: (event: PanGestureHandlerGestureEvent) => void;\n handlePanGestureHandler: (event: PanGestureHandlerGestureEvent) => void;\n scrollablePanGestureHandler: (event: PanGestureHandlerGestureEvent) => void;\n}\n\nexport const BottomSheetGestureHandlersContext =\n createContext(null);\n"]} \ No newline at end of file diff --git a/lib/commonjs/contexts/index.js b/lib/commonjs/contexts/index.js deleted file mode 100644 index 42763baaf..000000000 --- a/lib/commonjs/contexts/index.js +++ /dev/null @@ -1,70 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "BottomSheetContext", { - enumerable: true, - get: function () { - return _external.BottomSheetContext; - } -}); -Object.defineProperty(exports, "BottomSheetProvider", { - enumerable: true, - get: function () { - return _external.BottomSheetProvider; - } -}); -Object.defineProperty(exports, "BottomSheetInternalContext", { - enumerable: true, - get: function () { - return _internal.BottomSheetInternalContext; - } -}); -Object.defineProperty(exports, "BottomSheetInternalProvider", { - enumerable: true, - get: function () { - return _internal.BottomSheetInternalProvider; - } -}); -Object.defineProperty(exports, "BottomSheetGestureHandlersContext", { - enumerable: true, - get: function () { - return _gesture.BottomSheetGestureHandlersContext; - } -}); -Object.defineProperty(exports, "BottomSheetModalContext", { - enumerable: true, - get: function () { - return _external2.BottomSheetModalContext; - } -}); -Object.defineProperty(exports, "BottomSheetModalProvider", { - enumerable: true, - get: function () { - return _external2.BottomSheetModalProvider; - } -}); -Object.defineProperty(exports, "BottomSheetModalInternalContext", { - enumerable: true, - get: function () { - return _internal2.BottomSheetModalInternalContext; - } -}); -Object.defineProperty(exports, "BottomSheetModalInternalProvider", { - enumerable: true, - get: function () { - return _internal2.BottomSheetModalInternalProvider; - } -}); - -var _external = require("./external"); - -var _internal = require("./internal"); - -var _gesture = require("./gesture"); - -var _external2 = require("./modal/external"); - -var _internal2 = require("./modal/internal"); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/contexts/index.js.map b/lib/commonjs/contexts/index.js.map deleted file mode 100644 index cf72fdee3..000000000 --- a/lib/commonjs/contexts/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAIA;;AACA;;AAIA","sourcesContent":["export { BottomSheetContext, BottomSheetProvider } from './external';\nexport {\n BottomSheetInternalContext,\n BottomSheetInternalProvider,\n} from './internal';\nexport { BottomSheetGestureHandlersContext } from './gesture';\nexport {\n BottomSheetModalContext,\n BottomSheetModalProvider,\n} from './modal/external';\nexport {\n BottomSheetModalInternalContext,\n BottomSheetModalInternalProvider,\n} from './modal/internal';\nexport type { BottomSheetModalInternalContextType } from './modal/internal';\n"]} \ No newline at end of file diff --git a/lib/commonjs/contexts/internal.js b/lib/commonjs/contexts/internal.js deleted file mode 100644 index 51de8ae8b..000000000 --- a/lib/commonjs/contexts/internal.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.BottomSheetInternalProvider = exports.BottomSheetInternalContext = void 0; - -var _react = require("react"); - -const BottomSheetInternalContext = /*#__PURE__*/(0, _react.createContext)(null); -exports.BottomSheetInternalContext = BottomSheetInternalContext; -const BottomSheetInternalProvider = BottomSheetInternalContext.Provider; -exports.BottomSheetInternalProvider = BottomSheetInternalProvider; -//# sourceMappingURL=internal.js.map \ No newline at end of file diff --git a/lib/commonjs/contexts/internal.js.map b/lib/commonjs/contexts/internal.js.map deleted file mode 100644 index d0b307ed8..000000000 --- a/lib/commonjs/contexts/internal.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["internal.ts"],"names":["BottomSheetInternalContext","BottomSheetInternalProvider","Provider"],"mappings":";;;;;;;AAAA;;AA0EO,MAAMA,0BAA0B,gBACrC,0BAAqD,IAArD,CADK;;AAGA,MAAMC,2BAA2B,GAAGD,0BAA0B,CAACE,QAA/D","sourcesContent":["import { createContext, RefObject } from 'react';\nimport type {\n PanGestureHandlerProps,\n State,\n} from 'react-native-gesture-handler';\nimport type Animated from 'react-native-reanimated';\nimport type {\n AnimateToPositionType,\n BottomSheetProps,\n} from '../components/bottomSheet/types';\nimport type {\n ANIMATION_STATE,\n KEYBOARD_STATE,\n SCROLLABLE_STATE,\n SCROLLABLE_TYPE,\n SHEET_STATE,\n} from '../constants';\nimport type { Scrollable, ScrollableRef } from '../types';\n\nexport interface BottomSheetInternalContextType\n extends Pick<\n PanGestureHandlerProps,\n | 'activeOffsetY'\n | 'activeOffsetX'\n | 'failOffsetY'\n | 'failOffsetX'\n | 'waitFor'\n | 'simultaneousHandlers'\n >,\n Required<\n Pick<\n BottomSheetProps,\n | 'enableContentPanningGesture'\n | 'enableOverDrag'\n | 'enablePanDownToClose'\n | 'enableDynamicSizing'\n | 'overDragResistanceFactor'\n >\n > {\n // animated states\n animatedAnimationState: Animated.SharedValue;\n animatedSheetState: Animated.SharedValue;\n animatedScrollableState: Animated.SharedValue;\n animatedKeyboardState: Animated.SharedValue;\n animatedContentGestureState: Animated.SharedValue;\n animatedHandleGestureState: Animated.SharedValue;\n\n // animated values\n animatedSnapPoints: Animated.SharedValue;\n animatedPosition: Animated.SharedValue;\n animatedIndex: Animated.SharedValue;\n animatedContainerHeight: Animated.SharedValue;\n animatedContentHeight: Animated.SharedValue;\n animatedHighestSnapPoint: Animated.SharedValue;\n animatedClosedPosition: Animated.SharedValue;\n animatedFooterHeight: Animated.SharedValue;\n animatedHandleHeight: Animated.SharedValue;\n animatedKeyboardHeight: Animated.SharedValue;\n animatedKeyboardHeightInContainer: Animated.SharedValue;\n animatedScrollableType: Animated.SharedValue;\n animatedScrollableContentOffsetY: Animated.SharedValue;\n animatedScrollableOverrideState: Animated.SharedValue;\n isScrollableRefreshable: Animated.SharedValue;\n isContentHeightFixed: Animated.SharedValue;\n isInTemporaryPosition: Animated.SharedValue;\n shouldHandleKeyboardEvents: Animated.SharedValue;\n\n // methods\n stopAnimation: () => void;\n animateToPosition: AnimateToPositionType;\n setScrollableRef: (ref: ScrollableRef) => void;\n removeScrollableRef: (ref: RefObject) => void;\n}\n\nexport const BottomSheetInternalContext =\n createContext(null);\n\nexport const BottomSheetInternalProvider = BottomSheetInternalContext.Provider;\n"]} \ No newline at end of file diff --git a/lib/commonjs/contexts/modal/external.js b/lib/commonjs/contexts/modal/external.js deleted file mode 100644 index f62ed52c5..000000000 --- a/lib/commonjs/contexts/modal/external.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.BottomSheetModalProvider = exports.BottomSheetModalContext = void 0; - -var _react = require("react"); - -const BottomSheetModalContext = /*#__PURE__*/(0, _react.createContext)(null); -exports.BottomSheetModalContext = BottomSheetModalContext; -const BottomSheetModalProvider = BottomSheetModalContext.Provider; -exports.BottomSheetModalProvider = BottomSheetModalProvider; -//# sourceMappingURL=external.js.map \ No newline at end of file diff --git a/lib/commonjs/contexts/modal/external.js.map b/lib/commonjs/contexts/modal/external.js.map deleted file mode 100644 index c16297405..000000000 --- a/lib/commonjs/contexts/modal/external.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["external.ts"],"names":["BottomSheetModalContext","BottomSheetModalProvider","Provider"],"mappings":";;;;;;;AAAA;;AAOO,MAAMA,uBAAuB,gBAClC,0BAAkD,IAAlD,CADK;;AAGA,MAAMC,wBAAwB,GAAGD,uBAAuB,CAACE,QAAzD","sourcesContent":["import { createContext } from 'react';\n\nexport interface BottomSheetModalContextType {\n dismiss: (key?: string) => boolean;\n dismissAll: () => void;\n}\n\nexport const BottomSheetModalContext =\n createContext(null);\n\nexport const BottomSheetModalProvider = BottomSheetModalContext.Provider;\n"]} \ No newline at end of file diff --git a/lib/commonjs/contexts/modal/internal.js b/lib/commonjs/contexts/modal/internal.js deleted file mode 100644 index 9dce3a42b..000000000 --- a/lib/commonjs/contexts/modal/internal.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.BottomSheetModalInternalProvider = exports.BottomSheetModalInternalContext = void 0; - -var _react = require("react"); - -const BottomSheetModalInternalContext = /*#__PURE__*/(0, _react.createContext)(null); -exports.BottomSheetModalInternalContext = BottomSheetModalInternalContext; -const BottomSheetModalInternalProvider = BottomSheetModalInternalContext.Provider; -exports.BottomSheetModalInternalProvider = BottomSheetModalInternalProvider; -//# sourceMappingURL=internal.js.map \ No newline at end of file diff --git a/lib/commonjs/contexts/modal/internal.js.map b/lib/commonjs/contexts/modal/internal.js.map deleted file mode 100644 index 264579afe..000000000 --- a/lib/commonjs/contexts/modal/internal.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["internal.ts"],"names":["BottomSheetModalInternalContext","BottomSheetModalInternalProvider","Provider"],"mappings":";;;;;;;AAAA;;AAkBO,MAAMA,+BAA+B,gBAC1C,0BAA0D,IAA1D,CADK;;AAGA,MAAMC,gCAAgC,GAC3CD,+BAA+B,CAACE,QAD3B","sourcesContent":["import { createContext, Ref } from 'react';\nimport type { Insets } from 'react-native';\nimport type Animated from 'react-native-reanimated';\nimport type BottomSheet from '../../components/bottomSheet';\nimport type { BottomSheetModalStackBehavior } from '../../components/bottomSheetModal';\n\nexport interface BottomSheetModalInternalContextType {\n containerHeight: Animated.SharedValue;\n containerOffset: Animated.SharedValue>;\n mountSheet: (\n key: string,\n ref: Ref,\n stackBehavior: BottomSheetModalStackBehavior\n ) => void;\n unmountSheet: (key: string) => void;\n willUnmountSheet: (key: string) => void;\n}\n\nexport const BottomSheetModalInternalContext =\n createContext(null);\n\nexport const BottomSheetModalInternalProvider =\n BottomSheetModalInternalContext.Provider;\n"]} \ No newline at end of file diff --git a/lib/commonjs/hooks/index.js b/lib/commonjs/hooks/index.js deleted file mode 100644 index ce8107878..000000000 --- a/lib/commonjs/hooks/index.js +++ /dev/null @@ -1,134 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "useBottomSheet", { - enumerable: true, - get: function () { - return _useBottomSheet.useBottomSheet; - } -}); -Object.defineProperty(exports, "useBottomSheetInternal", { - enumerable: true, - get: function () { - return _useBottomSheetInternal.useBottomSheetInternal; - } -}); -Object.defineProperty(exports, "useBottomSheetModal", { - enumerable: true, - get: function () { - return _useBottomSheetModal.useBottomSheetModal; - } -}); -Object.defineProperty(exports, "useBottomSheetModalInternal", { - enumerable: true, - get: function () { - return _useBottomSheetModalInternal.useBottomSheetModalInternal; - } -}); -Object.defineProperty(exports, "useScrollable", { - enumerable: true, - get: function () { - return _useScrollable.useScrollable; - } -}); -Object.defineProperty(exports, "useScrollableSetter", { - enumerable: true, - get: function () { - return _useScrollableSetter.useScrollableSetter; - } -}); -Object.defineProperty(exports, "useScrollHandler", { - enumerable: true, - get: function () { - return _useScrollHandler.useScrollHandler; - } -}); -Object.defineProperty(exports, "useGestureHandler", { - enumerable: true, - get: function () { - return _useGestureHandler.useGestureHandler; - } -}); -Object.defineProperty(exports, "useGestureEventsHandlersDefault", { - enumerable: true, - get: function () { - return _useGestureEventsHandlersDefault.useGestureEventsHandlersDefault; - } -}); -Object.defineProperty(exports, "useKeyboard", { - enumerable: true, - get: function () { - return _useKeyboard.useKeyboard; - } -}); -Object.defineProperty(exports, "useStableCallback", { - enumerable: true, - get: function () { - return _useStableCallback.useStableCallback; - } -}); -Object.defineProperty(exports, "usePropsValidator", { - enumerable: true, - get: function () { - return _usePropsValidator.usePropsValidator; - } -}); -Object.defineProperty(exports, "useNormalizedSnapPoints", { - enumerable: true, - get: function () { - return _useNormalizedSnapPoints.useNormalizedSnapPoints; - } -}); -Object.defineProperty(exports, "useReactiveSharedValue", { - enumerable: true, - get: function () { - return _useReactiveSharedValue.useReactiveSharedValue; - } -}); -Object.defineProperty(exports, "useBottomSheetDynamicSnapPoints", { - enumerable: true, - get: function () { - return _useBottomSheetDynamicSnapPoints.useBottomSheetDynamicSnapPoints; - } -}); -Object.defineProperty(exports, "useBottomSheetGestureHandlers", { - enumerable: true, - get: function () { - return _useBottomSheetGestureHandlers.useBottomSheetGestureHandlers; - } -}); - -var _useBottomSheet = require("./useBottomSheet"); - -var _useBottomSheetInternal = require("./useBottomSheetInternal"); - -var _useBottomSheetModal = require("./useBottomSheetModal"); - -var _useBottomSheetModalInternal = require("./useBottomSheetModalInternal"); - -var _useScrollable = require("./useScrollable"); - -var _useScrollableSetter = require("./useScrollableSetter"); - -var _useScrollHandler = require("./useScrollHandler"); - -var _useGestureHandler = require("./useGestureHandler"); - -var _useGestureEventsHandlersDefault = require("./useGestureEventsHandlersDefault"); - -var _useKeyboard = require("./useKeyboard"); - -var _useStableCallback = require("./useStableCallback"); - -var _usePropsValidator = require("./usePropsValidator"); - -var _useNormalizedSnapPoints = require("./useNormalizedSnapPoints"); - -var _useReactiveSharedValue = require("./useReactiveSharedValue"); - -var _useBottomSheetDynamicSnapPoints = require("./useBottomSheetDynamicSnapPoints"); - -var _useBottomSheetGestureHandlers = require("./useBottomSheetGestureHandlers"); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/hooks/index.js.map b/lib/commonjs/hooks/index.js.map deleted file mode 100644 index d1453a553..000000000 --- a/lib/commonjs/hooks/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAGA;;AACA;;AAGA;;AACA;;AACA;;AAGA;;AACA;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA","sourcesContent":["export { useBottomSheet } from './useBottomSheet';\nexport { useBottomSheetInternal } from './useBottomSheetInternal';\n\n// modal\nexport { useBottomSheetModal } from './useBottomSheetModal';\nexport { useBottomSheetModalInternal } from './useBottomSheetModalInternal';\n\n// scrollable\nexport { useScrollable } from './useScrollable';\nexport { useScrollableSetter } from './useScrollableSetter';\nexport { useScrollHandler } from './useScrollHandler';\n\n// gestures\nexport { useGestureHandler } from './useGestureHandler';\nexport { useGestureEventsHandlersDefault } from './useGestureEventsHandlersDefault';\n\n// utilities\nexport { useKeyboard } from './useKeyboard';\nexport { useStableCallback } from './useStableCallback';\nexport { usePropsValidator } from './usePropsValidator';\nexport { useNormalizedSnapPoints } from './useNormalizedSnapPoints';\nexport { useReactiveSharedValue } from './useReactiveSharedValue';\nexport { useBottomSheetDynamicSnapPoints } from './useBottomSheetDynamicSnapPoints';\nexport { useBottomSheetGestureHandlers } from './useBottomSheetGestureHandlers';\n"]} \ No newline at end of file diff --git a/lib/commonjs/hooks/useBottomSheet.js b/lib/commonjs/hooks/useBottomSheet.js deleted file mode 100644 index 35c3ceb50..000000000 --- a/lib/commonjs/hooks/useBottomSheet.js +++ /dev/null @@ -1,23 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.useBottomSheet = void 0; - -var _react = require("react"); - -var _external = require("../contexts/external"); - -const useBottomSheet = () => { - const context = (0, _react.useContext)(_external.BottomSheetContext); - - if (context === null) { - throw "'useBottomSheet' cannot be used out of the BottomSheet!"; - } - - return context; -}; - -exports.useBottomSheet = useBottomSheet; -//# sourceMappingURL=useBottomSheet.js.map \ No newline at end of file diff --git a/lib/commonjs/hooks/useBottomSheet.js.map b/lib/commonjs/hooks/useBottomSheet.js.map deleted file mode 100644 index d28ec749d..000000000 --- a/lib/commonjs/hooks/useBottomSheet.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["useBottomSheet.ts"],"names":["useBottomSheet","context","BottomSheetContext"],"mappings":";;;;;;;AAAA;;AACA;;AAEO,MAAMA,cAAc,GAAG,MAAM;AAClC,QAAMC,OAAO,GAAG,uBAAWC,4BAAX,CAAhB;;AAEA,MAAID,OAAO,KAAK,IAAhB,EAAsB;AACpB,UAAM,yDAAN;AACD;;AAED,SAAOA,OAAP;AACD,CARM","sourcesContent":["import { useContext } from 'react';\nimport { BottomSheetContext } from '../contexts/external';\n\nexport const useBottomSheet = () => {\n const context = useContext(BottomSheetContext);\n\n if (context === null) {\n throw \"'useBottomSheet' cannot be used out of the BottomSheet!\";\n }\n\n return context;\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/hooks/useBottomSheetDynamicSnapPoints.js b/lib/commonjs/hooks/useBottomSheetDynamicSnapPoints.js deleted file mode 100644 index eab98ec21..000000000 --- a/lib/commonjs/hooks/useBottomSheetDynamicSnapPoints.js +++ /dev/null @@ -1,64 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.useBottomSheetDynamicSnapPoints = void 0; - -var _react = require("react"); - -var _reactNativeReanimated = require("react-native-reanimated"); - -var _constants = require("../components/bottomSheet/constants"); - -/** - * Provides dynamic content height calculating functionalities, by - * replacing the placeholder `CONTENT_HEIGHT` with calculated layout. - * @example - * [0, 'CONTENT_HEIGHT', '100%'] - * @param initialSnapPoints your snap point with content height placeholder. - * @returns { - * - animatedSnapPoints: an animated snap points to be set on `BottomSheet` or `BottomSheetModal`. - * - animatedHandleHeight: an animated handle height callback node to be set on `BottomSheet` or `BottomSheetModal`. - * - animatedContentHeight: an animated content height callback node to be set on `BottomSheet` or `BottomSheetModal`. - * - handleContentLayout: a `onLayout` callback method to be set on `BottomSheetView` component. - * } - * @deprecated will be deprecated in the next major release! please use the new introduce prop `enableDynamicSizing`. - */ -const useBottomSheetDynamicSnapPoints = initialSnapPoints => { - // variables - const animatedContentHeight = (0, _reactNativeReanimated.useSharedValue)(0); - const animatedHandleHeight = (0, _reactNativeReanimated.useSharedValue)(_constants.INITIAL_HANDLE_HEIGHT); - const animatedSnapPoints = (0, _reactNativeReanimated.useDerivedValue)(() => { - if (animatedHandleHeight.value === _constants.INITIAL_HANDLE_HEIGHT || animatedContentHeight.value === 0) { - return initialSnapPoints.map(() => _constants.INITIAL_SNAP_POINT); - } - - const contentWithHandleHeight = animatedContentHeight.value + animatedHandleHeight.value; - return initialSnapPoints.map(snapPoint => snapPoint === 'CONTENT_HEIGHT' ? contentWithHandleHeight : snapPoint); - }, []); - // callbacks - const handleContentLayout = (0, _react.useCallback)(({ - nativeEvent: { - layout: { - height - } - } - }) => { - animatedContentHeight.value = height; - }, [animatedContentHeight]); //#region effects - - (0, _react.useEffect)(() => { - console.warn('`useBottomSheetDynamicSnapPoints` will be deprecated in the next major release! please use the new introduce prop `enableDynamicSizing`.'); - }, []); //#endregion - - return { - animatedSnapPoints, - animatedHandleHeight, - animatedContentHeight, - handleContentLayout - }; -}; - -exports.useBottomSheetDynamicSnapPoints = useBottomSheetDynamicSnapPoints; -//# sourceMappingURL=useBottomSheetDynamicSnapPoints.js.map \ No newline at end of file diff --git a/lib/commonjs/hooks/useBottomSheetDynamicSnapPoints.js.map b/lib/commonjs/hooks/useBottomSheetDynamicSnapPoints.js.map deleted file mode 100644 index 2b08e6d6b..000000000 --- a/lib/commonjs/hooks/useBottomSheetDynamicSnapPoints.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["useBottomSheetDynamicSnapPoints.ts"],"names":["useBottomSheetDynamicSnapPoints","initialSnapPoints","animatedContentHeight","animatedHandleHeight","INITIAL_HANDLE_HEIGHT","animatedSnapPoints","value","map","INITIAL_SNAP_POINT","contentWithHandleHeight","snapPoint","handleContentLayout","nativeEvent","layout","height","console","warn"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,+BAA+B,GAC1CC,iBAD6C,IAE1C;AACH;AACA,QAAMC,qBAAqB,GAAG,2CAAe,CAAf,CAA9B;AACA,QAAMC,oBAAoB,GAAG,2CAAeC,gCAAf,CAA7B;AACA,QAAMC,kBAAkB,GAAG,4CAAgB,MAAM;AAC/C,QACEF,oBAAoB,CAACG,KAArB,KAA+BF,gCAA/B,IACAF,qBAAqB,CAACI,KAAtB,KAAgC,CAFlC,EAGE;AACA,aAAOL,iBAAiB,CAACM,GAAlB,CAAsB,MAAMC,6BAA5B,CAAP;AACD;;AACD,UAAMC,uBAAuB,GAC3BP,qBAAqB,CAACI,KAAtB,GAA8BH,oBAAoB,CAACG,KADrD;AAGA,WAAOL,iBAAiB,CAACM,GAAlB,CAAsBG,SAAS,IACpCA,SAAS,KAAK,gBAAd,GAAiCD,uBAAjC,GAA2DC,SADtD,CAAP;AAGD,GAb0B,EAaxB,EAbwB,CAA3B;AAoBA;AACA,QAAMC,mBAAmB,GAAG,wBAC1B,CAAC;AACCC,IAAAA,WAAW,EAAE;AACXC,MAAAA,MAAM,EAAE;AAAEC,QAAAA;AAAF;AADG;AADd,GAAD,KAIgC;AAC9BZ,IAAAA,qBAAqB,CAACI,KAAtB,GAA8BQ,MAA9B;AACD,GAPyB,EAQ1B,CAACZ,qBAAD,CAR0B,CAA5B,CAzBG,CAoCH;;AACA,wBAAU,MAAM;AACda,IAAAA,OAAO,CAACC,IAAR,CACE,0IADF;AAGD,GAJD,EAIG,EAJH,EArCG,CA0CH;;AACA,SAAO;AACLX,IAAAA,kBADK;AAELF,IAAAA,oBAFK;AAGLD,IAAAA,qBAHK;AAILS,IAAAA;AAJK,GAAP;AAMD,CAnDM","sourcesContent":["import { useCallback, useEffect } from 'react';\nimport { useDerivedValue, useSharedValue } from 'react-native-reanimated';\nimport {\n INITIAL_HANDLE_HEIGHT,\n INITIAL_SNAP_POINT,\n} from '../components/bottomSheet/constants';\n\n/**\n * Provides dynamic content height calculating functionalities, by\n * replacing the placeholder `CONTENT_HEIGHT` with calculated layout.\n * @example\n * [0, 'CONTENT_HEIGHT', '100%']\n * @param initialSnapPoints your snap point with content height placeholder.\n * @returns {\n * - animatedSnapPoints: an animated snap points to be set on `BottomSheet` or `BottomSheetModal`.\n * - animatedHandleHeight: an animated handle height callback node to be set on `BottomSheet` or `BottomSheetModal`.\n * - animatedContentHeight: an animated content height callback node to be set on `BottomSheet` or `BottomSheetModal`.\n * - handleContentLayout: a `onLayout` callback method to be set on `BottomSheetView` component.\n * }\n * @deprecated will be deprecated in the next major release! please use the new introduce prop `enableDynamicSizing`.\n */\nexport const useBottomSheetDynamicSnapPoints = (\n initialSnapPoints: Array\n) => {\n // variables\n const animatedContentHeight = useSharedValue(0);\n const animatedHandleHeight = useSharedValue(INITIAL_HANDLE_HEIGHT);\n const animatedSnapPoints = useDerivedValue(() => {\n if (\n animatedHandleHeight.value === INITIAL_HANDLE_HEIGHT ||\n animatedContentHeight.value === 0\n ) {\n return initialSnapPoints.map(() => INITIAL_SNAP_POINT);\n }\n const contentWithHandleHeight =\n animatedContentHeight.value + animatedHandleHeight.value;\n\n return initialSnapPoints.map(snapPoint =>\n snapPoint === 'CONTENT_HEIGHT' ? contentWithHandleHeight : snapPoint\n );\n }, []);\n\n type HandleContentLayoutProps = {\n nativeEvent: {\n layout: { height: number };\n };\n };\n // callbacks\n const handleContentLayout = useCallback(\n ({\n nativeEvent: {\n layout: { height },\n },\n }: HandleContentLayoutProps) => {\n animatedContentHeight.value = height;\n },\n [animatedContentHeight]\n );\n\n //#region effects\n useEffect(() => {\n console.warn(\n '`useBottomSheetDynamicSnapPoints` will be deprecated in the next major release! please use the new introduce prop `enableDynamicSizing`.'\n );\n }, []);\n //#endregion\n return {\n animatedSnapPoints,\n animatedHandleHeight,\n animatedContentHeight,\n handleContentLayout,\n };\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/hooks/useBottomSheetGestureHandlers.js b/lib/commonjs/hooks/useBottomSheetGestureHandlers.js deleted file mode 100644 index c0a4341cc..000000000 --- a/lib/commonjs/hooks/useBottomSheetGestureHandlers.js +++ /dev/null @@ -1,23 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.useBottomSheetGestureHandlers = void 0; - -var _react = require("react"); - -var _gesture = require("../contexts/gesture"); - -const useBottomSheetGestureHandlers = () => { - const context = (0, _react.useContext)(_gesture.BottomSheetGestureHandlersContext); - - if (context === null) { - throw "'useBottomSheetGestureHandlers' cannot be used out of the BottomSheet!"; - } - - return context; -}; - -exports.useBottomSheetGestureHandlers = useBottomSheetGestureHandlers; -//# sourceMappingURL=useBottomSheetGestureHandlers.js.map \ No newline at end of file diff --git a/lib/commonjs/hooks/useBottomSheetGestureHandlers.js.map b/lib/commonjs/hooks/useBottomSheetGestureHandlers.js.map deleted file mode 100644 index 335d2141e..000000000 --- a/lib/commonjs/hooks/useBottomSheetGestureHandlers.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["useBottomSheetGestureHandlers.ts"],"names":["useBottomSheetGestureHandlers","context","BottomSheetGestureHandlersContext"],"mappings":";;;;;;;AAAA;;AACA;;AAEO,MAAMA,6BAA6B,GAAG,MAAM;AACjD,QAAMC,OAAO,GAAG,uBAAWC,0CAAX,CAAhB;;AAEA,MAAID,OAAO,KAAK,IAAhB,EAAsB;AACpB,UAAM,wEAAN;AACD;;AAED,SAAOA,OAAP;AACD,CARM","sourcesContent":["import { useContext } from 'react';\nimport { BottomSheetGestureHandlersContext } from '../contexts/gesture';\n\nexport const useBottomSheetGestureHandlers = () => {\n const context = useContext(BottomSheetGestureHandlersContext);\n\n if (context === null) {\n throw \"'useBottomSheetGestureHandlers' cannot be used out of the BottomSheet!\";\n }\n\n return context;\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/hooks/useBottomSheetInternal.js b/lib/commonjs/hooks/useBottomSheetInternal.js deleted file mode 100644 index 1ba310a08..000000000 --- a/lib/commonjs/hooks/useBottomSheetInternal.js +++ /dev/null @@ -1,21 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.useBottomSheetInternal = useBottomSheetInternal; - -var _react = require("react"); - -var _internal = require("../contexts/internal"); - -function useBottomSheetInternal(unsafe) { - const context = (0, _react.useContext)(_internal.BottomSheetInternalContext); - - if (unsafe !== true && context === null) { - throw "'useBottomSheetInternal' cannot be used out of the BottomSheet!"; - } - - return context; -} -//# sourceMappingURL=useBottomSheetInternal.js.map \ No newline at end of file diff --git a/lib/commonjs/hooks/useBottomSheetInternal.js.map b/lib/commonjs/hooks/useBottomSheetInternal.js.map deleted file mode 100644 index c6b40bf10..000000000 --- a/lib/commonjs/hooks/useBottomSheetInternal.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["useBottomSheetInternal.ts"],"names":["useBottomSheetInternal","unsafe","context","BottomSheetInternalContext"],"mappings":";;;;;;;AAAA;;AACA;;AAaO,SAASA,sBAAT,CACLC,MADK,EAEkC;AACvC,QAAMC,OAAO,GAAG,uBAAWC,oCAAX,CAAhB;;AAEA,MAAIF,MAAM,KAAK,IAAX,IAAmBC,OAAO,KAAK,IAAnC,EAAyC;AACvC,UAAM,iEAAN;AACD;;AAED,SAAOA,OAAP;AACD","sourcesContent":["import { useContext } from 'react';\nimport {\n BottomSheetInternalContext,\n BottomSheetInternalContextType,\n} from '../contexts/internal';\n\nexport function useBottomSheetInternal(\n unsafe?: false\n): BottomSheetInternalContextType;\n\nexport function useBottomSheetInternal(\n unsafe: true\n): BottomSheetInternalContextType | null;\n\nexport function useBottomSheetInternal(\n unsafe?: boolean\n): BottomSheetInternalContextType | null {\n const context = useContext(BottomSheetInternalContext);\n\n if (unsafe !== true && context === null) {\n throw \"'useBottomSheetInternal' cannot be used out of the BottomSheet!\";\n }\n\n return context;\n}\n"]} \ No newline at end of file diff --git a/lib/commonjs/hooks/useBottomSheetModal.js b/lib/commonjs/hooks/useBottomSheetModal.js deleted file mode 100644 index d9d27bbec..000000000 --- a/lib/commonjs/hooks/useBottomSheetModal.js +++ /dev/null @@ -1,23 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.useBottomSheetModal = void 0; - -var _react = require("react"); - -var _contexts = require("../contexts"); - -const useBottomSheetModal = () => { - const context = (0, _react.useContext)(_contexts.BottomSheetModalContext); - - if (context === null) { - throw "'BottomSheetModalContext' cannot be null!"; - } - - return context; -}; - -exports.useBottomSheetModal = useBottomSheetModal; -//# sourceMappingURL=useBottomSheetModal.js.map \ No newline at end of file diff --git a/lib/commonjs/hooks/useBottomSheetModal.js.map b/lib/commonjs/hooks/useBottomSheetModal.js.map deleted file mode 100644 index c7368a8ad..000000000 --- a/lib/commonjs/hooks/useBottomSheetModal.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["useBottomSheetModal.ts"],"names":["useBottomSheetModal","context","BottomSheetModalContext"],"mappings":";;;;;;;AAAA;;AACA;;AAEO,MAAMA,mBAAmB,GAAG,MAAM;AACvC,QAAMC,OAAO,GAAG,uBAAWC,iCAAX,CAAhB;;AAEA,MAAID,OAAO,KAAK,IAAhB,EAAsB;AACpB,UAAM,2CAAN;AACD;;AAED,SAAOA,OAAP;AACD,CARM","sourcesContent":["import { useContext } from 'react';\nimport { BottomSheetModalContext } from '../contexts';\n\nexport const useBottomSheetModal = () => {\n const context = useContext(BottomSheetModalContext);\n\n if (context === null) {\n throw \"'BottomSheetModalContext' cannot be null!\";\n }\n\n return context;\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/hooks/useBottomSheetModalInternal.js b/lib/commonjs/hooks/useBottomSheetModalInternal.js deleted file mode 100644 index 9549a71ff..000000000 --- a/lib/commonjs/hooks/useBottomSheetModalInternal.js +++ /dev/null @@ -1,21 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.useBottomSheetModalInternal = useBottomSheetModalInternal; - -var _react = require("react"); - -var _contexts = require("../contexts"); - -function useBottomSheetModalInternal(unsafe) { - const context = (0, _react.useContext)(_contexts.BottomSheetModalInternalContext); - - if (unsafe !== true && context === null) { - throw "'BottomSheetModalInternalContext' cannot be null!"; - } - - return context; -} -//# sourceMappingURL=useBottomSheetModalInternal.js.map \ No newline at end of file diff --git a/lib/commonjs/hooks/useBottomSheetModalInternal.js.map b/lib/commonjs/hooks/useBottomSheetModalInternal.js.map deleted file mode 100644 index 9c1eee2db..000000000 --- a/lib/commonjs/hooks/useBottomSheetModalInternal.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["useBottomSheetModalInternal.ts"],"names":["useBottomSheetModalInternal","unsafe","context","BottomSheetModalInternalContext"],"mappings":";;;;;;;AAAA;;AACA;;AAaO,SAASA,2BAAT,CACLC,MADK,EAEuC;AAC5C,QAAMC,OAAO,GAAG,uBAAWC,yCAAX,CAAhB;;AAEA,MAAIF,MAAM,KAAK,IAAX,IAAmBC,OAAO,KAAK,IAAnC,EAAyC;AACvC,UAAM,mDAAN;AACD;;AAED,SAAOA,OAAP;AACD","sourcesContent":["import { useContext } from 'react';\nimport {\n BottomSheetModalInternalContext,\n BottomSheetModalInternalContextType,\n} from '../contexts';\n\nexport function useBottomSheetModalInternal(\n unsafe?: false\n): BottomSheetModalInternalContextType;\n\nexport function useBottomSheetModalInternal(\n unsafe: true\n): BottomSheetModalInternalContextType | null;\n\nexport function useBottomSheetModalInternal(\n unsafe?: boolean\n): BottomSheetModalInternalContextType | null {\n const context = useContext(BottomSheetModalInternalContext);\n\n if (unsafe !== true && context === null) {\n throw \"'BottomSheetModalInternalContext' cannot be null!\";\n }\n\n return context;\n}\n"]} \ No newline at end of file diff --git a/lib/commonjs/hooks/useBottomSheetSpringConfigs.js b/lib/commonjs/hooks/useBottomSheetSpringConfigs.js deleted file mode 100644 index ade007494..000000000 --- a/lib/commonjs/hooks/useBottomSheetSpringConfigs.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.useBottomSheetSpringConfigs = void 0; - -var _react = require("react"); - -/** - * Generate spring animation configs. - * @param configs overridable configs. - */ -const useBottomSheetSpringConfigs = configs => { - return (0, _react.useMemo)(() => configs, [configs]); -}; - -exports.useBottomSheetSpringConfigs = useBottomSheetSpringConfigs; -//# sourceMappingURL=useBottomSheetSpringConfigs.js.map \ No newline at end of file diff --git a/lib/commonjs/hooks/useBottomSheetSpringConfigs.js.map b/lib/commonjs/hooks/useBottomSheetSpringConfigs.js.map deleted file mode 100644 index bf456ed4c..000000000 --- a/lib/commonjs/hooks/useBottomSheetSpringConfigs.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["useBottomSheetSpringConfigs.ts"],"names":["useBottomSheetSpringConfigs","configs"],"mappings":";;;;;;;AAAA;;AAGA;AACA;AACA;AACA;AACO,MAAMA,2BAA2B,GACtCC,OADyC,IAEtC;AACH,SAAO,oBAAQ,MAAMA,OAAd,EAAuB,CAACA,OAAD,CAAvB,CAAP;AACD,CAJM","sourcesContent":["import { useMemo } from 'react';\nimport type { WithSpringConfig } from 'react-native-reanimated';\n\n/**\n * Generate spring animation configs.\n * @param configs overridable configs.\n */\nexport const useBottomSheetSpringConfigs = (\n configs: Omit\n) => {\n return useMemo(() => configs, [configs]);\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/hooks/useBottomSheetTimingConfigs.js b/lib/commonjs/hooks/useBottomSheetTimingConfigs.js deleted file mode 100644 index f1b6eb0d9..000000000 --- a/lib/commonjs/hooks/useBottomSheetTimingConfigs.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.useBottomSheetTimingConfigs = void 0; - -var _react = require("react"); - -var _constants = require("../constants"); - -/** - * Generate timing animation configs. - * @default - * - easing: Easing.out(Easing.exp) - * - duration 250 - * @param configs overridable configs. - */ -const useBottomSheetTimingConfigs = configs => { - return (0, _react.useMemo)(() => { - const _configs = { - easing: configs.easing || _constants.ANIMATION_EASING, - duration: configs.duration || _constants.ANIMATION_DURATION - }; - return _configs; - }, [configs.duration, configs.easing]); -}; - -exports.useBottomSheetTimingConfigs = useBottomSheetTimingConfigs; -//# sourceMappingURL=useBottomSheetTimingConfigs.js.map \ No newline at end of file diff --git a/lib/commonjs/hooks/useBottomSheetTimingConfigs.js.map b/lib/commonjs/hooks/useBottomSheetTimingConfigs.js.map deleted file mode 100644 index f817c745a..000000000 --- a/lib/commonjs/hooks/useBottomSheetTimingConfigs.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["useBottomSheetTimingConfigs.ts"],"names":["useBottomSheetTimingConfigs","configs","_configs","easing","ANIMATION_EASING","duration","ANIMATION_DURATION"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,2BAA2B,GAAIC,OAAD,IAA+B;AACxE,SAAO,oBAAQ,MAAM;AACnB,UAAMC,QAA0B,GAAG;AACjCC,MAAAA,MAAM,EAAEF,OAAO,CAACE,MAAR,IAAkBC,2BADO;AAEjCC,MAAAA,QAAQ,EAAEJ,OAAO,CAACI,QAAR,IAAoBC;AAFG,KAAnC;AAKA,WAAOJ,QAAP;AACD,GAPM,EAOJ,CAACD,OAAO,CAACI,QAAT,EAAmBJ,OAAO,CAACE,MAA3B,CAPI,CAAP;AAQD,CATM","sourcesContent":["import { useMemo } from 'react';\nimport type { WithTimingConfig } from 'react-native-reanimated';\nimport { ANIMATION_DURATION, ANIMATION_EASING } from '../constants';\n\n/**\n * Generate timing animation configs.\n * @default\n * - easing: Easing.out(Easing.exp)\n * - duration 250\n * @param configs overridable configs.\n */\nexport const useBottomSheetTimingConfigs = (configs: WithTimingConfig) => {\n return useMemo(() => {\n const _configs: WithTimingConfig = {\n easing: configs.easing || ANIMATION_EASING,\n duration: configs.duration || ANIMATION_DURATION,\n };\n\n return _configs;\n }, [configs.duration, configs.easing]);\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/hooks/useGestureEventsHandlersDefault.js b/lib/commonjs/hooks/useGestureEventsHandlersDefault.js deleted file mode 100644 index 59ec8343b..000000000 --- a/lib/commonjs/hooks/useGestureEventsHandlersDefault.js +++ /dev/null @@ -1,258 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.useGestureEventsHandlersDefault = void 0; - -var _reactNative = require("react-native"); - -var _reactNativeReanimated = require("react-native-reanimated"); - -var _useBottomSheetInternal = require("./useBottomSheetInternal"); - -var _constants = require("../constants"); - -var _clamp = require("../utilities/clamp"); - -var _snapPoint = require("../utilities/snapPoint"); - -const dismissKeyboard = _reactNative.Keyboard.dismiss; - -const useGestureEventsHandlersDefault = () => { - //#region variables - const { - animatedPosition, - animatedSnapPoints, - animatedKeyboardState, - animatedKeyboardHeight, - animatedContainerHeight, - animatedScrollableType, - animatedHighestSnapPoint, - animatedClosedPosition, - animatedScrollableContentOffsetY, - enableOverDrag, - enablePanDownToClose, - overDragResistanceFactor, - isInTemporaryPosition, - isScrollableRefreshable, - animateToPosition, - stopAnimation - } = (0, _useBottomSheetInternal.useBottomSheetInternal)(); //#endregion - //#region gesture methods - - const handleOnStart = (0, _reactNativeReanimated.useWorkletCallback)(function handleOnStart(__, _, context) { - // cancel current animation - stopAnimation(); // store current animated position - - context.initialPosition = animatedPosition.value; - context.initialKeyboardState = animatedKeyboardState.value; - /** - * if the scrollable content is scrolled, then - * we lock the position. - */ - - if (animatedScrollableContentOffsetY.value > 0) { - context.isScrollablePositionLocked = true; - } - }, [stopAnimation, animatedPosition, animatedKeyboardState, animatedScrollableContentOffsetY]); - const handleOnActive = (0, _reactNativeReanimated.useWorkletCallback)(function handleOnActive(source, { - translationY - }, context) { - let highestSnapPoint = animatedHighestSnapPoint.value; - /** - * if keyboard is shown, then we set the highest point to the current - * position which includes the keyboard height. - */ - - if (isInTemporaryPosition.value && context.initialKeyboardState === _constants.KEYBOARD_STATE.SHOWN) { - highestSnapPoint = context.initialPosition; - } - /** - * if current position is out of provided `snapPoints` and smaller then - * highest snap pont, then we set the highest point to the current position. - */ - - - if (isInTemporaryPosition.value && context.initialPosition < highestSnapPoint) { - highestSnapPoint = context.initialPosition; - } - - const lowestSnapPoint = enablePanDownToClose ? animatedContainerHeight.value : animatedSnapPoints.value[0]; - /** - * if scrollable is refreshable and sheet position at the highest - * point, then do not interact with current gesture. - */ - - if (source === _constants.GESTURE_SOURCE.SCROLLABLE && isScrollableRefreshable.value && animatedPosition.value === highestSnapPoint) { - return; - } - /** - * a negative scrollable content offset to be subtracted from accumulated - * current position and gesture translation Y to allow user to drag the sheet, - * when scrollable position at the top. - * a negative scrollable content offset when the scrollable is not locked. - */ - - - const negativeScrollableContentOffset = context.initialPosition === highestSnapPoint && source === _constants.GESTURE_SOURCE.SCROLLABLE || !context.isScrollablePositionLocked ? animatedScrollableContentOffsetY.value * -1 : 0; - /** - * an accumulated value of starting position with gesture translation y. - */ - - const draggedPosition = context.initialPosition + translationY; - /** - * an accumulated value of dragged position and negative scrollable content offset, - * this will insure locking sheet position when user is scrolling the scrollable until, - * they reach to the top of the scrollable. - */ - - const accumulatedDraggedPosition = draggedPosition + negativeScrollableContentOffset; - /** - * a clamped value of the accumulated dragged position, to insure keeping the dragged - * position between the highest and lowest snap points. - */ - - const clampedPosition = (0, _clamp.clamp)(accumulatedDraggedPosition, highestSnapPoint, lowestSnapPoint); - /** - * if scrollable position is locked and the animated position - * reaches the highest point, then we unlock the scrollable position. - */ - - if (context.isScrollablePositionLocked && source === _constants.GESTURE_SOURCE.SCROLLABLE && animatedPosition.value === highestSnapPoint) { - context.isScrollablePositionLocked = false; - } - /** - * over-drag implementation. - */ - - - if (enableOverDrag) { - if ((source === _constants.GESTURE_SOURCE.HANDLE || animatedScrollableType.value === _constants.SCROLLABLE_TYPE.VIEW) && draggedPosition < highestSnapPoint) { - const resistedPosition = highestSnapPoint - Math.sqrt(1 + (highestSnapPoint - draggedPosition)) * overDragResistanceFactor; - animatedPosition.value = resistedPosition; - return; - } - - if (source === _constants.GESTURE_SOURCE.HANDLE && draggedPosition > lowestSnapPoint) { - const resistedPosition = lowestSnapPoint + Math.sqrt(1 + (draggedPosition - lowestSnapPoint)) * overDragResistanceFactor; - animatedPosition.value = resistedPosition; - return; - } - - if (source === _constants.GESTURE_SOURCE.SCROLLABLE && draggedPosition + negativeScrollableContentOffset > lowestSnapPoint) { - const resistedPosition = lowestSnapPoint + Math.sqrt(1 + (draggedPosition + negativeScrollableContentOffset - lowestSnapPoint)) * overDragResistanceFactor; - animatedPosition.value = resistedPosition; - return; - } - } - - animatedPosition.value = clampedPosition; - }, [enableOverDrag, enablePanDownToClose, overDragResistanceFactor, isInTemporaryPosition, isScrollableRefreshable, animatedHighestSnapPoint, animatedContainerHeight, animatedSnapPoints, animatedPosition, animatedScrollableType, animatedScrollableContentOffsetY]); - const handleOnEnd = (0, _reactNativeReanimated.useWorkletCallback)(function handleOnEnd(source, { - translationY, - absoluteY, - velocityY - }, context) { - const highestSnapPoint = animatedHighestSnapPoint.value; - const isSheetAtHighestSnapPoint = animatedPosition.value === highestSnapPoint; - /** - * if scrollable is refreshable and sheet position at the highest - * point, then do not interact with current gesture. - */ - - if (source === _constants.GESTURE_SOURCE.SCROLLABLE && isScrollableRefreshable.value && isSheetAtHighestSnapPoint) { - return; - } - /** - * if the sheet is in a temporary position and the gesture ended above - * the current position, then we snap back to the temporary position. - */ - - - if (isInTemporaryPosition.value && context.initialPosition >= animatedPosition.value) { - if (context.initialPosition > animatedPosition.value) { - animateToPosition(context.initialPosition, _constants.ANIMATION_SOURCE.GESTURE, velocityY / 2); - } - - return; - } - /** - * close keyboard if current position is below the recorded - * start position and keyboard still shown. - */ - - - const isScrollable = animatedScrollableType.value !== _constants.SCROLLABLE_TYPE.UNDETERMINED && animatedScrollableType.value !== _constants.SCROLLABLE_TYPE.VIEW; - /** - * if keyboard is shown and the sheet is dragged down, - * then we dismiss the keyboard. - */ - - if (context.initialKeyboardState === _constants.KEYBOARD_STATE.SHOWN && animatedPosition.value > context.initialPosition) { - /** - * if the platform is ios, current content is scrollable and - * the end touch point is below the keyboard position then - * we exit the method. - * - * because the the keyboard dismiss is interactive in iOS. - */ - if (!(_reactNative.Platform.OS === 'ios' && isScrollable && absoluteY > _constants.WINDOW_HEIGHT - animatedKeyboardHeight.value)) { - (0, _reactNativeReanimated.runOnJS)(dismissKeyboard)(); - } - } - /** - * reset isInTemporaryPosition value - */ - - - if (isInTemporaryPosition.value) { - isInTemporaryPosition.value = false; - } - /** - * clone snap points array, and insert the container height - * if pan down to close is enabled. - */ - - - const snapPoints = animatedSnapPoints.value.slice(); - - if (enablePanDownToClose) { - snapPoints.unshift(animatedClosedPosition.value); - } - /** - * calculate the destination point, using redash. - */ - - - const destinationPoint = (0, _snapPoint.snapPoint)(translationY + context.initialPosition, velocityY, snapPoints); - /** - * if destination point is the same as the current position, - * then no need to perform animation. - */ - - if (destinationPoint === animatedPosition.value) { - return; - } - - const wasGestureHandledByScrollView = source === _constants.GESTURE_SOURCE.SCROLLABLE && animatedScrollableContentOffsetY.value > 0; - /** - * prevents snapping from top to middle / bottom with repeated interrupted scrolls - */ - - if (wasGestureHandledByScrollView && isSheetAtHighestSnapPoint) { - return; - } - - animateToPosition(destinationPoint, _constants.ANIMATION_SOURCE.GESTURE, velocityY / 2); - }, [enablePanDownToClose, isInTemporaryPosition, isScrollableRefreshable, animatedClosedPosition, animatedHighestSnapPoint, animatedKeyboardHeight, animatedPosition, animatedScrollableType, animatedSnapPoints, animatedScrollableContentOffsetY, animateToPosition]); //#endregion - - return { - handleOnStart, - handleOnActive, - handleOnEnd - }; -}; - -exports.useGestureEventsHandlersDefault = useGestureEventsHandlersDefault; -//# sourceMappingURL=useGestureEventsHandlersDefault.js.map \ No newline at end of file diff --git a/lib/commonjs/hooks/useGestureEventsHandlersDefault.js.map b/lib/commonjs/hooks/useGestureEventsHandlersDefault.js.map deleted file mode 100644 index a7ffb3391..000000000 --- a/lib/commonjs/hooks/useGestureEventsHandlersDefault.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["useGestureEventsHandlersDefault.tsx"],"names":["dismissKeyboard","Keyboard","dismiss","useGestureEventsHandlersDefault","animatedPosition","animatedSnapPoints","animatedKeyboardState","animatedKeyboardHeight","animatedContainerHeight","animatedScrollableType","animatedHighestSnapPoint","animatedClosedPosition","animatedScrollableContentOffsetY","enableOverDrag","enablePanDownToClose","overDragResistanceFactor","isInTemporaryPosition","isScrollableRefreshable","animateToPosition","stopAnimation","handleOnStart","__","_","context","initialPosition","value","initialKeyboardState","isScrollablePositionLocked","handleOnActive","source","translationY","highestSnapPoint","KEYBOARD_STATE","SHOWN","lowestSnapPoint","GESTURE_SOURCE","SCROLLABLE","negativeScrollableContentOffset","draggedPosition","accumulatedDraggedPosition","clampedPosition","HANDLE","SCROLLABLE_TYPE","VIEW","resistedPosition","Math","sqrt","handleOnEnd","absoluteY","velocityY","isSheetAtHighestSnapPoint","ANIMATION_SOURCE","GESTURE","isScrollable","UNDETERMINED","Platform","OS","WINDOW_HEIGHT","snapPoints","slice","unshift","destinationPoint","wasGestureHandledByScrollView"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AAWA;;AACA;;AAQA,MAAMA,eAAe,GAAGC,sBAASC,OAAjC;;AAEO,MAAMC,+BAA8D,GACzE,MAAM;AACJ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V;AACA;;;AACU,UAAMoC,gBAAgB,GAAG,0BACvB/B,YAAY,GAAGP,OAAO,CAACC,eADA,EAEvByB,SAFuB,EAGvBS,UAHuB,CAAzB;AAMA;AACV;AACA;AACA;;AACU,QAAIG,gBAAgB,KAAKzD,gBAAgB,CAACqB,KAA1C,EAAiD;AAC/C;AACD;;AAED,UAAMqC,6BAA6B,GACjCjC,MAAM,KAAKM,0BAAeC,UAA1B,IACAxB,gCAAgC,CAACa,KAAjC,GAAyC,CAF3C;AAGA;AACV;AACA;;AACU,QAAIqC,6BAA6B,IAAIZ,yBAArC,EAAgE;AAC9D;AACD;;AAEDhC,IAAAA,iBAAiB,CACf2C,gBADe,EAEfV,4BAAiBC,OAFF,EAGfH,SAAS,GAAG,CAHG,CAAjB;AAKD,GA1HH,EA2HE,CACEnC,oBADF,EAEEE,qBAFF,EAGEC,uBAHF,EAIEN,sBAJF,EAKED,wBALF,EAMEH,sBANF,EAOEH,gBAPF,EAQEK,sBARF,EASEJ,kBATF,EAUEO,gCAVF,EAWEM,iBAXF,CA3HF,CADF,CA3MI,CAqVJ;;AAEA,SAAO;AACLE,IAAAA,aADK;AAELQ,IAAAA,cAFK;AAGLmB,IAAAA;AAHK,GAAP;AAKD,CA7VI","sourcesContent":["import { Keyboard, Platform } from 'react-native';\nimport { runOnJS, useWorkletCallback } from 'react-native-reanimated';\nimport { useBottomSheetInternal } from './useBottomSheetInternal';\nimport {\n ANIMATION_SOURCE,\n GESTURE_SOURCE,\n KEYBOARD_STATE,\n SCROLLABLE_TYPE,\n WINDOW_HEIGHT,\n} from '../constants';\nimport type {\n GestureEventsHandlersHookType,\n GestureEventHandlerCallbackType,\n} from '../types';\nimport { clamp } from '../utilities/clamp';\nimport { snapPoint } from '../utilities/snapPoint';\n\ntype GestureEventContextType = {\n initialPosition: number;\n initialKeyboardState: KEYBOARD_STATE;\n isScrollablePositionLocked: boolean;\n};\n\nconst dismissKeyboard = Keyboard.dismiss;\n\nexport const useGestureEventsHandlersDefault: GestureEventsHandlersHookType =\n () => {\n //#region variables\n const {\n animatedPosition,\n animatedSnapPoints,\n animatedKeyboardState,\n animatedKeyboardHeight,\n animatedContainerHeight,\n animatedScrollableType,\n animatedHighestSnapPoint,\n animatedClosedPosition,\n animatedScrollableContentOffsetY,\n enableOverDrag,\n enablePanDownToClose,\n overDragResistanceFactor,\n isInTemporaryPosition,\n isScrollableRefreshable,\n animateToPosition,\n stopAnimation,\n } = useBottomSheetInternal();\n //#endregion\n\n //#region gesture methods\n const handleOnStart: GestureEventHandlerCallbackType =\n useWorkletCallback(\n function handleOnStart(__, _, context) {\n // cancel current animation\n stopAnimation();\n\n // store current animated position\n context.initialPosition = animatedPosition.value;\n context.initialKeyboardState = animatedKeyboardState.value;\n\n /**\n * if the scrollable content is scrolled, then\n * we lock the position.\n */\n if (animatedScrollableContentOffsetY.value > 0) {\n context.isScrollablePositionLocked = true;\n }\n },\n [\n stopAnimation,\n animatedPosition,\n animatedKeyboardState,\n animatedScrollableContentOffsetY,\n ]\n );\n const handleOnActive: GestureEventHandlerCallbackType =\n useWorkletCallback(\n function handleOnActive(source, { translationY }, context) {\n let highestSnapPoint = animatedHighestSnapPoint.value;\n\n /**\n * if keyboard is shown, then we set the highest point to the current\n * position which includes the keyboard height.\n */\n if (\n isInTemporaryPosition.value &&\n context.initialKeyboardState === KEYBOARD_STATE.SHOWN\n ) {\n highestSnapPoint = context.initialPosition;\n }\n\n /**\n * if current position is out of provided `snapPoints` and smaller then\n * highest snap pont, then we set the highest point to the current position.\n */\n if (\n isInTemporaryPosition.value &&\n context.initialPosition < highestSnapPoint\n ) {\n highestSnapPoint = context.initialPosition;\n }\n\n const lowestSnapPoint = enablePanDownToClose\n ? animatedContainerHeight.value\n : animatedSnapPoints.value[0];\n\n /**\n * if scrollable is refreshable and sheet position at the highest\n * point, then do not interact with current gesture.\n */\n if (\n source === GESTURE_SOURCE.SCROLLABLE &&\n isScrollableRefreshable.value &&\n animatedPosition.value === highestSnapPoint\n ) {\n return;\n }\n\n /**\n * a negative scrollable content offset to be subtracted from accumulated\n * current position and gesture translation Y to allow user to drag the sheet,\n * when scrollable position at the top.\n * a negative scrollable content offset when the scrollable is not locked.\n */\n const negativeScrollableContentOffset =\n (context.initialPosition === highestSnapPoint &&\n source === GESTURE_SOURCE.SCROLLABLE) ||\n !context.isScrollablePositionLocked\n ? animatedScrollableContentOffsetY.value * -1\n : 0;\n\n /**\n * an accumulated value of starting position with gesture translation y.\n */\n const draggedPosition = context.initialPosition + translationY;\n\n /**\n * an accumulated value of dragged position and negative scrollable content offset,\n * this will insure locking sheet position when user is scrolling the scrollable until,\n * they reach to the top of the scrollable.\n */\n const accumulatedDraggedPosition =\n draggedPosition + negativeScrollableContentOffset;\n\n /**\n * a clamped value of the accumulated dragged position, to insure keeping the dragged\n * position between the highest and lowest snap points.\n */\n const clampedPosition = clamp(\n accumulatedDraggedPosition,\n highestSnapPoint,\n lowestSnapPoint\n );\n\n /**\n * if scrollable position is locked and the animated position\n * reaches the highest point, then we unlock the scrollable position.\n */\n if (\n context.isScrollablePositionLocked &&\n source === GESTURE_SOURCE.SCROLLABLE &&\n animatedPosition.value === highestSnapPoint\n ) {\n context.isScrollablePositionLocked = false;\n }\n\n /**\n * over-drag implementation.\n */\n if (enableOverDrag) {\n if (\n (source === GESTURE_SOURCE.HANDLE ||\n animatedScrollableType.value === SCROLLABLE_TYPE.VIEW) &&\n draggedPosition < highestSnapPoint\n ) {\n const resistedPosition =\n highestSnapPoint -\n Math.sqrt(1 + (highestSnapPoint - draggedPosition)) *\n overDragResistanceFactor;\n animatedPosition.value = resistedPosition;\n return;\n }\n\n if (\n source === GESTURE_SOURCE.HANDLE &&\n draggedPosition > lowestSnapPoint\n ) {\n const resistedPosition =\n lowestSnapPoint +\n Math.sqrt(1 + (draggedPosition - lowestSnapPoint)) *\n overDragResistanceFactor;\n animatedPosition.value = resistedPosition;\n return;\n }\n\n if (\n source === GESTURE_SOURCE.SCROLLABLE &&\n draggedPosition + negativeScrollableContentOffset >\n lowestSnapPoint\n ) {\n const resistedPosition =\n lowestSnapPoint +\n Math.sqrt(\n 1 +\n (draggedPosition +\n negativeScrollableContentOffset -\n lowestSnapPoint)\n ) *\n overDragResistanceFactor;\n animatedPosition.value = resistedPosition;\n return;\n }\n }\n\n animatedPosition.value = clampedPosition;\n },\n [\n enableOverDrag,\n enablePanDownToClose,\n overDragResistanceFactor,\n isInTemporaryPosition,\n isScrollableRefreshable,\n animatedHighestSnapPoint,\n animatedContainerHeight,\n animatedSnapPoints,\n animatedPosition,\n animatedScrollableType,\n animatedScrollableContentOffsetY,\n ]\n );\n const handleOnEnd: GestureEventHandlerCallbackType =\n useWorkletCallback(\n function handleOnEnd(\n source,\n { translationY, absoluteY, velocityY },\n context\n ) {\n const highestSnapPoint = animatedHighestSnapPoint.value;\n const isSheetAtHighestSnapPoint =\n animatedPosition.value === highestSnapPoint;\n\n /**\n * if scrollable is refreshable and sheet position at the highest\n * point, then do not interact with current gesture.\n */\n if (\n source === GESTURE_SOURCE.SCROLLABLE &&\n isScrollableRefreshable.value &&\n isSheetAtHighestSnapPoint\n ) {\n return;\n }\n\n /**\n * if the sheet is in a temporary position and the gesture ended above\n * the current position, then we snap back to the temporary position.\n */\n if (\n isInTemporaryPosition.value &&\n context.initialPosition >= animatedPosition.value\n ) {\n if (context.initialPosition > animatedPosition.value) {\n animateToPosition(\n context.initialPosition,\n ANIMATION_SOURCE.GESTURE,\n velocityY / 2\n );\n }\n return;\n }\n\n /**\n * close keyboard if current position is below the recorded\n * start position and keyboard still shown.\n */\n const isScrollable =\n animatedScrollableType.value !== SCROLLABLE_TYPE.UNDETERMINED &&\n animatedScrollableType.value !== SCROLLABLE_TYPE.VIEW;\n\n /**\n * if keyboard is shown and the sheet is dragged down,\n * then we dismiss the keyboard.\n */\n if (\n context.initialKeyboardState === KEYBOARD_STATE.SHOWN &&\n animatedPosition.value > context.initialPosition\n ) {\n /**\n * if the platform is ios, current content is scrollable and\n * the end touch point is below the keyboard position then\n * we exit the method.\n *\n * because the the keyboard dismiss is interactive in iOS.\n */\n if (\n !(\n Platform.OS === 'ios' &&\n isScrollable &&\n absoluteY > WINDOW_HEIGHT - animatedKeyboardHeight.value\n )\n ) {\n runOnJS(dismissKeyboard)();\n }\n }\n\n /**\n * reset isInTemporaryPosition value\n */\n if (isInTemporaryPosition.value) {\n isInTemporaryPosition.value = false;\n }\n\n /**\n * clone snap points array, and insert the container height\n * if pan down to close is enabled.\n */\n const snapPoints = animatedSnapPoints.value.slice();\n if (enablePanDownToClose) {\n snapPoints.unshift(animatedClosedPosition.value);\n }\n\n /**\n * calculate the destination point, using redash.\n */\n const destinationPoint = snapPoint(\n translationY + context.initialPosition,\n velocityY,\n snapPoints\n );\n\n /**\n * if destination point is the same as the current position,\n * then no need to perform animation.\n */\n if (destinationPoint === animatedPosition.value) {\n return;\n }\n\n const wasGestureHandledByScrollView =\n source === GESTURE_SOURCE.SCROLLABLE &&\n animatedScrollableContentOffsetY.value > 0;\n /**\n * prevents snapping from top to middle / bottom with repeated interrupted scrolls\n */\n if (wasGestureHandledByScrollView && isSheetAtHighestSnapPoint) {\n return;\n }\n\n animateToPosition(\n destinationPoint,\n ANIMATION_SOURCE.GESTURE,\n velocityY / 2\n );\n },\n [\n enablePanDownToClose,\n isInTemporaryPosition,\n isScrollableRefreshable,\n animatedClosedPosition,\n animatedHighestSnapPoint,\n animatedKeyboardHeight,\n animatedPosition,\n animatedScrollableType,\n animatedSnapPoints,\n animatedScrollableContentOffsetY,\n animateToPosition,\n ]\n );\n //#endregion\n\n return {\n handleOnStart,\n handleOnActive,\n handleOnEnd,\n };\n };\n"]} \ No newline at end of file diff --git a/lib/commonjs/hooks/useGestureHandler.js b/lib/commonjs/hooks/useGestureHandler.js deleted file mode 100644 index 0753433c2..000000000 --- a/lib/commonjs/hooks/useGestureHandler.js +++ /dev/null @@ -1,82 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.useGestureHandler = void 0; - -var _reactNativeReanimated = require("react-native-reanimated"); - -var _reactNativeGestureHandler = require("react-native-gesture-handler"); - -var _constants = require("../constants"); - -const resetContext = context => { - 'worklet'; - - Object.keys(context).map(key => { - context[key] = undefined; - }); -}; - -const useGestureHandler = (type, state, gestureSource, handleOnStart, handleOnActive, handleOnEnd) => { - const gestureHandler = (0, _reactNativeReanimated.useAnimatedGestureHandler)({ - onActive: (payload, context) => { - if (!context.didStart) { - context.didStart = true; - state.value = _reactNativeGestureHandler.State.BEGAN; - gestureSource.value = type; - handleOnStart(type, payload, context); - return; - } - - if (gestureSource.value !== type) { - return; - } - - state.value = payload.state; - handleOnActive(type, payload, context); - }, - onEnd: (payload, context) => { - if (gestureSource.value !== type) { - return; - } - - state.value = payload.state; - gestureSource.value = _constants.GESTURE_SOURCE.UNDETERMINED; - handleOnEnd(type, payload, context); - resetContext(context); - }, - onCancel: (payload, context) => { - if (gestureSource.value !== type) { - return; - } - - state.value = payload.state; - gestureSource.value = _constants.GESTURE_SOURCE.UNDETERMINED; - resetContext(context); - }, - onFail: (payload, context) => { - if (gestureSource.value !== type) { - return; - } - - state.value = payload.state; - gestureSource.value = _constants.GESTURE_SOURCE.UNDETERMINED; - resetContext(context); - }, - onFinish: (payload, context) => { - if (gestureSource.value !== type) { - return; - } - - state.value = payload.state; - gestureSource.value = _constants.GESTURE_SOURCE.UNDETERMINED; - resetContext(context); - } - }, [type, state, handleOnStart, handleOnActive, handleOnEnd]); - return gestureHandler; -}; - -exports.useGestureHandler = useGestureHandler; -//# sourceMappingURL=useGestureHandler.js.map \ No newline at end of file diff --git a/lib/commonjs/hooks/useGestureHandler.js.map b/lib/commonjs/hooks/useGestureHandler.js.map deleted file mode 100644 index c144a1842..000000000 --- a/lib/commonjs/hooks/useGestureHandler.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["useGestureHandler.ts"],"names":["resetContext","context","Object","keys","map","key","undefined","useGestureHandler","type","state","gestureSource","handleOnStart","handleOnActive","handleOnEnd","gestureHandler","onActive","payload","didStart","value","State","BEGAN","onEnd","GESTURE_SOURCE","UNDETERMINED","onCancel","onFail","onFinish"],"mappings":";;;;;;;AAAA;;AACA;;AAIA;;AAMA,MAAMA,YAAY,GAAIC,OAAD,IAAkB;AACrC;;AAEAC,EAAAA,MAAM,CAACC,IAAP,CAAYF,OAAZ,EAAqBG,GAArB,CAAyBC,GAAG,IAAI;AAC9BJ,IAAAA,OAAO,CAACI,GAAD,CAAP,GAAeC,SAAf;AACD,GAFD;AAGD,CAND;;AAQO,MAAMC,iBAAiB,GAAG,CAC/BC,IAD+B,EAE/BC,KAF+B,EAG/BC,aAH+B,EAI/BC,aAJ+B,EAK/BC,cAL+B,EAM/BC,WAN+B,KAOsB;AACrD,QAAMC,cAAc,GAAG,sDAIrB;AACEC,IAAAA,QAAQ,EAAE,CAACC,OAAD,EAAUf,OAAV,KAAsB;AAC9B,UAAI,CAACA,OAAO,CAACgB,QAAb,EAAuB;AACrBhB,QAAAA,OAAO,CAACgB,QAAR,GAAmB,IAAnB;AAEAR,QAAAA,KAAK,CAACS,KAAN,GAAcC,iCAAMC,KAApB;AACAV,QAAAA,aAAa,CAACQ,KAAd,GAAsBV,IAAtB;AAEAG,QAAAA,aAAa,CAACH,IAAD,EAAOQ,OAAP,EAAgBf,OAAhB,CAAb;AACA;AACD;;AAED,UAAIS,aAAa,CAACQ,KAAd,KAAwBV,IAA5B,EAAkC;AAChC;AACD;;AAEDC,MAAAA,KAAK,CAACS,KAAN,GAAcF,OAAO,CAACP,KAAtB;AACAG,MAAAA,cAAc,CAACJ,IAAD,EAAOQ,OAAP,EAAgBf,OAAhB,CAAd;AACD,KAlBH;AAmBEoB,IAAAA,KAAK,EAAE,CAACL,OAAD,EAAUf,OAAV,KAAsB;AAC3B,UAAIS,aAAa,CAACQ,KAAd,KAAwBV,IAA5B,EAAkC;AAChC;AACD;;AAEDC,MAAAA,KAAK,CAACS,KAAN,GAAcF,OAAO,CAACP,KAAtB;AACAC,MAAA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animated';\nimport {\n State,\n PanGestureHandlerGestureEvent,\n} from 'react-native-gesture-handler';\nimport { GESTURE_SOURCE } from '../constants';\nimport type {\n GestureEventContextType,\n GestureEventHandlerCallbackType,\n} from '../types';\n\nconst resetContext = (context: any) => {\n 'worklet';\n\n Object.keys(context).map(key => {\n context[key] = undefined;\n });\n};\n\nexport const useGestureHandler = (\n type: GESTURE_SOURCE,\n state: Animated.SharedValue,\n gestureSource: Animated.SharedValue,\n handleOnStart: GestureEventHandlerCallbackType,\n handleOnActive: GestureEventHandlerCallbackType,\n handleOnEnd: GestureEventHandlerCallbackType\n): ((event: PanGestureHandlerGestureEvent) => void) => {\n const gestureHandler = useAnimatedGestureHandler<\n PanGestureHandlerGestureEvent,\n GestureEventContextType\n >(\n {\n onActive: (payload, context) => {\n if (!context.didStart) {\n context.didStart = true;\n\n state.value = State.BEGAN;\n gestureSource.value = type;\n\n handleOnStart(type, payload, context);\n return;\n }\n\n if (gestureSource.value !== type) {\n return;\n }\n\n state.value = payload.state;\n handleOnActive(type, payload, context);\n },\n onEnd: (payload, context) => {\n if (gestureSource.value !== type) {\n return;\n }\n\n state.value = payload.state;\n gestureSource.value = GESTURE_SOURCE.UNDETERMINED;\n\n handleOnEnd(type, payload, context);\n resetContext(context);\n },\n onCancel: (payload, context) => {\n if (gestureSource.value !== type) {\n return;\n }\n\n state.value = payload.state;\n gestureSource.value = GESTURE_SOURCE.UNDETERMINED;\n\n resetContext(context);\n },\n onFail: (payload, context) => {\n if (gestureSource.value !== type) {\n return;\n }\n\n state.value = payload.state;\n gestureSource.value = GESTURE_SOURCE.UNDETERMINED;\n\n resetContext(context);\n },\n onFinish: (payload, context) => {\n if (gestureSource.value !== type) {\n return;\n }\n\n state.value = payload.state;\n gestureSource.value = GESTURE_SOURCE.UNDETERMINED;\n\n resetContext(context);\n },\n },\n [type, state, handleOnStart, handleOnActive, handleOnEnd]\n );\n return gestureHandler;\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/hooks/useKeyboard.js b/lib/commonjs/hooks/useKeyboard.js deleted file mode 100644 index 7666a64dc..000000000 --- a/lib/commonjs/hooks/useKeyboard.js +++ /dev/null @@ -1,100 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.useKeyboard = void 0; - -var _react = require("react"); - -var _reactNative = require("react-native"); - -var _reactNativeReanimated = require("react-native-reanimated"); - -var _constants = require("../constants"); - -const KEYBOARD_EVENT_MAPPER = { - KEYBOARD_SHOW: _reactNative.Platform.select({ - ios: 'keyboardWillShow', - android: 'keyboardDidShow', - default: '' - }), - KEYBOARD_HIDE: _reactNative.Platform.select({ - ios: 'keyboardWillHide', - android: 'keyboardDidHide', - default: '' - }) -}; - -const useKeyboard = () => { - //#region variables - const shouldHandleKeyboardEvents = (0, _reactNativeReanimated.useSharedValue)(false); - const keyboardState = (0, _reactNativeReanimated.useSharedValue)(_constants.KEYBOARD_STATE.UNDETERMINED); - const keyboardHeight = (0, _reactNativeReanimated.useSharedValue)(0); - const keyboardAnimationEasing = (0, _reactNativeReanimated.useSharedValue)('keyboard'); - const keyboardAnimationDuration = (0, _reactNativeReanimated.useSharedValue)(500); - const temporaryCachedKeyboardEvent = (0, _reactNativeReanimated.useSharedValue)([]); //#endregion - //#region worklets - - const handleKeyboardEvent = (0, _reactNativeReanimated.useWorkletCallback)((state, height, duration, easing) => { - if (state === _constants.KEYBOARD_STATE.SHOWN && !shouldHandleKeyboardEvents.value) { - /** - * if the keyboard event was fired before the `onFocus` on TextInput, - * then we cache the input, and wait till the `shouldHandleKeyboardEvents` - * to be updated then fire this function again. - */ - temporaryCachedKeyboardEvent.value = [state, height, duration, easing]; - return; - } - - keyboardHeight.value = state === _constants.KEYBOARD_STATE.SHOWN ? height : height === 0 ? keyboardHeight.value : height; - keyboardAnimationDuration.value = duration; - keyboardAnimationEasing.value = easing; - keyboardState.value = state; - temporaryCachedKeyboardEvent.value = []; - }, []); //#endregion - //#region effects - - (0, _react.useEffect)(() => { - const handleOnKeyboardShow = event => { - (0, _reactNativeReanimated.runOnUI)(handleKeyboardEvent)(_constants.KEYBOARD_STATE.SHOWN, event.endCoordinates.height, event.duration, event.easing); - }; - - const handleOnKeyboardHide = event => { - (0, _reactNativeReanimated.runOnUI)(handleKeyboardEvent)(_constants.KEYBOARD_STATE.HIDDEN, event.endCoordinates.height, event.duration, event.easing); - }; - - const showSubscription = _reactNative.Keyboard.addListener(KEYBOARD_EVENT_MAPPER.KEYBOARD_SHOW, handleOnKeyboardShow); - - const hideSubscription = _reactNative.Keyboard.addListener(KEYBOARD_EVENT_MAPPER.KEYBOARD_HIDE, handleOnKeyboardHide); - - return () => { - showSubscription.remove(); - hideSubscription.remove(); - }; - }, [handleKeyboardEvent]); - /** - * This reaction is needed to handle the issue with multiline text input. - * - * @link https://github.com/gorhom/react-native-bottom-sheet/issues/411 - */ - - (0, _reactNativeReanimated.useAnimatedReaction)(() => shouldHandleKeyboardEvents.value, result => { - const params = temporaryCachedKeyboardEvent.value; - - if (result && params.length > 0) { - handleKeyboardEvent(params[0], params[1], params[2], params[3]); - } - }); //#endregion - - return { - state: keyboardState, - height: keyboardHeight, - animationEasing: keyboardAnimationEasing, - animationDuration: keyboardAnimationDuration, - shouldHandleKeyboardEvents - }; -}; - -exports.useKeyboard = useKeyboard; -//# sourceMappingURL=useKeyboard.js.map \ No newline at end of file diff --git a/lib/commonjs/hooks/useKeyboard.js.map b/lib/commonjs/hooks/useKeyboard.js.map deleted file mode 100644 index 62de18dd5..000000000 --- a/lib/commonjs/hooks/useKeyboard.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["useKeyboard.ts"],"names":["KEYBOARD_EVENT_MAPPER","KEYBOARD_SHOW","Platform","select","ios","android","default","KEYBOARD_HIDE","useKeyboard","shouldHandleKeyboardEvents","keyboardState","KEYBOARD_STATE","UNDETERMINED","keyboardHeight","keyboardAnimationEasing","keyboardAnimationDuration","temporaryCachedKeyboardEvent","handleKeyboardEvent","state","height","duration","easing","SHOWN","value","handleOnKeyboardShow","event","endCoordinates","handleOnKeyboardHide","HIDDEN","showSubscription","Keyboard","addListener","hideSubscription","remove","result","params","length","animationEasing","animationDuration"],"mappings":";;;;;;;AAAA;;AACA;;AAOA;;AAMA;;AAEA,MAAMA,qBAAqB,GAAG;AAC5BC,EAAAA,aAAa,EAAEC,sBAASC,MAAT,CAAgB;AAC7BC,IAAAA,GAAG,EAAE,kBADwB;AAE7BC,IAAAA,OAAO,EAAE,iBAFoB;AAG7BC,IAAAA,OAAO,EAAE;AAHoB,GAAhB,CADa;AAM5BC,EAAAA,aAAa,EAAEL,sBAASC,MAAT,CAAgB;AAC7BC,IAAAA,GAAG,EAAE,kBADwB;AAE7BC,IAAAA,OAAO,EAAE,iBAFoB;AAG7BC,IAAAA,OAAO,EAAE;AAHoB,GAAhB;AANa,CAA9B;;AAaO,MAAME,WAAW,GAAG,MAAM;AAC/B;AACA,QAAMC,0BAA0B,GAAG,2CAAe,KAAf,CAAnC;AACA,QAAMC,aAAa,GAAG,2CACpBC,0BAAeC,YADK,CAAtB;AAGA,QAAMC,cAAc,GAAG,2CAAe,CAAf,CAAvB;AACA,QAAMC,uBAAuB,GAC3B,2CAAoC,UAApC,CADF;AAEA,QAAMC,yBAAyB,GAAG,2CAAe,GAAf,CAAlC;AACA,QAAMC,4BAA4B,GAAG,2CAAoB,EAApB,CAArC,CAV+B,CAW/B;AAEA;;AACA,QAAMC,mBAAmB,GAAG,+CAC1B,CAACC,KAAD,EAAQC,MAAR,EAAgBC,QAAhB,EAA0BC,MAA1B,KAAqC;AACnC,QAAIH,KAAK,KAAKP,0BAAeW,KAAzB,IAAkC,CAACb,0BAA0B,CAACc,KAAlE,EAAyE;AACvE;AACR;AACA;AACA;AACA;AACQP,MAAAA,4BAA4B,CAACO,KAA7B,GAAqC,CAACL,KAAD,EAAQC,MAAR,EAAgBC,QAAhB,EAA0BC,MAA1B,CAArC;AACA;AACD;;AACDR,IAAAA,cAAc,CAACU,KAAf,GACEL,KA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IW,MAAM,IAAIC,MAAM,CAACC,MAAP,GAAgB,CAA9B,EAAiC;AAC/BnB,MAAAA,mBAAmB,CAACkB,MAAM,CAAC,CAAD,CAAP,EAAYA,MAAM,CAAC,CAAD,CAAlB,EAAuBA,MAAM,CAAC,CAAD,CAA7B,EAAkCA,MAAM,CAAC,CAAD,CAAxC,CAAnB;AACD;AACF,GAPH,EAhF+B,CAyF/B;;AAEA,SAAO;AACLjB,IAAAA,KAAK,EAAER,aADF;AAELS,IAAAA,MAAM,EAAEN,cAFH;AAGLwB,IAAAA,eAAe,EAAEvB,uBAHZ;AAILwB,IAAAA,iBAAiB,EAAEvB,yBAJd;AAKLN,IAAAA;AALK,GAAP;AAOD,CAlGM","sourcesContent":["import { useEffect } from 'react';\nimport {\n Keyboard,\n KeyboardEvent,\n KeyboardEventEasing,\n KeyboardEventName,\n Platform,\n} from 'react-native';\nimport {\n runOnUI,\n useAnimatedReaction,\n useSharedValue,\n useWorkletCallback,\n} from 'react-native-reanimated';\nimport { KEYBOARD_STATE } from '../constants';\n\nconst KEYBOARD_EVENT_MAPPER = {\n KEYBOARD_SHOW: Platform.select({\n ios: 'keyboardWillShow',\n android: 'keyboardDidShow',\n default: '',\n }) as KeyboardEventName,\n KEYBOARD_HIDE: Platform.select({\n ios: 'keyboardWillHide',\n android: 'keyboardDidHide',\n default: '',\n }) as KeyboardEventName,\n};\n\nexport const useKeyboard = () => {\n //#region variables\n const shouldHandleKeyboardEvents = useSharedValue(false);\n const keyboardState = useSharedValue(\n KEYBOARD_STATE.UNDETERMINED\n );\n const keyboardHeight = useSharedValue(0);\n const keyboardAnimationEasing =\n useSharedValue('keyboard');\n const keyboardAnimationDuration = useSharedValue(500);\n const temporaryCachedKeyboardEvent = useSharedValue([]);\n //#endregion\n\n //#region worklets\n const handleKeyboardEvent = useWorkletCallback(\n (state, height, duration, easing) => {\n if (state === KEYBOARD_STATE.SHOWN && !shouldHandleKeyboardEvents.value) {\n /**\n * if the keyboard event was fired before the `onFocus` on TextInput,\n * then we cache the input, and wait till the `shouldHandleKeyboardEvents`\n * to be updated then fire this function again.\n */\n temporaryCachedKeyboardEvent.value = [state, height, duration, easing];\n return;\n }\n keyboardHeight.value =\n state === KEYBOARD_STATE.SHOWN\n ? height\n : height === 0\n ? keyboardHeight.value\n : height;\n keyboardAnimationDuration.value = duration;\n keyboardAnimationEasing.value = easing;\n keyboardState.value = state;\n temporaryCachedKeyboardEvent.value = [];\n },\n []\n );\n //#endregion\n\n //#region effects\n useEffect(() => {\n const handleOnKeyboardShow = (event: KeyboardEvent) => {\n runOnUI(handleKeyboardEvent)(\n KEYBOARD_STATE.SHOWN,\n event.endCoordinates.height,\n event.duration,\n event.easing\n );\n };\n const handleOnKeyboardHide = (event: KeyboardEvent) => {\n runOnUI(handleKeyboardEvent)(\n KEYBOARD_STATE.HIDDEN,\n event.endCoordinates.height,\n event.duration,\n event.easing\n );\n };\n\n const showSubscription = Keyboard.addListener(\n KEYBOARD_EVENT_MAPPER.KEYBOARD_SHOW,\n handleOnKeyboardShow\n );\n\n const hideSubscription = Keyboard.addListener(\n KEYBOARD_EVENT_MAPPER.KEYBOARD_HIDE,\n handleOnKeyboardHide\n );\n\n return () => {\n showSubscription.remove();\n hideSubscription.remove();\n };\n }, [handleKeyboardEvent]);\n\n /**\n * This reaction is needed to handle the issue with multiline text input.\n *\n * @link https://github.com/gorhom/react-native-bottom-sheet/issues/411\n */\n useAnimatedReaction(\n () => shouldHandleKeyboardEvents.value,\n result => {\n const params = temporaryCachedKeyboardEvent.value;\n if (result && params.length > 0) {\n handleKeyboardEvent(params[0], params[1], params[2], params[3]);\n }\n }\n );\n //#endregion\n\n return {\n state: keyboardState,\n height: keyboardHeight,\n animationEasing: keyboardAnimationEasing,\n animationDuration: keyboardAnimationDuration,\n shouldHandleKeyboardEvents,\n };\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/hooks/useNormalizedSnapPoints.js b/lib/commonjs/hooks/useNormalizedSnapPoints.js deleted file mode 100644 index b24ea076f..000000000 --- a/lib/commonjs/hooks/useNormalizedSnapPoints.js +++ /dev/null @@ -1,58 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.useNormalizedSnapPoints = void 0; - -var _reactNativeReanimated = require("react-native-reanimated"); - -var _utilities = require("../utilities"); - -var _constants = require("../components/bottomSheet/constants"); - -/** - * Convert percentage snap points to pixels in screen and calculate - * the accurate snap points positions. - * @param snapPoints provided snap points. - * @param containerHeight BottomSheetContainer height. - * @param contentHeight content size. - * @param handleHeight handle size. - * @param enableDynamicSizing - * @param maxDynamicContentSize - * @returns {Animated.SharedValue} - */ -const useNormalizedSnapPoints = (snapPoints, containerHeight, contentHeight, handleHeight, enableDynamicSizing, maxDynamicContentSize) => { - const normalizedSnapPoints = (0, _reactNativeReanimated.useDerivedValue)(() => { - // early exit, if container layout is not ready - const isContainerLayoutReady = containerHeight.value !== _constants.INITIAL_CONTAINER_HEIGHT; - - if (!isContainerLayoutReady) { - return [_constants.INITIAL_SNAP_POINT]; - } - - const _snapPoints = snapPoints ? 'value' in snapPoints ? snapPoints.value : snapPoints : []; - - let _normalizedSnapPoints = _snapPoints.map(snapPoint => (0, _utilities.normalizeSnapPoint)(snapPoint, containerHeight.value)); - - if (enableDynamicSizing) { - if (handleHeight.value === _constants.INITIAL_HANDLE_HEIGHT) { - return [_constants.INITIAL_SNAP_POINT]; - } - - if (contentHeight.value === _constants.INITIAL_CONTAINER_HEIGHT) { - return [_constants.INITIAL_SNAP_POINT]; - } - - _normalizedSnapPoints.push(containerHeight.value - Math.min(contentHeight.value + handleHeight.value, maxDynamicContentSize !== undefined ? maxDynamicContentSize : containerHeight.value)); - - _normalizedSnapPoints = _normalizedSnapPoints.sort((a, b) => b - a); - } - - return _normalizedSnapPoints; - }, [snapPoints, enableDynamicSizing, maxDynamicContentSize]); - return normalizedSnapPoints; -}; - -exports.useNormalizedSnapPoints = useNormalizedSnapPoints; -//# sourceMappingURL=useNormalizedSnapPoints.js.map \ No newline at end of file diff --git a/lib/commonjs/hooks/useNormalizedSnapPoints.js.map b/lib/commonjs/hooks/useNormalizedSnapPoints.js.map deleted file mode 100644 index dcabb6660..000000000 --- a/lib/commonjs/hooks/useNormalizedSnapPoints.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["useNormalizedSnapPoints.ts"],"names":["useNormalizedSnapPoints","snapPoints","containerHeight","contentHeight","handleHeight","enableDynamicSizing","maxDynamicContentSize","normalizedSnapPoints","isContainerLayoutReady","value","INITIAL_CONTAINER_HEIGHT","INITIAL_SNAP_POINT","_snapPoints","_normalizedSnapPoints","map","snapPoint","INITIAL_HANDLE_HEIGHT","push","Math","min","undefined","sort","a","b"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,uBAAuB,GAAG,CACrCC,UADqC,EAErCC,eAFqC,EAGrCC,aAHqC,EAIrCC,YAJqC,EAKrCC,mBALqC,EAMrCC,qBANqC,KAOlC;AACH,QAAMC,oBAAoB,GAAG,4CAAgB,MAAM;AACjD;AACA,UAAMC,sBAAsB,GAC1BN,eAAe,CAACO,KAAhB,KAA0BC,mCAD5B;;AAEA,QAAI,CAACF,sBAAL,EAA6B;AAC3B,aAAO,CAACG,6BAAD,CAAP;AACD;;AAED,UAAMC,WAAW,GAAGX,UAAU,GAC1B,WAAWA,UAAX,GACEA,UAAU,CAACQ,KADb,GAEER,UAHwB,GAI1B,EAJJ;;AAMA,QAAIY,qBAAqB,GAAGD,WAAW,CAACE,GAAZ,CAAgBC,SAAS,IACnD,mCAAmBA,SAAnB,EAA8Bb,eAAe,CAACO,KAA9C,CAD0B,CAA5B;;AAIA,QAAIJ,mBAAJ,EAAyB;AACvB,UAAID,YAAY,CAACK,KAAb,KAAuBO,gCAA3B,EAAkD;AAChD,eAAO,CAACL,6BAAD,CAAP;AACD;;AAED,UAAIR,aAAa,CAACM,KAAd,KAAwBC,mCAA5B,EAAsD;AACpD,eAAO,CAACC,6BAAD,CAAP;AACD;;AAEDE,MAAAA,qBAAqB,CAACI,IAAtB,CACEf,eAAe,CAACO,KAAhB,GACES,IAAI,CAACC,GAAL,CACEhB,aAAa,CAACM,KAAd,GAAsBL,YAAY,CAACK,KADrC,EAEEH,qBAAqB,KAAKc,SAA1B,GACId,qBADJ,GAEIJ,eAAe,CAACO,KAJtB,CAFJ;;AAUAI,MAAAA,qBAAqB,GAAGA,qBAAqB,CAACQ,IAAtB,CAA2B,CAACC,CAAD,EAAIC,CAAJ,KAAUA,CAAC,GAAGD,CAAzC,CAAxB;AACD;;AACD,WAAOT,qBAAP;AACD,GAxC4B,EAwC1B,CAACZ,UAAD,EAAaI,mBAAb,EAAkCC,qBAAlC,CAxC0B,CAA7B;AA0CA,SAAOC,oBAAP;AACD,CAnDM","sourcesContent":["import Animated, { useDerivedValue } from 'react-native-reanimated';\nimport { normalizeSnapPoint } from '../utilities';\nimport type { BottomSheetProps } from '../components/bottomSheet';\nimport {\n INITIAL_CONTAINER_HEIGHT,\n INITIAL_HANDLE_HEIGHT,\n INITIAL_SNAP_POINT,\n} from '../components/bottomSheet/constants';\n\n/**\n * Convert percentage snap points to pixels in screen and calculate\n * the accurate snap points positions.\n * @param snapPoints provided snap points.\n * @param containerHeight BottomSheetContainer height.\n * @param contentHeight content size.\n * @param handleHeight handle size.\n * @param enableDynamicSizing\n * @param maxDynamicContentSize\n * @returns {Animated.SharedValue}\n */\nexport const useNormalizedSnapPoints = (\n snapPoints: BottomSheetProps['snapPoints'],\n containerHeight: Animated.SharedValue,\n contentHeight: Animated.SharedValue,\n handleHeight: Animated.SharedValue,\n enableDynamicSizing: BottomSheetProps['enableDynamicSizing'],\n maxDynamicContentSize: BottomSheetProps['maxDynamicContentSize']\n) => {\n const normalizedSnapPoints = useDerivedValue(() => {\n // early exit, if container layout is not ready\n const isContainerLayoutReady =\n containerHeight.value !== INITIAL_CONTAINER_HEIGHT;\n if (!isContainerLayoutReady) {\n return [INITIAL_SNAP_POINT];\n }\n\n const _snapPoints = snapPoints\n ? 'value' in snapPoints\n ? snapPoints.value\n : snapPoints\n : [];\n\n let _normalizedSnapPoints = _snapPoints.map(snapPoint =>\n normalizeSnapPoint(snapPoint, containerHeight.value)\n ) as number[];\n\n if (enableDynamicSizing) {\n if (handleHeight.value === INITIAL_HANDLE_HEIGHT) {\n return [INITIAL_SNAP_POINT];\n }\n\n if (contentHeight.value === INITIAL_CONTAINER_HEIGHT) {\n return [INITIAL_SNAP_POINT];\n }\n\n _normalizedSnapPoints.push(\n containerHeight.value -\n Math.min(\n contentHeight.value + handleHeight.value,\n maxDynamicContentSize !== undefined\n ? maxDynamicContentSize\n : containerHeight.value\n )\n );\n\n _normalizedSnapPoints = _normalizedSnapPoints.sort((a, b) => b - a);\n }\n return _normalizedSnapPoints;\n }, [snapPoints, enableDynamicSizing, maxDynamicContentSize]);\n\n return normalizedSnapPoints;\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/hooks/usePropsValidator.js b/lib/commonjs/hooks/usePropsValidator.js deleted file mode 100644 index ba3d109ce..000000000 --- a/lib/commonjs/hooks/usePropsValidator.js +++ /dev/null @@ -1,53 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.usePropsValidator = void 0; - -var _react = require("react"); - -var _invariant = _interopRequireDefault(require("invariant")); - -var _constants = require("../components/bottomSheet/constants"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * @todo - * replace this with `prop-types`. - */ -const usePropsValidator = ({ - index, - snapPoints, - enableDynamicSizing, - topInset, - bottomInset -}) => { - (0, _react.useMemo)(() => { - //#region snap points - const _snapPoints = snapPoints ? 'value' in snapPoints ? snapPoints.value : snapPoints : []; - - (0, _invariant.default)(_snapPoints || enableDynamicSizing, `'snapPoints' was not provided! please provide at least one snap point.`); - - _snapPoints.map(snapPoint => { - const _snapPoint = typeof snapPoint === 'number' ? snapPoint : parseInt(snapPoint.replace('%', ''), 10); - - (0, _invariant.default)(_snapPoint > 0 || _snapPoint === _constants.INITIAL_SNAP_POINT, `Snap point '${snapPoint}' is invalid. if you want to allow user to close the sheet, Please use 'enablePanDownToClose' prop.`); - }); - - (0, _invariant.default)('value' in _snapPoints || _snapPoints.length > 0 || enableDynamicSizing, `'snapPoints' was provided with no points! please provide at least one snap point.`); //#endregion - //#region index - - (0, _invariant.default)(typeof index === 'number' || typeof index === 'undefined', `'index' was provided but with wrong type ! expected type is a number.`); - (0, _invariant.default)(enableDynamicSizing || (typeof index === 'number' ? index >= -1 && index <= _snapPoints.length - 1 : true), `'index' was provided but out of the provided snap points range! expected value to be between -1, ${_snapPoints.length - 1}`); //#endregion - //#region insets - - (0, _invariant.default)(typeof topInset === 'number' || typeof topInset === 'undefined', `'topInset' was provided but with wrong type ! expected type is a number.`); - (0, _invariant.default)(typeof bottomInset === 'number' || typeof bottomInset === 'undefined', `'bottomInset' was provided but with wrong type ! expected type is a number.`); //#endregion - // animations - }, [index, snapPoints, topInset, bottomInset, enableDynamicSizing]); -}; - -exports.usePropsValidator = usePropsValidator; -//# sourceMappingURL=usePropsValidator.js.map \ No newline at end of file diff --git a/lib/commonjs/hooks/usePropsValidator.js.map b/lib/commonjs/hooks/usePropsValidator.js.map deleted file mode 100644 index 96572db4b..000000000 --- a/lib/commonjs/hooks/usePropsValidator.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["usePropsValidator.ts"],"names":["usePropsValidator","index","snapPoints","enableDynamicSizing","topInset","bottomInset","_snapPoints","value","map","snapPoint","_snapPoint","parseInt","replace","INITIAL_SNAP_POINT","length"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;AAGA;AACA;AACA;AACA;AAEO,MAAMA,iBAAiB,GAAG,CAAC;AAChCC,EAAAA,KADgC;AAEhCC,EAAAA,UAFgC;AAGhCC,EAAAA,mBAHgC;AAIhCC,EAAAA,QAJgC;AAKhCC,EAAAA;AALgC,CAAD,K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4DD,CAnEM","sourcesContent":["import { useMemo } from 'react';\nimport invariant from 'invariant';\nimport { INITIAL_SNAP_POINT } from '../components/bottomSheet/constants';\nimport type { BottomSheetProps } from '../components/bottomSheet';\n\n/**\n * @todo\n * replace this with `prop-types`.\n */\n\nexport const usePropsValidator = ({\n index,\n snapPoints,\n enableDynamicSizing,\n topInset,\n bottomInset,\n}: BottomSheetProps) => {\n useMemo(() => {\n //#region snap points\n const _snapPoints = snapPoints\n ? 'value' in snapPoints\n ? snapPoints.value\n : snapPoints\n : [];\n invariant(\n _snapPoints || enableDynamicSizing,\n `'snapPoints' was not provided! please provide at least one snap point.`\n );\n\n _snapPoints.map(snapPoint => {\n const _snapPoint =\n typeof snapPoint === 'number'\n ? snapPoint\n : parseInt(snapPoint.replace('%', ''), 10);\n\n invariant(\n _snapPoint > 0 || _snapPoint === INITIAL_SNAP_POINT,\n `Snap point '${snapPoint}' is invalid. if you want to allow user to close the sheet, Please use 'enablePanDownToClose' prop.`\n );\n });\n\n invariant(\n 'value' in _snapPoints || _snapPoints.length > 0 || enableDynamicSizing,\n `'snapPoints' was provided with no points! please provide at least one snap point.`\n );\n //#endregion\n\n //#region index\n invariant(\n typeof index === 'number' || typeof index === 'undefined',\n `'index' was provided but with wrong type ! expected type is a number.`\n );\n\n invariant(\n enableDynamicSizing ||\n (typeof index === 'number'\n ? index >= -1 && index <= _snapPoints.length - 1\n : true),\n `'index' was provided but out of the provided snap points range! expected value to be between -1, ${\n _snapPoints.length - 1\n }`\n );\n //#endregion\n\n //#region insets\n invariant(\n typeof topInset === 'number' || typeof topInset === 'undefined',\n `'topInset' was provided but with wrong type ! expected type is a number.`\n );\n invariant(\n typeof bottomInset === 'number' || typeof bottomInset === 'undefined',\n `'bottomInset' was provided but with wrong type ! expected type is a number.`\n );\n //#endregion\n\n // animations\n }, [index, snapPoints, topInset, bottomInset, enableDynamicSizing]);\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/hooks/useReactiveSharedValue.js b/lib/commonjs/hooks/useReactiveSharedValue.js deleted file mode 100644 index 080d3c28a..000000000 --- a/lib/commonjs/hooks/useReactiveSharedValue.js +++ /dev/null @@ -1,55 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.useReactiveSharedValue = void 0; - -var _react = require("react"); - -var _reactNativeReanimated = require("react-native-reanimated"); - -const useReactiveSharedValue = value => { - var _valueRef$current; - - const initialValueRef = (0, _react.useRef)(null); - const valueRef = (0, _react.useRef)(null); - - if (value && typeof value === 'object' && 'value' in value) { - /** - * if provided value is a shared value, - * then we do not initialize another one. - */ - } else if (valueRef.current === null) { - // @ts-ignore - initialValueRef.current = value; - /** - * if value is an object, then we need to - * pass a clone. - */ - - if (typeof value === 'object') { - // @ts-ignore - valueRef.current = (0, _reactNativeReanimated.makeMutable)({ ...value - }); - } else { - // @ts-ignore - valueRef.current = (0, _reactNativeReanimated.makeMutable)(value); - } - } else if (initialValueRef.current !== value) { - valueRef.current.value = value; - } - - (0, _react.useEffect)(() => { - return () => { - if (valueRef.current) { - (0, _reactNativeReanimated.cancelAnimation)(valueRef.current); - } - }; - }, []); // @ts-ignore - - return (_valueRef$current = valueRef.current) !== null && _valueRef$current !== void 0 ? _valueRef$current : value; -}; - -exports.useReactiveSharedValue = useReactiveSharedValue; -//# sourceMappingURL=useReactiveSharedValue.js.map \ No newline at end of file diff --git a/lib/commonjs/hooks/useReactiveSharedValue.js.map b/lib/commonjs/hooks/useReactiveSharedValue.js.map deleted file mode 100644 index 17c2ad0c4..000000000 --- a/lib/commonjs/hooks/useReactiveSharedValue.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["useReactiveSharedValue.ts"],"names":["useReactiveSharedValue","value","initialValueRef","valueRef","current"],"mappings":";;;;;;;AAAA;;AACA;;AAMO,MAAMA,sBAAsB,GACjCC,KADoC,IAEkB;AAAA;;AACtD,QAAMC,eAAe,GAAG,mBAAU,IAAV,CAAxB;AACA,QAAMC,QAAQ,GAAG,mBAAgC,IAAhC,CAAjB;;AAEA,MAAIF,KAAK,IAAI,OAAOA,KAAP,KAAiB,QAA1B,IAAsC,WAAWA,KAArD,EAA4D;AAC1D;AACJ;AACA;AACA;AACG,GALD,MAKO,IAAIE,QAAQ,CAACC,OAAT,KAAqB,IAAzB,EAA+B;AACpC;AACAF,IAAAA,eAAe,CAACE,OAAhB,GAA0BH,KAA1B;AACA;AACJ;AACA;AACA;;AACI,QAAI,OAAOA,KAAP,KAAiB,QAArB,EAA+B;AAC7B;AACAE,MAAAA,QAAQ,CAACC,OAAT,GAAmB,wCAAY,EAAE,GAAGH;AAAL,OAAZ,CAAnB;AACD,KAHD,MAGO;AACL;AACAE,MAAAA,QAAQ,CAACC,OAAT,GAAmB,wCAAYH,KAAZ,CAAnB;AACD;AACF,GAdM,MAcA,IAAIC,eAAe,CAACE,OAAhB,KAA4BH,KAAhC,EAAuC;AAC5CE,IAAAA,QAAQ,CAACC,OAAT,CAAiBH,KAAjB,GAAyBA,KAAzB;AACD;;AAED,wBAAU,MAAM;AACd,WAAO,MAAM;AACX,UAAIE,QAAQ,CAACC,OAAb,EAAsB;AACpB,oDAAgBD,QAAQ,CAACC,OAAzB;AACD;AACF,KAJD;AAKD,GAND,EAMG,EANH,EA3BsD,CAmCtD;;AACA,8BAAOD,QAAQ,CAACC,OAAhB,iEAA2BH,KAA3B;AACD,CAvCM","sourcesContent":["import { useEffect, useRef } from 'react';\nimport Animated, {\n cancelAnimation,\n makeMutable,\n} from 'react-native-reanimated';\nimport type { Primitive } from '../types';\n\nexport const useReactiveSharedValue = (\n value: T\n): T extends Primitive ? Animated.SharedValue : T => {\n const initialValueRef = useRef(null);\n const valueRef = useRef>(null);\n\n if (value && typeof value === 'object' && 'value' in value) {\n /**\n * if provided value is a shared value,\n * then we do not initialize another one.\n */\n } else if (valueRef.current === null) {\n // @ts-ignore\n initialValueRef.current = value;\n /**\n * if value is an object, then we need to\n * pass a clone.\n */\n if (typeof value === 'object') {\n // @ts-ignore\n valueRef.current = makeMutable({ ...value });\n } else {\n // @ts-ignore\n valueRef.current = makeMutable(value);\n }\n } else if (initialValueRef.current !== value) {\n valueRef.current.value = value as T;\n }\n\n useEffect(() => {\n return () => {\n if (valueRef.current) {\n cancelAnimation(valueRef.current);\n }\n };\n }, []);\n\n // @ts-ignore\n return valueRef.current ?? value;\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/hooks/useScrollEventsHandlersDefault.js b/lib/commonjs/hooks/useScrollEventsHandlersDefault.js deleted file mode 100644 index ce3a22563..000000000 --- a/lib/commonjs/hooks/useScrollEventsHandlersDefault.js +++ /dev/null @@ -1,111 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.useScrollEventsHandlersDefault = void 0; - -var _reactNativeReanimated = require("react-native-reanimated"); - -var _useBottomSheetInternal = require("./useBottomSheetInternal"); - -var _constants = require("../constants"); - -const useScrollEventsHandlersDefault = (scrollableRef, scrollableContentOffsetY) => { - // hooks - const { - animatedSheetState, - animatedScrollableState, - animatedAnimationState, - animatedScrollableContentOffsetY: rootScrollableContentOffsetY - } = (0, _useBottomSheetInternal.useBottomSheetInternal)(); //#region callbacks - - const handleOnScroll = (0, _reactNativeReanimated.useWorkletCallback)((_, context) => { - /** - * if sheet position is extended or fill parent, then we reset - * `shouldLockInitialPosition` value to false. - */ - if (animatedSheetState.value === _constants.SHEET_STATE.EXTENDED || animatedSheetState.value === _constants.SHEET_STATE.FILL_PARENT) { - context.shouldLockInitialPosition = false; - } - - if (animatedScrollableState.value === _constants.SCROLLABLE_STATE.LOCKED) { - var _context$initialConte; - - const lockPosition = context.shouldLockInitialPosition ? (_context$initialConte = context.initialContentOffsetY) !== null && _context$initialConte !== void 0 ? _context$initialConte : 0 : 0; // @ts-ignore - - (0, _reactNativeReanimated.scrollTo)(scrollableRef, 0, lockPosition, false); - scrollableContentOffsetY.value = lockPosition; - return; - } - }, [scrollableRef, scrollableContentOffsetY, animatedScrollableState, animatedSheetState]); - const handleOnBeginDrag = (0, _reactNativeReanimated.useWorkletCallback)(({ - contentOffset: { - y - } - }, context) => { - scrollableContentOffsetY.value = y; - rootScrollableContentOffsetY.value = y; - context.initialContentOffsetY = y; - /** - * if sheet position not extended or fill parent and the scrollable position - * not at the top, then we should lock the initial scrollable position. - */ - - if (animatedSheetState.value !== _constants.SHEET_STATE.EXTENDED && animatedSheetState.value !== _constants.SHEET_STATE.FILL_PARENT && y > 0) { - context.shouldLockInitialPosition = true; - } else { - context.shouldLockInitialPosition = false; - } - }, [scrollableContentOffsetY, animatedSheetState, rootScrollableContentOffsetY]); - const handleOnEndDrag = (0, _reactNativeReanimated.useWorkletCallback)(({ - contentOffset: { - y - } - }, context) => { - if (animatedScrollableState.value === _constants.SCROLLABLE_STATE.LOCKED) { - var _context$initialConte2; - - const lockPosition = context.shouldLockInitialPosition ? (_context$initialConte2 = context.initialContentOffsetY) !== null && _context$initialConte2 !== void 0 ? _context$initialConte2 : 0 : 0; // @ts-ignore - - (0, _reactNativeReanimated.scrollTo)(scrollableRef, 0, lockPosition, false); - scrollableContentOffsetY.value = lockPosition; - return; - } - - if (animatedAnimationState.value !== _constants.ANIMATION_STATE.RUNNING) { - scrollableContentOffsetY.value = y; - rootScrollableContentOffsetY.value = y; - } - }, [scrollableRef, scrollableContentOffsetY, animatedAnimationState, animatedScrollableState, rootScrollableContentOffsetY]); - const handleOnMomentumEnd = (0, _reactNativeReanimated.useWorkletCallback)(({ - contentOffset: { - y - } - }, context) => { - if (animatedScrollableState.value === _constants.SCROLLABLE_STATE.LOCKED) { - var _context$initialConte3; - - const lockPosition = context.shouldLockInitialPosition ? (_context$initialConte3 = context.initialContentOffsetY) !== null && _context$initialConte3 !== void 0 ? _context$initialConte3 : 0 : 0; // @ts-ignore - - (0, _reactNativeReanimated.scrollTo)(scrollableRef, 0, lockPosition, false); - scrollableContentOffsetY.value = 0; - return; - } - - if (animatedAnimationState.value !== _constants.ANIMATION_STATE.RUNNING) { - scrollableContentOffsetY.value = y; - rootScrollableContentOffsetY.value = y; - } - }, [scrollableContentOffsetY, scrollableRef, animatedAnimationState, animatedScrollableState, rootScrollableContentOffsetY]); //#endregion - - return { - handleOnScroll, - handleOnBeginDrag, - handleOnEndDrag, - handleOnMomentumEnd - }; -}; - -exports.useScrollEventsHandlersDefault = useScrollEventsHandlersDefault; -//# sourceMappingURL=useScrollEventsHandlersDefault.js.map \ No newline at end of file diff --git a/lib/commonjs/hooks/useScrollEventsHandlersDefault.js.map b/lib/commonjs/hooks/useScrollEventsHandlersDefault.js.map deleted file mode 100644 index 114683a57..000000000 --- a/lib/commonjs/hooks/useScrollEventsHandlersDefault.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["useScrollEventsHandlersDefault.ts"],"names":["useScrollEventsHandlersDefault","scrollableRef","scrollableContentOffsetY","animatedSheetState","animatedScrollableState","animatedAnimationState","animatedScrollableContentOffsetY","rootScrollableContentOffsetY","handleOnScroll","_","context","value","SHEET_STATE","EXTENDED","FILL_PARENT","shouldLockInitialPosition","SCROLLABLE_STATE","LOCKED","lockPosition","initialContentOffsetY","handleOnBeginDrag","contentOffset","y","handleOnEndDrag","ANIMATION_STATE","RUNNING","handleOnMomentumEnd"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAWO,MAAMA,8BAA4D,GAAG,CAC1EC,aAD0E,EAE1EC,wBAF0E,KAGvE;AACH;AACA,QAAM;AACJC,IAAAA,kBADI;AAEJC,IAAAA,uBAFI;AAGJC,IAAAA,sBAHI;AAIJC,IAAAA,gCAAgC,EAAEC;AAJ9B,MAKF,qDALJ,CAFG,CASH;;AACA,QAAMC,cAAsE,GAC1E,+CACE,CAACC,CAAD,EAAIC,OAAJ,KAAgB;AACd;AACR;AACA;AACA;AACQ,QACEP,kBAAkB,CAACQ,KAAnB,KAA6BC,uBAAYC,QAAzC,IACAV,kBAAkB,CAACQ,KAAnB,KAA6BC,uBAAYE,WAF3C,EAGE;AACAJ,MAAAA,OAAO,CAACK,yBAAR,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F,CAhBF,CADF,CA7FG,CAsHH;;AAEA,SAAO;AACLC,IAAAA,cADK;AAELY,IAAAA,iBAFK;AAGLG,IAAAA,eAHK;AAILG,IAAAA;AAJK,GAAP;AAMD,CAjIM","sourcesContent":["import { scrollTo, useWorkletCallback } from 'react-native-reanimated';\nimport { useBottomSheetInternal } from './useBottomSheetInternal';\nimport { ANIMATION_STATE, SCROLLABLE_STATE, SHEET_STATE } from '../constants';\nimport type {\n ScrollEventsHandlersHookType,\n ScrollEventHandlerCallbackType,\n} from '../types';\n\nexport type ScrollEventContextType = {\n initialContentOffsetY: number;\n shouldLockInitialPosition: boolean;\n};\n\nexport const useScrollEventsHandlersDefault: ScrollEventsHandlersHookType = (\n scrollableRef,\n scrollableContentOffsetY\n) => {\n // hooks\n const {\n animatedSheetState,\n animatedScrollableState,\n animatedAnimationState,\n animatedScrollableContentOffsetY: rootScrollableContentOffsetY,\n } = useBottomSheetInternal();\n\n //#region callbacks\n const handleOnScroll: ScrollEventHandlerCallbackType =\n useWorkletCallback(\n (_, context) => {\n /**\n * if sheet position is extended or fill parent, then we reset\n * `shouldLockInitialPosition` value to false.\n */\n if (\n animatedSheetState.value === SHEET_STATE.EXTENDED ||\n animatedSheetState.value === SHEET_STATE.FILL_PARENT\n ) {\n context.shouldLockInitialPosition = false;\n }\n\n if (animatedScrollableState.value === SCROLLABLE_STATE.LOCKED) {\n const lockPosition = context.shouldLockInitialPosition\n ? context.initialContentOffsetY ?? 0\n : 0;\n // @ts-ignore\n scrollTo(scrollableRef, 0, lockPosition, false);\n scrollableContentOffsetY.value = lockPosition;\n return;\n }\n },\n [\n scrollableRef,\n scrollableContentOffsetY,\n animatedScrollableState,\n animatedSheetState,\n ]\n );\n const handleOnBeginDrag: ScrollEventHandlerCallbackType =\n useWorkletCallback(\n ({ contentOffset: { y } }, context) => {\n scrollableContentOffsetY.value = y;\n rootScrollableContentOffsetY.value = y;\n context.initialContentOffsetY = y;\n\n /**\n * if sheet position not extended or fill parent and the scrollable position\n * not at the top, then we should lock the initial scrollable position.\n */\n if (\n animatedSheetState.value !== SHEET_STATE.EXTENDED &&\n animatedSheetState.value !== SHEET_STATE.FILL_PARENT &&\n y > 0\n ) {\n context.shouldLockInitialPosition = true;\n } else {\n context.shouldLockInitialPosition = false;\n }\n },\n [\n scrollableContentOffsetY,\n animatedSheetState,\n rootScrollableContentOffsetY,\n ]\n );\n const handleOnEndDrag: ScrollEventHandlerCallbackType =\n useWorkletCallback(\n ({ contentOffset: { y } }, context) => {\n if (animatedScrollableState.value === SCROLLABLE_STATE.LOCKED) {\n const lockPosition = context.shouldLockInitialPosition\n ? context.initialContentOffsetY ?? 0\n : 0;\n // @ts-ignore\n scrollTo(scrollableRef, 0, lockPosition, false);\n scrollableContentOffsetY.value = lockPosition;\n return;\n }\n if (animatedAnimationState.value !== ANIMATION_STATE.RUNNING) {\n scrollableContentOffsetY.value = y;\n rootScrollableContentOffsetY.value = y;\n }\n },\n [\n scrollableRef,\n scrollableContentOffsetY,\n animatedAnimationState,\n animatedScrollableState,\n rootScrollableContentOffsetY,\n ]\n );\n const handleOnMomentumEnd: ScrollEventHandlerCallbackType =\n useWorkletCallback(\n ({ contentOffset: { y } }, context) => {\n if (animatedScrollableState.value === SCROLLABLE_STATE.LOCKED) {\n const lockPosition = context.shouldLockInitialPosition\n ? context.initialContentOffsetY ?? 0\n : 0;\n // @ts-ignore\n scrollTo(scrollableRef, 0, lockPosition, false);\n scrollableContentOffsetY.value = 0;\n return;\n }\n if (animatedAnimationState.value !== ANIMATION_STATE.RUNNING) {\n scrollableContentOffsetY.value = y;\n rootScrollableContentOffsetY.value = y;\n }\n },\n [\n scrollableContentOffsetY,\n scrollableRef,\n animatedAnimationState,\n animatedScrollableState,\n rootScrollableContentOffsetY,\n ]\n );\n //#endregion\n\n return {\n handleOnScroll,\n handleOnBeginDrag,\n handleOnEndDrag,\n handleOnMomentumEnd,\n };\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/hooks/useScrollHandler.js b/lib/commonjs/hooks/useScrollHandler.js deleted file mode 100644 index 51864de15..000000000 --- a/lib/commonjs/hooks/useScrollHandler.js +++ /dev/null @@ -1,67 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.useScrollHandler = void 0; - -var _reactNativeReanimated = require("react-native-reanimated"); - -var _useScrollEventsHandlersDefault = require("./useScrollEventsHandlersDefault"); - -var _utilities = require("../utilities"); - -const useScrollHandler = (useScrollEventsHandlers = _useScrollEventsHandlersDefault.useScrollEventsHandlersDefault, onScroll, onScrollBeginDrag, onScrollEndDrag) => { - // refs - const scrollableRef = (0, _reactNativeReanimated.useAnimatedRef)(); // variables - - const scrollableContentOffsetY = (0, _reactNativeReanimated.useSharedValue)(0); // hooks - - const { - handleOnScroll = _utilities.workletNoop, - handleOnBeginDrag = _utilities.workletNoop, - handleOnEndDrag = _utilities.workletNoop, - handleOnMomentumEnd = _utilities.workletNoop, - handleOnMomentumBegin = _utilities.workletNoop - } = useScrollEventsHandlers(scrollableRef, scrollableContentOffsetY); // callbacks - - const scrollHandler = (0, _reactNativeReanimated.useAnimatedScrollHandler)({ - onScroll: (event, context) => { - handleOnScroll(event, context); - - if (onScroll) { - (0, _reactNativeReanimated.runOnJS)(onScroll)({ - nativeEvent: event - }); - } - }, - onBeginDrag: (event, context) => { - handleOnBeginDrag(event, context); - - if (onScrollBeginDrag) { - (0, _reactNativeReanimated.runOnJS)(onScrollBeginDrag)({ - nativeEvent: event - }); - } - }, - onEndDrag: (event, context) => { - handleOnEndDrag(event, context); - - if (onScrollEndDrag) { - (0, _reactNativeReanimated.runOnJS)(onScrollEndDrag)({ - nativeEvent: event - }); - } - }, - onMomentumBegin: handleOnMomentumBegin, - onMomentumEnd: handleOnMomentumEnd - }, [handleOnScroll, handleOnBeginDrag, handleOnEndDrag, handleOnMomentumBegin, handleOnMomentumEnd, onScroll, onScrollBeginDrag, onScrollEndDrag]); - return { - scrollHandler, - scrollableRef, - scrollableContentOffsetY - }; -}; - -exports.useScrollHandler = useScrollHandler; -//# sourceMappingURL=useScrollHandler.js.map \ No newline at end of file diff --git a/lib/commonjs/hooks/useScrollHandler.js.map b/lib/commonjs/hooks/useScrollHandler.js.map deleted file mode 100644 index d8de55aa0..000000000 --- a/lib/commonjs/hooks/useScrollHandler.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["useScrollHandler.ts"],"names":["useScrollHandler","useScrollEventsHandlers","useScrollEventsHandlersDefault","onScroll","onScrollBeginDrag","onScrollEndDrag","scrollableRef","scrollableContentOffsetY","handleOnScroll","noop","handleOnBeginDrag","handleOnEndDrag","handleOnMomentumEnd","handleOnMomentumBegin","scrollHandler","event","context","nativeEvent","onBeginDrag","onEndDrag","onMomentumBegin","onMomentumEnd"],"mappings":";;;;;;;AAAA;;AAMA;;AACA;;AAGO,MAAMA,gBAAgB,GAAG,CAC9BC,uBAAuB,GAAGC,8DADI,EAE9BC,QAF8B,EAG9BC,iBAH8B,EAI9BC,eAJ8B,KAK3B;AACH;AACA,QAAMC,aAAa,GAAG,4CAAtB,CAFG,CAIH;;AACA,QAAMC,wBAAwB,GAAG,2CAAuB,CAAvB,CAAjC,CALG,CAOH;;AACA,QAAM;AACJC,IAAAA,cAAc,GAAGC,sBADb;AAEJC,IAAAA,iBAAiB,GAAGD,sBAFhB;AAGJE,IAAAA,eAAe,GAAGF,sBAHd;AAIJG,IAAAA,mBAAmB,GAAGH,sBAJlB;AAKJI,IAAAA,qBAAqB,GAAGJ;AALpB,MAMFR,uBAAuB,CAACK,aAAD,EAAgBC,wBAAhB,CAN3B,CARG,CAgBH;;AACA,QAAMO,aAAa,GAAG,qDACpB;AACEX,IAAAA,QAAQ,EAAE,CAACY,KAAD,EAAQC,OAAR,KAAoB;AAC5BR,MAAAA,cAAc,CAACO,KAAD,EAAQC,OAAR,CAAd;;AAEA,UAAIb,QAAJ,EAAc;AACZ,4CAAQA,QAAR,EAAkB;AAAEc,UAAAA,WAAW,EAAEF;AAAf,SAAlB;AACD;AACF,KAPH;AAQEG,IAAAA,WAAW,EAAE,CAACH,KAAD,EAAQC,OAAR,KAAoB;AAC/BN,MAAAA,iBAAiB,CAACK,KAAD,EAAQC,OAAR,CAAjB;;AAEA,UAAIZ,iBAAJ,EAAuB;AACrB,4CAAQA,iBAAR,EAA2B;AAAEa,UAAAA,WAAW,EAAEF;AAAf,SAA3B;AACD;AACF,KAdH;AAeEI,IAAAA,SAAS,EAAE,CAACJ,KAAD,EAAQC,OAAR,KAAoB;AAC7BL,MAAAA,eAAe,CAACI,KAAD,EAAQC,OAAR,CAAf;;AAEA,UAAIX,eAAJ,EAAqB;AACnB,4CAAQA,eAAR,EAAyB;AAAEY,UAAAA,WAAW,EAAEF;AAAf,SAAzB;AACD;AACF,KArBH;AAsBEK,IAAAA,eAAe,EAAEP,qBAtBnB;AAuBEQ,IAAAA,aAAa,EAAET;AAvBjB,GADoB,EA0BpB,CACEJ,cADF,EAEEE,iBAFF,EAGEC,eAHF,EAIEE,qBAJF,EAKED,mBALF,EAMET,QANF,EAOEC,iBAPF,EAQEC,eARF,CA1BoB,CAAtB;AAsCA,SAAO;AAAES,IAAAA,aAAF;AAAiBR,IAAAA,aAAjB;AAAgCC,IAAAA;AAAhC,GAAP;AACD,CA7DM","sourcesContent":["import {\n runOnJS,\n useAnimatedRef,\n useAnimatedScrollHandler,\n useSharedValue,\n} from 'react-native-reanimated';\nimport { useScrollEventsHandlersDefault } from './useScrollEventsHandlersDefault';\nimport { workletNoop as noop } from '../utilities';\nimport type { Scrollable, ScrollableEvent } from '../types';\n\nexport const useScrollHandler = (\n useScrollEventsHandlers = useScrollEventsHandlersDefault,\n onScroll?: ScrollableEvent,\n onScrollBeginDrag?: ScrollableEvent,\n onScrollEndDrag?: ScrollableEvent\n) => {\n // refs\n const scrollableRef = useAnimatedRef();\n\n // variables\n const scrollableContentOffsetY = useSharedValue(0);\n\n // hooks\n const {\n handleOnScroll = noop,\n handleOnBeginDrag = noop,\n handleOnEndDrag = noop,\n handleOnMomentumEnd = noop,\n handleOnMomentumBegin = noop,\n } = useScrollEventsHandlers(scrollableRef, scrollableContentOffsetY);\n\n // callbacks\n const scrollHandler = useAnimatedScrollHandler(\n {\n onScroll: (event, context) => {\n handleOnScroll(event, context);\n\n if (onScroll) {\n runOnJS(onScroll)({ nativeEvent: event });\n }\n },\n onBeginDrag: (event, context) => {\n handleOnBeginDrag(event, context);\n\n if (onScrollBeginDrag) {\n runOnJS(onScrollBeginDrag)({ nativeEvent: event });\n }\n },\n onEndDrag: (event, context) => {\n handleOnEndDrag(event, context);\n\n if (onScrollEndDrag) {\n runOnJS(onScrollEndDrag)({ nativeEvent: event });\n }\n },\n onMomentumBegin: handleOnMomentumBegin,\n onMomentumEnd: handleOnMomentumEnd,\n },\n [\n handleOnScroll,\n handleOnBeginDrag,\n handleOnEndDrag,\n handleOnMomentumBegin,\n handleOnMomentumEnd,\n onScroll,\n onScrollBeginDrag,\n onScrollEndDrag,\n ]\n );\n\n return { scrollHandler, scrollableRef, scrollableContentOffsetY };\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/hooks/useScrollable.js b/lib/commonjs/hooks/useScrollable.js deleted file mode 100644 index b1951e64b..000000000 --- a/lib/commonjs/hooks/useScrollable.js +++ /dev/null @@ -1,79 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.useScrollable = void 0; - -var _react = require("react"); - -var _reactNativeReanimated = require("react-native-reanimated"); - -var _getRefNativeTag = require("../utilities/getRefNativeTag"); - -var _constants = require("../constants"); - -const useScrollable = () => { - // refs - const scrollableRef = (0, _react.useRef)(null); - const previousScrollableRef = (0, _react.useRef)(null); // variables - - const animatedScrollableType = (0, _reactNativeReanimated.useSharedValue)(_constants.SCROLLABLE_TYPE.UNDETERMINED); - const animatedScrollableContentOffsetY = (0, _reactNativeReanimated.useSharedValue)(0); - const animatedScrollableOverrideState = (0, _reactNativeReanimated.useSharedValue)(_constants.SCROLLABLE_STATE.UNDETERMINED); - const isScrollableRefreshable = (0, _reactNativeReanimated.useSharedValue)(false); // callbacks - - const setScrollableRef = (0, _react.useCallback)(ref => { - var _scrollableRef$curren, _scrollableRef$curren2; - - // get current node handle id - let currentRefId = (_scrollableRef$curren = (_scrollableRef$curren2 = scrollableRef.current) === null || _scrollableRef$curren2 === void 0 ? void 0 : _scrollableRef$curren2.id) !== null && _scrollableRef$curren !== void 0 ? _scrollableRef$curren : null; - - if (currentRefId !== ref.id) { - if (scrollableRef.current) { - // @ts-ignore - previousScrollableRef.current = scrollableRef.current; - } // @ts-ignore - - - scrollableRef.current = ref; - } - }, []); - const removeScrollableRef = (0, _react.useCallback)(ref => { - var _scrollableRef$curren3, _scrollableRef$curren4; - - // find node handle id - let id; - - try { - id = (0, _getRefNativeTag.getRefNativeTag)(ref); - } catch { - return; - } // get current node handle id - - - let currentRefId = (_scrollableRef$curren3 = (_scrollableRef$curren4 = scrollableRef.current) === null || _scrollableRef$curren4 === void 0 ? void 0 : _scrollableRef$curren4.id) !== null && _scrollableRef$curren3 !== void 0 ? _scrollableRef$curren3 : null; - /** - * @DEV - * when the incoming node is actually the current node, we reset - * the current scrollable ref to the previous one. - */ - - if (id === currentRefId) { - // @ts-ignore - scrollableRef.current = previousScrollableRef.current; - } - }, []); - return { - scrollableRef, - animatedScrollableType, - animatedScrollableContentOffsetY, - animatedScrollableOverrideState, - isScrollableRefreshable, - setScrollableRef, - removeScrollableRef - }; -}; - -exports.useScrollable = useScrollable; -//# sourceMappingURL=useScrollable.js.map \ No newline at end of file diff --git a/lib/commonjs/hooks/useScrollable.js.map b/lib/commonjs/hooks/useScrollable.js.map deleted file mode 100644 index 4c1883e94..000000000 --- a/lib/commonjs/hooks/useScrollable.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["useScrollable.ts"],"names":["useScrollable","scrollableRef","previousScrollableRef","animatedScrollableType","SCROLLABLE_TYPE","UNDETERMINED","animatedScrollableContentOffsetY","animatedScrollableOverrideState","SCROLLABLE_STATE","isScrollableRefreshable","setScrollableRef","ref","currentRefId","current","id","removeScrollableRef"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AAGO,MAAMA,aAAa,GAAG,MAAM;AACjC;AACA,QAAMC,aAAa,GAAG,mBAAsB,IAAtB,CAAtB;AACA,QAAMC,qBAAqB,GAAG,mBAAsB,IAAtB,CAA9B,CAHiC,CAKjC;;AACA,QAAMC,sBAAsB,GAAG,2CAC7BC,2BAAgBC,YADa,CAA/B;AAGA,QAAMC,gCAAgC,GAAG,2CAAuB,CAAvB,CAAzC;AACA,QAAMC,+BAA+B,GAAG,2CACtCC,4BAAiBH,YADqB,CAAxC;AAGA,QAAMI,uBAAuB,GAAG,2CAAwB,KAAxB,CAAhC,CAbiC,CAejC;;AACA,QAAMC,gBAAgB,GAAG,wBAAaC,GAAD,IAAwB;AAAA;;AAC3D;AACA,QAAIC,YAAY,sDAAGX,aAAa,CAACY,OAAjB,2DAAG,uBAAuBC,EAA1B,yEAAgC,IAAhD;;AAEA,QAAIF,YAAY,KAAKD,GAAG,CAACG,EAAzB,EAA6B;AAC3B,UAAIb,aAAa,CAACY,OAAlB,EAA2B;AACzB;AACAX,QAAAA,qBAAqB,CAACW,OAAtB,GAAgCZ,aAAa,CAACY,OAA9C;AACD,OAJ0B,CAK3B;;;AACAZ,MAAAA,aAAa,CAACY,OAAd,GAAwBF,GAAxB;AACD;AACF,GAZwB,EAYtB,EAZsB,CAAzB;AAcA,QAAMI,mBAAmB,GAAG,wBAAaJ,GAAD,IAAgC;AAAA;;AACtE;AACA,QAAIG,EAAJ;;AACA,QAAI;AACFA,MAAAA,EAAE,GAAG,sCAAgBH,GAAhB,CAAL;AACD,KAFD,CAEE,MAAM;AACN;AACD,KAPqE,CAStE;;;AACA,QAAIC,YAAY,uDAAGX,aAAa,CAACY,OAAjB,2DAAG,uBAAuBC,EAA1B,2EAAgC,IAAhD;AAEA;AACJ;AACA;AACA;AACA;;AACI,QAAIA,EAAE,KAAKF,YAAX,EAAyB;AACvB;AACAX,MAAAA,aAAa,CAACY,OAAd,GAAwBX,qBAAqB,CAACW,OAA9C;AACD;AACF,GArB2B,EAqBzB,EArByB,CAA5B;AAuBA,SAAO;AACLZ,IAAAA,aADK;AAELE,IAAAA,sBAFK;AAGLG,IAAAA,gCAHK;AAILC,IAAAA,+BAJK;AAKLE,IAAAA,uBALK;AAMLC,IAAAA,gBANK;AAOLK,IAAAA;AAPK,GAAP;AASD,CA9DM","sourcesContent":["import { useCallback, RefObject, useRef } from 'react';\nimport { useSharedValue } from 'react-native-reanimated';\nimport { getRefNativeTag } from '../utilities/getRefNativeTag';\nimport { SCROLLABLE_STATE, SCROLLABLE_TYPE } from '../constants';\nimport type { ScrollableRef, Scrollable } from '../types';\n\nexport const useScrollable = () => {\n // refs\n const scrollableRef = useRef(null);\n const previousScrollableRef = useRef(null);\n\n // variables\n const animatedScrollableType = useSharedValue(\n SCROLLABLE_TYPE.UNDETERMINED\n );\n const animatedScrollableContentOffsetY = useSharedValue(0);\n const animatedScrollableOverrideState = useSharedValue(\n SCROLLABLE_STATE.UNDETERMINED\n );\n const isScrollableRefreshable = useSharedValue(false);\n\n // callbacks\n const setScrollableRef = useCallback((ref: ScrollableRef) => {\n // get current node handle id\n let currentRefId = scrollableRef.current?.id ?? null;\n\n if (currentRefId !== ref.id) {\n if (scrollableRef.current) {\n // @ts-ignore\n previousScrollableRef.current = scrollableRef.current;\n }\n // @ts-ignore\n scrollableRef.current = ref;\n }\n }, []);\n\n const removeScrollableRef = useCallback((ref: RefObject) => {\n // find node handle id\n let id;\n try {\n id = getRefNativeTag(ref);\n } catch {\n return;\n }\n\n // get current node handle id\n let currentRefId = scrollableRef.current?.id ?? null;\n\n /**\n * @DEV\n * when the incoming node is actually the current node, we reset\n * the current scrollable ref to the previous one.\n */\n if (id === currentRefId) {\n // @ts-ignore\n scrollableRef.current = previousScrollableRef.current;\n }\n }, []);\n\n return {\n scrollableRef,\n animatedScrollableType,\n animatedScrollableContentOffsetY,\n animatedScrollableOverrideState,\n isScrollableRefreshable,\n setScrollableRef,\n removeScrollableRef,\n };\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/hooks/useScrollableSetter.js b/lib/commonjs/hooks/useScrollableSetter.js deleted file mode 100644 index a068616c7..000000000 --- a/lib/commonjs/hooks/useScrollableSetter.js +++ /dev/null @@ -1,52 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.useScrollableSetter = void 0; - -var _react = require("react"); - -var _useBottomSheetInternal = require("./useBottomSheetInternal"); - -var _getRefNativeTag = require("../utilities/getRefNativeTag"); - -const useScrollableSetter = (ref, type, contentOffsetY, refreshable, useFocusHook = _react.useEffect) => { - // hooks - const { - animatedScrollableType, - animatedScrollableContentOffsetY: rootScrollableContentOffsetY, - isContentHeightFixed, - isScrollableRefreshable, - setScrollableRef, - removeScrollableRef - } = (0, _useBottomSheetInternal.useBottomSheetInternal)(); // callbacks - - const handleSettingScrollable = (0, _react.useCallback)(() => { - // set current content offset - rootScrollableContentOffsetY.value = contentOffsetY.value; - animatedScrollableType.value = type; - isScrollableRefreshable.value = refreshable; - isContentHeightFixed.value = false; // set current scrollable ref - - const id = (0, _getRefNativeTag.getRefNativeTag)(ref); - - if (id) { - setScrollableRef({ - id: id, - node: ref - }); - } else { - console.warn(`Couldn't find the scrollable node handle id!`); - } - - return () => { - removeScrollableRef(ref); - }; - }, [ref, type, refreshable, animatedScrollableType, rootScrollableContentOffsetY, contentOffsetY, isScrollableRefreshable, isContentHeightFixed, setScrollableRef, removeScrollableRef]); // effects - - useFocusHook(handleSettingScrollable); -}; - -exports.useScrollableSetter = useScrollableSetter; -//# sourceMappingURL=useScrollableSetter.js.map \ No newline at end of file diff --git a/lib/commonjs/hooks/useScrollableSetter.js.map b/lib/commonjs/hooks/useScrollableSetter.js.map deleted file mode 100644 index 8b20320f5..000000000 --- a/lib/commonjs/hooks/useScrollableSetter.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["useScrollableSetter.ts"],"names":["useScrollableSetter","ref","type","contentOffsetY","refreshable","useFocusHook","useEffect","animatedScrollableType","animatedScrollableContentOffsetY","rootScrollableContentOffsetY","isContentHeightFixed","isScrollableRefreshable","setScrollableRef","removeScrollableRef","handleSettingScrollable","value","id","node","console","warn"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AAIO,MAAMA,mBAAmB,GAAG,CACjCC,GADiC,EAEjCC,IAFiC,EAGjCC,cAHiC,EAIjCC,WAJiC,EAKjCC,YAAY,GAAGC,gBALkB,KAM9B;AACH;AACA,QAAM;AACJC,IAAAA,sBADI;AAEJC,IAAAA,gCAAgC,EAAEC,4BAF9B;AAGJC,IAAAA,oBAHI;AAIJC,IAAAA,uBAJI;AAKJC,IAAAA,gBALI;AAMJC,IAAAA;AANI,MAOF,qDAPJ,CAFG,CAWH;;AACA,QAAMC,uBAAuB,GAAG,wBAAY,MAAM;AAChD;AACAL,IAAAA,4BAA4B,CAACM,KAA7B,GAAqCZ,cAAc,CAACY,KAApD;AACAR,IAAAA,sBAAsB,CAACQ,KAAvB,GAA+Bb,IAA/B;AACAS,IAAAA,uBAAuB,CAACI,KAAxB,GAAgCX,WAAhC;AACAM,IAAAA,oBAAoB,CAACK,KAArB,GAA6B,KAA7B,CALgD,CAOhD;;AACA,UAAMC,EAAE,GAAG,sCAAgBf,GAAhB,CAAX;;AACA,QAAIe,EAAJ,EAAQ;AACNJ,MAAAA,gBAAgB,CAAC;AACfI,QAAAA,EAAE,EAAEA,EADW;AAEfC,QAAAA,IAAI,EAAEhB;AAFS,OAAD,CAAhB;AAID,KALD,MAKO;AACLiB,MAAAA,OAAO,CAACC,IAAR,CAAc,8CAAd;AACD;;AAED,WAAO,MAAM;AACXN,MAAAA,mBAAmB,CAACZ,GAAD,CAAnB;AACD,KAFD;AAGD,GArB+B,EAqB7B,CACDA,GADC,EAEDC,IAFC,EAGDE,WAHC,EAIDG,sBAJC,EAKDE,4BALC,EAMDN,cANC,EAODQ,uBAPC,EAQDD,oBARC,EASDE,gBATC,EAUDC,mBAVC,CArB6B,CAAhC,CAZG,CA8CH;;AACAR,EAAAA,YAAY,CAACS,uBAAD,CAAZ;AACD,CAtDM","sourcesContent":["import React, { useCallback, useEffect } from 'react';\nimport Animated from 'react-native-reanimated';\nimport { useBottomSheetInternal } from './useBottomSheetInternal';\nimport { getRefNativeTag } from '../utilities/getRefNativeTag';\nimport { SCROLLABLE_TYPE } from '../constants';\nimport type { Scrollable } from '../types';\n\nexport const useScrollableSetter = (\n ref: React.RefObject,\n type: SCROLLABLE_TYPE,\n contentOffsetY: Animated.SharedValue,\n refreshable: boolean,\n useFocusHook = useEffect\n) => {\n // hooks\n const {\n animatedScrollableType,\n animatedScrollableContentOffsetY: rootScrollableContentOffsetY,\n isContentHeightFixed,\n isScrollableRefreshable,\n setScrollableRef,\n removeScrollableRef,\n } = useBottomSheetInternal();\n\n // callbacks\n const handleSettingScrollable = useCallback(() => {\n // set current content offset\n rootScrollableContentOffsetY.value = contentOffsetY.value;\n animatedScrollableType.value = type;\n isScrollableRefreshable.value = refreshable;\n isContentHeightFixed.value = false;\n\n // set current scrollable ref\n const id = getRefNativeTag(ref);\n if (id) {\n setScrollableRef({\n id: id,\n node: ref,\n });\n } else {\n console.warn(`Couldn't find the scrollable node handle id!`);\n }\n\n return () => {\n removeScrollableRef(ref);\n };\n }, [\n ref,\n type,\n refreshable,\n animatedScrollableType,\n rootScrollableContentOffsetY,\n contentOffsetY,\n isScrollableRefreshable,\n isContentHeightFixed,\n setScrollableRef,\n removeScrollableRef,\n ]);\n\n // effects\n useFocusHook(handleSettingScrollable);\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/hooks/useStableCallback.js b/lib/commonjs/hooks/useStableCallback.js deleted file mode 100644 index c80917cd4..000000000 --- a/lib/commonjs/hooks/useStableCallback.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.useStableCallback = void 0; - -var _react = require("react"); - -/** - * Provide a stable version of useCallback - * https://gist.github.com/JakeCoxon/c7ebf6e6496f8468226fd36b596e1985 - */ -const useStableCallback = callback => { - const callbackRef = (0, _react.useRef)(); - const memoCallback = (0, _react.useCallback)((...args) => callbackRef.current && callbackRef.current(...args), []); - (0, _react.useEffect)(() => { - callbackRef.current = callback; - return () => callbackRef.current = undefined; - }); - return memoCallback; -}; - -exports.useStableCallback = useStableCallback; -//# sourceMappingURL=useStableCallback.js.map \ No newline at end of file diff --git a/lib/commonjs/hooks/useStableCallback.js.map b/lib/commonjs/hooks/useStableCallback.js.map deleted file mode 100644 index e9d9cccea..000000000 --- a/lib/commonjs/hooks/useStableCallback.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["useStableCallback.ts"],"names":["useStableCallback","callback","callbackRef","memoCallback","args","current","undefined"],"mappings":";;;;;;;AAAA;;AAGA;AACA;AACA;AACA;AACO,MAAMA,iBAAiB,GAAIC,QAAD,IAAwB;AACvD,QAAMC,WAAW,GAAG,oBAApB;AACA,QAAMC,YAAY,GAAG,wBACnB,CAAC,GAAGC,IAAJ,KAAkBF,WAAW,CAACG,OAAZ,IAAuBH,WAAW,CAACG,OAAZ,CAAoB,GAAGD,IAAvB,CADtB,EAEnB,EAFmB,CAArB;AAIA,wBAAU,MAAM;AACdF,IAAAA,WAAW,CAACG,OAAZ,GAAsBJ,QAAtB;AACA,WAAO,MAAOC,WAAW,CAACG,OAAZ,GAAsBC,SAApC;AACD,GAHD;AAIA,SAAOH,YAAP;AACD,CAXM","sourcesContent":["import { useRef, useCallback, useEffect } from 'react';\n\ntype Callback = (...args: any[]) => any;\n/**\n * Provide a stable version of useCallback\n * https://gist.github.com/JakeCoxon/c7ebf6e6496f8468226fd36b596e1985\n */\nexport const useStableCallback = (callback: Callback) => {\n const callbackRef = useRef();\n const memoCallback = useCallback(\n (...args: any) => callbackRef.current && callbackRef.current(...args),\n []\n );\n useEffect(() => {\n callbackRef.current = callback;\n return () => (callbackRef.current = undefined);\n });\n return memoCallback;\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/index.js b/lib/commonjs/index.js deleted file mode 100644 index edd6bd338..000000000 --- a/lib/commonjs/index.js +++ /dev/null @@ -1,290 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -var _exportNames = { - TouchableHighlight: true, - TouchableOpacity: true, - TouchableWithoutFeedback: true, - BottomSheetModal: true, - BottomSheetModalProvider: true, - useBottomSheet: true, - useBottomSheetModal: true, - useBottomSheetSpringConfigs: true, - useBottomSheetTimingConfigs: true, - useBottomSheetInternal: true, - useBottomSheetModalInternal: true, - useBottomSheetDynamicSnapPoints: true, - useScrollEventsHandlersDefault: true, - useGestureEventsHandlersDefault: true, - useBottomSheetGestureHandlers: true, - useScrollHandler: true, - useScrollableSetter: true, - BottomSheetScrollView: true, - BottomSheetSectionList: true, - BottomSheetFlatList: true, - BottomSheetVirtualizedList: true, - createBottomSheetScrollableComponent: true, - BottomSheetHandle: true, - BottomSheetDraggableView: true, - BottomSheetView: true, - BottomSheetTextInput: true, - BottomSheetBackdrop: true, - BottomSheetFooter: true, - BottomSheetFooterContainer: true, - enableLogging: true -}; -Object.defineProperty(exports, "default", { - enumerable: true, - get: function () { - return _bottomSheet.default; - } -}); -Object.defineProperty(exports, "BottomSheetModal", { - enumerable: true, - get: function () { - return _bottomSheetModal.default; - } -}); -Object.defineProperty(exports, "BottomSheetModalProvider", { - enumerable: true, - get: function () { - return _bottomSheetModalProvider.default; - } -}); -Object.defineProperty(exports, "useBottomSheet", { - enumerable: true, - get: function () { - return _useBottomSheet.useBottomSheet; - } -}); -Object.defineProperty(exports, "useBottomSheetModal", { - enumerable: true, - get: function () { - return _useBottomSheetModal.useBottomSheetModal; - } -}); -Object.defineProperty(exports, "useBottomSheetSpringConfigs", { - enumerable: true, - get: function () { - return _useBottomSheetSpringConfigs.useBottomSheetSpringConfigs; - } -}); -Object.defineProperty(exports, "useBottomSheetTimingConfigs", { - enumerable: true, - get: function () { - return _useBottomSheetTimingConfigs.useBottomSheetTimingConfigs; - } -}); -Object.defineProperty(exports, "useBottomSheetInternal", { - enumerable: true, - get: function () { - return _useBottomSheetInternal.useBottomSheetInternal; - } -}); -Object.defineProperty(exports, "useBottomSheetModalInternal", { - enumerable: true, - get: function () { - return _useBottomSheetModalInternal.useBottomSheetModalInternal; - } -}); -Object.defineProperty(exports, "useBottomSheetDynamicSnapPoints", { - enumerable: true, - get: function () { - return _useBottomSheetDynamicSnapPoints.useBottomSheetDynamicSnapPoints; - } -}); -Object.defineProperty(exports, "useScrollEventsHandlersDefault", { - enumerable: true, - get: function () { - return _useScrollEventsHandlersDefault.useScrollEventsHandlersDefault; - } -}); -Object.defineProperty(exports, "useGestureEventsHandlersDefault", { - enumerable: true, - get: function () { - return _useGestureEventsHandlersDefault.useGestureEventsHandlersDefault; - } -}); -Object.defineProperty(exports, "useBottomSheetGestureHandlers", { - enumerable: true, - get: function () { - return _useBottomSheetGestureHandlers.useBottomSheetGestureHandlers; - } -}); -Object.defineProperty(exports, "useScrollHandler", { - enumerable: true, - get: function () { - return _useScrollHandler.useScrollHandler; - } -}); -Object.defineProperty(exports, "useScrollableSetter", { - enumerable: true, - get: function () { - return _useScrollableSetter.useScrollableSetter; - } -}); -Object.defineProperty(exports, "BottomSheetScrollView", { - enumerable: true, - get: function () { - return _bottomSheetScrollable.BottomSheetScrollView; - } -}); -Object.defineProperty(exports, "BottomSheetSectionList", { - enumerable: true, - get: function () { - return _bottomSheetScrollable.BottomSheetSectionList; - } -}); -Object.defineProperty(exports, "BottomSheetFlatList", { - enumerable: true, - get: function () { - return _bottomSheetScrollable.BottomSheetFlatList; - } -}); -Object.defineProperty(exports, "BottomSheetVirtualizedList", { - enumerable: true, - get: function () { - return _bottomSheetScrollable.BottomSheetVirtualizedList; - } -}); -Object.defineProperty(exports, "createBottomSheetScrollableComponent", { - enumerable: true, - get: function () { - return _bottomSheetScrollable.createBottomSheetScrollableComponent; - } -}); -Object.defineProperty(exports, "BottomSheetHandle", { - enumerable: true, - get: function () { - return _bottomSheetHandle.default; - } -}); -Object.defineProperty(exports, "BottomSheetDraggableView", { - enumerable: true, - get: function () { - return _bottomSheetDraggableView.default; - } -}); -Object.defineProperty(exports, "BottomSheetView", { - enumerable: true, - get: function () { - return _bottomSheetView.default; - } -}); -Object.defineProperty(exports, "BottomSheetTextInput", { - enumerable: true, - get: function () { - return _bottomSheetTextInput.default; - } -}); -Object.defineProperty(exports, "BottomSheetBackdrop", { - enumerable: true, - get: function () { - return _bottomSheetBackdrop.default; - } -}); -Object.defineProperty(exports, "BottomSheetFooter", { - enumerable: true, - get: function () { - return _bottomSheetFooter.default; - } -}); -Object.defineProperty(exports, "BottomSheetFooterContainer", { - enumerable: true, - get: function () { - return _BottomSheetFooterContainer.default; - } -}); -Object.defineProperty(exports, "enableLogging", { - enumerable: true, - get: function () { - return _logger.enableLogging; - } -}); -exports.TouchableWithoutFeedback = exports.TouchableOpacity = exports.TouchableHighlight = void 0; - -var _bottomSheet = _interopRequireDefault(require("./components/bottomSheet")); - -var _bottomSheetModal = _interopRequireDefault(require("./components/bottomSheetModal")); - -var _bottomSheetModalProvider = _interopRequireDefault(require("./components/bottomSheetModalProvider")); - -var _useBottomSheet = require("./hooks/useBottomSheet"); - -var _useBottomSheetModal = require("./hooks/useBottomSheetModal"); - -var _useBottomSheetSpringConfigs = require("./hooks/useBottomSheetSpringConfigs"); - -var _useBottomSheetTimingConfigs = require("./hooks/useBottomSheetTimingConfigs"); - -var _useBottomSheetInternal = require("./hooks/useBottomSheetInternal"); - -var _useBottomSheetModalInternal = require("./hooks/useBottomSheetModalInternal"); - -var _useBottomSheetDynamicSnapPoints = require("./hooks/useBottomSheetDynamicSnapPoints"); - -var _useScrollEventsHandlersDefault = require("./hooks/useScrollEventsHandlersDefault"); - -var _useGestureEventsHandlersDefault = require("./hooks/useGestureEventsHandlersDefault"); - -var _useBottomSheetGestureHandlers = require("./hooks/useBottomSheetGestureHandlers"); - -var _useScrollHandler = require("./hooks/useScrollHandler"); - -var _useScrollableSetter = require("./hooks/useScrollableSetter"); - -var _bottomSheetScrollable = require("./components/bottomSheetScrollable"); - -var _bottomSheetHandle = _interopRequireDefault(require("./components/bottomSheetHandle")); - -var _bottomSheetDraggableView = _interopRequireDefault(require("./components/bottomSheetDraggableView")); - -var _bottomSheetView = _interopRequireDefault(require("./components/bottomSheetView")); - -var _bottomSheetTextInput = _interopRequireDefault(require("./components/bottomSheetTextInput")); - -var _bottomSheetBackdrop = _interopRequireDefault(require("./components/bottomSheetBackdrop")); - -var _bottomSheetFooter = _interopRequireDefault(require("./components/bottomSheetFooter")); - -var _BottomSheetFooterContainer = _interopRequireDefault(require("./components/bottomSheetFooterContainer/BottomSheetFooterContainer")); - -var _touchables = _interopRequireDefault(require("./components/touchables")); - -var _constants = require("./constants"); - -Object.keys(_constants).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; - if (key in exports && exports[key] === _constants[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function () { - return _constants[key]; - } - }); -}); - -var _logger = require("./utilities/logger"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -// bottom sheet -// bottom sheet modal -//#region hooks -//#endregion -//#region components -// touchables -const { - TouchableHighlight, - TouchableOpacity, - TouchableWithoutFeedback -} = _touchables.default; // utils -//#endregion - -exports.TouchableWithoutFeedback = TouchableWithoutFeedback; -exports.TouchableOpacity = TouchableOpacity; -exports.TouchableHighlight = TouchableHighlight; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/index.js.map b/lib/commonjs/index.js.map deleted file mode 100644 index d9ca6078a..000000000 --- a/lib/commonjs/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":["TouchableHighlight","TouchableOpacity","TouchableWithoutFeedback","BottomSheetTouchable"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AAGA;;AACA;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAGA;;AAmCA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;;;AA1EA;AAGA;AAIA;AAaA;AAEA;AAeA;AAEO,MAAM;AACXA,EAAAA,kBADW;AAEXC,EAAAA,gBAFW;AAGXC,EAAAA;AAHW,IAITC,mBAJG,C,CAKP;AA+BA","sourcesContent":["// bottom sheet\nexport { default } from './components/bottomSheet';\n\n// bottom sheet modal\nexport { default as BottomSheetModal } from './components/bottomSheetModal';\nexport { default as BottomSheetModalProvider } from './components/bottomSheetModalProvider';\n\n//#region hooks\nexport { useBottomSheet } from './hooks/useBottomSheet';\nexport { useBottomSheetModal } from './hooks/useBottomSheetModal';\nexport { useBottomSheetSpringConfigs } from './hooks/useBottomSheetSpringConfigs';\nexport { useBottomSheetTimingConfigs } from './hooks/useBottomSheetTimingConfigs';\nexport { useBottomSheetInternal } from './hooks/useBottomSheetInternal';\nexport { useBottomSheetModalInternal } from './hooks/useBottomSheetModalInternal';\nexport { useBottomSheetDynamicSnapPoints } from './hooks/useBottomSheetDynamicSnapPoints';\nexport { useScrollEventsHandlersDefault } from './hooks/useScrollEventsHandlersDefault';\nexport { useGestureEventsHandlersDefault } from './hooks/useGestureEventsHandlersDefault';\nexport { useBottomSheetGestureHandlers } from './hooks/useBottomSheetGestureHandlers';\nexport { useScrollHandler } from './hooks/useScrollHandler';\nexport { useScrollableSetter } from './hooks/useScrollableSetter';\n//#endregion\n\n//#region components\nexport {\n BottomSheetScrollView,\n BottomSheetSectionList,\n BottomSheetFlatList,\n BottomSheetVirtualizedList,\n} from './components/bottomSheetScrollable';\nexport { default as BottomSheetHandle } from './components/bottomSheetHandle';\nexport { default as BottomSheetDraggableView } from './components/bottomSheetDraggableView';\nexport { default as BottomSheetView } from './components/bottomSheetView';\nexport { default as BottomSheetTextInput } from './components/bottomSheetTextInput';\nexport { default as BottomSheetBackdrop } from './components/bottomSheetBackdrop';\nexport { default as BottomSheetFooter } from './components/bottomSheetFooter';\nexport { default as BottomSheetFooterContainer } from './components/bottomSheetFooterContainer/BottomSheetFooterContainer';\n\n// touchables\nimport BottomSheetTouchable from './components/touchables';\nexport const {\n TouchableHighlight,\n TouchableOpacity,\n TouchableWithoutFeedback,\n} = BottomSheetTouchable;\n// utils\nexport { createBottomSheetScrollableComponent } from './components/bottomSheetScrollable';\n//#endregion\n\n//#region types\nexport type { BottomSheetProps } from './components/bottomSheet';\nexport type { BottomSheetModalProps } from './components/bottomSheetModal';\nexport type { BottomSheetHandleProps } from './components/bottomSheetHandle';\nexport type { BottomSheetBackgroundProps } from './components/bottomSheetBackground';\nexport type { BottomSheetBackdropProps } from './components/bottomSheetBackdrop';\nexport type { BottomSheetFooterProps } from './components/bottomSheetFooter';\n\nexport type {\n BottomSheetFlatListMethods,\n BottomSheetScrollViewMethods,\n BottomSheetSectionListMethods,\n BottomSheetVirtualizedListMethods,\n BottomSheetScrollableProps,\n} from './components/bottomSheetScrollable';\n\nexport type {\n ScrollEventsHandlersHookType,\n GestureEventsHandlersHookType,\n ScrollEventHandlerCallbackType,\n GestureEventHandlerCallbackType,\n} from './types';\n//#endregion\n\n//#region utilities\nexport * from './constants';\nexport { enableLogging } from './utilities/logger';\n//#endregion\n"]} \ No newline at end of file diff --git a/lib/commonjs/utilities/animate.js b/lib/commonjs/utilities/animate.js deleted file mode 100644 index a00f627ec..000000000 --- a/lib/commonjs/utilities/animate.js +++ /dev/null @@ -1,37 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.animate = void 0; - -var _reactNativeReanimated = require("react-native-reanimated"); - -var _constants = require("../constants"); - -const animate = ({ - point, - configs = undefined, - velocity = 0, - onComplete -}) => { - 'worklet'; - - if (!configs) { - configs = _constants.ANIMATION_CONFIGS; - } // detect animation type - - - const type = 'duration' in configs || 'easing' in configs ? _constants.ANIMATION_METHOD.TIMING : _constants.ANIMATION_METHOD.SPRING; - - if (type === _constants.ANIMATION_METHOD.TIMING) { - return (0, _reactNativeReanimated.withTiming)(point, configs, onComplete); - } else { - return (0, _reactNativeReanimated.withSpring)(point, Object.assign({ - velocity - }, configs), onComplete); - } -}; - -exports.animate = animate; -//# sourceMappingURL=animate.js.map \ No newline at end of file diff --git a/lib/commonjs/utilities/animate.js.map b/lib/commonjs/utilities/animate.js.map deleted file mode 100644 index bf3b7057d..000000000 --- a/lib/commonjs/utilities/animate.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["animate.ts"],"names":["animate","point","configs","undefined","velocity","onComplete","ANIMATION_CONFIGS","type","ANIMATION_METHOD","TIMING","SPRING","Object","assign"],"mappings":";;;;;;;AAAA;;AAOA;;AASO,MAAMA,OAAO,GAAG,CAAC;AACtBC,EAAAA,KADsB;AAEtBC,EAAAA,OAAO,GAAGC,SAFY;AAGtBC,EAAAA,QAAQ,GAAG,CAHW;AAItBC,EAAAA;AAJsB,CAAD,KAKF;AACnB;;AAEA,MAAI,CAACH,OAAL,EAAc;AACZA,IAAAA,OAAO,GAAGI,4BAAV;AACD,GALkB,CAOnB;;;AACA,QAAMC,IAAI,GACR,cAAcL,OAAd,IAAyB,YAAYA,OAArC,GACIM,4BAAiBC,MADrB,GAEID,4BAAiBE,MAHvB;;AAKA,MAAIH,IAAI,KAAKC,4BAAiBC,MAA9B,EAAsC;AACpC,WAAO,uCAAWR,KAAX,EAAkBC,OAAlB,EAA+CG,UAA/C,CAAP;AACD,GAFD,MAEO;AACL,WAAO,uCACLJ,KADK,EAELU,MAAM,CAACC,MAAP,CAAc;AAAER,MAAAA;AAAF,KAAd,EAA4BF,OAA5B,CAFK,EAGLG,UAHK,CAAP;AAKD;AACF,CA3BM","sourcesContent":["import {\n WithSpringConfig,\n WithTimingConfig,\n withTiming,\n withSpring,\n AnimationCallback,\n} from 'react-native-reanimated';\nimport { ANIMATION_CONFIGS, ANIMATION_METHOD } from '../constants';\n\ninterface AnimateParams {\n point: number;\n velocity?: number;\n configs?: WithSpringConfig | WithTimingConfig;\n onComplete?: AnimationCallback;\n}\n\nexport const animate = ({\n point,\n configs = undefined,\n velocity = 0,\n onComplete,\n}: AnimateParams) => {\n 'worklet';\n\n if (!configs) {\n configs = ANIMATION_CONFIGS;\n }\n\n // detect animation type\n const type =\n 'duration' in configs || 'easing' in configs\n ? ANIMATION_METHOD.TIMING\n : ANIMATION_METHOD.SPRING;\n\n if (type === ANIMATION_METHOD.TIMING) {\n return withTiming(point, configs as WithTimingConfig, onComplete);\n } else {\n return withSpring(\n point,\n Object.assign({ velocity }, configs) as WithSpringConfig,\n onComplete\n );\n }\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/utilities/clamp.js b/lib/commonjs/utilities/clamp.js deleted file mode 100644 index 9fed155da..000000000 --- a/lib/commonjs/utilities/clamp.js +++ /dev/null @@ -1,15 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.clamp = void 0; - -const clamp = (value, lowerBound, upperBound) => { - 'worklet'; - - return Math.min(Math.max(lowerBound, value), upperBound); -}; - -exports.clamp = clamp; -//# sourceMappingURL=clamp.js.map \ No newline at end of file diff --git a/lib/commonjs/utilities/clamp.js.map b/lib/commonjs/utilities/clamp.js.map deleted file mode 100644 index 5b4eb6e7b..000000000 --- a/lib/commonjs/utilities/clamp.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["clamp.ts"],"names":["clamp","value","lowerBound","upperBound","Math","min","max"],"mappings":";;;;;;;AAAO,MAAMA,KAAK,GAAG,CACnBC,KADmB,EAEnBC,UAFmB,EAGnBC,UAHmB,KAIhB;AACH;;AACA,SAAOC,IAAI,CAACC,GAAL,CAASD,IAAI,CAACE,GAAL,CAASJ,UAAT,EAAqBD,KAArB,CAAT,EAAsCE,UAAtC,CAAP;AACD,CAPM","sourcesContent":["export const clamp = (\n value: number,\n lowerBound: number,\n upperBound: number\n) => {\n 'worklet';\n return Math.min(Math.max(lowerBound, value), upperBound);\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/utilities/easingExp.js b/lib/commonjs/utilities/easingExp.js deleted file mode 100644 index 603d1b31b..000000000 --- a/lib/commonjs/utilities/easingExp.js +++ /dev/null @@ -1,21 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.exp = void 0; - -/** - * A modified version of the default AnimatedEasing.exp, - * to insure its value never goes below `0`. - * @see https://github.com/software-mansion/react-native-reanimated/issues/1610 - * @param t number - */ -const exp = t => { - 'worklet'; - - return Math.min(Math.max(0, Math.pow(2, 10 * (t - 1))), 1); -}; - -exports.exp = exp; -//# sourceMappingURL=easingExp.js.map \ No newline at end of file diff --git a/lib/commonjs/utilities/easingExp.js.map b/lib/commonjs/utilities/easingExp.js.map deleted file mode 100644 index aca657ae0..000000000 --- a/lib/commonjs/utilities/easingExp.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["easingExp.ts"],"names":["exp","t","Math","min","max","pow"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,GAAG,GAAIC,CAAD,IAAe;AAChC;;AACA,SAAOC,IAAI,CAACC,GAAL,CAASD,IAAI,CAACE,GAAL,CAAS,CAAT,EAAYF,IAAI,CAACG,GAAL,CAAS,CAAT,EAAY,MAAMJ,CAAC,GAAG,CAAV,CAAZ,CAAZ,CAAT,EAAiD,CAAjD,CAAP;AACD,CAHM","sourcesContent":["/**\n * A modified version of the default AnimatedEasing.exp,\n * to insure its value never goes below `0`.\n * @see https://github.com/software-mansion/react-native-reanimated/issues/1610\n * @param t number\n */\nexport const exp = (t: number) => {\n 'worklet';\n return Math.min(Math.max(0, Math.pow(2, 10 * (t - 1))), 1);\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/utilities/getKeyboardAnimationConfigs.js b/lib/commonjs/utilities/getKeyboardAnimationConfigs.js deleted file mode 100644 index 7f8f929fe..000000000 --- a/lib/commonjs/utilities/getKeyboardAnimationConfigs.js +++ /dev/null @@ -1,51 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.getKeyboardAnimationConfigs = void 0; - -var _reactNativeReanimated = require("react-native-reanimated"); - -const getKeyboardAnimationConfigs = (easing, duration) => { - 'worklet'; - - switch (easing) { - case 'easeIn': - return { - easing: _reactNativeReanimated.Easing.in(_reactNativeReanimated.Easing.ease), - duration - }; - - case 'easeOut': - return { - easing: _reactNativeReanimated.Easing.out(_reactNativeReanimated.Easing.ease), - duration - }; - - case 'easeInEaseOut': - return { - easing: _reactNativeReanimated.Easing.inOut(_reactNativeReanimated.Easing.ease), - duration - }; - - case 'linear': - return { - easing: _reactNativeReanimated.Easing.linear, - duration - }; - - case 'keyboard': - return { - damping: 500, - stiffness: 1000, - mass: 3, - overshootClamping: true, - restDisplacementThreshold: 10, - restSpeedThreshold: 10 - }; - } -}; - -exports.getKeyboardAnimationConfigs = getKeyboardAnimationConfigs; -//# sourceMappingURL=getKeyboardAnimationConfigs.js.map \ No newline at end of file diff --git a/lib/commonjs/utilities/getKeyboardAnimationConfigs.js.map b/lib/commonjs/utilities/getKeyboardAnimationConfigs.js.map deleted file mode 100644 index b9d292af8..000000000 --- a/lib/commonjs/utilities/getKeyboardAnimationConfigs.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["getKeyboardAnimationConfigs.ts"],"names":["getKeyboardAnimationConfigs","easing","duration","Easing","in","ease","out","inOut","linear","damping","stiffness","mass","overshootClamping","restDisplacementThreshold","restSpeedThreshold"],"mappings":";;;;;;;AAAA;;AAGO,MAAMA,2BAA2B,GAAG,CACzCC,MADyC,EAEzCC,QAFyC,KAGtC;AACH;;AACA,UAAQD,MAAR;AACE,SAAK,QAAL;AACE,aAAO;AACLA,QAAAA,MAAM,EAAEE,8BAAOC,EAAP,CAAUD,8BAAOE,IAAjB,CADH;AAELH,QAAAA;AAFK,OAAP;;AAKF,SAAK,SAAL;AACE,aAAO;AACLD,QAAAA,MAAM,EAAEE,8BAAOG,GAAP,CAAWH,8BAAOE,IAAlB,CADH;AAELH,QAAAA;AAFK,OAAP;;AAKF,SAAK,eAAL;AACE,aAAO;AACLD,QAAAA,MAAM,EAAEE,8BAAOI,KAAP,CAAaJ,8BAAOE,IAApB,CADH;AAELH,QAAAA;AAFK,OAAP;;AAKF,SAAK,QAAL;AACE,aAAO;AACLD,QAAAA,MAAM,EAAEE,8BAAOK,MADV;AAELN,QAAAA;AAFK,OAAP;;AAKF,SAAK,UAAL;AACE,aAAO;AACLO,QAAAA,OAAO,EAAE,GADJ;AAELC,QAAAA,SAAS,EAAE,IAFN;AAGLC,QAAAA,IAAI,EAAE,CAHD;AAILC,QAAAA,iBAAiB,EAAE,IAJd;AAKLC,QAAAA,yBAAyB,EAAE,EALtB;AAMLC,QAAAA,kBAAkB,EAAE;AANf,OAAP;AA1BJ;AAmCD,CAxCM","sourcesContent":["import { Easing } from 'react-native-reanimated';\nimport type { KeyboardEventEasing } from 'react-native';\n\nexport const getKeyboardAnimationConfigs = (\n easing: KeyboardEventEasing,\n duration: number\n) => {\n 'worklet';\n switch (easing) {\n case 'easeIn':\n return {\n easing: Easing.in(Easing.ease),\n duration,\n };\n\n case 'easeOut':\n return {\n easing: Easing.out(Easing.ease),\n duration,\n };\n\n case 'easeInEaseOut':\n return {\n easing: Easing.inOut(Easing.ease),\n duration,\n };\n\n case 'linear':\n return {\n easing: Easing.linear,\n duration,\n };\n\n case 'keyboard':\n return {\n damping: 500,\n stiffness: 1000,\n mass: 3,\n overshootClamping: true,\n restDisplacementThreshold: 10,\n restSpeedThreshold: 10,\n };\n }\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/utilities/getRefNativeTag.js b/lib/commonjs/utilities/getRefNativeTag.js deleted file mode 100644 index 0c1495d24..000000000 --- a/lib/commonjs/utilities/getRefNativeTag.js +++ /dev/null @@ -1,45 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.getRefNativeTag = getRefNativeTag; - -const isFunction = ref => typeof ref === 'function'; - -const hasNativeTag = ref => !!ref && typeof ref === 'object' && 'current' in (ref || {}) && '_nativeTag' in ((ref === null || ref === void 0 ? void 0 : ref.current) || {}); -/* - * getRefNativeTag is an internal utility used by createBottomSheetScrollableComponent - * to grab the native tag from the native host component. It only works when the ref - * is pointing to a native Host component. - * - * Internally in the bottom-sheet library ref can be a function that returns a native tag - * this seems to happen due to the usage of Reanimated's animated scroll components. - * - * This should be Fabric compatible as long as the ref is a native host component. - * */ - - -function getRefNativeTag(ref) { - const refType = typeof ref; - let nativeTag; - - if (isFunction(ref)) { - nativeTag = ref(); - } else if (hasNativeTag(ref)) { - nativeTag = ref.current._nativeTag; - } - - if (!nativeTag || typeof nativeTag !== 'number') { - throw new Error(`Unexpected nativeTag: ${refType}; nativeTag=${nativeTag} - - createBottomSheetScrollableComponent's ScrollableComponent needs to return - a reference that contains a nativeTag to a Native HostComponent. - - ref=${ref} - `); - } - - return nativeTag; -} -//# sourceMappingURL=getRefNativeTag.js.map \ No newline at end of file diff --git a/lib/commonjs/utilities/getRefNativeTag.js.map b/lib/commonjs/utilities/getRefNativeTag.js.map deleted file mode 100644 index ddb0c0d25..000000000 --- a/lib/commonjs/utilities/getRefNativeTag.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["getRefNativeTag.ts"],"names":["isFunction","ref","hasNativeTag","current","getRefNativeTag","refType","nativeTag","_nativeTag","Error"],"mappings":";;;;;;;AAAA,MAAMA,UAAU,GAAIC,GAAD,IAAmC,OAAOA,GAAP,KAAe,UAArE;;AAEA,MAAMC,YAAY,GAChBD,GADmB,IAGnB,CAAC,CAACA,GAAF,IACA,OAAOA,GAAP,KAAe,QADf,IAEA,cAAcA,GAAG,IAAI,EAArB,CAFA,IAGA,iBAAiB,CAACA,GAAD,aAACA,GAAD,uBAACA,GAAD,CAAcE,OAAd,KAAyB,EAA1C,CANF;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,eAAT,CAAyBH,GAAzB,EAAuC;AAC5C,QAAMI,OAAO,GAAG,OAAOJ,GAAvB;AACA,MAAIK,SAAJ;;AACA,MAAIN,UAAU,CAACC,GAAD,CAAd,EAAqB;AACnBK,IAAAA,SAAS,GAAGL,GAAG,EAAf;AACD,GAFD,MAEO,IAAIC,YAAY,CAACD,GAAD,CAAhB,EAAuB;AAC5BK,IAAAA,SAAS,GAAGL,GAAG,CAACE,OAAJ,CAAYI,UAAxB;AACD;;AAED,MAAI,CAACD,SAAD,IAAc,OAAOA,SAAP,KAAqB,QAAvC,EAAiD;AAC/C,UAAM,IAAIE,KAAJ,CACH,yBAAwBH,OAAQ,eAAcC,SAAU;AAC/D;AACA;AACA;AACA;AACA,SAASL,GAAI;AACb,IAPU,CAAN;AASD;;AAED,SAAOK,SAAP;AACD","sourcesContent":["const isFunction = (ref: unknown): ref is Function => typeof ref === 'function';\n\nconst hasNativeTag = (\n ref: unknown\n): ref is { current: { _nativeTag: number } } =>\n !!ref &&\n typeof ref === 'object' &&\n 'current' in (ref || {}) &&\n '_nativeTag' in ((ref as any)?.current || {});\n\n/*\n * getRefNativeTag is an internal utility used by createBottomSheetScrollableComponent\n * to grab the native tag from the native host component. It only works when the ref\n * is pointing to a native Host component.\n *\n * Internally in the bottom-sheet library ref can be a function that returns a native tag\n * this seems to happen due to the usage of Reanimated's animated scroll components.\n *\n * This should be Fabric compatible as long as the ref is a native host component.\n * */\nexport function getRefNativeTag(ref: unknown) {\n const refType = typeof ref;\n let nativeTag: undefined | number;\n if (isFunction(ref)) {\n nativeTag = ref();\n } else if (hasNativeTag(ref)) {\n nativeTag = ref.current._nativeTag;\n }\n\n if (!nativeTag || typeof nativeTag !== 'number') {\n throw new Error(\n `Unexpected nativeTag: ${refType}; nativeTag=${nativeTag} \n\n\t\t\tcreateBottomSheetScrollableComponent's ScrollableComponent needs to return \n\t\t\ta reference that contains a nativeTag to a Native HostComponent.\n\n\t\t\tref=${ref}\n\t\t\t`\n );\n }\n\n return nativeTag;\n}\n"]} \ No newline at end of file diff --git a/lib/commonjs/utilities/id.js b/lib/commonjs/utilities/id.js deleted file mode 100644 index ff906cc6e..000000000 --- a/lib/commonjs/utilities/id.js +++ /dev/null @@ -1,15 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.id = void 0; -let current = 0; - -const id = () => { - current = (current + 1) % Number.MAX_SAFE_INTEGER; - return current; -}; - -exports.id = id; -//# sourceMappingURL=id.js.map \ No newline at end of file diff --git a/lib/commonjs/utilities/id.js.map b/lib/commonjs/utilities/id.js.map deleted file mode 100644 index 4e87610cd..000000000 --- a/lib/commonjs/utilities/id.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["id.ts"],"names":["current","id","Number","MAX_SAFE_INTEGER"],"mappings":";;;;;;AAAA,IAAIA,OAAO,GAAG,CAAd;;AAEO,MAAMC,EAAE,GAAG,MAAM;AACtBD,EAAAA,OAAO,GAAG,CAACA,OAAO,GAAG,CAAX,IAAgBE,MAAM,CAACC,gBAAjC;AACA,SAAOH,OAAP;AACD,CAHM","sourcesContent":["let current = 0;\n\nexport const id = () => {\n current = (current + 1) % Number.MAX_SAFE_INTEGER;\n return current;\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/utilities/index.js b/lib/commonjs/utilities/index.js deleted file mode 100644 index 3576918db..000000000 --- a/lib/commonjs/utilities/index.js +++ /dev/null @@ -1,52 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "normalizeSnapPoint", { - enumerable: true, - get: function () { - return _normalizeSnapPoint.normalizeSnapPoint; - } -}); -Object.defineProperty(exports, "animate", { - enumerable: true, - get: function () { - return _animate.animate; - } -}); -Object.defineProperty(exports, "getKeyboardAnimationConfigs", { - enumerable: true, - get: function () { - return _getKeyboardAnimationConfigs.getKeyboardAnimationConfigs; - } -}); -Object.defineProperty(exports, "print", { - enumerable: true, - get: function () { - return _logger.print; - } -}); -Object.defineProperty(exports, "noop", { - enumerable: true, - get: function () { - return _noop.noop; - } -}); -Object.defineProperty(exports, "workletNoop", { - enumerable: true, - get: function () { - return _noop.workletNoop; - } -}); - -var _normalizeSnapPoint = require("./normalizeSnapPoint"); - -var _animate = require("./animate"); - -var _getKeyboardAnimationConfigs = require("./getKeyboardAnimationConfigs"); - -var _logger = require("./logger"); - -var _noop = require("./noop"); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/utilities/index.js.map b/lib/commonjs/utilities/index.js.map deleted file mode 100644 index 768a37f59..000000000 --- a/lib/commonjs/utilities/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA","sourcesContent":["export { normalizeSnapPoint } from './normalizeSnapPoint';\nexport { animate } from './animate';\nexport { getKeyboardAnimationConfigs } from './getKeyboardAnimationConfigs';\nexport { print } from './logger';\nexport { noop, workletNoop } from './noop';\n"]} \ No newline at end of file diff --git a/lib/commonjs/utilities/logger.js b/lib/commonjs/utilities/logger.js deleted file mode 100644 index 54a0140f8..000000000 --- a/lib/commonjs/utilities/logger.js +++ /dev/null @@ -1,48 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.enableLogging = exports.print = void 0; -let isLoggingEnabled = false; - -const enableLogging = () => { - if (!__DEV__) { - console.warn('[BottomSheet] could not enable logging on production!'); - return; - } - - isLoggingEnabled = true; -}; - -exports.enableLogging = enableLogging; - -let print = () => {}; - -exports.print = print; - -if (__DEV__) { - exports.print = print = ({ - component, - method, - params - }) => { - if (!isLoggingEnabled) { - return; - } - - let message = ''; - - if (typeof params === 'object') { - message = Object.keys(params).map(key => `${key}:${params[key]}`).join(' '); - } else { - message = `${params !== null && params !== void 0 ? params : ''}`; - } // eslint-disable-next-line no-console - - - console.log(`[${[component, method].filter(Boolean).join('::')}]`, message); - }; -} - -Object.freeze(print); -//# sourceMappingURL=logger.js.map \ No newline at end of file diff --git a/lib/commonjs/utilities/logger.js.map b/lib/commonjs/utilities/logger.js.map deleted file mode 100644 index bb51fdbe1..000000000 --- a/lib/commonjs/utilities/logger.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["logger.ts"],"names":["isLoggingEnabled","enableLogging","__DEV__","console","warn","print","component","method","params","message","Object","keys","map","key","join","log","filter","Boolean","freeze"],"mappings":";;;;;;AAQA,IAAIA,gBAAgB,GAAG,KAAvB;;AAEA,MAAMC,aAAa,GAAG,MAAM;AAC1B,MAAI,CAACC,OAAL,EAAc;AACZC,IAAAA,OAAO,CAACC,IAAR,CAAa,uDAAb;AACA;AACD;;AACDJ,EAAAA,gBAAgB,GAAG,IAAnB;AACD,CAND;;;;AAQA,IAAIK,KAAY,GAAG,MAAM,CAAE,CAA3B;;;;AAEA,IAAIH,OAAJ,EAAa;AACX,kBAAAG,KAAK,GAAG,CAAC;AAAEC,IAAAA,SAAF;AAAaC,IAAAA,MAAb;AAAqBC,IAAAA;AAArB,GAAD,KAAmC;AACzC,QAAI,CAACR,gBAAL,EAAuB;AACrB;AACD;;AACD,QAAIS,OAAO,GAAG,EAAd;;AAEA,QAAI,OAAOD,MAAP,KAAkB,QAAtB,EAAgC;AAC9BC,MAAAA,OAAO,GAAGC,MAAM,CAACC,IAAP,CAAYH,MAAZ,EACPI,GADO,CACHC,GAAG,IAAK,GAAEA,GAAI,IAAGL,MAAM,CAACK,GAAD,CAAM,EAD1B,EAEPC,IAFO,CAEF,GAFE,CAAV;AAGD,KAJD,MAIO;AACLL,MAAAA,OAAO,GAAI,GAAED,MAAH,aAAGA,MAAH,cAAGA,MAAH,GAAa,EAAG,EAA1B;AACD,KAZwC,CAazC;;;AACAL,IAAAA,OAAO,CAACY,GAAR,CAAa,IAAG,CAACT,SAAD,EAAYC,MAAZ,EAAoBS,MAApB,CAA2BC,OAA3B,EAAoCH,IAApC,CAAyC,IAAzC,CAA+C,GAA/D,EAAmEL,OAAnE;AACD,GAfD;AAgBD;;AAEDC,MAAM,CAACQ,MAAP,CAAcb,KAAd","sourcesContent":["interface PrintOptions {\n component?: string;\n method?: string;\n params?: Record | string | number | boolean;\n}\n\ntype Print = (options: PrintOptions) => void;\n\nlet isLoggingEnabled = false;\n\nconst enableLogging = () => {\n if (!__DEV__) {\n console.warn('[BottomSheet] could not enable logging on production!');\n return;\n }\n isLoggingEnabled = true;\n};\n\nlet print: Print = () => {};\n\nif (__DEV__) {\n print = ({ component, method, params }) => {\n if (!isLoggingEnabled) {\n return;\n }\n let message = '';\n\n if (typeof params === 'object') {\n message = Object.keys(params)\n .map(key => `${key}:${params[key]}`)\n .join(' ');\n } else {\n message = `${params ?? ''}`;\n }\n // eslint-disable-next-line no-console\n console.log(`[${[component, method].filter(Boolean).join('::')}]`, message);\n };\n}\n\nObject.freeze(print);\n\nexport { print, enableLogging };\n"]} \ No newline at end of file diff --git a/lib/commonjs/utilities/noop.js b/lib/commonjs/utilities/noop.js deleted file mode 100644 index a9adcfb91..000000000 --- a/lib/commonjs/utilities/noop.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.workletNoop = exports.noop = void 0; - -const workletNoop = () => { - 'worklet'; -}; - -exports.workletNoop = workletNoop; - -const noop = () => {}; - -exports.noop = noop; -//# sourceMappingURL=noop.js.map \ No newline at end of file diff --git a/lib/commonjs/utilities/noop.js.map b/lib/commonjs/utilities/noop.js.map deleted file mode 100644 index a0d60d0fc..000000000 --- a/lib/commonjs/utilities/noop.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["noop.ts"],"names":["workletNoop","noop"],"mappings":";;;;;;;AAAA,MAAMA,WAAW,GAAG,MAAM;AACxB;AACD,CAFD;;;;AAIA,MAAMC,IAAI,GAAG,MAAM,CAAE,CAArB","sourcesContent":["const workletNoop = () => {\n 'worklet';\n};\n\nconst noop = () => {};\n\nexport { noop, workletNoop };\n"]} \ No newline at end of file diff --git a/lib/commonjs/utilities/normalizeSnapPoint.js b/lib/commonjs/utilities/normalizeSnapPoint.js deleted file mode 100644 index d846c1236..000000000 --- a/lib/commonjs/utilities/normalizeSnapPoint.js +++ /dev/null @@ -1,24 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.normalizeSnapPoint = void 0; - -/** - * Converts a snap point to fixed numbers. - */ -const normalizeSnapPoint = (snapPoint, containerHeight) => { - 'worklet'; - - let normalizedSnapPoint = snapPoint; // percentage snap point - - if (typeof normalizedSnapPoint === 'string') { - normalizedSnapPoint = Number(normalizedSnapPoint.split('%')[0]) * containerHeight / 100; - } - - return Math.max(0, containerHeight - normalizedSnapPoint); -}; - -exports.normalizeSnapPoint = normalizeSnapPoint; -//# sourceMappingURL=normalizeSnapPoint.js.map \ No newline at end of file diff --git a/lib/commonjs/utilities/normalizeSnapPoint.js.map b/lib/commonjs/utilities/normalizeSnapPoint.js.map deleted file mode 100644 index 6c4c14a0c..000000000 --- a/lib/commonjs/utilities/normalizeSnapPoint.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["normalizeSnapPoint.ts"],"names":["normalizeSnapPoint","snapPoint","containerHeight","normalizedSnapPoint","Number","split","Math","max"],"mappings":";;;;;;;AAAA;AACA;AACA;AACO,MAAMA,kBAAkB,GAAG,CAChCC,SADgC,EAEhCC,eAFgC,KAG7B;AACH;;AACA,MAAIC,mBAAmB,GAAGF,SAA1B,CAFG,CAIH;;AACA,MAAI,OAAOE,mBAAP,KAA+B,QAAnC,EAA6C;AAC3CA,IAAAA,mBAAmB,GAChBC,MAAM,CAACD,mBAAmB,CAACE,KAApB,CAA0B,GAA1B,EAA+B,CAA/B,CAAD,CAAN,GAA4CH,eAA7C,GAAgE,GADlE;AAED;;AACD,SAAOI,IAAI,CAACC,GAAL,CAAS,CAAT,EAAYL,eAAe,GAAGC,mBAA9B,CAAP;AACD,CAbM","sourcesContent":["/**\n * Converts a snap point to fixed numbers.\n */\nexport const normalizeSnapPoint = (\n snapPoint: number | string,\n containerHeight: number\n) => {\n 'worklet';\n let normalizedSnapPoint = snapPoint;\n\n // percentage snap point\n if (typeof normalizedSnapPoint === 'string') {\n normalizedSnapPoint =\n (Number(normalizedSnapPoint.split('%')[0]) * containerHeight) / 100;\n }\n return Math.max(0, containerHeight - normalizedSnapPoint);\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/utilities/snapPoint.js b/lib/commonjs/utilities/snapPoint.js deleted file mode 100644 index a525c1e78..000000000 --- a/lib/commonjs/utilities/snapPoint.js +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.snapPoint = void 0; - -const snapPoint = (value, velocity, points) => { - 'worklet'; - - const point = value + 0.2 * velocity; - const deltas = points.map(p => Math.abs(point - p)); - const minDelta = Math.min.apply(null, deltas); - return points.filter(p => Math.abs(point - p) === minDelta)[0]; -}; - -exports.snapPoint = snapPoint; -//# sourceMappingURL=snapPoint.js.map \ No newline at end of file diff --git a/lib/commonjs/utilities/snapPoint.js.map b/lib/commonjs/utilities/snapPoint.js.map deleted file mode 100644 index 1a88bd1f5..000000000 --- a/lib/commonjs/utilities/snapPoint.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["snapPoint.ts"],"names":["snapPoint","value","velocity","points","point","deltas","map","p","Math","abs","minDelta","min","apply","filter"],"mappings":";;;;;;;AAAO,MAAMA,SAAS,GAAG,CACvBC,KADuB,EAEvBC,QAFuB,EAGvBC,MAHuB,KAIZ;AACX;;AACA,QAAMC,KAAK,GAAGH,KAAK,GAAG,MAAMC,QAA5B;AACA,QAAMG,MAAM,GAAGF,MAAM,CAACG,GAAP,CAAWC,CAAC,IAAIC,IAAI,CAACC,GAAL,CAASL,KAAK,GAAGG,CAAjB,CAAhB,CAAf;AACA,QAAMG,QAAQ,GAAGF,IAAI,CAACG,GAAL,CAASC,KAAT,CAAe,IAAf,EAAqBP,MAArB,CAAjB;AACA,SAAOF,MAAM,CAACU,MAAP,CAAcN,CAAC,IAAIC,IAAI,CAACC,GAAL,CAASL,KAAK,GAAGG,CAAjB,MAAwBG,QAA3C,EAAqD,CAArD,CAAP;AACD,CAVM","sourcesContent":["export const snapPoint = (\n value: number,\n velocity: number,\n points: ReadonlyArray\n): number => {\n 'worklet';\n const point = value + 0.2 * velocity;\n const deltas = points.map(p => Math.abs(point - p));\n const minDelta = Math.min.apply(null, deltas);\n return points.filter(p => Math.abs(point - p) === minDelta)[0];\n};\n"]} \ No newline at end of file diff --git a/lib/commonjs/utilities/validateSnapPoint.js b/lib/commonjs/utilities/validateSnapPoint.js deleted file mode 100644 index 8f54cb8ea..000000000 --- a/lib/commonjs/utilities/validateSnapPoint.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.validateSnapPoint = void 0; - -var _invariant = _interopRequireDefault(require("invariant")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -const validateSnapPoint = snapPoint => { - (0, _invariant.default)(typeof snapPoint === 'number' || typeof snapPoint === 'string', `'${snapPoint}' is not a valid snap point! expected types are string or number.`); - (0, _invariant.default)(typeof snapPoint === 'number' || typeof snapPoint === 'string' && snapPoint.includes('%'), `'${snapPoint}' is not a valid percentage snap point! expected percentage snap point must include '%'. e.g. '50%'`); - (0, _invariant.default)(typeof snapPoint === 'number' || typeof snapPoint === 'string' && Number(snapPoint.split('%')[0]), `'${snapPoint}' is not a valid percentage snap point! expected percentage snap point must be only numbers and '%'. e.g. '50%'`); -}; - -exports.validateSnapPoint = validateSnapPoint; -//# sourceMappingURL=validateSnapPoint.js.map \ No newline at end of file diff --git a/lib/commonjs/utilities/validateSnapPoint.js.map b/lib/commonjs/utilities/validateSnapPoint.js.map deleted file mode 100644 index 1705ade1f..000000000 --- a/lib/commonjs/utilities/validateSnapPoint.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["validateSnapPoint.ts"],"names":["validateSnapPoint","snapPoint","includes","Number","split"],"mappings":";;;;;;;AAAA;;;;AAEO,MAAMA,iBAAiB,GAAIC,SAAD,IAAoB;AACnD,0BACE,OAAOA,SAAP,KAAqB,QAArB,IAAiC,OAAOA,SAAP,KAAqB,QADxD,EAEG,IAAGA,SAAU,mEAFhB;AAKA,0BACE,OAAOA,SAAP,KAAqB,QAArB,IACG,OAAOA,SAAP,KAAqB,QAArB,IAAiCA,SAAS,CAACC,QAAV,CAAmB,GAAnB,CAFtC,EAGG,IAAGD,SAAU,qGAHhB;AAMA,0BACE,OAAOA,SAAP,KAAqB,QAArB,IACG,OAAOA,SAAP,KAAqB,QAArB,IAAiCE,MAAM,CAACF,SAAS,CAACG,KAAV,CAAgB,GAAhB,EAAqB,CAArB,CAAD,CAF5C,EAGG,IAAGH,SAAU,iHAHhB;AAKD,CAjBM","sourcesContent":["import invariant from 'invariant';\n\nexport const validateSnapPoint = (snapPoint: any) => {\n invariant(\n typeof snapPoint === 'number' || typeof snapPoint === 'string',\n `'${snapPoint}' is not a valid snap point! expected types are string or number.`\n );\n\n invariant(\n typeof snapPoint === 'number' ||\n (typeof snapPoint === 'string' && snapPoint.includes('%')),\n `'${snapPoint}' is not a valid percentage snap point! expected percentage snap point must include '%'. e.g. '50%'`\n );\n\n invariant(\n typeof snapPoint === 'number' ||\n (typeof snapPoint === 'string' && Number(snapPoint.split('%')[0])),\n `'${snapPoint}' is not a valid percentage snap point! expected percentage snap point must be only numbers and '%'. e.g. '50%'`\n );\n};\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheet/BottomSheet.js b/lib/module/components/bottomSheet/BottomSheet.js deleted file mode 100644 index a6c369635..000000000 --- a/lib/module/components/bottomSheet/BottomSheet.js +++ /dev/null @@ -1,1127 +0,0 @@ -import React, { useMemo, useCallback, forwardRef, useImperativeHandle, memo, useEffect } from 'react'; -import { Platform } from 'react-native'; -import invariant from 'invariant'; -import Animated, { useAnimatedReaction, useSharedValue, useAnimatedStyle, useDerivedValue, runOnJS, interpolate, Extrapolate, runOnUI, cancelAnimation, useWorkletCallback } from 'react-native-reanimated'; -import { State } from 'react-native-gesture-handler'; -import { useScrollable, usePropsValidator, useReactiveSharedValue, useNormalizedSnapPoints, useKeyboard } from '../../hooks'; -import { BottomSheetInternalProvider, BottomSheetProvider } from '../../contexts'; -import BottomSheetContainer from '../bottomSheetContainer'; -import BottomSheetGestureHandlersProvider from '../bottomSheetGestureHandlersProvider'; -import BottomSheetBackdropContainer from '../bottomSheetBackdropContainer'; -import BottomSheetHandleContainer from '../bottomSheetHandleContainer'; -import BottomSheetBackgroundContainer from '../bottomSheetBackgroundContainer'; -import BottomSheetFooterContainer from '../bottomSheetFooterContainer/BottomSheetFooterContainer'; -import BottomSheetDraggableView from '../bottomSheetDraggableView'; // import BottomSheetDebugView from '../bottomSheetDebugView'; - -import { ANIMATION_STATE, KEYBOARD_STATE, KEYBOARD_BEHAVIOR, SHEET_STATE, SCROLLABLE_STATE, KEYBOARD_BLUR_BEHAVIOR, KEYBOARD_INPUT_MODE, ANIMATION_SOURCE } from '../../constants'; -import { animate, getKeyboardAnimationConfigs, normalizeSnapPoint, print } from '../../utilities'; -import { DEFAULT_OVER_DRAG_RESISTANCE_FACTOR, DEFAULT_ENABLE_CONTENT_PANNING_GESTURE, DEFAULT_ENABLE_HANDLE_PANNING_GESTURE, DEFAULT_ENABLE_OVER_DRAG, DEFAULT_ANIMATE_ON_MOUNT, DEFAULT_KEYBOARD_BEHAVIOR, DEFAULT_KEYBOARD_BLUR_BEHAVIOR, DEFAULT_KEYBOARD_INPUT_MODE, INITIAL_CONTAINER_HEIGHT, INITIAL_HANDLE_HEIGHT, INITIAL_POSITION, INITIAL_SNAP_POINT, DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE, INITIAL_CONTAINER_OFFSET, INITIAL_VALUE, DEFAULT_DYNAMIC_SIZING } from './constants'; -import { styles } from './styles'; -Animated.addWhitelistedUIProps({ - decelerationRate: true -}); -const BottomSheetComponent = /*#__PURE__*/forwardRef(function BottomSheet(props, ref) { - //#region validate props - usePropsValidator(props); //#endregion - //#region extract props - - const { - // animations configurations - animationConfigs: _providedAnimationConfigs, - // configurations - index: _providedIndex = 0, - snapPoints: _providedSnapPoints, - animateOnMount = DEFAULT_ANIMATE_ON_MOUNT, - enableContentPanningGesture = DEFAULT_ENABLE_CONTENT_PANNING_GESTURE, - enableHandlePanningGesture = DEFAULT_ENABLE_HANDLE_PANNING_GESTURE, - enableOverDrag = DEFAULT_ENABLE_OVER_DRAG, - enablePanDownToClose = DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE, - enableDynamicSizing = DEFAULT_DYNAMIC_SIZING, - overDragResistanceFactor = DEFAULT_OVER_DRAG_RESISTANCE_FACTOR, - // styles - style: _providedStyle, - containerStyle: _providedContainerStyle, - backgroundStyle: _providedBackgroundStyle, - handleStyle: _providedHandleStyle, - handleIndicatorStyle: _providedHandleIndicatorStyle, - // hooks - gestureEventsHandlersHook, - // keyboard - keyboardBehavior = DEFAULT_KEYBOARD_BEHAVIOR, - keyboardBlurBehavior = DEFAULT_KEYBOARD_BLUR_BEHAVIOR, - android_keyboardInputMode = DEFAULT_KEYBOARD_INPUT_MODE, - // layout - handleHeight: _providedHandleHeight, - containerHeight: _providedContainerHeight, - contentHeight: _providedContentHeight, - containerOffset: _providedContainerOffset, - topInset = 0, - bottomInset = 0, - maxDynamicContentSize, - // animated callback shared values - animatedPosition: _providedAnimatedPosition, - animatedIndex: _providedAnimatedIndex, - // gestures - simultaneousHandlers: _providedSimultaneousHandlers, - waitFor: _providedWaitFor, - activeOffsetX: _providedActiveOffsetX, - activeOffsetY: _providedActiveOffsetY, - failOffsetX: _providedFailOffsetX, - failOffsetY: _providedFailOffsetY, - // callbacks - onChange: _providedOnChange, - onClose: _providedOnClose, - onAnimate: _providedOnAnimate, - // private - $modal = false, - detached = false, - // components - handleComponent, - backdropComponent, - backgroundComponent, - footerComponent, - children: Content - } = props; //#endregion - //#region layout variables - - /** - * This variable is consider an internal variable, - * that will be used conditionally in `animatedContainerHeight` - */ - - const _animatedContainerHeight = useReactiveSharedValue(_providedContainerHeight !== null && _providedContainerHeight !== void 0 ? _providedContainerHeight : INITIAL_CONTAINER_HEIGHT); - /** - * This is a conditional variable, where if the `BottomSheet` is used - * in a modal, then it will subset vertical insets (top+bottom) from - * provided container height. - */ - - - const animatedContainerHeight = useDerivedValue(() => { - const verticalInset = topInset + bottomInset; - return $modal ? _animatedContainerHeight.value - verticalInset : _animatedContainerHeight.value; - }, [$modal, topInset, bottomInset]); - const animatedContainerOffset = useReactiveSharedValue(_providedContainerOffset !== null && _providedContainerOffset !== void 0 ? _providedContainerOffset : INITIAL_CONTAINER_OFFSET); - const animatedHandleHeight = useReactiveSharedValue(_providedHandleHeight !== null && _providedHandleHeight !== void 0 ? _providedHandleHeight : INITIAL_HANDLE_HEIGHT); - const animatedFooterHeight = useSharedValue(0); - const animatedContentHeight = useSharedValue(INITIAL_CONTAINER_HEIGHT); - const animatedSnapPoints = useNormalizedSnapPoints(_providedSnapPoints, animatedContainerHeight, animatedContentHeight, animatedHandleHeight, enableDynamicSizing, maxDynamicContentSize); - const animatedHighestSnapPoint = useDerivedValue(() => animatedSnapPoints.value[animatedSnapPoints.value.length - 1]); - const animatedClosedPosition = useDerivedValue(() => { - let closedPosition = animatedContainerHeight.value; - - if ($modal || detached) { - closedPosition = animatedContainerHeight.value + bottomInset; - } - - return closedPosition; - }, [$modal, detached, bottomInset]); - const animatedSheetHeight = useDerivedValue(() => animatedContainerHeight.value - animatedHighestSnapPoint.value); - const animatedCurrentIndex = useReactiveSharedValue(animateOnMount ? -1 : _providedIndex); - const animatedPosition = useSharedValue(INITIAL_POSITION); - const animatedNextPosition = useSharedValue(INITIAL_VALUE); - const animatedNextPositionIndex = useSharedValue(0); // conditional - - const isAnimatedOnMount = useSharedValue(false); - const isContentHeightFixed = useSharedValue(false); - const isLayoutCalculated = useDerivedValue(() => { - let isContainerHeightCalculated = false; //container height was provided. - - if (_providedContainerHeight !== null || _providedContainerHeight !== undefined) { - isContainerHeightCalculated = true; - } // container height did set. - - - if (animatedContainerHeight.value !== INITIAL_CONTAINER_HEIGHT) { - isContainerHeightCalculated = true; - } - - let isHandleHeightCalculated = false; // handle height is provided. - - if (_providedHandleHeight !== null && _providedHandleHeight !== undefined && typeof _providedHandleHeight === 'number') { - isHandleHeightCalculated = true; - } // handle component is null. - - - if (handleComponent === null) { - animatedHandleHeight.value = 0; - isHandleHeightCalculated = true; - } // handle height did set. - - - if (animatedHandleHeight.value !== INITIAL_HANDLE_HEIGHT) { - isHandleHeightCalculated = true; - } - - let isSnapPointsNormalized = false; // the first snap point did normalized - - if (animatedSnapPoints.value[0] !== INITIAL_SNAP_POINT) { - isSnapPointsNormalized = true; - } - - return isContainerHeightCalculated && isHandleHeightCalculated && isSnapPointsNormalized; - }); - const isInTemporaryPosition = useSharedValue(false); - const isForcedClosing = useSharedValue(false); // gesture - - const animatedContentGestureState = useSharedValue(State.UNDETERMINED); - const animatedHandleGestureState = useSharedValue(State.UNDETERMINED); //#endregion - //#region hooks variables - // scrollable variables - - const { - animatedScrollableType, - animatedScrollableContentOffsetY, - animatedScrollableOverrideState, - isScrollableRefreshable, - setScrollableRef, - removeScrollableRef - } = useScrollable(); // keyboard - - const { - state: animatedKeyboardState, - height: animatedKeyboardHeight, - animationDuration: keyboardAnimationDuration, - animationEasing: keyboardAnimationEasing, - shouldHandleKeyboardEvents - } = useKeyboard(); - const animatedKeyboardHeightInContainer = useSharedValue(0); //#endregion - //#region state/dynamic variables - // states - - const animatedAnimationState = useSharedValue(ANIMATION_STATE.UNDETERMINED); - const animatedAnimationSource = useSharedValue(ANIMATION_SOURCE.MOUNT); - const animatedSheetState = useDerivedValue(() => { - // closed position = position >= container height - if (animatedPosition.value >= animatedClosedPosition.value) return SHEET_STATE.CLOSED; // extended position = container height - sheet height - - const extendedPosition = animatedContainerHeight.value - animatedSheetHeight.value; - if (animatedPosition.value === extendedPosition) return SHEET_STATE.EXTENDED; // extended position with keyboard = - // container height - (sheet height + keyboard height in root container) - - const keyboardHeightInContainer = animatedKeyboardHeightInContainer.value; - const extendedPositionWithKeyboard = Math.max(0, animatedContainerHeight.value - (animatedSheetHeight.value + keyboardHeightInContainer)); // detect if keyboard is open and the sheet is in temporary position - - if (keyboardBehavior === KEYBOARD_BEHAVIOR.interactive && isInTemporaryPosition.value && animatedPosition.value === extendedPositionWithKeyboard) { - return SHEET_STATE.EXTENDED; - } // fill parent = 0 - - - if (animatedPosition.value === 0) { - return SHEET_STATE.FILL_PARENT; - } // detect if position is below extended point - - - if (animatedPosition.value < extendedPosition) { - return SHEET_STATE.OVER_EXTENDED; - } - - return SHEET_STATE.OPENED; - }, [animatedClosedPosition, animatedContainerHeight, animatedKeyboardHeightInContainer, animatedPosition, animatedSheetHeight, isInTemporaryPosition, keyboardBehavior]); - const animatedScrollableState = useDerivedValue(() => { - /** - * if scrollable override state is set, then we just return its value. - */ - if (animatedScrollableOverrideState.value !== SCROLLABLE_STATE.UNDETERMINED) { - return animatedScrollableOverrideState.value; - } - /** - * if sheet state is fill parent, then unlock scrolling - */ - - - if (animatedSheetState.value === SHEET_STATE.FILL_PARENT) { - return SCROLLABLE_STATE.UNLOCKED; - } - /** - * if sheet state is extended, then unlock scrolling - */ - - - if (animatedSheetState.value === SHEET_STATE.EXTENDED) { - return SCROLLABLE_STATE.UNLOCKED; - } - /** - * if keyboard is shown and sheet is animating - * then we do not lock the scrolling to not lose - * current scrollable scroll position. - */ - - - if (animatedKeyboardState.value === KEYBOARD_STATE.SHOWN && animatedAnimationState.value === ANIMATION_STATE.RUNNING) { - return SCROLLABLE_STATE.UNLOCKED; - } - - return SCROLLABLE_STATE.LOCKED; - }); // dynamic - - const animatedContentHeightMax = useDerivedValue(() => { - const keyboardHeightInContainer = animatedKeyboardHeightInContainer.value; - const handleHeight = Math.max(0, animatedHandleHeight.value); - let contentHeight = animatedSheetHeight.value - handleHeight; - - if (keyboardBehavior === KEYBOARD_BEHAVIOR.extend && animatedKeyboardState.value === KEYBOARD_STATE.SHOWN) { - contentHeight = contentHeight - keyboardHeightInContainer; - } else if (keyboardBehavior === KEYBOARD_BEHAVIOR.fillParent && isInTemporaryPosition.value) { - if (animatedKeyboardState.value === KEYBOARD_STATE.SHOWN) { - contentHeight = animatedContainerHeight.value - handleHeight - keyboardHeightInContainer; - } else { - contentHeight = animatedContainerHeight.value - handleHeight; - } - } else if (keyboardBehavior === KEYBOARD_BEHAVIOR.interactive && isInTemporaryPosition.value) { - const contentWithKeyboardHeight = contentHeight + keyboardHeightInContainer; - - if (animatedKeyboardState.value === KEYBOARD_STATE.SHOWN) { - if (keyboardHeightInContainer + animatedSheetHeight.value > animatedContainerHeight.value) { - contentHeight = animatedContainerHeight.value - keyboardHeightInContainer - handleHeight; - } - } else if (contentWithKeyboardHeight + handleHeight > animatedContainerHeight.value) { - contentHeight = animatedContainerHeight.value - handleHeight; - } else { - contentHeight = contentWithKeyboardHeight; - } - } - /** - * before the container is measured, `contentHeight` value will be below zero, - * which will lead to freeze the scrollable. - * - * @link (https://github.com/gorhom/react-native-bottom-sheet/issues/470) - */ - - - return Math.max(contentHeight, 0); - }, [animatedContainerHeight, animatedHandleHeight, animatedKeyboardHeightInContainer, animatedKeyboardState, animatedSheetHeight, isInTemporaryPosition, keyboardBehavior]); - const animatedIndex = useDerivedValue(() => { - const adjustedSnapPoints = animatedSnapPoints.value.slice().reverse(); - const adjustedSnapPointsIndexes = animatedSnapPoints.value.slice().map((_, index) => index).reverse(); - /** - * we add the close state index `-1` - */ - - adjustedSnapPoints.push(animatedContainerHeight.value); - adjustedSnapPointsIndexes.push(-1); - const currentIndex = isLayoutCalculated.value ? interpolate(animatedPosition.value, adjustedSnapPoints, adjustedSnapPointsIndexes, Extrapolate.CLAMP) : -1; - /** - * if the sheet is currently running an animation by the keyboard opening, - * then we clamp the index on android with resize keyboard mode. - */ - - if (android_keyboardInputMode === KEYBOARD_INPUT_MODE.adjustResize && animatedAnimationSource.value === ANIMATION_SOURCE.KEYBOARD && animatedAnimationState.value === ANIMATION_STATE.RUNNING && isInTemporaryPosition.value) { - return Math.max(animatedCurrentIndex.value, currentIndex); - } - /** - * if the sheet is currently running an animation by snap point change - usually caused - * by dynamic content height -, then we return the next position index. - */ - - - if (animatedAnimationSource.value === ANIMATION_SOURCE.SNAP_POINT_CHANGE && animatedAnimationState.value === ANIMATION_STATE.RUNNING) { - return animatedNextPositionIndex.value; - } - - return currentIndex; - }, [android_keyboardInputMode]); //#endregion - //#region private methods - - /** - * Calculate the next position based on keyboard state. - */ - - const getNextPosition = useWorkletCallback(function getNextPosition() { - 'worklet'; - - const currentIndex = animatedCurrentIndex.value; - const snapPoints = animatedSnapPoints.value; - const keyboardState = animatedKeyboardState.value; - const highestSnapPoint = animatedHighestSnapPoint.value; - /** - * Handle restore sheet position on blur - */ - - if (keyboardBlurBehavior === KEYBOARD_BLUR_BEHAVIOR.restore && keyboardState === KEYBOARD_STATE.HIDDEN && animatedContentGestureState.value !== State.ACTIVE && animatedHandleGestureState.value !== State.ACTIVE) { - isInTemporaryPosition.value = false; - const nextPosition = snapPoints[currentIndex]; - return nextPosition; - } - /** - * Handle extend behavior - */ - - - if (keyboardBehavior === KEYBOARD_BEHAVIOR.extend && keyboardState === KEYBOARD_STATE.SHOWN) { - return highestSnapPoint; - } - /** - * Handle full screen behavior - */ - - - if (keyboardBehavior === KEYBOARD_BEHAVIOR.fillParent && keyboardState === KEYBOARD_STATE.SHOWN) { - isInTemporaryPosition.value = true; - return 0; - } - /** - * handle interactive behavior - */ - - - if (keyboardBehavior === KEYBOARD_BEHAVIOR.interactive && keyboardState === KEYBOARD_STATE.SHOWN) { - isInTemporaryPosition.value = true; - const keyboardHeightInContainer = animatedKeyboardHeightInContainer.value; - return Math.max(0, highestSnapPoint - keyboardHeightInContainer); - } - - if (isInTemporaryPosition.value) { - return animatedPosition.value; - } - - return snapPoints[currentIndex]; - }, [animatedContentGestureState, animatedCurrentIndex, animatedHandleGestureState, animatedHighestSnapPoint, animatedKeyboardHeightInContainer, animatedKeyboardState, animatedPosition, animatedSnapPoints, isInTemporaryPosition, keyboardBehavior, keyboardBlurBehavior]); - const handleOnChange = useCallback(function handleOnChange(index) { - print({ - component: BottomSheet.name, - method: handleOnChange.name, - params: { - index, - animatedCurrentIndex: animatedCurrentIndex.value - } - }); - - if (_providedOnChange) { - _providedOnChange(index); - } - }, [_providedOnChange, animatedCurrentIndex]); - const handleOnAnimate = useCallback(function handleOnAnimate(toPoint) { - const snapPoints = animatedSnapPoints.value; - const toIndex = snapPoints.indexOf(toPoint); - print({ - component: BottomSheet.name, - method: handleOnAnimate.name, - params: { - toIndex, - fromIndex: animatedCurrentIndex.value - } - }); - - if (!_providedOnAnimate) { - return; - } - - if (toIndex !== animatedCurrentIndex.value) { - _providedOnAnimate(animatedCurrentIndex.value, toIndex); - } - }, [_providedOnAnimate, animatedSnapPoints, animatedCurrentIndex]); //#endregion - //#region animation - - const stopAnimation = useWorkletCallback(() => { - cancelAnimation(animatedPosition); - isForcedClosing.value = false; - animatedAnimationSource.value = ANIMATION_SOURCE.NONE; - animatedAnimationState.value = ANIMATION_STATE.STOPPED; - }, [animatedPosition, animatedAnimationState, animatedAnimationSource]); - const animateToPositionCompleted = useWorkletCallback(function animateToPositionCompleted(isFinished) { - isForcedClosing.value = false; - - if (!isFinished) { - return; - } - - runOnJS(print)({ - component: BottomSheet.name, - method: animateToPositionCompleted.name, - params: { - animatedCurrentIndex: animatedCurrentIndex.value, - animatedNextPosition: animatedNextPosition.value, - animatedNextPositionIndex: animatedNextPositionIndex.value - } - }); - animatedAnimationSource.value = ANIMATION_SOURCE.NONE; - animatedAnimationState.value = ANIMATION_STATE.STOPPED; - animatedNextPosition.value = INITIAL_VALUE; - animatedNextPositionIndex.value = INITIAL_VALUE; - }); - const animateToPosition = useWorkletCallback(function animateToPosition(position, source, velocity = 0, configs) { - if (position === animatedPosition.value || position === undefined || animatedAnimationState.value === ANIMATION_STATE.RUNNING && position === animatedNextPosition.value) { - return; - } - - runOnJS(print)({ - component: BottomSheet.name, - method: animateToPosition.name, - params: { - currentPosition: animatedPosition.value, - position, - velocity, - animatedContainerHeight: animatedContainerHeight.value - } - }); - stopAnimation(); - /** - * set animation state to running, and source - */ - - animatedAnimationState.value = ANIMATION_STATE.RUNNING; - animatedAnimationSource.value = source; - /** - * store next position - */ - - animatedNextPosition.value = position; - animatedNextPositionIndex.value = animatedSnapPoints.value.indexOf(position); - /** - * fire `onAnimate` callback - */ - - runOnJS(handleOnAnimate)(position); - /** - * force animation configs from parameters, if provided - */ - - if (configs !== undefined) { - animatedPosition.value = animate({ - point: position, - configs, - velocity, - onComplete: animateToPositionCompleted - }); - } else { - /** - * use animationConfigs callback, if provided - */ - animatedPosition.value = animate({ - point: position, - velocity, - configs: _providedAnimationConfigs, - onComplete: animateToPositionCompleted - }); - } - }, [handleOnAnimate, _providedAnimationConfigs]); //#endregion - //#region public methods - - const handleSnapToIndex = useCallback(function handleSnapToIndex(index, animationConfigs) { - const snapPoints = animatedSnapPoints.value; - invariant(index >= -1 && index <= snapPoints.length - 1, `'index' was provided but out of the provided snap points range! expected value to be between -1, ${snapPoints.length - 1}`); - print({ - component: BottomSheet.name, - method: handleSnapToIndex.name, - params: { - index - } - }); - const nextPosition = snapPoints[index]; - /** - * exit method if : - * - layout is not calculated. - * - already animating to next position. - * - sheet is forced closing. - */ - - if (!isLayoutCalculated.value || index === animatedNextPositionIndex.value || nextPosition === animatedNextPosition.value || isForcedClosing.value) { - return; - } - /** - * reset temporary position boolean. - */ - - - isInTemporaryPosition.value = false; - runOnUI(animateToPosition)(nextPosition, ANIMATION_SOURCE.USER, 0, animationConfigs); - }, [animateToPosition, isLayoutCalculated, isInTemporaryPosition, isForcedClosing, animatedSnapPoints, animatedNextPosition, animatedNextPositionIndex]); - const handleSnapToPosition = useWorkletCallback(function handleSnapToPosition(position, animationConfigs) { - print({ - component: BottomSheet.name, - method: handleSnapToPosition.name, - params: { - position - } - }); - /** - * normalized provided position. - */ - - const nextPosition = normalizeSnapPoint(position, animatedContainerHeight.value); - /** - * exit method if : - * - layout is not calculated. - * - already animating to next position. - * - sheet is forced closing. - */ - - if (!isLayoutCalculated || nextPosition === animatedNextPosition.value || isForcedClosing.value) { - return; - } - /** - * mark the new position as temporary. - */ - - - isInTemporaryPosition.value = true; - runOnUI(animateToPosition)(nextPosition, ANIMATION_SOURCE.USER, 0, animationConfigs); - }, [animateToPosition, bottomInset, topInset, isLayoutCalculated, isForcedClosing, animatedContainerHeight, animatedPosition]); - const handleClose = useCallback(function handleClose(animationConfigs) { - print({ - component: BottomSheet.name, - method: handleClose.name - }); - const nextPosition = animatedClosedPosition.value; - /** - * exit method if : - * - layout is not calculated. - * - already animating to next position. - * - sheet is forced closing. - */ - - if (!isLayoutCalculated.value || nextPosition === animatedNextPosition.value || isForcedClosing.value) { - return; - } - /** - * reset temporary position variable. - */ - - - isInTemporaryPosition.value = false; - runOnUI(animateToPosition)(nextPosition, ANIMATION_SOURCE.USER, 0, animationConfigs); - }, [animateToPosition, isForcedClosing, isLayoutCalculated, isInTemporaryPosition, animatedNextPosition, animatedClosedPosition]); - const handleForceClose = useCallback(function handleForceClose(animationConfigs) { - print({ - component: BottomSheet.name, - method: handleForceClose.name - }); - const nextPosition = animatedClosedPosition.value; - /** - * exit method if : - * - already animating to next position. - * - sheet is forced closing. - */ - - if (nextPosition === animatedNextPosition.value || isForcedClosing.value) { - return; - } - /** - * reset temporary position variable. - */ - - - isInTemporaryPosition.value = false; - /** - * set force closing variable. - */ - - isForcedClosing.value = true; - runOnUI(animateToPosition)(nextPosition, ANIMATION_SOURCE.USER, 0, animationConfigs); - }, [animateToPosition, isForcedClosing, isInTemporaryPosition, animatedNextPosition, animatedClosedPosition]); - const handleExpand = useCallback(function handleExpand(animationConfigs) { - print({ - component: BottomSheet.name, - method: handleExpand.name - }); - const snapPoints = animatedSnapPoints.value; - const nextPosition = snapPoints[snapPoints.length - 1]; - /** - * exit method if : - * - layout is not calculated. - * - already animating to next position. - * - sheet is forced closing. - */ - - if (!isLayoutCalculated.value || snapPoints.length - 1 === animatedNextPositionIndex.value || nextPosition === animatedNextPosition.value || isForcedClosing.value) { - return; - } - /** - * reset temporary position boolean. - */ - - - isInTemporaryPosition.value = false; - runOnUI(animateToPosition)(nextPosition, ANIMATION_SOURCE.USER, 0, animationConfigs); - }, [animateToPosition, isInTemporaryPosition, isLayoutCalculated, isForcedClosing, animatedSnapPoints, animatedNextPosition, animatedNextPositionIndex]); - const handleCollapse = useCallback(function handleCollapse(animationConfigs) { - print({ - component: BottomSheet.name, - method: handleCollapse.name - }); - const nextPosition = animatedSnapPoints.value[0]; - /** - * exit method if : - * - layout is not calculated. - * - already animating to next position. - * - sheet is forced closing. - */ - - if (!isLayoutCalculated || animatedNextPositionIndex.value === 0 || nextPosition === animatedNextPosition.value || isForcedClosing.value) { - return; - } - /** - * reset temporary position boolean. - */ - - - isInTemporaryPosition.value = false; - runOnUI(animateToPosition)(nextPosition, ANIMATION_SOURCE.USER, 0, animationConfigs); - }, [animateToPosition, isForcedClosing, isLayoutCalculated, isInTemporaryPosition, animatedSnapPoints, animatedNextPosition, animatedNextPositionIndex]); - useImperativeHandle(ref, () => ({ - snapToIndex: handleSnapToIndex, - snapToPosition: handleSnapToPosition, - expand: handleExpand, - collapse: handleCollapse, - close: handleClose, - forceClose: handleForceClose - })); //#endregion - //#region contexts variables - - const internalContextVariables = useMemo(() => ({ - enableContentPanningGesture, - enableDynamicSizing, - overDragResistanceFactor, - enableOverDrag, - enablePanDownToClose, - animatedAnimationState, - animatedSheetState, - animatedScrollableState, - animatedScrollableOverrideState, - animatedContentGestureState, - animatedHandleGestureState, - animatedKeyboardState, - animatedScrollableType, - animatedIndex, - animatedPosition, - animatedContentHeight, - animatedClosedPosition, - animatedHandleHeight, - animatedFooterHeight, - animatedKeyboardHeight, - animatedKeyboardHeightInContainer, - animatedContainerHeight, - animatedSnapPoints, - animatedHighestSnapPoint, - animatedScrollableContentOffsetY, - isInTemporaryPosition, - isContentHeightFixed, - isScrollableRefreshable, - shouldHandleKeyboardEvents, - simultaneousHandlers: _providedSimultaneousHandlers, - waitFor: _providedWaitFor, - activeOffsetX: _providedActiveOffsetX, - activeOffsetY: _providedActiveOffsetY, - failOffsetX: _providedFailOffsetX, - failOffsetY: _providedFailOffsetY, - animateToPosition, - stopAnimation, - setScrollableRef, - removeScrollableRef - }), [animatedIndex, animatedPosition, animatedContentHeight, animatedScrollableType, animatedContentGestureState, animatedHandleGestureState, animatedClosedPosition, animatedFooterHeight, animatedContainerHeight, animatedHandleHeight, animatedAnimationState, animatedKeyboardState, animatedKeyboardHeight, animatedKeyboardHeightInContainer, animatedSheetState, animatedHighestSnapPoint, animatedScrollableState, animatedScrollableOverrideState, animatedSnapPoints, shouldHandleKeyboardEvents, animatedScrollableContentOffsetY, isScrollableRefreshable, isContentHeightFixed, isInTemporaryPosition, enableContentPanningGesture, overDragResistanceFactor, enableOverDrag, enablePanDownToClose, enableDynamicSizing, _providedSimultaneousHandlers, _providedWaitFor, _providedActiveOffsetX, _providedActiveOffsetY, _providedFailOffsetX, _providedFailOffsetY, setScrollableRef, removeScrollableRef, animateToPosition, stopAnimation]); - const externalContextVariables = useMemo(() => ({ - animatedIndex, - animatedPosition, - snapToIndex: handleSnapToIndex, - snapToPosition: handleSnapToPosition, - expand: handleExpand, - collapse: handleCollapse, - close: handleClose, - forceClose: handleForceClose - }), [animatedIndex, animatedPosition, handleSnapToIndex, handleSnapToPosition, handleExpand, handleCollapse, handleClose, handleForceClose]); //#endregion - //#region styles - - const containerAnimatedStyle = useAnimatedStyle(() => ({ - opacity: Platform.OS === 'android' && animatedIndex.value === -1 ? 0 : 1, - transform: [{ - translateY: animatedPosition.value - }] - }), [animatedPosition, animatedIndex]); - const containerStyle = useMemo(() => [_providedStyle, styles.container, containerAnimatedStyle], [_providedStyle, containerAnimatedStyle]); - const contentContainerAnimatedStyle = useAnimatedStyle(() => { - /** - * if content height was provided, then we skip setting - * calculated height. - */ - if (_providedContentHeight) { - return {}; - } - - return { - height: animate({ - point: animatedContentHeightMax.value, - configs: _providedAnimationConfigs - }) - }; - }, [animatedContentHeightMax, enableDynamicSizing, animatedContentHeight]); - const contentContainerStyle = useMemo(() => [styles.contentContainer, contentContainerAnimatedStyle], [contentContainerAnimatedStyle]); - /** - * added safe area to prevent the sheet from floating above - * the bottom of the screen, when sheet being over dragged or - * when the sheet is resized. - */ - - const contentMaskContainerAnimatedStyle = useAnimatedStyle(() => { - if (detached) { - return { - overflow: 'visible' - }; - } - - return { - paddingBottom: animatedContainerHeight.value - }; - }, [detached]); - const contentMaskContainerStyle = useMemo(() => [styles.contentMaskContainer, contentMaskContainerAnimatedStyle], [contentMaskContainerAnimatedStyle]); //#endregion - //#region effects - - /** - * React to `isLayoutCalculated` change, to insure that the sheet will - * appears/mounts only when all layout is been calculated. - * - * @alias OnMount - */ - - useAnimatedReaction(() => isLayoutCalculated.value, _isLayoutCalculated => { - /** - * exit method if: - * - layout is not calculated yet. - * - already did animate on mount. - */ - if (!_isLayoutCalculated || isAnimatedOnMount.value) { - return; - } - - let nextPosition; - - if (_providedIndex === -1) { - nextPosition = animatedClosedPosition.value; - animatedNextPositionIndex.value = -1; - } else { - nextPosition = animatedSnapPoints.value[_providedIndex]; - } - - runOnJS(print)({ - component: BottomSheet.name, - method: 'useAnimatedReaction::OnMount', - params: { - isLayoutCalculated: _isLayoutCalculated, - animatedSnapPoints: animatedSnapPoints.value, - nextPosition - } - }); - /** - * here we exit method early because the next position - * is out of the screen, this happens when `snapPoints` - * still being calculated. - */ - - if (nextPosition === INITIAL_POSITION || nextPosition === animatedClosedPosition.value) { - isAnimatedOnMount.value = true; - animatedCurrentIndex.value = _providedIndex; - return; - } - - if (animateOnMount) { - animateToPosition(nextPosition, ANIMATION_SOURCE.MOUNT); - } else { - animatedPosition.value = nextPosition; - } - - isAnimatedOnMount.value = true; - }, [_providedIndex, animateOnMount]); - /** - * React to `snapPoints` change, to insure that the sheet position reflect - * to the current point correctly. - * - * @alias OnSnapPointsChange - */ - - useAnimatedReaction(() => ({ - snapPoints: animatedSnapPoints.value, - containerHeight: animatedContainerHeight.value - }), (result, _previousResult) => { - const { - snapPoints, - containerHeight - } = result; - - const _previousSnapPoints = _previousResult === null || _previousResult === void 0 ? void 0 : _previousResult.snapPoints; - - const _previousContainerHeight = _previousResult === null || _previousResult === void 0 ? void 0 : _previousResult.containerHeight; - - let nextPosition; - let animationConfig; - let animationSource = ANIMATION_SOURCE.SNAP_POINT_CHANGE; - /** - * if the bottom sheet is closing and the container gets resized, - * then we restart the closing animation to the new position. - */ - - if (animatedAnimationState.value === ANIMATION_STATE.RUNNING && animatedNextPositionIndex.value === -1 && _previousContainerHeight !== containerHeight) { - animationSource = ANIMATION_SOURCE.CONTAINER_RESIZE; - animationConfig = { - duration: 0 - }; - animateToPosition(containerHeight, animationSource, 0, animationConfig); - } - - if (JSON.stringify(snapPoints) === JSON.stringify(_previousSnapPoints) || !isLayoutCalculated.value || !isAnimatedOnMount.value || containerHeight <= 0) { - return; - } - - runOnJS(print)({ - component: BottomSheet.name, - method: 'useAnimatedReaction::OnSnapPointChange', - params: { - snapPoints - } - }); - /** - * if snap points changed while sheet is animating, then - * we stop the animation and animate to the updated point. - */ - - if (animatedAnimationState.value === ANIMATION_STATE.RUNNING && animatedNextPositionIndex.value !== animatedCurrentIndex.value) { - nextPosition = animatedNextPositionIndex.value !== -1 ? snapPoints[animatedNextPositionIndex.value] : animatedNextPosition.value; - } else if (animatedCurrentIndex.value === -1) { - nextPosition = animatedClosedPosition.value; - } else if (isInTemporaryPosition.value) { - nextPosition = getNextPosition(); - } else { - nextPosition = snapPoints[animatedCurrentIndex.value]; - /** - * if snap points changes because of the container height change, - * then we skip the snap animation by setting the duration to 0. - */ - - if (containerHeight !== _previousContainerHeight) { - animationSource = ANIMATION_SOURCE.CONTAINER_RESIZE; - animationConfig = { - duration: 0 - }; - } - } - - animateToPosition(nextPosition, animationSource, 0, animationConfig); - }); - /** - * React to keyboard appearance state. - * - * @alias OnKeyboardStateChange - */ - - useAnimatedReaction(() => ({ - _keyboardState: animatedKeyboardState.value, - _keyboardHeight: animatedKeyboardHeight.value - }), (result, _previousResult) => { - const { - _keyboardState, - _keyboardHeight - } = result; - - const _previousKeyboardState = _previousResult === null || _previousResult === void 0 ? void 0 : _previousResult._keyboardState; - - const _previousKeyboardHeight = _previousResult === null || _previousResult === void 0 ? void 0 : _previousResult._keyboardHeight; - /** - * Calculate the keyboard height in the container. - */ - - - animatedKeyboardHeightInContainer.value = $modal ? Math.abs(_keyboardHeight - Math.abs(bottomInset - animatedContainerOffset.value.bottom)) : Math.abs(_keyboardHeight - animatedContainerOffset.value.bottom); - const hasActiveGesture = animatedContentGestureState.value === State.ACTIVE || animatedContentGestureState.value === State.BEGAN || animatedHandleGestureState.value === State.ACTIVE || animatedHandleGestureState.value === State.BEGAN; - - if ( - /** - * if keyboard state is equal to the previous state, then exit the method - */ - _keyboardState === _previousKeyboardState && _keyboardHeight === _previousKeyboardHeight || - /** - * if user is interacting with sheet, then exit the method - */ - hasActiveGesture || - /** - * if sheet not animated on mount yet, then exit the method - */ - !isAnimatedOnMount.value || _keyboardState === KEYBOARD_STATE.HIDDEN && keyboardBlurBehavior === KEYBOARD_BLUR_BEHAVIOR.none || Platform.OS === 'android' && keyboardBehavior === KEYBOARD_BEHAVIOR.interactive && android_keyboardInputMode === KEYBOARD_INPUT_MODE.adjustResize) { - animatedKeyboardHeightInContainer.value = 0; - return; - } - - runOnJS(print)({ - component: BottomSheet.name, - method: 'useAnimatedReaction::OnKeyboardStateChange', - params: { - keyboardState: _keyboardState, - keyboardHeight: _keyboardHeight - } - }); - let animationConfigs = getKeyboardAnimationConfigs(keyboardAnimationEasing.value, keyboardAnimationDuration.value); - const nextPosition = getNextPosition(); - animateToPosition(nextPosition, ANIMATION_SOURCE.KEYBOARD, 0, animationConfigs); - }, [$modal, bottomInset, keyboardBehavior, keyboardBlurBehavior, android_keyboardInputMode, animatedContainerOffset, getNextPosition]); - /** - * sets provided animated position - */ - - useAnimatedReaction(() => animatedPosition.value, _animatedPosition => { - if (_providedAnimatedPosition) { - _providedAnimatedPosition.value = _animatedPosition + topInset; - } - }); - /** - * sets provided animated index - */ - - useAnimatedReaction(() => animatedIndex.value, _animatedIndex => { - if (_providedAnimatedIndex) { - _providedAnimatedIndex.value = _animatedIndex; - } - }); - /** - * React to internal variables to detect change in snap position. - * - * @alias OnChange - */ - - useAnimatedReaction(() => ({ - _animatedIndex: animatedIndex.value, - _animatedPosition: animatedPosition.value, - _animationState: animatedAnimationState.value, - _contentGestureState: animatedContentGestureState.value, - _handleGestureState: animatedHandleGestureState.value - }), ({ - _animatedIndex, - _animationState, - _contentGestureState, - _handleGestureState - }) => { - /** - * exit the method if animation state is not stopped. - */ - if (_animationState !== ANIMATION_STATE.STOPPED) { - return; - } - /** - * exit the method if animated index value - * has fraction, e.g. 1.99, 0.52 - */ - - - if (_animatedIndex % 1 !== 0) { - return; - } - /** - * exit the method if there any active gesture. - */ - - - const hasNoActiveGesture = (_contentGestureState === State.END || _contentGestureState === State.UNDETERMINED || _contentGestureState === State.CANCELLED) && (_handleGestureState === State.END || _handleGestureState === State.UNDETERMINED || _handleGestureState === State.CANCELLED); - - if (!hasNoActiveGesture) { - return; - } - /** - * if the index is not equal to the current index, - * than the sheet position had changed and we trigger - * the `onChange` callback. - */ - - - if (_animatedIndex !== animatedCurrentIndex.value) { - runOnJS(print)({ - component: BottomSheet.name, - method: 'useAnimatedReaction::OnChange', - params: { - animatedCurrentIndex: animatedCurrentIndex.value, - animatedIndex: _animatedIndex - } - }); - animatedCurrentIndex.value = _animatedIndex; - runOnJS(handleOnChange)(_animatedIndex); - } - /** - * if index is `-1` than we fire the `onClose` callback. - */ - - - if (_animatedIndex === -1 && _providedOnClose) { - runOnJS(print)({ - component: BottomSheet.name, - method: 'useAnimatedReaction::onClose', - params: { - animatedCurrentIndex: animatedCurrentIndex.value, - animatedIndex: _animatedIndex - } - }); - runOnJS(_providedOnClose)(); - } - }, [handleOnChange, _providedOnClose]); - /** - * React to `index` prop to snap the sheet to the new position. - * - * @alias onIndexChange - */ - - useEffect(() => { - if (isAnimatedOnMount.value) { - handleSnapToIndex(_providedIndex); - } - }, [_providedIndex, animatedCurrentIndex, isAnimatedOnMount, handleSnapToIndex]); //#endregion - // render - - print({ - component: BottomSheet.name, - method: 'render', - params: { - animatedSnapPoints: animatedSnapPoints.value, - animatedCurrentIndex: animatedCurrentIndex.value, - providedIndex: _providedIndex - } - }); - return /*#__PURE__*/React.createElement(BottomSheetProvider, { - value: externalContextVariables - }, /*#__PURE__*/React.createElement(BottomSheetInternalProvider, { - value: internalContextVariables - }, /*#__PURE__*/React.createElement(BottomSheetGestureHandlersProvider, { - gestureEventsHandlersHook: gestureEventsHandlersHook - }, /*#__PURE__*/React.createElement(BottomSheetBackdropContainer, { - key: "BottomSheetBackdropContainer", - animatedIndex: animatedIndex, - animatedPosition: animatedPosition, - backdropComponent: backdropComponent - }), /*#__PURE__*/React.createElement(BottomSheetContainer, { - key: "BottomSheetContainer", - shouldCalculateHeight: !$modal, - containerHeight: _animatedContainerHeight, - containerOffset: animatedContainerOffset, - topInset: topInset, - bottomInset: bottomInset, - detached: detached, - style: _providedContainerStyle - }, /*#__PURE__*/React.createElement(Animated.View, { - style: containerStyle - }, /*#__PURE__*/React.createElement(BottomSheetBackgroundContainer, { - key: "BottomSheetBackgroundContainer", - animatedIndex: animatedIndex, - animatedPosition: animatedPosition, - backgroundComponent: backgroundComponent, - backgroundStyle: _providedBackgroundStyle - }), /*#__PURE__*/React.createElement(Animated.View, { - pointerEvents: "box-none", - style: contentMaskContainerStyle - }, /*#__PURE__*/React.createElement(BottomSheetDraggableView, { - key: "BottomSheetRootDraggableView", - style: contentContainerStyle - }, typeof Content === 'function' ? /*#__PURE__*/React.createElement(Content, null) : Content, footerComponent && /*#__PURE__*/React.createElement(BottomSheetFooterContainer, { - footerComponent: footerComponent - }))), /*#__PURE__*/React.createElement(BottomSheetHandleContainer, { - key: "BottomSheetHandleContainer", - animatedIndex: animatedIndex, - animatedPosition: animatedPosition, - handleHeight: animatedHandleHeight, - enableHandlePanningGesture: enableHandlePanningGesture, - enableOverDrag: enableOverDrag, - enablePanDownToClose: enablePanDownToClose, - overDragResistanceFactor: overDragResistanceFactor, - keyboardBehavior: keyboardBehavior, - handleComponent: handleComponent, - handleStyle: _providedHandleStyle, - handleIndicatorStyle: _providedHandleIndicatorStyle - })))))); -}); -const BottomSheet = /*#__PURE__*/memo(BottomSheetComponent); -BottomSheet.displayName = 'BottomSheet'; -export default BottomSheet; -//# sourceMappingURL=BottomSheet.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheet/BottomSheet.js.map b/lib/module/components/bottomSheet/BottomSheet.js.map deleted file mode 100644 index 7cd46b65f..000000000 --- a/lib/module/components/bottomSheet/BottomSheet.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheet.tsx"],"names":["React","useMemo","useCallback","forwardRef","useImperativeHandle","memo","useEffect","Platform","invariant","Animated","useAnimatedReaction","useSharedValue","useAnimatedStyle","useDerivedValue","runOnJS","interpolate","Extrapolate","runOnUI","cancelAnimation","useWorkletCallback","State","useScrollable","usePropsValidator","useReactiveSharedValue","useNormalizedSnapPoints","useKeyboard","BottomSheetInternalProvider","BottomSheetProvider","BottomSheetContainer","BottomSheetGestureHandlersProvider","BottomSheetBackdropContainer","BottomSheetHandleContainer","BottomSheetBackgroundContainer","BottomSheetFooterContainer","BottomSheetDraggableView","ANIMATION_STATE","KEYBOARD_STATE","KEYBOARD_BEHAVIOR","SHEET_STATE","SCROLLABLE_STATE","KEYBOARD_BLUR_BEHAVIOR","KEYBOARD_INPUT_MODE","ANIMATION_SOURCE","animate","getKeyboardAnimationConfigs","normalizeSnapPoint","print","DEFAULT_OVER_DRAG_RESISTANCE_FACTOR","DEFAULT_ENABLE_CONTENT_PANNING_GESTURE","DEFAULT_ENABLE_HANDLE_PANNING_GESTURE","DEFAULT_ENABLE_OVER_DRAG","DEFAULT_ANIMATE_ON_MOUNT","DEFAULT_KEYBOARD_BEHAVIOR","DEFAULT_KEYBOARD_BLUR_BEHAVIOR","DEFAULT_KEYBOARD_INPUT_MODE","INITIAL_CONTAINER_HEIGHT","INITIAL_HANDLE_HEIGHT","INITIAL_POSITION","INITIAL_SNAP_POINT","DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE","INITIAL_CONTAINER_OFFSET","INITIAL_VALUE","DEFAULT_DYNAMIC_SIZING","styles","addWhitelistedUIProps","decelerationRate","BottomSheetComponent","BottomSheet","props","ref","animationConfigs","_providedAnimationConfigs","index","_providedIndex","snapPoints","_providedSnapPoints","animateOnMount","enableContentPanningGesture","enableHandlePanningGesture","enableOverDrag","enablePanDownToClose","enableDynamicSizing","overDragResistanceFactor","style","_providedStyle","containerStyle","_providedContainerStyle","backgroundStyle","_providedBackgroundStyle","handleStyle","_providedHandleStyle","handleIndicatorStyle","_providedHandleIndicatorStyle","gestureEventsHandlersHook","keyboardBehavior","keyboardBlurBehavior","android_keyboardInputMode","handleHeight","_providedHandleHeight","containerHeight","_providedContainerHeight","contentHeight","_providedContentHeight","containerOffset","_providedContainerOffset","topInset","bottomInset","maxDynamicContentSize","animatedPosition","_providedAnimatedPosition","animatedIndex","_providedAnimatedIndex","simultaneousHandlers","_providedSimultaneousHandlers","waitFor","_providedWaitFor","activeOffsetX","_providedActiveOffsetX","activeOffsetY","_providedActiveOffsetY","failOffsetX","_providedFailOffsetX","failOffsetY","_providedFailOffsetY","onChange","_providedOnChange","onClose","_providedOnClose","onAnimate","_providedOnAnimate","$modal","detached","handleComponent","backdropComponent","backgroundComponent","footerComponent","children","Content","_animatedContainerHeight","animatedContainerHeight","verticalInset","value","animatedContainerOffset","animatedHandleHeight","animatedFooterHeight","animatedContentHeight","animatedSnapPoints","animatedHighestSnapPoint","length","animatedClosedPosition","closedPosition","animatedSheetHeight","animatedCurrentIndex","animatedNextPosition","animatedNextPositionIndex","isAnimatedOnMount","isContentHeightFixed","isLayoutCalculated","isContainerHeightCalculated","undefined","isHandleHeightCalculated","isSnapPointsNormalized","isInTemporaryPosition","isForcedClosing","animatedContentGestureState","UNDETERMINED","animatedHandleGestureState","animatedScrollableType","animatedScrollableContentOffsetY","animatedScrollableOverrideState","isScrollableRefreshable","setScrollableRef","removeScrollableRef","state","animatedKeyboardState","height","animatedKeyboardHeight","animationDuration","keyboardAnimationDuration","animationEasing","keyboardAnimationEasing","shouldHandleKeyboardEvents","animatedKeyboardHeightInContainer","animatedAnimationState","animatedAnimationSource","MOUNT","animatedSheetState","CLOSED","extendedPosition","EXTENDED","keyboardHeightInContainer","extendedPositionWithKeyboard","Math","max","interactive","FILL_PARENT","OVER_EXTENDED","OPENED","animatedScrollableState","UNLOCKED","SHOWN","RUNNING","LOCKED","animatedContentHeightMax","extend","fillParent","contentWithKeyboardHeight","adjustedSnapPoints","slice","reverse","adjustedSnapPointsIndexes","map","_","push","currentIndex","CLAMP","adjustResize","KEYBOARD","SNAP_POINT_CHANGE","getNextPosition","keyboardState","highestSnapPoint","restore","HIDDEN","ACTIVE","nextPosition","handleOnChange","component","name","method","params","handleOnAnimate","toPoint","toIndex","indexOf","fromIndex","stopAnimation","NONE","STOPPED","animateToPositionCompleted","isFinished","animateToPosition","position","source","velocity","configs","currentPosition","point","onComplete","handleSnapToIndex","USER","handleSnapToPosition","handleClose","handleForceClose","handleExpand","handleCollapse","snapToIndex","snapToPosition","expand","collapse","close","forceClose","internalContextVariables","externalContextVariables","containerAnimatedStyle","opacity","OS","transform","translateY","container","contentContainerAnimatedStyle","contentContainerStyle","contentContainer","contentMaskContainerAnimatedStyle","overflow","paddingBottom","contentMaskContainerStyle","contentMaskContainer","_isLayoutCalculated","result","_previousResult","_previousSnapPoints","_previousContainerHeight","animationConfig","animationSource","CONTAINER_RESIZE","duration","JSON","stringify","_keyboardState","_keyboardHeight","_previousKeyboardState","_previousKeyboardHeight","abs","bottom","hasActiveGesture","BEGAN","none","keyboardHeight","_animatedPosition","_animatedIndex","_animationState","_contentGestureState","_handleGestureState","hasNoActiveGesture","END","CANCELLED","providedIndex","displayName"],"mappings":"AAAA,OAAOA,KAAP,IACEC,OADF,EAEEC,WAFF,EAGEC,UAHF,EAIEC,mBAJF,EAKEC,IALF,EAMEC,SANF,QAOO,OAPP;AAQA,SAASC,QAAT,QAAyB,cAAzB;AACA,OAAOC,SAAP,MAAsB,WAAtB;AACA,OAAOC,QAAP,IACEC,mBADF,EAEEC,cAFF,EAGEC,gBAHF,EAIEC,eAJF,EAKEC,OALF,EAMEC,WANF,EAOEC,WAPF,EAQEC,OARF,EASEC,eATF,EAUEC,kBAVF,QAaO,yBAbP;AAcA,SAASC,KAAT,QAAsB,8BAAtB;AACA,SACEC,aADF,EAEEC,iBAFF,EAGEC,sBAHF,EAIEC,uBAJF,EAKEC,WALF,QAMO,aANP;AAOA,SACEC,2BADF,EAEEC,mBAFF,QAGO,gBAHP;AAIA,OAAOC,oBAAP,MAAiC,yBAAjC;AACA,OAAOC,kCAAP,MAA+C,uCAA/C;AACA,OAAOC,4BAAP,MAAyC,iCAAzC;AACA,OAAOC,0BAAP,MAAuC,+BAAvC;AACA,OAAOC,8BAAP,MAA2C,mCAA3C;AACA,OAAOC,0BAAP,MAAuC,0DAAvC;AACA,OAAOC,wBAAP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VF,CATF,CADF,CADF,CADF;AA0FD,CAtkDoC,CAAvC;AAykDA,MAAMzB,WAAW,gBAAG9D,IAAI,CAAC6D,oBAAD,CAAxB;AACAC,WAAW,CAACiP,WAAZ,GAA0B,aAA1B;AAEA,eAAejP,WAAf","sourcesContent":["import React, {\n useMemo,\n useCallback,\n forwardRef,\n useImperativeHandle,\n memo,\n useEffect,\n} from 'react';\nimport { Platform } from 'react-native';\nimport invariant from 'invariant';\nimport Animated, {\n useAnimatedReaction,\n useSharedValue,\n useAnimatedStyle,\n useDerivedValue,\n runOnJS,\n interpolate,\n Extrapolate,\n runOnUI,\n cancelAnimation,\n useWorkletCallback,\n WithSpringConfig,\n WithTimingConfig,\n} from 'react-native-reanimated';\nimport { State } from 'react-native-gesture-handler';\nimport {\n useScrollable,\n usePropsValidator,\n useReactiveSharedValue,\n useNormalizedSnapPoints,\n useKeyboard,\n} from '../../hooks';\nimport {\n BottomSheetInternalProvider,\n BottomSheetProvider,\n} from '../../contexts';\nimport BottomSheetContainer from '../bottomSheetContainer';\nimport BottomSheetGestureHandlersProvider from '../bottomSheetGestureHandlersProvider';\nimport BottomSheetBackdropContainer from '../bottomSheetBackdropContainer';\nimport BottomSheetHandleContainer from '../bottomSheetHandleContainer';\nimport BottomSheetBackgroundContainer from '../bottomSheetBackgroundContainer';\nimport BottomSheetFooterContainer from '../bottomSheetFooterContainer/BottomSheetFooterContainer';\nimport BottomSheetDraggableView from '../bottomSheetDraggableView';\n// import BottomSheetDebugView from '../bottomSheetDebugView';\nimport {\n ANIMATION_STATE,\n KEYBOARD_STATE,\n KEYBOARD_BEHAVIOR,\n SHEET_STATE,\n SCROLLABLE_STATE,\n KEYBOARD_BLUR_BEHAVIOR,\n KEYBOARD_INPUT_MODE,\n ANIMATION_SOURCE,\n} from '../../constants';\nimport {\n animate,\n getKeyboardAnimationConfigs,\n normalizeSnapPoint,\n print,\n} from '../../utilities';\nimport {\n DEFAULT_OVER_DRAG_RESISTANCE_FACTOR,\n DEFAULT_ENABLE_CONTENT_PANNING_GESTURE,\n DEFAULT_ENABLE_HANDLE_PANNING_GESTURE,\n DEFAULT_ENABLE_OVER_DRAG,\n DEFAULT_ANIMATE_ON_MOUNT,\n DEFAULT_KEYBOARD_BEHAVIOR,\n DEFAULT_KEYBOARD_BLUR_BEHAVIOR,\n DEFAULT_KEYBOARD_INPUT_MODE,\n INITIAL_CONTAINER_HEIGHT,\n INITIAL_HANDLE_HEIGHT,\n INITIAL_POSITION,\n INITIAL_SNAP_POINT,\n DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE,\n INITIAL_CONTAINER_OFFSET,\n INITIAL_VALUE,\n DEFAULT_DYNAMIC_SIZING,\n} from './constants';\nimport type { BottomSheetMethods, Insets } from '../../types';\nimport type { BottomSheetProps, AnimateToPositionType } from './types';\nimport { styles } from './styles';\n\nAnimated.addWhitelistedUIProps({\n decelerationRate: true,\n});\n\ntype BottomSheet = BottomSheetMethods;\n\nconst BottomSheetComponent = forwardRef(\n function BottomSheet(props, ref) {\n //#region validate props\n usePropsValidator(props);\n //#endregion\n\n //#region extract props\n const {\n // animations configurations\n animationConfigs: _providedAnimationConfigs,\n\n // configurations\n index: _providedIndex = 0,\n snapPoints: _providedSnapPoints,\n animateOnMount = DEFAULT_ANIMATE_ON_MOUNT,\n enableContentPanningGesture = DEFAULT_ENABLE_CONTENT_PANNING_GESTURE,\n enableHandlePanningGesture = DEFAULT_ENABLE_HANDLE_PANNING_GESTURE,\n enableOverDrag = DEFAULT_ENABLE_OVER_DRAG,\n enablePanDownToClose = DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE,\n enableDynamicSizing = DEFAULT_DYNAMIC_SIZING,\n overDragResistanceFactor = DEFAULT_OVER_DRAG_RESISTANCE_FACTOR,\n\n // styles\n style: _providedStyle,\n containerStyle: _providedContainerStyle,\n backgroundStyle: _providedBackgroundStyle,\n handleStyle: _providedHandleStyle,\n handleIndicatorStyle: _providedHandleIndicatorStyle,\n\n // hooks\n gestureEventsHandlersHook,\n\n // keyboard\n keyboardBehavior = DEFAULT_KEYBOARD_BEHAVIOR,\n keyboardBlurBehavior = DEFAULT_KEYBOARD_BLUR_BEHAVIOR,\n android_keyboardInputMode = DEFAULT_KEYBOARD_INPUT_MODE,\n\n // layout\n handleHeight: _providedHandleHeight,\n containerHeight: _providedContainerHeight,\n contentHeight: _providedContentHeight,\n containerOffset: _providedContainerOffset,\n topInset = 0,\n bottomInset = 0,\n maxDynamicContentSize,\n\n // animated callback shared values\n animatedPosition: _providedAnimatedPosition,\n animatedIndex: _providedAnimatedIndex,\n\n // gestures\n simultaneousHandlers: _providedSimultaneousHandlers,\n waitFor: _providedWaitFor,\n activeOffsetX: _providedActiveOffsetX,\n activeOffsetY: _providedActiveOffsetY,\n failOffsetX: _providedFailOffsetX,\n failOffsetY: _providedFailOffsetY,\n\n // callbacks\n onChange: _providedOnChange,\n onClose: _providedOnClose,\n onAnimate: _providedOnAnimate,\n\n // private\n $modal = false,\n detached = false,\n\n // components\n handleComponent,\n backdropComponent,\n backgroundComponent,\n footerComponent,\n children: Content,\n } = props;\n //#endregion\n\n //#region layout variables\n /**\n * This variable is consider an internal variable,\n * that will be used conditionally in `animatedContainerHeight`\n */\n const _animatedContainerHeight = useReactiveSharedValue(\n _providedContainerHeight ?? INITIAL_CONTAINER_HEIGHT\n );\n /**\n * This is a conditional variable, where if the `BottomSheet` is used\n * in a modal, then it will subset vertical insets (top+bottom) from\n * provided container height.\n */\n const animatedContainerHeight = useDerivedValue(() => {\n const verticalInset = topInset + bottomInset;\n return $modal\n ? _animatedContainerHeight.value - verticalInset\n : _animatedContainerHeight.value;\n }, [$modal, topInset, bottomInset]);\n const animatedContainerOffset = useReactiveSharedValue(\n _providedContainerOffset ?? INITIAL_CONTAINER_OFFSET\n ) as Animated.SharedValue;\n const animatedHandleHeight = useReactiveSharedValue(\n _providedHandleHeight ?? INITIAL_HANDLE_HEIGHT\n );\n const animatedFooterHeight = useSharedValue(0);\n const animatedContentHeight = useSharedValue(INITIAL_CONTAINER_HEIGHT);\n const animatedSnapPoints = useNormalizedSnapPoints(\n _providedSnapPoints,\n animatedContainerHeight,\n animatedContentHeight,\n animatedHandleHeight,\n enableDynamicSizing,\n maxDynamicContentSize\n );\n const animatedHighestSnapPoint = useDerivedValue(\n () => animatedSnapPoints.value[animatedSnapPoints.value.length - 1]\n );\n const animatedClosedPosition = useDerivedValue(() => {\n let closedPosition = animatedContainerHeight.value;\n\n if ($modal || detached) {\n closedPosition = animatedContainerHeight.value + bottomInset;\n }\n\n return closedPosition;\n }, [$modal, detached, bottomInset]);\n const animatedSheetHeight = useDerivedValue(\n () => animatedContainerHeight.value - animatedHighestSnapPoint.value\n );\n const animatedCurrentIndex = useReactiveSharedValue(\n animateOnMount ? -1 : _providedIndex\n );\n const animatedPosition = useSharedValue(INITIAL_POSITION);\n const animatedNextPosition = useSharedValue(INITIAL_VALUE);\n const animatedNextPositionIndex = useSharedValue(0);\n\n // conditional\n const isAnimatedOnMount = useSharedValue(false);\n const isContentHeightFixed = useSharedValue(false);\n const isLayoutCalculated = useDerivedValue(() => {\n let isContainerHeightCalculated = false;\n //container height was provided.\n if (\n _providedContainerHeight !== null ||\n _providedContainerHeight !== undefined\n ) {\n isContainerHeightCalculated = true;\n }\n // container height did set.\n if (animatedContainerHeight.value !== INITIAL_CONTAINER_HEIGHT) {\n isContainerHeightCalculated = true;\n }\n\n let isHandleHeightCalculated = false;\n // handle height is provided.\n if (\n _providedHandleHeight !== null &&\n _providedHandleHeight !== undefined &&\n typeof _providedHandleHeight === 'number'\n ) {\n isHandleHeightCalculated = true;\n }\n // handle component is null.\n if (handleComponent === null) {\n animatedHandleHeight.value = 0;\n isHandleHeightCalculated = true;\n }\n // handle height did set.\n if (animatedHandleHeight.value !== INITIAL_HANDLE_HEIGHT) {\n isHandleHeightCalculated = true;\n }\n\n let isSnapPointsNormalized = false;\n // the first snap point did normalized\n if (animatedSnapPoints.value[0] !== INITIAL_SNAP_POINT) {\n isSnapPointsNormalized = true;\n }\n\n return (\n isContainerHeightCalculated &&\n isHandleHeightCalculated &&\n isSnapPointsNormalized\n );\n });\n const isInTemporaryPosition = useSharedValue(false);\n const isForcedClosing = useSharedValue(false);\n\n // gesture\n const animatedContentGestureState = useSharedValue(\n State.UNDETERMINED\n );\n const animatedHandleGestureState = useSharedValue(\n State.UNDETERMINED\n );\n //#endregion\n\n //#region hooks variables\n // scrollable variables\n const {\n animatedScrollableType,\n animatedScrollableContentOffsetY,\n animatedScrollableOverrideState,\n isScrollableRefreshable,\n setScrollableRef,\n removeScrollableRef,\n } = useScrollable();\n // keyboard\n const {\n state: animatedKeyboardState,\n height: animatedKeyboardHeight,\n animationDuration: keyboardAnimationDuration,\n animationEasing: keyboardAnimationEasing,\n shouldHandleKeyboardEvents,\n } = useKeyboard();\n const animatedKeyboardHeightInContainer = useSharedValue(0);\n //#endregion\n\n //#region state/dynamic variables\n // states\n const animatedAnimationState = useSharedValue(ANIMATION_STATE.UNDETERMINED);\n const animatedAnimationSource = useSharedValue(\n ANIMATION_SOURCE.MOUNT\n );\n const animatedSheetState = useDerivedValue(() => {\n // closed position = position >= container height\n if (animatedPosition.value >= animatedClosedPosition.value)\n return SHEET_STATE.CLOSED;\n\n // extended position = container height - sheet height\n const extendedPosition =\n animatedContainerHeight.value - animatedSheetHeight.value;\n if (animatedPosition.value === extendedPosition)\n return SHEET_STATE.EXTENDED;\n\n // extended position with keyboard =\n // container height - (sheet height + keyboard height in root container)\n const keyboardHeightInContainer = animatedKeyboardHeightInContainer.value;\n const extendedPositionWithKeyboard = Math.max(\n 0,\n animatedContainerHeight.value -\n (animatedSheetHeight.value + keyboardHeightInContainer)\n );\n\n // detect if keyboard is open and the sheet is in temporary position\n if (\n keyboardBehavior === KEYBOARD_BEHAVIOR.interactive &&\n isInTemporaryPosition.value &&\n animatedPosition.value === extendedPositionWithKeyboard\n ) {\n return SHEET_STATE.EXTENDED;\n }\n\n // fill parent = 0\n if (animatedPosition.value === 0) {\n return SHEET_STATE.FILL_PARENT;\n }\n\n // detect if position is below extended point\n if (animatedPosition.value < extendedPosition) {\n return SHEET_STATE.OVER_EXTENDED;\n }\n\n return SHEET_STATE.OPENED;\n }, [\n animatedClosedPosition,\n animatedContainerHeight,\n animatedKeyboardHeightInContainer,\n animatedPosition,\n animatedSheetHeight,\n isInTemporaryPosition,\n keyboardBehavior,\n ]);\n const animatedScrollableState = useDerivedValue(() => {\n /**\n * if scrollable override state is set, then we just return its value.\n */\n if (\n animatedScrollableOverrideState.value !== SCROLLABLE_STATE.UNDETERMINED\n ) {\n return animatedScrollableOverrideState.value;\n }\n /**\n * if sheet state is fill parent, then unlock scrolling\n */\n if (animatedSheetState.value === SHEET_STATE.FILL_PARENT) {\n return SCROLLABLE_STATE.UNLOCKED;\n }\n\n /**\n * if sheet state is extended, then unlock scrolling\n */\n if (animatedSheetState.value === SHEET_STATE.EXTENDED) {\n return SCROLLABLE_STATE.UNLOCKED;\n }\n\n /**\n * if keyboard is shown and sheet is animating\n * then we do not lock the scrolling to not lose\n * current scrollable scroll position.\n */\n if (\n animatedKeyboardState.value === KEYBOARD_STATE.SHOWN &&\n animatedAnimationState.value === ANIMATION_STATE.RUNNING\n ) {\n return SCROLLABLE_STATE.UNLOCKED;\n }\n\n return SCROLLABLE_STATE.LOCKED;\n });\n // dynamic\n const animatedContentHeightMax = useDerivedValue(() => {\n const keyboardHeightInContainer = animatedKeyboardHeightInContainer.value;\n const handleHeight = Math.max(0, animatedHandleHeight.value);\n let contentHeight = animatedSheetHeight.value - handleHeight;\n\n if (\n keyboardBehavior === KEYBOARD_BEHAVIOR.extend &&\n animatedKeyboardState.value === KEYBOARD_STATE.SHOWN\n ) {\n contentHeight = contentHeight - keyboardHeightInContainer;\n } else if (\n keyboardBehavior === KEYBOARD_BEHAVIOR.fillParent &&\n isInTemporaryPosition.value\n ) {\n if (animatedKeyboardState.value === KEYBOARD_STATE.SHOWN) {\n contentHeight =\n animatedContainerHeight.value -\n handleHeight -\n keyboardHeightInContainer;\n } else {\n contentHeight = animatedContainerHeight.value - handleHeight;\n }\n } else if (\n keyboardBehavior === KEYBOARD_BEHAVIOR.interactive &&\n isInTemporaryPosition.value\n ) {\n const contentWithKeyboardHeight =\n contentHeight + keyboardHeightInContainer;\n\n if (animatedKeyboardState.value === KEYBOARD_STATE.SHOWN) {\n if (\n keyboardHeightInContainer + animatedSheetHeight.value >\n animatedContainerHeight.value\n ) {\n contentHeight =\n animatedContainerHeight.value -\n keyboardHeightInContainer -\n handleHeight;\n }\n } else if (\n contentWithKeyboardHeight + handleHeight >\n animatedContainerHeight.value\n ) {\n contentHeight = animatedContainerHeight.value - handleHeight;\n } else {\n contentHeight = contentWithKeyboardHeight;\n }\n }\n\n /**\n * before the container is measured, `contentHeight` value will be below zero,\n * which will lead to freeze the scrollable.\n *\n * @link (https://github.com/gorhom/react-native-bottom-sheet/issues/470)\n */\n return Math.max(contentHeight, 0);\n }, [\n animatedContainerHeight,\n animatedHandleHeight,\n animatedKeyboardHeightInContainer,\n animatedKeyboardState,\n animatedSheetHeight,\n isInTemporaryPosition,\n keyboardBehavior,\n ]);\n const animatedIndex = useDerivedValue(() => {\n const adjustedSnapPoints = animatedSnapPoints.value.slice().reverse();\n const adjustedSnapPointsIndexes = animatedSnapPoints.value\n .slice()\n .map((_: any, index: number) => index)\n .reverse();\n\n /**\n * we add the close state index `-1`\n */\n adjustedSnapPoints.push(animatedContainerHeight.value);\n adjustedSnapPointsIndexes.push(-1);\n\n const currentIndex = isLayoutCalculated.value\n ? interpolate(\n animatedPosition.value,\n adjustedSnapPoints,\n adjustedSnapPointsIndexes,\n Extrapolate.CLAMP\n )\n : -1;\n\n /**\n * if the sheet is currently running an animation by the keyboard opening,\n * then we clamp the index on android with resize keyboard mode.\n */\n if (\n android_keyboardInputMode === KEYBOARD_INPUT_MODE.adjustResize &&\n animatedAnimationSource.value === ANIMATION_SOURCE.KEYBOARD &&\n animatedAnimationState.value === ANIMATION_STATE.RUNNING &&\n isInTemporaryPosition.value\n ) {\n return Math.max(animatedCurrentIndex.value, currentIndex);\n }\n\n /**\n * if the sheet is currently running an animation by snap point change - usually caused\n * by dynamic content height -, then we return the next position index.\n */\n if (\n animatedAnimationSource.value === ANIMATION_SOURCE.SNAP_POINT_CHANGE &&\n animatedAnimationState.value === ANIMATION_STATE.RUNNING\n ) {\n return animatedNextPositionIndex.value;\n }\n\n return currentIndex;\n }, [android_keyboardInputMode]);\n //#endregion\n\n //#region private methods\n /**\n * Calculate the next position based on keyboard state.\n */\n const getNextPosition = useWorkletCallback(\n function getNextPosition() {\n 'worklet';\n const currentIndex = animatedCurrentIndex.value;\n const snapPoints = animatedSnapPoints.value;\n const keyboardState = animatedKeyboardState.value;\n const highestSnapPoint = animatedHighestSnapPoint.value;\n\n /**\n * Handle restore sheet position on blur\n */\n if (\n keyboardBlurBehavior === KEYBOARD_BLUR_BEHAVIOR.restore &&\n keyboardState === KEYBOARD_STATE.HIDDEN &&\n animatedContentGestureState.value !== State.ACTIVE &&\n animatedHandleGestureState.value !== State.ACTIVE\n ) {\n isInTemporaryPosition.value = false;\n const nextPosition = snapPoints[currentIndex];\n return nextPosition;\n }\n\n /**\n * Handle extend behavior\n */\n if (\n keyboardBehavior === KEYBOARD_BEHAVIOR.extend &&\n keyboardState === KEYBOARD_STATE.SHOWN\n ) {\n return highestSnapPoint;\n }\n\n /**\n * Handle full screen behavior\n */\n if (\n keyboardBehavior === KEYBOARD_BEHAVIOR.fillParent &&\n keyboardState === KEYBOARD_STATE.SHOWN\n ) {\n isInTemporaryPosition.value = true;\n return 0;\n }\n\n /**\n * handle interactive behavior\n */\n if (\n keyboardBehavior === KEYBOARD_BEHAVIOR.interactive &&\n keyboardState === KEYBOARD_STATE.SHOWN\n ) {\n isInTemporaryPosition.value = true;\n const keyboardHeightInContainer =\n animatedKeyboardHeightInContainer.value;\n return Math.max(0, highestSnapPoint - keyboardHeightInContainer);\n }\n\n if (isInTemporaryPosition.value) {\n return animatedPosition.value;\n }\n\n return snapPoints[currentIndex];\n },\n [\n animatedContentGestureState,\n animatedCurrentIndex,\n animatedHandleGestureState,\n animatedHighestSnapPoint,\n animatedKeyboardHeightInContainer,\n animatedKeyboardState,\n animatedPosition,\n animatedSnapPoints,\n isInTemporaryPosition,\n keyboardBehavior,\n keyboardBlurBehavior,\n ]\n );\n const handleOnChange = useCallback(\n function handleOnChange(index: number) {\n print({\n component: BottomSheet.name,\n method: handleOnChange.name,\n params: {\n index,\n animatedCurrentIndex: animatedCurrentIndex.value,\n },\n });\n\n if (_providedOnChange) {\n _providedOnChange(index);\n }\n },\n [_providedOnChange, animatedCurrentIndex]\n );\n const handleOnAnimate = useCallback(\n function handleOnAnimate(toPoint: number) {\n const snapPoints = animatedSnapPoints.value;\n const toIndex = snapPoints.indexOf(toPoint);\n\n print({\n component: BottomSheet.name,\n method: handleOnAnimate.name,\n params: {\n toIndex,\n fromIndex: animatedCurrentIndex.value,\n },\n });\n\n if (!_providedOnAnimate) {\n return;\n }\n\n if (toIndex !== animatedCurrentIndex.value) {\n _providedOnAnimate(animatedCurrentIndex.value, toIndex);\n }\n },\n [_providedOnAnimate, animatedSnapPoints, animatedCurrentIndex]\n );\n //#endregion\n\n //#region animation\n const stopAnimation = useWorkletCallback(() => {\n cancelAnimation(animatedPosition);\n isForcedClosing.value = false;\n animatedAnimationSource.value = ANIMATION_SOURCE.NONE;\n animatedAnimationState.value = ANIMATION_STATE.STOPPED;\n }, [animatedPosition, animatedAnimationState, animatedAnimationSource]);\n const animateToPositionCompleted = useWorkletCallback(\n function animateToPositionCompleted(isFinished?: boolean) {\n isForcedClosing.value = false;\n\n if (!isFinished) {\n return;\n }\n runOnJS(print)({\n component: BottomSheet.name,\n method: animateToPositionCompleted.name,\n params: {\n animatedCurrentIndex: animatedCurrentIndex.value,\n animatedNextPosition: animatedNextPosition.value,\n animatedNextPositionIndex: animatedNextPositionIndex.value,\n },\n });\n\n animatedAnimationSource.value = ANIMATION_SOURCE.NONE;\n animatedAnimationState.value = ANIMATION_STATE.STOPPED;\n animatedNextPosition.value = INITIAL_VALUE;\n animatedNextPositionIndex.value = INITIAL_VALUE;\n }\n );\n const animateToPosition: AnimateToPositionType = useWorkletCallback(\n function animateToPosition(\n position: number,\n source: ANIMATION_SOURCE,\n velocity: number = 0,\n configs?: WithTimingConfig | WithSpringConfig\n ) {\n if (\n position === animatedPosition.value ||\n position === undefined ||\n (animatedAnimationState.value === ANIMATION_STATE.RUNNING &&\n position === animatedNextPosition.value)\n ) {\n return;\n }\n\n runOnJS(print)({\n component: BottomSheet.name,\n method: animateToPosition.name,\n params: {\n currentPosition: animatedPosition.value,\n position,\n velocity,\n animatedContainerHeight: animatedContainerHeight.value,\n },\n });\n\n stopAnimation();\n\n /**\n * set animation state to running, and source\n */\n animatedAnimationState.value = ANIMATION_STATE.RUNNING;\n animatedAnimationSource.value = source;\n\n /**\n * store next position\n */\n animatedNextPosition.value = position;\n animatedNextPositionIndex.value =\n animatedSnapPoints.value.indexOf(position);\n\n /**\n * fire `onAnimate` callback\n */\n runOnJS(handleOnAnimate)(position);\n\n /**\n * force animation configs from parameters, if provided\n */\n if (configs !== undefined) {\n animatedPosition.value = animate({\n point: position,\n configs,\n velocity,\n onComplete: animateToPositionCompleted,\n });\n } else {\n /**\n * use animationConfigs callback, if provided\n */\n animatedPosition.value = animate({\n point: position,\n velocity,\n configs: _providedAnimationConfigs,\n onComplete: animateToPositionCompleted,\n });\n }\n },\n [handleOnAnimate, _providedAnimationConfigs]\n );\n //#endregion\n\n //#region public methods\n const handleSnapToIndex = useCallback(\n function handleSnapToIndex(\n index: number,\n animationConfigs?: WithSpringConfig | WithTimingConfig\n ) {\n const snapPoints = animatedSnapPoints.value;\n invariant(\n index >= -1 && index <= snapPoints.length - 1,\n `'index' was provided but out of the provided snap points range! expected value to be between -1, ${\n snapPoints.length - 1\n }`\n );\n print({\n component: BottomSheet.name,\n method: handleSnapToIndex.name,\n params: {\n index,\n },\n });\n\n const nextPosition = snapPoints[index];\n\n /**\n * exit method if :\n * - layout is not calculated.\n * - already animating to next position.\n * - sheet is forced closing.\n */\n if (\n !isLayoutCalculated.value ||\n index === animatedNextPositionIndex.value ||\n nextPosition === animatedNextPosition.value ||\n isForcedClosing.value\n ) {\n return;\n }\n\n /**\n * reset temporary position boolean.\n */\n isInTemporaryPosition.value = false;\n\n runOnUI(animateToPosition)(\n nextPosition,\n ANIMATION_SOURCE.USER,\n 0,\n animationConfigs\n );\n },\n [\n animateToPosition,\n isLayoutCalculated,\n isInTemporaryPosition,\n isForcedClosing,\n animatedSnapPoints,\n animatedNextPosition,\n animatedNextPositionIndex,\n ]\n );\n const handleSnapToPosition = useWorkletCallback(\n function handleSnapToPosition(\n position: number | string,\n animationConfigs?: WithSpringConfig | WithTimingConfig\n ) {\n print({\n component: BottomSheet.name,\n method: handleSnapToPosition.name,\n params: {\n position,\n },\n });\n\n /**\n * normalized provided position.\n */\n const nextPosition = normalizeSnapPoint(\n position,\n animatedContainerHeight.value\n );\n\n /**\n * exit method if :\n * - layout is not calculated.\n * - already animating to next position.\n * - sheet is forced closing.\n */\n if (\n !isLayoutCalculated ||\n nextPosition === animatedNextPosition.value ||\n isForcedClosing.value\n ) {\n return;\n }\n\n /**\n * mark the new position as temporary.\n */\n isInTemporaryPosition.value = true;\n\n runOnUI(animateToPosition)(\n nextPosition,\n ANIMATION_SOURCE.USER,\n 0,\n animationConfigs\n );\n },\n [\n animateToPosition,\n bottomInset,\n topInset,\n isLayoutCalculated,\n isForcedClosing,\n animatedContainerHeight,\n animatedPosition,\n ]\n );\n const handleClose = useCallback(\n function handleClose(\n animationConfigs?: WithSpringConfig | WithTimingConfig\n ) {\n print({\n component: BottomSheet.name,\n method: handleClose.name,\n });\n\n const nextPosition = animatedClosedPosition.value;\n\n /**\n * exit method if :\n * - layout is not calculated.\n * - already animating to next position.\n * - sheet is forced closing.\n */\n if (\n !isLayoutCalculated.value ||\n nextPosition === animatedNextPosition.value ||\n isForcedClosing.value\n ) {\n return;\n }\n\n /**\n * reset temporary position variable.\n */\n isInTemporaryPosition.value = false;\n\n runOnUI(animateToPosition)(\n nextPosition,\n ANIMATION_SOURCE.USER,\n 0,\n animationConfigs\n );\n },\n [\n animateToPosition,\n isForcedClosing,\n isLayoutCalculated,\n isInTemporaryPosition,\n animatedNextPosition,\n animatedClosedPosition,\n ]\n );\n const handleForceClose = useCallback(\n function handleForceClose(\n animationConfigs?: WithSpringConfig | WithTimingConfig\n ) {\n print({\n component: BottomSheet.name,\n method: handleForceClose.name,\n });\n\n const nextPosition = animatedClosedPosition.value;\n\n /**\n * exit method if :\n * - already animating to next position.\n * - sheet is forced closing.\n */\n if (\n nextPosition === animatedNextPosition.value ||\n isForcedClosing.value\n ) {\n return;\n }\n\n /**\n * reset temporary position variable.\n */\n isInTemporaryPosition.value = false;\n\n /**\n * set force closing variable.\n */\n isForcedClosing.value = true;\n\n runOnUI(animateToPosition)(\n nextPosition,\n ANIMATION_SOURCE.USER,\n 0,\n animationConfigs\n );\n },\n [\n animateToPosition,\n isForcedClosing,\n isInTemporaryPosition,\n animatedNextPosition,\n animatedClosedPosition,\n ]\n );\n const handleExpand = useCallback(\n function handleExpand(\n animationConfigs?: WithSpringConfig | WithTimingConfig\n ) {\n print({\n component: BottomSheet.name,\n method: handleExpand.name,\n });\n\n const snapPoints = animatedSnapPoints.value;\n const nextPosition = snapPoints[snapPoints.length - 1];\n\n /**\n * exit method if :\n * - layout is not calculated.\n * - already animating to next position.\n * - sheet is forced closing.\n */\n if (\n !isLayoutCalculated.value ||\n snapPoints.length - 1 === animatedNextPositionIndex.value ||\n nextPosition === animatedNextPosition.value ||\n isForcedClosing.value\n ) {\n return;\n }\n\n /**\n * reset temporary position boolean.\n */\n isInTemporaryPosition.value = false;\n\n runOnUI(animateToPosition)(\n nextPosition,\n ANIMATION_SOURCE.USER,\n 0,\n animationConfigs\n );\n },\n [\n animateToPosition,\n isInTemporaryPosition,\n isLayoutCalculated,\n isForcedClosing,\n animatedSnapPoints,\n animatedNextPosition,\n animatedNextPositionIndex,\n ]\n );\n const handleCollapse = useCallback(\n function handleCollapse(\n animationConfigs?: WithSpringConfig | WithTimingConfig\n ) {\n print({\n component: BottomSheet.name,\n method: handleCollapse.name,\n });\n\n const nextPosition = animatedSnapPoints.value[0];\n\n /**\n * exit method if :\n * - layout is not calculated.\n * - already animating to next position.\n * - sheet is forced closing.\n */\n if (\n !isLayoutCalculated ||\n animatedNextPositionIndex.value === 0 ||\n nextPosition === animatedNextPosition.value ||\n isForcedClosing.value\n ) {\n return;\n }\n\n /**\n * reset temporary position boolean.\n */\n isInTemporaryPosition.value = false;\n\n runOnUI(animateToPosition)(\n nextPosition,\n ANIMATION_SOURCE.USER,\n 0,\n animationConfigs\n );\n },\n [\n animateToPosition,\n isForcedClosing,\n isLayoutCalculated,\n isInTemporaryPosition,\n animatedSnapPoints,\n animatedNextPosition,\n animatedNextPositionIndex,\n ]\n );\n\n useImperativeHandle(ref, () => ({\n snapToIndex: handleSnapToIndex,\n snapToPosition: handleSnapToPosition,\n expand: handleExpand,\n collapse: handleCollapse,\n close: handleClose,\n forceClose: handleForceClose,\n }));\n //#endregion\n\n //#region contexts variables\n const internalContextVariables = useMemo(\n () => ({\n enableContentPanningGesture,\n enableDynamicSizing,\n overDragResistanceFactor,\n enableOverDrag,\n enablePanDownToClose,\n animatedAnimationState,\n animatedSheetState,\n animatedScrollableState,\n animatedScrollableOverrideState,\n animatedContentGestureState,\n animatedHandleGestureState,\n animatedKeyboardState,\n animatedScrollableType,\n animatedIndex,\n animatedPosition,\n animatedContentHeight,\n animatedClosedPosition,\n animatedHandleHeight,\n animatedFooterHeight,\n animatedKeyboardHeight,\n animatedKeyboardHeightInContainer,\n animatedContainerHeight,\n animatedSnapPoints,\n animatedHighestSnapPoint,\n animatedScrollableContentOffsetY,\n isInTemporaryPosition,\n isContentHeightFixed,\n isScrollableRefreshable,\n shouldHandleKeyboardEvents,\n simultaneousHandlers: _providedSimultaneousHandlers,\n waitFor: _providedWaitFor,\n activeOffsetX: _providedActiveOffsetX,\n activeOffsetY: _providedActiveOffsetY,\n failOffsetX: _providedFailOffsetX,\n failOffsetY: _providedFailOffsetY,\n animateToPosition,\n stopAnimation,\n setScrollableRef,\n removeScrollableRef,\n }),\n [\n animatedIndex,\n animatedPosition,\n animatedContentHeight,\n animatedScrollableType,\n animatedContentGestureState,\n animatedHandleGestureState,\n animatedClosedPosition,\n animatedFooterHeight,\n animatedContainerHeight,\n animatedHandleHeight,\n animatedAnimationState,\n animatedKeyboardState,\n animatedKeyboardHeight,\n animatedKeyboardHeightInContainer,\n animatedSheetState,\n animatedHighestSnapPoint,\n animatedScrollableState,\n animatedScrollableOverrideState,\n animatedSnapPoints,\n shouldHandleKeyboardEvents,\n animatedScrollableContentOffsetY,\n isScrollableRefreshable,\n isContentHeightFixed,\n isInTemporaryPosition,\n enableContentPanningGesture,\n overDragResistanceFactor,\n enableOverDrag,\n enablePanDownToClose,\n enableDynamicSizing,\n _providedSimultaneousHandlers,\n _providedWaitFor,\n _providedActiveOffsetX,\n _providedActiveOffsetY,\n _providedFailOffsetX,\n _providedFailOffsetY,\n setScrollableRef,\n removeScrollableRef,\n animateToPosition,\n stopAnimation,\n ]\n );\n const externalContextVariables = useMemo(\n () => ({\n animatedIndex,\n animatedPosition,\n snapToIndex: handleSnapToIndex,\n snapToPosition: handleSnapToPosition,\n expand: handleExpand,\n collapse: handleCollapse,\n close: handleClose,\n forceClose: handleForceClose,\n }),\n [\n animatedIndex,\n animatedPosition,\n handleSnapToIndex,\n handleSnapToPosition,\n handleExpand,\n handleCollapse,\n handleClose,\n handleForceClose,\n ]\n );\n //#endregion\n\n //#region styles\n const containerAnimatedStyle = useAnimatedStyle(\n () => ({\n opacity:\n Platform.OS === 'android' && animatedIndex.value === -1 ? 0 : 1,\n transform: [\n {\n translateY: animatedPosition.value,\n },\n ],\n }),\n [animatedPosition, animatedIndex]\n );\n const containerStyle = useMemo(\n () => [_providedStyle, styles.container, containerAnimatedStyle],\n [_providedStyle, containerAnimatedStyle]\n );\n const contentContainerAnimatedStyle = useAnimatedStyle(() => {\n /**\n * if content height was provided, then we skip setting\n * calculated height.\n */\n if (_providedContentHeight) {\n return {};\n }\n\n return {\n height: animate({\n point: animatedContentHeightMax.value,\n configs: _providedAnimationConfigs,\n }),\n };\n }, [animatedContentHeightMax, enableDynamicSizing, animatedContentHeight]);\n const contentContainerStyle = useMemo(\n () => [styles.contentContainer, contentContainerAnimatedStyle],\n [contentContainerAnimatedStyle]\n );\n /**\n * added safe area to prevent the sheet from floating above\n * the bottom of the screen, when sheet being over dragged or\n * when the sheet is resized.\n */\n const contentMaskContainerAnimatedStyle = useAnimatedStyle(() => {\n if (detached) {\n return {\n overflow: 'visible',\n };\n }\n return {\n paddingBottom: animatedContainerHeight.value,\n };\n }, [detached]);\n const contentMaskContainerStyle = useMemo(\n () => [styles.contentMaskContainer, contentMaskContainerAnimatedStyle],\n [contentMaskContainerAnimatedStyle]\n );\n //#endregion\n\n //#region effects\n /**\n * React to `isLayoutCalculated` change, to insure that the sheet will\n * appears/mounts only when all layout is been calculated.\n *\n * @alias OnMount\n */\n useAnimatedReaction(\n () => isLayoutCalculated.value,\n _isLayoutCalculated => {\n /**\n * exit method if:\n * - layout is not calculated yet.\n * - already did animate on mount.\n */\n if (!_isLayoutCalculated || isAnimatedOnMount.value) {\n return;\n }\n\n let nextPosition;\n if (_providedIndex === -1) {\n nextPosition = animatedClosedPosition.value;\n animatedNextPositionIndex.value = -1;\n } else {\n nextPosition = animatedSnapPoints.value[_providedIndex];\n }\n\n runOnJS(print)({\n component: BottomSheet.name,\n method: 'useAnimatedReaction::OnMount',\n params: {\n isLayoutCalculated: _isLayoutCalculated,\n animatedSnapPoints: animatedSnapPoints.value,\n nextPosition,\n },\n });\n\n /**\n * here we exit method early because the next position\n * is out of the screen, this happens when `snapPoints`\n * still being calculated.\n */\n if (\n nextPosition === INITIAL_POSITION ||\n nextPosition === animatedClosedPosition.value\n ) {\n isAnimatedOnMount.value = true;\n animatedCurrentIndex.value = _providedIndex;\n return;\n }\n\n if (animateOnMount) {\n animateToPosition(nextPosition, ANIMATION_SOURCE.MOUNT);\n } else {\n animatedPosition.value = nextPosition;\n }\n isAnimatedOnMount.value = true;\n },\n [_providedIndex, animateOnMount]\n );\n\n /**\n * React to `snapPoints` change, to insure that the sheet position reflect\n * to the current point correctly.\n *\n * @alias OnSnapPointsChange\n */\n useAnimatedReaction(\n () => ({\n snapPoints: animatedSnapPoints.value,\n containerHeight: animatedContainerHeight.value,\n }),\n (result, _previousResult) => {\n const { snapPoints, containerHeight } = result;\n const _previousSnapPoints = _previousResult?.snapPoints;\n const _previousContainerHeight = _previousResult?.containerHeight;\n\n let nextPosition;\n let animationConfig;\n let animationSource = ANIMATION_SOURCE.SNAP_POINT_CHANGE;\n\n /**\n * if the bottom sheet is closing and the container gets resized,\n * then we restart the closing animation to the new position.\n */\n if (\n animatedAnimationState.value === ANIMATION_STATE.RUNNING &&\n animatedNextPositionIndex.value === -1 &&\n _previousContainerHeight !== containerHeight\n ) {\n animationSource = ANIMATION_SOURCE.CONTAINER_RESIZE;\n animationConfig = {\n duration: 0,\n };\n animateToPosition(\n containerHeight,\n animationSource,\n 0,\n animationConfig\n );\n }\n\n if (\n JSON.stringify(snapPoints) === JSON.stringify(_previousSnapPoints) ||\n !isLayoutCalculated.value ||\n !isAnimatedOnMount.value ||\n containerHeight <= 0\n ) {\n return;\n }\n\n runOnJS(print)({\n component: BottomSheet.name,\n method: 'useAnimatedReaction::OnSnapPointChange',\n params: {\n snapPoints,\n },\n });\n\n /**\n * if snap points changed while sheet is animating, then\n * we stop the animation and animate to the updated point.\n */\n if (\n animatedAnimationState.value === ANIMATION_STATE.RUNNING &&\n animatedNextPositionIndex.value !== animatedCurrentIndex.value\n ) {\n nextPosition =\n animatedNextPositionIndex.value !== -1\n ? snapPoints[animatedNextPositionIndex.value]\n : animatedNextPosition.value;\n } else if (animatedCurrentIndex.value === -1) {\n nextPosition = animatedClosedPosition.value;\n } else if (isInTemporaryPosition.value) {\n nextPosition = getNextPosition();\n } else {\n nextPosition = snapPoints[animatedCurrentIndex.value];\n\n /**\n * if snap points changes because of the container height change,\n * then we skip the snap animation by setting the duration to 0.\n */\n if (containerHeight !== _previousContainerHeight) {\n animationSource = ANIMATION_SOURCE.CONTAINER_RESIZE;\n animationConfig = {\n duration: 0,\n };\n }\n }\n animateToPosition(nextPosition, animationSource, 0, animationConfig);\n }\n );\n\n /**\n * React to keyboard appearance state.\n *\n * @alias OnKeyboardStateChange\n */\n useAnimatedReaction(\n () => ({\n _keyboardState: animatedKeyboardState.value,\n _keyboardHeight: animatedKeyboardHeight.value,\n }),\n (result, _previousResult) => {\n const { _keyboardState, _keyboardHeight } = result;\n const _previousKeyboardState = _previousResult?._keyboardState;\n const _previousKeyboardHeight = _previousResult?._keyboardHeight;\n\n /**\n * Calculate the keyboard height in the container.\n */\n animatedKeyboardHeightInContainer.value = $modal\n ? Math.abs(\n _keyboardHeight -\n Math.abs(bottomInset - animatedContainerOffset.value.bottom)\n )\n : Math.abs(_keyboardHeight - animatedContainerOffset.value.bottom);\n\n const hasActiveGesture =\n animatedContentGestureState.value === State.ACTIVE ||\n animatedContentGestureState.value === State.BEGAN ||\n animatedHandleGestureState.value === State.ACTIVE ||\n animatedHandleGestureState.value === State.BEGAN;\n\n if (\n /**\n * if keyboard state is equal to the previous state, then exit the method\n */\n (_keyboardState === _previousKeyboardState &&\n _keyboardHeight === _previousKeyboardHeight) ||\n /**\n * if user is interacting with sheet, then exit the method\n */\n hasActiveGesture ||\n /**\n * if sheet not animated on mount yet, then exit the method\n */\n !isAnimatedOnMount.value ||\n /**\n * if new keyboard state is hidden and blur behavior is none, then exit the method\n */\n (_keyboardState === KEYBOARD_STATE.HIDDEN &&\n keyboardBlurBehavior === KEYBOARD_BLUR_BEHAVIOR.none) ||\n /**\n * if platform is android and the input mode is resize, then exit the method\n */\n (Platform.OS === 'android' &&\n keyboardBehavior === KEYBOARD_BEHAVIOR.interactive &&\n android_keyboardInputMode === KEYBOARD_INPUT_MODE.adjustResize)\n ) {\n animatedKeyboardHeightInContainer.value = 0;\n return;\n }\n\n runOnJS(print)({\n component: BottomSheet.name,\n method: 'useAnimatedReaction::OnKeyboardStateChange',\n params: {\n keyboardState: _keyboardState,\n keyboardHeight: _keyboardHeight,\n },\n });\n\n let animationConfigs = getKeyboardAnimationConfigs(\n keyboardAnimationEasing.value,\n keyboardAnimationDuration.value\n );\n const nextPosition = getNextPosition();\n animateToPosition(\n nextPosition,\n ANIMATION_SOURCE.KEYBOARD,\n 0,\n animationConfigs\n );\n },\n [\n $modal,\n bottomInset,\n keyboardBehavior,\n keyboardBlurBehavior,\n android_keyboardInputMode,\n animatedContainerOffset,\n getNextPosition,\n ]\n );\n\n /**\n * sets provided animated position\n */\n useAnimatedReaction(\n () => animatedPosition.value,\n _animatedPosition => {\n if (_providedAnimatedPosition) {\n _providedAnimatedPosition.value = _animatedPosition + topInset;\n }\n }\n );\n\n /**\n * sets provided animated index\n */\n useAnimatedReaction(\n () => animatedIndex.value,\n _animatedIndex => {\n if (_providedAnimatedIndex) {\n _providedAnimatedIndex.value = _animatedIndex;\n }\n }\n );\n\n /**\n * React to internal variables to detect change in snap position.\n *\n * @alias OnChange\n */\n useAnimatedReaction(\n () => ({\n _animatedIndex: animatedIndex.value,\n _animatedPosition: animatedPosition.value,\n _animationState: animatedAnimationState.value,\n _contentGestureState: animatedContentGestureState.value,\n _handleGestureState: animatedHandleGestureState.value,\n }),\n ({\n _animatedIndex,\n _animationState,\n _contentGestureState,\n _handleGestureState,\n }) => {\n /**\n * exit the method if animation state is not stopped.\n */\n if (_animationState !== ANIMATION_STATE.STOPPED) {\n return;\n }\n\n /**\n * exit the method if animated index value\n * has fraction, e.g. 1.99, 0.52\n */\n if (_animatedIndex % 1 !== 0) {\n return;\n }\n\n /**\n * exit the method if there any active gesture.\n */\n const hasNoActiveGesture =\n (_contentGestureState === State.END ||\n _contentGestureState === State.UNDETERMINED ||\n _contentGestureState === State.CANCELLED) &&\n (_handleGestureState === State.END ||\n _handleGestureState === State.UNDETERMINED ||\n _handleGestureState === State.CANCELLED);\n if (!hasNoActiveGesture) {\n return;\n }\n\n /**\n * if the index is not equal to the current index,\n * than the sheet position had changed and we trigger\n * the `onChange` callback.\n */\n if (_animatedIndex !== animatedCurrentIndex.value) {\n runOnJS(print)({\n component: BottomSheet.name,\n method: 'useAnimatedReaction::OnChange',\n params: {\n animatedCurrentIndex: animatedCurrentIndex.value,\n animatedIndex: _animatedIndex,\n },\n });\n\n animatedCurrentIndex.value = _animatedIndex;\n runOnJS(handleOnChange)(_animatedIndex);\n }\n\n /**\n * if index is `-1` than we fire the `onClose` callback.\n */\n if (_animatedIndex === -1 && _providedOnClose) {\n runOnJS(print)({\n component: BottomSheet.name,\n method: 'useAnimatedReaction::onClose',\n params: {\n animatedCurrentIndex: animatedCurrentIndex.value,\n animatedIndex: _animatedIndex,\n },\n });\n runOnJS(_providedOnClose)();\n }\n },\n [handleOnChange, _providedOnClose]\n );\n\n /**\n * React to `index` prop to snap the sheet to the new position.\n *\n * @alias onIndexChange\n */\n useEffect(() => {\n if (isAnimatedOnMount.value) {\n handleSnapToIndex(_providedIndex);\n }\n }, [\n _providedIndex,\n animatedCurrentIndex,\n isAnimatedOnMount,\n handleSnapToIndex,\n ]);\n //#endregion\n\n // render\n print({\n component: BottomSheet.name,\n method: 'render',\n params: {\n animatedSnapPoints: animatedSnapPoints.value,\n animatedCurrentIndex: animatedCurrentIndex.value,\n providedIndex: _providedIndex,\n },\n });\n return (\n \n \n \n \n \n \n \n \n \n {typeof Content === 'function' ? : Content}\n\n {footerComponent && (\n \n )}\n \n \n \n \n {/* */}\n \n \n \n \n );\n }\n);\n\nconst BottomSheet = memo(BottomSheetComponent);\nBottomSheet.displayName = 'BottomSheet';\n\nexport default BottomSheet;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheet/constants.js b/lib/module/components/bottomSheet/constants.js deleted file mode 100644 index 889a30d5d..000000000 --- a/lib/module/components/bottomSheet/constants.js +++ /dev/null @@ -1,30 +0,0 @@ -import { KEYBOARD_BEHAVIOR, KEYBOARD_BLUR_BEHAVIOR, KEYBOARD_INPUT_MODE, SCREEN_HEIGHT } from '../../constants'; // default values - -const DEFAULT_HANDLE_HEIGHT = 24; -const DEFAULT_OVER_DRAG_RESISTANCE_FACTOR = 2.5; -const DEFAULT_ENABLE_CONTENT_PANNING_GESTURE = true; -const DEFAULT_ENABLE_HANDLE_PANNING_GESTURE = true; -const DEFAULT_ENABLE_OVER_DRAG = true; -const DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE = false; -const DEFAULT_ANIMATE_ON_MOUNT = true; -const DEFAULT_DYNAMIC_SIZING = false; // keyboard - -const DEFAULT_KEYBOARD_BEHAVIOR = KEYBOARD_BEHAVIOR.interactive; -const DEFAULT_KEYBOARD_BLUR_BEHAVIOR = KEYBOARD_BLUR_BEHAVIOR.none; -const DEFAULT_KEYBOARD_INPUT_MODE = KEYBOARD_INPUT_MODE.adjustPan; // initial values - -const INITIAL_VALUE = Number.NEGATIVE_INFINITY; -const INITIAL_SNAP_POINT = -999; -const INITIAL_CONTAINER_HEIGHT = -999; -const INITIAL_CONTAINER_OFFSET = { - top: 0, - bottom: 0, - left: 0, - right: 0 -}; -const INITIAL_HANDLE_HEIGHT = -999; -const INITIAL_POSITION = SCREEN_HEIGHT; -export { DEFAULT_HANDLE_HEIGHT, DEFAULT_OVER_DRAG_RESISTANCE_FACTOR, DEFAULT_ENABLE_CONTENT_PANNING_GESTURE, DEFAULT_ENABLE_HANDLE_PANNING_GESTURE, DEFAULT_ENABLE_OVER_DRAG, DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE, DEFAULT_DYNAMIC_SIZING, DEFAULT_ANIMATE_ON_MOUNT, // keyboard -DEFAULT_KEYBOARD_BEHAVIOR, DEFAULT_KEYBOARD_BLUR_BEHAVIOR, DEFAULT_KEYBOARD_INPUT_MODE, // layout -INITIAL_POSITION, INITIAL_CONTAINER_HEIGHT, INITIAL_CONTAINER_OFFSET, INITIAL_HANDLE_HEIGHT, INITIAL_SNAP_POINT, INITIAL_VALUE }; -//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheet/constants.js.map b/lib/module/components/bottomSheet/constants.js.map deleted file mode 100644 index cb4369fe6..000000000 --- a/lib/module/components/bottomSheet/constants.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["constants.ts"],"names":["KEYBOARD_BEHAVIOR","KEYBOARD_BLUR_BEHAVIOR","KEYBOARD_INPUT_MODE","SCREEN_HEIGHT","DEFAULT_HANDLE_HEIGHT","DEFAULT_OVER_DRAG_RESISTANCE_FACTOR","DEFAULT_ENABLE_CONTENT_PANNING_GESTURE","DEFAULT_ENABLE_HANDLE_PANNING_GESTURE","DEFAULT_ENABLE_OVER_DRAG","DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE","DEFAULT_ANIMATE_ON_MOUNT","DEFAULT_DYNAMIC_SIZING","DEFAULT_KEYBOARD_BEHAVIOR","interactive","DEFAULT_KEYBOARD_BLUR_BEHAVIOR","none","DEFAULT_KEYBOARD_INPUT_MODE","adjustPan","INITIAL_VALUE","Number","NEGATIVE_INFINITY","INITIAL_SNAP_POINT","INITIAL_CONTAINER_HEIGHT","INITIAL_CONTAINER_OFFSET","top","bottom","left","right","INITIAL_HANDLE_HEIGHT","INITIAL_POSITION"],"mappings":"AAAA,SACEA,iBADF,EAEEC,sBAFF,EAGEC,mBAHF,EAIEC,aAJF,QAKO,iBALP,C,CAOA;;AACA,MAAMC,qBAAqB,GAAG,EAA9B;AACA,MAAMC,mCAAmC,GAAG,GAA5C;AACA,MAAMC,sCAAsC,GAAG,IAA/C;AACA,MAAMC,qCAAqC,GAAG,IAA9C;AACA,MAAMC,wBAAwB,GAAG,IAAjC;AACA,MAAMC,gCAAgC,GAAG,KAAzC;AACA,MAAMC,wBAAwB,GAAG,IAAjC;AACA,MAAMC,sBAAsB,GAAG,KAA/B,C,CAEA;;AACA,MAAMC,yBAAyB,GAAGZ,iBAAiB,CAACa,WAApD;AACA,MAAMC,8BAA8B,GAAGb,sBAAsB,CAACc,IAA9D;AACA,MAAMC,2BAA2B,GAAGd,mBAAmB,CAACe,SAAxD,C,CAEA;;AACA,MAAMC,aAAa,GAAGC,MAAM,CAACC,iBAA7B;AACA,MAAMC,kBAAkB,GAAG,CAAC,GAA5B;AACA,MAAMC,wBAAwB,GAAG,CAAC,GAAlC;AACA,MAAMC,wBAAwB,GAAG;AAC/BC,EAAAA,GAAG,EAAE,CAD0B;AAE/BC,EAAAA,MAAM,EAAE,CAFuB;AAG/BC,EAAAA,IAAI,EAAE,CAHyB;AAI/BC,EAAAA,KAAK,EAAE;AAJwB,CAAjC;AAMA,MAAMC,qBAAqB,GAAG,CAAC,GAA/B;AACA,MAAMC,gBAAgB,GAAG1B,aAAzB;AAEA,SACEC,qBADF,EAEEC,mCAFF,EAGEC,sCAHF,EAIEC,qCAJF,EAKEC,wBALF,EAMEC,gCANF,EAOEE,sBAPF,EAQED,wBARF,EASE;AACAE,yBAVF,EAWEE,8BAXF,EAYEE,2BAZF,EAaE;AACAa,gBAdF,EAeEP,wBAfF,EAgBEC,wBAhBF,EAiBEK,qBAjBF,EAkBEP,kBAlBF,EAmBEH,aAnBF","sourcesContent":["import {\n KEYBOARD_BEHAVIOR,\n KEYBOARD_BLUR_BEHAVIOR,\n KEYBOARD_INPUT_MODE,\n SCREEN_HEIGHT,\n} from '../../constants';\n\n// default values\nconst DEFAULT_HANDLE_HEIGHT = 24;\nconst DEFAULT_OVER_DRAG_RESISTANCE_FACTOR = 2.5;\nconst DEFAULT_ENABLE_CONTENT_PANNING_GESTURE = true;\nconst DEFAULT_ENABLE_HANDLE_PANNING_GESTURE = true;\nconst DEFAULT_ENABLE_OVER_DRAG = true;\nconst DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE = false;\nconst DEFAULT_ANIMATE_ON_MOUNT = true;\nconst DEFAULT_DYNAMIC_SIZING = false;\n\n// keyboard\nconst DEFAULT_KEYBOARD_BEHAVIOR = KEYBOARD_BEHAVIOR.interactive;\nconst DEFAULT_KEYBOARD_BLUR_BEHAVIOR = KEYBOARD_BLUR_BEHAVIOR.none;\nconst DEFAULT_KEYBOARD_INPUT_MODE = KEYBOARD_INPUT_MODE.adjustPan;\n\n// initial values\nconst INITIAL_VALUE = Number.NEGATIVE_INFINITY;\nconst INITIAL_SNAP_POINT = -999;\nconst INITIAL_CONTAINER_HEIGHT = -999;\nconst INITIAL_CONTAINER_OFFSET = {\n top: 0,\n bottom: 0,\n left: 0,\n right: 0,\n};\nconst INITIAL_HANDLE_HEIGHT = -999;\nconst INITIAL_POSITION = SCREEN_HEIGHT;\n\nexport {\n DEFAULT_HANDLE_HEIGHT,\n DEFAULT_OVER_DRAG_RESISTANCE_FACTOR,\n DEFAULT_ENABLE_CONTENT_PANNING_GESTURE,\n DEFAULT_ENABLE_HANDLE_PANNING_GESTURE,\n DEFAULT_ENABLE_OVER_DRAG,\n DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE,\n DEFAULT_DYNAMIC_SIZING,\n DEFAULT_ANIMATE_ON_MOUNT,\n // keyboard\n DEFAULT_KEYBOARD_BEHAVIOR,\n DEFAULT_KEYBOARD_BLUR_BEHAVIOR,\n DEFAULT_KEYBOARD_INPUT_MODE,\n // layout\n INITIAL_POSITION,\n INITIAL_CONTAINER_HEIGHT,\n INITIAL_CONTAINER_OFFSET,\n INITIAL_HANDLE_HEIGHT,\n INITIAL_SNAP_POINT,\n INITIAL_VALUE,\n};\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheet/index.js b/lib/module/components/bottomSheet/index.js deleted file mode 100644 index 492551ed7..000000000 --- a/lib/module/components/bottomSheet/index.js +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './BottomSheet'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheet/index.js.map b/lib/module/components/bottomSheet/index.js.map deleted file mode 100644 index 57f7b105f..000000000 --- a/lib/module/components/bottomSheet/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":["default"],"mappings":"AAAA,SAASA,OAAT,QAAwB,eAAxB","sourcesContent":["export { default } from './BottomSheet';\nexport type { BottomSheetProps } from './types';\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheet/styles.js b/lib/module/components/bottomSheet/styles.js deleted file mode 100644 index 2ed48af80..000000000 --- a/lib/module/components/bottomSheet/styles.js +++ /dev/null @@ -1,15 +0,0 @@ -import { StyleSheet } from 'react-native'; -export const styles = StyleSheet.create({ - container: { - flexDirection: 'column-reverse', - position: 'absolute', - top: 0, - left: 0, - right: 0 - }, - contentContainer: {}, - contentMaskContainer: { - overflow: 'hidden' - } -}); -//# sourceMappingURL=styles.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheet/styles.js.map b/lib/module/components/bottomSheet/styles.js.map deleted file mode 100644 index b8dc43c06..000000000 --- a/lib/module/components/bottomSheet/styles.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["styles.ts"],"names":["StyleSheet","styles","create","container","flexDirection","position","top","left","right","contentContainer","contentMaskContainer","overflow"],"mappings":"AAAA,SAASA,UAAT,QAA2B,cAA3B;AAEA,OAAO,MAAMC,MAAM,GAAGD,UAAU,CAACE,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE;AACTC,IAAAA,aAAa,EAAE,gBADN;AAETC,IAAAA,QAAQ,EAAE,UAFD;AAGTC,IAAAA,GAAG,EAAE,CAHI;AAITC,IAAAA,IAAI,EAAE,CAJG;AAKTC,IAAAA,KAAK,EAAE;AALE,GAD2B;AAQtCC,EAAAA,gBAAgB,EAAE,EARoB;AAStCC,EAAAA,oBAAoB,EAAE;AACpBC,IAAAA,QAAQ,EAAE;AADU;AATgB,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\n\nexport const styles = StyleSheet.create({\n container: {\n flexDirection: 'column-reverse',\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n },\n contentContainer: {},\n contentMaskContainer: {\n overflow: 'hidden',\n },\n});\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackdrop/BottomSheetBackdrop.js b/lib/module/components/bottomSheetBackdrop/BottomSheetBackdrop.js deleted file mode 100644 index 6fbd1a07a..000000000 --- a/lib/module/components/bottomSheetBackdrop/BottomSheetBackdrop.js +++ /dev/null @@ -1,91 +0,0 @@ -import React, { memo, useCallback, useMemo, useState } from 'react'; -import Animated, { interpolate, Extrapolate, useAnimatedStyle, useAnimatedReaction, useAnimatedGestureHandler, runOnJS } from 'react-native-reanimated'; -import { TapGestureHandler } from 'react-native-gesture-handler'; -import { useBottomSheet } from '../../hooks'; -import { DEFAULT_OPACITY, DEFAULT_APPEARS_ON_INDEX, DEFAULT_DISAPPEARS_ON_INDEX, DEFAULT_ENABLE_TOUCH_THROUGH, DEFAULT_PRESS_BEHAVIOR } from './constants'; -import { styles } from './styles'; - -const BottomSheetBackdropComponent = ({ - animatedIndex, - opacity: _providedOpacity, - appearsOnIndex: _providedAppearsOnIndex, - disappearsOnIndex: _providedDisappearsOnIndex, - enableTouchThrough: _providedEnableTouchThrough, - pressBehavior = DEFAULT_PRESS_BEHAVIOR, - onPress, - style, - children -}) => { - //#region hooks - const { - snapToIndex, - close - } = useBottomSheet(); //#endregion - //#region defaults - - const opacity = _providedOpacity !== null && _providedOpacity !== void 0 ? _providedOpacity : DEFAULT_OPACITY; - const appearsOnIndex = _providedAppearsOnIndex !== null && _providedAppearsOnIndex !== void 0 ? _providedAppearsOnIndex : DEFAULT_APPEARS_ON_INDEX; - const disappearsOnIndex = _providedDisappearsOnIndex !== null && _providedDisappearsOnIndex !== void 0 ? _providedDisappearsOnIndex : DEFAULT_DISAPPEARS_ON_INDEX; - const enableTouchThrough = _providedEnableTouchThrough !== null && _providedEnableTouchThrough !== void 0 ? _providedEnableTouchThrough : DEFAULT_ENABLE_TOUCH_THROUGH; //#endregion - //#region variables - - const [pointerEvents, setPointerEvents] = useState(enableTouchThrough ? 'none' : 'auto'); //#endregion - //#region callbacks - - const handleOnPress = useCallback(() => { - onPress === null || onPress === void 0 ? void 0 : onPress(); - - if (pressBehavior === 'close') { - close(); - } else if (pressBehavior === 'collapse') { - snapToIndex(disappearsOnIndex); - } else if (typeof pressBehavior === 'number') { - snapToIndex(pressBehavior); - } - }, [snapToIndex, close, disappearsOnIndex, pressBehavior, onPress]); - const handleContainerTouchability = useCallback(shouldDisableTouchability => { - setPointerEvents(shouldDisableTouchability ? 'none' : 'auto'); - }, []); //#endregion - //#region tap gesture - - const gestureHandler = useAnimatedGestureHandler({ - onFinish: () => { - runOnJS(handleOnPress)(); - } - }, [handleOnPress]); //#endregion - //#region styles - - const containerAnimatedStyle = useAnimatedStyle(() => ({ - opacity: interpolate(animatedIndex.value, [-1, disappearsOnIndex, appearsOnIndex], [0, 0, opacity], Extrapolate.CLAMP), - flex: 1 - })); - const containerStyle = useMemo(() => [styles.container, style, containerAnimatedStyle], [style, containerAnimatedStyle]); //#endregion - //#region effects - - useAnimatedReaction(() => animatedIndex.value <= disappearsOnIndex, (shouldDisableTouchability, previous) => { - if (shouldDisableTouchability === previous) { - return; - } - - runOnJS(handleContainerTouchability)(shouldDisableTouchability); - }, [disappearsOnIndex]); //#endregion - - return pressBehavior !== 'none' ? /*#__PURE__*/React.createElement(TapGestureHandler, { - onGestureEvent: gestureHandler - }, /*#__PURE__*/React.createElement(Animated.View, { - style: containerStyle, - pointerEvents: pointerEvents, - accessible: true, - accessibilityRole: "button", - accessibilityLabel: "Bottom Sheet backdrop", - accessibilityHint: `Tap to ${typeof pressBehavior === 'string' ? pressBehavior : 'move'} the Bottom Sheet` - }, children)) : /*#__PURE__*/React.createElement(Animated.View, { - pointerEvents: pointerEvents, - style: containerStyle - }, children); -}; - -const BottomSheetBackdrop = /*#__PURE__*/memo(BottomSheetBackdropComponent); -BottomSheetBackdrop.displayName = 'BottomSheetBackdrop'; -export default BottomSheetBackdrop; -//# sourceMappingURL=BottomSheetBackdrop.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackdrop/BottomSheetBackdrop.js.map b/lib/module/components/bottomSheetBackdrop/BottomSheetBackdrop.js.map deleted file mode 100644 index 329982e45..000000000 --- a/lib/module/components/bottomSheetBackdrop/BottomSheetBackdrop.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheetBackdrop.tsx"],"names":["React","memo","useCallback","useMemo","useState","Animated","interpolate","Extrapolate","useAnimatedStyle","useAnimatedReaction","useAnimatedGestureHandler","runOnJS","TapGestureHandler","useBottomSheet","DEFAULT_OPACITY","DEFAULT_APPEARS_ON_INDEX","DEFAULT_DISAPPEARS_ON_INDEX","DEFAULT_ENABLE_TOUCH_THROUGH","DEFAULT_PRESS_BEHAVIOR","styles","BottomSheetBackdropComponent","animatedIndex","opacity","_providedOpacity","appearsOnIndex","_providedAppearsOnIndex","disappearsOnIndex","_providedDisappearsOnIndex","enableTouchThrough","_providedEnableTouchThrough","pressBehavior","onPress","style","children","snapToIndex","close","pointerEvents","setPointerEvents","handleOnPress","handleContainerTouchability","shouldDisableTouchability","gestureHandler","onFinish","containerAnimatedStyle","value","CLAMP","flex","containerStyle","container","previous","BottomSheetBackdrop","displayName"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,IAAhB,EAAsBC,WAAtB,EAAmCC,OAAnC,EAA4CC,QAA5C,QAA4D,OAA5D;AAEA,OAAOC,QAAP,IACEC,WADF,EAEEC,WAFF,EAGEC,gBAHF,EAIEC,mBAJF,EAKEC,yBALF,EAMEC,OANF,QAOO,yBAPP;AAQA,SACEC,iBADF,QAGO,8BAHP;AAIA,SAASC,cAAT,QAA+B,aAA/B;AACA,SACEC,eADF,EAEEC,wBAFF,EAGEC,2BAHF,EAIEC,4BAJF,EAKEC,sBALF,QAMO,aANP;AAOA,SAASC,MAAT,QAAuB,UAAvB;;AAGA,MAAMC,4BAA4B,GAAG,CAA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,CAAnB,CArEqC,CA+ErC;;AAEA,SAAOI,aAAa,KAAK,MAAlB,gBACL,oBAAC,iBAAD;AAAmB,IAAA,cAAc,EAAEW;AAAnC,kBACE,oBAAC,QAAD,CAAU,IAAV;AACE,IAAA,KAAK,EAAEM,cADT;AAEE,IAAA,aAAa,EAAEX,aAFjB;AAGE,IAAA,UAAU,EAAE,IAHd;AAIE,IAAA,iBAAiB,EAAC,QAJpB;AAKE,IAAA,kBAAkB,EAAC,uBALrB;AAME,IAAA,iBAAiB,EAAG,UAClB,OAAON,aAAP,KAAyB,QAAzB,GAAoCA,aAApC,GAAoD,MACrD;AARH,KAUGG,QAVH,CADF,CADK,gBAgBL,oBAAC,QAAD,CAAU,IAAV;AAAe,IAAA,aAAa,EAAEG,aAA9B;AAA6C,IAAA,KAAK,EAAEW;AAApD,KACGd,QADH,CAhBF;AAoBD,CA/GD;;AAiHA,MAAMiB,mBAAmB,gBAAGjD,IAAI,CAACmB,4BAAD,CAAhC;AACA8B,mBAAmB,CAACC,WAApB,GAAkC,qBAAlC;AAEA,eAAeD,mBAAf","sourcesContent":["import React, { memo, useCallback, useMemo, useState } from 'react';\nimport { ViewProps } from 'react-native';\nimport Animated, {\n interpolate,\n Extrapolate,\n useAnimatedStyle,\n useAnimatedReaction,\n useAnimatedGestureHandler,\n runOnJS,\n} from 'react-native-reanimated';\nimport {\n TapGestureHandler,\n TapGestureHandlerGestureEvent,\n} from 'react-native-gesture-handler';\nimport { useBottomSheet } from '../../hooks';\nimport {\n DEFAULT_OPACITY,\n DEFAULT_APPEARS_ON_INDEX,\n DEFAULT_DISAPPEARS_ON_INDEX,\n DEFAULT_ENABLE_TOUCH_THROUGH,\n DEFAULT_PRESS_BEHAVIOR,\n} from './constants';\nimport { styles } from './styles';\nimport type { BottomSheetDefaultBackdropProps } from './types';\n\nconst BottomSheetBackdropComponent = ({\n animatedIndex,\n opacity: _providedOpacity,\n appearsOnIndex: _providedAppearsOnIndex,\n disappearsOnIndex: _providedDisappearsOnIndex,\n enableTouchThrough: _providedEnableTouchThrough,\n pressBehavior = DEFAULT_PRESS_BEHAVIOR,\n onPress,\n style,\n children,\n}: BottomSheetDefaultBackdropProps) => {\n //#region hooks\n const { snapToIndex, close } = useBottomSheet();\n //#endregion\n\n //#region defaults\n const opacity = _providedOpacity ?? DEFAULT_OPACITY;\n const appearsOnIndex = _providedAppearsOnIndex ?? DEFAULT_APPEARS_ON_INDEX;\n const disappearsOnIndex =\n _providedDisappearsOnIndex ?? DEFAULT_DISAPPEARS_ON_INDEX;\n const enableTouchThrough =\n _providedEnableTouchThrough ?? DEFAULT_ENABLE_TOUCH_THROUGH;\n //#endregion\n\n //#region variables\n const [pointerEvents, setPointerEvents] = useState<\n ViewProps['pointerEvents']\n >(enableTouchThrough ? 'none' : 'auto');\n //#endregion\n\n //#region callbacks\n const handleOnPress = useCallback(() => {\n onPress?.();\n\n if (pressBehavior === 'close') {\n close();\n } else if (pressBehavior === 'collapse') {\n snapToIndex(disappearsOnIndex as number);\n } else if (typeof pressBehavior === 'number') {\n snapToIndex(pressBehavior);\n }\n }, [snapToIndex, close, disappearsOnIndex, pressBehavior, onPress]);\n const handleContainerTouchability = useCallback(\n (shouldDisableTouchability: boolean) => {\n setPointerEvents(shouldDisableTouchability ? 'none' : 'auto');\n },\n []\n );\n //#endregion\n\n //#region tap gesture\n const gestureHandler =\n useAnimatedGestureHandler(\n {\n onFinish: () => {\n runOnJS(handleOnPress)();\n },\n },\n [handleOnPress]\n );\n //#endregion\n\n //#region styles\n const containerAnimatedStyle = useAnimatedStyle(() => ({\n opacity: interpolate(\n animatedIndex.value,\n [-1, disappearsOnIndex, appearsOnIndex],\n [0, 0, opacity],\n Extrapolate.CLAMP\n ),\n flex: 1,\n }));\n const containerStyle = useMemo(\n () => [styles.container, style, containerAnimatedStyle],\n [style, containerAnimatedStyle]\n );\n //#endregion\n\n //#region effects\n useAnimatedReaction(\n () => animatedIndex.value <= disappearsOnIndex,\n (shouldDisableTouchability, previous) => {\n if (shouldDisableTouchability === previous) {\n return;\n }\n runOnJS(handleContainerTouchability)(shouldDisableTouchability);\n },\n [disappearsOnIndex]\n );\n //#endregion\n\n return pressBehavior !== 'none' ? (\n \n \n {children}\n \n \n ) : (\n \n {children}\n \n );\n};\n\nconst BottomSheetBackdrop = memo(BottomSheetBackdropComponent);\nBottomSheetBackdrop.displayName = 'BottomSheetBackdrop';\n\nexport default BottomSheetBackdrop;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackdrop/constants.js b/lib/module/components/bottomSheetBackdrop/constants.js deleted file mode 100644 index 2abe24132..000000000 --- a/lib/module/components/bottomSheetBackdrop/constants.js +++ /dev/null @@ -1,7 +0,0 @@ -const DEFAULT_OPACITY = 0.5; -const DEFAULT_APPEARS_ON_INDEX = 1; -const DEFAULT_DISAPPEARS_ON_INDEX = 0; -const DEFAULT_ENABLE_TOUCH_THROUGH = false; -const DEFAULT_PRESS_BEHAVIOR = 'close'; -export { DEFAULT_OPACITY, DEFAULT_APPEARS_ON_INDEX, DEFAULT_DISAPPEARS_ON_INDEX, DEFAULT_ENABLE_TOUCH_THROUGH, DEFAULT_PRESS_BEHAVIOR }; -//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackdrop/constants.js.map b/lib/module/components/bottomSheetBackdrop/constants.js.map deleted file mode 100644 index e07a61f81..000000000 --- a/lib/module/components/bottomSheetBackdrop/constants.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["constants.ts"],"names":["DEFAULT_OPACITY","DEFAULT_APPEARS_ON_INDEX","DEFAULT_DISAPPEARS_ON_INDEX","DEFAULT_ENABLE_TOUCH_THROUGH","DEFAULT_PRESS_BEHAVIOR"],"mappings":"AAAA,MAAMA,eAAe,GAAG,GAAxB;AACA,MAAMC,wBAAwB,GAAG,CAAjC;AACA,MAAMC,2BAA2B,GAAG,CAApC;AACA,MAAMC,4BAA4B,GAAG,KAArC;AACA,MAAMC,sBAAsB,GAAG,OAA/B;AAEA,SACEJ,eADF,EAEEC,wBAFF,EAGEC,2BAHF,EAIEC,4BAJF,EAKEC,sBALF","sourcesContent":["const DEFAULT_OPACITY = 0.5;\nconst DEFAULT_APPEARS_ON_INDEX = 1;\nconst DEFAULT_DISAPPEARS_ON_INDEX = 0;\nconst DEFAULT_ENABLE_TOUCH_THROUGH = false;\nconst DEFAULT_PRESS_BEHAVIOR = 'close' as const;\n\nexport {\n DEFAULT_OPACITY,\n DEFAULT_APPEARS_ON_INDEX,\n DEFAULT_DISAPPEARS_ON_INDEX,\n DEFAULT_ENABLE_TOUCH_THROUGH,\n DEFAULT_PRESS_BEHAVIOR,\n};\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackdrop/index.js b/lib/module/components/bottomSheetBackdrop/index.js deleted file mode 100644 index e32285096..000000000 --- a/lib/module/components/bottomSheetBackdrop/index.js +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './BottomSheetBackdrop'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackdrop/index.js.map b/lib/module/components/bottomSheetBackdrop/index.js.map deleted file mode 100644 index 81c427142..000000000 --- a/lib/module/components/bottomSheetBackdrop/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":["default"],"mappings":"AAAA,SAASA,OAAT,QAAwB,uBAAxB","sourcesContent":["export { default } from './BottomSheetBackdrop';\nexport type { BottomSheetBackdropProps } from './types';\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackdrop/styles.js b/lib/module/components/bottomSheetBackdrop/styles.js deleted file mode 100644 index 87817ba10..000000000 --- a/lib/module/components/bottomSheetBackdrop/styles.js +++ /dev/null @@ -1,7 +0,0 @@ -import { StyleSheet } from 'react-native'; -export const styles = StyleSheet.create({ - container: { - backgroundColor: 'black' - } -}); -//# sourceMappingURL=styles.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackdrop/styles.js.map b/lib/module/components/bottomSheetBackdrop/styles.js.map deleted file mode 100644 index 92aa3b86b..000000000 --- a/lib/module/components/bottomSheetBackdrop/styles.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["styles.ts"],"names":["StyleSheet","styles","create","container","backgroundColor"],"mappings":"AAAA,SAASA,UAAT,QAA2B,cAA3B;AAEA,OAAO,MAAMC,MAAM,GAAGD,UAAU,CAACE,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE;AACTC,IAAAA,eAAe,EAAE;AADR;AAD2B,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\n\nexport const styles = StyleSheet.create({\n container: {\n backgroundColor: 'black',\n },\n});\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackdropContainer/BottomSheetBackdropContainer.js b/lib/module/components/bottomSheetBackdropContainer/BottomSheetBackdropContainer.js deleted file mode 100644 index 4a8452229..000000000 --- a/lib/module/components/bottomSheetBackdropContainer/BottomSheetBackdropContainer.js +++ /dev/null @@ -1,19 +0,0 @@ -import React, { memo } from 'react'; -import { styles } from './styles'; - -const BottomSheetBackdropContainerComponent = ({ - animatedIndex, - animatedPosition, - backdropComponent: BackdropComponent -}) => { - return BackdropComponent ? /*#__PURE__*/React.createElement(BackdropComponent, { - animatedIndex: animatedIndex, - animatedPosition: animatedPosition, - style: styles.container - }) : null; -}; - -const BottomSheetBackdropContainer = /*#__PURE__*/memo(BottomSheetBackdropContainerComponent); -BottomSheetBackdropContainer.displayName = 'BottomSheetBackdropContainer'; -export default BottomSheetBackdropContainer; -//# sourceMappingURL=BottomSheetBackdropContainer.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackdropContainer/BottomSheetBackdropContainer.js.map b/lib/module/components/bottomSheetBackdropContainer/BottomSheetBackdropContainer.js.map deleted file mode 100644 index da6234cfa..000000000 --- a/lib/module/components/bottomSheetBackdropContainer/BottomSheetBackdropContainer.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheetBackdropContainer.tsx"],"names":["React","memo","styles","BottomSheetBackdropContainerComponent","animatedIndex","animatedPosition","backdropComponent","BackdropComponent","container","BottomSheetBackdropContainer","displayName"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,IAAhB,QAA4B,OAA5B;AAEA,SAASC,MAAT,QAAuB,UAAvB;;AAEA,MAAMC,qCAAqC,GAAG,CAAC;AAC7CC,EAAAA,aAD6C;AAE7CC,EAAAA,gBAF6C;AAG7CC,EAAAA,iBAAiB,EAAEC;AAH0B,CAAD,KAIL;AACvC,SAAOA,iBAAiB,gBACtB,oBAAC,iBAAD;AACE,IAAA,aAAa,EAAEH,aADjB;AAEE,IAAA,gBAAgB,EAAEC,gBAFpB;AAGE,IAAA,KAAK,EAAEH,MAAM,CAACM;AAHhB,IADsB,GAMpB,IANJ;AAOD,CAZD;;AAcA,MAAMC,4BAA4B,gBAAGR,IAAI,CACvCE,qCADuC,CAAzC;AAGAM,4BAA4B,CAACC,WAA7B,GAA2C,8BAA3C;AAEA,eAAeD,4BAAf","sourcesContent":["import React, { memo } from 'react';\nimport type { BottomSheetBackdropContainerProps } from './types';\nimport { styles } from './styles';\n\nconst BottomSheetBackdropContainerComponent = ({\n animatedIndex,\n animatedPosition,\n backdropComponent: BackdropComponent,\n}: BottomSheetBackdropContainerProps) => {\n return BackdropComponent ? (\n \n ) : null;\n};\n\nconst BottomSheetBackdropContainer = memo(\n BottomSheetBackdropContainerComponent\n);\nBottomSheetBackdropContainer.displayName = 'BottomSheetBackdropContainer';\n\nexport default BottomSheetBackdropContainer;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackdropContainer/index.js b/lib/module/components/bottomSheetBackdropContainer/index.js deleted file mode 100644 index 4aaabaac8..000000000 --- a/lib/module/components/bottomSheetBackdropContainer/index.js +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './BottomSheetBackdropContainer'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackdropContainer/index.js.map b/lib/module/components/bottomSheetBackdropContainer/index.js.map deleted file mode 100644 index d482b18dd..000000000 --- a/lib/module/components/bottomSheetBackdropContainer/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":["default"],"mappings":"AAAA,SAASA,OAAT,QAAwB,gCAAxB","sourcesContent":["export { default } from './BottomSheetBackdropContainer';\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackdropContainer/styles.js b/lib/module/components/bottomSheetBackdropContainer/styles.js deleted file mode 100644 index 2cdb32548..000000000 --- a/lib/module/components/bottomSheetBackdropContainer/styles.js +++ /dev/null @@ -1,11 +0,0 @@ -import { StyleSheet } from 'react-native'; -export const styles = StyleSheet.create({ - container: { - position: 'absolute', - top: 0, - left: 0, - right: 0, - bottom: 0 - } -}); -//# sourceMappingURL=styles.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackdropContainer/styles.js.map b/lib/module/components/bottomSheetBackdropContainer/styles.js.map deleted file mode 100644 index 633c8bcfc..000000000 --- a/lib/module/components/bottomSheetBackdropContainer/styles.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["styles.ts"],"names":["StyleSheet","styles","create","container","position","top","left","right","bottom"],"mappings":"AAAA,SAASA,UAAT,QAA2B,cAA3B;AAEA,OAAO,MAAMC,MAAM,GAAGD,UAAU,CAACE,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE;AACTC,IAAAA,QAAQ,EAAE,UADD;AAETC,IAAAA,GAAG,EAAE,CAFI;AAGTC,IAAAA,IAAI,EAAE,CAHG;AAITC,IAAAA,KAAK,EAAE,CAJE;AAKTC,IAAAA,MAAM,EAAE;AALC;AAD2B,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\n\nexport const styles = StyleSheet.create({\n container: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n },\n});\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackground/BottomSheetBackground.js b/lib/module/components/bottomSheetBackground/BottomSheetBackground.js deleted file mode 100644 index d72bcec69..000000000 --- a/lib/module/components/bottomSheetBackground/BottomSheetBackground.js +++ /dev/null @@ -1,19 +0,0 @@ -import React, { memo } from 'react'; -import { View } from 'react-native'; -import { styles } from './styles'; - -const BottomSheetBackgroundComponent = ({ - pointerEvents, - style -}) => /*#__PURE__*/React.createElement(View, { - pointerEvents: pointerEvents, - accessible: true, - accessibilityRole: "adjustable", - accessibilityLabel: "Bottom Sheet", - style: [styles.container, style] -}); - -const BottomSheetBackground = /*#__PURE__*/memo(BottomSheetBackgroundComponent); -BottomSheetBackground.displayName = 'BottomSheetBackground'; -export default BottomSheetBackground; -//# sourceMappingURL=BottomSheetBackground.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackground/BottomSheetBackground.js.map b/lib/module/components/bottomSheetBackground/BottomSheetBackground.js.map deleted file mode 100644 index 4da384991..000000000 --- a/lib/module/components/bottomSheetBackground/BottomSheetBackground.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheetBackground.tsx"],"names":["React","memo","View","styles","BottomSheetBackgroundComponent","pointerEvents","style","container","BottomSheetBackground","displayName"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,IAAhB,QAA4B,OAA5B;AACA,SAASC,IAAT,QAAqB,cAArB;AAEA,SAASC,MAAT,QAAuB,UAAvB;;AAEA,MAAMC,8BAA8B,GAAG,CAAC;AACtCC,EAAAA,aADsC;AAEtCC,EAAAA;AAFsC,CAAD,kBAIrC,oBAAC,IAAD;AACE,EAAA,aAAa,EAAED,aADjB;AAEE,EAAA,UAAU,EAAE,IAFd;AAGE,EAAA,iBAAiB,EAAC,YAHpB;AAIE,EAAA,kBAAkB,EAAC,cAJrB;AAKE,EAAA,KAAK,EAAE,CAACF,MAAM,CAACI,SAAR,EAAmBD,KAAnB;AALT,EAJF;;AAaA,MAAME,qBAAqB,gBAAGP,IAAI,CAACG,8BAAD,CAAlC;AACAI,qBAAqB,CAACC,WAAtB,GAAoC,uBAApC;AAEA,eAAeD,qBAAf","sourcesContent":["import React, { memo } from 'react';\nimport { View } from 'react-native';\nimport type { BottomSheetBackgroundProps } from './types';\nimport { styles } from './styles';\n\nconst BottomSheetBackgroundComponent = ({\n pointerEvents,\n style,\n}: BottomSheetBackgroundProps) => (\n \n);\n\nconst BottomSheetBackground = memo(BottomSheetBackgroundComponent);\nBottomSheetBackground.displayName = 'BottomSheetBackground';\n\nexport default BottomSheetBackground;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackground/index.js b/lib/module/components/bottomSheetBackground/index.js deleted file mode 100644 index 5a866c119..000000000 --- a/lib/module/components/bottomSheetBackground/index.js +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './BottomSheetBackground'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackground/index.js.map b/lib/module/components/bottomSheetBackground/index.js.map deleted file mode 100644 index bf16e5cb4..000000000 --- a/lib/module/components/bottomSheetBackground/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":["default"],"mappings":"AAAA,SAASA,OAAT,QAAwB,yBAAxB","sourcesContent":["export { default } from './BottomSheetBackground';\nexport type { BottomSheetBackgroundProps } from './types';\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackground/styles.js b/lib/module/components/bottomSheetBackground/styles.js deleted file mode 100644 index 7e7784bf3..000000000 --- a/lib/module/components/bottomSheetBackground/styles.js +++ /dev/null @@ -1,8 +0,0 @@ -import { StyleSheet } from 'react-native'; -export const styles = StyleSheet.create({ - container: { - backgroundColor: 'white', - borderRadius: 15 - } -}); -//# sourceMappingURL=styles.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackground/styles.js.map b/lib/module/components/bottomSheetBackground/styles.js.map deleted file mode 100644 index 40b0e9fa0..000000000 --- a/lib/module/components/bottomSheetBackground/styles.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["styles.ts"],"names":["StyleSheet","styles","create","container","backgroundColor","borderRadius"],"mappings":"AAAA,SAASA,UAAT,QAA2B,cAA3B;AAEA,OAAO,MAAMC,MAAM,GAAGD,UAAU,CAACE,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE;AACTC,IAAAA,eAAe,EAAE,OADR;AAETC,IAAAA,YAAY,EAAE;AAFL;AAD2B,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\n\nexport const styles = StyleSheet.create({\n container: {\n backgroundColor: 'white',\n borderRadius: 15,\n },\n});\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.js b/lib/module/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.js deleted file mode 100644 index c8b735d32..000000000 --- a/lib/module/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.js +++ /dev/null @@ -1,25 +0,0 @@ -import React, { memo, useMemo } from 'react'; -import BottomSheetBackground from '../bottomSheetBackground'; -import { styles } from './styles'; -import { StyleSheet } from 'react-native'; - -const BottomSheetBackgroundContainerComponent = ({ - animatedIndex, - animatedPosition, - backgroundComponent: _providedBackgroundComponent, - backgroundStyle: _providedBackgroundStyle -}) => { - const BackgroundComponent = _providedBackgroundComponent || BottomSheetBackground; - const backgroundStyle = useMemo(() => StyleSheet.flatten([styles.container, _providedBackgroundStyle]), [_providedBackgroundStyle]); - return _providedBackgroundComponent === null ? null : /*#__PURE__*/React.createElement(BackgroundComponent, { - pointerEvents: "none", - animatedIndex: animatedIndex, - animatedPosition: animatedPosition, - style: backgroundStyle - }); -}; - -const BottomSheetBackgroundContainer = /*#__PURE__*/memo(BottomSheetBackgroundContainerComponent); -BottomSheetBackgroundContainer.displayName = 'BottomSheetBackgroundContainer'; -export default BottomSheetBackgroundContainer; -//# sourceMappingURL=BottomSheetBackgroundContainer.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.js.map b/lib/module/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.js.map deleted file mode 100644 index 66c660e8e..000000000 --- a/lib/module/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheetBackgroundContainer.tsx"],"names":["React","memo","useMemo","BottomSheetBackground","styles","StyleSheet","BottomSheetBackgroundContainerComponent","animatedIndex","animatedPosition","backgroundComponent","_providedBackgroundComponent","backgroundStyle","_providedBackgroundStyle","BackgroundComponent","flatten","container","BottomSheetBackgroundContainer","displayName"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,IAAhB,EAAsBC,OAAtB,QAAqC,OAArC;AACA,OAAOC,qBAAP,MAAkC,0BAAlC;AAEA,SAASC,MAAT,QAAuB,UAAvB;AACA,SAASC,UAAT,QAA2B,cAA3B;;AAEA,MAAMC,uCAAuC,GAAG,CAAC;AAC/CC,EAAAA,aAD+C;AAE/CC,EAAAA,gBAF+C;AAG/CC,EAAAA,mBAAmB,EAAEC,4BAH0B;AAI/CC,EAAAA,eAAe,EAAEC;AAJ8B,CAAD,KAKL;AACzC,QAAMC,mBAAmB,GACvBH,4BAA4B,IAAIP,qBADlC;AAGA,QAAMQ,eAAe,GAAGT,OAAO,CAC7B,MAAMG,UAAU,CAACS,OAAX,CAAmB,CAACV,MAAM,CAACW,SAAR,EAAmBH,wBAAnB,CAAnB,CADuB,EAE7B,CAACA,wBAAD,CAF6B,CAA/B;AAKA,SAAOF,4BAA4B,KAAK,IAAjC,GAAwC,IAAxC,gBACL,oBAAC,mBAAD;AACE,IAAA,aAAa,EAAC,MADhB;AAEE,IAAA,aAAa,EAAEH,aAFjB;AAGE,IAAA,gBAAgB,EAAEC,gBAHpB;AAIE,IAAA,KAAK,EAAEG;AAJT,IADF;AAQD,CAtBD;;AAwBA,MAAMK,8BAA8B,gBAAGf,IAAI,CACzCK,uCADyC,CAA3C;AAGAU,8BAA8B,CAACC,WAA/B,GAA6C,gCAA7C;AAEA,eAAeD,8BAAf","sourcesContent":["import React, { memo, useMemo } from 'react';\nimport BottomSheetBackground from '../bottomSheetBackground';\nimport type { BottomSheetBackgroundContainerProps } from './types';\nimport { styles } from './styles';\nimport { StyleSheet } from 'react-native';\n\nconst BottomSheetBackgroundContainerComponent = ({\n animatedIndex,\n animatedPosition,\n backgroundComponent: _providedBackgroundComponent,\n backgroundStyle: _providedBackgroundStyle,\n}: BottomSheetBackgroundContainerProps) => {\n const BackgroundComponent =\n _providedBackgroundComponent || BottomSheetBackground;\n\n const backgroundStyle = useMemo(\n () => StyleSheet.flatten([styles.container, _providedBackgroundStyle]),\n [_providedBackgroundStyle]\n );\n\n return _providedBackgroundComponent === null ? null : (\n \n );\n};\n\nconst BottomSheetBackgroundContainer = memo(\n BottomSheetBackgroundContainerComponent\n);\nBottomSheetBackgroundContainer.displayName = 'BottomSheetBackgroundContainer';\n\nexport default BottomSheetBackgroundContainer;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackgroundContainer/index.js b/lib/module/components/bottomSheetBackgroundContainer/index.js deleted file mode 100644 index 09628f098..000000000 --- a/lib/module/components/bottomSheetBackgroundContainer/index.js +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './BottomSheetBackgroundContainer'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackgroundContainer/index.js.map b/lib/module/components/bottomSheetBackgroundContainer/index.js.map deleted file mode 100644 index 4e9fbfa3b..000000000 --- a/lib/module/components/bottomSheetBackgroundContainer/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":["default"],"mappings":"AAAA,SAASA,OAAT,QAAwB,kCAAxB","sourcesContent":["export { default } from './BottomSheetBackgroundContainer';\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackgroundContainer/styles.js b/lib/module/components/bottomSheetBackgroundContainer/styles.js deleted file mode 100644 index 2cdb32548..000000000 --- a/lib/module/components/bottomSheetBackgroundContainer/styles.js +++ /dev/null @@ -1,11 +0,0 @@ -import { StyleSheet } from 'react-native'; -export const styles = StyleSheet.create({ - container: { - position: 'absolute', - top: 0, - left: 0, - right: 0, - bottom: 0 - } -}); -//# sourceMappingURL=styles.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetBackgroundContainer/styles.js.map b/lib/module/components/bottomSheetBackgroundContainer/styles.js.map deleted file mode 100644 index 633c8bcfc..000000000 --- a/lib/module/components/bottomSheetBackgroundContainer/styles.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["styles.ts"],"names":["StyleSheet","styles","create","container","position","top","left","right","bottom"],"mappings":"AAAA,SAASA,UAAT,QAA2B,cAA3B;AAEA,OAAO,MAAMC,MAAM,GAAGD,UAAU,CAACE,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE;AACTC,IAAAA,QAAQ,EAAE,UADD;AAETC,IAAAA,GAAG,EAAE,CAFI;AAGTC,IAAAA,IAAI,EAAE,CAHG;AAITC,IAAAA,KAAK,EAAE,CAJE;AAKTC,IAAAA,MAAM,EAAE;AALC;AAD2B,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\n\nexport const styles = StyleSheet.create({\n container: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n },\n});\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetContainer/BottomSheetContainer.js b/lib/module/components/bottomSheetContainer/BottomSheetContainer.js deleted file mode 100644 index d1a5c5192..000000000 --- a/lib/module/components/bottomSheetContainer/BottomSheetContainer.js +++ /dev/null @@ -1,69 +0,0 @@ -import React, { memo, useCallback, useMemo, useRef } from 'react'; -import { StatusBar, View } from 'react-native'; -import { WINDOW_HEIGHT } from '../../constants'; -import { print } from '../../utilities'; -import { styles } from './styles'; - -function BottomSheetContainerComponent({ - containerHeight, - containerOffset, - topInset = 0, - bottomInset = 0, - shouldCalculateHeight = true, - detached, - style, - children -}) { - const containerRef = useRef(null); //#region styles - - const containerStyle = useMemo(() => [style, styles.container, { - top: topInset, - bottom: bottomInset, - overflow: detached ? 'visible' : 'hidden' - }], [style, detached, topInset, bottomInset]); //#endregion - //#region callbacks - - const handleContainerLayout = useCallback(function handleContainerLayout({ - nativeEvent: { - layout: { - height - } - } - }) { - var _containerRef$current; - - containerHeight.value = height; - (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.measure((_x, _y, _width, _height, _pageX, pageY) => { - var _StatusBar$currentHei; - - if (!containerOffset.value) return; - containerOffset.value = { - top: pageY !== null && pageY !== void 0 ? pageY : 0, - left: 0, - right: 0, - bottom: Math.max(0, WINDOW_HEIGHT - ((pageY !== null && pageY !== void 0 ? pageY : 0) + height + ((_StatusBar$currentHei = StatusBar.currentHeight) !== null && _StatusBar$currentHei !== void 0 ? _StatusBar$currentHei : 0))) - }; - }); - print({ - component: BottomSheetContainer.displayName, - method: 'handleContainerLayout', - params: { - height - } - }); - }, [containerHeight, containerOffset, containerRef]); //#endregion - //#region render - - return /*#__PURE__*/React.createElement(View, { - ref: containerRef, - pointerEvents: "box-none", - onLayout: shouldCalculateHeight ? handleContainerLayout : undefined, - style: containerStyle, - children: children - }); //#endregion -} - -const BottomSheetContainer = /*#__PURE__*/memo(BottomSheetContainerComponent); -BottomSheetContainer.displayName = 'BottomSheetContainer'; -export default BottomSheetContainer; -//# sourceMappingURL=BottomSheetContainer.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetContainer/BottomSheetContainer.js.map b/lib/module/components/bottomSheetContainer/BottomSheetContainer.js.map deleted file mode 100644 index 6aa524cc8..000000000 --- a/lib/module/components/bottomSheetContainer/BottomSheetContainer.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheetContainer.tsx"],"names":["React","memo","useCallback","useMemo","useRef","StatusBar","View","WINDOW_HEIGHT","print","styles","BottomSheetContainerComponent","containerHeight","containerOffset","topInset","bottomInset","shouldCalculateHeight","detached","style","children","containerRef","containerStyle","container","top","bottom","overflow","handleContainerLayout","nativeEvent","layout","height","value","current","measure","_x","_y","_width","_height","_pageX","pageY","left","right","Math","max","currentHeight","component","BottomSheetContainer","displayName","method","params","undefined"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,IAAhB,EAAsBC,WAAtB,EAAmCC,OAAnC,EAA4CC,MAA5C,QAA0D,OAA1D;AACA,SAEEC,SAFF,EAIEC,IAJF,QAMO,cANP;AAOA,SAASC,aAAT,QAA8B,iBAA9B;AACA,SAASC,KAAT,QAAsB,iBAAtB;AACA,SAASC,MAAT,QAAuB,UAAvB;;AAGA,SAASC,6BAAT,CAAuC;AACrCC,EAAAA,eADqC;AAErCC,EAAAA,eAFqC;AAGrCC,EAAAA,QAAQ,GAAG,CAH0B;AAIrCC,EAAAA,WAAW,GAAG,CAJuB;AAKrCC,EAAAA,qBAAqB,GAAG,IALa;AAMrCC,EAAAA,QANqC;AAOrCC,EAAAA,KAPqC;AAQrCC,EAAAA;AARqC,CAAvC,EAS8B;AAC5B,QAAMC,YAAY,GAAGf,MAAM,CAAO,IAAP,CAA3B,CAD4B,CAE5B;;AACA,QAAMgB,cAAc,GAAGjB,OAAO,CAC5B,MAAM,CACJc,KADI,EAEJR,MAAM,CAACY,SAFH,EAGJ;AACEC,IAAAA,GAAG,EAAET,QADP;AAEEU,IAAAA,MAAM,EAAET,WAFV;AAGEU,IAAAA,QAAQ,EAAER,QAAQ,GAAG,SAAH,GAAe;AAHnC,GAHI,CADsB,EAU5B,CAACC,KAAD,EAAQD,QAAR,EAAkBH,QAAlB,EAA4BC,WAA5B,CAV4B,CAA9B,CAH4B,CAe5B;AAEA;;AACA,QAAMW,qBAAqB,GAAGvB,WAAW,CACvC,SAASuB,qBAAT,CAA+B;AAC7BC,IAAAA,WAAW,EAAE;AACXC,MAAAA,MAAM,EAAE;AAAEC,QAAAA;AAAF;AADG;AADgB,GAA/B,EAIsB;AAAA;;AACpBjB,IAAAA,eAAe,CAACkB,KAAhB,G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ArB,GAAmC,sBAAnC;AAEA,eAAeD,oBAAf","sourcesContent":["import React, { memo, useCallback, useMemo, useRef } from 'react';\nimport {\n LayoutChangeEvent,\n StatusBar,\n StyleProp,\n View,\n ViewStyle,\n} from 'react-native';\nimport { WINDOW_HEIGHT } from '../../constants';\nimport { print } from '../../utilities';\nimport { styles } from './styles';\nimport type { BottomSheetContainerProps } from './types';\n\nfunction BottomSheetContainerComponent({\n containerHeight,\n containerOffset,\n topInset = 0,\n bottomInset = 0,\n shouldCalculateHeight = true,\n detached,\n style,\n children,\n}: BottomSheetContainerProps) {\n const containerRef = useRef(null);\n //#region styles\n const containerStyle = useMemo>(\n () => [\n style,\n styles.container,\n {\n top: topInset,\n bottom: bottomInset,\n overflow: detached ? 'visible' : 'hidden',\n },\n ],\n [style, detached, topInset, bottomInset]\n );\n //#endregion\n\n //#region callbacks\n const handleContainerLayout = useCallback(\n function handleContainerLayout({\n nativeEvent: {\n layout: { height },\n },\n }: LayoutChangeEvent) {\n containerHeight.value = height;\n\n containerRef.current?.measure(\n (_x, _y, _width, _height, _pageX, pageY) => {\n if (!containerOffset.value) return;\n containerOffset.value = {\n top: pageY ?? 0,\n left: 0,\n right: 0,\n bottom: Math.max(\n 0,\n WINDOW_HEIGHT -\n ((pageY ?? 0) + height + (StatusBar.currentHeight ?? 0))\n ),\n };\n }\n );\n\n print({\n component: BottomSheetContainer.displayName,\n method: 'handleContainerLayout',\n params: {\n height,\n },\n });\n },\n [containerHeight, containerOffset, containerRef]\n );\n //#endregion\n\n //#region render\n return (\n \n );\n //#endregion\n}\n\nconst BottomSheetContainer = memo(BottomSheetContainerComponent);\nBottomSheetContainer.displayName = 'BottomSheetContainer';\n\nexport default BottomSheetContainer;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetContainer/index.js b/lib/module/components/bottomSheetContainer/index.js deleted file mode 100644 index 42198190e..000000000 --- a/lib/module/components/bottomSheetContainer/index.js +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './BottomSheetContainer'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetContainer/index.js.map b/lib/module/components/bottomSheetContainer/index.js.map deleted file mode 100644 index 8250bcb0d..000000000 --- a/lib/module/components/bottomSheetContainer/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":["default"],"mappings":"AAAA,SAASA,OAAT,QAAwB,wBAAxB","sourcesContent":["export { default } from './BottomSheetContainer';\nexport type { BottomSheetContainerProps } from './types';\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetContainer/styles.js b/lib/module/components/bottomSheetContainer/styles.js deleted file mode 100644 index e2b0343da..000000000 --- a/lib/module/components/bottomSheetContainer/styles.js +++ /dev/null @@ -1,6 +0,0 @@ -import { StyleSheet } from 'react-native'; -export const styles = StyleSheet.create({ - container: { ...StyleSheet.absoluteFillObject - } -}); -//# sourceMappingURL=styles.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetContainer/styles.js.map b/lib/module/components/bottomSheetContainer/styles.js.map deleted file mode 100644 index a3d759720..000000000 --- a/lib/module/components/bottomSheetContainer/styles.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["styles.ts"],"names":["StyleSheet","styles","create","container","absoluteFillObject"],"mappings":"AAAA,SAASA,UAAT,QAA2B,cAA3B;AAEA,OAAO,MAAMC,MAAM,GAAGD,UAAU,CAACE,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE,EACT,GAAGH,UAAU,CAACI;AADL;AAD2B,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\n\nexport const styles = StyleSheet.create({\n container: {\n ...StyleSheet.absoluteFillObject,\n },\n});\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetContainer/styles.web.js b/lib/module/components/bottomSheetContainer/styles.web.js deleted file mode 100644 index 7ea3f46e4..000000000 --- a/lib/module/components/bottomSheetContainer/styles.web.js +++ /dev/null @@ -1,12 +0,0 @@ -import { StyleSheet } from 'react-native'; -export const styles = StyleSheet.create({ - container: { - // @ts-ignore - position: 'fixed', - left: 0, - right: 0, - bottom: 0, - top: 0 - } -}); -//# sourceMappingURL=styles.web.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetContainer/styles.web.js.map b/lib/module/components/bottomSheetContainer/styles.web.js.map deleted file mode 100644 index a1ca0fd87..000000000 --- a/lib/module/components/bottomSheetContainer/styles.web.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["styles.web.ts"],"names":["StyleSheet","styles","create","container","position","left","right","bottom","top"],"mappings":"AAAA,SAASA,UAAT,QAA2B,cAA3B;AAEA,OAAO,MAAMC,MAAM,GAAGD,UAAU,CAACE,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE;AACT;AACAC,IAAAA,QAAQ,EAAE,OAFD;AAGTC,IAAAA,IAAI,EAAE,CAHG;AAITC,IAAAA,KAAK,EAAE,CAJE;AAKTC,IAAAA,MAAM,EAAE,CALC;AAMTC,IAAAA,GAAG,EAAE;AANI;AAD2B,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\n\nexport const styles = StyleSheet.create({\n container: {\n // @ts-ignore\n position: 'fixed',\n left: 0,\n right: 0,\n bottom: 0,\n top: 0,\n },\n});\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetDraggableView/BottomSheetDraggableView.js b/lib/module/components/bottomSheetDraggableView/BottomSheetDraggableView.js deleted file mode 100644 index 179c135d5..000000000 --- a/lib/module/components/bottomSheetDraggableView/BottomSheetDraggableView.js +++ /dev/null @@ -1,76 +0,0 @@ -function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } - -import React, { useMemo, useRef, memo } from 'react'; -import Animated from 'react-native-reanimated'; -import { PanGestureHandler } from 'react-native-gesture-handler'; -import { useBottomSheetGestureHandlers, useBottomSheetInternal } from '../../hooks'; -import { GESTURE_SOURCE } from '../../constants'; - -const BottomSheetDraggableViewComponent = ({ - gestureType = GESTURE_SOURCE.CONTENT, - nativeGestureRef, - refreshControlGestureRef, - style, - children, - ...rest -}) => { - //#region hooks - const { - enableContentPanningGesture, - simultaneousHandlers: _providedSimultaneousHandlers, - waitFor, - activeOffsetX, - activeOffsetY, - failOffsetX, - failOffsetY - } = useBottomSheetInternal(); - const { - contentPanGestureHandler, - scrollablePanGestureHandler - } = useBottomSheetGestureHandlers(); //#endregion - //#region variables - - const panGestureRef = useRef(null); - const gestureHandler = useMemo(() => gestureType === GESTURE_SOURCE.CONTENT ? contentPanGestureHandler : scrollablePanGestureHandler, [gestureType, contentPanGestureHandler, scrollablePanGestureHandler]); - const simultaneousHandlers = useMemo(() => { - const refs = []; - - if (nativeGestureRef) { - refs.push(nativeGestureRef); - } - - if (refreshControlGestureRef) { - refs.push(refreshControlGestureRef); - } - - if (_providedSimultaneousHandlers) { - if (Array.isArray(_providedSimultaneousHandlers)) { - refs.push(..._providedSimultaneousHandlers); - } else { - refs.push(_providedSimultaneousHandlers); - } - } - - return refs; - }, [_providedSimultaneousHandlers, nativeGestureRef, refreshControlGestureRef]); //#endregion - - return /*#__PURE__*/React.createElement(PanGestureHandler, { - ref: panGestureRef, - enabled: enableContentPanningGesture, - simultaneousHandlers: simultaneousHandlers, - shouldCancelWhenOutside: false, - waitFor: waitFor, - onGestureEvent: gestureHandler, - activeOffsetX: activeOffsetX, - activeOffsetY: activeOffsetY, - failOffsetX: failOffsetX, - failOffsetY: failOffsetY - }, /*#__PURE__*/React.createElement(Animated.View, _extends({ - style: style - }, rest), children)); -}; - -const BottomSheetDraggableView = /*#__PURE__*/memo(BottomSheetDraggableViewComponent); -BottomSheetDraggableView.displayName = 'BottomSheetDraggableView'; -export default BottomSheetDraggableView; -//# sourceMappingURL=BottomSheetDraggableView.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetDraggableView/BottomSheetDraggableView.js.map b/lib/module/components/bottomSheetDraggableView/BottomSheetDraggableView.js.map deleted file mode 100644 index 1954fb0f9..000000000 --- a/lib/module/components/bottomSheetDraggableView/BottomSheetDraggableView.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheetDraggableView.tsx"],"names":["React","useMemo","useRef","memo","Animated","PanGestureHandler","useBottomSheetGestureHandlers","useBottomSheetInternal","GESTURE_SOURCE","BottomSheetDraggableViewComponent","gestureType","CONTENT","nativeGestureRef","refreshControlGestureRef","style","children","rest","enableContentPanningGesture","simultaneousHandlers","_providedSimultaneousHandlers","waitFor","activeOffsetX","activeOffsetY","failOffsetX","failOffsetY","contentPanGestureHandler","scrollablePanGestureHandler","panGestureRef","gestureHandler","refs","push","Array","isArray","BottomSheetDraggableView","displayName"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,OAAhB,EAAyBC,MAAzB,EAAiCC,IAAjC,QAA6C,OAA7C;AACA,OAAOC,QAAP,MAAqB,yBAArB;AACA,SAASC,iBAAT,QAAkC,8BAAlC;AACA,SACEC,6BADF,EAEEC,sBAFF,QAGO,aAHP;AAIA,SAASC,cAAT,QAA+B,iBAA/B;;AAGA,MAAMC,iCAAiC,GAAG,CAAC;AACzCC,EAAAA,WAAW,GAAGF,cAAc,CAACG,OADY;AAEzCC,EAAAA,gBAFyC;AAGzCC,EAAAA,wBAHyC;AAIzCC,EAAAA,KAJyC;AAKzCC,EAAAA,QALyC;AAMzC,KAAGC;AANsC,CAAD,KAOL;AACnC;AACA,QAAM;AACJC,IAAAA,2BADI;AAEJC,IAAAA,oBAAoB,EAAEC,6BAFlB;AAGJC,IAAAA,OAHI;AAIJC,IAAAA,aAJI;AAKJC,IAAAA,aALI;AAMJC,IAAAA,WANI;AAOJC,IAAAA;AAPI,MAQFjB,sBAAsB,EAR1B;AASA,QAAM;AAAEkB,IAAAA,wBAAF;AAA4BC,IAAAA;AAA5B,MACJpB,6BAA6B,EAD/B,CAXmC,CAan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AjC,GACGD,QADH,CAZF,CADF;AAkBD,CA5ED;;AA8EA,MAAMkB,wBAAwB,gBAAG9B,IAAI,CAACM,iCAAD,CAArC;AACAwB,wBAAwB,CAACC,WAAzB,GAAuC,0BAAvC;AAEA,eAAeD,wBAAf","sourcesContent":["import React, { useMemo, useRef, memo } from 'react';\nimport Animated from 'react-native-reanimated';\nimport { PanGestureHandler } from 'react-native-gesture-handler';\nimport {\n useBottomSheetGestureHandlers,\n useBottomSheetInternal,\n} from '../../hooks';\nimport { GESTURE_SOURCE } from '../../constants';\nimport type { BottomSheetDraggableViewProps } from './types';\n\nconst BottomSheetDraggableViewComponent = ({\n gestureType = GESTURE_SOURCE.CONTENT,\n nativeGestureRef,\n refreshControlGestureRef,\n style,\n children,\n ...rest\n}: BottomSheetDraggableViewProps) => {\n //#region hooks\n const {\n enableContentPanningGesture,\n simultaneousHandlers: _providedSimultaneousHandlers,\n waitFor,\n activeOffsetX,\n activeOffsetY,\n failOffsetX,\n failOffsetY,\n } = useBottomSheetInternal();\n const { contentPanGestureHandler, scrollablePanGestureHandler } =\n useBottomSheetGestureHandlers();\n //#endregion\n\n //#region variables\n const panGestureRef = useRef(null);\n const gestureHandler = useMemo(\n () =>\n gestureType === GESTURE_SOURCE.CONTENT\n ? contentPanGestureHandler\n : scrollablePanGestureHandler,\n [gestureType, contentPanGestureHandler, scrollablePanGestureHandler]\n );\n const simultaneousHandlers = useMemo(() => {\n const refs = [];\n\n if (nativeGestureRef) {\n refs.push(nativeGestureRef);\n }\n\n if (refreshControlGestureRef) {\n refs.push(refreshControlGestureRef);\n }\n\n if (_providedSimultaneousHandlers) {\n if (Array.isArray(_providedSimultaneousHandlers)) {\n refs.push(..._providedSimultaneousHandlers);\n } else {\n refs.push(_providedSimultaneousHandlers);\n }\n }\n\n return refs;\n }, [\n _providedSimultaneousHandlers,\n nativeGestureRef,\n refreshControlGestureRef,\n ]);\n //#endregion\n\n return (\n \n \n {children}\n \n \n );\n};\n\nconst BottomSheetDraggableView = memo(BottomSheetDraggableViewComponent);\nBottomSheetDraggableView.displayName = 'BottomSheetDraggableView';\n\nexport default BottomSheetDraggableView;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetDraggableView/index.js b/lib/module/components/bottomSheetDraggableView/index.js deleted file mode 100644 index 712845034..000000000 --- a/lib/module/components/bottomSheetDraggableView/index.js +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './BottomSheetDraggableView'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetDraggableView/index.js.map b/lib/module/components/bottomSheetDraggableView/index.js.map deleted file mode 100644 index f43b956e1..000000000 --- a/lib/module/components/bottomSheetDraggableView/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":["default"],"mappings":"AAAA,SAASA,OAAT,QAAwB,4BAAxB","sourcesContent":["export { default } from './BottomSheetDraggableView';\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetFooter/BottomSheetFooter.js b/lib/module/components/bottomSheetFooter/BottomSheetFooter.js deleted file mode 100644 index 195fe1e93..000000000 --- a/lib/module/components/bottomSheetFooter/BottomSheetFooter.js +++ /dev/null @@ -1,59 +0,0 @@ -import React, { memo, useCallback, useMemo } from 'react'; -import Animated, { useAnimatedStyle } from 'react-native-reanimated'; -import { KEYBOARD_STATE } from '../../constants'; -import { useBottomSheetInternal } from '../../hooks'; -import { styles } from './styles'; - -function BottomSheetFooterComponent({ - animatedFooterPosition, - bottomInset = 0, - style, - children -}) { - //#region hooks - const { - animatedFooterHeight, - animatedKeyboardState - } = useBottomSheetInternal(); //#endregion - //#region styles - - const containerAnimatedStyle = useAnimatedStyle(() => { - let footerTranslateY = animatedFooterPosition.value; - /** - * Offset the bottom inset only when keyboard is not shown - */ - - if (animatedKeyboardState.value !== KEYBOARD_STATE.SHOWN) { - footerTranslateY = footerTranslateY - bottomInset; - } - - return { - transform: [{ - translateY: Math.max(0, footerTranslateY) - }] - }; - }, [bottomInset, animatedKeyboardState, animatedFooterPosition]); - const containerStyle = useMemo(() => [styles.container, style, containerAnimatedStyle], [style, containerAnimatedStyle]); //#endregion - //#region callbacks - - const handleContainerLayout = useCallback(({ - nativeEvent: { - layout: { - height - } - } - }) => { - animatedFooterHeight.value = height; - }, [animatedFooterHeight]); //#endregion - - return children !== null ? /*#__PURE__*/React.createElement(Animated.View, { - pointerEvents: "box-none", - onLayout: handleContainerLayout, - style: containerStyle - }, typeof children === 'function' ? children() : children) : null; -} - -const BottomSheetFooter = /*#__PURE__*/memo(BottomSheetFooterComponent); -BottomSheetFooter.displayName = 'BottomSheetFooter'; -export default BottomSheetFooter; -//# sourceMappingURL=BottomSheetFooter.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetFooter/BottomSheetFooter.js.map b/lib/module/components/bottomSheetFooter/BottomSheetFooter.js.map deleted file mode 100644 index bd151fde1..000000000 --- a/lib/module/components/bottomSheetFooter/BottomSheetFooter.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheetFooter.tsx"],"names":["React","memo","useCallback","useMemo","Animated","useAnimatedStyle","KEYBOARD_STATE","useBottomSheetInternal","styles","BottomSheetFooterComponent","animatedFooterPosition","bottomInset","style","children","animatedFooterHeight","animatedKeyboardState","containerAnimatedStyle","footerTranslateY","value","SHOWN","transform","translateY","Math","max","containerStyle","container","handleContainerLayout","nativeEvent","layout","height","BottomSheetFooter","displayName"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,IAAhB,EAAsBC,WAAtB,EAAmCC,OAAnC,QAAkD,OAAlD;AAEA,OAAOC,QAAP,IAAmBC,gBAAnB,QAA2C,yBAA3C;AACA,SAASC,cAAT,QAA+B,iBAA/B;AACA,SAASC,sBAAT,QAAuC,aAAvC;AAEA,SAASC,MAAT,QAAuB,UAAvB;;AAEA,SAASC,0BAAT,CAAoC;AAClCC,EAAAA,sBADkC;AAElCC,EAAAA,WAAW,GAAG,CAFoB;AAGlCC,EAAAA,KAHkC;A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GAAiCA,QAAQ,EAAzC,GAA8CA,QALjD,CADK,GAQH,IARJ;AASD;;AAED,MAAMiB,iBAAiB,gBAAG7B,IAAI,CAACQ,0BAAD,CAA9B;AACAqB,iBAAiB,CAACC,WAAlB,GAAgC,mBAAhC;AAEA,eAAeD,iBAAf","sourcesContent":["import React, { memo, useCallback, useMemo } from 'react';\nimport { LayoutChangeEvent } from 'react-native';\nimport Animated, { useAnimatedStyle } from 'react-native-reanimated';\nimport { KEYBOARD_STATE } from '../../constants';\nimport { useBottomSheetInternal } from '../../hooks';\nimport type { BottomSheetDefaultFooterProps } from './types';\nimport { styles } from './styles';\n\nfunction BottomSheetFooterComponent({\n animatedFooterPosition,\n bottomInset = 0,\n style,\n children,\n}: BottomSheetDefaultFooterProps) {\n //#region hooks\n const { animatedFooterHeight, animatedKeyboardState } =\n useBottomSheetInternal();\n //#endregion\n\n //#region styles\n const containerAnimatedStyle = useAnimatedStyle(() => {\n let footerTranslateY = animatedFooterPosition.value;\n\n /**\n * Offset the bottom inset only when keyboard is not shown\n */\n if (animatedKeyboardState.value !== KEYBOARD_STATE.SHOWN) {\n footerTranslateY = footerTranslateY - bottomInset;\n }\n\n return {\n transform: [\n {\n translateY: Math.max(0, footerTranslateY),\n },\n ],\n };\n }, [bottomInset, animatedKeyboardState, animatedFooterPosition]);\n const containerStyle = useMemo(\n () => [styles.container, style, containerAnimatedStyle],\n [style, containerAnimatedStyle]\n );\n //#endregion\n\n //#region callbacks\n const handleContainerLayout = useCallback(\n ({\n nativeEvent: {\n layout: { height },\n },\n }: LayoutChangeEvent) => {\n animatedFooterHeight.value = height;\n },\n [animatedFooterHeight]\n );\n //#endregion\n\n return children !== null ? (\n \n {typeof children === 'function' ? children() : children}\n \n ) : null;\n}\n\nconst BottomSheetFooter = memo(BottomSheetFooterComponent);\nBottomSheetFooter.displayName = 'BottomSheetFooter';\n\nexport default BottomSheetFooter;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetFooter/index.js b/lib/module/components/bottomSheetFooter/index.js deleted file mode 100644 index 46c501568..000000000 --- a/lib/module/components/bottomSheetFooter/index.js +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './BottomSheetFooter'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetFooter/index.js.map b/lib/module/components/bottomSheetFooter/index.js.map deleted file mode 100644 index a7d9ec329..000000000 --- a/lib/module/components/bottomSheetFooter/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":["default"],"mappings":"AAAA,SAASA,OAAT,QAAwB,qBAAxB","sourcesContent":["export { default } from './BottomSheetFooter';\nexport type { BottomSheetFooterProps } from './types';\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetFooter/styles.js b/lib/module/components/bottomSheetFooter/styles.js deleted file mode 100644 index 452741c55..000000000 --- a/lib/module/components/bottomSheetFooter/styles.js +++ /dev/null @@ -1,11 +0,0 @@ -import { StyleSheet } from 'react-native'; -export const styles = StyleSheet.create({ - container: { - position: 'absolute', - top: 0, - left: 0, - right: 0, - zIndex: 9999 - } -}); -//# sourceMappingURL=styles.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetFooter/styles.js.map b/lib/module/components/bottomSheetFooter/styles.js.map deleted file mode 100644 index 7c6f8adde..000000000 --- a/lib/module/components/bottomSheetFooter/styles.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["styles.ts"],"names":["StyleSheet","styles","create","container","position","top","left","right","zIndex"],"mappings":"AAAA,SAASA,UAAT,QAA2B,cAA3B;AAEA,OAAO,MAAMC,MAAM,GAAGD,UAAU,CAACE,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE;AACTC,IAAAA,QAAQ,EAAE,UADD;AAETC,IAAAA,GAAG,EAAE,CAFI;AAGTC,IAAAA,IAAI,EAAE,CAHG;AAITC,IAAAA,KAAK,EAAE,CAJE;AAKTC,IAAAA,MAAM,EAAE;AALC;AAD2B,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\n\nexport const styles = StyleSheet.create({\n container: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n zIndex: 9999,\n },\n});\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetFooterContainer/BottomSheetFooterContainer.js b/lib/module/components/bottomSheetFooterContainer/BottomSheetFooterContainer.js deleted file mode 100644 index ffb9461fa..000000000 --- a/lib/module/components/bottomSheetFooterContainer/BottomSheetFooterContainer.js +++ /dev/null @@ -1,40 +0,0 @@ -import React, { memo } from 'react'; -import { useDerivedValue } from 'react-native-reanimated'; -import { useBottomSheetInternal } from '../../hooks'; -import { KEYBOARD_STATE } from '../../constants'; - -const BottomSheetFooterContainerComponent = ({ - footerComponent: FooterComponent -}) => { - //#region hooks - const { - animatedContainerHeight, - animatedHandleHeight, - animatedFooterHeight, - animatedPosition, - animatedKeyboardState, - animatedKeyboardHeightInContainer - } = useBottomSheetInternal(); //#endregion - //#region variables - - const animatedFooterPosition = useDerivedValue(() => { - const keyboardHeight = animatedKeyboardHeightInContainer.value; - let footerTranslateY = Math.max(0, animatedContainerHeight.value - animatedPosition.value); - - if (animatedKeyboardState.value === KEYBOARD_STATE.SHOWN) { - footerTranslateY = footerTranslateY - keyboardHeight; - } - - footerTranslateY = footerTranslateY - animatedFooterHeight.value - animatedHandleHeight.value; - return footerTranslateY; - }, [animatedKeyboardHeightInContainer, animatedContainerHeight, animatedPosition, animatedKeyboardState, animatedFooterHeight, animatedHandleHeight]); //#endregion - - return /*#__PURE__*/React.createElement(FooterComponent, { - animatedFooterPosition: animatedFooterPosition - }); -}; - -const BottomSheetFooterContainer = /*#__PURE__*/memo(BottomSheetFooterContainerComponent); -BottomSheetFooterContainer.displayName = 'BottomSheetFooterContainer'; -export default BottomSheetFooterContainer; -//# sourceMappingURL=BottomSheetFooterContainer.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetFooterContainer/BottomSheetFooterContainer.js.map b/lib/module/components/bottomSheetFooterContainer/BottomSheetFooterContainer.js.map deleted file mode 100644 index d0d616cd2..000000000 --- a/lib/module/components/bottomSheetFooterContainer/BottomSheetFooterContainer.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheetFooterContainer.tsx"],"names":["React","memo","useDerivedValue","useBottomSheetInternal","KEYBOARD_STATE","BottomSheetFooterContainerComponent","footerComponent","FooterComponent","animatedContainerHeight","animatedHandleHeight","animatedFooterHeight","animatedPosition","animatedKeyboardState","animatedKeyboardHeightInContainer","animatedFooterPosition","keyboardHeight","value","footerTranslateY","Math","max","SHOWN","BottomSheetFooterContainer","displayName"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,IAAhB,QAA4B,OAA5B;AACA,SAASC,eAAT,QAAgC,yBAAhC;AACA,SAASC,sBAAT,QAAuC,aAAvC;AACA,SAASC,cAAT,QAA+B,iBAA/B;;AAGA,MAAMC,mCAAmC,GAAG,CAAC;AAC3CC,EAAAA,eAAe,EAAEC;AAD0B,CAAD,KAEL;AACrC;AACA,QAAM;AACJC,IAAAA,uBADI;AAEJC,IAAAA,oBAFI;AAGJC,IAAAA,oBAHI;AAIJC,IAAAA,gBAJI;AAKJC,IAAAA,qBALI;AAMJC,IAAAA;AANI,MAOFV,sBAAsB,EAP1B,CAFqC,CAUrC;AAEA;;AACA,QAAMW,sBAAsB,GAAGZ,eAAe,CAAC,MAAM;AACnD,UAAMa,cAAc,GAAGF,iCAAiC,CAACG,KAAzD;AACA,QAAIC,gBAAgB,GAAGC,IAAI,CAACC,GAAL,CACrB,CADqB,EAErBX,uBAAuB,CAACQ,KAAxB,GAAgCL,gBAAgB,CAACK,KAF5B,CAAvB;;AAKA,QAAIJ,qBAAqB,CAACI,KAAtB,KAAgCZ,cAAc,CAACgB,KAAnD,EAA0D;AACxDH,MAAAA,gBAAgB,GAAGA,gBAAgB,GAAGF,cAAtC;AACD;;AAEDE,IAAAA,gBAAgB,GACdA,gBAAgB,GAChBP,oBAAoB,CAACM,KADrB,GAEAP,oBAAoB,CAACO,KAHvB;AAKA,WAAOC,gBAAP;AACD,GAjB6C,EAiB3C,CACDJ,iCADC,EAEDL,uBAFC,EAGDG,gBAHC,EAIDC,qBAJC,EAKDF,oBALC,EAMDD,oBANC,CAjB2C,CAA9C,CAbqC,CAsCrC;;AAEA,sBAAO,oBAAC,eAAD;AAAiB,IAAA,sBAAsB,EAAEK;AAAzC,IAAP;AACD,CA3CD;;AA6CA,MAAMO,0BAA0B,gBAAGpB,IAAI,CAACI,mCAAD,CAAvC;AACAgB,0BAA0B,CAACC,WAA3B,GAAyC,4BAAzC;AAEA,eAAeD,0BAAf","sourcesContent":["import React, { memo } from 'react';\nimport { useDerivedValue } from 'react-native-reanimated';\nimport { useBottomSheetInternal } from '../../hooks';\nimport { KEYBOARD_STATE } from '../../constants';\nimport type { BottomSheetFooterContainerProps } from './types';\n\nconst BottomSheetFooterContainerComponent = ({\n footerComponent: FooterComponent,\n}: BottomSheetFooterContainerProps) => {\n //#region hooks\n const {\n animatedContainerHeight,\n animatedHandleHeight,\n animatedFooterHeight,\n animatedPosition,\n animatedKeyboardState,\n animatedKeyboardHeightInContainer,\n } = useBottomSheetInternal();\n //#endregion\n\n //#region variables\n const animatedFooterPosition = useDerivedValue(() => {\n const keyboardHeight = animatedKeyboardHeightInContainer.value;\n let footerTranslateY = Math.max(\n 0,\n animatedContainerHeight.value - animatedPosition.value\n );\n\n if (animatedKeyboardState.value === KEYBOARD_STATE.SHOWN) {\n footerTranslateY = footerTranslateY - keyboardHeight;\n }\n\n footerTranslateY =\n footerTranslateY -\n animatedFooterHeight.value -\n animatedHandleHeight.value;\n\n return footerTranslateY;\n }, [\n animatedKeyboardHeightInContainer,\n animatedContainerHeight,\n animatedPosition,\n animatedKeyboardState,\n animatedFooterHeight,\n animatedHandleHeight,\n ]);\n //#endregion\n\n return ;\n};\n\nconst BottomSheetFooterContainer = memo(BottomSheetFooterContainerComponent);\nBottomSheetFooterContainer.displayName = 'BottomSheetFooterContainer';\n\nexport default BottomSheetFooterContainer;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.js b/lib/module/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.js deleted file mode 100644 index adf81e285..000000000 --- a/lib/module/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.js +++ /dev/null @@ -1,44 +0,0 @@ -import React, { useMemo } from 'react'; -import { GESTURE_SOURCE } from '../../constants'; -import { useGestureHandler, useBottomSheetInternal, useGestureEventsHandlersDefault } from '../../hooks'; -import { BottomSheetGestureHandlersContext } from '../../contexts'; -import { useSharedValue } from 'react-native-reanimated'; - -const BottomSheetGestureHandlersProvider = ({ - gestureEventsHandlersHook: useGestureEventsHandlers = useGestureEventsHandlersDefault, - children -}) => { - //#region variables - const animatedGestureSource = useSharedValue(GESTURE_SOURCE.UNDETERMINED); //#endregion - //#region hooks - - const { - animatedContentGestureState, - animatedHandleGestureState - } = useBottomSheetInternal(); - const { - handleOnStart, - handleOnActive, - handleOnEnd - } = useGestureEventsHandlers(); //#endregion - //#region gestures - - const contentPanGestureHandler = useGestureHandler(GESTURE_SOURCE.CONTENT, animatedContentGestureState, animatedGestureSource, handleOnStart, handleOnActive, handleOnEnd); - const scrollablePanGestureHandler = useGestureHandler(GESTURE_SOURCE.SCROLLABLE, animatedContentGestureState, animatedGestureSource, handleOnStart, handleOnActive, handleOnEnd); - const handlePanGestureHandler = useGestureHandler(GESTURE_SOURCE.HANDLE, animatedHandleGestureState, animatedGestureSource, handleOnStart, handleOnActive, handleOnEnd); //#endregion - //#region context - - const contextValue = useMemo(() => ({ - contentPanGestureHandler, - handlePanGestureHandler, - scrollablePanGestureHandler, - animatedGestureSource - }), [contentPanGestureHandler, handlePanGestureHandler, scrollablePanGestureHandler, animatedGestureSource]); //#endregion - - return /*#__PURE__*/React.createElement(BottomSheetGestureHandlersContext.Provider, { - value: contextValue - }, children); -}; - -export default BottomSheetGestureHandlersProvider; -//# sourceMappingURL=BottomSheetGestureHandlersProvider.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.js.map b/lib/module/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.js.map deleted file mode 100644 index 58c9619a3..000000000 --- a/lib/module/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheetGestureHandlersProvider.tsx"],"names":["React","useMemo","GESTURE_SOURCE","useGestureHandler","useBottomSheetInternal","useGestureEventsHandlersDefault","BottomSheetGestureHandlersContext","useSharedValue","BottomSheetGestureHandlersProvider","gestureEventsHandlersHook","useGestureEventsHandlers","children","animatedGestureSource","UNDETERMINED","animatedContentGestureState","animatedHandleGestureState","handleOnStart","handleOnActive","handleOnEnd","contentPanGestureHandler","CONTENT","scrollablePanGestureHandler","SCROLLABLE","handlePanGestureHandler","HANDLE","contextValue"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,OAAhB,QAA+B,OAA/B;AACA,SAASC,cAAT,QAA+B,iBAA/B;AACA,SACEC,iBADF,EAEEC,sBAFF,EAGEC,+BAHF,QAIO,aAJP;AAKA,SAASC,iCAAT,QAAkD,gBAAlD;AAEA,SAASC,cAAT,QAA+B,yBAA/B;;AAEA,MAAMC,kCAAkC,GAAG,CAAC;AAC1CC,EAAAA,yBAAyB,EACvBC,wBAAwB,GAAGL,+BAFa;AAG1CM,EAAAA;AAH0C,CAAD,KAII;AAC7C;AACA,QAAMC,qBAAqB,GAAGL,cAAc,CAC1CL,cAAc,CAACW,YAD2B,CAA5C,CAF6C,CAK7C;AAEA;;AACA,QAAM;AAAEC,IAAAA,2BAAF;AAA+BC,IAAAA;AAA/B,MACJX,sBAAsB,EADxB;AAEA,QAAM;AAAEY,IAAAA,aAAF;AAAiBC,IAAAA,cAAjB;AAAiCC,IAAAA;AAAjC,MACJR,wBAAwB,EAD1B,CAV6C,CAY7C;AAEA;;AACA,QAAMS,wBAAwB,GAAGhB,iBAAiB,CAChDD,cAAc,CAACkB,OADiC,EAEhDN,2BAFgD,EAGhDF,qBAHgD,EAIhDI,aAJgD,EAKhDC,cALgD,EAMhDC,WANgD,CAAlD;AASA,QAAMG,2BAA2B,GAAGlB,iBAAiB,CACnDD,cAAc,CAACoB,UADoC,EAEnDR,2BAFmD,EAGnDF,qBAHmD,EAInDI,aAJmD,EAKnDC,cALmD,EAMnDC,WANmD,CAArD;AASA,QAAMK,uBAAuB,GAAGpB,iBAAiB,CAC/CD,cAAc,CAACsB,MADgC,EAE/CT,0BAF+C,EAG/CH,qBAH+C,EAI/CI,aAJ+C,EAK/CC,cAL+C,EAM/CC,WAN+C,CAAjD,CAjC6C,CAyC7C;AAEA;;AACA,QAAMO,YAAY,GAAGxB,OAAO,CAC1B,OAAO;AACLkB,IAAAA,wBADK;AAELI,IAAAA,uBAFK;AAGLF,IAAAA,2BAHK;AAILT,IAAAA;AAJK,GAAP,CAD0B,EAO1B,CACEO,wBADF,EAEEI,uBAFF,EAGEF,2BAHF,EAIET,qBAJF,CAP0B,CAA5B,CA5C6C,CA0D7C;;AACA,sBACE,oBAAC,iCAAD,CAAmC,QAAnC;AAA4C,IAAA,KAAK,EAAEa;AAAnD,KACGd,QADH,CADF;AAKD,CApED;;AAsEA,eAAeH,kCAAf","sourcesContent":["import React, { useMemo } from 'react';\nimport { GESTURE_SOURCE } from '../../constants';\nimport {\n useGestureHandler,\n useBottomSheetInternal,\n useGestureEventsHandlersDefault,\n} from '../../hooks';\nimport { BottomSheetGestureHandlersContext } from '../../contexts';\nimport type { BottomSheetGestureHandlersProviderProps } from './types';\nimport { useSharedValue } from 'react-native-reanimated';\n\nconst BottomSheetGestureHandlersProvider = ({\n gestureEventsHandlersHook:\n useGestureEventsHandlers = useGestureEventsHandlersDefault,\n children,\n}: BottomSheetGestureHandlersProviderProps) => {\n //#region variables\n const animatedGestureSource = useSharedValue(\n GESTURE_SOURCE.UNDETERMINED\n );\n //#endregion\n\n //#region hooks\n const { animatedContentGestureState, animatedHandleGestureState } =\n useBottomSheetInternal();\n const { handleOnStart, handleOnActive, handleOnEnd } =\n useGestureEventsHandlers();\n //#endregion\n\n //#region gestures\n const contentPanGestureHandler = useGestureHandler(\n GESTURE_SOURCE.CONTENT,\n animatedContentGestureState,\n animatedGestureSource,\n handleOnStart,\n handleOnActive,\n handleOnEnd\n );\n\n const scrollablePanGestureHandler = useGestureHandler(\n GESTURE_SOURCE.SCROLLABLE,\n animatedContentGestureState,\n animatedGestureSource,\n handleOnStart,\n handleOnActive,\n handleOnEnd\n );\n\n const handlePanGestureHandler = useGestureHandler(\n GESTURE_SOURCE.HANDLE,\n animatedHandleGestureState,\n animatedGestureSource,\n handleOnStart,\n handleOnActive,\n handleOnEnd\n );\n //#endregion\n\n //#region context\n const contextValue = useMemo(\n () => ({\n contentPanGestureHandler,\n handlePanGestureHandler,\n scrollablePanGestureHandler,\n animatedGestureSource,\n }),\n [\n contentPanGestureHandler,\n handlePanGestureHandler,\n scrollablePanGestureHandler,\n animatedGestureSource,\n ]\n );\n //#endregion\n return (\n \n {children}\n \n );\n};\n\nexport default BottomSheetGestureHandlersProvider;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetGestureHandlersProvider/index.js b/lib/module/components/bottomSheetGestureHandlersProvider/index.js deleted file mode 100644 index 9986d5a8e..000000000 --- a/lib/module/components/bottomSheetGestureHandlersProvider/index.js +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './BottomSheetGestureHandlersProvider'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetGestureHandlersProvider/index.js.map b/lib/module/components/bottomSheetGestureHandlersProvider/index.js.map deleted file mode 100644 index 695b74941..000000000 --- a/lib/module/components/bottomSheetGestureHandlersProvider/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":["default"],"mappings":"AAAA,SAASA,OAAT,QAAwB,sCAAxB","sourcesContent":["export { default } from './BottomSheetGestureHandlersProvider';\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetHandle/BottomSheetHandle.js b/lib/module/components/bottomSheetHandle/BottomSheetHandle.js deleted file mode 100644 index e62a6ee71..000000000 --- a/lib/module/components/bottomSheetHandle/BottomSheetHandle.js +++ /dev/null @@ -1,24 +0,0 @@ -import React, { memo, useMemo } from 'react'; -import Animated from 'react-native-reanimated'; -import { styles } from './styles'; - -const BottomSheetHandleComponent = ({ - style, - indicatorStyle: _indicatorStyle, - children -}) => { - // styles - const containerStyle = useMemo(() => [styles.container, ...[Array.isArray(style) ? style : [style]]], [style]); - const indicatorStyle = useMemo(() => [styles.indicator, ...[Array.isArray(_indicatorStyle) ? _indicatorStyle : [_indicatorStyle]]], [_indicatorStyle]); // render - - return /*#__PURE__*/React.createElement(Animated.View, { - style: containerStyle - }, /*#__PURE__*/React.createElement(Animated.View, { - style: indicatorStyle - }), children); -}; - -const BottomSheetHandle = /*#__PURE__*/memo(BottomSheetHandleComponent); -BottomSheetHandle.displayName = 'BottomSheetHandle'; -export default BottomSheetHandle; -//# sourceMappingURL=BottomSheetHandle.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetHandle/BottomSheetHandle.js.map b/lib/module/components/bottomSheetHandle/BottomSheetHandle.js.map deleted file mode 100644 index a25caa4f5..000000000 --- a/lib/module/components/bottomSheetHandle/BottomSheetHandle.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheetHandle.tsx"],"names":["React","memo","useMemo","Animated","styles","BottomSheetHandleComponent","style","indicatorStyle","_indicatorStyle","children","containerStyle","container","Array","isArray","indicator","BottomSheetHandle","displayName"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,IAAhB,EAAsBC,OAAtB,QAAqC,OAArC;AACA,OAAOC,QAAP,MAAqB,yBAArB;AACA,SAASC,MAAT,QAAuB,UAAvB;;AAGA,MAAMC,0BAA0B,GAAG,CAAC;AAClCC,EAAAA,KADkC;AAElCC,EAAAA,cAAc,EAAEC,eAFkB;AAGlCC,EAAAA;AAHkC,CAAD,KAIE;AACnC;AACA,QAAMC,cAAc,GAAGR,OAAO,CAC5B,MAAM,CAACE,MAAM,CAACO,SAAR,EAAmB,GAAG,CAACC,KAAK,CAACC,OAAN,CAAcP,KAAd,IAAuBA,KAAvB,GAA+B,CAACA,KAAD,CAAhC,CAAtB,CADsB,EAE5B,CAACA,KAAD,CAF4B,CAA9B;AAIA,QAAMC,cAAc,GAAGL,OAAO,CAC5B,MAAM,CACJE,MAAM,CAACU,SADH,EAEJ,GAAG,CAACF,KAAK,CAACC,OAAN,CAAcL,eAAd,IAAiCA,eAAjC,GAAmD,CAACA,eAAD,CAApD,CAFC,CADsB,EAK5B,CAACA,eAAD,CAL4B,CAA9B,CANmC,CAcnC;;AACA,sBACE,oBAAC,QAAD,CAAU,IAAV;AAAe,IAAA,KAAK,EAAEE;AAAtB,kBACE,oBAAC,QAAD,CAAU,IAAV;AAAe,IAAA,KAAK,EAAEH;AAAtB,IADF,EAEGE,QAFH,CADF;AAMD,CAzBD;;AA2BA,MAAMM,iBAAiB,gBAAGd,IAAI,CAACI,0BAAD,CAA9B;AACAU,iBAAiB,CAACC,WAAlB,GAAgC,mBAAhC;AAEA,eAAeD,iBAAf","sourcesContent":["import React, { memo, useMemo } from 'react';\nimport Animated from 'react-native-reanimated';\nimport { styles } from './styles';\nimport type { BottomSheetDefaultHandleProps } from './types';\n\nconst BottomSheetHandleComponent = ({\n style,\n indicatorStyle: _indicatorStyle,\n children,\n}: BottomSheetDefaultHandleProps) => {\n // styles\n const containerStyle = useMemo(\n () => [styles.container, ...[Array.isArray(style) ? style : [style]]],\n [style]\n );\n const indicatorStyle = useMemo(\n () => [\n styles.indicator,\n ...[Array.isArray(_indicatorStyle) ? _indicatorStyle : [_indicatorStyle]],\n ],\n [_indicatorStyle]\n );\n\n // render\n return (\n \n \n {children}\n \n );\n};\n\nconst BottomSheetHandle = memo(BottomSheetHandleComponent);\nBottomSheetHandle.displayName = 'BottomSheetHandle';\n\nexport default BottomSheetHandle;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetHandle/index.js b/lib/module/components/bottomSheetHandle/index.js deleted file mode 100644 index 02fec0d5d..000000000 --- a/lib/module/components/bottomSheetHandle/index.js +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './BottomSheetHandle'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetHandle/index.js.map b/lib/module/components/bottomSheetHandle/index.js.map deleted file mode 100644 index cb4ce2add..000000000 --- a/lib/module/components/bottomSheetHandle/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":["default"],"mappings":"AAAA,SAASA,OAAT,QAAwB,qBAAxB","sourcesContent":["export { default } from './BottomSheetHandle';\nexport type { BottomSheetHandleProps } from './types';\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetHandle/styles.js b/lib/module/components/bottomSheetHandle/styles.js deleted file mode 100644 index b699f8706..000000000 --- a/lib/module/components/bottomSheetHandle/styles.js +++ /dev/null @@ -1,15 +0,0 @@ -import { StyleSheet } from 'react-native'; -import { WINDOW_WIDTH } from '../../constants'; -export const styles = StyleSheet.create({ - container: { - padding: 10 - }, - indicator: { - alignSelf: 'center', - width: 7.5 * WINDOW_WIDTH / 100, - height: 4, - borderRadius: 4, - backgroundColor: 'rgba(0, 0, 0, 0.75)' - } -}); -//# sourceMappingURL=styles.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetHandle/styles.js.map b/lib/module/components/bottomSheetHandle/styles.js.map deleted file mode 100644 index 7c9590974..000000000 --- a/lib/module/components/bottomSheetHandle/styles.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["styles.ts"],"names":["StyleSheet","WINDOW_WIDTH","styles","create","container","padding","indicator","alignSelf","width","height","borderRadius","backgroundColor"],"mappings":"AAAA,SAASA,UAAT,QAA2B,cAA3B;AACA,SAASC,YAAT,QAA6B,iBAA7B;AAEA,OAAO,MAAMC,MAAM,GAAGF,UAAU,CAACG,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE;AACTC,IAAAA,OAAO,EAAE;AADA,GAD2B;AAKtCC,EAAAA,SAAS,EAAE;AACTC,IAAAA,SAAS,EAAE,QADF;AAETC,IAAAA,KAAK,EAAG,MAAMP,YAAP,GAAuB,GAFrB;AAGTQ,IAAAA,MAAM,EAAE,CAHC;AAITC,IAAAA,YAAY,EAAE,CAJL;AAKTC,IAAAA,eAAe,EAAE;AALR;AAL2B,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\nimport { WINDOW_WIDTH } from '../../constants';\n\nexport const styles = StyleSheet.create({\n container: {\n padding: 10,\n },\n\n indicator: {\n alignSelf: 'center',\n width: (7.5 * WINDOW_WIDTH) / 100,\n height: 4,\n borderRadius: 4,\n backgroundColor: 'rgba(0, 0, 0, 0.75)',\n },\n});\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetHandleContainer/BottomSheetHandleContainer.js b/lib/module/components/bottomSheetHandleContainer/BottomSheetHandleContainer.js deleted file mode 100644 index bd555bc7f..000000000 --- a/lib/module/components/bottomSheetHandleContainer/BottomSheetHandleContainer.js +++ /dev/null @@ -1,98 +0,0 @@ -import React, { memo, useCallback, useMemo } from 'react'; -import { PanGestureHandler } from 'react-native-gesture-handler'; -import Animated from 'react-native-reanimated'; -import BottomSheetHandle from '../bottomSheetHandle'; -import { useBottomSheetGestureHandlers, useBottomSheetInternal } from '../../hooks'; -import { print } from '../../utilities'; - -function BottomSheetHandleContainerComponent({ - animatedIndex, - animatedPosition, - simultaneousHandlers: _internalSimultaneousHandlers, - enableHandlePanningGesture, - handleHeight, - handleComponent: _providedHandleComponent, - handleStyle: _providedHandleStyle, - handleIndicatorStyle: _providedIndicatorStyle -}) { - //#region hooks - const { - activeOffsetX, - activeOffsetY, - failOffsetX, - failOffsetY, - waitFor, - simultaneousHandlers: _providedSimultaneousHandlers - } = useBottomSheetInternal(); - const { - handlePanGestureHandler - } = useBottomSheetGestureHandlers(); //#endregion - //#region variables - - const simultaneousHandlers = useMemo(() => { - const refs = []; - - if (_internalSimultaneousHandlers) { - refs.push(_internalSimultaneousHandlers); - } - - if (_providedSimultaneousHandlers) { - if (Array.isArray(_providedSimultaneousHandlers)) { - refs.push(..._providedSimultaneousHandlers); - } else { - refs.push(_providedSimultaneousHandlers); - } - } - - return refs; - }, [_providedSimultaneousHandlers, _internalSimultaneousHandlers]); //#endregion - //#region callbacks - - const handleContainerLayout = useCallback(function handleContainerLayout({ - nativeEvent: { - layout: { - height - } - } - }) { - handleHeight.value = height; - print({ - component: BottomSheetHandleContainer.displayName, - method: 'handleContainerLayout', - params: { - height - } - }); - }, [handleHeight]); //#endregion - //#region renders - - const HandleComponent = _providedHandleComponent === undefined ? BottomSheetHandle : _providedHandleComponent; - return HandleComponent !== null ? /*#__PURE__*/React.createElement(PanGestureHandler, { - enabled: enableHandlePanningGesture, - waitFor: waitFor, - simultaneousHandlers: simultaneousHandlers, - shouldCancelWhenOutside: false, - activeOffsetX: activeOffsetX, - activeOffsetY: activeOffsetY, - failOffsetX: failOffsetX, - failOffsetY: failOffsetY, - onGestureEvent: handlePanGestureHandler - }, /*#__PURE__*/React.createElement(Animated.View, { - key: "BottomSheetHandleContainer", - accessible: true, - accessibilityRole: "adjustable", - accessibilityLabel: "Bottom Sheet handle", - accessibilityHint: "Drag up or down to extend or minimize the Bottom Sheet", - onLayout: handleContainerLayout - }, /*#__PURE__*/React.createElement(HandleComponent, { - animatedIndex: animatedIndex, - animatedPosition: animatedPosition, - style: _providedHandleStyle, - indicatorStyle: _providedIndicatorStyle - }))) : null; //#endregion -} - -const BottomSheetHandleContainer = /*#__PURE__*/memo(BottomSheetHandleContainerComponent); -BottomSheetHandleContainer.displayName = 'BottomSheetHandleContainer'; -export default BottomSheetHandleContainer; -//# sourceMappingURL=BottomSheetHandleContainer.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetHandleContainer/BottomSheetHandleContainer.js.map b/lib/module/components/bottomSheetHandleContainer/BottomSheetHandleContainer.js.map deleted file mode 100644 index 6a2829365..000000000 --- a/lib/module/components/bottomSheetHandleContainer/BottomSheetHandleContainer.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheetHandleContainer.tsx"],"names":["React","memo","useCallback","useMemo","PanGestureHandler","Animated","BottomSheetHandle","useBottomSheetGestureHandlers","useBottomSheetInternal","print","BottomSheetHandleContainerComponent","animatedIndex","animatedPosition","simultaneousHandlers","_internalSimultaneousHandlers","enableHandlePanningGesture","handleHeight","handleComponent","_providedHandleComponent","handleStyle","_providedHandleStyle","handleIndicatorStyle","_providedIndicatorStyle","activeOffsetX","activeOffsetY","failOffsetX","failOffsetY","waitFor","_providedSimultaneousHandlers","handlePanGestureHandler","refs","push","Array","isArray","handleContainerLayout","nativeEvent","layout","height","value","component","BottomSheetHandleContainer","displayName","method","params","HandleComponent","undefined"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,IAAhB,EAAsBC,WAAtB,EAAmCC,OAAnC,QAAkD,OAAlD;AAEA,SAASC,iBAAT,QAAkC,8BAAlC;AACA,OAAOC,QAAP,MAAqB,yBAArB;AACA,OAAOC,iBAAP,MAA8B,sBAA9B;AACA,SACEC,6BADF,EAEEC,sBAFF,QAGO,aAHP;AAIA,SAASC,KAAT,QAAsB,iBAAtB;;AAGA,SAASC,mCAAT,CAA6C;AAC3CC,EAAAA,aAD2C;AAE3CC,EAAAA,gBAF2C;AAG3CC,EAAAA,oBAAoB,EAAEC,6BAHqB;AAI3CC,EAAAA,0BAJ2C;AAK3CC,EAAAA,YAL2C;AAM3CC,EAAAA,eAAe,EAAEC,wBAN0B;AAO3CC,EAAAA,WAAW,EAAEC,oBAP8B;AAQ3CC,EAAAA,oBAAoB,EAAEC;AARqB,CAA7C,EASoC;AAClC;AACA,QAAM;AACJC,IAAAA,aADI;AAEJC,IAAAA,aA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;AAIA,SAAO0B,eAAe,KAAK,IAApB,gBACL,oBAAC,iBAAD;AACE,IAAA,OAAO,EAAE7B,0BADX;AAEE,IAAA,OAAO,EAAEY,OAFX;AAGE,IAAA,oBAAoB,EAAEd,oBAHxB;AAIE,IAAA,uBAAuB,EAAE,KAJ3B;AAKE,IAAA,aAAa,EAAEU,aALjB;AAME,IAAA,aAAa,EAAEC,aANjB;AAOE,IAAA,WAAW,EAAEC,WAPf;AAQE,IAAA,WAAW,EAAEC,WARf;AASE,IAAA,cAAc,EAAEG;AATlB,kBAWE,oBAAC,QAAD,CAAU,IAAV;AACE,IAAA,GAAG,EAAC,4BADN;AAEE,IAAA,UAAU,EAAE,IAFd;AAGE,IAAA,iBAAiB,EAAC,YAHpB;AAIE,IAAA,kBAAkB,EAAC,qBAJrB;AAKE,IAAA,iBAAiB,EAAC,wDALpB;AAME,IAAA,QAAQ,EAAEK;AANZ,kBAQE,oBAAC,eAAD;AACE,IAAA,aAAa,EAAEvB,aADjB;AAEE,IAAA,gBAAgB,EAAEC,gBAFpB;AAGE,IAAA,KAAK,EAAEQ,oBAHT;AAIE,IAAA,cAAc,EAAEE;AAJlB,IARF,CAXF,CADK,GA4BH,IA5BJ,CA3DkC,CAwFlC;AACD;;AAED,MAAMkB,0BAA0B,gBAAGvC,IAAI,CAACS,mCAAD,CAAvC;AACA8B,0BAA0B,CAACC,WAA3B,GAAyC,4BAAzC;AAEA,eAAeD,0BAAf","sourcesContent":["import React, { memo, useCallback, useMemo } from 'react';\nimport type { LayoutChangeEvent } from 'react-native';\nimport { PanGestureHandler } from 'react-native-gesture-handler';\nimport Animated from 'react-native-reanimated';\nimport BottomSheetHandle from '../bottomSheetHandle';\nimport {\n useBottomSheetGestureHandlers,\n useBottomSheetInternal,\n} from '../../hooks';\nimport { print } from '../../utilities';\nimport type { BottomSheetHandleContainerProps } from './types';\n\nfunction BottomSheetHandleContainerComponent({\n animatedIndex,\n animatedPosition,\n simultaneousHandlers: _internalSimultaneousHandlers,\n enableHandlePanningGesture,\n handleHeight,\n handleComponent: _providedHandleComponent,\n handleStyle: _providedHandleStyle,\n handleIndicatorStyle: _providedIndicatorStyle,\n}: BottomSheetHandleContainerProps) {\n //#region hooks\n const {\n activeOffsetX,\n activeOffsetY,\n failOffsetX,\n failOffsetY,\n waitFor,\n simultaneousHandlers: _providedSimultaneousHandlers,\n } = useBottomSheetInternal();\n const { handlePanGestureHandler } = useBottomSheetGestureHandlers();\n //#endregion\n\n //#region variables\n const simultaneousHandlers = useMemo(() => {\n const refs = [];\n\n if (_internalSimultaneousHandlers) {\n refs.push(_internalSimultaneousHandlers);\n }\n\n if (_providedSimultaneousHandlers) {\n if (Array.isArray(_providedSimultaneousHandlers)) {\n refs.push(..._providedSimultaneousHandlers);\n } else {\n refs.push(_providedSimultaneousHandlers);\n }\n }\n\n return refs;\n }, [_providedSimultaneousHandlers, _internalSimultaneousHandlers]);\n //#endregion\n\n //#region callbacks\n const handleContainerLayout = useCallback(\n function handleContainerLayout({\n nativeEvent: {\n layout: { height },\n },\n }: LayoutChangeEvent) {\n handleHeight.value = height;\n\n print({\n component: BottomSheetHandleContainer.displayName,\n method: 'handleContainerLayout',\n params: {\n height,\n },\n });\n },\n [handleHeight]\n );\n //#endregion\n\n //#region renders\n const HandleComponent =\n _providedHandleComponent === undefined\n ? BottomSheetHandle\n : _providedHandleComponent;\n return HandleComponent !== null ? (\n \n \n \n \n \n ) : null;\n //#endregion\n}\n\nconst BottomSheetHandleContainer = memo(BottomSheetHandleContainerComponent);\nBottomSheetHandleContainer.displayName = 'BottomSheetHandleContainer';\n\nexport default BottomSheetHandleContainer;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetHandleContainer/index.js b/lib/module/components/bottomSheetHandleContainer/index.js deleted file mode 100644 index 32c15660e..000000000 --- a/lib/module/components/bottomSheetHandleContainer/index.js +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './BottomSheetHandleContainer'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetHandleContainer/index.js.map b/lib/module/components/bottomSheetHandleContainer/index.js.map deleted file mode 100644 index 0c9996858..000000000 --- a/lib/module/components/bottomSheetHandleContainer/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":["default"],"mappings":"AAAA,SAASA,OAAT,QAAwB,8BAAxB","sourcesContent":["export { default } from './BottomSheetHandleContainer';\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetModal/BottomSheetModal.js b/lib/module/components/bottomSheetModal/BottomSheetModal.js deleted file mode 100644 index 933f45031..000000000 --- a/lib/module/components/bottomSheetModal/BottomSheetModal.js +++ /dev/null @@ -1,363 +0,0 @@ -function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } - -import React, { forwardRef, memo, useCallback, useImperativeHandle, useMemo, useRef, useState } from 'react'; -import { Portal, usePortal } from '@gorhom/portal'; -import BottomSheet from '../bottomSheet'; -import { useBottomSheetModalInternal } from '../../hooks'; -import { print } from '../../utilities'; -import { DEFAULT_STACK_BEHAVIOR, DEFAULT_ENABLE_DISMISS_ON_CLOSE } from './constants'; -import { id } from '../../utilities/id'; -const INITIAL_STATE = { - mount: false, - data: undefined -}; -const BottomSheetModalComponent = /*#__PURE__*/forwardRef(function BottomSheetModal(props, ref) { - const { - // modal props - name, - stackBehavior = DEFAULT_STACK_BEHAVIOR, - enableDismissOnClose = DEFAULT_ENABLE_DISMISS_ON_CLOSE, - onDismiss: _providedOnDismiss, - // bottom sheet props - index = 0, - snapPoints, - enablePanDownToClose = true, - animateOnMount = true, - containerComponent: ContainerComponent = React.Fragment, - // callbacks - onChange: _providedOnChange, - // components - children: Content, - ...bottomSheetProps - } = props; //#region state - - const [{ - mount, - data - }, setState] = useState(INITIAL_STATE); //#endregion - //#region hooks - - const { - containerHeight, - containerOffset, - mountSheet, - unmountSheet, - willUnmountSheet - } = useBottomSheetModalInternal(); - const { - removePortal: unmountPortal - } = usePortal(); //#endregion - //#region refs - - const bottomSheetRef = useRef(null); - const currentIndexRef = useRef(!animateOnMount ? index : -1); - const restoreIndexRef = useRef(-1); - const minimized = useRef(false); - const forcedDismissed = useRef(false); - const mounted = useRef(false); - mounted.current = mount; //#endregion - //#region variables - - const key = useMemo(() => name || `bottom-sheet-modal-${id()}`, [name]); //#endregion - //#region private methods - - const resetVariables = useCallback(function resetVariables() { - print({ - component: BottomSheetModal.name, - method: resetVariables.name - }); - currentIndexRef.current = -1; - restoreIndexRef.current = -1; - minimized.current = false; - mounted.current = false; - forcedDismissed.current = false; - }, []); - const unmount = useCallback(function unmount() { - print({ - component: BottomSheetModal.name, - method: unmount.name - }); - const _mounted = mounted.current; // reset variables - - resetVariables(); // unmount sheet and portal - - unmountSheet(key); - unmountPortal(key); // unmount the node, if sheet is still mounted - - if (_mounted) { - setState(INITIAL_STATE); - } // fire `onDismiss` callback - - - if (_providedOnDismiss) { - _providedOnDismiss(); - } - }, [key, resetVariables, unmountSheet, unmountPortal, _providedOnDismiss]); //#endregion - //#region bottom sheet methods - - const handleSnapToIndex = useCallback((...args) => { - var _bottomSheetRef$curre; - - if (minimized.current) { - return; - } - - (_bottomSheetRef$curre = bottomSheetRef.current) === null || _bottomSheetRef$curre === void 0 ? void 0 : _bottomSheetRef$curre.snapToIndex(...args); - }, []); - const handleSnapToPosition = useCallback((...args) => { - var _bottomSheetRef$curre2; - - if (minimized.current) { - return; - } - - (_bottomSheetRef$curre2 = bottomSheetRef.current) === null || _bottomSheetRef$curre2 === void 0 ? void 0 : _bottomSheetRef$curre2.snapToPosition(...args); - }, []); - const handleExpand = useCallback((...args) => { - var _bottomSheetRef$curre3; - - if (minimized.current) { - return; - } - - (_bottomSheetRef$curre3 = bottomSheetRef.current) === null || _bottomSheetRef$curre3 === void 0 ? void 0 : _bottomSheetRef$curre3.expand(...args); - }, []); - const handleCollapse = useCallback((...args) => { - var _bottomSheetRef$curre4; - - if (minimized.current) { - return; - } - - (_bottomSheetRef$curre4 = bottomSheetRef.current) === null || _bottomSheetRef$curre4 === void 0 ? void 0 : _bottomSheetRef$curre4.collapse(...args); - }, []); - const handleClose = useCallback((...args) => { - var _bottomSheetRef$curre5; - - if (minimized.current) { - return; - } - - (_bottomSheetRef$curre5 = bottomSheetRef.current) === null || _bottomSheetRef$curre5 === void 0 ? void 0 : _bottomSheetRef$curre5.close(...args); - }, []); - const handleForceClose = useCallback((...args) => { - var _bottomSheetRef$curre6; - - if (minimized.current) { - return; - } - - (_bottomSheetRef$curre6 = bottomSheetRef.current) === null || _bottomSheetRef$curre6 === void 0 ? void 0 : _bottomSheetRef$curre6.forceClose(...args); - }, []); //#endregion - //#region bottom sheet modal methods - - const handlePresent = useCallback(function handlePresent(_data) { - requestAnimationFrame(() => { - setState({ - mount: true, - data: _data - }); - mountSheet(key, ref, stackBehavior); - print({ - component: BottomSheetModal.name, - method: handlePresent.name - }); - }); - }, // eslint-disable-next-line react-hooks/exhaustive-deps - [key, stackBehavior, mountSheet]); - const handleDismiss = useCallback(function handleDismiss(animationConfigs) { - var _bottomSheetRef$curre7; - - print({ - component: BottomSheetModal.name, - method: handleDismiss.name, - params: { - currentIndexRef: currentIndexRef.current, - minimized: minimized.current - } - }); - /** - * if modal is already been dismiss, we exit the method. - */ - - if (currentIndexRef.current === -1 && minimized.current === false) { - return; - } - - if (minimized.current || currentIndexRef.current === -1 && enablePanDownToClose) { - unmount(); - return; - } - - willUnmountSheet(key); - forcedDismissed.current = true; - (_bottomSheetRef$curre7 = bottomSheetRef.current) === null || _bottomSheetRef$curre7 === void 0 ? void 0 : _bottomSheetRef$curre7.forceClose(animationConfigs); - }, [willUnmountSheet, unmount, key, enablePanDownToClose]); - const handleMinimize = useCallback(function handleMinimize() { - var _bottomSheetRef$curre8; - - print({ - component: BottomSheetModal.name, - method: handleMinimize.name, - params: { - minimized: minimized.current - } - }); - - if (minimized.current) { - return; - } - - minimized.current = true; - /** - * if modal got minimized before it finish its mounting - * animation, we set the `restoreIndexRef` to the - * provided index. - */ - - if (currentIndexRef.current === -1) { - restoreIndexRef.current = index; - } else { - restoreIndexRef.current = currentIndexRef.current; - } - - (_bottomSheetRef$curre8 = bottomSheetRef.current) === null || _bottomSheetRef$curre8 === void 0 ? void 0 : _bottomSheetRef$curre8.close(); - }, [index]); - const handleRestore = useCallback(function handleRestore() { - var _bottomSheetRef$curre9; - - print({ - component: BottomSheetModal.name, - method: handleRestore.name, - params: { - minimized: minimized.current, - forcedDismissed: forcedDismissed.current - } - }); - - if (!minimized.current || forcedDismissed.current) { - return; - } - - minimized.current = false; - (_bottomSheetRef$curre9 = bottomSheetRef.current) === null || _bottomSheetRef$curre9 === void 0 ? void 0 : _bottomSheetRef$curre9.snapToIndex(restoreIndexRef.current); - }, []); //#endregion - //#region callbacks - - const handlePortalOnUnmount = useCallback(function handlePortalOnUnmount() { - var _bottomSheetRef$curre10; - - print({ - component: BottomSheetModal.name, - method: handlePortalOnUnmount.name, - params: { - minimized: minimized.current, - forcedDismissed: forcedDismissed.current - } - }); - /** - * if modal is already been dismiss, we exit the method. - */ - - if (currentIndexRef.current === -1 && minimized.current === false) { - return; - } - - mounted.current = false; - forcedDismissed.current = true; - - if (minimized.current) { - unmount(); - return; - } - - willUnmountSheet(key); - (_bottomSheetRef$curre10 = bottomSheetRef.current) === null || _bottomSheetRef$curre10 === void 0 ? void 0 : _bottomSheetRef$curre10.close(); - }, [key, unmount, willUnmountSheet]); - const handlePortalRender = useCallback(function handlePortalRender(render) { - if (mounted.current) { - render(); - } - }, []); - const handleBottomSheetOnChange = useCallback(function handleBottomSheetOnChange(_index) { - print({ - component: BottomSheetModal.name, - method: handleBottomSheetOnChange.name, - params: { - minimized: minimized.current, - forcedDismissed: forcedDismissed.current - } - }); - currentIndexRef.current = _index; - - if (_providedOnChange) { - _providedOnChange(_index); - } - }, [_providedOnChange]); - const handleBottomSheetOnClose = useCallback(function handleBottomSheetOnClose() { - print({ - component: BottomSheetModal.name, - method: handleBottomSheetOnClose.name, - params: { - minimized: minimized.current, - forcedDismissed: forcedDismissed.current - } - }); - - if (minimized.current) { - return; - } - - if (enableDismissOnClose) { - unmount(); - } - }, [enableDismissOnClose, unmount]); //#endregion - //#region expose methods - - useImperativeHandle(ref, () => ({ - // sheet - snapToIndex: handleSnapToIndex, - snapToPosition: handleSnapToPosition, - expand: handleExpand, - collapse: handleCollapse, - close: handleClose, - forceClose: handleForceClose, - // modal methods - dismiss: handleDismiss, - present: handlePresent, - // internal - minimize: handleMinimize, - restore: handleRestore - })); //#endregion - // render - // console.log('BottomSheetModal', index, mount, data); - - return mount ? /*#__PURE__*/React.createElement(Portal, { - key: key, - name: key, - handleOnMount: handlePortalRender, - handleOnUpdate: handlePortalRender, - handleOnUnmount: handlePortalOnUnmount - }, /*#__PURE__*/React.createElement(ContainerComponent, { - key: key - }, /*#__PURE__*/React.createElement(BottomSheet, _extends({}, bottomSheetProps, { - ref: bottomSheetRef, - key: key, - index: index, - snapPoints: snapPoints, - enablePanDownToClose: enablePanDownToClose, - animateOnMount: animateOnMount, - containerHeight: containerHeight, - containerOffset: containerOffset, - onChange: handleBottomSheetOnChange, - onClose: handleBottomSheetOnClose, - children: typeof Content === 'function' ? /*#__PURE__*/React.createElement(Content, { - data: data - }) : Content, - $modal: true - })))) : null; -}); -const BottomSheetModal = /*#__PURE__*/memo(BottomSheetModalComponent); -BottomSheetModal.displayName = 'BottomSheetModal'; -export default BottomSheetModal; -//# sourceMappingURL=BottomSheetModal.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetModal/BottomSheetModal.js.map b/lib/module/components/bottomSheetModal/BottomSheetModal.js.map deleted file mode 100644 index 13e2351b2..000000000 --- a/lib/module/components/bottomSheetModal/BottomSheetModal.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheetModal.tsx"],"names":["React","forwardRef","memo","useCallback","useImperativeHandle","useMemo","useRef","useState","Portal","usePortal","BottomSheet","useBottomSheetModalInternal","print","DEFAULT_STACK_BEHAVIOR","DEFAULT_ENABLE_DISMISS_ON_CLOSE","id","INITIAL_STATE","mount","data","undefined","BottomSheetModalComponent","BottomSheetModal","props","ref","name","stackBehavior","enableDismissOnClose","onDismiss","_providedOnDismiss","index","snapPoints","enablePanDownToClose","animateOnMount","containerComponent","ContainerComponent","Fragment","onChange","_providedOnChange","children","Content","bottomSheetProps","setState","containerHeight","containerOffset","mountSheet","unmountSheet","willUnmountSheet","removePortal","unmountPortal","bottomSheetRef","currentIndexRef","restoreIndexRef","minimized","forcedDismissed","mounted","current","key","resetVariables","component","method","unmount","_mounted","handleSnapToIndex","args","snapToIndex","handleSnapToPosition","snapToPosition","handleExpand","expand","handleCollapse","collapse","handleClose","close","handleForceClose","forceClose","handlePresent","_data","requestAnimationFrame","handleDismiss","animationConfigs","params","handleMinimize","handleRestore","handlePortalOnUnmount","handlePortalRender","render","handleBottomSheetOnChange","_index","handleBottomSheetOnClose","dismiss","present","minimize","restore","displayName"],"mappings":";;AAAA,OAAOA,KAAP,IACEC,UADF,EAEEC,IAFF,EAGEC,WAHF,EAIEC,mBAJF,EAKEC,OALF,EAMEC,MANF,EAOEC,QAPF,QAQO,OARP;AASA,SAASC,MAAT,EAAiBC,SAAjB,QAAkC,gBAAlC;AACA,OAAOC,WAAP,MAAwB,gBAAxB;AACA,SAASC,2BAAT,QAA4C,aAA5C;AACA,SAASC,KAAT,QAAsB,iBAAtB;AACA,SACEC,sBADF,EAEEC,+BAFF,QAGO,aAHP;AAMA,SAASC,EAAT,QAAmB,oBAAnB;AAIA,MAAMC,aAGL,GAAG;AACFC,EAAAA,KAAK,EAAE,KADL;AAEFC,EAAAA,IAAI,EAAEC;AAFJ,CAHJ;AAQA,MAAMC,yBAAyB,gBAAGnB,UAAU,CAG1C,SAASoB,gBAAT,CAA0BC,KAA1B,EAAiCC,GAAjC,EAAsC;AACtC,QAAM;AACJ;A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,OAAD;AAAS,MAAA,IAAI,EAAErB;AAAf,MAAhC,GAA0DqB,OAb9D;AAeE,IAAA,MAAM,EAAE;AAfV,KADF,CAPF,CADU,GA4BR,IA5BJ;AA6BD,CAhX2C,CAA5C;AAkXA,MAAMlB,gBAAgB,gBAAGnB,IAAI,CAACkB,yBAAD,CAA7B;AACAC,gBAAgB,CAACwE,WAAjB,GAA+B,kBAA/B;AAEA,eAAexE,gBAAf","sourcesContent":["import React, {\n forwardRef,\n memo,\n useCallback,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { Portal, usePortal } from '@gorhom/portal';\nimport BottomSheet from '../bottomSheet';\nimport { useBottomSheetModalInternal } from '../../hooks';\nimport { print } from '../../utilities';\nimport {\n DEFAULT_STACK_BEHAVIOR,\n DEFAULT_ENABLE_DISMISS_ON_CLOSE,\n} from './constants';\nimport type { BottomSheetModalMethods, BottomSheetMethods } from '../../types';\nimport type { BottomSheetModalProps } from './types';\nimport { id } from '../../utilities/id';\n\ntype BottomSheetModal = BottomSheetModalMethods;\n\nconst INITIAL_STATE: {\n mount: boolean;\n data: any;\n} = {\n mount: false,\n data: undefined,\n};\n\nconst BottomSheetModalComponent = forwardRef<\n BottomSheetModal,\n BottomSheetModalProps\n>(function BottomSheetModal(props, ref) {\n const {\n // modal props\n name,\n stackBehavior = DEFAULT_STACK_BEHAVIOR,\n enableDismissOnClose = DEFAULT_ENABLE_DISMISS_ON_CLOSE,\n onDismiss: _providedOnDismiss,\n\n // bottom sheet props\n index = 0,\n snapPoints,\n enablePanDownToClose = true,\n animateOnMount = true,\n containerComponent: ContainerComponent = React.Fragment,\n\n // callbacks\n onChange: _providedOnChange,\n\n // components\n children: Content,\n ...bottomSheetProps\n } = props;\n\n //#region state\n const [{ mount, data }, setState] = useState(INITIAL_STATE);\n //#endregion\n\n //#region hooks\n const {\n containerHeight,\n containerOffset,\n mountSheet,\n unmountSheet,\n willUnmountSheet,\n } = useBottomSheetModalInternal();\n const { removePortal: unmountPortal } = usePortal();\n //#endregion\n\n //#region refs\n const bottomSheetRef = useRef(null);\n const currentIndexRef = useRef(!animateOnMount ? index : -1);\n const restoreIndexRef = useRef(-1);\n const minimized = useRef(false);\n const forcedDismissed = useRef(false);\n const mounted = useRef(false);\n mounted.current = mount;\n //#endregion\n\n //#region variables\n const key = useMemo(() => name || `bottom-sheet-modal-${id()}`, [name]);\n //#endregion\n\n //#region private methods\n const resetVariables = useCallback(function resetVariables() {\n print({\n component: BottomSheetModal.name,\n method: resetVariables.name,\n });\n currentIndexRef.current = -1;\n restoreIndexRef.current = -1;\n minimized.current = false;\n mounted.current = false;\n forcedDismissed.current = false;\n }, []);\n const unmount = useCallback(\n function unmount() {\n print({\n component: BottomSheetModal.name,\n method: unmount.name,\n });\n const _mounted = mounted.current;\n\n // reset variables\n resetVariables();\n\n // unmount sheet and portal\n unmountSheet(key);\n unmountPortal(key);\n\n // unmount the node, if sheet is still mounted\n if (_mounted) {\n setState(INITIAL_STATE);\n }\n\n // fire `onDismiss` callback\n if (_providedOnDismiss) {\n _providedOnDismiss();\n }\n },\n [key, resetVariables, unmountSheet, unmountPortal, _providedOnDismiss]\n );\n //#endregion\n\n //#region bottom sheet methods\n const handleSnapToIndex = useCallback(\n (...args) => {\n if (minimized.current) {\n return;\n }\n bottomSheetRef.current?.snapToIndex(...args);\n },\n []\n );\n const handleSnapToPosition = useCallback<\n BottomSheetMethods['snapToPosition']\n >((...args) => {\n if (minimized.current) {\n return;\n }\n bottomSheetRef.current?.snapToPosition(...args);\n }, []);\n const handleExpand = useCallback((...args) => {\n if (minimized.current) {\n return;\n }\n bottomSheetRef.current?.expand(...args);\n }, []);\n const handleCollapse = useCallback(\n (...args) => {\n if (minimized.current) {\n return;\n }\n bottomSheetRef.current?.collapse(...args);\n },\n []\n );\n const handleClose = useCallback((...args) => {\n if (minimized.current) {\n return;\n }\n bottomSheetRef.current?.close(...args);\n }, []);\n const handleForceClose = useCallback(\n (...args) => {\n if (minimized.current) {\n return;\n }\n bottomSheetRef.current?.forceClose(...args);\n },\n []\n );\n //#endregion\n\n //#region bottom sheet modal methods\n const handlePresent = useCallback(\n function handlePresent(_data?: any) {\n requestAnimationFrame(() => {\n setState({\n mount: true,\n data: _data,\n });\n mountSheet(key, ref, stackBehavior);\n\n print({\n component: BottomSheetModal.name,\n method: handlePresent.name,\n });\n });\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [key, stackBehavior, mountSheet]\n );\n const handleDismiss = useCallback(\n function handleDismiss(animationConfigs) {\n print({\n component: BottomSheetModal.name,\n method: handleDismiss.name,\n params: {\n currentIndexRef: currentIndexRef.current,\n minimized: minimized.current,\n },\n });\n /**\n * if modal is already been dismiss, we exit the method.\n */\n if (currentIndexRef.current === -1 && minimized.current === false) {\n return;\n }\n\n if (\n minimized.current ||\n (currentIndexRef.current === -1 && enablePanDownToClose)\n ) {\n unmount();\n return;\n }\n willUnmountSheet(key);\n forcedDismissed.current = true;\n bottomSheetRef.current?.forceClose(animationConfigs);\n },\n [willUnmountSheet, unmount, key, enablePanDownToClose]\n );\n const handleMinimize = useCallback(\n function handleMinimize() {\n print({\n component: BottomSheetModal.name,\n method: handleMinimize.name,\n params: {\n minimized: minimized.current,\n },\n });\n if (minimized.current) {\n return;\n }\n minimized.current = true;\n\n /**\n * if modal got minimized before it finish its mounting\n * animation, we set the `restoreIndexRef` to the\n * provided index.\n */\n if (currentIndexRef.current === -1) {\n restoreIndexRef.current = index;\n } else {\n restoreIndexRef.current = currentIndexRef.current;\n }\n bottomSheetRef.current?.close();\n },\n [index]\n );\n const handleRestore = useCallback(function handleRestore() {\n print({\n component: BottomSheetModal.name,\n method: handleRestore.name,\n params: {\n minimized: minimized.current,\n forcedDismissed: forcedDismissed.current,\n },\n });\n if (!minimized.current || forcedDismissed.current) {\n return;\n }\n minimized.current = false;\n bottomSheetRef.current?.snapToIndex(restoreIndexRef.current);\n }, []);\n //#endregion\n\n //#region callbacks\n const handlePortalOnUnmount = useCallback(\n function handlePortalOnUnmount() {\n print({\n component: BottomSheetModal.name,\n method: handlePortalOnUnmount.name,\n params: {\n minimized: minimized.current,\n forcedDismissed: forcedDismissed.current,\n },\n });\n /**\n * if modal is already been dismiss, we exit the method.\n */\n if (currentIndexRef.current === -1 && minimized.current === false) {\n return;\n }\n\n mounted.current = false;\n forcedDismissed.current = true;\n\n if (minimized.current) {\n unmount();\n return;\n }\n willUnmountSheet(key);\n bottomSheetRef.current?.close();\n },\n [key, unmount, willUnmountSheet]\n );\n const handlePortalRender = useCallback(function handlePortalRender(\n render: () => void\n ) {\n if (mounted.current) {\n render();\n }\n },\n []);\n const handleBottomSheetOnChange = useCallback(\n function handleBottomSheetOnChange(_index: number) {\n print({\n component: BottomSheetModal.name,\n method: handleBottomSheetOnChange.name,\n params: {\n minimized: minimized.current,\n forcedDismissed: forcedDismissed.current,\n },\n });\n currentIndexRef.current = _index;\n\n if (_providedOnChange) {\n _providedOnChange(_index);\n }\n },\n [_providedOnChange]\n );\n const handleBottomSheetOnClose = useCallback(\n function handleBottomSheetOnClose() {\n print({\n component: BottomSheetModal.name,\n method: handleBottomSheetOnClose.name,\n params: {\n minimized: minimized.current,\n forcedDismissed: forcedDismissed.current,\n },\n });\n\n if (minimized.current) {\n return;\n }\n\n if (enableDismissOnClose) {\n unmount();\n }\n },\n [enableDismissOnClose, unmount]\n );\n //#endregion\n\n //#region expose methods\n useImperativeHandle(ref, () => ({\n // sheet\n snapToIndex: handleSnapToIndex,\n snapToPosition: handleSnapToPosition,\n expand: handleExpand,\n collapse: handleCollapse,\n close: handleClose,\n forceClose: handleForceClose,\n // modal methods\n dismiss: handleDismiss,\n present: handlePresent,\n // internal\n minimize: handleMinimize,\n restore: handleRestore,\n }));\n //#endregion\n\n // render\n // console.log('BottomSheetModal', index, mount, data);\n return mount ? (\n \n \n : Content\n }\n $modal={true}\n />\n \n \n ) : null;\n});\n\nconst BottomSheetModal = memo(BottomSheetModalComponent);\nBottomSheetModal.displayName = 'BottomSheetModal';\n\nexport default BottomSheetModal;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetModal/constants.js b/lib/module/components/bottomSheetModal/constants.js deleted file mode 100644 index b50566d8b..000000000 --- a/lib/module/components/bottomSheetModal/constants.js +++ /dev/null @@ -1,4 +0,0 @@ -const DEFAULT_STACK_BEHAVIOR = 'replace'; -const DEFAULT_ENABLE_DISMISS_ON_CLOSE = true; -export { DEFAULT_STACK_BEHAVIOR, DEFAULT_ENABLE_DISMISS_ON_CLOSE }; -//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetModal/constants.js.map b/lib/module/components/bottomSheetModal/constants.js.map deleted file mode 100644 index 772655d09..000000000 --- a/lib/module/components/bottomSheetModal/constants.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["constants.ts"],"names":["DEFAULT_STACK_BEHAVIOR","DEFAULT_ENABLE_DISMISS_ON_CLOSE"],"mappings":"AAAA,MAAMA,sBAAsB,GAAG,SAA/B;AACA,MAAMC,+BAA+B,GAAG,IAAxC;AAEA,SAASD,sBAAT,EAAiCC,+BAAjC","sourcesContent":["const DEFAULT_STACK_BEHAVIOR = 'replace';\nconst DEFAULT_ENABLE_DISMISS_ON_CLOSE = true;\n\nexport { DEFAULT_STACK_BEHAVIOR, DEFAULT_ENABLE_DISMISS_ON_CLOSE };\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetModal/index.js b/lib/module/components/bottomSheetModal/index.js deleted file mode 100644 index de4e3cf14..000000000 --- a/lib/module/components/bottomSheetModal/index.js +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './BottomSheetModal'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetModal/index.js.map b/lib/module/components/bottomSheetModal/index.js.map deleted file mode 100644 index 768887316..000000000 --- a/lib/module/components/bottomSheetModal/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":["default"],"mappings":"AAAA,SAASA,OAAT,QAAwB,oBAAxB","sourcesContent":["export { default } from './BottomSheetModal';\nexport type {\n BottomSheetModalProps,\n BottomSheetModalPrivateMethods,\n BottomSheetModalStackBehavior,\n} from './types';\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetModalProvider/BottomSheetModalProvider.js b/lib/module/components/bottomSheetModalProvider/BottomSheetModalProvider.js deleted file mode 100644 index 347fbc2ac..000000000 --- a/lib/module/components/bottomSheetModalProvider/BottomSheetModalProvider.js +++ /dev/null @@ -1,178 +0,0 @@ -import React, { useCallback, useMemo, useRef } from 'react'; -import { useSharedValue } from 'react-native-reanimated'; -import { PortalProvider } from '@gorhom/portal'; -import { BottomSheetModalProvider, BottomSheetModalInternalProvider } from '../../contexts'; -import BottomSheetContainer from '../bottomSheetContainer'; -import { MODAL_STACK_BEHAVIOR } from '../../constants'; -import { INITIAL_CONTAINER_HEIGHT, INITIAL_CONTAINER_OFFSET } from '../bottomSheet/constants'; - -const BottomSheetModalProviderWrapper = ({ - children -}) => { - //#region layout variables - const animatedContainerHeight = useSharedValue(INITIAL_CONTAINER_HEIGHT); - const animatedContainerOffset = useSharedValue(INITIAL_CONTAINER_OFFSET); //#endregion - //#region variables - - const sheetsQueueRef = useRef([]); //#endregion - //#region private methods - - const handleMountSheet = useCallback((key, ref, stackBehavior) => { - const _sheetsQueue = sheetsQueueRef.current.slice(); - - const sheetIndex = _sheetsQueue.findIndex(item => item.key === key); - - const sheetOnTop = sheetIndex === _sheetsQueue.length - 1; - /** - * Exit the method, if sheet is already presented - * and at the top. - */ - - if (sheetIndex !== -1 && sheetOnTop) { - return; - } - /** - * Minimize the current sheet if: - * - it exists. - * - it is not unmounting. - * - stack behavior is 'replace'. - */ - - - const currentMountedSheet = _sheetsQueue[_sheetsQueue.length - 1]; - - if (currentMountedSheet && !currentMountedSheet.willUnmount && stackBehavior === MODAL_STACK_BEHAVIOR.replace) { - var _currentMountedSheet$, _currentMountedSheet$2; - - (_currentMountedSheet$ = currentMountedSheet.ref) === null || _currentMountedSheet$ === void 0 ? void 0 : (_currentMountedSheet$2 = _currentMountedSheet$.current) === null || _currentMountedSheet$2 === void 0 ? void 0 : _currentMountedSheet$2.minimize(); - } - /** - * Restore and remove incoming sheet from the queue, - * if it was registered. - */ - - - if (sheetIndex !== -1) { - var _ref$current; - - _sheetsQueue.splice(sheetIndex, 1); - - ref === null || ref === void 0 ? void 0 : (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.restore(); - } - - _sheetsQueue.push({ - key, - ref, - willUnmount: false - }); - - sheetsQueueRef.current = _sheetsQueue; - }, []); - const handleUnmountSheet = useCallback(key => { - const _sheetsQueue = sheetsQueueRef.current.slice(); - - const sheetIndex = _sheetsQueue.findIndex(item => item.key === key); - - const sheetOnTop = sheetIndex === _sheetsQueue.length - 1; - /** - * Here we remove the unmounted sheet and update - * the sheets queue. - */ - - _sheetsQueue.splice(sheetIndex, 1); - - sheetsQueueRef.current = _sheetsQueue; - /** - * Here we try to restore previous sheet position if unmounted - * sheet was on top. This is needed when user dismiss - * the modal by panning down. - */ - - const hasMinimizedSheet = sheetsQueueRef.current.length > 0; - const minimizedSheet = sheetsQueueRef.current[sheetsQueueRef.current.length - 1]; - - if (sheetOnTop && hasMinimizedSheet && minimizedSheet && !minimizedSheet.willUnmount) { - var _sheetsQueueRef$curre, _sheetsQueueRef$curre2; - - (_sheetsQueueRef$curre = sheetsQueueRef.current[sheetsQueueRef.current.length - 1].ref) === null || _sheetsQueueRef$curre === void 0 ? void 0 : (_sheetsQueueRef$curre2 = _sheetsQueueRef$curre.current) === null || _sheetsQueueRef$curre2 === void 0 ? void 0 : _sheetsQueueRef$curre2.restore(); - } - }, []); - const handleWillUnmountSheet = useCallback(key => { - const _sheetsQueue = sheetsQueueRef.current.slice(); - - const sheetIndex = _sheetsQueue.findIndex(item => item.key === key); - - const sheetOnTop = sheetIndex === _sheetsQueue.length - 1; - /** - * Here we mark the sheet that will unmount, - * so it won't be restored. - */ - - if (sheetIndex !== -1) { - _sheetsQueue[sheetIndex].willUnmount = true; - } - /** - * Here we try to restore previous sheet position, - * This is needed when user dismiss the modal by fire the dismiss action. - */ - - - const hasMinimizedSheet = _sheetsQueue.length > 1; - - if (sheetOnTop && hasMinimizedSheet) { - var _sheetsQueue$ref, _sheetsQueue$ref$curr; - - (_sheetsQueue$ref = _sheetsQueue[_sheetsQueue.length - 2].ref) === null || _sheetsQueue$ref === void 0 ? void 0 : (_sheetsQueue$ref$curr = _sheetsQueue$ref.current) === null || _sheetsQueue$ref$curr === void 0 ? void 0 : _sheetsQueue$ref$curr.restore(); - } - - sheetsQueueRef.current = _sheetsQueue; - }, []); //#endregion - //#region public methods - - const handleDismiss = useCallback(key => { - const sheetToBeDismissed = key ? sheetsQueueRef.current.find(item => item.key === key) : sheetsQueueRef.current[sheetsQueueRef.current.length - 1]; - - if (sheetToBeDismissed) { - var _sheetToBeDismissed$r, _sheetToBeDismissed$r2; - - (_sheetToBeDismissed$r = sheetToBeDismissed.ref) === null || _sheetToBeDismissed$r === void 0 ? void 0 : (_sheetToBeDismissed$r2 = _sheetToBeDismissed$r.current) === null || _sheetToBeDismissed$r2 === void 0 ? void 0 : _sheetToBeDismissed$r2.dismiss(); - return true; - } - - return false; - }, []); - const handleDismissAll = useCallback(() => { - sheetsQueueRef.current.map(item => { - var _item$ref, _item$ref$current; - - (_item$ref = item.ref) === null || _item$ref === void 0 ? void 0 : (_item$ref$current = _item$ref.current) === null || _item$ref$current === void 0 ? void 0 : _item$ref$current.dismiss(); - }); - }, []); //#endregion - //#region context variables - - const externalContextVariables = useMemo(() => ({ - dismiss: handleDismiss, - dismissAll: handleDismissAll - }), [handleDismiss, handleDismissAll]); - const internalContextVariables = useMemo(() => ({ - containerHeight: animatedContainerHeight, - containerOffset: animatedContainerOffset, - mountSheet: handleMountSheet, - unmountSheet: handleUnmountSheet, - willUnmountSheet: handleWillUnmountSheet - }), [animatedContainerHeight, animatedContainerOffset, handleMountSheet, handleUnmountSheet, handleWillUnmountSheet]); //#endregion - //#region renders - - return /*#__PURE__*/React.createElement(BottomSheetModalProvider, { - value: externalContextVariables - }, /*#__PURE__*/React.createElement(BottomSheetModalInternalProvider, { - value: internalContextVariables - }, /*#__PURE__*/React.createElement(BottomSheetContainer, { - containerOffset: animatedContainerOffset, - containerHeight: animatedContainerHeight, - children: null - }), /*#__PURE__*/React.createElement(PortalProvider, null, children))); //#endregion -}; - -export default BottomSheetModalProviderWrapper; -//# sourceMappingURL=BottomSheetModalProvider.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetModalProvider/BottomSheetModalProvider.js.map b/lib/module/components/bottomSheetModalProvider/BottomSheetModalProvider.js.map deleted file mode 100644 index 421016054..000000000 --- a/lib/module/components/bottomSheetModalProvider/BottomSheetModalProvider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheetModalProvider.tsx"],"names":["React","useCallback","useMemo","useRef","useSharedValue","PortalProvider","BottomSheetModalProvider","BottomSheetModalInternalProvider","BottomSheetContainer","MODAL_STACK_BEHAVIOR","INITIAL_CONTAINER_HEIGHT","INITIAL_CONTAINER_OFFSET","BottomSheetModalProviderWrapper","children","animatedContainerHeight","animatedContainerOffset","sheetsQueueRef","handleMountSheet","key","ref","stackBehavior","_sheetsQueue","current","slice","sheetIndex","findIndex","item","sheetOnTop","length","currentMountedSheet","willUnmount","replace","minimize","splice","restore","push","handleUnmountSheet","hasMinimizedSheet","minimizedSheet","handleWillUnmountSheet","handleDismiss","sheetToBeDismissed","find","dismiss","handleDismissAll","map","externalContextVariables","dismissAll","internalContextVariables","containerHeight","containerOffset","mountSheet","unmountSheet","willUnmountSheet"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,WAAhB,EAA6BC,OAA7B,EAAsCC,MAAtC,QAAoD,OAApD;AACA,SAASC,cAAT,QAA+B,yBAA/B;AACA,SAASC,cAAT,QAA+B,gBAA/B;AACA,SACEC,wBADF,EAEEC,gCAFF,QAGO,gBAHP;AAIA,OAA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ATgC,EAS9B,EAT8B,CAAjC;AAUA,QAAMC,gBAAgB,GAAG3C,WAAW,CAAC,MAAM;AACzCe,IAAAA,cAAc,CAACM,OAAf,CAAuBuB,GAAvB,CAA2BnB,IAAI,IAAI;AAAA;;AACjC,mBAAAA,IAAI,CAACP,GAAL,6EAAUG,OAAV,wEAAmBqB,OAAnB;AACD,KAFD;AAGD,GAJmC,EAIjC,EAJiC,CAApC,CA9HmC,CAmInC;AAEA;;AACA,QAAMG,wBAAwB,GAAG5C,OAAO,CACtC,OAAO;AACLyC,IAAAA,OAAO,EAAEH,aADJ;AAELO,IAAAA,UAAU,EAAEH;AAFP,GAAP,CADsC,EAKtC,CAACJ,aAAD,EAAgBI,gBAAhB,CALsC,CAAxC;AAOA,QAAMI,wBAAwB,GAAG9C,OAAO,CACtC,OAAO;AACL+C,IAAAA,eAAe,EAAEnC,uBADZ;AAELoC,IAAAA,eAAe,EAAEnC,uBAFZ;AAGLoC,IAAAA,UAAU,EAAElC,gBAHP;AAILmC,IAAAA,YAAY,EAAEhB,kBAJT;AAKLiB,IAAAA,gBAAgB,EAAEd;AALb,GAAP,CADsC,EAQtC,CACEzB,uBADF,EAEEC,uBAFF,EAGEE,gBAHF,EAIEmB,kBAJF,EAKEG,sBALF,CARsC,CAAxC,CA7ImC,CA6JnC;AAEA;;AACA,sBACE,oBAAC,wBAAD;AAA0B,IAAA,KAAK,EAAEO;AAAjC,kBACE,oBAAC,gCAAD;AAAkC,IAAA,KAAK,EAAEE;AAAzC,kBACE,oBAAC,oBAAD;AACE,IAAA,eAAe,EAAEjC,uBADnB;AAEE,IAAA,eAAe,EAAED,uBAFnB;AAGE,IAAA,QAAQ,EAAE;AAHZ,IADF,eAME,oBAAC,cAAD,QAAiBD,QAAjB,CANF,CADF,CADF,CAhKmC,CA4KnC;AACD,CA/KD;;AAiLA,eAAeD,+BAAf","sourcesContent":["import React, { useCallback, useMemo, useRef } from 'react';\nimport { useSharedValue } from 'react-native-reanimated';\nimport { PortalProvider } from '@gorhom/portal';\nimport {\n BottomSheetModalProvider,\n BottomSheetModalInternalProvider,\n} from '../../contexts';\nimport BottomSheetContainer from '../bottomSheetContainer';\nimport { MODAL_STACK_BEHAVIOR } from '../../constants';\nimport {\n INITIAL_CONTAINER_HEIGHT,\n INITIAL_CONTAINER_OFFSET,\n} from '../bottomSheet/constants';\nimport type { BottomSheetModalStackBehavior } from '../bottomSheetModal';\nimport type {\n BottomSheetModalProviderProps,\n BottomSheetModalRef,\n} from './types';\n\nconst BottomSheetModalProviderWrapper = ({\n children,\n}: BottomSheetModalProviderProps) => {\n //#region layout variables\n const animatedContainerHeight = useSharedValue(INITIAL_CONTAINER_HEIGHT);\n const animatedContainerOffset = useSharedValue(INITIAL_CONTAINER_OFFSET);\n //#endregion\n\n //#region variables\n const sheetsQueueRef = useRef([]);\n //#endregion\n\n //#region private methods\n const handleMountSheet = useCallback(\n (key: string, ref: any, stackBehavior: BottomSheetModalStackBehavior) => {\n const _sheetsQueue = sheetsQueueRef.current.slice();\n const sheetIndex = _sheetsQueue.findIndex(item => item.key === key);\n const sheetOnTop = sheetIndex === _sheetsQueue.length - 1;\n\n /**\n * Exit the method, if sheet is already presented\n * and at the top.\n */\n if (sheetIndex !== -1 && sheetOnTop) {\n return;\n }\n\n /**\n * Minimize the current sheet if:\n * - it exists.\n * - it is not unmounting.\n * - stack behavior is 'replace'.\n */\n const currentMountedSheet = _sheetsQueue[_sheetsQueue.length - 1];\n if (\n currentMountedSheet &&\n !currentMountedSheet.willUnmount &&\n stackBehavior === MODAL_STACK_BEHAVIOR.replace\n ) {\n currentMountedSheet.ref?.current?.minimize();\n }\n\n /**\n * Restore and remove incoming sheet from the queue,\n * if it was registered.\n */\n if (sheetIndex !== -1) {\n _sheetsQueue.splice(sheetIndex, 1);\n ref?.current?.restore();\n }\n\n _sheetsQueue.push({\n key,\n ref,\n willUnmount: false,\n });\n sheetsQueueRef.current = _sheetsQueue;\n },\n []\n );\n const handleUnmountSheet = useCallback((key: string) => {\n const _sheetsQueue = sheetsQueueRef.current.slice();\n const sheetIndex = _sheetsQueue.findIndex(item => item.key === key);\n const sheetOnTop = sheetIndex === _sheetsQueue.length - 1;\n\n /**\n * Here we remove the unmounted sheet and update\n * the sheets queue.\n */\n _sheetsQueue.splice(sheetIndex, 1);\n sheetsQueueRef.current = _sheetsQueue;\n\n /**\n * Here we try to restore previous sheet position if unmounted\n * sheet was on top. This is needed when user dismiss\n * the modal by panning down.\n */\n const hasMinimizedSheet = sheetsQueueRef.current.length > 0;\n const minimizedSheet =\n sheetsQueueRef.current[sheetsQueueRef.current.length - 1];\n if (\n sheetOnTop &&\n hasMinimizedSheet &&\n minimizedSheet &&\n !minimizedSheet.willUnmount\n ) {\n sheetsQueueRef.current[\n sheetsQueueRef.current.length - 1\n ].ref?.current?.restore();\n }\n }, []);\n const handleWillUnmountSheet = useCallback((key: string) => {\n const _sheetsQueue = sheetsQueueRef.current.slice();\n const sheetIndex = _sheetsQueue.findIndex(item => item.key === key);\n const sheetOnTop = sheetIndex === _sheetsQueue.length - 1;\n\n /**\n * Here we mark the sheet that will unmount,\n * so it won't be restored.\n */\n if (sheetIndex !== -1) {\n _sheetsQueue[sheetIndex].willUnmount = true;\n }\n\n /**\n * Here we try to restore previous sheet position,\n * This is needed when user dismiss the modal by fire the dismiss action.\n */\n const hasMinimizedSheet = _sheetsQueue.length > 1;\n if (sheetOnTop && hasMinimizedSheet) {\n _sheetsQueue[_sheetsQueue.length - 2].ref?.current?.restore();\n }\n\n sheetsQueueRef.current = _sheetsQueue;\n }, []);\n //#endregion\n\n //#region public methods\n const handleDismiss = useCallback((key?: string) => {\n const sheetToBeDismissed = key\n ? sheetsQueueRef.current.find(item => item.key === key)\n : sheetsQueueRef.current[sheetsQueueRef.current.length - 1];\n if (sheetToBeDismissed) {\n sheetToBeDismissed.ref?.current?.dismiss();\n return true;\n }\n return false;\n }, []);\n const handleDismissAll = useCallback(() => {\n sheetsQueueRef.current.map(item => {\n item.ref?.current?.dismiss();\n });\n }, []);\n //#endregion\n\n //#region context variables\n const externalContextVariables = useMemo(\n () => ({\n dismiss: handleDismiss,\n dismissAll: handleDismissAll,\n }),\n [handleDismiss, handleDismissAll]\n );\n const internalContextVariables = useMemo(\n () => ({\n containerHeight: animatedContainerHeight,\n containerOffset: animatedContainerOffset,\n mountSheet: handleMountSheet,\n unmountSheet: handleUnmountSheet,\n willUnmountSheet: handleWillUnmountSheet,\n }),\n [\n animatedContainerHeight,\n animatedContainerOffset,\n handleMountSheet,\n handleUnmountSheet,\n handleWillUnmountSheet,\n ]\n );\n //#endregion\n\n //#region renders\n return (\n \n \n \n {children}\n \n \n );\n //#endregion\n};\n\nexport default BottomSheetModalProviderWrapper;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetModalProvider/index.js b/lib/module/components/bottomSheetModalProvider/index.js deleted file mode 100644 index a81da684b..000000000 --- a/lib/module/components/bottomSheetModalProvider/index.js +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './BottomSheetModalProvider'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetModalProvider/index.js.map b/lib/module/components/bottomSheetModalProvider/index.js.map deleted file mode 100644 index 5a4c2f3d1..000000000 --- a/lib/module/components/bottomSheetModalProvider/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":["default"],"mappings":"AAAA,SAASA,OAAT,QAAwB,4BAAxB","sourcesContent":["export { default } from './BottomSheetModalProvider';\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.js b/lib/module/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.js deleted file mode 100644 index 572a150f1..000000000 --- a/lib/module/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.js +++ /dev/null @@ -1,34 +0,0 @@ -function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } - -import React, { forwardRef, memo } from 'react'; -import { RefreshControl } from 'react-native'; -import { NativeViewGestureHandler } from 'react-native-gesture-handler'; -import Animated, { useAnimatedProps } from 'react-native-reanimated'; -import { SCROLLABLE_STATE } from '../../constants'; -import { useBottomSheetInternal } from '../../hooks'; -const AnimatedRefreshControl = Animated.createAnimatedComponent(RefreshControl); -const BottomSheetRefreshControlComponent = /*#__PURE__*/forwardRef(({ - onRefresh, - ...rest -}, ref) => { - // hooks - const { - animatedScrollableState - } = useBottomSheetInternal(); // variables - - const animatedProps = useAnimatedProps(() => ({ - enabled: animatedScrollableState.value === SCROLLABLE_STATE.UNLOCKED - })); // render - - return /*#__PURE__*/React.createElement(NativeViewGestureHandler, { - ref: ref, - shouldCancelWhenOutside: false - }, /*#__PURE__*/React.createElement(AnimatedRefreshControl, _extends({}, rest, { - onRefresh: onRefresh, - animatedProps: animatedProps - }))); -}); -const BottomSheetRefreshControl = /*#__PURE__*/memo(BottomSheetRefreshControlComponent); -BottomSheetRefreshControl.displayName = 'BottomSheetRefreshControl'; -export default BottomSheetRefreshControl; -//# sourceMappingURL=BottomSheetRefreshControl.android.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.js.map b/lib/module/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.js.map deleted file mode 100644 index 4a970b372..000000000 --- a/lib/module/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheetRefreshControl.android.tsx"],"names":["React","forwardRef","memo","RefreshControl","NativeViewGestureHandler","Animated","useAnimatedProps","SCROLLABLE_STATE","useBottomSheetInternal","AnimatedRefreshControl","createAnimatedComponent","BottomSheetRefreshControlComponent","onRefresh","rest","ref","animatedScrollableState","animatedProps","enabled","value","UNLOCKED","BottomSheetRefreshControl","displayName"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,UAAhB,EAA4BC,IAA5B,QAAwC,OAAxC;AACA,SAASC,cAAT,QAAoD,cAApD;AACA,SAASC,wBAAT,QAAyC,8BAAzC;AACA,OAAOC,QAAP,IAAmBC,gBAAnB,QAA2C,yBAA3C;AACA,SAASC,gBAAT,QAAiC,iBAAjC;AACA,SAASC,sBAAT,QAAuC,aAAvC;AAEA,MAAMC,sBAAsB,GAAGJ,QAAQ,CAACK,uBAAT,CAAiCP,cAAjC,CAA/B;AAEA,MAAMQ,kCAAkC,gBAAGV,UAAU,CAGnD,CAAC;AAAEW,EAAAA,SAAF;AAAa,KAAGC;AAAhB,CAAD,EAAyBC,GAAzB,KAAiC;AACjC;AACA,QAAM;AAAEC,IAAAA;AAAF,MAA8BP,sBAAsB,EAA1D,CAFiC,CAIjC;;AACA,QAAMQ,aAAa,GAAGV,gBAAgB,CAAC,OAAO;AAC5CW,IAAAA,OAAO,EAAEF,uBAAuB,CAACG,KAAxB,KAAkCX,gBAAgB,CAACY;AADhB,GAAP,CAAD,CAAtC,CALiC,CASjC;;AACA,sBACE,oBAAC,wBAAD;AAA0B,IAAA,GAAG,EAAEL,GAA/B;AAAoC,IAAA,uBAAuB,EAAE;AAA7D,kBACE,oBAAC,sBAAD,eACMD,IADN;AAEE,IAAA,SAAS,EAAED,SAFb;AAGE,IAAA,aAAa,EAAEI;AAHjB,KADF,CADF;AASD,CAtBoD,CAArD;AAwBA,MAAMI,yBAAyB,gBAAGlB,IAAI,CAACS,kCAAD,CAAtC;AACAS,yBAAyB,CAACC,WAA1B,GAAwC,2BAAxC;AAEA,eAAeD,yBAAf","sourcesContent":["import React, { forwardRef, memo } from 'react';\nimport { RefreshControl, RefreshControlProps } from 'react-native';\nimport { NativeViewGestureHandler } from 'react-native-gesture-handler';\nimport Animated, { useAnimatedProps } from 'react-native-reanimated';\nimport { SCROLLABLE_STATE } from '../../constants';\nimport { useBottomSheetInternal } from '../../hooks';\n\nconst AnimatedRefreshControl = Animated.createAnimatedComponent(RefreshControl);\n\nconst BottomSheetRefreshControlComponent = forwardRef<\n NativeViewGestureHandler,\n RefreshControlProps\n>(({ onRefresh, ...rest }, ref) => {\n // hooks\n const { animatedScrollableState } = useBottomSheetInternal();\n\n // variables\n const animatedProps = useAnimatedProps(() => ({\n enabled: animatedScrollableState.value === SCROLLABLE_STATE.UNLOCKED,\n }));\n\n // render\n return (\n \n \n \n );\n});\n\nconst BottomSheetRefreshControl = memo(BottomSheetRefreshControlComponent);\nBottomSheetRefreshControl.displayName = 'BottomSheetRefreshControl';\n\nexport default BottomSheetRefreshControl;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetRefreshControl/BottomSheetRefreshControl.js b/lib/module/components/bottomSheetRefreshControl/BottomSheetRefreshControl.js deleted file mode 100644 index 7b9fb2511..000000000 --- a/lib/module/components/bottomSheetRefreshControl/BottomSheetRefreshControl.js +++ /dev/null @@ -1,2 +0,0 @@ -export default (() => null); -//# sourceMappingURL=BottomSheetRefreshControl.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetRefreshControl/BottomSheetRefreshControl.js.map b/lib/module/components/bottomSheetRefreshControl/BottomSheetRefreshControl.js.map deleted file mode 100644 index bbcb4623b..000000000 --- a/lib/module/components/bottomSheetRefreshControl/BottomSheetRefreshControl.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheetRefreshControl.tsx"],"names":[],"mappings":"AAAA,gBAAe,MAAM,IAArB","sourcesContent":["export default () => null;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetRefreshControl/index.js b/lib/module/components/bottomSheetRefreshControl/index.js deleted file mode 100644 index bba4151b7..000000000 --- a/lib/module/components/bottomSheetRefreshControl/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import BottomSheetRefreshControl from './BottomSheetRefreshControl'; -export default BottomSheetRefreshControl; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetRefreshControl/index.js.map b/lib/module/components/bottomSheetRefreshControl/index.js.map deleted file mode 100644 index be8cf517e..000000000 --- a/lib/module/components/bottomSheetRefreshControl/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":["BottomSheetRefreshControl"],"mappings":"AAGA,OAAOA,yBAAP,MAAsC,6BAAtC;AAEA,eAAeA,yBAAf","sourcesContent":["import type React from 'react';\nimport type { RefreshControlProps } from 'react-native';\nimport type { NativeViewGestureHandlerProps } from 'react-native-gesture-handler';\nimport BottomSheetRefreshControl from './BottomSheetRefreshControl';\n\nexport default BottomSheetRefreshControl as any as React.MemoExoticComponent<\n React.ForwardRefExoticComponent<\n RefreshControlProps & {\n children: React.ReactNode | React.ReactNode[];\n } & React.RefAttributes<\n React.ComponentType<\n NativeViewGestureHandlerProps & React.RefAttributes\n >\n >\n >\n>;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetScrollable/BottomSheetFlatList.js b/lib/module/components/bottomSheetScrollable/BottomSheetFlatList.js deleted file mode 100644 index 85c1388af..000000000 --- a/lib/module/components/bottomSheetScrollable/BottomSheetFlatList.js +++ /dev/null @@ -1,11 +0,0 @@ -import { memo } from 'react'; -import { FlatList as RNFlatList } from 'react-native'; -import Animated from 'react-native-reanimated'; -import { SCROLLABLE_TYPE } from '../../constants'; -import { createBottomSheetScrollableComponent } from './createBottomSheetScrollableComponent'; -const AnimatedFlatList = Animated.createAnimatedComponent(RNFlatList); -const BottomSheetFlatListComponent = createBottomSheetScrollableComponent(SCROLLABLE_TYPE.FLATLIST, AnimatedFlatList); -const BottomSheetFlatList = /*#__PURE__*/memo(BottomSheetFlatListComponent); -BottomSheetFlatList.displayName = 'BottomSheetFlatList'; -export default BottomSheetFlatList; -//# sourceMappingURL=BottomSheetFlatList.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetScrollable/BottomSheetFlatList.js.map b/lib/module/components/bottomSheetScrollable/BottomSheetFlatList.js.map deleted file mode 100644 index 69c5cb712..000000000 --- a/lib/module/components/bottomSheetScrollable/BottomSheetFlatList.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheetFlatList.tsx"],"names":["memo","FlatList","RNFlatList","Animated","SCROLLABLE_TYPE","createBottomSheetScrollableComponent","AnimatedFlatList","createAnimatedComponent","BottomSheetFlatListComponent","FLATLIST","BottomSheetFlatList","displayName"],"mappings":"AAAA,SAASA,IAAT,QAAqB,OAArB;AACA,SACEC,QAAQ,IAAIC,UADd,QAGO,cAHP;AAIA,OAAOC,QAAP,MAAqB,yBAArB;AACA,SAASC,eAAT,QAAgC,iBAAhC;AACA,SAASC,oCAAT,QAAqD,wCAArD;AAMA,MAAMC,gBAAgB,GACpBH,QAAQ,CAACI,uBAAT,CAAuDL,UAAvD,CADF;AAGA,MAAMM,4BAA4B,GAAGH,oCAAoC,CAGvED,eAAe,CAACK,QAHuD,EAG7CH,gBAH6C,CAAzE;AAKA,MAAMI,mBAAmB,gBAAGV,IAAI,CAACQ,4BAAD,CAAhC;AACAE,mBAAmB,CAACC,WAApB,GAAkC,qBAAlC;AAEA,eAAeD,mBAAf","sourcesContent":["import { memo } from 'react';\nimport {\n FlatList as RNFlatList,\n FlatListProps as RNFlatListProps,\n} from 'react-native';\nimport Animated from 'react-native-reanimated';\nimport { SCROLLABLE_TYPE } from '../../constants';\nimport { createBottomSheetScrollableComponent } from './createBottomSheetScrollableComponent';\nimport type {\n BottomSheetFlatListMethods,\n BottomSheetFlatListProps,\n} from './types';\n\nconst AnimatedFlatList =\n Animated.createAnimatedComponent>(RNFlatList);\n\nconst BottomSheetFlatListComponent = createBottomSheetScrollableComponent<\n BottomSheetFlatListMethods,\n BottomSheetFlatListProps\n>(SCROLLABLE_TYPE.FLATLIST, AnimatedFlatList);\n\nconst BottomSheetFlatList = memo(BottomSheetFlatListComponent);\nBottomSheetFlatList.displayName = 'BottomSheetFlatList';\n\nexport default BottomSheetFlatList as (\n props: BottomSheetFlatListProps\n) => ReturnType;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetScrollable/BottomSheetScrollView.js b/lib/module/components/bottomSheetScrollable/BottomSheetScrollView.js deleted file mode 100644 index 38907fd58..000000000 --- a/lib/module/components/bottomSheetScrollable/BottomSheetScrollView.js +++ /dev/null @@ -1,11 +0,0 @@ -import { memo } from 'react'; -import { ScrollView as RNScrollView } from 'react-native'; -import Animated from 'react-native-reanimated'; -import { SCROLLABLE_TYPE } from '../../constants'; -import { createBottomSheetScrollableComponent } from './createBottomSheetScrollableComponent'; -const AnimatedScrollView = Animated.createAnimatedComponent(RNScrollView); -const BottomSheetScrollViewComponent = createBottomSheetScrollableComponent(SCROLLABLE_TYPE.SCROLLVIEW, AnimatedScrollView); -const BottomSheetScrollView = /*#__PURE__*/memo(BottomSheetScrollViewComponent); -BottomSheetScrollView.displayName = 'BottomSheetScrollView'; -export default BottomSheetScrollView; -//# sourceMappingURL=BottomSheetScrollView.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetScrollable/BottomSheetScrollView.js.map b/lib/module/components/bottomSheetScrollable/BottomSheetScrollView.js.map deleted file mode 100644 index 76214e75a..000000000 --- a/lib/module/components/bottomSheetScrollable/BottomSheetScrollView.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheetScrollView.tsx"],"names":["memo","ScrollView","RNScrollView","Animated","SCROLLABLE_TYPE","createBottomSheetScrollableComponent","AnimatedScrollView","createAnimatedComponent","BottomSheetScrollViewComponent","SCROLLVIEW","BottomSheetScrollView","displayName"],"mappings":"AAAA,SAASA,IAAT,QAAqB,OAArB;AACA,SACEC,UAAU,IAAIC,YADhB,QAGO,cAHP;AAIA,OAAOC,QAAP,MAAqB,yBAArB;AACA,SAASC,eAAT,QAAgC,iBAAhC;AACA,SAASC,oCAAT,QAAqD,wCAArD;AAMA,MAAMC,kBAAkB,GACtBH,QAAQ,CAACI,uBAAT,CAAoDL,YAApD,CADF;AAGA,MAAMM,8BAA8B,GAAGH,oCAAoC,CAGzED,eAAe,CAACK,UAHyD,EAG7CH,kBAH6C,CAA3E;AAKA,MAAMI,qBAAqB,gBAAGV,IAAI,CAACQ,8BAAD,CAAlC;AACAE,qBAAqB,CAACC,WAAtB,GAAoC,uBAApC;AAEA,eAAeD,qBAAf","sourcesContent":["import { memo } from 'react';\nimport {\n ScrollView as RNScrollView,\n ScrollViewProps as RNScrollViewProps,\n} from 'react-native';\nimport Animated from 'react-native-reanimated';\nimport { SCROLLABLE_TYPE } from '../../constants';\nimport { createBottomSheetScrollableComponent } from './createBottomSheetScrollableComponent';\nimport type {\n BottomSheetScrollViewMethods,\n BottomSheetScrollViewProps,\n} from './types';\n\nconst AnimatedScrollView =\n Animated.createAnimatedComponent(RNScrollView);\n\nconst BottomSheetScrollViewComponent = createBottomSheetScrollableComponent<\n BottomSheetScrollViewMethods,\n BottomSheetScrollViewProps\n>(SCROLLABLE_TYPE.SCROLLVIEW, AnimatedScrollView);\n\nconst BottomSheetScrollView = memo(BottomSheetScrollViewComponent);\nBottomSheetScrollView.displayName = 'BottomSheetScrollView';\n\nexport default BottomSheetScrollView as (\n props: BottomSheetScrollViewProps\n) => ReturnType;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetScrollable/BottomSheetSectionList.js b/lib/module/components/bottomSheetScrollable/BottomSheetSectionList.js deleted file mode 100644 index 6517c9013..000000000 --- a/lib/module/components/bottomSheetScrollable/BottomSheetSectionList.js +++ /dev/null @@ -1,11 +0,0 @@ -import { memo } from 'react'; -import { SectionList as RNSectionList } from 'react-native'; -import Animated from 'react-native-reanimated'; -import { SCROLLABLE_TYPE } from '../../constants'; -import { createBottomSheetScrollableComponent } from './createBottomSheetScrollableComponent'; -const AnimatedSectionList = Animated.createAnimatedComponent(RNSectionList); -const BottomSheetSectionListComponent = createBottomSheetScrollableComponent(SCROLLABLE_TYPE.SECTIONLIST, AnimatedSectionList); -const BottomSheetSectionList = /*#__PURE__*/memo(BottomSheetSectionListComponent); -BottomSheetSectionList.displayName = 'BottomSheetSectionList'; -export default BottomSheetSectionList; -//# sourceMappingURL=BottomSheetSectionList.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetScrollable/BottomSheetSectionList.js.map b/lib/module/components/bottomSheetScrollable/BottomSheetSectionList.js.map deleted file mode 100644 index 6f8f44c6c..000000000 --- a/lib/module/components/bottomSheetScrollable/BottomSheetSectionList.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheetSectionList.tsx"],"names":["memo","SectionList","RNSectionList","Animated","SCROLLABLE_TYPE","createBottomSheetScrollableComponent","AnimatedSectionList","createAnimatedComponent","BottomSheetSectionListComponent","SECTIONLIST","BottomSheetSectionList","displayName"],"mappings":"AAAA,SAASA,IAAT,QAAqB,OAArB;AACA,SAEEC,WAAW,IAAIC,aAFjB,QAIO,cAJP;AAKA,OAAOC,QAAP,MAAqB,yBAArB;AACA,SAASC,eAAT,QAAgC,iBAAhC;AACA,SAASC,oCAAT,QAAqD,wCAArD;AAMA,MAAMC,mBAAmB,GACvBH,QAAQ,CAACI,uBAAT,CAA0DL,aAA1D,CADF;AAGA,MAAMM,+BAA+B,GAAGH,oCAAoC,CAG1ED,eAAe,CAACK,WAH0D,EAG7CH,mBAH6C,CAA5E;AAKA,MAAMI,sBAAsB,gBAAGV,IAAI,CAACQ,+BAAD,CAAnC;AACAE,sBAAsB,CAACC,WAAvB,GAAqC,wBAArC;AAEA,eAAeD,sBAAf","sourcesContent":["import { memo } from 'react';\nimport {\n DefaultSectionT,\n SectionList as RNSectionList,\n SectionListProps as RNSectionListProps,\n} from 'react-native';\nimport Animated from 'react-native-reanimated';\nimport { SCROLLABLE_TYPE } from '../../constants';\nimport { createBottomSheetScrollableComponent } from './createBottomSheetScrollableComponent';\nimport type {\n BottomSheetSectionListMethods,\n BottomSheetSectionListProps,\n} from './types';\n\nconst AnimatedSectionList =\n Animated.createAnimatedComponent>(RNSectionList);\n\nconst BottomSheetSectionListComponent = createBottomSheetScrollableComponent<\n BottomSheetSectionListMethods,\n BottomSheetSectionListProps\n>(SCROLLABLE_TYPE.SECTIONLIST, AnimatedSectionList);\n\nconst BottomSheetSectionList = memo(BottomSheetSectionListComponent);\nBottomSheetSectionList.displayName = 'BottomSheetSectionList';\n\nexport default BottomSheetSectionList as (\n props: BottomSheetSectionListProps\n) => ReturnType;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetScrollable/BottomSheetVirtualizedList.js b/lib/module/components/bottomSheetScrollable/BottomSheetVirtualizedList.js deleted file mode 100644 index a91d87f58..000000000 --- a/lib/module/components/bottomSheetScrollable/BottomSheetVirtualizedList.js +++ /dev/null @@ -1,11 +0,0 @@ -import { memo } from 'react'; -import { VirtualizedList as RNVirtualizedList } from 'react-native'; -import Animated from 'react-native-reanimated'; -import { SCROLLABLE_TYPE } from '../../constants'; -import { createBottomSheetScrollableComponent } from './createBottomSheetScrollableComponent'; -const AnimatedVirtualizedList = Animated.createAnimatedComponent(RNVirtualizedList); -const BottomSheetVirtualizedListComponent = createBottomSheetScrollableComponent(SCROLLABLE_TYPE.VIRTUALIZEDLIST, AnimatedVirtualizedList); -const BottomSheetVirtualizedList = /*#__PURE__*/memo(BottomSheetVirtualizedListComponent); -BottomSheetVirtualizedList.displayName = 'BottomSheetVirtualizedList'; -export default BottomSheetVirtualizedList; -//# sourceMappingURL=BottomSheetVirtualizedList.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetScrollable/BottomSheetVirtualizedList.js.map b/lib/module/components/bottomSheetScrollable/BottomSheetVirtualizedList.js.map deleted file mode 100644 index 171a27a55..000000000 --- a/lib/module/components/bottomSheetScrollable/BottomSheetVirtualizedList.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheetVirtualizedList.tsx"],"names":["memo","VirtualizedList","RNVirtualizedList","Animated","SCROLLABLE_TYPE","createBottomSheetScrollableComponent","AnimatedVirtualizedList","createAnimatedComponent","BottomSheetVirtualizedListComponent","VIRTUALIZEDLIST","BottomSheetVirtualizedList","displayName"],"mappings":"AAAA,SAASA,IAAT,QAAqB,OAArB;AACA,SACEC,eAAe,IAAIC,iBADrB,QAGO,cAHP;AAIA,OAAOC,QAAP,MAAqB,yBAArB;AACA,SAASC,eAAT,QAAgC,iBAAhC;AACA,SAASC,oCAAT,QAAqD,wCAArD;AAMA,MAAMC,uBAAuB,GAC3BH,QAAQ,CAACI,uBAAT,CACEL,iBADF,CADF;AAKA,MAAMM,mCAAmC,GACvCH,oCAAoC,CAGlCD,eAAe,CAACK,eAHkB,EAGDH,uBAHC,CADtC;AAMA,MAAMI,0BAA0B,gBAAGV,IAAI,CAACQ,mCAAD,CAAvC;AACAE,0BAA0B,CAACC,WAA3B,GAAyC,4BAAzC;AAEA,eAAeD,0BAAf","sourcesContent":["import { memo } from 'react';\nimport {\n VirtualizedList as RNVirtualizedList,\n VirtualizedListProps as RNVirtualizedListProps,\n} from 'react-native';\nimport Animated from 'react-native-reanimated';\nimport { SCROLLABLE_TYPE } from '../../constants';\nimport { createBottomSheetScrollableComponent } from './createBottomSheetScrollableComponent';\nimport type {\n BottomSheetVirtualizedListMethods,\n BottomSheetVirtualizedListProps,\n} from './types';\n\nconst AnimatedVirtualizedList =\n Animated.createAnimatedComponent>(\n RNVirtualizedList\n );\n\nconst BottomSheetVirtualizedListComponent =\n createBottomSheetScrollableComponent<\n BottomSheetVirtualizedListMethods,\n BottomSheetVirtualizedListProps\n >(SCROLLABLE_TYPE.VIRTUALIZEDLIST, AnimatedVirtualizedList);\n\nconst BottomSheetVirtualizedList = memo(BottomSheetVirtualizedListComponent);\nBottomSheetVirtualizedList.displayName = 'BottomSheetVirtualizedList';\n\nexport default BottomSheetVirtualizedList as (\n props: BottomSheetVirtualizedListProps\n) => ReturnType;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetScrollable/createBottomSheetScrollableComponent.js b/lib/module/components/bottomSheetScrollable/createBottomSheetScrollableComponent.js deleted file mode 100644 index 83abb5601..000000000 --- a/lib/module/components/bottomSheetScrollable/createBottomSheetScrollableComponent.js +++ /dev/null @@ -1,140 +0,0 @@ -function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } - -import React, { forwardRef, useImperativeHandle, useMemo, useRef } from 'react'; -import { Platform } from 'react-native'; -import { useAnimatedProps, useAnimatedStyle } from 'react-native-reanimated'; -import { NativeViewGestureHandler } from 'react-native-gesture-handler'; -import BottomSheetDraggableView from '../bottomSheetDraggableView'; -import BottomSheetRefreshControl from '../bottomSheetRefreshControl'; -import { useScrollHandler, useScrollableSetter, useBottomSheetInternal, useStableCallback } from '../../hooks'; -import { GESTURE_SOURCE, SCROLLABLE_DECELERATION_RATE_MAPPER, SCROLLABLE_STATE } from '../../constants'; -import { styles } from './styles'; -export function createBottomSheetScrollableComponent(type, ScrollableComponent) { - return /*#__PURE__*/forwardRef((props, ref) => { - // props - const { - // hooks - focusHook, - scrollEventsHandlersHook, - // props - enableFooterMarginAdjustment = false, - overScrollMode = 'never', - keyboardDismissMode = 'interactive', - showsVerticalScrollIndicator = true, - style, - refreshing, - onRefresh, - progressViewOffset, - refreshControl, - // events - onScroll, - onScrollBeginDrag, - onScrollEndDrag, - onContentSizeChange, - ...rest - } = props; //#region refs - - const nativeGestureRef = useRef(null); - const refreshControlGestureRef = useRef(null); //#endregion - //#region hooks - - const { - scrollableRef, - scrollableContentOffsetY, - scrollHandler - } = useScrollHandler(scrollEventsHandlersHook, onScroll, onScrollBeginDrag, onScrollEndDrag); - const { - enableContentPanningGesture, - animatedFooterHeight, - animatedScrollableState, - animatedContentHeight, - enableDynamicSizing - } = useBottomSheetInternal(); //#endregion - //#region variables - - const scrollableAnimatedProps = useAnimatedProps(() => ({ - decelerationRate: SCROLLABLE_DECELERATION_RATE_MAPPER[animatedScrollableState.value], - showsVerticalScrollIndicator: showsVerticalScrollIndicator ? animatedScrollableState.value === SCROLLABLE_STATE.UNLOCKED : showsVerticalScrollIndicator - }), [showsVerticalScrollIndicator]); //#endregion - //#region callbacks - - const handleContentSizeChange = useStableCallback((contentWidth, contentHeight) => { - if (enableDynamicSizing) { - animatedContentHeight.value = contentHeight; - } - - if (onContentSizeChange) { - onContentSizeChange(contentWidth, contentHeight); - } - }); //#endregion - //#region styles - - const containerAnimatedStyle = useAnimatedStyle(() => ({ - marginBottom: enableFooterMarginAdjustment ? animatedFooterHeight.value : 0 - }), [enableFooterMarginAdjustment]); - const containerStyle = useMemo(() => { - return enableFooterMarginAdjustment ? [...(style ? 'length' in style ? style : [style] : []), containerAnimatedStyle] : style; - }, [enableFooterMarginAdjustment, style, containerAnimatedStyle]); //#endregion - //#region effects - // @ts-ignore - - useImperativeHandle(ref, () => scrollableRef.current); - useScrollableSetter(scrollableRef, type, scrollableContentOffsetY, onRefresh !== undefined, focusHook); //#endregion - //#region render - - if (Platform.OS === 'android') { - const scrollableContent = /*#__PURE__*/React.createElement(NativeViewGestureHandler, { - ref: nativeGestureRef, - enabled: enableContentPanningGesture, - shouldCancelWhenOutside: false - }, /*#__PURE__*/React.createElement(ScrollableComponent, _extends({ - animatedProps: scrollableAnimatedProps - }, rest, { - scrollEventThrottle: 16, - ref: scrollableRef, - overScrollMode: overScrollMode, - keyboardDismissMode: keyboardDismissMode, - onScroll: scrollHandler, - onContentSizeChange: handleContentSizeChange, - style: containerStyle - }))); - return /*#__PURE__*/React.createElement(BottomSheetDraggableView, { - nativeGestureRef: nativeGestureRef, - refreshControlGestureRef: refreshControlGestureRef, - gestureType: GESTURE_SOURCE.SCROLLABLE, - style: styles.container - }, onRefresh ? /*#__PURE__*/React.createElement(BottomSheetRefreshControl, { - ref: refreshControlGestureRef, - refreshing: refreshing, - onRefresh: onRefresh, - progressViewOffset: progressViewOffset, - style: styles.container - }, scrollableContent) : scrollableContent); - } - - return /*#__PURE__*/React.createElement(BottomSheetDraggableView, { - nativeGestureRef: nativeGestureRef, - gestureType: GESTURE_SOURCE.SCROLLABLE, - style: styles.container - }, /*#__PURE__*/React.createElement(NativeViewGestureHandler, { - ref: nativeGestureRef, - enabled: enableContentPanningGesture, - shouldCancelWhenOutside: false - }, /*#__PURE__*/React.createElement(ScrollableComponent, _extends({ - animatedProps: scrollableAnimatedProps - }, rest, { - scrollEventThrottle: 16, - ref: scrollableRef, - overScrollMode: overScrollMode, - keyboardDismissMode: keyboardDismissMode, - refreshing: refreshing, - onRefresh: onRefresh, - progressViewOffset: progressViewOffset, - refreshControl: refreshControl, - onScroll: scrollHandler, - onContentSizeChange: handleContentSizeChange, - style: containerStyle - })))); //#endregion - }); -} -//# sourceMappingURL=createBottomSheetScrollableComponent.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetScrollable/createBottomSheetScrollableComponent.js.map b/lib/module/components/bottomSheetScrollable/createBottomSheetScrollableComponent.js.map deleted file mode 100644 index 301f43be5..000000000 --- a/lib/module/components/bottomSheetScrollable/createBottomSheetScrollableComponent.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["createBottomSheetScrollableComponent.tsx"],"names":["React","forwardRef","useImperativeHandle","useMemo","useRef","Platform","useAnimatedProps","useAnimatedStyle","NativeViewGestureHandler","BottomSheetDraggableView","BottomSheetRefreshControl","useScrollHandler","useScrollableSetter","useBottomSheetInternal","useStableCallback","GESTURE_SOURCE","SCROLLABLE_DECELERATION_RATE_MAPPER","SCROLLABLE_STATE","styles","createBottomSheetScrollableComponent","type","ScrollableComponent","props","ref","focusHook","scrollEventsHandlersHook","enableFooterMarginAdjustment","overScrollMode","keyboardDismissMode","showsVerticalScrollIndicator","style","refreshing","onRefresh","progressViewOffset","refreshControl","onScroll","onScrollBeginDrag","onScrollEndDrag","onContentSizeChange","rest","nativeGestureRef","refreshControlGestureRef","scrollableRef","scrollableContentOffsetY","scrollHandler","enableContentPanningGesture","animatedFooterHeight","animatedScrollableState","animatedContentHeight","enableDynamicSizing","scrollableAnimatedProps","decelerationRate","value","UNLOCKED","handleContentSizeChange","contentWidth","contentHeight","containerAnimatedStyle","marginBottom","containerStyle","current","undefined","OS","scrollableContent","SCROLLABLE","container"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,UAAhB,EAA4BC,mBAA5B,EAAiDC,OAAjD,EAA0DC,MAA1D,QAAwE,OAAxE;AACA,SAASC,QAAT,QAAyB,cAAzB;AACA,SAASC,gBAAT,EAA2BC,gBAA3B,QAAmD,yBAAnD;AACA,SAASC,wBAAT,QAAyC,8BAAzC;AACA,OAAOC,wBAAP,MAAqC,6BAArC;AACA,OAAOC,yBAAP,MAAsC,8BAAtC;AACA,SACEC,gBADF,EAEEC,mBAFF,EAGEC,sBAHF,EAIEC,iBAJF,QAKO,aALP;AAMA,SACEC,cADF,EAEEC,mCAFF,EAGEC,gBAHF,QAKO,iBALP;AAMA,SAASC,MAAT,QAAuB,UAAvB;AAEA,OAAO,SAASC,oCAAT,CACLC,IADK,EAELC,mBAFK,EAGL;AACA,sBAAOpB,UAAU,CAAO,CAACqB,KAAD,EAAQC,GAAR,KAAgB;AACtC;AACA,UAAM;AACJ;AACAC,MAAAA,SAFI;AAGJC,MAAAA,wBAHI;AAIJ;AACAC,MAAAA,4BAA4B,GAAG,KAL3B;AAMJC,MAAAA,cAAc,GAAG,OANb;AAOJC,MAAAA,mBAAmB,GAAG,aAPlB;AAQJC,MAAAA,4BAA4B,GAAG,IAR3B;AASJC,MAAAA,KATI;AAUJC,MAAAA,UAVI;AAWJC,MAAAA,SAXI;AAYJC,MAAAA,kBAZI;AAaJC,MAAAA,cAbI;AAcJ;AACAC,MAAAA,QAfI;AAgBJC,MAAAA,iBAhBI;AAiBJC,MAAAA,eAjBI;AAkBJC,MAAAA,mBAlBI;AAmBJ,SAAGC;AAnBC,QAoBGjB,KApBT,CAFsC,CAwBtC;;AACA,UAAMkB,gBAAgB,GAAGpC,MAAM,CAA2B,IAA3B,CAA/B;AACA,UAAMqC,wBAAwB,GAAGrC,MAAM,CAA2B,IAA3B,CAAvC,CA1BsC,CA2Bt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AGE,QAAA,SAAS,EAAEC,SAHb;AAIE,QAAA,kBAAkB,EAAEC,kBAJtB;AAKE,QAAA,KAAK,EAAEf,MAAM,CAAC+C;AALhB,SAOGF,iBAPH,CADQ,GAWRA,iBAjBJ,CADF;AAsBD;;AACD,wBACE,oBAAC,wBAAD;AACE,MAAA,gBAAgB,EAAEvB,gBADpB;AAEE,MAAA,WAAW,EAAEzB,cAAc,CAACiD,UAF9B;AAGE,MAAA,KAAK,EAAE9C,MAAM,CAAC+C;AAHhB,oBAKE,oBAAC,wBAAD;AACE,MAAA,GAAG,EAAEzB,gBADP;AAEE,MAAA,OAAO,EAAEK,2BAFX;AAGE,MAAA,uBAAuB,EAAE;AAH3B,oBAKE,oBAAC,mBAAD;AACE,MAAA,aAAa,EAAEK;AADjB,OAEMX,IAFN;AAGE,MAAA,mBAAmB,EAAE,EAHvB;AAIE,MAAA,GAAG,EAAEG,aAJP;AAKE,MAAA,cAAc,EAAEf,cALlB;AAME,MAAA,mBAAmB,EAAEC,mBANvB;AAOE,MAAA,UAAU,EAAEG,UAPd;AAQE,MAAA,SAAS,EAAEC,SARb;AASE,MAAA,kBAAkB,EAAEC,kBATtB;AAUE,MAAA,cAAc,EAAEC,cAVlB;AAWE,MAAA,QAAQ,EAAEU,aAXZ;AAYE,MAAA,mBAAmB,EAAEU,uBAZvB;AAaE,MAAA,KAAK,EAAEK;AAbT,OALF,CALF,CADF,CApJsC,CAiLtC;AACD,GAlLgB,CAAjB;AAmLD","sourcesContent":["import React, { forwardRef, useImperativeHandle, useMemo, useRef } from 'react';\nimport { Platform } from 'react-native';\nimport { useAnimatedProps, useAnimatedStyle } from 'react-native-reanimated';\nimport { NativeViewGestureHandler } from 'react-native-gesture-handler';\nimport BottomSheetDraggableView from '../bottomSheetDraggableView';\nimport BottomSheetRefreshControl from '../bottomSheetRefreshControl';\nimport {\n useScrollHandler,\n useScrollableSetter,\n useBottomSheetInternal,\n useStableCallback,\n} from '../../hooks';\nimport {\n GESTURE_SOURCE,\n SCROLLABLE_DECELERATION_RATE_MAPPER,\n SCROLLABLE_STATE,\n SCROLLABLE_TYPE,\n} from '../../constants';\nimport { styles } from './styles';\n\nexport function createBottomSheetScrollableComponent(\n type: SCROLLABLE_TYPE,\n ScrollableComponent: any\n) {\n return forwardRef((props, ref) => {\n // props\n const {\n // hooks\n focusHook,\n scrollEventsHandlersHook,\n // props\n enableFooterMarginAdjustment = false,\n overScrollMode = 'never',\n keyboardDismissMode = 'interactive',\n showsVerticalScrollIndicator = true,\n style,\n refreshing,\n onRefresh,\n progressViewOffset,\n refreshControl,\n // events\n onScroll,\n onScrollBeginDrag,\n onScrollEndDrag,\n onContentSizeChange,\n ...rest\n }: any = props;\n\n //#region refs\n const nativeGestureRef = useRef(null);\n const refreshControlGestureRef = useRef(null);\n //#endregion\n\n //#region hooks\n const { scrollableRef, scrollableContentOffsetY, scrollHandler } =\n useScrollHandler(\n scrollEventsHandlersHook,\n onScroll,\n onScrollBeginDrag,\n onScrollEndDrag\n );\n const {\n enableContentPanningGesture,\n animatedFooterHeight,\n animatedScrollableState,\n animatedContentHeight,\n enableDynamicSizing,\n } = useBottomSheetInternal();\n //#endregion\n\n //#region variables\n const scrollableAnimatedProps = useAnimatedProps(\n () => ({\n decelerationRate:\n SCROLLABLE_DECELERATION_RATE_MAPPER[animatedScrollableState.value],\n showsVerticalScrollIndicator: showsVerticalScrollIndicator\n ? animatedScrollableState.value === SCROLLABLE_STATE.UNLOCKED\n : showsVerticalScrollIndicator,\n }),\n [showsVerticalScrollIndicator]\n );\n //#endregion\n\n //#region callbacks\n const handleContentSizeChange = useStableCallback(\n (contentWidth: number, contentHeight: number) => {\n if (enableDynamicSizing) {\n animatedContentHeight.value = contentHeight;\n }\n\n if (onContentSizeChange) {\n onContentSizeChange(contentWidth, contentHeight);\n }\n }\n );\n //#endregion\n\n //#region styles\n const containerAnimatedStyle = useAnimatedStyle(\n () => ({\n marginBottom: enableFooterMarginAdjustment\n ? animatedFooterHeight.value\n : 0,\n }),\n [enableFooterMarginAdjustment]\n );\n const containerStyle = useMemo(() => {\n return enableFooterMarginAdjustment\n ? [\n ...(style ? ('length' in style ? style : [style]) : []),\n containerAnimatedStyle,\n ]\n : style;\n }, [enableFooterMarginAdjustment, style, containerAnimatedStyle]);\n //#endregion\n\n //#region effects\n // @ts-ignore\n useImperativeHandle(ref, () => scrollableRef.current);\n useScrollableSetter(\n scrollableRef,\n type,\n scrollableContentOffsetY,\n onRefresh !== undefined,\n focusHook\n );\n //#endregion\n\n //#region render\n if (Platform.OS === 'android') {\n const scrollableContent = (\n \n \n \n );\n return (\n \n {onRefresh ? (\n \n {scrollableContent}\n \n ) : (\n scrollableContent\n )}\n \n );\n }\n return (\n \n \n \n \n \n );\n //#endregion\n });\n}\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetScrollable/index.js b/lib/module/components/bottomSheetScrollable/index.js deleted file mode 100644 index 3319ed0a4..000000000 --- a/lib/module/components/bottomSheetScrollable/index.js +++ /dev/null @@ -1,6 +0,0 @@ -export { createBottomSheetScrollableComponent } from './createBottomSheetScrollableComponent'; -export { default as BottomSheetSectionList } from './BottomSheetSectionList'; -export { default as BottomSheetFlatList } from './BottomSheetFlatList'; -export { default as BottomSheetScrollView } from './BottomSheetScrollView'; -export { default as BottomSheetVirtualizedList } from './BottomSheetVirtualizedList'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetScrollable/index.js.map b/lib/module/components/bottomSheetScrollable/index.js.map deleted file mode 100644 index 304fab661..000000000 --- a/lib/module/components/bottomSheetScrollable/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":["createBottomSheetScrollableComponent","default","BottomSheetSectionList","BottomSheetFlatList","BottomSheetScrollView","BottomSheetVirtualizedList"],"mappings":"AAAA,SAASA,oCAAT,QAAqD,wCAArD;AACA,SAASC,OAAO,IAAIC,sBAApB,QAAkD,0BAAlD;AACA,SAASD,OAAO,IAAIE,mBAApB,QAA+C,uBAA/C;AACA,SAASF,OAAO,IAAIG,qBAApB,QAAiD,yBAAjD;AACA,SAASH,OAAO,IAAII,0BAApB,QAAsD,8BAAtD","sourcesContent":["export { createBottomSheetScrollableComponent } from './createBottomSheetScrollableComponent';\nexport { default as BottomSheetSectionList } from './BottomSheetSectionList';\nexport { default as BottomSheetFlatList } from './BottomSheetFlatList';\nexport { default as BottomSheetScrollView } from './BottomSheetScrollView';\nexport { default as BottomSheetVirtualizedList } from './BottomSheetVirtualizedList';\n\nexport type {\n BottomSheetFlatListMethods,\n BottomSheetScrollViewMethods,\n BottomSheetSectionListMethods,\n BottomSheetVirtualizedListMethods,\n BottomSheetScrollableProps,\n} from './types';\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetScrollable/styles.js b/lib/module/components/bottomSheetScrollable/styles.js deleted file mode 100644 index 3a7343f35..000000000 --- a/lib/module/components/bottomSheetScrollable/styles.js +++ /dev/null @@ -1,8 +0,0 @@ -import { StyleSheet } from 'react-native'; -export const styles = StyleSheet.create({ - container: { - flex: 1, - overflow: 'visible' - } -}); -//# sourceMappingURL=styles.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetScrollable/styles.js.map b/lib/module/components/bottomSheetScrollable/styles.js.map deleted file mode 100644 index 12239dad5..000000000 --- a/lib/module/components/bottomSheetScrollable/styles.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["styles.ts"],"names":["StyleSheet","styles","create","container","flex","overflow"],"mappings":"AAAA,SAASA,UAAT,QAA2B,cAA3B;AAEA,OAAO,MAAMC,MAAM,GAAGD,UAAU,CAACE,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE;AACTC,IAAAA,IAAI,EAAE,CADG;AAETC,IAAAA,QAAQ,EAAE;AAFD;AAD2B,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\n\nexport const styles = StyleSheet.create({\n container: {\n flex: 1,\n overflow: 'visible',\n },\n});\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetTextInput/BottomSheetTextInput.js b/lib/module/components/bottomSheetTextInput/BottomSheetTextInput.js deleted file mode 100644 index d98f469a3..000000000 --- a/lib/module/components/bottomSheetTextInput/BottomSheetTextInput.js +++ /dev/null @@ -1,47 +0,0 @@ -function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } - -import React, { memo, useCallback, forwardRef, useEffect } from 'react'; -import { TextInput } from 'react-native-gesture-handler'; -import { useBottomSheetInternal } from '../../hooks'; -const BottomSheetTextInputComponent = /*#__PURE__*/forwardRef(({ - onFocus, - onBlur, - ...rest -}, ref) => { - //#region hooks - const { - shouldHandleKeyboardEvents - } = useBottomSheetInternal(); - useEffect(() => { - return () => { - // Reset the flag on unmount - shouldHandleKeyboardEvents.value = false; - }; - }, [shouldHandleKeyboardEvents]); //#endregion - //#region callbacks - - const handleOnFocus = useCallback(args => { - shouldHandleKeyboardEvents.value = true; - - if (onFocus) { - onFocus(args); - } - }, [onFocus, shouldHandleKeyboardEvents]); - const handleOnBlur = useCallback(args => { - shouldHandleKeyboardEvents.value = false; - - if (onBlur) { - onBlur(args); - } - }, [onBlur, shouldHandleKeyboardEvents]); //#endregion - - return /*#__PURE__*/React.createElement(TextInput, _extends({ - ref: ref, - onFocus: handleOnFocus, - onBlur: handleOnBlur - }, rest)); -}); -const BottomSheetTextInput = /*#__PURE__*/memo(BottomSheetTextInputComponent); -BottomSheetTextInput.displayName = 'BottomSheetTextInput'; -export default BottomSheetTextInput; -//# sourceMappingURL=BottomSheetTextInput.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetTextInput/BottomSheetTextInput.js.map b/lib/module/components/bottomSheetTextInput/BottomSheetTextInput.js.map deleted file mode 100644 index 53df50858..000000000 --- a/lib/module/components/bottomSheetTextInput/BottomSheetTextInput.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheetTextInput.tsx"],"names":["React","memo","useCallback","forwardRef","useEffect","TextInput","useBottomSheetInternal","BottomSheetTextInputComponent","onFocus","onBlur","rest","ref","shouldHandleKeyboardEvents","value","handleOnFocus","args","handleOnBlur","BottomSheetTextInput","displayName"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,IAAhB,EAAsBC,WAAtB,EAAmCC,UAAnC,EAA+CC,SAA/C,QAAgE,OAAhE;AACA,SAASC,SAAT,QAA0B,8BAA1B;AACA,SAASC,sBAAT,QAAuC,aAAvC;AAGA,MAAMC,6BAA6B,gBAAGJ,UAAU,CAG9C,CAAC;AAAEK,EAAAA,OAAF;AAAWC,EAAAA,MAAX;AAAmB,KAAGC;AAAtB,CAAD,EAA+BC,GAA/B,KAAuC;AACvC;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAiCN,sBAAsB,EAA7D;AAEAF,EAAAA,SAAS,CAAC,MAAM;AACd,WAAO,MAAM;AACX;AACAQ,MAAAA,0BAA0B,CAACC,KAA3B,GAAmC,KAAnC;AACD,KAHD;AAID,GALQ,EAKN,CAACD,0BAAD,CALM,CAAT,CAJuC,CAUvC;AAEA;;AACA,QAAME,aAAa,GAAGZ,WAAW,CAC/Ba,IAAI,IAAI;AACNH,IAAAA,0BAA0B,CAACC,KAA3B,GAAmC,IAAnC;;AACA,QAAIL,OAAJ,EAAa;AACXA,MAAAA,OAAO,CAACO,IAAD,CAAP;AACD;AACF,GAN8B,EAO/B,CAACP,OAAD,EAAUI,0BAAV,CAP+B,CAAjC;AASA,QAAMI,YAAY,GAAGd,WAAW,CAC9Ba,IAAI,IAAI;AACNH,IAAAA,0BAA0B,CAACC,KAA3B,GAAmC,KAAnC;;AACA,QAAIJ,MAAJ,EAAY;AACVA,MAAAA,MAAM,CAACM,IAAD,CAAN;AACD;AACF,GAN6B,EAO9B,CAACN,MAAD,EAASG,0BAAT,CAP8B,CAAhC,CAtBuC,CA+BvC;;AAEA,sBACE,oBAAC,SAAD;AACE,IAAA,GAAG,EAAED,GADP;AAEE,IAAA,OAAO,EAAEG,aAFX;AAGE,IAAA,MAAM,EAAEE;AAHV,KAIMN,IAJN,EADF;AAQD,CA5C+C,CAAhD;AA8CA,MAAMO,oBAAoB,gBAAGhB,IAAI,CAACM,6BAAD,CAAjC;AACAU,oBAAoB,CAACC,WAArB,GAAmC,sBAAnC;AAEA,eAAeD,oBAAf","sourcesContent":["import React, { memo, useCallback, forwardRef, useEffect } from 'react';\nimport { TextInput } from 'react-native-gesture-handler';\nimport { useBottomSheetInternal } from '../../hooks';\nimport type { BottomSheetTextInputProps } from './types';\n\nconst BottomSheetTextInputComponent = forwardRef<\n TextInput,\n BottomSheetTextInputProps\n>(({ onFocus, onBlur, ...rest }, ref) => {\n //#region hooks\n const { shouldHandleKeyboardEvents } = useBottomSheetInternal();\n\n useEffect(() => {\n return () => {\n // Reset the flag on unmount\n shouldHandleKeyboardEvents.value = false;\n };\n }, [shouldHandleKeyboardEvents]);\n //#endregion\n\n //#region callbacks\n const handleOnFocus = useCallback(\n args => {\n shouldHandleKeyboardEvents.value = true;\n if (onFocus) {\n onFocus(args);\n }\n },\n [onFocus, shouldHandleKeyboardEvents]\n );\n const handleOnBlur = useCallback(\n args => {\n shouldHandleKeyboardEvents.value = false;\n if (onBlur) {\n onBlur(args);\n }\n },\n [onBlur, shouldHandleKeyboardEvents]\n );\n //#endregion\n\n return (\n \n );\n});\n\nconst BottomSheetTextInput = memo(BottomSheetTextInputComponent);\nBottomSheetTextInput.displayName = 'BottomSheetTextInput';\n\nexport default BottomSheetTextInput;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetTextInput/index.js b/lib/module/components/bottomSheetTextInput/index.js deleted file mode 100644 index 4033c0d23..000000000 --- a/lib/module/components/bottomSheetTextInput/index.js +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './BottomSheetTextInput'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetTextInput/index.js.map b/lib/module/components/bottomSheetTextInput/index.js.map deleted file mode 100644 index c366b3aa9..000000000 --- a/lib/module/components/bottomSheetTextInput/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":["default"],"mappings":"AAAA,SAASA,OAAT,QAAwB,wBAAxB","sourcesContent":["export { default } from './BottomSheetTextInput';\nexport type { BottomSheetTextInputProps } from './types';\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetTextInput/types.js b/lib/module/components/bottomSheetTextInput/types.js deleted file mode 100644 index 718fd38ae..000000000 --- a/lib/module/components/bottomSheetTextInput/types.js +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetTextInput/types.js.map b/lib/module/components/bottomSheetTextInput/types.js.map deleted file mode 100644 index 9ffd4b22f..000000000 --- a/lib/module/components/bottomSheetTextInput/types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetView/BottomSheetView.js b/lib/module/components/bottomSheetView/BottomSheetView.js deleted file mode 100644 index 0eb5afe4a..000000000 --- a/lib/module/components/bottomSheetView/BottomSheetView.js +++ /dev/null @@ -1,73 +0,0 @@ -function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } - -import React, { memo, useEffect, useCallback, useMemo } from 'react'; -import { StyleSheet } from 'react-native'; -import Animated, { useAnimatedStyle } from 'react-native-reanimated'; -import { SCROLLABLE_TYPE } from '../../constants'; -import { useBottomSheetInternal } from '../../hooks'; -import { print } from '../../utilities'; - -function BottomSheetViewComponent({ - focusHook: useFocusHook = useEffect, - enableFooterMarginAdjustment = false, - onLayout, - style, - children, - ...rest -}) { - //#region hooks - const { - animatedScrollableContentOffsetY, - animatedScrollableType, - animatedFooterHeight, - enableDynamicSizing, - animatedContentHeight - } = useBottomSheetInternal(); //#endregion - //#region styles - - const containerStylePaddingBottom = useMemo(() => { - const flattenStyle = StyleSheet.flatten(style); - const paddingBottom = flattenStyle && 'paddingBottom' in flattenStyle ? flattenStyle.paddingBottom : 0; - return typeof paddingBottom === 'number' ? paddingBottom : 0; - }, [style]); - const containerAnimatedStyle = useAnimatedStyle(() => ({ - paddingBottom: enableFooterMarginAdjustment ? animatedFooterHeight.value + containerStylePaddingBottom : containerStylePaddingBottom - }), [containerStylePaddingBottom, enableFooterMarginAdjustment]); - const containerStyle = useMemo(() => [style, containerAnimatedStyle], [style, containerAnimatedStyle]); //#endregion - //#region callbacks - - const handleSettingScrollable = useCallback(() => { - animatedScrollableContentOffsetY.value = 0; - animatedScrollableType.value = SCROLLABLE_TYPE.VIEW; - }, [animatedScrollableContentOffsetY, animatedScrollableType]); - const handleLayout = useCallback(event => { - if (enableDynamicSizing) { - animatedContentHeight.value = event.nativeEvent.layout.height; - } - - if (onLayout) { - onLayout(event); - } - - print({ - component: BottomSheetView.displayName, - method: 'handleLayout', - params: { - height: event.nativeEvent.layout.height - } - }); - }, [onLayout, animatedContentHeight, enableDynamicSizing]); //#endregion - // effects - - useFocusHook(handleSettingScrollable); //render - - return /*#__PURE__*/React.createElement(Animated.View, _extends({ - onLayout: handleLayout, - style: containerStyle - }, rest), children); -} - -const BottomSheetView = /*#__PURE__*/memo(BottomSheetViewComponent); -BottomSheetView.displayName = 'BottomSheetView'; -export default BottomSheetView; -//# sourceMappingURL=BottomSheetView.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetView/BottomSheetView.js.map b/lib/module/components/bottomSheetView/BottomSheetView.js.map deleted file mode 100644 index 2a64dda4f..000000000 --- a/lib/module/components/bottomSheetView/BottomSheetView.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["BottomSheetView.tsx"],"names":["React","memo","useEffect","useCallback","useMemo","StyleSheet","Animated","useAnimatedStyle","SCROLLABLE_TYPE","useBottomSheetInternal","print","BottomSheetViewComponent","focusHook","useFocusHook","enableFooterMarginAdjustment","onLayout","style","children","rest","animatedScrollableContentOffsetY","animatedScrollableType","animatedFooterHeight","enableDynamicSizing","animatedContentHeight","containerStylePaddingBottom","flattenStyle","flatten","paddingBottom","containerAnimatedStyle","value","containerStyle","handleSettingScrollable","VIEW","handleLayout","event","nativeEvent","layout","height","component","BottomSheetView","displayName","method","params"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,IAAhB,EAAsBC,SAAtB,EAAiCC,WAAjC,EAA8CC,OAA9C,QAA6D,OAA7D;AACA,SAA4BC,UAA5B,QAA8C,cAA9C;AACA,OAAOC,QAAP,IAAmBC,gBAAnB,QAA2C,yBAA3C;AACA,SAASC,eAAT,QAAgC,iBAAhC;AACA,SAASC,sBAAT,QAAuC,aAAvC;AAEA,SAASC,KAAT,QAAsB,iBAAtB;;AAEA,SAASC,wBAAT,CAAkC;AAChCC,EAAAA,SAAS,EAAEC,YAAY,GAAGX,SADM;AAEhCY,EAAAA,4BAA4B,GAAG,KAFC;AAGhCC,EAAAA,QAHgC;AAIhCC,EAAAA,KAJgC;AAKhCC,EAAAA,QALgC;AAMhC,KAAGC;AAN6B,CAAlC,EAOyB;AACvB;AACA,QAAM;AACJC,IAAAA,gCADI;AAEJC,IAAAA,sBAFI;AAGJC,IAAAA,oBAHI;AAIJC,IAAAA,mBAJI;AAKJC,IAAAA;AALI,MAMFd,sBAAsB,EAN1B,CAFuB,CASvB;AAEA;;AACA,QAAMe,2BAA2B,GAAGpB,OAAO,CAAC,MAAM;AAChD,UAAMqB,YAAY,GAAGpB,UAAU,CAACqB,OAAX,CAAmBV,KAAnB,CAArB;AACA,UAAMW,aAAa,GACjBF,YAAY,IAAI,mBAAmBA,YAAnC,GACIA,YAAY,CAACE,aADjB,GAEI,CAHN;AAIA,WAAO,OAAOA,aAAP,KAAyB,QAA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8B,CAAhC,CAvCuB,CA2DvB;AAEA;;AACAT,EAAAA,YAAY,CAACkB,uBAAD,CAAZ,CA9DuB,CAgEvB;;AACA,sBACE,oBAAC,QAAD,CAAU,IAAV;AAAe,IAAA,QAAQ,EAAEE,YAAzB;AAAuC,IAAA,KAAK,EAAEH;AAA9C,KAAkEZ,IAAlE,GACGD,QADH,CADF;AAKD;;AAED,MAAMsB,eAAe,gBAAGtC,IAAI,CAACU,wBAAD,CAA5B;AACA4B,eAAe,CAACC,WAAhB,GAA8B,iBAA9B;AAEA,eAAeD,eAAf","sourcesContent":["import React, { memo, useEffect, useCallback, useMemo } from 'react';\nimport { LayoutChangeEvent, StyleSheet } from 'react-native';\nimport Animated, { useAnimatedStyle } from 'react-native-reanimated';\nimport { SCROLLABLE_TYPE } from '../../constants';\nimport { useBottomSheetInternal } from '../../hooks';\nimport type { BottomSheetViewProps } from './types';\nimport { print } from '../../utilities';\n\nfunction BottomSheetViewComponent({\n focusHook: useFocusHook = useEffect,\n enableFooterMarginAdjustment = false,\n onLayout,\n style,\n children,\n ...rest\n}: BottomSheetViewProps) {\n //#region hooks\n const {\n animatedScrollableContentOffsetY,\n animatedScrollableType,\n animatedFooterHeight,\n enableDynamicSizing,\n animatedContentHeight,\n } = useBottomSheetInternal();\n //#endregion\n\n //#region styles\n const containerStylePaddingBottom = useMemo(() => {\n const flattenStyle = StyleSheet.flatten(style);\n const paddingBottom =\n flattenStyle && 'paddingBottom' in flattenStyle\n ? flattenStyle.paddingBottom\n : 0;\n return typeof paddingBottom === 'number' ? paddingBottom : 0;\n }, [style]);\n const containerAnimatedStyle = useAnimatedStyle(\n () => ({\n paddingBottom: enableFooterMarginAdjustment\n ? animatedFooterHeight.value + containerStylePaddingBottom\n : containerStylePaddingBottom,\n }),\n [containerStylePaddingBottom, enableFooterMarginAdjustment]\n );\n const containerStyle = useMemo(\n () => [style, containerAnimatedStyle],\n [style, containerAnimatedStyle]\n );\n //#endregion\n\n //#region callbacks\n const handleSettingScrollable = useCallback(() => {\n animatedScrollableContentOffsetY.value = 0;\n animatedScrollableType.value = SCROLLABLE_TYPE.VIEW;\n }, [animatedScrollableContentOffsetY, animatedScrollableType]);\n const handleLayout = useCallback(\n (event: LayoutChangeEvent) => {\n if (enableDynamicSizing) {\n animatedContentHeight.value = event.nativeEvent.layout.height;\n }\n\n if (onLayout) {\n onLayout(event);\n }\n\n print({\n component: BottomSheetView.displayName,\n method: 'handleLayout',\n params: {\n height: event.nativeEvent.layout.height,\n },\n });\n },\n [onLayout, animatedContentHeight, enableDynamicSizing]\n );\n //#endregion\n\n // effects\n useFocusHook(handleSettingScrollable);\n\n //render\n return (\n \n {children}\n \n );\n}\n\nconst BottomSheetView = memo(BottomSheetViewComponent);\nBottomSheetView.displayName = 'BottomSheetView';\n\nexport default BottomSheetView;\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetView/index.js b/lib/module/components/bottomSheetView/index.js deleted file mode 100644 index 298647bc6..000000000 --- a/lib/module/components/bottomSheetView/index.js +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './BottomSheetView'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetView/index.js.map b/lib/module/components/bottomSheetView/index.js.map deleted file mode 100644 index 06e3cd60d..000000000 --- a/lib/module/components/bottomSheetView/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":["default"],"mappings":"AAAA,SAASA,OAAT,QAAwB,mBAAxB","sourcesContent":["export { default } from './BottomSheetView';\n"]} \ No newline at end of file diff --git a/lib/module/components/bottomSheetView/styles.js b/lib/module/components/bottomSheetView/styles.js deleted file mode 100644 index fbac29306..000000000 --- a/lib/module/components/bottomSheetView/styles.js +++ /dev/null @@ -1,6 +0,0 @@ -import { StyleSheet } from 'react-native'; -export const styles = StyleSheet.create({ - container: {// flex: 1, - } -}); -//# sourceMappingURL=styles.js.map \ No newline at end of file diff --git a/lib/module/components/bottomSheetView/styles.js.map b/lib/module/components/bottomSheetView/styles.js.map deleted file mode 100644 index 388f35bba..000000000 --- a/lib/module/components/bottomSheetView/styles.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["styles.ts"],"names":["StyleSheet","styles","create","container"],"mappings":"AAAA,SAASA,UAAT,QAA2B,cAA3B;AAEA,OAAO,MAAMC,MAAM,GAAGD,UAAU,CAACE,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE,CACT;AADS;AAD2B,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\n\nexport const styles = StyleSheet.create({\n container: {\n // flex: 1,\n },\n});\n"]} \ No newline at end of file diff --git a/lib/module/components/touchables/Touchables.ios.js b/lib/module/components/touchables/Touchables.ios.js deleted file mode 100644 index f53e4cd94..000000000 --- a/lib/module/components/touchables/Touchables.ios.js +++ /dev/null @@ -1,2 +0,0 @@ -export { TouchableOpacity, TouchableHighlight, TouchableWithoutFeedback } from 'react-native'; -//# sourceMappingURL=Touchables.ios.js.map \ No newline at end of file diff --git a/lib/module/components/touchables/Touchables.ios.js.map b/lib/module/components/touchables/Touchables.ios.js.map deleted file mode 100644 index c756bc4a9..000000000 --- a/lib/module/components/touchables/Touchables.ios.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["Touchables.ios.tsx"],"names":["TouchableOpacity","TouchableHighlight","TouchableWithoutFeedback"],"mappings":"AAAA,SACEA,gBADF,EAEEC,kBAFF,EAGEC,wBAHF,QAIO,cAJP","sourcesContent":["export {\n TouchableOpacity,\n TouchableHighlight,\n TouchableWithoutFeedback,\n} from 'react-native';\n"]} \ No newline at end of file diff --git a/lib/module/components/touchables/Touchables.js b/lib/module/components/touchables/Touchables.js deleted file mode 100644 index b1edc977b..000000000 --- a/lib/module/components/touchables/Touchables.js +++ /dev/null @@ -1,2 +0,0 @@ -export { TouchableOpacity, TouchableHighlight, TouchableWithoutFeedback } from 'react-native-gesture-handler'; -//# sourceMappingURL=Touchables.js.map \ No newline at end of file diff --git a/lib/module/components/touchables/Touchables.js.map b/lib/module/components/touchables/Touchables.js.map deleted file mode 100644 index ac59a11c2..000000000 --- a/lib/module/components/touchables/Touchables.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["Touchables.tsx"],"names":["TouchableOpacity","TouchableHighlight","TouchableWithoutFeedback"],"mappings":"AAAA,SACEA,gBADF,EAEEC,kBAFF,EAGEC,wBAHF,QAIO,8BAJP","sourcesContent":["export {\n TouchableOpacity,\n TouchableHighlight,\n TouchableWithoutFeedback,\n} from 'react-native-gesture-handler';\n"]} \ No newline at end of file diff --git a/lib/module/components/touchables/index.js b/lib/module/components/touchables/index.js deleted file mode 100644 index 4c2049ac0..000000000 --- a/lib/module/components/touchables/index.js +++ /dev/null @@ -1,8 +0,0 @@ -import { TouchableOpacity, TouchableHighlight, TouchableWithoutFeedback // @ts-ignore -} from './Touchables'; -export default { - TouchableOpacity: TouchableOpacity, - TouchableHighlight: TouchableHighlight, - TouchableWithoutFeedback: TouchableWithoutFeedback -}; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/components/touchables/index.js.map b/lib/module/components/touchables/index.js.map deleted file mode 100644 index ce2b7e92c..000000000 --- a/lib/module/components/touchables/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":["TouchableOpacity","TouchableHighlight","TouchableWithoutFeedback"],"mappings":"AAMA,SACEA,gBADF,EAEEC,kBAFF,EAGEC,wBAHF,CAIE;AAJF,OAKO,cALP;AAOA,eAAe;AACbF,EAAAA,gBAAgB,EAAEA,gBADL;AAEbC,EAAAA,kBAAkB,EAAEA,kBAFP;AAGbC,EAAAA,wBAAwB,EACtBA;AAJW,CAAf","sourcesContent":["import type {\n TouchableOpacity as RNTouchableOpacity,\n TouchableHighlight as RNTouchableHighlight,\n TouchableWithoutFeedback as RNTouchableWithoutFeedback,\n} from 'react-native';\n\nimport {\n TouchableOpacity,\n TouchableHighlight,\n TouchableWithoutFeedback,\n // @ts-ignore\n} from './Touchables';\n\nexport default {\n TouchableOpacity: TouchableOpacity as any as typeof RNTouchableOpacity,\n TouchableHighlight: TouchableHighlight as any as typeof RNTouchableHighlight,\n TouchableWithoutFeedback:\n TouchableWithoutFeedback as any as typeof RNTouchableWithoutFeedback,\n};\n"]} \ No newline at end of file diff --git a/lib/module/constants.js b/lib/module/constants.js deleted file mode 100644 index b5a576b1d..000000000 --- a/lib/module/constants.js +++ /dev/null @@ -1,128 +0,0 @@ -import { Dimensions, Platform } from 'react-native'; -import { Easing } from 'react-native-reanimated'; -const { - height: WINDOW_HEIGHT, - width: WINDOW_WIDTH -} = Dimensions.get('window'); -const { - height: SCREEN_HEIGHT, - width: SCREEN_WIDTH -} = Dimensions.get('screen'); -var GESTURE_SOURCE; - -(function (GESTURE_SOURCE) { - GESTURE_SOURCE[GESTURE_SOURCE["UNDETERMINED"] = 0] = "UNDETERMINED"; - GESTURE_SOURCE[GESTURE_SOURCE["SCROLLABLE"] = 1] = "SCROLLABLE"; - GESTURE_SOURCE[GESTURE_SOURCE["HANDLE"] = 2] = "HANDLE"; - GESTURE_SOURCE[GESTURE_SOURCE["CONTENT"] = 3] = "CONTENT"; -})(GESTURE_SOURCE || (GESTURE_SOURCE = {})); - -var SHEET_STATE; - -(function (SHEET_STATE) { - SHEET_STATE[SHEET_STATE["CLOSED"] = 0] = "CLOSED"; - SHEET_STATE[SHEET_STATE["OPENED"] = 1] = "OPENED"; - SHEET_STATE[SHEET_STATE["EXTENDED"] = 2] = "EXTENDED"; - SHEET_STATE[SHEET_STATE["OVER_EXTENDED"] = 3] = "OVER_EXTENDED"; - SHEET_STATE[SHEET_STATE["FILL_PARENT"] = 4] = "FILL_PARENT"; -})(SHEET_STATE || (SHEET_STATE = {})); - -var SCROLLABLE_STATE; - -(function (SCROLLABLE_STATE) { - SCROLLABLE_STATE[SCROLLABLE_STATE["LOCKED"] = 0] = "LOCKED"; - SCROLLABLE_STATE[SCROLLABLE_STATE["UNLOCKED"] = 1] = "UNLOCKED"; - SCROLLABLE_STATE[SCROLLABLE_STATE["UNDETERMINED"] = 2] = "UNDETERMINED"; -})(SCROLLABLE_STATE || (SCROLLABLE_STATE = {})); - -var SCROLLABLE_TYPE; - -(function (SCROLLABLE_TYPE) { - SCROLLABLE_TYPE[SCROLLABLE_TYPE["UNDETERMINED"] = 0] = "UNDETERMINED"; - SCROLLABLE_TYPE[SCROLLABLE_TYPE["VIEW"] = 1] = "VIEW"; - SCROLLABLE_TYPE[SCROLLABLE_TYPE["FLATLIST"] = 2] = "FLATLIST"; - SCROLLABLE_TYPE[SCROLLABLE_TYPE["SCROLLVIEW"] = 3] = "SCROLLVIEW"; - SCROLLABLE_TYPE[SCROLLABLE_TYPE["SECTIONLIST"] = 4] = "SECTIONLIST"; - SCROLLABLE_TYPE[SCROLLABLE_TYPE["VIRTUALIZEDLIST"] = 5] = "VIRTUALIZEDLIST"; -})(SCROLLABLE_TYPE || (SCROLLABLE_TYPE = {})); - -var ANIMATION_STATE; - -(function (ANIMATION_STATE) { - ANIMATION_STATE[ANIMATION_STATE["UNDETERMINED"] = 0] = "UNDETERMINED"; - ANIMATION_STATE[ANIMATION_STATE["RUNNING"] = 1] = "RUNNING"; - ANIMATION_STATE[ANIMATION_STATE["STOPPED"] = 2] = "STOPPED"; - ANIMATION_STATE[ANIMATION_STATE["INTERRUPTED"] = 3] = "INTERRUPTED"; -})(ANIMATION_STATE || (ANIMATION_STATE = {})); - -var ANIMATION_SOURCE; - -(function (ANIMATION_SOURCE) { - ANIMATION_SOURCE[ANIMATION_SOURCE["NONE"] = 0] = "NONE"; - ANIMATION_SOURCE[ANIMATION_SOURCE["MOUNT"] = 1] = "MOUNT"; - ANIMATION_SOURCE[ANIMATION_SOURCE["GESTURE"] = 2] = "GESTURE"; - ANIMATION_SOURCE[ANIMATION_SOURCE["USER"] = 3] = "USER"; - ANIMATION_SOURCE[ANIMATION_SOURCE["CONTAINER_RESIZE"] = 4] = "CONTAINER_RESIZE"; - ANIMATION_SOURCE[ANIMATION_SOURCE["SNAP_POINT_CHANGE"] = 5] = "SNAP_POINT_CHANGE"; - ANIMATION_SOURCE[ANIMATION_SOURCE["KEYBOARD"] = 6] = "KEYBOARD"; -})(ANIMATION_SOURCE || (ANIMATION_SOURCE = {})); - -var ANIMATION_METHOD; - -(function (ANIMATION_METHOD) { - ANIMATION_METHOD[ANIMATION_METHOD["TIMING"] = 0] = "TIMING"; - ANIMATION_METHOD[ANIMATION_METHOD["SPRING"] = 1] = "SPRING"; -})(ANIMATION_METHOD || (ANIMATION_METHOD = {})); - -var KEYBOARD_STATE; - -(function (KEYBOARD_STATE) { - KEYBOARD_STATE[KEYBOARD_STATE["UNDETERMINED"] = 0] = "UNDETERMINED"; - KEYBOARD_STATE[KEYBOARD_STATE["SHOWN"] = 1] = "SHOWN"; - KEYBOARD_STATE[KEYBOARD_STATE["HIDDEN"] = 2] = "HIDDEN"; -})(KEYBOARD_STATE || (KEYBOARD_STATE = {})); - -const ANIMATION_EASING = Easing.out(Easing.exp); -const ANIMATION_DURATION = 250; -const ANIMATION_CONFIGS_IOS = { - damping: 500, - stiffness: 1000, - mass: 3, - overshootClamping: true, - restDisplacementThreshold: 10, - restSpeedThreshold: 10 -}; -const ANIMATION_CONFIGS_ANDROID = { - duration: ANIMATION_DURATION, - easing: ANIMATION_EASING -}; -const ANIMATION_CONFIGS = Platform.OS === 'ios' ? ANIMATION_CONFIGS_IOS : ANIMATION_CONFIGS_ANDROID; -const SCROLLABLE_DECELERATION_RATE_MAPPER = { - [SCROLLABLE_STATE.UNDETERMINED]: 0, - [SCROLLABLE_STATE.LOCKED]: 0, - [SCROLLABLE_STATE.UNLOCKED]: Platform.select({ - ios: 0.998, - android: 0.985, - default: 1 - }) -}; -const MODAL_STACK_BEHAVIOR = { - replace: 'replace', - push: 'push' -}; -const KEYBOARD_BEHAVIOR = { - interactive: 'interactive', - extend: 'extend', - fillParent: 'fillParent' -}; -const KEYBOARD_BLUR_BEHAVIOR = { - none: 'none', - restore: 'restore' -}; -const KEYBOARD_INPUT_MODE = { - adjustPan: 'adjustPan', - adjustResize: 'adjustResize' -}; -const KEYBOARD_DISMISS_THRESHOLD = 12.5; -export { GESTURE_SOURCE, SHEET_STATE, ANIMATION_STATE, ANIMATION_METHOD, ANIMATION_SOURCE, SCROLLABLE_TYPE, SCROLLABLE_STATE, KEYBOARD_STATE, WINDOW_HEIGHT, WINDOW_WIDTH, SCREEN_HEIGHT, SCREEN_WIDTH, SCROLLABLE_DECELERATION_RATE_MAPPER, MODAL_STACK_BEHAVIOR, KEYBOARD_BEHAVIOR, KEYBOARD_BLUR_BEHAVIOR, KEYBOARD_INPUT_MODE, KEYBOARD_DISMISS_THRESHOLD, ANIMATION_CONFIGS, ANIMATION_EASING, ANIMATION_DURATION }; -//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/lib/module/constants.js.map b/lib/module/constants.js.map deleted file mode 100644 index ad6997b03..000000000 --- a/lib/module/constants.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["constants.ts"],"names":["Dimensions","Platform","Easing","height","WINDOW_HEIGHT","width","WINDOW_WIDTH","get","SCREEN_HEIGHT","SCREEN_WIDTH","GESTURE_SOURCE","SHEET_STATE","SCROLLABLE_STATE","SCROLLABLE_TYPE","ANIMATION_STATE","ANIMATION_SOURCE","ANIMATION_METHOD","KEYBOARD_STATE","ANIMATION_EASING","out","exp","ANIMATION_DURATION","ANIMATION_CONFIGS_IOS","damping","stiffness","mass","overshootClamping","restDisplacementThreshold","restSpeedThreshold","ANIMATION_CONFIGS_ANDROID","duration","easing","ANIMATION_CONFIGS","OS","SCROLLABLE_DECELERATION_RATE_MAPPER","UNDETERMINED","LOCKED","UNLOCKED","select","ios","android","default","MODAL_STACK_BEHAVIOR","replace","push","KEYBOARD_BEHAVIOR","interactive","extend","fillParent","KEYBOARD_BLUR_BEHAVIOR","none","restore","KEYBOARD_INPUT_MODE","adjustPan","adjustResize","KEYBOARD_DISMISS_THRESHOLD"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A,OAAO,EAAE;AAHkC,GAAhB;AAHa,CAA5C;AAUA,MAAMC,oBAAoB,GAAG;AAC3BC,EAAAA,OAAO,EAAE,SADkB;AAE3BC,EAAAA,IAAI,EAAE;AAFqB,CAA7B;AAKA,MAAMC,iBAAiB,GAAG;AACxBC,EAAAA,WAAW,EAAE,aADW;AAExBC,EAAAA,MAAM,EAAE,QAFgB;AAGxBC,EAAAA,UAAU,EAAE;AAHY,CAA1B;AAMA,MAAMC,sBAAsB,GAAG;AAC7BC,EAAAA,IAAI,EAAE,MADuB;AAE7BC,EAAAA,OAAO,EAAE;AAFoB,CAA/B;AAKA,MAAMC,mBAAmB,GAAG;AAC1BC,EAAAA,SAAS,EAAE,WADe;AAE1BC,EAAAA,YAAY,EAAE;AAFY,CAA5B;AAKA,MAAMC,0BAA0B,GAAG,IAAnC;AAEA,SACE7C,cADF,EAEEC,WAFF,EAGEG,eAHF,EAIEE,gBAJF,EAKED,gBALF,EAMEF,eANF,EAOED,gBAPF,EAQEK,cARF,EASEb,aATF,EAUEE,YAVF,EAWEE,aAXF,EAYEC,YAZF,EAaEyB,mCAbF,EAcEQ,oBAdF,EAeEG,iBAfF,EAgBEI,sBAhBF,EAiBEG,mBAjBF,EAkBEG,0BAlBF,EAmBEvB,iBAnBF,EAoBEd,gBApBF,EAqBEG,kBArBF","sourcesContent":["import { Dimensions, Platform } from 'react-native';\nimport Animated, { Easing } from 'react-native-reanimated';\n\nconst { height: WINDOW_HEIGHT, width: WINDOW_WIDTH } = Dimensions.get('window');\nconst { height: SCREEN_HEIGHT, width: SCREEN_WIDTH } = Dimensions.get('screen');\n\nenum GESTURE_SOURCE {\n UNDETERMINED = 0,\n SCROLLABLE,\n HANDLE,\n CONTENT,\n}\n\nenum SHEET_STATE {\n CLOSED = 0,\n OPENED,\n EXTENDED,\n OVER_EXTENDED,\n FILL_PARENT,\n}\n\nenum SCROLLABLE_STATE {\n LOCKED = 0,\n UNLOCKED,\n UNDETERMINED,\n}\n\nenum SCROLLABLE_TYPE {\n UNDETERMINED = 0,\n VIEW,\n FLATLIST,\n SCROLLVIEW,\n SECTIONLIST,\n VIRTUALIZEDLIST,\n}\n\nenum ANIMATION_STATE {\n UNDETERMINED = 0,\n RUNNING,\n STOPPED,\n INTERRUPTED,\n}\n\nenum ANIMATION_SOURCE {\n NONE = 0,\n MOUNT,\n GESTURE,\n USER,\n CONTAINER_RESIZE,\n SNAP_POINT_CHANGE,\n KEYBOARD,\n}\n\nenum ANIMATION_METHOD {\n TIMING,\n SPRING,\n}\n\nenum KEYBOARD_STATE {\n UNDETERMINED = 0,\n SHOWN,\n HIDDEN,\n}\n\nconst ANIMATION_EASING: Animated.EasingFunction = Easing.out(Easing.exp);\nconst ANIMATION_DURATION = 250;\n\nconst ANIMATION_CONFIGS_IOS = {\n damping: 500,\n stiffness: 1000,\n mass: 3,\n overshootClamping: true,\n restDisplacementThreshold: 10,\n restSpeedThreshold: 10,\n};\n\nconst ANIMATION_CONFIGS_ANDROID = {\n duration: ANIMATION_DURATION,\n easing: ANIMATION_EASING,\n};\n\nconst ANIMATION_CONFIGS =\n Platform.OS === 'ios' ? ANIMATION_CONFIGS_IOS : ANIMATION_CONFIGS_ANDROID;\n\nconst SCROLLABLE_DECELERATION_RATE_MAPPER = {\n [SCROLLABLE_STATE.UNDETERMINED]: 0,\n [SCROLLABLE_STATE.LOCKED]: 0,\n [SCROLLABLE_STATE.UNLOCKED]: Platform.select({\n ios: 0.998,\n android: 0.985,\n default: 1,\n }),\n};\n\nconst MODAL_STACK_BEHAVIOR = {\n replace: 'replace',\n push: 'push',\n};\n\nconst KEYBOARD_BEHAVIOR = {\n interactive: 'interactive',\n extend: 'extend',\n fillParent: 'fillParent',\n} as const;\n\nconst KEYBOARD_BLUR_BEHAVIOR = {\n none: 'none',\n restore: 'restore',\n} as const;\n\nconst KEYBOARD_INPUT_MODE = {\n adjustPan: 'adjustPan',\n adjustResize: 'adjustResize',\n} as const;\n\nconst KEYBOARD_DISMISS_THRESHOLD = 12.5;\n\nexport {\n GESTURE_SOURCE,\n SHEET_STATE,\n ANIMATION_STATE,\n ANIMATION_METHOD,\n ANIMATION_SOURCE,\n SCROLLABLE_TYPE,\n SCROLLABLE_STATE,\n KEYBOARD_STATE,\n WINDOW_HEIGHT,\n WINDOW_WIDTH,\n SCREEN_HEIGHT,\n SCREEN_WIDTH,\n SCROLLABLE_DECELERATION_RATE_MAPPER,\n MODAL_STACK_BEHAVIOR,\n KEYBOARD_BEHAVIOR,\n KEYBOARD_BLUR_BEHAVIOR,\n KEYBOARD_INPUT_MODE,\n KEYBOARD_DISMISS_THRESHOLD,\n ANIMATION_CONFIGS,\n ANIMATION_EASING,\n ANIMATION_DURATION,\n};\n"]} \ No newline at end of file diff --git a/lib/module/contexts/external.js b/lib/module/contexts/external.js deleted file mode 100644 index fa5e24e89..000000000 --- a/lib/module/contexts/external.js +++ /dev/null @@ -1,4 +0,0 @@ -import { createContext } from 'react'; -export const BottomSheetContext = /*#__PURE__*/createContext(null); -export const BottomSheetProvider = BottomSheetContext.Provider; -//# sourceMappingURL=external.js.map \ No newline at end of file diff --git a/lib/module/contexts/external.js.map b/lib/module/contexts/external.js.map deleted file mode 100644 index 9cec4b916..000000000 --- a/lib/module/contexts/external.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["external.ts"],"names":["createContext","BottomSheetContext","BottomSheetProvider","Provider"],"mappings":"AAAA,SAASA,aAAT,QAA8B,OAA9B;AAGA,OAAO,MAAMC,kBAAkB,gBAAGD,aAAa,CAE7C,IAF6C,CAAxC;AAIP,OAAO,MAAME,mBAAmB,GAAGD,kBAAkB,CAACE,QAA/C","sourcesContent":["import { createContext } from 'react';\nimport type { BottomSheetMethods, BottomSheetVariables } from '../types';\n\nexport const BottomSheetContext = createContext<\n (BottomSheetMethods & BottomSheetVariables) | null\n>(null);\n\nexport const BottomSheetProvider = BottomSheetContext.Provider;\n"]} \ No newline at end of file diff --git a/lib/module/contexts/gesture.js b/lib/module/contexts/gesture.js deleted file mode 100644 index 8b82097e2..000000000 --- a/lib/module/contexts/gesture.js +++ /dev/null @@ -1,3 +0,0 @@ -import { createContext } from 'react'; -export const BottomSheetGestureHandlersContext = /*#__PURE__*/createContext(null); -//# sourceMappingURL=gesture.js.map \ No newline at end of file diff --git a/lib/module/contexts/gesture.js.map b/lib/module/contexts/gesture.js.map deleted file mode 100644 index 754f3c09b..000000000 --- a/lib/module/contexts/gesture.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["gesture.ts"],"names":["createContext","BottomSheetGestureHandlersContext"],"mappings":"AAAA,SAASA,aAAT,QAA8B,OAA9B;AASA,OAAO,MAAMC,iCAAiC,gBAC5CD,aAAa,CAA+C,IAA/C,CADR","sourcesContent":["import { createContext } from 'react';\nimport type { PanGestureHandlerGestureEvent } from 'react-native-gesture-handler';\n\nexport interface BottomSheetGestureHandlersContextType {\n contentPanGestureHandler: (event: PanGestureHandlerGestureEvent) => void;\n handlePanGestureHandler: (event: PanGestureHandlerGestureEvent) => void;\n scrollablePanGestureHandler: (event: PanGestureHandlerGestureEvent) => void;\n}\n\nexport const BottomSheetGestureHandlersContext =\n createContext(null);\n"]} \ No newline at end of file diff --git a/lib/module/contexts/index.js b/lib/module/contexts/index.js deleted file mode 100644 index a6f79061c..000000000 --- a/lib/module/contexts/index.js +++ /dev/null @@ -1,6 +0,0 @@ -export { BottomSheetContext, BottomSheetProvider } from './external'; -export { BottomSheetInternalContext, BottomSheetInternalProvider } from './internal'; -export { BottomSheetGestureHandlersContext } from './gesture'; -export { BottomSheetModalContext, BottomSheetModalProvider } from './modal/external'; -export { BottomSheetModalInternalContext, BottomSheetModalInternalProvider } from './modal/internal'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/contexts/index.js.map b/lib/module/contexts/index.js.map deleted file mode 100644 index 3d4bb1a9f..000000000 --- a/lib/module/contexts/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":["BottomSheetContext","BottomSheetProvider","BottomSheetInternalContext","BottomSheetInternalProvider","BottomSheetGestureHandlersContext","BottomSheetModalContext","BottomSheetModalProvider","BottomSheetModalInternalContext","BottomSheetModalInternalProvider"],"mappings":"AAAA,SAASA,kBAAT,EAA6BC,mBAA7B,QAAwD,YAAxD;AACA,SACEC,0BADF,EAEEC,2BAFF,QAGO,YAHP;AAIA,SAASC,iCAAT,QAAkD,WAAlD;AACA,SACEC,uBADF,EAEEC,wBAFF,QAGO,kBAHP;AAIA,SACEC,+BADF,EAEEC,gCAFF,QAGO,kBAHP","sourcesContent":["export { BottomSheetContext, BottomSheetProvider } from './external';\nexport {\n BottomSheetInternalContext,\n BottomSheetInternalProvider,\n} from './internal';\nexport { BottomSheetGestureHandlersContext } from './gesture';\nexport {\n BottomSheetModalContext,\n BottomSheetModalProvider,\n} from './modal/external';\nexport {\n BottomSheetModalInternalContext,\n BottomSheetModalInternalProvider,\n} from './modal/internal';\nexport type { BottomSheetModalInternalContextType } from './modal/internal';\n"]} \ No newline at end of file diff --git a/lib/module/contexts/internal.js b/lib/module/contexts/internal.js deleted file mode 100644 index 0f014be5e..000000000 --- a/lib/module/contexts/internal.js +++ /dev/null @@ -1,4 +0,0 @@ -import { createContext } from 'react'; -export const BottomSheetInternalContext = /*#__PURE__*/createContext(null); -export const BottomSheetInternalProvider = BottomSheetInternalContext.Provider; -//# sourceMappingURL=internal.js.map \ No newline at end of file diff --git a/lib/module/contexts/internal.js.map b/lib/module/contexts/internal.js.map deleted file mode 100644 index 61dac4523..000000000 --- a/lib/module/contexts/internal.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["internal.ts"],"names":["createContext","BottomSheetInternalContext","BottomSheetInternalProvider","Provider"],"mappings":"AAAA,SAASA,aAAT,QAAyC,OAAzC;AA0EA,OAAO,MAAMC,0BAA0B,gBACrCD,aAAa,CAAwC,IAAxC,CADR;AAGP,OAAO,MAAME,2BAA2B,GAAGD,0BAA0B,CAACE,QAA/D","sourcesContent":["import { createContext, RefObject } from 'react';\nimport type {\n PanGestureHandlerProps,\n State,\n} from 'react-native-gesture-handler';\nimport type Animated from 'react-native-reanimated';\nimport type {\n AnimateToPositionType,\n BottomSheetProps,\n} from '../components/bottomSheet/types';\nimport type {\n ANIMATION_STATE,\n KEYBOARD_STATE,\n SCROLLABLE_STATE,\n SCROLLABLE_TYPE,\n SHEET_STATE,\n} from '../constants';\nimport type { Scrollable, ScrollableRef } from '../types';\n\nexport interface BottomSheetInternalContextType\n extends Pick<\n PanGestureHandlerProps,\n | 'activeOffsetY'\n | 'activeOffsetX'\n | 'failOffsetY'\n | 'failOffsetX'\n | 'waitFor'\n | 'simultaneousHandlers'\n >,\n Required<\n Pick<\n BottomSheetProps,\n | 'enableContentPanningGesture'\n | 'enableOverDrag'\n | 'enablePanDownToClose'\n | 'enableDynamicSizing'\n | 'overDragResistanceFactor'\n >\n > {\n // animated states\n animatedAnimationState: Animated.SharedValue;\n animatedSheetState: Animated.SharedValue;\n animatedScrollableState: Animated.SharedValue;\n animatedKeyboardState: Animated.SharedValue;\n animatedContentGestureState: Animated.SharedValue;\n animatedHandleGestureState: Animated.SharedValue;\n\n // animated values\n animatedSnapPoints: Animated.SharedValue;\n animatedPosition: Animated.SharedValue;\n animatedIndex: Animated.SharedValue;\n animatedContainerHeight: Animated.SharedValue;\n animatedContentHeight: Animated.SharedValue;\n animatedHighestSnapPoint: Animated.SharedValue;\n animatedClosedPosition: Animated.SharedValue;\n animatedFooterHeight: Animated.SharedValue;\n animatedHandleHeight: Animated.SharedValue;\n animatedKeyboardHeight: Animated.SharedValue;\n animatedKeyboardHeightInContainer: Animated.SharedValue;\n animatedScrollableType: Animated.SharedValue;\n animatedScrollableContentOffsetY: Animated.SharedValue;\n animatedScrollableOverrideState: Animated.SharedValue;\n isScrollableRefreshable: Animated.SharedValue;\n isContentHeightFixed: Animated.SharedValue;\n isInTemporaryPosition: Animated.SharedValue;\n shouldHandleKeyboardEvents: Animated.SharedValue;\n\n // methods\n stopAnimation: () => void;\n animateToPosition: AnimateToPositionType;\n setScrollableRef: (ref: ScrollableRef) => void;\n removeScrollableRef: (ref: RefObject) => void;\n}\n\nexport const BottomSheetInternalContext =\n createContext(null);\n\nexport const BottomSheetInternalProvider = BottomSheetInternalContext.Provider;\n"]} \ No newline at end of file diff --git a/lib/module/contexts/modal/external.js b/lib/module/contexts/modal/external.js deleted file mode 100644 index ab8d2dd2a..000000000 --- a/lib/module/contexts/modal/external.js +++ /dev/null @@ -1,4 +0,0 @@ -import { createContext } from 'react'; -export const BottomSheetModalContext = /*#__PURE__*/createContext(null); -export const BottomSheetModalProvider = BottomSheetModalContext.Provider; -//# sourceMappingURL=external.js.map \ No newline at end of file diff --git a/lib/module/contexts/modal/external.js.map b/lib/module/contexts/modal/external.js.map deleted file mode 100644 index 3a7283fc7..000000000 --- a/lib/module/contexts/modal/external.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["external.ts"],"names":["createContext","BottomSheetModalContext","BottomSheetModalProvider","Provider"],"mappings":"AAAA,SAASA,aAAT,QAA8B,OAA9B;AAOA,OAAO,MAAMC,uBAAuB,gBAClCD,aAAa,CAAqC,IAArC,CADR;AAGP,OAAO,MAAME,wBAAwB,GAAGD,uBAAuB,CAACE,QAAzD","sourcesContent":["import { createContext } from 'react';\n\nexport interface BottomSheetModalContextType {\n dismiss: (key?: string) => boolean;\n dismissAll: () => void;\n}\n\nexport const BottomSheetModalContext =\n createContext(null);\n\nexport const BottomSheetModalProvider = BottomSheetModalContext.Provider;\n"]} \ No newline at end of file diff --git a/lib/module/contexts/modal/internal.js b/lib/module/contexts/modal/internal.js deleted file mode 100644 index 86eac195d..000000000 --- a/lib/module/contexts/modal/internal.js +++ /dev/null @@ -1,4 +0,0 @@ -import { createContext } from 'react'; -export const BottomSheetModalInternalContext = /*#__PURE__*/createContext(null); -export const BottomSheetModalInternalProvider = BottomSheetModalInternalContext.Provider; -//# sourceMappingURL=internal.js.map \ No newline at end of file diff --git a/lib/module/contexts/modal/internal.js.map b/lib/module/contexts/modal/internal.js.map deleted file mode 100644 index df89efdcb..000000000 --- a/lib/module/contexts/modal/internal.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["internal.ts"],"names":["createContext","BottomSheetModalInternalContext","BottomSheetModalInternalProvider","Provider"],"mappings":"AAAA,SAASA,aAAT,QAAmC,OAAnC;AAkBA,OAAO,MAAMC,+BAA+B,gBAC1CD,aAAa,CAA6C,IAA7C,CADR;AAGP,OAAO,MAAME,gCAAgC,GAC3CD,+BAA+B,CAACE,QAD3B","sourcesContent":["import { createContext, Ref } from 'react';\nimport type { Insets } from 'react-native';\nimport type Animated from 'react-native-reanimated';\nimport type BottomSheet from '../../components/bottomSheet';\nimport type { BottomSheetModalStackBehavior } from '../../components/bottomSheetModal';\n\nexport interface BottomSheetModalInternalContextType {\n containerHeight: Animated.SharedValue;\n containerOffset: Animated.SharedValue>;\n mountSheet: (\n key: string,\n ref: Ref,\n stackBehavior: BottomSheetModalStackBehavior\n ) => void;\n unmountSheet: (key: string) => void;\n willUnmountSheet: (key: string) => void;\n}\n\nexport const BottomSheetModalInternalContext =\n createContext(null);\n\nexport const BottomSheetModalInternalProvider =\n BottomSheetModalInternalContext.Provider;\n"]} \ No newline at end of file diff --git a/lib/module/hooks/index.js b/lib/module/hooks/index.js deleted file mode 100644 index 0acb902a1..000000000 --- a/lib/module/hooks/index.js +++ /dev/null @@ -1,21 +0,0 @@ -export { useBottomSheet } from './useBottomSheet'; -export { useBottomSheetInternal } from './useBottomSheetInternal'; // modal - -export { useBottomSheetModal } from './useBottomSheetModal'; -export { useBottomSheetModalInternal } from './useBottomSheetModalInternal'; // scrollable - -export { useScrollable } from './useScrollable'; -export { useScrollableSetter } from './useScrollableSetter'; -export { useScrollHandler } from './useScrollHandler'; // gestures - -export { useGestureHandler } from './useGestureHandler'; -export { useGestureEventsHandlersDefault } from './useGestureEventsHandlersDefault'; // utilities - -export { useKeyboard } from './useKeyboard'; -export { useStableCallback } from './useStableCallback'; -export { usePropsValidator } from './usePropsValidator'; -export { useNormalizedSnapPoints } from './useNormalizedSnapPoints'; -export { useReactiveSharedValue } from './useReactiveSharedValue'; -export { useBottomSheetDynamicSnapPoints } from './useBottomSheetDynamicSnapPoints'; -export { useBottomSheetGestureHandlers } from './useBottomSheetGestureHandlers'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/hooks/index.js.map b/lib/module/hooks/index.js.map deleted file mode 100644 index 098ee80e4..000000000 --- a/lib/module/hooks/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":["useBottomSheet","useBottomSheetInternal","useBottomSheetModal","useBottomSheetModalInternal","useScrollable","useScrollableSetter","useScrollHandler","useGestureHandler","useGestureEventsHandlersDefault","useKeyboard","useStableCallback","usePropsValidator","useNormalizedSnapPoints","useReactiveSharedValue","useBottomSheetDynamicSnapPoints","useBottomSheetGestureHandlers"],"mappings":"AAAA,SAASA,cAAT,QAA+B,kBAA/B;AACA,SAASC,sBAAT,QAAuC,0BAAvC,C,CAEA;;AACA,SAASC,mBAAT,QAAoC,uBAApC;AACA,SAASC,2BAAT,QAA4C,+BAA5C,C,CAEA;;AACA,SAASC,aAAT,QAA8B,iBAA9B;AACA,SAASC,mBAAT,QAAoC,uBAApC;AACA,SAASC,gBAAT,QAAiC,oBAAjC,C,CAEA;;AACA,SAASC,iBAAT,QAAkC,qBAAlC;AACA,SAASC,+BAAT,QAAgD,mCAAhD,C,CAEA;;AACA,SAASC,WAAT,QAA4B,eAA5B;AACA,SAASC,iBAAT,QAAkC,qBAAlC;AACA,SAASC,iBAAT,QAAkC,qBAAlC;AACA,SAASC,uBAAT,QAAwC,2BAAxC;AACA,SAASC,sBAAT,QAAuC,0BAAvC;AACA,SAASC,+BAAT,QAAgD,mCAAhD;AACA,SAASC,6BAAT,QAA8C,iCAA9C","sourcesContent":["export { useBottomSheet } from './useBottomSheet';\nexport { useBottomSheetInternal } from './useBottomSheetInternal';\n\n// modal\nexport { useBottomSheetModal } from './useBottomSheetModal';\nexport { useBottomSheetModalInternal } from './useBottomSheetModalInternal';\n\n// scrollable\nexport { useScrollable } from './useScrollable';\nexport { useScrollableSetter } from './useScrollableSetter';\nexport { useScrollHandler } from './useScrollHandler';\n\n// gestures\nexport { useGestureHandler } from './useGestureHandler';\nexport { useGestureEventsHandlersDefault } from './useGestureEventsHandlersDefault';\n\n// utilities\nexport { useKeyboard } from './useKeyboard';\nexport { useStableCallback } from './useStableCallback';\nexport { usePropsValidator } from './usePropsValidator';\nexport { useNormalizedSnapPoints } from './useNormalizedSnapPoints';\nexport { useReactiveSharedValue } from './useReactiveSharedValue';\nexport { useBottomSheetDynamicSnapPoints } from './useBottomSheetDynamicSnapPoints';\nexport { useBottomSheetGestureHandlers } from './useBottomSheetGestureHandlers';\n"]} \ No newline at end of file diff --git a/lib/module/hooks/useBottomSheet.js b/lib/module/hooks/useBottomSheet.js deleted file mode 100644 index 0f3e384c4..000000000 --- a/lib/module/hooks/useBottomSheet.js +++ /dev/null @@ -1,12 +0,0 @@ -import { useContext } from 'react'; -import { BottomSheetContext } from '../contexts/external'; -export const useBottomSheet = () => { - const context = useContext(BottomSheetContext); - - if (context === null) { - throw "'useBottomSheet' cannot be used out of the BottomSheet!"; - } - - return context; -}; -//# sourceMappingURL=useBottomSheet.js.map \ No newline at end of file diff --git a/lib/module/hooks/useBottomSheet.js.map b/lib/module/hooks/useBottomSheet.js.map deleted file mode 100644 index 584ac4b0e..000000000 --- a/lib/module/hooks/useBottomSheet.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["useBottomSheet.ts"],"names":["useContext","BottomSheetContext","useBottomSheet","context"],"mappings":"AAAA,SAASA,UAAT,QAA2B,OAA3B;AACA,SAASC,kBAAT,QAAmC,sBAAnC;AAEA,OAAO,MAAMC,cAAc,GAAG,MAAM;AAClC,QAAMC,OAAO,GAAGH,UAAU,CAACC,kBAAD,CAA1B;;AAEA,MAAIE,OAAO,KAAK,IAAhB,EAAsB;AACpB,UAAM,yDAAN;AACD;;AAED,SAAOA,OAAP;AACD,CARM","sourcesContent":["import { useContext } from 'react';\nimport { BottomSheetContext } from '../contexts/external';\n\nexport const useBottomSheet = () => {\n const context = useContext(BottomSheetContext);\n\n if (context === null) {\n throw \"'useBottomSheet' cannot be used out of the BottomSheet!\";\n }\n\n return context;\n};\n"]} \ No newline at end of file diff --git a/lib/module/hooks/useBottomSheetDynamicSnapPoints.js b/lib/module/hooks/useBottomSheetDynamicSnapPoints.js deleted file mode 100644 index 0dbc9e8a4..000000000 --- a/lib/module/hooks/useBottomSheetDynamicSnapPoints.js +++ /dev/null @@ -1,53 +0,0 @@ -import { useCallback, useEffect } from 'react'; -import { useDerivedValue, useSharedValue } from 'react-native-reanimated'; -import { INITIAL_HANDLE_HEIGHT, INITIAL_SNAP_POINT } from '../components/bottomSheet/constants'; -/** - * Provides dynamic content height calculating functionalities, by - * replacing the placeholder `CONTENT_HEIGHT` with calculated layout. - * @example - * [0, 'CONTENT_HEIGHT', '100%'] - * @param initialSnapPoints your snap point with content height placeholder. - * @returns { - * - animatedSnapPoints: an animated snap points to be set on `BottomSheet` or `BottomSheetModal`. - * - animatedHandleHeight: an animated handle height callback node to be set on `BottomSheet` or `BottomSheetModal`. - * - animatedContentHeight: an animated content height callback node to be set on `BottomSheet` or `BottomSheetModal`. - * - handleContentLayout: a `onLayout` callback method to be set on `BottomSheetView` component. - * } - * @deprecated will be deprecated in the next major release! please use the new introduce prop `enableDynamicSizing`. - */ - -export const useBottomSheetDynamicSnapPoints = initialSnapPoints => { - // variables - const animatedContentHeight = useSharedValue(0); - const animatedHandleHeight = useSharedValue(INITIAL_HANDLE_HEIGHT); - const animatedSnapPoints = useDerivedValue(() => { - if (animatedHandleHeight.value === INITIAL_HANDLE_HEIGHT || animatedContentHeight.value === 0) { - return initialSnapPoints.map(() => INITIAL_SNAP_POINT); - } - - const contentWithHandleHeight = animatedContentHeight.value + animatedHandleHeight.value; - return initialSnapPoints.map(snapPoint => snapPoint === 'CONTENT_HEIGHT' ? contentWithHandleHeight : snapPoint); - }, []); - // callbacks - const handleContentLayout = useCallback(({ - nativeEvent: { - layout: { - height - } - } - }) => { - animatedContentHeight.value = height; - }, [animatedContentHeight]); //#region effects - - useEffect(() => { - console.warn('`useBottomSheetDynamicSnapPoints` will be deprecated in the next major release! please use the new introduce prop `enableDynamicSizing`.'); - }, []); //#endregion - - return { - animatedSnapPoints, - animatedHandleHeight, - animatedContentHeight, - handleContentLayout - }; -}; -//# sourceMappingURL=useBottomSheetDynamicSnapPoints.js.map \ No newline at end of file diff --git a/lib/module/hooks/useBottomSheetDynamicSnapPoints.js.map b/lib/module/hooks/useBottomSheetDynamicSnapPoints.js.map deleted file mode 100644 index 948cf3dbe..000000000 --- a/lib/module/hooks/useBottomSheetDynamicSnapPoints.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["useBottomSheetDynamicSnapPoints.ts"],"names":["useCallback","useEffect","useDerivedValue","useSharedValue","INITIAL_HANDLE_HEIGHT","INITIAL_SNAP_POINT","useBottomSheetDynamicSnapPoints","initialSnapPoints","animatedContentHeight","animatedHandleHeight","animatedSnapPoints","value","map","contentWithHandleHeight","snapPoint","handleContentLayout","nativeEvent","layout","height","console","warn"],"mappings":"AAAA,SAASA,WAAT,EAAsBC,SAAtB,QAAuC,OAAvC;AACA,SAASC,eAAT,EAA0BC,cAA1B,QAAgD,yBAAhD;AACA,SACEC,qBADF,EAEEC,kBAFF,QAGO,qCAHP;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,+BAA+B,GAC1CC,iBAD6C,IAE1C;AACH;AACA,QAAMC,qBAAqB,GAAGL,cAAc,CAAC,CAAD,CAA5C;AACA,QAAMM,oBAAoB,GAAGN,cAAc,CAACC,qBAAD,CAA3C;AACA,QAAMM,kBAAkB,GAAGR,eAAe,CAAC,MAAM;AAC/C,QACEO,oBAAoB,CAACE,KAArB,KAA+BP,qBAA/B,IACAI,qBAAqB,CAACG,KAAtB,KAAgC,CAFlC,EAGE;AACA,aAAOJ,iBAAiB,CAACK,GAAlB,CAAsB,MAAMP,kBAA5B,CAAP;AACD;;AACD,UAAMQ,uBAAuB,GAC3BL,qBAAqB,CAACG,KAAtB,GAA8BF,oBAAoB,CAACE,KADrD;AAGA,WAAOJ,iBAAiB,CAACK,GAAlB,CAAsBE,SAAS,IACpCA,SAAS,KAAK,gBAAd,GAAiCD,uBAAjC,GAA2DC,SADtD,CAAP;AAGD,GAbyC,EAavC,EAbuC,CAA1C;AAoBA;AACA,QAAMC,mBAAmB,GAAGf,WAAW,CACrC,CAAC;AACCgB,IAAAA,WAAW,EAAE;AACXC,MAAAA,MAAM,EAAE;AAAEC,QAAAA;AAAF;AADG;AADd,GAAD,KAIgC;AAC9BV,IAAAA,qBAAqB,CAACG,KAAtB,GAA8BO,MAA9B;AACD,GAPoC,EAQrC,CAACV,qBAAD,CARqC,CAAvC,CAzBG,CAoCH;;AACAP,EAAAA,SAAS,CAAC,MAAM;AACdkB,IAAAA,OAAO,CAACC,IAAR,CACE,0IADF;AAGD,GAJQ,EAIN,EAJM,CAAT,CArCG,CA0CH;;AACA,SAAO;AACLV,IAAAA,kBADK;AAELD,IAAAA,oBAFK;AAGLD,IAAAA,qBAHK;AAILO,IAAAA;AAJK,GAAP;AAMD,CAnDM","sourcesContent":["import { useCallback, useEffect } from 'react';\nimport { useDerivedValue, useSharedValue } from 'react-native-reanimated';\nimport {\n INITIAL_HANDLE_HEIGHT,\n INITIAL_SNAP_POINT,\n} from '../components/bottomSheet/constants';\n\n/**\n * Provides dynamic content height calculating functionalities, by\n * replacing the placeholder `CONTENT_HEIGHT` with calculated layout.\n * @example\n * [0, 'CONTENT_HEIGHT', '100%']\n * @param initialSnapPoints your snap point with content height placeholder.\n * @returns {\n * - animatedSnapPoints: an animated snap points to be set on `BottomSheet` or `BottomSheetModal`.\n * - animatedHandleHeight: an animated handle height callback node to be set on `BottomSheet` or `BottomSheetModal`.\n * - animatedContentHeight: an animated content height callback node to be set on `BottomSheet` or `BottomSheetModal`.\n * - handleContentLayout: a `onLayout` callback method to be set on `BottomSheetView` component.\n * }\n * @deprecated will be deprecated in the next major release! please use the new introduce prop `enableDynamicSizing`.\n */\nexport const useBottomSheetDynamicSnapPoints = (\n initialSnapPoints: Array\n) => {\n // variables\n const animatedContentHeight = useSharedValue(0);\n const animatedHandleHeight = useSharedValue(INITIAL_HANDLE_HEIGHT);\n const animatedSnapPoints = useDerivedValue(() => {\n if (\n animatedHandleHeight.value === INITIAL_HANDLE_HEIGHT ||\n animatedContentHeight.value === 0\n ) {\n return initialSnapPoints.map(() => INITIAL_SNAP_POINT);\n }\n const contentWithHandleHeight =\n animatedContentHeight.value + animatedHandleHeight.value;\n\n return initialSnapPoints.map(snapPoint =>\n snapPoint === 'CONTENT_HEIGHT' ? contentWithHandleHeight : snapPoint\n );\n }, []);\n\n type HandleContentLayoutProps = {\n nativeEvent: {\n layout: { height: number };\n };\n };\n // callbacks\n const handleContentLayout = useCallback(\n ({\n nativeEvent: {\n layout: { height },\n },\n }: HandleContentLayoutProps) => {\n animatedContentHeight.value = height;\n },\n [animatedContentHeight]\n );\n\n //#region effects\n useEffect(() => {\n console.warn(\n '`useBottomSheetDynamicSnapPoints` will be deprecated in the next major release! please use the new introduce prop `enableDynamicSizing`.'\n );\n }, []);\n //#endregion\n return {\n animatedSnapPoints,\n animatedHandleHeight,\n animatedContentHeight,\n handleContentLayout,\n };\n};\n"]} \ No newline at end of file diff --git a/lib/module/hooks/useBottomSheetGestureHandlers.js b/lib/module/hooks/useBottomSheetGestureHandlers.js deleted file mode 100644 index c9a3df458..000000000 --- a/lib/module/hooks/useBottomSheetGestureHandlers.js +++ /dev/null @@ -1,12 +0,0 @@ -import { useContext } from 'react'; -import { BottomSheetGestureHandlersContext } from '../contexts/gesture'; -export const useBottomSheetGestureHandlers = () => { - const context = useContext(BottomSheetGestureHandlersContext); - - if (context === null) { - throw "'useBottomSheetGestureHandlers' cannot be used out of the BottomSheet!"; - } - - return context; -}; -//# sourceMappingURL=useBottomSheetGestureHandlers.js.map \ No newline at end of file diff --git a/lib/module/hooks/useBottomSheetGestureHandlers.js.map b/lib/module/hooks/useBottomSheetGestureHandlers.js.map deleted file mode 100644 index 7a3105a5d..000000000 --- a/lib/module/hooks/useBottomSheetGestureHandlers.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["useBottomSheetGestureHandlers.ts"],"names":["useContext","BottomSheetGestureHandlersContext","useBottomSheetGestureHandlers","context"],"mappings":"AAAA,SAASA,UAAT,QAA2B,OAA3B;AACA,SAASC,iCAAT,QAAkD,qBAAlD;AAEA,OAAO,MAAMC,6BAA6B,GAAG,MAAM;AACjD,QAAMC,OAAO,GAAGH,UAAU,CAACC,iCAAD,CAA1B;;AAEA,MAAIE,OAAO,KAAK,IAAhB,EAAsB;AACpB,UAAM,wEAAN;AACD;;AAED,SAAOA,OAAP;AACD,CARM","sourcesContent":["import { useContext } from 'react';\nimport { BottomSheetGestureHandlersContext } from '../contexts/gesture';\n\nexport const useBottomSheetGestureHandlers = () => {\n const context = useContext(BottomSheetGestureHandlersContext);\n\n if (context === null) {\n throw \"'useBottomSheetGestureHandlers' cannot be used out of the BottomSheet!\";\n }\n\n return context;\n};\n"]} \ No newline at end of file diff --git a/lib/module/hooks/useBottomSheetInternal.js b/lib/module/hooks/useBottomSheetInternal.js deleted file mode 100644 index 9c0714881..000000000 --- a/lib/module/hooks/useBottomSheetInternal.js +++ /dev/null @@ -1,12 +0,0 @@ -import { useContext } from 'react'; -import { BottomSheetInternalContext } from '../contexts/internal'; -export function useBottomSheetInternal(unsafe) { - const context = useContext(BottomSheetInternalContext); - - if (unsafe !== true && context === null) { - throw "'useBottomSheetInternal' cannot be used out of the BottomSheet!"; - } - - return context; -} -//# sourceMappingURL=useBottomSheetInternal.js.map \ No newline at end of file diff --git a/lib/module/hooks/useBottomSheetInternal.js.map b/lib/module/hooks/useBottomSheetInternal.js.map deleted file mode 100644 index c4574ce96..000000000 --- a/lib/module/hooks/useBottomSheetInternal.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["useBottomSheetInternal.ts"],"names":["useContext","BottomSheetInternalContext","useBottomSheetInternal","unsafe","context"],"mappings":"AAAA,SAASA,UAAT,QAA2B,OAA3B;AACA,SACEC,0BADF,QAGO,sBAHP;AAaA,OAAO,SAASC,sBAAT,CACLC,MADK,EAEkC;AACvC,QAAMC,OAAO,GAAGJ,UAAU,CAACC,0BAAD,CAA1B;;AAEA,MAAIE,MAAM,KAAK,IAAX,IAAmBC,OAAO,KAAK,IAAnC,EAAyC;AACvC,UAAM,iEAAN;AACD;;AAED,SAAOA,OAAP;AACD","sourcesContent":["import { useContext } from 'react';\nimport {\n BottomSheetInternalContext,\n BottomSheetInternalContextType,\n} from '../contexts/internal';\n\nexport function useBottomSheetInternal(\n unsafe?: false\n): BottomSheetInternalContextType;\n\nexport function useBottomSheetInternal(\n unsafe: true\n): BottomSheetInternalContextType | null;\n\nexport function useBottomSheetInternal(\n unsafe?: boolean\n): BottomSheetInternalContextType | null {\n const context = useContext(BottomSheetInternalContext);\n\n if (unsafe !== true && context === null) {\n throw \"'useBottomSheetInternal' cannot be used out of the BottomSheet!\";\n }\n\n return context;\n}\n"]} \ No newline at end of file diff --git a/lib/module/hooks/useBottomSheetModal.js b/lib/module/hooks/useBottomSheetModal.js deleted file mode 100644 index 78de0c192..000000000 --- a/lib/module/hooks/useBottomSheetModal.js +++ /dev/null @@ -1,12 +0,0 @@ -import { useContext } from 'react'; -import { BottomSheetModalContext } from '../contexts'; -export const useBottomSheetModal = () => { - const context = useContext(BottomSheetModalContext); - - if (context === null) { - throw "'BottomSheetModalContext' cannot be null!"; - } - - return context; -}; -//# sourceMappingURL=useBottomSheetModal.js.map \ No newline at end of file diff --git a/lib/module/hooks/useBottomSheetModal.js.map b/lib/module/hooks/useBottomSheetModal.js.map deleted file mode 100644 index 0d21a8e39..000000000 --- a/lib/module/hooks/useBottomSheetModal.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["useBottomSheetModal.ts"],"names":["useContext","BottomSheetModalContext","useBottomSheetModal","context"],"mappings":"AAAA,SAASA,UAAT,QAA2B,OAA3B;AACA,SAASC,uBAAT,QAAwC,aAAxC;AAEA,OAAO,MAAMC,mBAAmB,GAAG,MAAM;AACvC,QAAMC,OAAO,GAAGH,UAAU,CAACC,uBAAD,CAA1B;;AAEA,MAAIE,OAAO,KAAK,IAAhB,EAAsB;AACpB,UAAM,2CAAN;AACD;;AAED,SAAOA,OAAP;AACD,CARM","sourcesContent":["import { useContext } from 'react';\nimport { BottomSheetModalContext } from '../contexts';\n\nexport const useBottomSheetModal = () => {\n const context = useContext(BottomSheetModalContext);\n\n if (context === null) {\n throw \"'BottomSheetModalContext' cannot be null!\";\n }\n\n return context;\n};\n"]} \ No newline at end of file diff --git a/lib/module/hooks/useBottomSheetModalInternal.js b/lib/module/hooks/useBottomSheetModalInternal.js deleted file mode 100644 index e8ada5721..000000000 --- a/lib/module/hooks/useBottomSheetModalInternal.js +++ /dev/null @@ -1,12 +0,0 @@ -import { useContext } from 'react'; -import { BottomSheetModalInternalContext } from '../contexts'; -export function useBottomSheetModalInternal(unsafe) { - const context = useContext(BottomSheetModalInternalContext); - - if (unsafe !== true && context === null) { - throw "'BottomSheetModalInternalContext' cannot be null!"; - } - - return context; -} -//# sourceMappingURL=useBottomSheetModalInternal.js.map \ No newline at end of file diff --git a/lib/module/hooks/useBottomSheetModalInternal.js.map b/lib/module/hooks/useBottomSheetModalInternal.js.map deleted file mode 100644 index a744e44ab..000000000 --- a/lib/module/hooks/useBottomSheetModalInternal.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["useBottomSheetModalInternal.ts"],"names":["useContext","BottomSheetModalInternalContext","useBottomSheetModalInternal","unsafe","context"],"mappings":"AAAA,SAASA,UAAT,QAA2B,OAA3B;AACA,SACEC,+BADF,QAGO,aAHP;AAaA,OAAO,SAASC,2BAAT,CACLC,MADK,EAEuC;AAC5C,QAAMC,OAAO,GAAGJ,UAAU,CAACC,+BAAD,CAA1B;;AAEA,MAAIE,MAAM,KAAK,IAAX,IAAmBC,OAAO,KAAK,IAAnC,EAAyC;AACvC,UAAM,mDAAN;AACD;;AAED,SAAOA,OAAP;AACD","sourcesContent":["import { useContext } from 'react';\nimport {\n BottomSheetModalInternalContext,\n BottomSheetModalInternalContextType,\n} from '../contexts';\n\nexport function useBottomSheetModalInternal(\n unsafe?: false\n): BottomSheetModalInternalContextType;\n\nexport function useBottomSheetModalInternal(\n unsafe: true\n): BottomSheetModalInternalContextType | null;\n\nexport function useBottomSheetModalInternal(\n unsafe?: boolean\n): BottomSheetModalInternalContextType | null {\n const context = useContext(BottomSheetModalInternalContext);\n\n if (unsafe !== true && context === null) {\n throw \"'BottomSheetModalInternalContext' cannot be null!\";\n }\n\n return context;\n}\n"]} \ No newline at end of file diff --git a/lib/module/hooks/useBottomSheetSpringConfigs.js b/lib/module/hooks/useBottomSheetSpringConfigs.js deleted file mode 100644 index d2632aa5c..000000000 --- a/lib/module/hooks/useBottomSheetSpringConfigs.js +++ /dev/null @@ -1,10 +0,0 @@ -import { useMemo } from 'react'; - -/** - * Generate spring animation configs. - * @param configs overridable configs. - */ -export const useBottomSheetSpringConfigs = configs => { - return useMemo(() => configs, [configs]); -}; -//# sourceMappingURL=useBottomSheetSpringConfigs.js.map \ No newline at end of file diff --git a/lib/module/hooks/useBottomSheetSpringConfigs.js.map b/lib/module/hooks/useBottomSheetSpringConfigs.js.map deleted file mode 100644 index 4f8e161c3..000000000 --- a/lib/module/hooks/useBottomSheetSpringConfigs.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["useBottomSheetSpringConfigs.ts"],"names":["useMemo","useBottomSheetSpringConfigs","configs"],"mappings":"AAAA,SAASA,OAAT,QAAwB,OAAxB;;AAGA;AACA;AACA;AACA;AACA,OAAO,MAAMC,2BAA2B,GACtCC,OADyC,IAEtC;AACH,SAAOF,OAAO,CAAC,MAAME,OAAP,EAAgB,CAACA,OAAD,CAAhB,CAAd;AACD,CAJM","sourcesContent":["import { useMemo } from 'react';\nimport type { WithSpringConfig } from 'react-native-reanimated';\n\n/**\n * Generate spring animation configs.\n * @param configs overridable configs.\n */\nexport const useBottomSheetSpringConfigs = (\n configs: Omit\n) => {\n return useMemo(() => configs, [configs]);\n};\n"]} \ No newline at end of file diff --git a/lib/module/hooks/useBottomSheetTimingConfigs.js b/lib/module/hooks/useBottomSheetTimingConfigs.js deleted file mode 100644 index 69cb8555d..000000000 --- a/lib/module/hooks/useBottomSheetTimingConfigs.js +++ /dev/null @@ -1,20 +0,0 @@ -import { useMemo } from 'react'; -import { ANIMATION_DURATION, ANIMATION_EASING } from '../constants'; -/** - * Generate timing animation configs. - * @default - * - easing: Easing.out(Easing.exp) - * - duration 250 - * @param configs overridable configs. - */ - -export const useBottomSheetTimingConfigs = configs => { - return useMemo(() => { - const _configs = { - easing: configs.easing || ANIMATION_EASING, - duration: configs.duration || ANIMATION_DURATION - }; - return _configs; - }, [configs.duration, configs.easing]); -}; -//# sourceMappingURL=useBottomSheetTimingConfigs.js.map \ No newline at end of file diff --git a/lib/module/hooks/useBottomSheetTimingConfigs.js.map b/lib/module/hooks/useBottomSheetTimingConfigs.js.map deleted file mode 100644 index c1c6950a3..000000000 --- a/lib/module/hooks/useBottomSheetTimingConfigs.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["useBottomSheetTimingConfigs.ts"],"names":["useMemo","ANIMATION_DURATION","ANIMATION_EASING","useBottomSheetTimingConfigs","configs","_configs","easing","duration"],"mappings":"AAAA,SAASA,OAAT,QAAwB,OAAxB;AAEA,SAASC,kBAAT,EAA6BC,gBAA7B,QAAqD,cAArD;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,2BAA2B,GAAIC,OAAD,IAA+B;AACxE,SAAOJ,OAAO,CAAC,MAAM;AACnB,UAAMK,QAA0B,GAAG;AACjCC,MAAAA,MAAM,EAAEF,OAAO,CAACE,MAAR,IAAkBJ,gBADO;AAEjCK,MAAAA,QAAQ,EAAEH,OAAO,CAACG,QAAR,IAAoBN;AAFG,KAAnC;AAKA,WAAOI,QAAP;AACD,GAPa,EAOX,CAACD,OAAO,CAACG,QAAT,EAAmBH,OAAO,CAACE,MAA3B,CAPW,CAAd;AAQD,CATM","sourcesContent":["import { useMemo } from 'react';\nimport type { WithTimingConfig } from 'react-native-reanimated';\nimport { ANIMATION_DURATION, ANIMATION_EASING } from '../constants';\n\n/**\n * Generate timing animation configs.\n * @default\n * - easing: Easing.out(Easing.exp)\n * - duration 250\n * @param configs overridable configs.\n */\nexport const useBottomSheetTimingConfigs = (configs: WithTimingConfig) => {\n return useMemo(() => {\n const _configs: WithTimingConfig = {\n easing: configs.easing || ANIMATION_EASING,\n duration: configs.duration || ANIMATION_DURATION,\n };\n\n return _configs;\n }, [configs.duration, configs.easing]);\n};\n"]} \ No newline at end of file diff --git a/lib/module/hooks/useGestureEventsHandlersDefault.js b/lib/module/hooks/useGestureEventsHandlersDefault.js deleted file mode 100644 index 4b8d9626f..000000000 --- a/lib/module/hooks/useGestureEventsHandlersDefault.js +++ /dev/null @@ -1,242 +0,0 @@ -import { Keyboard, Platform } from 'react-native'; -import { runOnJS, useWorkletCallback } from 'react-native-reanimated'; -import { useBottomSheetInternal } from './useBottomSheetInternal'; -import { ANIMATION_SOURCE, GESTURE_SOURCE, KEYBOARD_STATE, SCROLLABLE_TYPE, WINDOW_HEIGHT } from '../constants'; -import { clamp } from '../utilities/clamp'; -import { snapPoint } from '../utilities/snapPoint'; -const dismissKeyboard = Keyboard.dismiss; -export const useGestureEventsHandlersDefault = () => { - //#region variables - const { - animatedPosition, - animatedSnapPoints, - animatedKeyboardState, - animatedKeyboardHeight, - animatedContainerHeight, - animatedScrollableType, - animatedHighestSnapPoint, - animatedClosedPosition, - animatedScrollableContentOffsetY, - enableOverDrag, - enablePanDownToClose, - overDragResistanceFactor, - isInTemporaryPosition, - isScrollableRefreshable, - animateToPosition, - stopAnimation - } = useBottomSheetInternal(); //#endregion - //#region gesture methods - - const handleOnStart = useWorkletCallback(function handleOnStart(__, _, context) { - // cancel current animation - stopAnimation(); // store current animated position - - context.initialPosition = animatedPosition.value; - context.initialKeyboardState = animatedKeyboardState.value; - /** - * if the scrollable content is scrolled, then - * we lock the position. - */ - - if (animatedScrollableContentOffsetY.value > 0) { - context.isScrollablePositionLocked = true; - } - }, [stopAnimation, animatedPosition, animatedKeyboardState, animatedScrollableContentOffsetY]); - const handleOnActive = useWorkletCallback(function handleOnActive(source, { - translationY - }, context) { - let highestSnapPoint = animatedHighestSnapPoint.value; - /** - * if keyboard is shown, then we set the highest point to the current - * position which includes the keyboard height. - */ - - if (isInTemporaryPosition.value && context.initialKeyboardState === KEYBOARD_STATE.SHOWN) { - highestSnapPoint = context.initialPosition; - } - /** - * if current position is out of provided `snapPoints` and smaller then - * highest snap pont, then we set the highest point to the current position. - */ - - - if (isInTemporaryPosition.value && context.initialPosition < highestSnapPoint) { - highestSnapPoint = context.initialPosition; - } - - const lowestSnapPoint = enablePanDownToClose ? animatedContainerHeight.value : animatedSnapPoints.value[0]; - /** - * if scrollable is refreshable and sheet position at the highest - * point, then do not interact with current gesture. - */ - - if (source === GESTURE_SOURCE.SCROLLABLE && isScrollableRefreshable.value && animatedPosition.value === highestSnapPoint) { - return; - } - /** - * a negative scrollable content offset to be subtracted from accumulated - * current position and gesture translation Y to allow user to drag the sheet, - * when scrollable position at the top. - * a negative scrollable content offset when the scrollable is not locked. - */ - - - const negativeScrollableContentOffset = context.initialPosition === highestSnapPoint && source === GESTURE_SOURCE.SCROLLABLE || !context.isScrollablePositionLocked ? animatedScrollableContentOffsetY.value * -1 : 0; - /** - * an accumulated value of starting position with gesture translation y. - */ - - const draggedPosition = context.initialPosition + translationY; - /** - * an accumulated value of dragged position and negative scrollable content offset, - * this will insure locking sheet position when user is scrolling the scrollable until, - * they reach to the top of the scrollable. - */ - - const accumulatedDraggedPosition = draggedPosition + negativeScrollableContentOffset; - /** - * a clamped value of the accumulated dragged position, to insure keeping the dragged - * position between the highest and lowest snap points. - */ - - const clampedPosition = clamp(accumulatedDraggedPosition, highestSnapPoint, lowestSnapPoint); - /** - * if scrollable position is locked and the animated position - * reaches the highest point, then we unlock the scrollable position. - */ - - if (context.isScrollablePositionLocked && source === GESTURE_SOURCE.SCROLLABLE && animatedPosition.value === highestSnapPoint) { - context.isScrollablePositionLocked = false; - } - /** - * over-drag implementation. - */ - - - if (enableOverDrag) { - if ((source === GESTURE_SOURCE.HANDLE || animatedScrollableType.value === SCROLLABLE_TYPE.VIEW) && draggedPosition < highestSnapPoint) { - const resistedPosition = highestSnapPoint - Math.sqrt(1 + (highestSnapPoint - draggedPosition)) * overDragResistanceFactor; - animatedPosition.value = resistedPosition; - return; - } - - if (source === GESTURE_SOURCE.HANDLE && draggedPosition > lowestSnapPoint) { - const resistedPosition = lowestSnapPoint + Math.sqrt(1 + (draggedPosition - lowestSnapPoint)) * overDragResistanceFactor; - animatedPosition.value = resistedPosition; - return; - } - - if (source === GESTURE_SOURCE.SCROLLABLE && draggedPosition + negativeScrollableContentOffset > lowestSnapPoint) { - const resistedPosition = lowestSnapPoint + Math.sqrt(1 + (draggedPosition + negativeScrollableContentOffset - lowestSnapPoint)) * overDragResistanceFactor; - animatedPosition.value = resistedPosition; - return; - } - } - - animatedPosition.value = clampedPosition; - }, [enableOverDrag, enablePanDownToClose, overDragResistanceFactor, isInTemporaryPosition, isScrollableRefreshable, animatedHighestSnapPoint, animatedContainerHeight, animatedSnapPoints, animatedPosition, animatedScrollableType, animatedScrollableContentOffsetY]); - const handleOnEnd = useWorkletCallback(function handleOnEnd(source, { - translationY, - absoluteY, - velocityY - }, context) { - const highestSnapPoint = animatedHighestSnapPoint.value; - const isSheetAtHighestSnapPoint = animatedPosition.value === highestSnapPoint; - /** - * if scrollable is refreshable and sheet position at the highest - * point, then do not interact with current gesture. - */ - - if (source === GESTURE_SOURCE.SCROLLABLE && isScrollableRefreshable.value && isSheetAtHighestSnapPoint) { - return; - } - /** - * if the sheet is in a temporary position and the gesture ended above - * the current position, then we snap back to the temporary position. - */ - - - if (isInTemporaryPosition.value && context.initialPosition >= animatedPosition.value) { - if (context.initialPosition > animatedPosition.value) { - animateToPosition(context.initialPosition, ANIMATION_SOURCE.GESTURE, velocityY / 2); - } - - return; - } - /** - * close keyboard if current position is below the recorded - * start position and keyboard still shown. - */ - - - const isScrollable = animatedScrollableType.value !== SCROLLABLE_TYPE.UNDETERMINED && animatedScrollableType.value !== SCROLLABLE_TYPE.VIEW; - /** - * if keyboard is shown and the sheet is dragged down, - * then we dismiss the keyboard. - */ - - if (context.initialKeyboardState === KEYBOARD_STATE.SHOWN && animatedPosition.value > context.initialPosition) { - /** - * if the platform is ios, current content is scrollable and - * the end touch point is below the keyboard position then - * we exit the method. - * - * because the the keyboard dismiss is interactive in iOS. - */ - if (!(Platform.OS === 'ios' && isScrollable && absoluteY > WINDOW_HEIGHT - animatedKeyboardHeight.value)) { - runOnJS(dismissKeyboard)(); - } - } - /** - * reset isInTemporaryPosition value - */ - - - if (isInTemporaryPosition.value) { - isInTemporaryPosition.value = false; - } - /** - * clone snap points array, and insert the container height - * if pan down to close is enabled. - */ - - - const snapPoints = animatedSnapPoints.value.slice(); - - if (enablePanDownToClose) { - snapPoints.unshift(animatedClosedPosition.value); - } - /** - * calculate the destination point, using redash. - */ - - - const destinationPoint = snapPoint(translationY + context.initialPosition, velocityY, snapPoints); - /** - * if destination point is the same as the current position, - * then no need to perform animation. - */ - - if (destinationPoint === animatedPosition.value) { - return; - } - - const wasGestureHandledByScrollView = source === GESTURE_SOURCE.SCROLLABLE && animatedScrollableContentOffsetY.value > 0; - /** - * prevents snapping from top to middle / bottom with repeated interrupted scrolls - */ - - if (wasGestureHandledByScrollView && isSheetAtHighestSnapPoint) { - return; - } - - animateToPosition(destinationPoint, ANIMATION_SOURCE.GESTURE, velocityY / 2); - }, [enablePanDownToClose, isInTemporaryPosition, isScrollableRefreshable, animatedClosedPosition, animatedHighestSnapPoint, animatedKeyboardHeight, animatedPosition, animatedScrollableType, animatedSnapPoints, animatedScrollableContentOffsetY, animateToPosition]); //#endregion - - return { - handleOnStart, - handleOnActive, - handleOnEnd - }; -}; -//# sourceMappingURL=useGestureEventsHandlersDefault.js.map \ No newline at end of file diff --git a/lib/module/hooks/useGestureEventsHandlersDefault.js.map b/lib/module/hooks/useGestureEventsHandlersDefault.js.map deleted file mode 100644 index c6bf30554..000000000 --- a/lib/module/hooks/useGestureEventsHandlersDefault.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["useGestureEventsHandlersDefault.tsx"],"names":["Keyboard","Platform","runOnJS","useWorkletCallback","useBottomSheetInternal","ANIMATION_SOURCE","GESTURE_SOURCE","KEYBOARD_STATE","SCROLLABLE_TYPE","WINDOW_HEIGHT","clamp","snapPoint","dismissKeyboard","dismiss","useGestureEventsHandlersDefault","animatedPosition","animatedSnapPoints","animatedKeyboardState","animatedKeyboardHeight","animatedContainerHeight","animatedScrollableType","animatedHighestSnapPoint","animatedClosedPosition","animatedScrollableContentOffsetY","enableOverDrag","enablePanDownToClose","overDragResistanceFactor","isInTemporaryPosition","isScrollableRefreshable","animateToPosition","stopAnimation","handleOnStart","__","_","context","initialPosition","value","initialKeyboardState","isScrollablePositionLocked","handleOnActive","source","translationY","highestSnapPoint","SHOWN","lowestSnapPoint","SCROLLABLE","negativeScrollableContentOffset","draggedPosition","accumulatedDraggedPosition","clampedPosition","HANDLE","VIEW","resistedPosition","Math","sqrt","handleOnEnd","absoluteY","velocityY","isSheetAtHighestSnapPoint","GESTURE","isScrollable","UNDETERMINED","OS","snapPoints","slice","unshift","destinationPoint","wasGestureHandledByScrollView"],"mappings":"AAAA,SAASA,QAAT,EAAmBC,QAAnB,QAAmC,cAAnC;AACA,SAASC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cAFK;AAGLgB,IAAAA;AAHK,GAAP;AAKD,CA7VI","sourcesContent":["import { Keyboard, Platform } from 'react-native';\nimport { runOnJS, useWorkletCallback } from 'react-native-reanimated';\nimport { useBottomSheetInternal } from './useBottomSheetInternal';\nimport {\n ANIMATION_SOURCE,\n GESTURE_SOURCE,\n KEYBOARD_STATE,\n SCROLLABLE_TYPE,\n WINDOW_HEIGHT,\n} from '../constants';\nimport type {\n GestureEventsHandlersHookType,\n GestureEventHandlerCallbackType,\n} from '../types';\nimport { clamp } from '../utilities/clamp';\nimport { snapPoint } from '../utilities/snapPoint';\n\ntype GestureEventContextType = {\n initialPosition: number;\n initialKeyboardState: KEYBOARD_STATE;\n isScrollablePositionLocked: boolean;\n};\n\nconst dismissKeyboard = Keyboard.dismiss;\n\nexport const useGestureEventsHandlersDefault: GestureEventsHandlersHookType =\n () => {\n //#region variables\n const {\n animatedPosition,\n animatedSnapPoints,\n animatedKeyboardState,\n animatedKeyboardHeight,\n animatedContainerHeight,\n animatedScrollableType,\n animatedHighestSnapPoint,\n animatedClosedPosition,\n animatedScrollableContentOffsetY,\n enableOverDrag,\n enablePanDownToClose,\n overDragResistanceFactor,\n isInTemporaryPosition,\n isScrollableRefreshable,\n animateToPosition,\n stopAnimation,\n } = useBottomSheetInternal();\n //#endregion\n\n //#region gesture methods\n const handleOnStart: GestureEventHandlerCallbackType =\n useWorkletCallback(\n function handleOnStart(__, _, context) {\n // cancel current animation\n stopAnimation();\n\n // store current animated position\n context.initialPosition = animatedPosition.value;\n context.initialKeyboardState = animatedKeyboardState.value;\n\n /**\n * if the scrollable content is scrolled, then\n * we lock the position.\n */\n if (animatedScrollableContentOffsetY.value > 0) {\n context.isScrollablePositionLocked = true;\n }\n },\n [\n stopAnimation,\n animatedPosition,\n animatedKeyboardState,\n animatedScrollableContentOffsetY,\n ]\n );\n const handleOnActive: GestureEventHandlerCallbackType =\n useWorkletCallback(\n function handleOnActive(source, { translationY }, context) {\n let highestSnapPoint = animatedHighestSnapPoint.value;\n\n /**\n * if keyboard is shown, then we set the highest point to the current\n * position which includes the keyboard height.\n */\n if (\n isInTemporaryPosition.value &&\n context.initialKeyboardState === KEYBOARD_STATE.SHOWN\n ) {\n highestSnapPoint = context.initialPosition;\n }\n\n /**\n * if current position is out of provided `snapPoints` and smaller then\n * highest snap pont, then we set the highest point to the current position.\n */\n if (\n isInTemporaryPosition.value &&\n context.initialPosition < highestSnapPoint\n ) {\n highestSnapPoint = context.initialPosition;\n }\n\n const lowestSnapPoint = enablePanDownToClose\n ? animatedContainerHeight.value\n : animatedSnapPoints.value[0];\n\n /**\n * if scrollable is refreshable and sheet position at the highest\n * point, then do not interact with current gesture.\n */\n if (\n source === GESTURE_SOURCE.SCROLLABLE &&\n isScrollableRefreshable.value &&\n animatedPosition.value === highestSnapPoint\n ) {\n return;\n }\n\n /**\n * a negative scrollable content offset to be subtracted from accumulated\n * current position and gesture translation Y to allow user to drag the sheet,\n * when scrollable position at the top.\n * a negative scrollable content offset when the scrollable is not locked.\n */\n const negativeScrollableContentOffset =\n (context.initialPosition === highestSnapPoint &&\n source === GESTURE_SOURCE.SCROLLABLE) ||\n !context.isScrollablePositionLocked\n ? animatedScrollableContentOffsetY.value * -1\n : 0;\n\n /**\n * an accumulated value of starting position with gesture translation y.\n */\n const draggedPosition = context.initialPosition + translationY;\n\n /**\n * an accumulated value of dragged position and negative scrollable content offset,\n * this will insure locking sheet position when user is scrolling the scrollable until,\n * they reach to the top of the scrollable.\n */\n const accumulatedDraggedPosition =\n draggedPosition + negativeScrollableContentOffset;\n\n /**\n * a clamped value of the accumulated dragged position, to insure keeping the dragged\n * position between the highest and lowest snap points.\n */\n const clampedPosition = clamp(\n accumulatedDraggedPosition,\n highestSnapPoint,\n lowestSnapPoint\n );\n\n /**\n * if scrollable position is locked and the animated position\n * reaches the highest point, then we unlock the scrollable position.\n */\n if (\n context.isScrollablePositionLocked &&\n source === GESTURE_SOURCE.SCROLLABLE &&\n animatedPosition.value === highestSnapPoint\n ) {\n context.isScrollablePositionLocked = false;\n }\n\n /**\n * over-drag implementation.\n */\n if (enableOverDrag) {\n if (\n (source === GESTURE_SOURCE.HANDLE ||\n animatedScrollableType.value === SCROLLABLE_TYPE.VIEW) &&\n draggedPosition < highestSnapPoint\n ) {\n const resistedPosition =\n highestSnapPoint -\n Math.sqrt(1 + (highestSnapPoint - draggedPosition)) *\n overDragResistanceFactor;\n animatedPosition.value = resistedPosition;\n return;\n }\n\n if (\n source === GESTURE_SOURCE.HANDLE &&\n draggedPosition > lowestSnapPoint\n ) {\n const resistedPosition =\n lowestSnapPoint +\n Math.sqrt(1 + (draggedPosition - lowestSnapPoint)) *\n overDragResistanceFactor;\n animatedPosition.value = resistedPosition;\n return;\n }\n\n if (\n source === GESTURE_SOURCE.SCROLLABLE &&\n draggedPosition + negativeScrollableContentOffset >\n lowestSnapPoint\n ) {\n const resistedPosition =\n lowestSnapPoint +\n Math.sqrt(\n 1 +\n (draggedPosition +\n negativeScrollableContentOffset -\n lowestSnapPoint)\n ) *\n overDragResistanceFactor;\n animatedPosition.value = resistedPosition;\n return;\n }\n }\n\n animatedPosition.value = clampedPosition;\n },\n [\n enableOverDrag,\n enablePanDownToClose,\n overDragResistanceFactor,\n isInTemporaryPosition,\n isScrollableRefreshable,\n animatedHighestSnapPoint,\n animatedContainerHeight,\n animatedSnapPoints,\n animatedPosition,\n animatedScrollableType,\n animatedScrollableContentOffsetY,\n ]\n );\n const handleOnEnd: GestureEventHandlerCallbackType =\n useWorkletCallback(\n function handleOnEnd(\n source,\n { translationY, absoluteY, velocityY },\n context\n ) {\n const highestSnapPoint = animatedHighestSnapPoint.value;\n const isSheetAtHighestSnapPoint =\n animatedPosition.value === highestSnapPoint;\n\n /**\n * if scrollable is refreshable and sheet position at the highest\n * point, then do not interact with current gesture.\n */\n if (\n source === GESTURE_SOURCE.SCROLLABLE &&\n isScrollableRefreshable.value &&\n isSheetAtHighestSnapPoint\n ) {\n return;\n }\n\n /**\n * if the sheet is in a temporary position and the gesture ended above\n * the current position, then we snap back to the temporary position.\n */\n if (\n isInTemporaryPosition.value &&\n context.initialPosition >= animatedPosition.value\n ) {\n if (context.initialPosition > animatedPosition.value) {\n animateToPosition(\n context.initialPosition,\n ANIMATION_SOURCE.GESTURE,\n velocityY / 2\n );\n }\n return;\n }\n\n /**\n * close keyboard if current position is below the recorded\n * start position and keyboard still shown.\n */\n const isScrollable =\n animatedScrollableType.value !== SCROLLABLE_TYPE.UNDETERMINED &&\n animatedScrollableType.value !== SCROLLABLE_TYPE.VIEW;\n\n /**\n * if keyboard is shown and the sheet is dragged down,\n * then we dismiss the keyboard.\n */\n if (\n context.initialKeyboardState === KEYBOARD_STATE.SHOWN &&\n animatedPosition.value > context.initialPosition\n ) {\n /**\n * if the platform is ios, current content is scrollable and\n * the end touch point is below the keyboard position then\n * we exit the method.\n *\n * because the the keyboard dismiss is interactive in iOS.\n */\n if (\n !(\n Platform.OS === 'ios' &&\n isScrollable &&\n absoluteY > WINDOW_HEIGHT - animatedKeyboardHeight.value\n )\n ) {\n runOnJS(dismissKeyboard)();\n }\n }\n\n /**\n * reset isInTemporaryPosition value\n */\n if (isInTemporaryPosition.value) {\n isInTemporaryPosition.value = false;\n }\n\n /**\n * clone snap points array, and insert the container height\n * if pan down to close is enabled.\n */\n const snapPoints = animatedSnapPoints.value.slice();\n if (enablePanDownToClose) {\n snapPoints.unshift(animatedClosedPosition.value);\n }\n\n /**\n * calculate the destination point, using redash.\n */\n const destinationPoint = snapPoint(\n translationY + context.initialPosition,\n velocityY,\n snapPoints\n );\n\n /**\n * if destination point is the same as the current position,\n * then no need to perform animation.\n */\n if (destinationPoint === animatedPosition.value) {\n return;\n }\n\n const wasGestureHandledByScrollView =\n source === GESTURE_SOURCE.SCROLLABLE &&\n animatedScrollableContentOffsetY.value > 0;\n /**\n * prevents snapping from top to middle / bottom with repeated interrupted scrolls\n */\n if (wasGestureHandledByScrollView && isSheetAtHighestSnapPoint) {\n return;\n }\n\n animateToPosition(\n destinationPoint,\n ANIMATION_SOURCE.GESTURE,\n velocityY / 2\n );\n },\n [\n enablePanDownToClose,\n isInTemporaryPosition,\n isScrollableRefreshable,\n animatedClosedPosition,\n animatedHighestSnapPoint,\n animatedKeyboardHeight,\n animatedPosition,\n animatedScrollableType,\n animatedSnapPoints,\n animatedScrollableContentOffsetY,\n animateToPosition,\n ]\n );\n //#endregion\n\n return {\n handleOnStart,\n handleOnActive,\n handleOnEnd,\n };\n };\n"]} \ No newline at end of file diff --git a/lib/module/hooks/useGestureHandler.js b/lib/module/hooks/useGestureHandler.js deleted file mode 100644 index 0ca37d09d..000000000 --- a/lib/module/hooks/useGestureHandler.js +++ /dev/null @@ -1,71 +0,0 @@ -import { useAnimatedGestureHandler } from 'react-native-reanimated'; -import { State } from 'react-native-gesture-handler'; -import { GESTURE_SOURCE } from '../constants'; - -const resetContext = context => { - 'worklet'; - - Object.keys(context).map(key => { - context[key] = undefined; - }); -}; - -export const useGestureHandler = (type, state, gestureSource, handleOnStart, handleOnActive, handleOnEnd) => { - const gestureHandler = useAnimatedGestureHandler({ - onActive: (payload, context) => { - if (!context.didStart) { - context.didStart = true; - state.value = State.BEGAN; - gestureSource.value = type; - handleOnStart(type, payload, context); - return; - } - - if (gestureSource.value !== type) { - return; - } - - state.value = payload.state; - handleOnActive(type, payload, context); - }, - onEnd: (payload, context) => { - if (gestureSource.value !== type) { - return; - } - - state.value = payload.state; - gestureSource.value = GESTURE_SOURCE.UNDETERMINED; - handleOnEnd(type, payload, context); - resetContext(context); - }, - onCancel: (payload, context) => { - if (gestureSource.value !== type) { - return; - } - - state.value = payload.state; - gestureSource.value = GESTURE_SOURCE.UNDETERMINED; - resetContext(context); - }, - onFail: (payload, context) => { - if (gestureSource.value !== type) { - return; - } - - state.value = payload.state; - gestureSource.value = GESTURE_SOURCE.UNDETERMINED; - resetContext(context); - }, - onFinish: (payload, context) => { - if (gestureSource.value !== type) { - return; - } - - state.value = payload.state; - gestureSource.value = GESTURE_SOURCE.UNDETERMINED; - resetContext(context); - } - }, [type, state, handleOnStart, handleOnActive, handleOnEnd]); - return gestureHandler; -}; -//# sourceMappingURL=useGestureHandler.js.map \ No newline at end of file diff --git a/lib/module/hooks/useGestureHandler.js.map b/lib/module/hooks/useGestureHandler.js.map deleted file mode 100644 index ef48dbb79..000000000 --- a/lib/module/hooks/useGestureHandler.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["useGestureHandler.ts"],"names":["useAnimatedGestureHandler","State","GESTURE_SOURCE","resetContext","context","Object","keys","map","key","undefined","useGestureHandler","type","state","gestureSource","handleOnStart","handleOnActive","handleOnEnd","gestureHandler","onActive","payload","didStart","value","BEGAN","onEnd","UNDETERMINED","onCancel","onFail","onFinish"],"mappings":"AAAA,SAAmBA,yBAAnB,QAAoD,yBAApD;AACA,SACEC,KADF,QAGO,8BAHP;AAIA,SAASC,cAAT,QAA+B,cAA/B;;AAMA,MAAMC,YAAY,GAAIC,OAAD,IAAkB;AACrC;;AAEAC,EAAAA,MAAM,CAACC,IAAP,CAAYF,OAAZ,EAAqBG,GAArB,CAAyBC,GAAG,IAAI;AAC9BJ,IAAAA,OAAO,CAACI,GAAD,CAAP,GAAeC,SAAf;AACD,GAFD;AAGD,CAND;;AAQA,OAAO,MAAMC,iBAAiB,GAAG,CAC/BC,IAD+B,EAE/BC,KAF+B,EAG/BC,aAH+B,EAI/BC,aAJ+B,EAK/BC,cAL+B,EAM/BC,WAN+B,KAOsB;AACrD,QAAMC,cAAc,GAAGjB,yBAAyB,CAI9C;AACEkB,IAAAA,QAAQ,EAAE,CAACC,OAAD,EAAUf,OAAV,KAAsB;AAC9B,UAAI,CAACA,OAAO,CAACgB,QAAb,EAAuB;AACrBhB,QAAAA,OAAO,CAACgB,QAAR,GAAmB,IAAnB;AAEAR,QAAAA,KAAK,CAACS,KAAN,GAAcpB,KAAK,CAACqB,KAApB;AACAT,QAAAA,aAAa,CAACQ,KAAd,GAAsBV,IAAtB;AAEAG,QAAAA,aAAa,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,KAjDH;AAkDEuB,IAAAA,QAAQ,EAAE,CAACR,OAAD,EAAUf,OAAV,KAAsB;AAC9B,UAAIS,aAAa,CAACQ,KAAd,KAAwBV,IAA5B,EAAkC;AAChC;AACD;;AAEDC,MAAAA,KAAK,CAACS,KAAN,GAAcF,OAAO,CAACP,KAAtB;AACAC,MAAAA,aAAa,CAACQ,KAAd,GAAsBnB,cAAc,CAACsB,YAArC;AAEArB,MAAAA,YAAY,CAACC,OAAD,CAAZ;AACD;AA3DH,GAJ8C,EAiE9C,CAACO,IAAD,EAAOC,KAAP,EAAcE,aAAd,EAA6BC,cAA7B,EAA6CC,WAA7C,CAjE8C,CAAhD;AAmEA,SAAOC,cAAP;AACD,CA5EM","sourcesContent":["import Animated, { useAnimatedGestureHandler } from 'react-native-reanimated';\nimport {\n State,\n PanGestureHandlerGestureEvent,\n} from 'react-native-gesture-handler';\nimport { GESTURE_SOURCE } from '../constants';\nimport type {\n GestureEventContextType,\n GestureEventHandlerCallbackType,\n} from '../types';\n\nconst resetContext = (context: any) => {\n 'worklet';\n\n Object.keys(context).map(key => {\n context[key] = undefined;\n });\n};\n\nexport const useGestureHandler = (\n type: GESTURE_SOURCE,\n state: Animated.SharedValue,\n gestureSource: Animated.SharedValue,\n handleOnStart: GestureEventHandlerCallbackType,\n handleOnActive: GestureEventHandlerCallbackType,\n handleOnEnd: GestureEventHandlerCallbackType\n): ((event: PanGestureHandlerGestureEvent) => void) => {\n const gestureHandler = useAnimatedGestureHandler<\n PanGestureHandlerGestureEvent,\n GestureEventContextType\n >(\n {\n onActive: (payload, context) => {\n if (!context.didStart) {\n context.didStart = true;\n\n state.value = State.BEGAN;\n gestureSource.value = type;\n\n handleOnStart(type, payload, context);\n return;\n }\n\n if (gestureSource.value !== type) {\n return;\n }\n\n state.value = payload.state;\n handleOnActive(type, payload, context);\n },\n onEnd: (payload, context) => {\n if (gestureSource.value !== type) {\n return;\n }\n\n state.value = payload.state;\n gestureSource.value = GESTURE_SOURCE.UNDETERMINED;\n\n handleOnEnd(type, payload, context);\n resetContext(context);\n },\n onCancel: (payload, context) => {\n if (gestureSource.value !== type) {\n return;\n }\n\n state.value = payload.state;\n gestureSource.value = GESTURE_SOURCE.UNDETERMINED;\n\n resetContext(context);\n },\n onFail: (payload, context) => {\n if (gestureSource.value !== type) {\n return;\n }\n\n state.value = payload.state;\n gestureSource.value = GESTURE_SOURCE.UNDETERMINED;\n\n resetContext(context);\n },\n onFinish: (payload, context) => {\n if (gestureSource.value !== type) {\n return;\n }\n\n state.value = payload.state;\n gestureSource.value = GESTURE_SOURCE.UNDETERMINED;\n\n resetContext(context);\n },\n },\n [type, state, handleOnStart, handleOnActive, handleOnEnd]\n );\n return gestureHandler;\n};\n"]} \ No newline at end of file diff --git a/lib/module/hooks/useKeyboard.js b/lib/module/hooks/useKeyboard.js deleted file mode 100644 index 23008f350..000000000 --- a/lib/module/hooks/useKeyboard.js +++ /dev/null @@ -1,84 +0,0 @@ -import { useEffect } from 'react'; -import { Keyboard, Platform } from 'react-native'; -import { runOnUI, useAnimatedReaction, useSharedValue, useWorkletCallback } from 'react-native-reanimated'; -import { KEYBOARD_STATE } from '../constants'; -const KEYBOARD_EVENT_MAPPER = { - KEYBOARD_SHOW: Platform.select({ - ios: 'keyboardWillShow', - android: 'keyboardDidShow', - default: '' - }), - KEYBOARD_HIDE: Platform.select({ - ios: 'keyboardWillHide', - android: 'keyboardDidHide', - default: '' - }) -}; -export const useKeyboard = () => { - //#region variables - const shouldHandleKeyboardEvents = useSharedValue(false); - const keyboardState = useSharedValue(KEYBOARD_STATE.UNDETERMINED); - const keyboardHeight = useSharedValue(0); - const keyboardAnimationEasing = useSharedValue('keyboard'); - const keyboardAnimationDuration = useSharedValue(500); - const temporaryCachedKeyboardEvent = useSharedValue([]); //#endregion - //#region worklets - - const handleKeyboardEvent = useWorkletCallback((state, height, duration, easing) => { - if (state === KEYBOARD_STATE.SHOWN && !shouldHandleKeyboardEvents.value) { - /** - * if the keyboard event was fired before the `onFocus` on TextInput, - * then we cache the input, and wait till the `shouldHandleKeyboardEvents` - * to be updated then fire this function again. - */ - temporaryCachedKeyboardEvent.value = [state, height, duration, easing]; - return; - } - - keyboardHeight.value = state === KEYBOARD_STATE.SHOWN ? height : height === 0 ? keyboardHeight.value : height; - keyboardAnimationDuration.value = duration; - keyboardAnimationEasing.value = easing; - keyboardState.value = state; - temporaryCachedKeyboardEvent.value = []; - }, []); //#endregion - //#region effects - - useEffect(() => { - const handleOnKeyboardShow = event => { - runOnUI(handleKeyboardEvent)(KEYBOARD_STATE.SHOWN, event.endCoordinates.height, event.duration, event.easing); - }; - - const handleOnKeyboardHide = event => { - runOnUI(handleKeyboardEvent)(KEYBOARD_STATE.HIDDEN, event.endCoordinates.height, event.duration, event.easing); - }; - - const showSubscription = Keyboard.addListener(KEYBOARD_EVENT_MAPPER.KEYBOARD_SHOW, handleOnKeyboardShow); - const hideSubscription = Keyboard.addListener(KEYBOARD_EVENT_MAPPER.KEYBOARD_HIDE, handleOnKeyboardHide); - return () => { - showSubscription.remove(); - hideSubscription.remove(); - }; - }, [handleKeyboardEvent]); - /** - * This reaction is needed to handle the issue with multiline text input. - * - * @link https://github.com/gorhom/react-native-bottom-sheet/issues/411 - */ - - useAnimatedReaction(() => shouldHandleKeyboardEvents.value, result => { - const params = temporaryCachedKeyboardEvent.value; - - if (result && params.length > 0) { - handleKeyboardEvent(params[0], params[1], params[2], params[3]); - } - }); //#endregion - - return { - state: keyboardState, - height: keyboardHeight, - animationEasing: keyboardAnimationEasing, - animationDuration: keyboardAnimationDuration, - shouldHandleKeyboardEvents - }; -}; -//# sourceMappingURL=useKeyboard.js.map \ No newline at end of file diff --git a/lib/module/hooks/useKeyboard.js.map b/lib/module/hooks/useKeyboard.js.map deleted file mode 100644 index bddd4a3cf..000000000 --- a/lib/module/hooks/useKeyboard.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["useKeyboard.ts"],"names":["useEffect","Keyboard","Platform","runOnUI","useAnimatedReaction","useSharedValue","useWorkletCallback","KEYBOARD_STATE","KEYBOARD_EVENT_MAPPER","KEYBOARD_SHOW","select","ios","android","default","KEYBOARD_HIDE","useKeyboard","shouldHandleKeyboardEvents","keyboardState","UNDETERMINED","keyboardHeight","keyboardAnimationEasing","keyboardAnimationDuration","temporaryCachedKeyboardEvent","handleKeyboardEvent","state","height","duration","easing","SHOWN","value","handleOnKeyboardShow","event","endCoordinates","handleOnKeyboardHide","HIDDEN","showSubscription","addListener","hideSubscription","remove","result","params","length","animationEasing","animationDuration"],"mappings":"AAAA,SAASA,SAAT,QAA0B,OAA1B;AACA,SACEC,QADF,EAKEC,QALF,QAMO,cANP;AAOA,SACEC,OADF,EAEEC,mBAFF,EAGEC,cAHF,EAIEC,kBAJF,QAKO,yBALP;AAMA,SAASC,cAAT,QAA+B,cAA/B;AAEA,MAAMC,qBAAqB,GAAG;AAC5BC,EAAAA,aAAa,EAAEP,QAAQ,CAACQ,MAAT,CAAgB;AAC7BC,IAAAA,GAAG,EAAE,kBADwB;AAE7BC,IAAAA,OAAO,EAAE,iBAFoB;AAG7BC,IAAAA,OAAO,EAAE;AAHoB,GAAhB,CADa;AAM5BC,EAAAA,aAAa,EAAEZ,QAAQ,CAACQ,MAAT,CAAgB;AAC7BC,IAAAA,GAAG,EAAE,kBADwB;AAE7BC,IAAAA,OAAO,EAAE,iBAFoB;AAG7BC,IAAAA,OAAO,EAAE;AAHoB,GAAhB;AANa,CAA9B;AAaA,OAAO,MAAME,WAAW,GAAG,MAAM;AAC/B;AACA,QAAMC,0BAA0B,GAAGX,cAAc,CAAC,KAAD,CAAjD;AACA,QAAMY,aAAa,GAAGZ,cAAc,CAClCE,cAAc,CAACW,YADmB,CAApC;AAGA,QAAMC,cAAc,GAAGd,cAAc,CAAC,CAAD,CAArC;AACA,QAAMe,uBAAuB,GAC3Bf,cAAc,CAAsB,UAAtB,CADhB;AAEA,QAAMgB,yBAAyB,GAAGhB,cAAc,CAAC,GAAD,CAAhD;AACA,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K,CAACL,QAHR,EAIEK,KAAK,CAACJ,MAJR;AAMD,KAPD;;AASA,UAAMQ,gBAAgB,GAAGlC,QAAQ,CAACmC,WAAT,CACvB5B,qBAAqB,CAACC,aADC,EAEvBqB,oBAFuB,CAAzB;AAKA,UAAMO,gBAAgB,GAAGpC,QAAQ,CAACmC,WAAT,CACvB5B,qBAAqB,CAACM,aADC,EAEvBmB,oBAFuB,CAAzB;AAKA,WAAO,MAAM;AACXE,MAAAA,gBAAgB,CAACG,MAAjB;AACAD,MAAAA,gBAAgB,CAACC,MAAjB;AACD,KAHD;AAID,GAhCQ,EAgCN,CAACf,mBAAD,CAhCM,CAAT;AAkCA;AACF;AACA;AACA;AACA;;AACEnB,EAAAA,mBAAmB,CACjB,MAAMY,0BAA0B,CAACa,KADhB,EAEjBU,MAAM,IAAI;AACR,UAAMC,MAAM,GAAGlB,4BAA4B,CAACO,KAA5C;;AACA,QAAIU,MAAM,IAAIC,MAAM,CAACC,MAAP,GAAgB,CAA9B,EAAiC;AAC/BlB,MAAAA,mBAAmB,CAACiB,MAAM,CAAC,CAAD,CAAP,EAAYA,MAAM,CAAC,CAAD,CAAlB,EAAuBA,MAAM,CAAC,CAAD,CAA7B,EAAkCA,MAAM,CAAC,CAAD,CAAxC,CAAnB;AACD;AACF,GAPgB,CAAnB,CAhF+B,CAyF/B;;AAEA,SAAO;AACLhB,IAAAA,KAAK,EAAEP,aADF;AAELQ,IAAAA,MAAM,EAAEN,cAFH;AAGLuB,IAAAA,eAAe,EAAEtB,uBAHZ;AAILuB,IAAAA,iBAAiB,EAAEtB,yBAJd;AAKLL,IAAAA;AALK,GAAP;AAOD,CAlGM","sourcesContent":["import { useEffect } from 'react';\nimport {\n Keyboard,\n KeyboardEvent,\n KeyboardEventEasing,\n KeyboardEventName,\n Platform,\n} from 'react-native';\nimport {\n runOnUI,\n useAnimatedReaction,\n useSharedValue,\n useWorkletCallback,\n} from 'react-native-reanimated';\nimport { KEYBOARD_STATE } from '../constants';\n\nconst KEYBOARD_EVENT_MAPPER = {\n KEYBOARD_SHOW: Platform.select({\n ios: 'keyboardWillShow',\n android: 'keyboardDidShow',\n default: '',\n }) as KeyboardEventName,\n KEYBOARD_HIDE: Platform.select({\n ios: 'keyboardWillHide',\n android: 'keyboardDidHide',\n default: '',\n }) as KeyboardEventName,\n};\n\nexport const useKeyboard = () => {\n //#region variables\n const shouldHandleKeyboardEvents = useSharedValue(false);\n const keyboardState = useSharedValue(\n KEYBOARD_STATE.UNDETERMINED\n );\n const keyboardHeight = useSharedValue(0);\n const keyboardAnimationEasing =\n useSharedValue('keyboard');\n const keyboardAnimationDuration = useSharedValue(500);\n const temporaryCachedKeyboardEvent = useSharedValue([]);\n //#endregion\n\n //#region worklets\n const handleKeyboardEvent = useWorkletCallback(\n (state, height, duration, easing) => {\n if (state === KEYBOARD_STATE.SHOWN && !shouldHandleKeyboardEvents.value) {\n /**\n * if the keyboard event was fired before the `onFocus` on TextInput,\n * then we cache the input, and wait till the `shouldHandleKeyboardEvents`\n * to be updated then fire this function again.\n */\n temporaryCachedKeyboardEvent.value = [state, height, duration, easing];\n return;\n }\n keyboardHeight.value =\n state === KEYBOARD_STATE.SHOWN\n ? height\n : height === 0\n ? keyboardHeight.value\n : height;\n keyboardAnimationDuration.value = duration;\n keyboardAnimationEasing.value = easing;\n keyboardState.value = state;\n temporaryCachedKeyboardEvent.value = [];\n },\n []\n );\n //#endregion\n\n //#region effects\n useEffect(() => {\n const handleOnKeyboardShow = (event: KeyboardEvent) => {\n runOnUI(handleKeyboardEvent)(\n KEYBOARD_STATE.SHOWN,\n event.endCoordinates.height,\n event.duration,\n event.easing\n );\n };\n const handleOnKeyboardHide = (event: KeyboardEvent) => {\n runOnUI(handleKeyboardEvent)(\n KEYBOARD_STATE.HIDDEN,\n event.endCoordinates.height,\n event.duration,\n event.easing\n );\n };\n\n const showSubscription = Keyboard.addListener(\n KEYBOARD_EVENT_MAPPER.KEYBOARD_SHOW,\n handleOnKeyboardShow\n );\n\n const hideSubscription = Keyboard.addListener(\n KEYBOARD_EVENT_MAPPER.KEYBOARD_HIDE,\n handleOnKeyboardHide\n );\n\n return () => {\n showSubscription.remove();\n hideSubscription.remove();\n };\n }, [handleKeyboardEvent]);\n\n /**\n * This reaction is needed to handle the issue with multiline text input.\n *\n * @link https://github.com/gorhom/react-native-bottom-sheet/issues/411\n */\n useAnimatedReaction(\n () => shouldHandleKeyboardEvents.value,\n result => {\n const params = temporaryCachedKeyboardEvent.value;\n if (result && params.length > 0) {\n handleKeyboardEvent(params[0], params[1], params[2], params[3]);\n }\n }\n );\n //#endregion\n\n return {\n state: keyboardState,\n height: keyboardHeight,\n animationEasing: keyboardAnimationEasing,\n animationDuration: keyboardAnimationDuration,\n shouldHandleKeyboardEvents,\n };\n};\n"]} \ No newline at end of file diff --git a/lib/module/hooks/useNormalizedSnapPoints.js b/lib/module/hooks/useNormalizedSnapPoints.js deleted file mode 100644 index d77d80d57..000000000 --- a/lib/module/hooks/useNormalizedSnapPoints.js +++ /dev/null @@ -1,47 +0,0 @@ -import { useDerivedValue } from 'react-native-reanimated'; -import { normalizeSnapPoint } from '../utilities'; -import { INITIAL_CONTAINER_HEIGHT, INITIAL_HANDLE_HEIGHT, INITIAL_SNAP_POINT } from '../components/bottomSheet/constants'; -/** - * Convert percentage snap points to pixels in screen and calculate - * the accurate snap points positions. - * @param snapPoints provided snap points. - * @param containerHeight BottomSheetContainer height. - * @param contentHeight content size. - * @param handleHeight handle size. - * @param enableDynamicSizing - * @param maxDynamicContentSize - * @returns {Animated.SharedValue} - */ - -export const useNormalizedSnapPoints = (snapPoints, containerHeight, contentHeight, handleHeight, enableDynamicSizing, maxDynamicContentSize) => { - const normalizedSnapPoints = useDerivedValue(() => { - // early exit, if container layout is not ready - const isContainerLayoutReady = containerHeight.value !== INITIAL_CONTAINER_HEIGHT; - - if (!isContainerLayoutReady) { - return [INITIAL_SNAP_POINT]; - } - - const _snapPoints = snapPoints ? 'value' in snapPoints ? snapPoints.value : snapPoints : []; - - let _normalizedSnapPoints = _snapPoints.map(snapPoint => normalizeSnapPoint(snapPoint, containerHeight.value)); - - if (enableDynamicSizing) { - if (handleHeight.value === INITIAL_HANDLE_HEIGHT) { - return [INITIAL_SNAP_POINT]; - } - - if (contentHeight.value === INITIAL_CONTAINER_HEIGHT) { - return [INITIAL_SNAP_POINT]; - } - - _normalizedSnapPoints.push(containerHeight.value - Math.min(contentHeight.value + handleHeight.value, maxDynamicContentSize !== undefined ? maxDynamicContentSize : containerHeight.value)); - - _normalizedSnapPoints = _normalizedSnapPoints.sort((a, b) => b - a); - } - - return _normalizedSnapPoints; - }, [snapPoints, enableDynamicSizing, maxDynamicContentSize]); - return normalizedSnapPoints; -}; -//# sourceMappingURL=useNormalizedSnapPoints.js.map \ No newline at end of file diff --git a/lib/module/hooks/useNormalizedSnapPoints.js.map b/lib/module/hooks/useNormalizedSnapPoints.js.map deleted file mode 100644 index 7c70bcace..000000000 --- a/lib/module/hooks/useNormalizedSnapPoints.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["useNormalizedSnapPoints.ts"],"names":["useDerivedValue","normalizeSnapPoint","INITIAL_CONTAINER_HEIGHT","INITIAL_HANDLE_HEIGHT","INITIAL_SNAP_POINT","useNormalizedSnapPoints","snapPoints","containerHeight","contentHeight","handleHeight","enableDynamicSizing","maxDynamicContentSize","normalizedSnapPoints","isContainerLayoutReady","value","_snapPoints","_normalizedSnapPoints","map","snapPoint","push","Math","min","undefined","sort","a","b"],"mappings":"AAAA,SAAmBA,eAAnB,QAA0C,yBAA1C;AACA,SAASC,kBAAT,QAAmC,cAAnC;AAEA,SACEC,wBADF,EAEEC,qBAFF,EAGEC,kBAHF,QAIO,qCAJP;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,uBAAuB,GAAG,CACrCC,UADqC,EAErCC,eAFqC,EAGrCC,aAHqC,EAIrCC,YAJqC,EAKrCC,mBALqC,EAMrCC,qBANqC,KAOlC;AACH,QAAMC,oBAAoB,GAAGZ,eAAe,CAAC,MAAM;AACjD;AACA,UAAMa,sBAAsB,GAC1BN,eAAe,CAACO,KAAhB,KAA0BZ,wBAD5B;;AAEA,QAAI,CAACW,sBAAL,EAA6B;AAC3B,aAAO,CAACT,kBAAD,CAAP;AACD;;AAED,UAAMW,WAAW,GAAGT,UAAU,GAC1B,WAAWA,UAAX,GACEA,UAAU,CAACQ,KADb,GAEER,UAHwB,GAI1B,EAJJ;;AAMA,QAAIU,qBAAqB,GAAGD,WAAW,CAACE,GAAZ,CAAgBC,SAAS,IACnDjB,kBAAkB,CAACiB,SAAD,EAAYX,eAAe,CAACO,KAA5B,CADQ,CAA5B;;AAIA,QAAIJ,mBAAJ,EAAyB;AACvB,UAAID,YAAY,CAACK,KAAb,KAAuBX,qBAA3B,EAAkD;AAChD,eAAO,CAACC,kBAAD,CAAP;AACD;;AAED,UAAII,aAAa,CAACM,KAAd,KAAwBZ,wBAA5B,EAAsD;AACpD,eAAO,CAACE,kBAAD,CAAP;AACD;;AAEDY,MAAAA,qBAAqB,CAACG,IAAtB,CACEZ,eAAe,CAACO,KAAhB,GACEM,IAAI,CAACC,GAAL,CACEb,aAAa,CAACM,KAAd,GAAsBL,YAAY,CAACK,KADrC,EAEEH,qBAAqB,KAAKW,SAA1B,GACIX,qBADJ,GAEIJ,eAAe,CAACO,KAJtB,CAFJ;;AAUAE,MAAAA,qBAAqB,GAAGA,qBAAqB,CAACO,IAAtB,CAA2B,CAACC,CAAD,EAAIC,CAAJ,KAAUA,CAAC,GAAGD,CAAzC,CAAxB;AACD;;AACD,WAAOR,qBAAP;AACD,GAxC2C,EAwCzC,CAACV,UAAD,EAAaI,mBAAb,EAAkCC,qBAAlC,CAxCyC,CAA5C;AA0CA,SAAOC,oBAAP;AACD,CAnDM","sourcesContent":["import Animated, { useDerivedValue } from 'react-native-reanimated';\nimport { normalizeSnapPoint } from '../utilities';\nimport type { BottomSheetProps } from '../components/bottomSheet';\nimport {\n INITIAL_CONTAINER_HEIGHT,\n INITIAL_HANDLE_HEIGHT,\n INITIAL_SNAP_POINT,\n} from '../components/bottomSheet/constants';\n\n/**\n * Convert percentage snap points to pixels in screen and calculate\n * the accurate snap points positions.\n * @param snapPoints provided snap points.\n * @param containerHeight BottomSheetContainer height.\n * @param contentHeight content size.\n * @param handleHeight handle size.\n * @param enableDynamicSizing\n * @param maxDynamicContentSize\n * @returns {Animated.SharedValue}\n */\nexport const useNormalizedSnapPoints = (\n snapPoints: BottomSheetProps['snapPoints'],\n containerHeight: Animated.SharedValue,\n contentHeight: Animated.SharedValue,\n handleHeight: Animated.SharedValue,\n enableDynamicSizing: BottomSheetProps['enableDynamicSizing'],\n maxDynamicContentSize: BottomSheetProps['maxDynamicContentSize']\n) => {\n const normalizedSnapPoints = useDerivedValue(() => {\n // early exit, if container layout is not ready\n const isContainerLayoutReady =\n containerHeight.value !== INITIAL_CONTAINER_HEIGHT;\n if (!isContainerLayoutReady) {\n return [INITIAL_SNAP_POINT];\n }\n\n const _snapPoints = snapPoints\n ? 'value' in snapPoints\n ? snapPoints.value\n : snapPoints\n : [];\n\n let _normalizedSnapPoints = _snapPoints.map(snapPoint =>\n normalizeSnapPoint(snapPoint, containerHeight.value)\n ) as number[];\n\n if (enableDynamicSizing) {\n if (handleHeight.value === INITIAL_HANDLE_HEIGHT) {\n return [INITIAL_SNAP_POINT];\n }\n\n if (contentHeight.value === INITIAL_CONTAINER_HEIGHT) {\n return [INITIAL_SNAP_POINT];\n }\n\n _normalizedSnapPoints.push(\n containerHeight.value -\n Math.min(\n contentHeight.value + handleHeight.value,\n maxDynamicContentSize !== undefined\n ? maxDynamicContentSize\n : containerHeight.value\n )\n );\n\n _normalizedSnapPoints = _normalizedSnapPoints.sort((a, b) => b - a);\n }\n return _normalizedSnapPoints;\n }, [snapPoints, enableDynamicSizing, maxDynamicContentSize]);\n\n return normalizedSnapPoints;\n};\n"]} \ No newline at end of file diff --git a/lib/module/hooks/usePropsValidator.js b/lib/module/hooks/usePropsValidator.js deleted file mode 100644 index 2009ef8dc..000000000 --- a/lib/module/hooks/usePropsValidator.js +++ /dev/null @@ -1,40 +0,0 @@ -import { useMemo } from 'react'; -import invariant from 'invariant'; -import { INITIAL_SNAP_POINT } from '../components/bottomSheet/constants'; - -/** - * @todo - * replace this with `prop-types`. - */ -export const usePropsValidator = ({ - index, - snapPoints, - enableDynamicSizing, - topInset, - bottomInset -}) => { - useMemo(() => { - //#region snap points - const _snapPoints = snapPoints ? 'value' in snapPoints ? snapPoints.value : snapPoints : []; - - invariant(_snapPoints || enableDynamicSizing, `'snapPoints' was not provided! please provide at least one snap point.`); - - _snapPoints.map(snapPoint => { - const _snapPoint = typeof snapPoint === 'number' ? snapPoint : parseInt(snapPoint.replace('%', ''), 10); - - invariant(_snapPoint > 0 || _snapPoint === INITIAL_SNAP_POINT, `Snap point '${snapPoint}' is invalid. if you want to allow user to close the sheet, Please use 'enablePanDownToClose' prop.`); - }); - - invariant('value' in _snapPoints || _snapPoints.length > 0 || enableDynamicSizing, `'snapPoints' was provided with no points! please provide at least one snap point.`); //#endregion - //#region index - - invariant(typeof index === 'number' || typeof index === 'undefined', `'index' was provided but with wrong type ! expected type is a number.`); - invariant(enableDynamicSizing || (typeof index === 'number' ? index >= -1 && index <= _snapPoints.length - 1 : true), `'index' was provided but out of the provided snap points range! expected value to be between -1, ${_snapPoints.length - 1}`); //#endregion - //#region insets - - invariant(typeof topInset === 'number' || typeof topInset === 'undefined', `'topInset' was provided but with wrong type ! expected type is a number.`); - invariant(typeof bottomInset === 'number' || typeof bottomInset === 'undefined', `'bottomInset' was provided but with wrong type ! expected type is a number.`); //#endregion - // animations - }, [index, snapPoints, topInset, bottomInset, enableDynamicSizing]); -}; -//# sourceMappingURL=usePropsValidator.js.map \ No newline at end of file diff --git a/lib/module/hooks/usePropsValidator.js.map b/lib/module/hooks/usePropsValidator.js.map deleted file mode 100644 index e5a0d1d4f..000000000 --- a/lib/module/hooks/usePropsValidator.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["usePropsValidator.ts"],"names":["useMemo","invariant","INITIAL_SNAP_POINT","usePropsValidator","index","snapPoints","enableDynamicSizing","topInset","bottomInset","_snapPoints","value","map","snapPoint","_snapPoint","parseInt","replace","length"],"mappings":"AAAA,SAASA,OAAT,QAAwB,OAAxB;AACA,OAAOC,SAAP,MAAsB,WAAtB;AACA,SAASC,kBAAT,QAAmC,qCAAnC;;AAGA;AACA;AACA;AACA;AAEA,OAAO,MAAMC,iBAAiB,GAAG,CAAC;AAChCC,EAAAA,KADgC;AAEhCC,EAAAA,UAFgC;AAGhCC,EAAAA,mBAHgC;AAIhCC,EAAAA,QAJgC;AAKhCC,EAAAA;AALgC,CAAD,KAMT;AACtBR,EAAAA,OAAO,CAAC,MAAM;AACZ;AACA,UAAMS,WAAW,GAAGJ,UAAU,GAC1B,WAAWA,UAAX,GACEA,UAAU,CAACK,KADb,GAEEL,UAHwB,GAI1B,EAJJ;;AAKAJ,IAAAA,SAAS,CACPQ,WAAW,IAAIH,mBADR,EAEN,wEAFM,CAAT;;AAKAG,IAAAA,WAAW,CAACE,GAAZ,CAAgBC,SAAS,IAAI;AAC3B,YAAMC,UAAU,GACd,OAAOD,SAAP,KAAqB,QAArB,GACIA,SADJ,GAEIE,QAAQ,CAACF,SAAS,CAACG,OAAV,CAAkB,GAAlB,EAAuB,EAAvB,CAAD,EAA6B,EAA7B,CAHd;;AAKAd,MAAAA,SAAS,CACPY,UAAU,GAAG,CAAb,IAAkBA,UAAU,KAAKX,kBAD1B,EAEN,eAAcU,SAAU,qGAFlB,CAAT;AAID,KAVD;;AAYAX,IAAAA,SAAS,CACP,WAAWQ,WAAX,IAA0BA,WAAW,CAACO,MAAZ,GAAqB,CAA/C,IAAoDV,mBAD7C,EAEN,mFAFM,CAAT,CAxBY,CA4BZ;AAEA;;AACAL,IAAAA,SAAS,CACP,OAAOG,KAAP,KAAiB,QAAjB,IAA6B,OAAOA,KAAP,KAAiB,WADvC,EAEN,uEAFM,CAAT;AAKAH,IAAAA,SAAS,CACPK,mBAAmB,KAChB,OAAOF,KAAP,KAAiB,QAAjB,GACGA,KAAK,IAAI,CAAC,CAAV,IAAeA,KAAK,IAAIK,WAAW,CAACO,MAAZ,GAAqB,CADhD,GAEG,IAHa,CADZ,EAKN,oGACCP,WAAW,CAACO,MAAZ,GAAqB,CACtB,EAPM,CAAT,CApCY,CA6CZ;AAEA;;AACAf,IAAAA,SAAS,CACP,OAAOM,QAAP,KAAoB,QAApB,IAAgC,OAAOA,QAAP,KAAoB,WAD7C,EAEN,0EAFM,CAAT;AAIAN,IAAAA,SAAS,CACP,OAAOO,WAAP,KAAuB,QAAvB,IAAmC,OAAOA,WAAP,KAAuB,WADnD,EAEN,6EAFM,CAAT,CApDY,CAwDZ;AAEA;AACD,GA3DM,EA2DJ,CAACJ,KAAD,EAAQC,UAAR,EAAoBE,QAApB,EAA8BC,WAA9B,EAA2CF,mBAA3C,CA3DI,CAAP;AA4DD,CAnEM","sourcesContent":["import { useMemo } from 'react';\nimport invariant from 'invariant';\nimport { INITIAL_SNAP_POINT } from '../components/bottomSheet/constants';\nimport type { BottomSheetProps } from '../components/bottomSheet';\n\n/**\n * @todo\n * replace this with `prop-types`.\n */\n\nexport const usePropsValidator = ({\n index,\n snapPoints,\n enableDynamicSizing,\n topInset,\n bottomInset,\n}: BottomSheetProps) => {\n useMemo(() => {\n //#region snap points\n const _snapPoints = snapPoints\n ? 'value' in snapPoints\n ? snapPoints.value\n : snapPoints\n : [];\n invariant(\n _snapPoints || enableDynamicSizing,\n `'snapPoints' was not provided! please provide at least one snap point.`\n );\n\n _snapPoints.map(snapPoint => {\n const _snapPoint =\n typeof snapPoint === 'number'\n ? snapPoint\n : parseInt(snapPoint.replace('%', ''), 10);\n\n invariant(\n _snapPoint > 0 || _snapPoint === INITIAL_SNAP_POINT,\n `Snap point '${snapPoint}' is invalid. if you want to allow user to close the sheet, Please use 'enablePanDownToClose' prop.`\n );\n });\n\n invariant(\n 'value' in _snapPoints || _snapPoints.length > 0 || enableDynamicSizing,\n `'snapPoints' was provided with no points! please provide at least one snap point.`\n );\n //#endregion\n\n //#region index\n invariant(\n typeof index === 'number' || typeof index === 'undefined',\n `'index' was provided but with wrong type ! expected type is a number.`\n );\n\n invariant(\n enableDynamicSizing ||\n (typeof index === 'number'\n ? index >= -1 && index <= _snapPoints.length - 1\n : true),\n `'index' was provided but out of the provided snap points range! expected value to be between -1, ${\n _snapPoints.length - 1\n }`\n );\n //#endregion\n\n //#region insets\n invariant(\n typeof topInset === 'number' || typeof topInset === 'undefined',\n `'topInset' was provided but with wrong type ! expected type is a number.`\n );\n invariant(\n typeof bottomInset === 'number' || typeof bottomInset === 'undefined',\n `'bottomInset' was provided but with wrong type ! expected type is a number.`\n );\n //#endregion\n\n // animations\n }, [index, snapPoints, topInset, bottomInset, enableDynamicSizing]);\n};\n"]} \ No newline at end of file diff --git a/lib/module/hooks/useReactiveSharedValue.js b/lib/module/hooks/useReactiveSharedValue.js deleted file mode 100644 index d8b0e1458..000000000 --- a/lib/module/hooks/useReactiveSharedValue.js +++ /dev/null @@ -1,44 +0,0 @@ -import { useEffect, useRef } from 'react'; -import { cancelAnimation, makeMutable } from 'react-native-reanimated'; -export const useReactiveSharedValue = value => { - var _valueRef$current; - - const initialValueRef = useRef(null); - const valueRef = useRef(null); - - if (value && typeof value === 'object' && 'value' in value) { - /** - * if provided value is a shared value, - * then we do not initialize another one. - */ - } else if (valueRef.current === null) { - // @ts-ignore - initialValueRef.current = value; - /** - * if value is an object, then we need to - * pass a clone. - */ - - if (typeof value === 'object') { - // @ts-ignore - valueRef.current = makeMutable({ ...value - }); - } else { - // @ts-ignore - valueRef.current = makeMutable(value); - } - } else if (initialValueRef.current !== value) { - valueRef.current.value = value; - } - - useEffect(() => { - return () => { - if (valueRef.current) { - cancelAnimation(valueRef.current); - } - }; - }, []); // @ts-ignore - - return (_valueRef$current = valueRef.current) !== null && _valueRef$current !== void 0 ? _valueRef$current : value; -}; -//# sourceMappingURL=useReactiveSharedValue.js.map \ No newline at end of file diff --git a/lib/module/hooks/useReactiveSharedValue.js.map b/lib/module/hooks/useReactiveSharedValue.js.map deleted file mode 100644 index 89acc7711..000000000 --- a/lib/module/hooks/useReactiveSharedValue.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["useReactiveSharedValue.ts"],"names":["useEffect","useRef","cancelAnimation","makeMutable","useReactiveSharedValue","value","initialValueRef","valueRef","current"],"mappings":"AAAA,SAASA,SAAT,EAAoBC,MAApB,QAAkC,OAAlC;AACA,SACEC,eADF,EAEEC,WAFF,QAGO,yBAHP;AAMA,OAAO,MAAMC,sBAAsB,GACjCC,KADoC,IAEkB;AAAA;;AACtD,QAAMC,eAAe,GAAGL,MAAM,CAAI,IAAJ,CAA9B;AACA,QAAMM,QAAQ,GAAGN,MAAM,CAA0B,IAA1B,CAAvB;;AAEA,MAAII,KAAK,IAAI,OAAOA,KAAP,KAAiB,QAA1B,IAAsC,WAAWA,KAArD,EAA4D;AAC1D;AACJ;AACA;AACA;AACG,GALD,MAKO,IAAIE,QAAQ,CAACC,OAAT,KAAqB,IAAzB,EAA+B;AACpC;AACAF,IAAAA,eAAe,CAACE,OAAhB,GAA0BH,KAA1B;AACA;AACJ;AACA;AACA;;AACI,QAAI,OAAOA,KAAP,KAAiB,QAArB,EAA+B;AAC7B;AACAE,MAAAA,QAAQ,CAACC,OAAT,GAAmBL,WAAW,CAAC,EAAE,GAAGE;AAAL,OAAD,CAA9B;AACD,KAHD,MAGO;AACL;AACAE,MAAAA,QAAQ,CAACC,OAAT,GAAmBL,WAAW,CAACE,KAAD,CAA9B;AACD;AACF,GAdM,MAcA,IAAIC,eAAe,CAACE,OAAhB,KAA4BH,KAAhC,EAAuC;AAC5CE,IAAAA,QAAQ,CAACC,OAAT,CAAiBH,KAAjB,GAAyBA,KAAzB;AACD;;AAEDL,EAAAA,SAAS,CAAC,MAAM;AACd,WAAO,MAAM;AACX,UAAIO,QAAQ,CAACC,OAAb,EAAsB;AACpBN,QAAAA,eAAe,CAACK,QAAQ,CAACC,OAAV,CAAf;AACD;AACF,KAJD;AAKD,GANQ,EAMN,EANM,CAAT,CA3BsD,CAmCtD;;AACA,8BAAOD,QAAQ,CAACC,OAAhB,iEAA2BH,KAA3B;AACD,CAvCM","sourcesContent":["import { useEffect, useRef } from 'react';\nimport Animated, {\n cancelAnimation,\n makeMutable,\n} from 'react-native-reanimated';\nimport type { Primitive } from '../types';\n\nexport const useReactiveSharedValue = (\n value: T\n): T extends Primitive ? Animated.SharedValue : T => {\n const initialValueRef = useRef(null);\n const valueRef = useRef>(null);\n\n if (value && typeof value === 'object' && 'value' in value) {\n /**\n * if provided value is a shared value,\n * then we do not initialize another one.\n */\n } else if (valueRef.current === null) {\n // @ts-ignore\n initialValueRef.current = value;\n /**\n * if value is an object, then we need to\n * pass a clone.\n */\n if (typeof value === 'object') {\n // @ts-ignore\n valueRef.current = makeMutable({ ...value });\n } else {\n // @ts-ignore\n valueRef.current = makeMutable(value);\n }\n } else if (initialValueRef.current !== value) {\n valueRef.current.value = value as T;\n }\n\n useEffect(() => {\n return () => {\n if (valueRef.current) {\n cancelAnimation(valueRef.current);\n }\n };\n }, []);\n\n // @ts-ignore\n return valueRef.current ?? value;\n};\n"]} \ No newline at end of file diff --git a/lib/module/hooks/useScrollEventsHandlersDefault.js b/lib/module/hooks/useScrollEventsHandlersDefault.js deleted file mode 100644 index 933a4a5ef..000000000 --- a/lib/module/hooks/useScrollEventsHandlersDefault.js +++ /dev/null @@ -1,99 +0,0 @@ -import { scrollTo, useWorkletCallback } from 'react-native-reanimated'; -import { useBottomSheetInternal } from './useBottomSheetInternal'; -import { ANIMATION_STATE, SCROLLABLE_STATE, SHEET_STATE } from '../constants'; -export const useScrollEventsHandlersDefault = (scrollableRef, scrollableContentOffsetY) => { - // hooks - const { - animatedSheetState, - animatedScrollableState, - animatedAnimationState, - animatedScrollableContentOffsetY: rootScrollableContentOffsetY - } = useBottomSheetInternal(); //#region callbacks - - const handleOnScroll = useWorkletCallback((_, context) => { - /** - * if sheet position is extended or fill parent, then we reset - * `shouldLockInitialPosition` value to false. - */ - if (animatedSheetState.value === SHEET_STATE.EXTENDED || animatedSheetState.value === SHEET_STATE.FILL_PARENT) { - context.shouldLockInitialPosition = false; - } - - if (animatedScrollableState.value === SCROLLABLE_STATE.LOCKED) { - var _context$initialConte; - - const lockPosition = context.shouldLockInitialPosition ? (_context$initialConte = context.initialContentOffsetY) !== null && _context$initialConte !== void 0 ? _context$initialConte : 0 : 0; // @ts-ignore - - scrollTo(scrollableRef, 0, lockPosition, false); - scrollableContentOffsetY.value = lockPosition; - return; - } - }, [scrollableRef, scrollableContentOffsetY, animatedScrollableState, animatedSheetState]); - const handleOnBeginDrag = useWorkletCallback(({ - contentOffset: { - y - } - }, context) => { - scrollableContentOffsetY.value = y; - rootScrollableContentOffsetY.value = y; - context.initialContentOffsetY = y; - /** - * if sheet position not extended or fill parent and the scrollable position - * not at the top, then we should lock the initial scrollable position. - */ - - if (animatedSheetState.value !== SHEET_STATE.EXTENDED && animatedSheetState.value !== SHEET_STATE.FILL_PARENT && y > 0) { - context.shouldLockInitialPosition = true; - } else { - context.shouldLockInitialPosition = false; - } - }, [scrollableContentOffsetY, animatedSheetState, rootScrollableContentOffsetY]); - const handleOnEndDrag = useWorkletCallback(({ - contentOffset: { - y - } - }, context) => { - if (animatedScrollableState.value === SCROLLABLE_STATE.LOCKED) { - var _context$initialConte2; - - const lockPosition = context.shouldLockInitialPosition ? (_context$initialConte2 = context.initialContentOffsetY) !== null && _context$initialConte2 !== void 0 ? _context$initialConte2 : 0 : 0; // @ts-ignore - - scrollTo(scrollableRef, 0, lockPosition, false); - scrollableContentOffsetY.value = lockPosition; - return; - } - - if (animatedAnimationState.value !== ANIMATION_STATE.RUNNING) { - scrollableContentOffsetY.value = y; - rootScrollableContentOffsetY.value = y; - } - }, [scrollableRef, scrollableContentOffsetY, animatedAnimationState, animatedScrollableState, rootScrollableContentOffsetY]); - const handleOnMomentumEnd = useWorkletCallback(({ - contentOffset: { - y - } - }, context) => { - if (animatedScrollableState.value === SCROLLABLE_STATE.LOCKED) { - var _context$initialConte3; - - const lockPosition = context.shouldLockInitialPosition ? (_context$initialConte3 = context.initialContentOffsetY) !== null && _context$initialConte3 !== void 0 ? _context$initialConte3 : 0 : 0; // @ts-ignore - - scrollTo(scrollableRef, 0, lockPosition, false); - scrollableContentOffsetY.value = 0; - return; - } - - if (animatedAnimationState.value !== ANIMATION_STATE.RUNNING) { - scrollableContentOffsetY.value = y; - rootScrollableContentOffsetY.value = y; - } - }, [scrollableContentOffsetY, scrollableRef, animatedAnimationState, animatedScrollableState, rootScrollableContentOffsetY]); //#endregion - - return { - handleOnScroll, - handleOnBeginDrag, - handleOnEndDrag, - handleOnMomentumEnd - }; -}; -//# sourceMappingURL=useScrollEventsHandlersDefault.js.map \ No newline at end of file diff --git a/lib/module/hooks/useScrollEventsHandlersDefault.js.map b/lib/module/hooks/useScrollEventsHandlersDefault.js.map deleted file mode 100644 index d680ebd41..000000000 --- a/lib/module/hooks/useScrollEventsHandlersDefault.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["useScrollEventsHandlersDefault.ts"],"names":["scrollTo","useWorkletCallback","useBottomSheetInternal","ANIMATION_STATE","SCROLLABLE_STATE","SHEET_STATE","useScrollEventsHandlersDefault","scrollableRef","scrollableContentOffsetY","animatedSheetState","animatedScrollableState","animatedAnimationState","animatedScrollableContentOffsetY","rootScrollableContentOffsetY","handleOnScroll","_","context","value","EXTENDED","FILL_PARENT","shouldLockInitialPosition","LOCKED","lockPosition","initialContentOffsetY","handleOnBeginDrag","contentOffset","y","handleOnEndDrag","RUNNING","handleOnMomentumEnd"],"mappings":"AAAA,SAASA,QAAT,EAAmBC,kBAAnB,QAA6C,yBAA7C;AACA,SAASC,sBAAT,QAAuC,0BAAvC;AACA,SAASC,eAAT,EAA0BC,gBAA1B,EAA4C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AAAjB,GAAD,EAA2BV,OAA3B,KAAuC;AACrC,QAAIN,uBAAuB,CAACO,KAAxB,KAAkCb,gBAAgB,CAACiB,MAAvD,EAA+D;AAAA;;AAC7D,YAAMC,YAAY,GAAGN,OAAO,CAACI,yBAAR,6BACjBJ,OAAO,CAACO,qBADS,2EACgB,CADhB,GAEjB,CAFJ,CAD6D,CAI7D;;AACAvB,MAAAA,QAAQ,CAACO,aAAD,EAAgB,CAAhB,EAAmBe,YAAnB,EAAiC,KAAjC,CAAR;AACAd,MAAAA,wBAAwB,CAACS,KAAzB,GAAiC,CAAjC;AACA;AACD;;AACD,QAAIN,sBAAsB,CAACM,KAAvB,KAAiCd,eAAe,CAACyB,OAArD,EAA8D;AAC5DpB,MAAAA,wBAAwB,CAACS,KAAzB,GAAiCS,CAAjC;AACAb,MAAAA,4BAA4B,CAACI,KAA7B,GAAqCS,CAArC;AACD;AACF,GAfe,EAgBhB,CACElB,wBADF,EAEED,aAFF,EAGEI,sBAHF,EAIED,uBAJF,EAKEG,4BALF,CAhBgB,CADpB,CA7FG,CAsHH;;AAEA,SAAO;AACLC,IAAAA,cADK;AAELU,IAAAA,iBAFK;AAGLG,IAAAA,eAHK;AAILE,IAAAA;AAJK,GAAP;AAMD,CAjIM","sourcesContent":["import { scrollTo, useWorkletCallback } from 'react-native-reanimated';\nimport { useBottomSheetInternal } from './useBottomSheetInternal';\nimport { ANIMATION_STATE, SCROLLABLE_STATE, SHEET_STATE } from '../constants';\nimport type {\n ScrollEventsHandlersHookType,\n ScrollEventHandlerCallbackType,\n} from '../types';\n\nexport type ScrollEventContextType = {\n initialContentOffsetY: number;\n shouldLockInitialPosition: boolean;\n};\n\nexport const useScrollEventsHandlersDefault: ScrollEventsHandlersHookType = (\n scrollableRef,\n scrollableContentOffsetY\n) => {\n // hooks\n const {\n animatedSheetState,\n animatedScrollableState,\n animatedAnimationState,\n animatedScrollableContentOffsetY: rootScrollableContentOffsetY,\n } = useBottomSheetInternal();\n\n //#region callbacks\n const handleOnScroll: ScrollEventHandlerCallbackType =\n useWorkletCallback(\n (_, context) => {\n /**\n * if sheet position is extended or fill parent, then we reset\n * `shouldLockInitialPosition` value to false.\n */\n if (\n animatedSheetState.value === SHEET_STATE.EXTENDED ||\n animatedSheetState.value === SHEET_STATE.FILL_PARENT\n ) {\n context.shouldLockInitialPosition = false;\n }\n\n if (animatedScrollableState.value === SCROLLABLE_STATE.LOCKED) {\n const lockPosition = context.shouldLockInitialPosition\n ? context.initialContentOffsetY ?? 0\n : 0;\n // @ts-ignore\n scrollTo(scrollableRef, 0, lockPosition, false);\n scrollableContentOffsetY.value = lockPosition;\n return;\n }\n },\n [\n scrollableRef,\n scrollableContentOffsetY,\n animatedScrollableState,\n animatedSheetState,\n ]\n );\n const handleOnBeginDrag: ScrollEventHandlerCallbackType =\n useWorkletCallback(\n ({ contentOffset: { y } }, context) => {\n scrollableContentOffsetY.value = y;\n rootScrollableContentOffsetY.value = y;\n context.initialContentOffsetY = y;\n\n /**\n * if sheet position not extended or fill parent and the scrollable position\n * not at the top, then we should lock the initial scrollable position.\n */\n if (\n animatedSheetState.value !== SHEET_STATE.EXTENDED &&\n animatedSheetState.value !== SHEET_STATE.FILL_PARENT &&\n y > 0\n ) {\n context.shouldLockInitialPosition = true;\n } else {\n context.shouldLockInitialPosition = false;\n }\n },\n [\n scrollableContentOffsetY,\n animatedSheetState,\n rootScrollableContentOffsetY,\n ]\n );\n const handleOnEndDrag: ScrollEventHandlerCallbackType =\n useWorkletCallback(\n ({ contentOffset: { y } }, context) => {\n if (animatedScrollableState.value === SCROLLABLE_STATE.LOCKED) {\n const lockPosition = context.shouldLockInitialPosition\n ? context.initialContentOffsetY ?? 0\n : 0;\n // @ts-ignore\n scrollTo(scrollableRef, 0, lockPosition, false);\n scrollableContentOffsetY.value = lockPosition;\n return;\n }\n if (animatedAnimationState.value !== ANIMATION_STATE.RUNNING) {\n scrollableContentOffsetY.value = y;\n rootScrollableContentOffsetY.value = y;\n }\n },\n [\n scrollableRef,\n scrollableContentOffsetY,\n animatedAnimationState,\n animatedScrollableState,\n rootScrollableContentOffsetY,\n ]\n );\n const handleOnMomentumEnd: ScrollEventHandlerCallbackType =\n useWorkletCallback(\n ({ contentOffset: { y } }, context) => {\n if (animatedScrollableState.value === SCROLLABLE_STATE.LOCKED) {\n const lockPosition = context.shouldLockInitialPosition\n ? context.initialContentOffsetY ?? 0\n : 0;\n // @ts-ignore\n scrollTo(scrollableRef, 0, lockPosition, false);\n scrollableContentOffsetY.value = 0;\n return;\n }\n if (animatedAnimationState.value !== ANIMATION_STATE.RUNNING) {\n scrollableContentOffsetY.value = y;\n rootScrollableContentOffsetY.value = y;\n }\n },\n [\n scrollableContentOffsetY,\n scrollableRef,\n animatedAnimationState,\n animatedScrollableState,\n rootScrollableContentOffsetY,\n ]\n );\n //#endregion\n\n return {\n handleOnScroll,\n handleOnBeginDrag,\n handleOnEndDrag,\n handleOnMomentumEnd,\n };\n};\n"]} \ No newline at end of file diff --git a/lib/module/hooks/useScrollHandler.js b/lib/module/hooks/useScrollHandler.js deleted file mode 100644 index 98611677f..000000000 --- a/lib/module/hooks/useScrollHandler.js +++ /dev/null @@ -1,55 +0,0 @@ -import { runOnJS, useAnimatedRef, useAnimatedScrollHandler, useSharedValue } from 'react-native-reanimated'; -import { useScrollEventsHandlersDefault } from './useScrollEventsHandlersDefault'; -import { workletNoop as noop } from '../utilities'; -export const useScrollHandler = (useScrollEventsHandlers = useScrollEventsHandlersDefault, onScroll, onScrollBeginDrag, onScrollEndDrag) => { - // refs - const scrollableRef = useAnimatedRef(); // variables - - const scrollableContentOffsetY = useSharedValue(0); // hooks - - const { - handleOnScroll = noop, - handleOnBeginDrag = noop, - handleOnEndDrag = noop, - handleOnMomentumEnd = noop, - handleOnMomentumBegin = noop - } = useScrollEventsHandlers(scrollableRef, scrollableContentOffsetY); // callbacks - - const scrollHandler = useAnimatedScrollHandler({ - onScroll: (event, context) => { - handleOnScroll(event, context); - - if (onScroll) { - runOnJS(onScroll)({ - nativeEvent: event - }); - } - }, - onBeginDrag: (event, context) => { - handleOnBeginDrag(event, context); - - if (onScrollBeginDrag) { - runOnJS(onScrollBeginDrag)({ - nativeEvent: event - }); - } - }, - onEndDrag: (event, context) => { - handleOnEndDrag(event, context); - - if (onScrollEndDrag) { - runOnJS(onScrollEndDrag)({ - nativeEvent: event - }); - } - }, - onMomentumBegin: handleOnMomentumBegin, - onMomentumEnd: handleOnMomentumEnd - }, [handleOnScroll, handleOnBeginDrag, handleOnEndDrag, handleOnMomentumBegin, handleOnMomentumEnd, onScroll, onScrollBeginDrag, onScrollEndDrag]); - return { - scrollHandler, - scrollableRef, - scrollableContentOffsetY - }; -}; -//# sourceMappingURL=useScrollHandler.js.map \ No newline at end of file diff --git a/lib/module/hooks/useScrollHandler.js.map b/lib/module/hooks/useScrollHandler.js.map deleted file mode 100644 index d5bb73e93..000000000 --- a/lib/module/hooks/useScrollHandler.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["useScrollHandler.ts"],"names":["runOnJS","useAnimatedRef","useAnimatedScrollHandler","useSharedValue","useScrollEventsHandlersDefault","workletNoop","noop","useScrollHandler","useScrollEventsHandlers","onScroll","onScrollBeginDrag","onScrollEndDrag","scrollableRef","scrollableContentOffsetY","handleOnScroll","handleOnBeginDrag","handleOnEndDrag","handleOnMomentumEnd","handleOnMomentumBegin","scrollHandler","event","context","nativeEvent","onBeginDrag","onEndDrag","onMomentumBegin","onMomentumEnd"],"mappings":"AAAA,SACEA,OADF,EAEEC,cAFF,EAGEC,wBAHF,EAIEC,cAJF,QAKO,yBALP;AAMA,SAASC,8BAAT,QAA+C,kCAA/C;AACA,SAASC,WAAW,IAAIC,IAAxB,QAAoC,cAApC;AAGA,OAAO,MAAMC,gBAAgB,GAAG,CAC9BC,uBAAuB,GAAGJ,8BADI,EAE9BK,QAF8B,EAG9BC,iBAH8B,EAI9BC,eAJ8B,KAK3B;AACH;AACA,QAAMC,aAAa,GAAGX,cAAc,EA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EC,eAHF,EAIEE,qBAJF,EAKED,mBALF,EAMER,QANF,EAOEC,iBAPF,EAQEC,eARF,CA1B4C,CAA9C;AAsCA,SAAO;AAAEQ,IAAAA,aAAF;AAAiBP,IAAAA,aAAjB;AAAgCC,IAAAA;AAAhC,GAAP;AACD,CA7DM","sourcesContent":["import {\n runOnJS,\n useAnimatedRef,\n useAnimatedScrollHandler,\n useSharedValue,\n} from 'react-native-reanimated';\nimport { useScrollEventsHandlersDefault } from './useScrollEventsHandlersDefault';\nimport { workletNoop as noop } from '../utilities';\nimport type { Scrollable, ScrollableEvent } from '../types';\n\nexport const useScrollHandler = (\n useScrollEventsHandlers = useScrollEventsHandlersDefault,\n onScroll?: ScrollableEvent,\n onScrollBeginDrag?: ScrollableEvent,\n onScrollEndDrag?: ScrollableEvent\n) => {\n // refs\n const scrollableRef = useAnimatedRef();\n\n // variables\n const scrollableContentOffsetY = useSharedValue(0);\n\n // hooks\n const {\n handleOnScroll = noop,\n handleOnBeginDrag = noop,\n handleOnEndDrag = noop,\n handleOnMomentumEnd = noop,\n handleOnMomentumBegin = noop,\n } = useScrollEventsHandlers(scrollableRef, scrollableContentOffsetY);\n\n // callbacks\n const scrollHandler = useAnimatedScrollHandler(\n {\n onScroll: (event, context) => {\n handleOnScroll(event, context);\n\n if (onScroll) {\n runOnJS(onScroll)({ nativeEvent: event });\n }\n },\n onBeginDrag: (event, context) => {\n handleOnBeginDrag(event, context);\n\n if (onScrollBeginDrag) {\n runOnJS(onScrollBeginDrag)({ nativeEvent: event });\n }\n },\n onEndDrag: (event, context) => {\n handleOnEndDrag(event, context);\n\n if (onScrollEndDrag) {\n runOnJS(onScrollEndDrag)({ nativeEvent: event });\n }\n },\n onMomentumBegin: handleOnMomentumBegin,\n onMomentumEnd: handleOnMomentumEnd,\n },\n [\n handleOnScroll,\n handleOnBeginDrag,\n handleOnEndDrag,\n handleOnMomentumBegin,\n handleOnMomentumEnd,\n onScroll,\n onScrollBeginDrag,\n onScrollEndDrag,\n ]\n );\n\n return { scrollHandler, scrollableRef, scrollableContentOffsetY };\n};\n"]} \ No newline at end of file diff --git a/lib/module/hooks/useScrollable.js b/lib/module/hooks/useScrollable.js deleted file mode 100644 index f0a869b9a..000000000 --- a/lib/module/hooks/useScrollable.js +++ /dev/null @@ -1,66 +0,0 @@ -import { useCallback, useRef } from 'react'; -import { useSharedValue } from 'react-native-reanimated'; -import { getRefNativeTag } from '../utilities/getRefNativeTag'; -import { SCROLLABLE_STATE, SCROLLABLE_TYPE } from '../constants'; -export const useScrollable = () => { - // refs - const scrollableRef = useRef(null); - const previousScrollableRef = useRef(null); // variables - - const animatedScrollableType = useSharedValue(SCROLLABLE_TYPE.UNDETERMINED); - const animatedScrollableContentOffsetY = useSharedValue(0); - const animatedScrollableOverrideState = useSharedValue(SCROLLABLE_STATE.UNDETERMINED); - const isScrollableRefreshable = useSharedValue(false); // callbacks - - const setScrollableRef = useCallback(ref => { - var _scrollableRef$curren, _scrollableRef$curren2; - - // get current node handle id - let currentRefId = (_scrollableRef$curren = (_scrollableRef$curren2 = scrollableRef.current) === null || _scrollableRef$curren2 === void 0 ? void 0 : _scrollableRef$curren2.id) !== null && _scrollableRef$curren !== void 0 ? _scrollableRef$curren : null; - - if (currentRefId !== ref.id) { - if (scrollableRef.current) { - // @ts-ignore - previousScrollableRef.current = scrollableRef.current; - } // @ts-ignore - - - scrollableRef.current = ref; - } - }, []); - const removeScrollableRef = useCallback(ref => { - var _scrollableRef$curren3, _scrollableRef$curren4; - - // find node handle id - let id; - - try { - id = getRefNativeTag(ref); - } catch { - return; - } // get current node handle id - - - let currentRefId = (_scrollableRef$curren3 = (_scrollableRef$curren4 = scrollableRef.current) === null || _scrollableRef$curren4 === void 0 ? void 0 : _scrollableRef$curren4.id) !== null && _scrollableRef$curren3 !== void 0 ? _scrollableRef$curren3 : null; - /** - * @DEV - * when the incoming node is actually the current node, we reset - * the current scrollable ref to the previous one. - */ - - if (id === currentRefId) { - // @ts-ignore - scrollableRef.current = previousScrollableRef.current; - } - }, []); - return { - scrollableRef, - animatedScrollableType, - animatedScrollableContentOffsetY, - animatedScrollableOverrideState, - isScrollableRefreshable, - setScrollableRef, - removeScrollableRef - }; -}; -//# sourceMappingURL=useScrollable.js.map \ No newline at end of file diff --git a/lib/module/hooks/useScrollable.js.map b/lib/module/hooks/useScrollable.js.map deleted file mode 100644 index 1af0ce48d..000000000 --- a/lib/module/hooks/useScrollable.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["useScrollable.ts"],"names":["useCallback","useRef","useSharedValue","getRefNativeTag","SCROLLABLE_STATE","SCROLLABLE_TYPE","useScrollable","scrollableRef","previousScrollableRef","animatedScrollableType","UNDETERMINED","animatedScrollableContentOffsetY","animatedScrollableOverrideState","isScrollableRefreshable","setScrollableRef","ref","currentRefId","current","id","removeScrollableRef"],"mappings":"AAAA,SAASA,WAAT,EAAiCC,MAAjC,QAA+C,OAA/C;AACA,SAASC,cAAT,QAA+B,yBAA/B;AACA,SAASC,eAAT,QAAgC,8BAAhC;AACA,SAASC,gBAAT,EAA2BC,eAA3B,QAAkD,cAAlD;AAGA,OAAO,MAAMC,aAAa,GAAG,MAAM;AACjC;AACA,QAAMC,aAAa,GAAGN,MAAM,CAAgB,IAAhB,CAA5B;AACA,QAAMO,qBAAqB,GAAGP,MAAM,CAAgB,IAAhB,CAApC,CAHiC,CAKjC;;AACA,QAAMQ,sBAAsB,GAAGP,cAAc,CAC3CG,eAAe,CAACK,YAD2B,CAA7C;AAGA,QAAMC,gCAAgC,GAAGT,cAAc,CAAS,CAAT,CAAvD;AACA,QAAMU,+BAA+B,GAAGV,cAAc,CACpDE,gBAAgB,CAACM,YADmC,CAAtD;AAGA,QAAMG,uBAAuB,GAAGX,cAAc,CAAU,KAAV,CAA9C,CAbiC,CAejC;;AACA,QAAMY,gBAAgB,GAAGd,WAAW,CAAEe,GAAD,IAAwB;AAAA;;AAC3D;AACA,QAAIC,YAAY,sDAAGT,aAAa,CAACU,OAAjB,2DAAG,uBAAuBC,EAA1B,yEAAgC,IAAhD;;AAEA,QAAIF,YAAY,KAAKD,GAAG,CAACG,EAAzB,EAA6B;AAC3B,UAAIX,aAAa,CAACU,OAAlB,EAA2B;AACzB;AACAT,QAAAA,qBAAqB,CAACS,OAAtB,GAAgCV,aAAa,CAACU,OAA9C;AACD,OAJ0B,CAK3B;;;AACAV,MAAAA,aAAa,CAACU,OAAd,GAAwBF,GAAxB;AACD;AACF,GAZmC,EAYjC,EAZiC,CAApC;AAcA,QAAMI,mBAAmB,GAAGnB,WAAW,CAAEe,GAAD,IAAgC;AAAA;;AACtE;AACA,QAAIG,EAAJ;;AACA,QAAI;AACFA,MAAAA,EAAE,GAAGf,eAAe,CAACY,GAAD,CAApB;AACD,KAFD,CAEE,MAAM;AACN;AACD,KAPqE,CAStE;;;AACA,QAAIC,YAAY,uDAAGT,aAAa,CAACU,OAAjB,2DAAG,uBAAuBC,EAA1B,2EAAgC,IAAhD;AAEA;AACJ;AACA;AACA;AACA;;AACI,QAAIA,EAAE,KAAKF,YAAX,EAAyB;AACvB;AACAT,MAAAA,aAAa,CAACU,OAAd,GAAwBT,qBAAqB,CAACS,OAA9C;AACD;AACF,GArBsC,EAqBpC,EArBoC,CAAvC;AAuBA,SAAO;AACLV,IAAAA,aADK;AAELE,IAAAA,sBAFK;AAGLE,IAAAA,gCAHK;AAILC,IAAAA,+BAJK;AAKLC,IAAAA,uBALK;AAMLC,IAAAA,gBANK;AAOLK,IAAAA;AAPK,GAAP;AASD,CA9DM","sourcesContent":["import { useCallback, RefObject, useRef } from 'react';\nimport { useSharedValue } from 'react-native-reanimated';\nimport { getRefNativeTag } from '../utilities/getRefNativeTag';\nimport { SCROLLABLE_STATE, SCROLLABLE_TYPE } from '../constants';\nimport type { ScrollableRef, Scrollable } from '../types';\n\nexport const useScrollable = () => {\n // refs\n const scrollableRef = useRef(null);\n const previousScrollableRef = useRef(null);\n\n // variables\n const animatedScrollableType = useSharedValue(\n SCROLLABLE_TYPE.UNDETERMINED\n );\n const animatedScrollableContentOffsetY = useSharedValue(0);\n const animatedScrollableOverrideState = useSharedValue(\n SCROLLABLE_STATE.UNDETERMINED\n );\n const isScrollableRefreshable = useSharedValue(false);\n\n // callbacks\n const setScrollableRef = useCallback((ref: ScrollableRef) => {\n // get current node handle id\n let currentRefId = scrollableRef.current?.id ?? null;\n\n if (currentRefId !== ref.id) {\n if (scrollableRef.current) {\n // @ts-ignore\n previousScrollableRef.current = scrollableRef.current;\n }\n // @ts-ignore\n scrollableRef.current = ref;\n }\n }, []);\n\n const removeScrollableRef = useCallback((ref: RefObject) => {\n // find node handle id\n let id;\n try {\n id = getRefNativeTag(ref);\n } catch {\n return;\n }\n\n // get current node handle id\n let currentRefId = scrollableRef.current?.id ?? null;\n\n /**\n * @DEV\n * when the incoming node is actually the current node, we reset\n * the current scrollable ref to the previous one.\n */\n if (id === currentRefId) {\n // @ts-ignore\n scrollableRef.current = previousScrollableRef.current;\n }\n }, []);\n\n return {\n scrollableRef,\n animatedScrollableType,\n animatedScrollableContentOffsetY,\n animatedScrollableOverrideState,\n isScrollableRefreshable,\n setScrollableRef,\n removeScrollableRef,\n };\n};\n"]} \ No newline at end of file diff --git a/lib/module/hooks/useScrollableSetter.js b/lib/module/hooks/useScrollableSetter.js deleted file mode 100644 index f1748be9a..000000000 --- a/lib/module/hooks/useScrollableSetter.js +++ /dev/null @@ -1,40 +0,0 @@ -import { useCallback, useEffect } from 'react'; -import { useBottomSheetInternal } from './useBottomSheetInternal'; -import { getRefNativeTag } from '../utilities/getRefNativeTag'; -export const useScrollableSetter = (ref, type, contentOffsetY, refreshable, useFocusHook = useEffect) => { - // hooks - const { - animatedScrollableType, - animatedScrollableContentOffsetY: rootScrollableContentOffsetY, - isContentHeightFixed, - isScrollableRefreshable, - setScrollableRef, - removeScrollableRef - } = useBottomSheetInternal(); // callbacks - - const handleSettingScrollable = useCallback(() => { - // set current content offset - rootScrollableContentOffsetY.value = contentOffsetY.value; - animatedScrollableType.value = type; - isScrollableRefreshable.value = refreshable; - isContentHeightFixed.value = false; // set current scrollable ref - - const id = getRefNativeTag(ref); - - if (id) { - setScrollableRef({ - id: id, - node: ref - }); - } else { - console.warn(`Couldn't find the scrollable node handle id!`); - } - - return () => { - removeScrollableRef(ref); - }; - }, [ref, type, refreshable, animatedScrollableType, rootScrollableContentOffsetY, contentOffsetY, isScrollableRefreshable, isContentHeightFixed, setScrollableRef, removeScrollableRef]); // effects - - useFocusHook(handleSettingScrollable); -}; -//# sourceMappingURL=useScrollableSetter.js.map \ No newline at end of file diff --git a/lib/module/hooks/useScrollableSetter.js.map b/lib/module/hooks/useScrollableSetter.js.map deleted file mode 100644 index a5902cae6..000000000 --- a/lib/module/hooks/useScrollableSetter.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["useScrollableSetter.ts"],"names":["useCallback","useEffect","useBottomSheetInternal","getRefNativeTag","useScrollableSetter","ref","type","contentOffsetY","refreshable","useFocusHook","animatedScrollableType","animatedScrollableContentOffsetY","rootScrollableContentOffsetY","isContentHeightFixed","isScrollableRefreshable","setScrollableRef","removeScrollableRef","handleSettingScrollable","value","id","node","console","warn"],"mappings":"AAAA,SAAgBA,WAAhB,EAA6BC,SAA7B,QAA8C,OAA9C;AAEA,SAASC,sBAAT,QAAuC,0BAAvC;AACA,SAASC,eAAT,QAAgC,8BAAhC;AAIA,OAAO,MAAMC,mBAAmB,GAAG,CACjCC,GADiC,EAEjCC,IAFiC,EAGjCC,cAHiC,EAIjCC,WAJiC,EAKjCC,YAAY,GAAGR,SALkB,KAM9B;AACH;AACA,QAAM;AACJS,IAAAA,sBADI;AAEJC,IAAAA,gCAAgC,EAAEC,4BAF9B;AAGJC,IAAAA,oBAHI;AAIJC,IAAAA,uBAJI;AAKJC,IAAAA,gBALI;AAMJC,IAAAA;AANI,MAOFd,sBAAsB,EAP1B,CAFG,CAWH;;AACA,QAAMe,uBAAuB,GAAGjB,WAAW,CAAC,MAAM;AAChD;AACAY,IAAAA,4BAA4B,CAACM,KAA7B,GAAqCX,cAAc,CAACW,KAApD;AACAR,IAAAA,sBAAsB,CAACQ,KAAvB,GAA+BZ,IAA/B;AACAQ,IAAAA,uBAAuB,CAACI,KAAxB,GAAgCV,WAAhC;AACAK,IAAAA,oBAAoB,CAACK,KAArB,GAA6B,KAA7B,CALgD,CAOhD;;AACA,UAAMC,EAAE,GAAGhB,eAAe,CAACE,GAAD,CAA1B;;AACA,QAAIc,EAAJ,EAAQ;AACNJ,MAAAA,gBAAgB,CAAC;AACfI,QAAAA,EAAE,EAAEA,EADW;AAEfC,QAAAA,IAAI,EAAEf;AAFS,OAAD,CAAhB;AAID,KALD,MAKO;AACLgB,MAAAA,OAAO,CAACC,IAAR,CAAc,8CAAd;AACD;;AAED,WAAO,MAAM;AACXN,MAAAA,mBAAmB,CAACX,GAAD,CAAnB;AACD,KAFD;AAGD,GArB0C,EAqBxC,CACDA,GADC,EAEDC,IAFC,EAGDE,WAHC,EAIDE,sBAJC,EAKDE,4BALC,EAMDL,cANC,EAODO,uBAPC,EAQDD,oBARC,EASDE,gBATC,EAUDC,mBAVC,CArBwC,CAA3C,CAZG,CA8CH;;AACAP,EAAAA,YAAY,CAACQ,uBAAD,CAAZ;AACD,CAtDM","sourcesContent":["import React, { useCallback, useEffect } from 'react';\nimport Animated from 'react-native-reanimated';\nimport { useBottomSheetInternal } from './useBottomSheetInternal';\nimport { getRefNativeTag } from '../utilities/getRefNativeTag';\nimport { SCROLLABLE_TYPE } from '../constants';\nimport type { Scrollable } from '../types';\n\nexport const useScrollableSetter = (\n ref: React.RefObject,\n type: SCROLLABLE_TYPE,\n contentOffsetY: Animated.SharedValue,\n refreshable: boolean,\n useFocusHook = useEffect\n) => {\n // hooks\n const {\n animatedScrollableType,\n animatedScrollableContentOffsetY: rootScrollableContentOffsetY,\n isContentHeightFixed,\n isScrollableRefreshable,\n setScrollableRef,\n removeScrollableRef,\n } = useBottomSheetInternal();\n\n // callbacks\n const handleSettingScrollable = useCallback(() => {\n // set current content offset\n rootScrollableContentOffsetY.value = contentOffsetY.value;\n animatedScrollableType.value = type;\n isScrollableRefreshable.value = refreshable;\n isContentHeightFixed.value = false;\n\n // set current scrollable ref\n const id = getRefNativeTag(ref);\n if (id) {\n setScrollableRef({\n id: id,\n node: ref,\n });\n } else {\n console.warn(`Couldn't find the scrollable node handle id!`);\n }\n\n return () => {\n removeScrollableRef(ref);\n };\n }, [\n ref,\n type,\n refreshable,\n animatedScrollableType,\n rootScrollableContentOffsetY,\n contentOffsetY,\n isScrollableRefreshable,\n isContentHeightFixed,\n setScrollableRef,\n removeScrollableRef,\n ]);\n\n // effects\n useFocusHook(handleSettingScrollable);\n};\n"]} \ No newline at end of file diff --git a/lib/module/hooks/useStableCallback.js b/lib/module/hooks/useStableCallback.js deleted file mode 100644 index 91a679d96..000000000 --- a/lib/module/hooks/useStableCallback.js +++ /dev/null @@ -1,16 +0,0 @@ -import { useRef, useCallback, useEffect } from 'react'; - -/** - * Provide a stable version of useCallback - * https://gist.github.com/JakeCoxon/c7ebf6e6496f8468226fd36b596e1985 - */ -export const useStableCallback = callback => { - const callbackRef = useRef(); - const memoCallback = useCallback((...args) => callbackRef.current && callbackRef.current(...args), []); - useEffect(() => { - callbackRef.current = callback; - return () => callbackRef.current = undefined; - }); - return memoCallback; -}; -//# sourceMappingURL=useStableCallback.js.map \ No newline at end of file diff --git a/lib/module/hooks/useStableCallback.js.map b/lib/module/hooks/useStableCallback.js.map deleted file mode 100644 index d6fb52e72..000000000 --- a/lib/module/hooks/useStableCallback.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["useStableCallback.ts"],"names":["useRef","useCallback","useEffect","useStableCallback","callback","callbackRef","memoCallback","args","current","undefined"],"mappings":"AAAA,SAASA,MAAT,EAAiBC,WAAjB,EAA8BC,SAA9B,QAA+C,OAA/C;;AAGA;AACA;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,GAAIC,QAAD,IAAwB;AACvD,QAAMC,WAAW,GAAGL,MAAM,EAA1B;AACA,QAAMM,YAAY,GAAGL,WAAW,CAC9B,CAAC,GAAGM,IAAJ,KAAkBF,WAAW,CAACG,OAAZ,IAAuBH,WAAW,CAACG,OAAZ,CAAoB,GAAGD,IAAvB,CADX,EAE9B,EAF8B,CAAhC;AAIAL,EAAAA,SAAS,CAAC,MAAM;AACdG,IAAAA,WAAW,CAACG,OAAZ,GAAsBJ,QAAtB;AACA,WAAO,MAAOC,WAAW,CAACG,OAAZ,GAAsBC,SAApC;AACD,GAHQ,CAAT;AAIA,SAAOH,YAAP;AACD,CAXM","sourcesContent":["import { useRef, useCallback, useEffect } from 'react';\n\ntype Callback = (...args: any[]) => any;\n/**\n * Provide a stable version of useCallback\n * https://gist.github.com/JakeCoxon/c7ebf6e6496f8468226fd36b596e1985\n */\nexport const useStableCallback = (callback: Callback) => {\n const callbackRef = useRef();\n const memoCallback = useCallback(\n (...args: any) => callbackRef.current && callbackRef.current(...args),\n []\n );\n useEffect(() => {\n callbackRef.current = callback;\n return () => (callbackRef.current = undefined);\n });\n return memoCallback;\n};\n"]} \ No newline at end of file diff --git a/lib/module/index.js b/lib/module/index.js deleted file mode 100644 index 906885637..000000000 --- a/lib/module/index.js +++ /dev/null @@ -1,44 +0,0 @@ -// bottom sheet -export { default } from './components/bottomSheet'; // bottom sheet modal - -export { default as BottomSheetModal } from './components/bottomSheetModal'; -export { default as BottomSheetModalProvider } from './components/bottomSheetModalProvider'; //#region hooks - -export { useBottomSheet } from './hooks/useBottomSheet'; -export { useBottomSheetModal } from './hooks/useBottomSheetModal'; -export { useBottomSheetSpringConfigs } from './hooks/useBottomSheetSpringConfigs'; -export { useBottomSheetTimingConfigs } from './hooks/useBottomSheetTimingConfigs'; -export { useBottomSheetInternal } from './hooks/useBottomSheetInternal'; -export { useBottomSheetModalInternal } from './hooks/useBottomSheetModalInternal'; -export { useBottomSheetDynamicSnapPoints } from './hooks/useBottomSheetDynamicSnapPoints'; -export { useScrollEventsHandlersDefault } from './hooks/useScrollEventsHandlersDefault'; -export { useGestureEventsHandlersDefault } from './hooks/useGestureEventsHandlersDefault'; -export { useBottomSheetGestureHandlers } from './hooks/useBottomSheetGestureHandlers'; -export { useScrollHandler } from './hooks/useScrollHandler'; -export { useScrollableSetter } from './hooks/useScrollableSetter'; //#endregion -//#region components - -export { BottomSheetScrollView, BottomSheetSectionList, BottomSheetFlatList, BottomSheetVirtualizedList } from './components/bottomSheetScrollable'; -export { default as BottomSheetHandle } from './components/bottomSheetHandle'; -export { default as BottomSheetDraggableView } from './components/bottomSheetDraggableView'; -export { default as BottomSheetView } from './components/bottomSheetView'; -export { default as BottomSheetTextInput } from './components/bottomSheetTextInput'; -export { default as BottomSheetBackdrop } from './components/bottomSheetBackdrop'; -export { default as BottomSheetFooter } from './components/bottomSheetFooter'; -export { default as BottomSheetFooterContainer } from './components/bottomSheetFooterContainer/BottomSheetFooterContainer'; // touchables - -import BottomSheetTouchable from './components/touchables'; -export const { - TouchableHighlight, - TouchableOpacity, - TouchableWithoutFeedback -} = BottomSheetTouchable; // utils - -export { createBottomSheetScrollableComponent } from './components/bottomSheetScrollable'; //#endregion -//#region types - -//#endregion -//#region utilities -export * from './constants'; -export { enableLogging } from './utilities/logger'; //#endregion -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/index.js.map b/lib/module/index.js.map deleted file mode 100644 index 8d6162efb..000000000 --- a/lib/module/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":["default","BottomSheetModal","BottomSheetModalProvider","useBottomSheet","useBottomSheetModal","useBottomSheetSpringConfigs","useBottomSheetTimingConfigs","useBottomSheetInternal","useBottomSheetModalInternal","useBottomSheetDynamicSnapPoints","useScrollEventsHandlersDefault","useGestureEventsHandlersDefault","useBottomSheetGestureHandlers","useScrollHandler","useScrollableSetter","BottomSheetScrollView","BottomSheetSectionList","BottomSheetFlatList","BottomSheetVirtualizedList","BottomSheetHandle","BottomSheetDraggableView","BottomSheetView","BottomSheetTextInput","BottomSheetBackdrop","BottomSheetFooter","BottomSheetFooterContainer","BottomSheetTouchable","TouchableHighlight","TouchableOpacity","TouchableWithoutFeedback","createBottomSheetScrollableComponent","enableLogging"],"mappings":"AAAA;AACA,SAASA,OAAT,QAAwB,0BAAxB,C,CAEA;;AACA,SAASA,OAAO,IAAIC,gBAApB,QAA4C,+BAA5C;AACA,SAASD,OAAO,IAAIE,wBAApB,QAAoD,uCAApD,C,CAEA;;AACA,SAASC,cAAT,QAA+B,wBAA/B;AACA,SAASC,mBAAT,QAAoC,6BAApC;AACA,SAASC,2BAAT,QAA4C,qCAA5C;AACA,SAASC,2BAAT,QAA4C,qCAA5C;AACA,SAASC,sBAAT,QAAuC,gCAAvC;AACA,SAASC,2BAAT,QAA4C,qCAA5C;AACA,SAASC,+BAAT,QAAgD,yCAAhD;AACA,SAASC,8BAAT,QAA+C,wCAA/C;AACA,SAASC,+BAAT,QAAgD,yCAAhD;AACA,SAASC,6BAAT,QAA8C,uCAA9C;AACA,SAASC,gBAAT,QAAiC,0BAAjC;AACA,SAASC,mBAAT,QAAoC,6BAApC,C,CACA;AAEA;;AACA,SACEC,qBADF,EAEEC,sBAFF,EAGEC,mBAHF,EAIEC,0BAJF,QAKO,oCALP;AAMA,SAASlB,OAAO,IAAImB,iBAApB,QAA6C,gCAA7C;AACA,SAASnB,OAAO,IAAIoB,wBAApB,QAAoD,uCAApD;AACA,SAASpB,OAAO,IAAIqB,eAApB,QAA2C,8BAA3C;AACA,SAASrB,OAAO,IAAIsB,oBAApB,QAAgD,mCAAhD;AACA,SAAStB,OAAO,IAAIuB,mBAApB,QAA+C,kCAA/C;AACA,SAASvB,OAAO,IAAIwB,iBAApB,QAA6C,gCAA7C;AACA,SAASxB,OAAO,IAAIyB,0BAApB,QAAsD,oEAAtD,C,CAEA;;AACA,OAAOC,oBAAP,MAAiC,yBAAjC;AACA,OAAO,MAAM;AACXC,EAAAA,kBADW;AAEXC,EAAAA,gBAFW;AAGXC,EAAAA;AAHW,IAITH,oBAJG,C,CAKP;;AACA,SAASI,oCAAT,QAAqD,oCAArD,C,CACA;AAEA;;AAsBA;AAEA;AACA,cAAc,aAAd;AACA,SAASC,aAAT,QAA8B,oBAA9B,C,CACA","sourcesContent":["// bottom sheet\nexport { default } from './components/bottomSheet';\n\n// bottom sheet modal\nexport { default as BottomSheetModal } from './components/bottomSheetModal';\nexport { default as BottomSheetModalProvider } from './components/bottomSheetModalProvider';\n\n//#region hooks\nexport { useBottomSheet } from './hooks/useBottomSheet';\nexport { useBottomSheetModal } from './hooks/useBottomSheetModal';\nexport { useBottomSheetSpringConfigs } from './hooks/useBottomSheetSpringConfigs';\nexport { useBottomSheetTimingConfigs } from './hooks/useBottomSheetTimingConfigs';\nexport { useBottomSheetInternal } from './hooks/useBottomSheetInternal';\nexport { useBottomSheetModalInternal } from './hooks/useBottomSheetModalInternal';\nexport { useBottomSheetDynamicSnapPoints } from './hooks/useBottomSheetDynamicSnapPoints';\nexport { useScrollEventsHandlersDefault } from './hooks/useScrollEventsHandlersDefault';\nexport { useGestureEventsHandlersDefault } from './hooks/useGestureEventsHandlersDefault';\nexport { useBottomSheetGestureHandlers } from './hooks/useBottomSheetGestureHandlers';\nexport { useScrollHandler } from './hooks/useScrollHandler';\nexport { useScrollableSetter } from './hooks/useScrollableSetter';\n//#endregion\n\n//#region components\nexport {\n BottomSheetScrollView,\n BottomSheetSectionList,\n BottomSheetFlatList,\n BottomSheetVirtualizedList,\n} from './components/bottomSheetScrollable';\nexport { default as BottomSheetHandle } from './components/bottomSheetHandle';\nexport { default as BottomSheetDraggableView } from './components/bottomSheetDraggableView';\nexport { default as BottomSheetView } from './components/bottomSheetView';\nexport { default as BottomSheetTextInput } from './components/bottomSheetTextInput';\nexport { default as BottomSheetBackdrop } from './components/bottomSheetBackdrop';\nexport { default as BottomSheetFooter } from './components/bottomSheetFooter';\nexport { default as BottomSheetFooterContainer } from './components/bottomSheetFooterContainer/BottomSheetFooterContainer';\n\n// touchables\nimport BottomSheetTouchable from './components/touchables';\nexport const {\n TouchableHighlight,\n TouchableOpacity,\n TouchableWithoutFeedback,\n} = BottomSheetTouchable;\n// utils\nexport { createBottomSheetScrollableComponent } from './components/bottomSheetScrollable';\n//#endregion\n\n//#region types\nexport type { BottomSheetProps } from './components/bottomSheet';\nexport type { BottomSheetModalProps } from './components/bottomSheetModal';\nexport type { BottomSheetHandleProps } from './components/bottomSheetHandle';\nexport type { BottomSheetBackgroundProps } from './components/bottomSheetBackground';\nexport type { BottomSheetBackdropProps } from './components/bottomSheetBackdrop';\nexport type { BottomSheetFooterProps } from './components/bottomSheetFooter';\n\nexport type {\n BottomSheetFlatListMethods,\n BottomSheetScrollViewMethods,\n BottomSheetSectionListMethods,\n BottomSheetVirtualizedListMethods,\n BottomSheetScrollableProps,\n} from './components/bottomSheetScrollable';\n\nexport type {\n ScrollEventsHandlersHookType,\n GestureEventsHandlersHookType,\n ScrollEventHandlerCallbackType,\n GestureEventHandlerCallbackType,\n} from './types';\n//#endregion\n\n//#region utilities\nexport * from './constants';\nexport { enableLogging } from './utilities/logger';\n//#endregion\n"]} \ No newline at end of file diff --git a/lib/module/utilities/animate.js b/lib/module/utilities/animate.js deleted file mode 100644 index a22725abc..000000000 --- a/lib/module/utilities/animate.js +++ /dev/null @@ -1,26 +0,0 @@ -import { withTiming, withSpring } from 'react-native-reanimated'; -import { ANIMATION_CONFIGS, ANIMATION_METHOD } from '../constants'; -export const animate = ({ - point, - configs = undefined, - velocity = 0, - onComplete -}) => { - 'worklet'; - - if (!configs) { - configs = ANIMATION_CONFIGS; - } // detect animation type - - - const type = 'duration' in configs || 'easing' in configs ? ANIMATION_METHOD.TIMING : ANIMATION_METHOD.SPRING; - - if (type === ANIMATION_METHOD.TIMING) { - return withTiming(point, configs, onComplete); - } else { - return withSpring(point, Object.assign({ - velocity - }, configs), onComplete); - } -}; -//# sourceMappingURL=animate.js.map \ No newline at end of file diff --git a/lib/module/utilities/animate.js.map b/lib/module/utilities/animate.js.map deleted file mode 100644 index 5ec06f0dc..000000000 --- a/lib/module/utilities/animate.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["animate.ts"],"names":["withTiming","withSpring","ANIMATION_CONFIGS","ANIMATION_METHOD","animate","point","configs","undefined","velocity","onComplete","type","TIMING","SPRING","Object","assign"],"mappings":"AAAA,SAGEA,UAHF,EAIEC,UAJF,QAMO,yBANP;AAOA,SAASC,iBAAT,EAA4BC,gBAA5B,QAAoD,cAApD;AASA,OAAO,MAAMC,OAAO,GAAG,CAAC;AACtBC,EAAAA,KADsB;AAEtBC,EAAAA,OAAO,GAAGC,SAFY;AAGtBC,EAAAA,QAAQ,GAAG,CAHW;AAItBC,EAAAA;AAJsB,CAAD,KAKF;AACnB;;AAEA,MAAI,CAACH,OAAL,EAAc;AACZA,IAAAA,OAAO,GAAGJ,iBAAV;AACD,GALkB,CAOnB;;;AACA,QAAMQ,IAAI,GACR,cAAcJ,OAAd,IAAyB,YAAYA,OAArC,GACIH,gBAAgB,CAACQ,MADrB,GAEIR,gBAAgB,CAACS,MAHvB;;AAKA,MAAIF,IAAI,KAAKP,gBAAgB,CAACQ,MAA9B,EAAsC;AACpC,WAAOX,UAAU,CAACK,KAAD,EAAQC,OAAR,EAAqCG,UAArC,CAAjB;AACD,GAFD,MAEO;AACL,WAAOR,UAAU,CACfI,KADe,EAEfQ,MAAM,CAACC,MAAP,CAAc;AAAEN,MAAAA;AAAF,KAAd,EAA4BF,OAA5B,CAFe,EAGfG,UAHe,CAAjB;AAKD;AACF,CA3BM","sourcesContent":["import {\n WithSpringConfig,\n WithTimingConfig,\n withTiming,\n withSpring,\n AnimationCallback,\n} from 'react-native-reanimated';\nimport { ANIMATION_CONFIGS, ANIMATION_METHOD } from '../constants';\n\ninterface AnimateParams {\n point: number;\n velocity?: number;\n configs?: WithSpringConfig | WithTimingConfig;\n onComplete?: AnimationCallback;\n}\n\nexport const animate = ({\n point,\n configs = undefined,\n velocity = 0,\n onComplete,\n}: AnimateParams) => {\n 'worklet';\n\n if (!configs) {\n configs = ANIMATION_CONFIGS;\n }\n\n // detect animation type\n const type =\n 'duration' in configs || 'easing' in configs\n ? ANIMATION_METHOD.TIMING\n : ANIMATION_METHOD.SPRING;\n\n if (type === ANIMATION_METHOD.TIMING) {\n return withTiming(point, configs as WithTimingConfig, onComplete);\n } else {\n return withSpring(\n point,\n Object.assign({ velocity }, configs) as WithSpringConfig,\n onComplete\n );\n }\n};\n"]} \ No newline at end of file diff --git a/lib/module/utilities/clamp.js b/lib/module/utilities/clamp.js deleted file mode 100644 index 2f84379b9..000000000 --- a/lib/module/utilities/clamp.js +++ /dev/null @@ -1,6 +0,0 @@ -export const clamp = (value, lowerBound, upperBound) => { - 'worklet'; - - return Math.min(Math.max(lowerBound, value), upperBound); -}; -//# sourceMappingURL=clamp.js.map \ No newline at end of file diff --git a/lib/module/utilities/clamp.js.map b/lib/module/utilities/clamp.js.map deleted file mode 100644 index 011f6f24f..000000000 --- a/lib/module/utilities/clamp.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["clamp.ts"],"names":["clamp","value","lowerBound","upperBound","Math","min","max"],"mappings":"AAAA,OAAO,MAAMA,KAAK,GAAG,CACnBC,KADmB,EAEnBC,UAFmB,EAGnBC,UAHmB,KAIhB;AACH;;AACA,SAAOC,IAAI,CAACC,GAAL,CAASD,IAAI,CAACE,GAAL,CAASJ,UAAT,EAAqBD,KAArB,CAAT,EAAsCE,UAAtC,CAAP;AACD,CAPM","sourcesContent":["export const clamp = (\n value: number,\n lowerBound: number,\n upperBound: number\n) => {\n 'worklet';\n return Math.min(Math.max(lowerBound, value), upperBound);\n};\n"]} \ No newline at end of file diff --git a/lib/module/utilities/easingExp.js b/lib/module/utilities/easingExp.js deleted file mode 100644 index e4e3eb8b3..000000000 --- a/lib/module/utilities/easingExp.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * A modified version of the default AnimatedEasing.exp, - * to insure its value never goes below `0`. - * @see https://github.com/software-mansion/react-native-reanimated/issues/1610 - * @param t number - */ -export const exp = t => { - 'worklet'; - - return Math.min(Math.max(0, Math.pow(2, 10 * (t - 1))), 1); -}; -//# sourceMappingURL=easingExp.js.map \ No newline at end of file diff --git a/lib/module/utilities/easingExp.js.map b/lib/module/utilities/easingExp.js.map deleted file mode 100644 index 143baa079..000000000 --- a/lib/module/utilities/easingExp.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["easingExp.ts"],"names":["exp","t","Math","min","max","pow"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,GAAG,GAAIC,CAAD,IAAe;AAChC;;AACA,SAAOC,IAAI,CAACC,GAAL,CAASD,IAAI,CAACE,GAAL,CAAS,CAAT,EAAYF,IAAI,CAACG,GAAL,CAAS,CAAT,EAAY,MAAMJ,CAAC,GAAG,CAAV,CAAZ,CAAZ,CAAT,EAAiD,CAAjD,CAAP;AACD,CAHM","sourcesContent":["/**\n * A modified version of the default AnimatedEasing.exp,\n * to insure its value never goes below `0`.\n * @see https://github.com/software-mansion/react-native-reanimated/issues/1610\n * @param t number\n */\nexport const exp = (t: number) => {\n 'worklet';\n return Math.min(Math.max(0, Math.pow(2, 10 * (t - 1))), 1);\n};\n"]} \ No newline at end of file diff --git a/lib/module/utilities/getKeyboardAnimationConfigs.js b/lib/module/utilities/getKeyboardAnimationConfigs.js deleted file mode 100644 index dfac85c3a..000000000 --- a/lib/module/utilities/getKeyboardAnimationConfigs.js +++ /dev/null @@ -1,41 +0,0 @@ -import { Easing } from 'react-native-reanimated'; -export const getKeyboardAnimationConfigs = (easing, duration) => { - 'worklet'; - - switch (easing) { - case 'easeIn': - return { - easing: Easing.in(Easing.ease), - duration - }; - - case 'easeOut': - return { - easing: Easing.out(Easing.ease), - duration - }; - - case 'easeInEaseOut': - return { - easing: Easing.inOut(Easing.ease), - duration - }; - - case 'linear': - return { - easing: Easing.linear, - duration - }; - - case 'keyboard': - return { - damping: 500, - stiffness: 1000, - mass: 3, - overshootClamping: true, - restDisplacementThreshold: 10, - restSpeedThreshold: 10 - }; - } -}; -//# sourceMappingURL=getKeyboardAnimationConfigs.js.map \ No newline at end of file diff --git a/lib/module/utilities/getKeyboardAnimationConfigs.js.map b/lib/module/utilities/getKeyboardAnimationConfigs.js.map deleted file mode 100644 index 2a1a9cf66..000000000 --- a/lib/module/utilities/getKeyboardAnimationConfigs.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["getKeyboardAnimationConfigs.ts"],"names":["Easing","getKeyboardAnimationConfigs","easing","duration","in","ease","out","inOut","linear","damping","stiffness","mass","overshootClamping","restDisplacementThreshold","restSpeedThreshold"],"mappings":"AAAA,SAASA,MAAT,QAAuB,yBAAvB;AAGA,OAAO,MAAMC,2BAA2B,GAAG,CACzCC,MADyC,EAEzCC,QAFyC,KAGtC;AACH;;AACA,UAAQD,MAAR;AACE,SAAK,QAAL;AACE,aAAO;AACLA,QAAAA,MAAM,EAAEF,MAAM,CAACI,EAAP,CAAUJ,MAAM,CAACK,IAAjB,CADH;AAELF,QAAAA;AAFK,OAAP;;AAKF,SAAK,SAAL;AACE,aAAO;AACLD,QAAAA,MAAM,EAAEF,MAAM,CAACM,GAAP,CAAWN,MAAM,CAACK,IAAlB,CADH;AAELF,QAAAA;AAFK,OAAP;;AAKF,SAAK,eAAL;AACE,aAAO;AACLD,QAAAA,MAAM,EAAEF,MAAM,CAACO,KAAP,CAAaP,MAAM,CAACK,IAApB,CADH;AAELF,QAAAA;AAFK,OAAP;;AAKF,SAAK,QAAL;AACE,aAAO;AACLD,QAAAA,MAAM,EAAEF,MAAM,CAACQ,MADV;AAELL,QAAAA;AAFK,OAAP;;AAKF,SAAK,UAAL;AACE,aAAO;AACLM,QAAAA,OAAO,EAAE,GADJ;AAELC,QAAAA,SAAS,EAAE,IAFN;AAGLC,QAAAA,IAAI,EAAE,CAHD;AAILC,QAAAA,iBAAiB,EAAE,IAJd;AAKLC,QAAAA,yBAAyB,EAAE,EALtB;AAMLC,QAAAA,kBAAkB,EAAE;AANf,OAAP;AA1BJ;AAmCD,CAxCM","sourcesContent":["import { Easing } from 'react-native-reanimated';\nimport type { KeyboardEventEasing } from 'react-native';\n\nexport const getKeyboardAnimationConfigs = (\n easing: KeyboardEventEasing,\n duration: number\n) => {\n 'worklet';\n switch (easing) {\n case 'easeIn':\n return {\n easing: Easing.in(Easing.ease),\n duration,\n };\n\n case 'easeOut':\n return {\n easing: Easing.out(Easing.ease),\n duration,\n };\n\n case 'easeInEaseOut':\n return {\n easing: Easing.inOut(Easing.ease),\n duration,\n };\n\n case 'linear':\n return {\n easing: Easing.linear,\n duration,\n };\n\n case 'keyboard':\n return {\n damping: 500,\n stiffness: 1000,\n mass: 3,\n overshootClamping: true,\n restDisplacementThreshold: 10,\n restSpeedThreshold: 10,\n };\n }\n};\n"]} \ No newline at end of file diff --git a/lib/module/utilities/getRefNativeTag.js b/lib/module/utilities/getRefNativeTag.js deleted file mode 100644 index 5f30f74da..000000000 --- a/lib/module/utilities/getRefNativeTag.js +++ /dev/null @@ -1,38 +0,0 @@ -const isFunction = ref => typeof ref === 'function'; - -const hasNativeTag = ref => !!ref && typeof ref === 'object' && 'current' in (ref || {}) && '_nativeTag' in ((ref === null || ref === void 0 ? void 0 : ref.current) || {}); -/* - * getRefNativeTag is an internal utility used by createBottomSheetScrollableComponent - * to grab the native tag from the native host component. It only works when the ref - * is pointing to a native Host component. - * - * Internally in the bottom-sheet library ref can be a function that returns a native tag - * this seems to happen due to the usage of Reanimated's animated scroll components. - * - * This should be Fabric compatible as long as the ref is a native host component. - * */ - - -export function getRefNativeTag(ref) { - const refType = typeof ref; - let nativeTag; - - if (isFunction(ref)) { - nativeTag = ref(); - } else if (hasNativeTag(ref)) { - nativeTag = ref.current._nativeTag; - } - - if (!nativeTag || typeof nativeTag !== 'number') { - throw new Error(`Unexpected nativeTag: ${refType}; nativeTag=${nativeTag} - - createBottomSheetScrollableComponent's ScrollableComponent needs to return - a reference that contains a nativeTag to a Native HostComponent. - - ref=${ref} - `); - } - - return nativeTag; -} -//# sourceMappingURL=getRefNativeTag.js.map \ No newline at end of file diff --git a/lib/module/utilities/getRefNativeTag.js.map b/lib/module/utilities/getRefNativeTag.js.map deleted file mode 100644 index c8d36c976..000000000 --- a/lib/module/utilities/getRefNativeTag.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["getRefNativeTag.ts"],"names":["isFunction","ref","hasNativeTag","current","getRefNativeTag","refType","nativeTag","_nativeTag","Error"],"mappings":"AAAA,MAAMA,UAAU,GAAIC,GAAD,IAAmC,OAAOA,GAAP,KAAe,UAArE;;AAEA,MAAMC,YAAY,GAChBD,GADmB,IAGnB,CAAC,CAACA,GAAF,IACA,OAAOA,GAAP,KAAe,QADf,IAEA,cAAcA,GAAG,IAAI,EAArB,CAFA,IAGA,iBAAiB,CAACA,GAAD,aAACA,GAAD,uBAACA,GAAD,CAAcE,OAAd,KAAyB,EAA1C,CANF;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,SAASC,eAAT,CAAyBH,GAAzB,EAAuC;AAC5C,QAAMI,OAAO,GAAG,OAAOJ,GAAvB;AACA,MAAIK,SAAJ;;AACA,MAAIN,UAAU,CAACC,GAAD,CAAd,EAAqB;AACnBK,IAAAA,SAAS,GAAGL,GAAG,EAAf;AACD,GAFD,MAEO,IAAIC,YAAY,CAACD,GAAD,CAAhB,EAAuB;AAC5BK,IAAAA,SAAS,GAAGL,GAAG,CAACE,OAAJ,CAAYI,UAAxB;AACD;;AAED,MAAI,CAACD,SAAD,IAAc,OAAOA,SAAP,KAAqB,QAAvC,EAAiD;AAC/C,UAAM,IAAIE,KAAJ,CACH,yBAAwBH,OAAQ,eAAcC,SAAU;AAC/D;AACA;AACA;AACA;AACA,SAASL,GAAI;AACb,IAPU,CAAN;AASD;;AAED,SAAOK,SAAP;AACD","sourcesContent":["const isFunction = (ref: unknown): ref is Function => typeof ref === 'function';\n\nconst hasNativeTag = (\n ref: unknown\n): ref is { current: { _nativeTag: number } } =>\n !!ref &&\n typeof ref === 'object' &&\n 'current' in (ref || {}) &&\n '_nativeTag' in ((ref as any)?.current || {});\n\n/*\n * getRefNativeTag is an internal utility used by createBottomSheetScrollableComponent\n * to grab the native tag from the native host component. It only works when the ref\n * is pointing to a native Host component.\n *\n * Internally in the bottom-sheet library ref can be a function that returns a native tag\n * this seems to happen due to the usage of Reanimated's animated scroll components.\n *\n * This should be Fabric compatible as long as the ref is a native host component.\n * */\nexport function getRefNativeTag(ref: unknown) {\n const refType = typeof ref;\n let nativeTag: undefined | number;\n if (isFunction(ref)) {\n nativeTag = ref();\n } else if (hasNativeTag(ref)) {\n nativeTag = ref.current._nativeTag;\n }\n\n if (!nativeTag || typeof nativeTag !== 'number') {\n throw new Error(\n `Unexpected nativeTag: ${refType}; nativeTag=${nativeTag} \n\n\t\t\tcreateBottomSheetScrollableComponent's ScrollableComponent needs to return \n\t\t\ta reference that contains a nativeTag to a Native HostComponent.\n\n\t\t\tref=${ref}\n\t\t\t`\n );\n }\n\n return nativeTag;\n}\n"]} \ No newline at end of file diff --git a/lib/module/utilities/id.js b/lib/module/utilities/id.js deleted file mode 100644 index ed49b21ad..000000000 --- a/lib/module/utilities/id.js +++ /dev/null @@ -1,6 +0,0 @@ -let current = 0; -export const id = () => { - current = (current + 1) % Number.MAX_SAFE_INTEGER; - return current; -}; -//# sourceMappingURL=id.js.map \ No newline at end of file diff --git a/lib/module/utilities/id.js.map b/lib/module/utilities/id.js.map deleted file mode 100644 index 9f76b77c6..000000000 --- a/lib/module/utilities/id.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["id.ts"],"names":["current","id","Number","MAX_SAFE_INTEGER"],"mappings":"AAAA,IAAIA,OAAO,GAAG,CAAd;AAEA,OAAO,MAAMC,EAAE,GAAG,MAAM;AACtBD,EAAAA,OAAO,GAAG,CAACA,OAAO,GAAG,CAAX,IAAgBE,MAAM,CAACC,gBAAjC;AACA,SAAOH,OAAP;AACD,CAHM","sourcesContent":["let current = 0;\n\nexport const id = () => {\n current = (current + 1) % Number.MAX_SAFE_INTEGER;\n return current;\n};\n"]} \ No newline at end of file diff --git a/lib/module/utilities/index.js b/lib/module/utilities/index.js deleted file mode 100644 index 59c1d6261..000000000 --- a/lib/module/utilities/index.js +++ /dev/null @@ -1,6 +0,0 @@ -export { normalizeSnapPoint } from './normalizeSnapPoint'; -export { animate } from './animate'; -export { getKeyboardAnimationConfigs } from './getKeyboardAnimationConfigs'; -export { print } from './logger'; -export { noop, workletNoop } from './noop'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/utilities/index.js.map b/lib/module/utilities/index.js.map deleted file mode 100644 index a8f15bc43..000000000 --- a/lib/module/utilities/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.ts"],"names":["normalizeSnapPoint","animate","getKeyboardAnimationConfigs","print","noop","workletNoop"],"mappings":"AAAA,SAASA,kBAAT,QAAmC,sBAAnC;AACA,SAASC,OAAT,QAAwB,WAAxB;AACA,SAASC,2BAAT,QAA4C,+BAA5C;AACA,SAASC,KAAT,QAAsB,UAAtB;AACA,SAASC,IAAT,EAAeC,WAAf,QAAkC,QAAlC","sourcesContent":["export { normalizeSnapPoint } from './normalizeSnapPoint';\nexport { animate } from './animate';\nexport { getKeyboardAnimationConfigs } from './getKeyboardAnimationConfigs';\nexport { print } from './logger';\nexport { noop, workletNoop } from './noop';\n"]} \ No newline at end of file diff --git a/lib/module/utilities/logger.js b/lib/module/utilities/logger.js deleted file mode 100644 index 94647a6aa..000000000 --- a/lib/module/utilities/logger.js +++ /dev/null @@ -1,39 +0,0 @@ -let isLoggingEnabled = false; - -const enableLogging = () => { - if (!__DEV__) { - console.warn('[BottomSheet] could not enable logging on production!'); - return; - } - - isLoggingEnabled = true; -}; - -let print = () => {}; - -if (__DEV__) { - print = ({ - component, - method, - params - }) => { - if (!isLoggingEnabled) { - return; - } - - let message = ''; - - if (typeof params === 'object') { - message = Object.keys(params).map(key => `${key}:${params[key]}`).join(' '); - } else { - message = `${params !== null && params !== void 0 ? params : ''}`; - } // eslint-disable-next-line no-console - - - console.log(`[${[component, method].filter(Boolean).join('::')}]`, message); - }; -} - -Object.freeze(print); -export { print, enableLogging }; -//# sourceMappingURL=logger.js.map \ No newline at end of file diff --git a/lib/module/utilities/logger.js.map b/lib/module/utilities/logger.js.map deleted file mode 100644 index 8348b94e2..000000000 --- a/lib/module/utilities/logger.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["logger.ts"],"names":["isLoggingEnabled","enableLogging","__DEV__","console","warn","print","component","method","params","message","Object","keys","map","key","join","log","filter","Boolean","freeze"],"mappings":"AAQA,IAAIA,gBAAgB,GAAG,KAAvB;;AAEA,MAAMC,aAAa,GAAG,MAAM;AAC1B,MAAI,CAACC,OAAL,EAAc;AACZC,IAAAA,OAAO,CAACC,IAAR,CAAa,uDAAb;AACA;AACD;;AACDJ,EAAAA,gBAAgB,GAAG,IAAnB;AACD,CAND;;AAQA,IAAIK,KAAY,GAAG,MAAM,CAAE,CAA3B;;AAEA,IAAIH,OAAJ,EAAa;AACXG,EAAAA,KAAK,GAAG,CAAC;AAAEC,IAAAA,SAAF;AAAaC,IAAAA,MAAb;AAAqBC,IAAAA;AAArB,GAAD,KAAmC;AACzC,QAAI,CAACR,gBAAL,EAAuB;AACrB;AACD;;AACD,QAAIS,OAAO,GAAG,EAAd;;AAEA,QAAI,OAAOD,MAAP,KAAkB,QAAtB,EAAgC;AAC9BC,MAAAA,OAAO,GAAGC,MAAM,CAACC,IAAP,CAAYH,MAAZ,EACPI,GADO,CACHC,GAAG,IAAK,GAAEA,GAAI,IAAGL,MAAM,CAACK,GAAD,CAAM,EAD1B,EAEPC,IAFO,CAEF,GAFE,CAAV;AAGD,KAJD,MAIO;AACLL,MAAAA,OAAO,GAAI,GAAED,MAAH,aAAGA,MAAH,cAAGA,MAAH,GAAa,EAAG,EAA1B;AACD,KAZwC,CAazC;;;AACAL,IAAAA,OAAO,CAACY,GAAR,CAAa,IAAG,CAACT,SAAD,EAAYC,MAAZ,EAAoBS,MAApB,CAA2BC,OAA3B,EAAoCH,IAApC,CAAyC,IAAzC,CAA+C,GAA/D,EAAmEL,OAAnE;AACD,GAfD;AAgBD;;AAEDC,MAAM,CAACQ,MAAP,CAAcb,KAAd;AAEA,SAASA,KAAT,EAAgBJ,aAAhB","sourcesContent":["interface PrintOptions {\n component?: string;\n method?: string;\n params?: Record | string | number | boolean;\n}\n\ntype Print = (options: PrintOptions) => void;\n\nlet isLoggingEnabled = false;\n\nconst enableLogging = () => {\n if (!__DEV__) {\n console.warn('[BottomSheet] could not enable logging on production!');\n return;\n }\n isLoggingEnabled = true;\n};\n\nlet print: Print = () => {};\n\nif (__DEV__) {\n print = ({ component, method, params }) => {\n if (!isLoggingEnabled) {\n return;\n }\n let message = '';\n\n if (typeof params === 'object') {\n message = Object.keys(params)\n .map(key => `${key}:${params[key]}`)\n .join(' ');\n } else {\n message = `${params ?? ''}`;\n }\n // eslint-disable-next-line no-console\n console.log(`[${[component, method].filter(Boolean).join('::')}]`, message);\n };\n}\n\nObject.freeze(print);\n\nexport { print, enableLogging };\n"]} \ No newline at end of file diff --git a/lib/module/utilities/noop.js b/lib/module/utilities/noop.js deleted file mode 100644 index b9bcedf3d..000000000 --- a/lib/module/utilities/noop.js +++ /dev/null @@ -1,8 +0,0 @@ -const workletNoop = () => { - 'worklet'; -}; - -const noop = () => {}; - -export { noop, workletNoop }; -//# sourceMappingURL=noop.js.map \ No newline at end of file diff --git a/lib/module/utilities/noop.js.map b/lib/module/utilities/noop.js.map deleted file mode 100644 index 3fa335019..000000000 --- a/lib/module/utilities/noop.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["noop.ts"],"names":["workletNoop","noop"],"mappings":"AAAA,MAAMA,WAAW,GAAG,MAAM;AACxB;AACD,CAFD;;AAIA,MAAMC,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEA,SAASA,IAAT,EAAeD,WAAf","sourcesContent":["const workletNoop = () => {\n 'worklet';\n};\n\nconst noop = () => {};\n\nexport { noop, workletNoop };\n"]} \ No newline at end of file diff --git a/lib/module/utilities/normalizeSnapPoint.js b/lib/module/utilities/normalizeSnapPoint.js deleted file mode 100644 index 64836932f..000000000 --- a/lib/module/utilities/normalizeSnapPoint.js +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Converts a snap point to fixed numbers. - */ -export const normalizeSnapPoint = (snapPoint, containerHeight) => { - 'worklet'; - - let normalizedSnapPoint = snapPoint; // percentage snap point - - if (typeof normalizedSnapPoint === 'string') { - normalizedSnapPoint = Number(normalizedSnapPoint.split('%')[0]) * containerHeight / 100; - } - - return Math.max(0, containerHeight - normalizedSnapPoint); -}; -//# sourceMappingURL=normalizeSnapPoint.js.map \ No newline at end of file diff --git a/lib/module/utilities/normalizeSnapPoint.js.map b/lib/module/utilities/normalizeSnapPoint.js.map deleted file mode 100644 index 3570f6985..000000000 --- a/lib/module/utilities/normalizeSnapPoint.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["normalizeSnapPoint.ts"],"names":["normalizeSnapPoint","snapPoint","containerHeight","normalizedSnapPoint","Number","split","Math","max"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,MAAMA,kBAAkB,GAAG,CAChCC,SADgC,EAEhCC,eAFgC,KAG7B;AACH;;AACA,MAAIC,mBAAmB,GAAGF,SAA1B,CAFG,CAIH;;AACA,MAAI,OAAOE,mBAAP,KAA+B,QAAnC,EAA6C;AAC3CA,IAAAA,mBAAmB,GAChBC,MAAM,CAACD,mBAAmB,CAACE,KAApB,CAA0B,GAA1B,EAA+B,CAA/B,CAAD,CAAN,GAA4CH,eAA7C,GAAgE,GADlE;AAED;;AACD,SAAOI,IAAI,CAACC,GAAL,CAAS,CAAT,EAAYL,eAAe,GAAGC,mBAA9B,CAAP;AACD,CAbM","sourcesContent":["/**\n * Converts a snap point to fixed numbers.\n */\nexport const normalizeSnapPoint = (\n snapPoint: number | string,\n containerHeight: number\n) => {\n 'worklet';\n let normalizedSnapPoint = snapPoint;\n\n // percentage snap point\n if (typeof normalizedSnapPoint === 'string') {\n normalizedSnapPoint =\n (Number(normalizedSnapPoint.split('%')[0]) * containerHeight) / 100;\n }\n return Math.max(0, containerHeight - normalizedSnapPoint);\n};\n"]} \ No newline at end of file diff --git a/lib/module/utilities/snapPoint.js b/lib/module/utilities/snapPoint.js deleted file mode 100644 index c4c3f1303..000000000 --- a/lib/module/utilities/snapPoint.js +++ /dev/null @@ -1,9 +0,0 @@ -export const snapPoint = (value, velocity, points) => { - 'worklet'; - - const point = value + 0.2 * velocity; - const deltas = points.map(p => Math.abs(point - p)); - const minDelta = Math.min.apply(null, deltas); - return points.filter(p => Math.abs(point - p) === minDelta)[0]; -}; -//# sourceMappingURL=snapPoint.js.map \ No newline at end of file diff --git a/lib/module/utilities/snapPoint.js.map b/lib/module/utilities/snapPoint.js.map deleted file mode 100644 index deb7e9f37..000000000 --- a/lib/module/utilities/snapPoint.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["snapPoint.ts"],"names":["snapPoint","value","velocity","points","point","deltas","map","p","Math","abs","minDelta","min","apply","filter"],"mappings":"AAAA,OAAO,MAAMA,SAAS,GAAG,CACvBC,KADuB,EAEvBC,QAFuB,EAGvBC,MAHuB,KAIZ;AACX;;AACA,QAAMC,KAAK,GAAGH,KAAK,GAAG,MAAMC,QAA5B;AACA,QAAMG,MAAM,GAAGF,MAAM,CAACG,GAAP,CAAWC,CAAC,IAAIC,IAAI,CAACC,GAAL,CAASL,KAAK,GAAGG,CAAjB,CAAhB,CAAf;AACA,QAAMG,QAAQ,GAAGF,IAAI,CAACG,GAAL,CAASC,KAAT,CAAe,IAAf,EAAqBP,MAArB,CAAjB;AACA,SAAOF,MAAM,CAACU,MAAP,CAAcN,CAAC,IAAIC,IAAI,CAACC,GAAL,CAASL,KAAK,GAAGG,CAAjB,MAAwBG,QAA3C,EAAqD,CAArD,CAAP;AACD,CAVM","sourcesContent":["export const snapPoint = (\n value: number,\n velocity: number,\n points: ReadonlyArray\n): number => {\n 'worklet';\n const point = value + 0.2 * velocity;\n const deltas = points.map(p => Math.abs(point - p));\n const minDelta = Math.min.apply(null, deltas);\n return points.filter(p => Math.abs(point - p) === minDelta)[0];\n};\n"]} \ No newline at end of file diff --git a/lib/module/utilities/validateSnapPoint.js b/lib/module/utilities/validateSnapPoint.js deleted file mode 100644 index e06e657e2..000000000 --- a/lib/module/utilities/validateSnapPoint.js +++ /dev/null @@ -1,7 +0,0 @@ -import invariant from 'invariant'; -export const validateSnapPoint = snapPoint => { - invariant(typeof snapPoint === 'number' || typeof snapPoint === 'string', `'${snapPoint}' is not a valid snap point! expected types are string or number.`); - invariant(typeof snapPoint === 'number' || typeof snapPoint === 'string' && snapPoint.includes('%'), `'${snapPoint}' is not a valid percentage snap point! expected percentage snap point must include '%'. e.g. '50%'`); - invariant(typeof snapPoint === 'number' || typeof snapPoint === 'string' && Number(snapPoint.split('%')[0]), `'${snapPoint}' is not a valid percentage snap point! expected percentage snap point must be only numbers and '%'. e.g. '50%'`); -}; -//# sourceMappingURL=validateSnapPoint.js.map \ No newline at end of file diff --git a/lib/module/utilities/validateSnapPoint.js.map b/lib/module/utilities/validateSnapPoint.js.map deleted file mode 100644 index 14eb4576c..000000000 --- a/lib/module/utilities/validateSnapPoint.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["validateSnapPoint.ts"],"names":["invariant","validateSnapPoint","snapPoint","includes","Number","split"],"mappings":"AAAA,OAAOA,SAAP,MAAsB,WAAtB;AAEA,OAAO,MAAMC,iBAAiB,GAAIC,SAAD,IAAoB;AACnDF,EAAAA,SAAS,CACP,OAAOE,SAAP,KAAqB,QAArB,IAAiC,OAAOA,SAAP,KAAqB,QAD/C,EAEN,IAAGA,SAAU,mEAFP,CAAT;AAKAF,EAAAA,SAAS,CACP,OAAOE,SAAP,KAAqB,QAArB,IACG,OAAOA,SAAP,KAAqB,QAArB,IAAiCA,SAAS,CAACC,QAAV,CAAmB,GAAnB,CAF7B,EAGN,IAAGD,SAAU,qGAHP,CAAT;AAMAF,EAAAA,SAAS,CACP,OAAOE,SAAP,KAAqB,QAArB,IACG,OAAOA,SAAP,KAAqB,QAArB,IAAiCE,MAAM,CAACF,SAAS,CAACG,KAAV,CAAgB,GAAhB,EAAqB,CAArB,CAAD,CAFnC,EAGN,IAAGH,SAAU,iHAHP,CAAT;AAKD,CAjBM","sourcesContent":["import invariant from 'invariant';\n\nexport const validateSnapPoint = (snapPoint: any) => {\n invariant(\n typeof snapPoint === 'number' || typeof snapPoint === 'string',\n `'${snapPoint}' is not a valid snap point! expected types are string or number.`\n );\n\n invariant(\n typeof snapPoint === 'number' ||\n (typeof snapPoint === 'string' && snapPoint.includes('%')),\n `'${snapPoint}' is not a valid percentage snap point! expected percentage snap point must include '%'. e.g. '50%'`\n );\n\n invariant(\n typeof snapPoint === 'number' ||\n (typeof snapPoint === 'string' && Number(snapPoint.split('%')[0])),\n `'${snapPoint}' is not a valid percentage snap point! expected percentage snap point must be only numbers and '%'. e.g. '50%'`\n );\n};\n"]} \ No newline at end of file diff --git a/lib/typescript/components/bottomSheet/BottomSheet.d.ts b/lib/typescript/components/bottomSheet/BottomSheet.d.ts deleted file mode 100644 index f6abd37b8..000000000 --- a/lib/typescript/components/bottomSheet/BottomSheet.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import React from 'react'; -import type { BottomSheetMethods } from '../../types'; -import type { BottomSheetProps } from './types'; -declare type BottomSheet = BottomSheetMethods; -declare const BottomSheet: React.MemoExoticComponent>>; -export default BottomSheet; diff --git a/lib/typescript/components/bottomSheet/constants.d.ts b/lib/typescript/components/bottomSheet/constants.d.ts deleted file mode 100644 index 187bc6eeb..000000000 --- a/lib/typescript/components/bottomSheet/constants.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -declare const DEFAULT_HANDLE_HEIGHT = 24; -declare const DEFAULT_OVER_DRAG_RESISTANCE_FACTOR = 2.5; -declare const DEFAULT_ENABLE_CONTENT_PANNING_GESTURE = true; -declare const DEFAULT_ENABLE_HANDLE_PANNING_GESTURE = true; -declare const DEFAULT_ENABLE_OVER_DRAG = true; -declare const DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE = false; -declare const DEFAULT_ANIMATE_ON_MOUNT = true; -declare const DEFAULT_DYNAMIC_SIZING = false; -declare const DEFAULT_KEYBOARD_BEHAVIOR: "interactive"; -declare const DEFAULT_KEYBOARD_BLUR_BEHAVIOR: "none"; -declare const DEFAULT_KEYBOARD_INPUT_MODE: "adjustPan"; -declare const INITIAL_VALUE: number; -declare const INITIAL_SNAP_POINT = -999; -declare const INITIAL_CONTAINER_HEIGHT = -999; -declare const INITIAL_CONTAINER_OFFSET: { - top: number; - bottom: number; - left: number; - right: number; -}; -declare const INITIAL_HANDLE_HEIGHT = -999; -declare const INITIAL_POSITION: number; -export { DEFAULT_HANDLE_HEIGHT, DEFAULT_OVER_DRAG_RESISTANCE_FACTOR, DEFAULT_ENABLE_CONTENT_PANNING_GESTURE, DEFAULT_ENABLE_HANDLE_PANNING_GESTURE, DEFAULT_ENABLE_OVER_DRAG, DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE, DEFAULT_DYNAMIC_SIZING, DEFAULT_ANIMATE_ON_MOUNT, DEFAULT_KEYBOARD_BEHAVIOR, DEFAULT_KEYBOARD_BLUR_BEHAVIOR, DEFAULT_KEYBOARD_INPUT_MODE, INITIAL_POSITION, INITIAL_CONTAINER_HEIGHT, INITIAL_CONTAINER_OFFSET, INITIAL_HANDLE_HEIGHT, INITIAL_SNAP_POINT, INITIAL_VALUE, }; diff --git a/lib/typescript/components/bottomSheet/index.d.ts b/lib/typescript/components/bottomSheet/index.d.ts deleted file mode 100644 index fce453ad5..000000000 --- a/lib/typescript/components/bottomSheet/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './BottomSheet'; -export type { BottomSheetProps } from './types'; diff --git a/lib/typescript/components/bottomSheet/styles.d.ts b/lib/typescript/components/bottomSheet/styles.d.ts deleted file mode 100644 index df97caab9..000000000 --- a/lib/typescript/components/bottomSheet/styles.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -export declare const styles: { - container: { - flexDirection: "column-reverse"; - position: "absolute"; - top: number; - left: number; - right: number; - }; - contentContainer: {}; - contentMaskContainer: { - overflow: "hidden"; - }; -}; diff --git a/lib/typescript/components/bottomSheet/types.d.ts b/lib/typescript/components/bottomSheet/types.d.ts deleted file mode 100644 index 575ca3035..000000000 --- a/lib/typescript/components/bottomSheet/types.d.ts +++ /dev/null @@ -1,334 +0,0 @@ -import type React from 'react'; -import type { ViewStyle, Insets, StyleProp } from 'react-native'; -import type { - SharedValue, - AnimateStyle, - WithSpringConfig, - WithTimingConfig, -} from 'react-native-reanimated'; -import type { PanGestureHandlerProps } from 'react-native-gesture-handler'; -import type { BottomSheetHandleProps } from '../bottomSheetHandle'; -import type { BottomSheetBackdropProps } from '../bottomSheetBackdrop'; -import type { BottomSheetBackgroundProps } from '../bottomSheetBackground'; -import type { BottomSheetFooterProps } from '../bottomSheetFooter'; -import type { - ANIMATION_SOURCE, - KEYBOARD_BEHAVIOR, - KEYBOARD_BLUR_BEHAVIOR, - KEYBOARD_INPUT_MODE, -} from '../../constants'; -import type { GestureEventsHandlersHookType } from '../../types'; - -export interface BottomSheetProps - extends BottomSheetAnimationConfigs, - Partial< - Pick< - PanGestureHandlerProps, - | 'activeOffsetY' - | 'activeOffsetX' - | 'failOffsetY' - | 'failOffsetX' - | 'waitFor' - | 'simultaneousHandlers' - > - > { - //#region configuration - /** - * Initial snap point index, provide `-1` to initiate bottom sheet in closed state. - * @type number - * @default 0 - */ - index?: number; - /** - * Points for the bottom sheet to snap to. It accepts array of number, string or mix. - * String values should be a percentage. - * - * ⚠️ This prop is required unless you set `enableDynamicSizing` to `true`. - * @example - * snapPoints={[200, 500]} - * snapPoints={[200, '%50']} - * snapPoints={['%100']} - * @type Array - */ - snapPoints?: - | Array - | SharedValue> - | Readonly<(string | number)[] | SharedValue<(string | number)[]>>; - /** - * Defines how violently sheet has to be stopped while over dragging. - * @type number - * @default 2.5 - */ - overDragResistanceFactor?: number; - /** - * Defines whether the bottom sheet is attached to the bottom or no. - * @type boolean - * @default false - */ - detached?: boolean; - /** - * Enable content panning gesture interaction. - * @type boolean - * @default true - */ - enableContentPanningGesture?: boolean; - /** - * Enable handle panning gesture interaction. - * @type boolean - * @default true - */ - enableHandlePanningGesture?: boolean; - /** - * Enable over drag for the sheet. - * @type boolean - * @default true - */ - enableOverDrag?: boolean; - /** - * Enable pan down gesture to close the sheet. - * @type boolean - * @default false - */ - enablePanDownToClose?: boolean; - /** - * Enable dynamic sizing for content view and scrollable - * content size. - * @type boolean - * @default false - */ - enableDynamicSizing?: boolean; - /** - * To start the sheet closed and snap to initial index when it's mounted. - * @type boolean - * @default true - */ - animateOnMount?: boolean; - //#endregion - - //#region layout - /** - * Handle height helps to calculate the internal container and sheet layouts, - * if `handleComponent` is provided, the library internally will calculate its layout, - * unless `handleHeight` is provided. - * @type number - */ - handleHeight?: number | SharedValue; - /** - * Container height helps to calculate the internal sheet layouts, - * if `containerHeight` not provided, the library internally will calculate it, - * however this will cause an extra re-rendering. - * @type number | SharedValue; - */ - containerHeight?: number | SharedValue; - /** - * Content height helps dynamic snap points calculation. - * @type number | SharedValue; - */ - contentHeight?: number | SharedValue; - /** - * Container offset helps to accurately detect container offsets. - * @type SharedValue; - */ - containerOffset?: SharedValue>; - /** - * Top inset value helps to calculate percentage snap points values, - * usually comes from `@react-navigation/stack` hook `useHeaderHeight` or - * from `react-native-safe-area-context` hook `useSafeArea`. - * @type number - * @default 0 - */ - topInset?: number; - /** - * Bottom inset value helps to calculate percentage snap points values, - * usually comes from `react-native-safe-area-context` hook `useSafeArea`. - * @type number - * @default 0 - */ - bottomInset?: number; - /** - * Max dynamic content size height to limit the bottom sheet height - * from exceeding a provided size. - * @type number - * @default container height - */ - maxDynamicContentSize?: number; - //#endregion - - //#region keyboard - /** - * Defines the keyboard appearance behavior. - * @enum - * - `interactive`: offset the sheet by the size of the keyboard. - * - `extend`: extend the sheet to its maximum snap point. - * - `fillParent`: extend the sheet to fill parent. - * @type `interactive` | `extend` | `fillParent` - * @default interactive - */ - keyboardBehavior?: keyof typeof KEYBOARD_BEHAVIOR; - /** - * Defines the keyboard blur behavior. - * - `none`: do nothing. - * - `restore`: restore sheet position. - */ - keyboardBlurBehavior?: keyof typeof KEYBOARD_BLUR_BEHAVIOR; - /** - * Defines keyboard input mode for Android only. - * @link {https://developer.android.com/guide/topics/manifest/activity-element#wsoft} - * @type `adjustPan` | `adjustResize` - * @default `adjustPan` - */ - android_keyboardInputMode?: keyof typeof KEYBOARD_INPUT_MODE; - - //#endregion - - //#region styles - /** - * View style to be applied to the container. - * @type ViewStyle - * @default undefined - */ - containerStyle?: StyleProp; - /** - * View style to be applied to the sheet container component, - * it also could be an Animated Style. - * @type AnimateStyle - * @default undefined - */ - style?: StyleProp< - AnimateStyle< - Omit< - ViewStyle, - | 'flexDirection' - | 'position' - | 'top' - | 'left' - | 'bottom' - | 'right' - | 'opacity' - | 'transform' - > - > - >; - /** - * View style to be applied to the background component. - * @type ViewStyle - * @default undefined - */ - backgroundStyle?: StyleProp< - Omit - >; - /** - * View style to be applied to the handle component. - * @type ViewStyle - * @default undefined - */ - handleStyle?: StyleProp; - /** - * View style to be applied to the handle indicator component. - * @type ViewStyle - * @default undefined - */ - handleIndicatorStyle?: StyleProp; - //#endregion - - /** - * Custom hook to provide pan gesture events handler, which will allow advance and - * customize handling for pan gesture. - * @warning this is an experimental feature and the hook signature can change without a major version bump. - * @type GestureEventsHandlersHookType - * @default useGestureEventsHandlersDefault - */ - gestureEventsHandlersHook?: GestureEventsHandlersHookType; - - //#region animated nodes - /** - * Animated value to be used as a callback of the position node internally. - * @type SharedValue - */ - animatedPosition?: SharedValue; - /** - * Animated value to be used as a callback for the position index node internally. - * @type SharedValue - */ - animatedIndex?: SharedValue; - //#endregion - - //#region callbacks - /** - * Callback when the sheet position changed to a provided point. - * - * @type (index: number) => void; - */ - onChange?: (index: number) => void; - /** - * Callback when the sheet close. - * - * @type () => void; - */ - onClose?: () => void; - /** - * Callback when the sheet about to animate to a new position. - * - * @type (fromIndex: number, toIndex: number) => void; - */ - onAnimate?: (fromIndex: number, toIndex: number) => void; - //#endregion - - //#region components - /** - * Component to be placed as a sheet handle. - * @see {BottomSheetHandleProps} - * @type React.FC\ - */ - handleComponent?: React.FC | null; - /** - * Component to be placed as a sheet backdrop. - * @see {BottomSheetBackdropProps} - * @type React.FC\ - * @default null - */ - backdropComponent?: React.FC | null; - /** - * Component to be placed as a background. - * @see {BottomSheetBackgroundProps} - * @type React.FC\ - */ - backgroundComponent?: React.FC | null; - /** - * Component to be placed as a footer. - * @see {BottomSheetFooterProps} - * @type React.FC\ - */ - footerComponent?: React.FC; - /** - * A scrollable node or normal view. - * @type (() => React.ReactElement) | React.ReactNode[] | React.ReactNode - */ - children: (() => React.ReactElement) | React.ReactNode[] | React.ReactNode; - //#endregion - - //#region private - /** - * An indicator whether if the sheet running in a modal. - * @type boolean - */ - $modal?: boolean; - //#endregion -} - -export interface BottomSheetAnimationConfigs { - /** - * Animation configs, this could be created by: - * - `useBottomSheetSpringConfigs` - * - `useBottomSheetTimingConfigs` - * @type WithSpringConfig | WithTimingConfig - */ - animationConfigs?: WithSpringConfig | WithTimingConfig; -} - -export type AnimateToPositionType = ( - position: number, - source: ANIMATION_SOURCE, - velocity?: number, - configs?: WithTimingConfig | WithSpringConfig -) => void; diff --git a/lib/typescript/components/bottomSheetBackdrop/BottomSheetBackdrop.d.ts b/lib/typescript/components/bottomSheetBackdrop/BottomSheetBackdrop.d.ts deleted file mode 100644 index cdffb3560..000000000 --- a/lib/typescript/components/bottomSheetBackdrop/BottomSheetBackdrop.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import React from 'react'; -import type { BottomSheetDefaultBackdropProps } from './types'; -declare const BottomSheetBackdrop: React.MemoExoticComponent<({ animatedIndex, opacity: _providedOpacity, appearsOnIndex: _providedAppearsOnIndex, disappearsOnIndex: _providedDisappearsOnIndex, enableTouchThrough: _providedEnableTouchThrough, pressBehavior, onPress, style, children, }: BottomSheetDefaultBackdropProps) => JSX.Element>; -export default BottomSheetBackdrop; diff --git a/lib/typescript/components/bottomSheetBackdrop/constants.d.ts b/lib/typescript/components/bottomSheetBackdrop/constants.d.ts deleted file mode 100644 index 607e4f1aa..000000000 --- a/lib/typescript/components/bottomSheetBackdrop/constants.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -declare const DEFAULT_OPACITY = 0.5; -declare const DEFAULT_APPEARS_ON_INDEX = 1; -declare const DEFAULT_DISAPPEARS_ON_INDEX = 0; -declare const DEFAULT_ENABLE_TOUCH_THROUGH = false; -declare const DEFAULT_PRESS_BEHAVIOR: "close"; -export { DEFAULT_OPACITY, DEFAULT_APPEARS_ON_INDEX, DEFAULT_DISAPPEARS_ON_INDEX, DEFAULT_ENABLE_TOUCH_THROUGH, DEFAULT_PRESS_BEHAVIOR, }; diff --git a/lib/typescript/components/bottomSheetBackdrop/index.d.ts b/lib/typescript/components/bottomSheetBackdrop/index.d.ts deleted file mode 100644 index 2ee0ef56c..000000000 --- a/lib/typescript/components/bottomSheetBackdrop/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './BottomSheetBackdrop'; -export type { BottomSheetBackdropProps } from './types'; diff --git a/lib/typescript/components/bottomSheetBackdrop/styles.d.ts b/lib/typescript/components/bottomSheetBackdrop/styles.d.ts deleted file mode 100644 index a015593bd..000000000 --- a/lib/typescript/components/bottomSheetBackdrop/styles.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export declare const styles: { - container: { - backgroundColor: string; - }; -}; diff --git a/lib/typescript/components/bottomSheetBackdrop/types.d.ts b/lib/typescript/components/bottomSheetBackdrop/types.d.ts deleted file mode 100644 index 6a33b9a73..000000000 --- a/lib/typescript/components/bottomSheetBackdrop/types.d.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { ReactNode } from 'react'; -import type { ViewProps } from 'react-native'; -import type { BottomSheetVariables } from '../../types'; - -export interface BottomSheetBackdropProps - extends Pick, - BottomSheetVariables {} - -export type BackdropPressBehavior = 'none' | 'close' | 'collapse' | number; - -export interface BottomSheetDefaultBackdropProps - extends BottomSheetBackdropProps { - /** - * Backdrop opacity. - * @type number - * @default 0.5 - */ - opacity?: number; - /** - * Snap point index when backdrop will appears on. - * @type number - * @default 1 - */ - appearsOnIndex?: number; - /** - * Snap point index when backdrop will disappears on. - * @type number - * @default 0 - */ - disappearsOnIndex?: number; - /** - * Enable touch through backdrop component. - * @type boolean - * @default false - */ - enableTouchThrough?: boolean; - /** - * What should happen when user press backdrop? - * @type BackdropPressBehavior - * @default 'close' - */ - pressBehavior?: BackdropPressBehavior; - - /** - * Function which will be executed on pressing backdrop component - * @type {Function} - */ - onPress?: () => void; - /** - * Child component that will be rendered on backdrop. - */ - children?: ReactNode | ReactNode[]; -} diff --git a/lib/typescript/components/bottomSheetBackdropContainer/BottomSheetBackdropContainer.d.ts b/lib/typescript/components/bottomSheetBackdropContainer/BottomSheetBackdropContainer.d.ts deleted file mode 100644 index 649f9b489..000000000 --- a/lib/typescript/components/bottomSheetBackdropContainer/BottomSheetBackdropContainer.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import React from 'react'; -import type { BottomSheetBackdropContainerProps } from './types'; -declare const BottomSheetBackdropContainer: React.MemoExoticComponent<({ animatedIndex, animatedPosition, backdropComponent: BackdropComponent, }: BottomSheetBackdropContainerProps) => JSX.Element | null>; -export default BottomSheetBackdropContainer; diff --git a/lib/typescript/components/bottomSheetBackdropContainer/index.d.ts b/lib/typescript/components/bottomSheetBackdropContainer/index.d.ts deleted file mode 100644 index 3db6d12f8..000000000 --- a/lib/typescript/components/bottomSheetBackdropContainer/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './BottomSheetBackdropContainer'; diff --git a/lib/typescript/components/bottomSheetBackdropContainer/styles.d.ts b/lib/typescript/components/bottomSheetBackdropContainer/styles.d.ts deleted file mode 100644 index 1499ffb3b..000000000 --- a/lib/typescript/components/bottomSheetBackdropContainer/styles.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export declare const styles: { - container: { - position: "absolute"; - top: number; - left: number; - right: number; - bottom: number; - }; -}; diff --git a/lib/typescript/components/bottomSheetBackdropContainer/types.d.ts b/lib/typescript/components/bottomSheetBackdropContainer/types.d.ts deleted file mode 100644 index de06232d1..000000000 --- a/lib/typescript/components/bottomSheetBackdropContainer/types.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { BottomSheetProps } from '../bottomSheet'; -import type { BottomSheetBackdropProps } from '../bottomSheetBackdrop'; - -export interface BottomSheetBackdropContainerProps - extends Pick, - BottomSheetBackdropProps {} diff --git a/lib/typescript/components/bottomSheetBackground/BottomSheetBackground.d.ts b/lib/typescript/components/bottomSheetBackground/BottomSheetBackground.d.ts deleted file mode 100644 index 388ff926c..000000000 --- a/lib/typescript/components/bottomSheetBackground/BottomSheetBackground.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import React from 'react'; -import type { BottomSheetBackgroundProps } from './types'; -declare const BottomSheetBackground: React.MemoExoticComponent<({ pointerEvents, style, }: BottomSheetBackgroundProps) => JSX.Element>; -export default BottomSheetBackground; diff --git a/lib/typescript/components/bottomSheetBackground/index.d.ts b/lib/typescript/components/bottomSheetBackground/index.d.ts deleted file mode 100644 index 14964f214..000000000 --- a/lib/typescript/components/bottomSheetBackground/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './BottomSheetBackground'; -export type { BottomSheetBackgroundProps } from './types'; diff --git a/lib/typescript/components/bottomSheetBackground/styles.d.ts b/lib/typescript/components/bottomSheetBackground/styles.d.ts deleted file mode 100644 index 5505fe350..000000000 --- a/lib/typescript/components/bottomSheetBackground/styles.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare const styles: { - container: { - backgroundColor: string; - borderRadius: number; - }; -}; diff --git a/lib/typescript/components/bottomSheetBackground/types.d.ts b/lib/typescript/components/bottomSheetBackground/types.d.ts deleted file mode 100644 index 37d2e20db..000000000 --- a/lib/typescript/components/bottomSheetBackground/types.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { ViewProps } from 'react-native'; -import type { BottomSheetVariables } from '../../types'; - -export interface BottomSheetBackgroundProps - extends Pick, - BottomSheetVariables {} diff --git a/lib/typescript/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.d.ts b/lib/typescript/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.d.ts deleted file mode 100644 index d01f03343..000000000 --- a/lib/typescript/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import React from 'react'; -import type { BottomSheetBackgroundContainerProps } from './types'; -declare const BottomSheetBackgroundContainer: React.MemoExoticComponent<({ animatedIndex, animatedPosition, backgroundComponent: _providedBackgroundComponent, backgroundStyle: _providedBackgroundStyle, }: BottomSheetBackgroundContainerProps) => JSX.Element | null>; -export default BottomSheetBackgroundContainer; diff --git a/lib/typescript/components/bottomSheetBackgroundContainer/index.d.ts b/lib/typescript/components/bottomSheetBackgroundContainer/index.d.ts deleted file mode 100644 index 929b5e06f..000000000 --- a/lib/typescript/components/bottomSheetBackgroundContainer/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './BottomSheetBackgroundContainer'; diff --git a/lib/typescript/components/bottomSheetBackgroundContainer/styles.d.ts b/lib/typescript/components/bottomSheetBackgroundContainer/styles.d.ts deleted file mode 100644 index 1499ffb3b..000000000 --- a/lib/typescript/components/bottomSheetBackgroundContainer/styles.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export declare const styles: { - container: { - position: "absolute"; - top: number; - left: number; - right: number; - bottom: number; - }; -}; diff --git a/lib/typescript/components/bottomSheetBackgroundContainer/types.d.ts b/lib/typescript/components/bottomSheetBackgroundContainer/types.d.ts deleted file mode 100644 index 3b0978311..000000000 --- a/lib/typescript/components/bottomSheetBackgroundContainer/types.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { BottomSheetProps } from '../bottomSheet'; -import type { BottomSheetBackgroundProps } from '../bottomSheetBackground'; - -export interface BottomSheetBackgroundContainerProps - extends Pick, - BottomSheetBackgroundProps {} diff --git a/lib/typescript/components/bottomSheetContainer/BottomSheetContainer.d.ts b/lib/typescript/components/bottomSheetContainer/BottomSheetContainer.d.ts deleted file mode 100644 index b12778c29..000000000 --- a/lib/typescript/components/bottomSheetContainer/BottomSheetContainer.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import React from 'react'; -import type { BottomSheetContainerProps } from './types'; -declare function BottomSheetContainerComponent({ containerHeight, containerOffset, topInset, bottomInset, shouldCalculateHeight, detached, style, children, }: BottomSheetContainerProps): JSX.Element; -declare const BottomSheetContainer: React.MemoExoticComponent; -export default BottomSheetContainer; diff --git a/lib/typescript/components/bottomSheetContainer/index.d.ts b/lib/typescript/components/bottomSheetContainer/index.d.ts deleted file mode 100644 index ff4646d1a..000000000 --- a/lib/typescript/components/bottomSheetContainer/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './BottomSheetContainer'; -export type { BottomSheetContainerProps } from './types'; diff --git a/lib/typescript/components/bottomSheetContainer/styles.d.ts b/lib/typescript/components/bottomSheetContainer/styles.d.ts deleted file mode 100644 index 428d90e9f..000000000 --- a/lib/typescript/components/bottomSheetContainer/styles.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export declare const styles: { - container: { - position: "absolute"; - left: 0; - right: 0; - top: 0; - bottom: 0; - }; -}; diff --git a/lib/typescript/components/bottomSheetContainer/styles.web.d.ts b/lib/typescript/components/bottomSheetContainer/styles.web.d.ts deleted file mode 100644 index 206640490..000000000 --- a/lib/typescript/components/bottomSheetContainer/styles.web.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { StyleSheet } from 'react-native'; -export declare const styles: StyleSheet.NamedStyles | StyleSheet.NamedStyles<{ - container: { - position: "fixed"; - left: number; - right: number; - bottom: number; - top: number; - }; -}>; diff --git a/lib/typescript/components/bottomSheetContainer/types.d.ts b/lib/typescript/components/bottomSheetContainer/types.d.ts deleted file mode 100644 index a2193eddb..000000000 --- a/lib/typescript/components/bottomSheetContainer/types.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import type { ReactNode } from 'react'; -import type { Insets, StyleProp, ViewStyle } from 'react-native'; -import type Animated from 'react-native-reanimated'; -import type { BottomSheetProps } from '../bottomSheet/types'; - -export interface BottomSheetContainerProps - extends Partial< - Pick - > { - containerHeight: Animated.SharedValue; - containerOffset: Animated.SharedValue; - shouldCalculateHeight?: boolean; - style?: StyleProp; - children: ReactNode; -} diff --git a/lib/typescript/components/bottomSheetDraggableView/BottomSheetDraggableView.d.ts b/lib/typescript/components/bottomSheetDraggableView/BottomSheetDraggableView.d.ts deleted file mode 100644 index 29526753a..000000000 --- a/lib/typescript/components/bottomSheetDraggableView/BottomSheetDraggableView.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import React from 'react'; -import type { BottomSheetDraggableViewProps } from './types'; -declare const BottomSheetDraggableView: React.MemoExoticComponent<({ gestureType, nativeGestureRef, refreshControlGestureRef, style, children, ...rest }: BottomSheetDraggableViewProps) => JSX.Element>; -export default BottomSheetDraggableView; diff --git a/lib/typescript/components/bottomSheetDraggableView/index.d.ts b/lib/typescript/components/bottomSheetDraggableView/index.d.ts deleted file mode 100644 index 3d86cb044..000000000 --- a/lib/typescript/components/bottomSheetDraggableView/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './BottomSheetDraggableView'; diff --git a/lib/typescript/components/bottomSheetDraggableView/types.d.ts b/lib/typescript/components/bottomSheetDraggableView/types.d.ts deleted file mode 100644 index 8d38987e2..000000000 --- a/lib/typescript/components/bottomSheetDraggableView/types.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type { ReactNode, Ref } from 'react'; -import type { ViewProps as RNViewProps } from 'react-native'; -import type { NativeViewGestureHandler } from 'react-native-gesture-handler'; -import type { GESTURE_SOURCE } from '../../constants'; - -export type BottomSheetDraggableViewProps = RNViewProps & { - /** - * Defines the gesture type of the draggable view. - * - * @default GESTURE_SOURCE.CONTENT - * @type GESTURE_SOURCE - */ - gestureType?: GESTURE_SOURCE; - nativeGestureRef?: Ref | null; - refreshControlGestureRef?: Ref | null; - children: ReactNode[] | ReactNode; -}; diff --git a/lib/typescript/components/bottomSheetFooter/BottomSheetFooter.d.ts b/lib/typescript/components/bottomSheetFooter/BottomSheetFooter.d.ts deleted file mode 100644 index fd24e4437..000000000 --- a/lib/typescript/components/bottomSheetFooter/BottomSheetFooter.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import React from 'react'; -import type { BottomSheetDefaultFooterProps } from './types'; -declare function BottomSheetFooterComponent({ animatedFooterPosition, bottomInset, style, children, }: BottomSheetDefaultFooterProps): JSX.Element | null; -declare const BottomSheetFooter: React.MemoExoticComponent; -export default BottomSheetFooter; diff --git a/lib/typescript/components/bottomSheetFooter/index.d.ts b/lib/typescript/components/bottomSheetFooter/index.d.ts deleted file mode 100644 index f20231923..000000000 --- a/lib/typescript/components/bottomSheetFooter/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './BottomSheetFooter'; -export type { BottomSheetFooterProps } from './types'; diff --git a/lib/typescript/components/bottomSheetFooter/styles.d.ts b/lib/typescript/components/bottomSheetFooter/styles.d.ts deleted file mode 100644 index 567feaf16..000000000 --- a/lib/typescript/components/bottomSheetFooter/styles.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export declare const styles: { - container: { - position: "absolute"; - top: number; - left: number; - right: number; - zIndex: number; - }; -}; diff --git a/lib/typescript/components/bottomSheetFooter/types.d.ts b/lib/typescript/components/bottomSheetFooter/types.d.ts deleted file mode 100644 index 14c52e86d..000000000 --- a/lib/typescript/components/bottomSheetFooter/types.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -import type { ReactElement, ReactNode } from 'react'; -import { ViewStyle } from 'react-native'; -import type Animated from 'react-native-reanimated'; - -export interface BottomSheetFooterProps { - /** - * Calculated footer animated position. - * - * @type Animated.SharedValue - */ - animatedFooterPosition: Animated.SharedValue; -} - -export interface BottomSheetDefaultFooterProps extends BottomSheetFooterProps { - /** - * Bottom inset to be added below the footer, usually comes - * from `react-native-safe-area-context` hook `useSafeArea`. - * - * @type number - * @default 0 - */ - bottomInset?: number; - - /** - * Container style. - * - * @type ViewStyle - */ - style?: ViewStyle; - - /** - * Component to be placed in the footer. - * - * @type {ReactNode | ReactNode[] | (() => ReactElement)} - */ - children?: ReactNode | ReactNode[] | (() => ReactElement); -} diff --git a/lib/typescript/components/bottomSheetFooterContainer/BottomSheetFooterContainer.d.ts b/lib/typescript/components/bottomSheetFooterContainer/BottomSheetFooterContainer.d.ts deleted file mode 100644 index 25f4a50e4..000000000 --- a/lib/typescript/components/bottomSheetFooterContainer/BottomSheetFooterContainer.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import React from 'react'; -import type { BottomSheetFooterContainerProps } from './types'; -declare const BottomSheetFooterContainer: React.MemoExoticComponent<({ footerComponent: FooterComponent, }: BottomSheetFooterContainerProps) => JSX.Element>; -export default BottomSheetFooterContainer; diff --git a/lib/typescript/components/bottomSheetFooterContainer/types.d.ts b/lib/typescript/components/bottomSheetFooterContainer/types.d.ts deleted file mode 100644 index 2ba8cf705..000000000 --- a/lib/typescript/components/bottomSheetFooterContainer/types.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { BottomSheetProps } from '../bottomSheet'; - -export interface BottomSheetFooterContainerProps - extends Required> {} diff --git a/lib/typescript/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.d.ts b/lib/typescript/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.d.ts deleted file mode 100644 index 38461be9f..000000000 --- a/lib/typescript/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { BottomSheetGestureHandlersProviderProps } from './types'; -declare const BottomSheetGestureHandlersProvider: ({ gestureEventsHandlersHook: useGestureEventsHandlers, children, }: BottomSheetGestureHandlersProviderProps) => JSX.Element; -export default BottomSheetGestureHandlersProvider; diff --git a/lib/typescript/components/bottomSheetGestureHandlersProvider/index.d.ts b/lib/typescript/components/bottomSheetGestureHandlersProvider/index.d.ts deleted file mode 100644 index ab5338f64..000000000 --- a/lib/typescript/components/bottomSheetGestureHandlersProvider/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './BottomSheetGestureHandlersProvider'; diff --git a/lib/typescript/components/bottomSheetGestureHandlersProvider/types.d.ts b/lib/typescript/components/bottomSheetGestureHandlersProvider/types.d.ts deleted file mode 100644 index 9898f1b8b..000000000 --- a/lib/typescript/components/bottomSheetGestureHandlersProvider/types.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { ReactChild } from 'react'; -import type { BottomSheetProps } from '../bottomSheet/types'; - -export interface BottomSheetGestureHandlersProviderProps - extends Pick { - children: ReactChild | ReactChild[]; -} diff --git a/lib/typescript/components/bottomSheetHandle/BottomSheetHandle.d.ts b/lib/typescript/components/bottomSheetHandle/BottomSheetHandle.d.ts deleted file mode 100644 index 0cf78f454..000000000 --- a/lib/typescript/components/bottomSheetHandle/BottomSheetHandle.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import React from 'react'; -import type { BottomSheetDefaultHandleProps } from './types'; -declare const BottomSheetHandle: React.MemoExoticComponent<({ style, indicatorStyle: _indicatorStyle, children, }: BottomSheetDefaultHandleProps) => JSX.Element>; -export default BottomSheetHandle; diff --git a/lib/typescript/components/bottomSheetHandle/index.d.ts b/lib/typescript/components/bottomSheetHandle/index.d.ts deleted file mode 100644 index 442097b11..000000000 --- a/lib/typescript/components/bottomSheetHandle/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './BottomSheetHandle'; -export type { BottomSheetHandleProps } from './types'; diff --git a/lib/typescript/components/bottomSheetHandle/styles.d.ts b/lib/typescript/components/bottomSheetHandle/styles.d.ts deleted file mode 100644 index 4ea04c9d3..000000000 --- a/lib/typescript/components/bottomSheetHandle/styles.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -export declare const styles: { - container: { - padding: number; - }; - indicator: { - alignSelf: "center"; - width: number; - height: number; - borderRadius: number; - backgroundColor: string; - }; -}; diff --git a/lib/typescript/components/bottomSheetHandle/types.d.ts b/lib/typescript/components/bottomSheetHandle/types.d.ts deleted file mode 100644 index 20cc2bc20..000000000 --- a/lib/typescript/components/bottomSheetHandle/types.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -import type React from 'react'; -import type { ViewProps } from 'react-native'; -import type { AnimateProps } from 'react-native-reanimated'; -import type { BottomSheetVariables } from '../../types'; - -export interface BottomSheetHandleProps extends BottomSheetVariables {} - -export interface BottomSheetDefaultHandleProps extends BottomSheetHandleProps { - /** - * View style to be applied to the handle container. - * @type Animated.AnimateStyle | ViewStyle - * @default undefined - */ - style?: AnimateProps['style']; - /** - * View style to be applied to the handle indicator. - * @type Animated.AnimateStyle | ViewStyle - * @default undefined - */ - indicatorStyle?: AnimateProps['style']; - /** - * Content to be added below the indicator. - * @type React.ReactNode | React.ReactNode[]; - * @default undefined - */ - children?: React.ReactNode | React.ReactNode[]; -} diff --git a/lib/typescript/components/bottomSheetHandleContainer/BottomSheetHandleContainer.d.ts b/lib/typescript/components/bottomSheetHandleContainer/BottomSheetHandleContainer.d.ts deleted file mode 100644 index 5db7ca68c..000000000 --- a/lib/typescript/components/bottomSheetHandleContainer/BottomSheetHandleContainer.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import React from 'react'; -import type { BottomSheetHandleContainerProps } from './types'; -declare function BottomSheetHandleContainerComponent({ animatedIndex, animatedPosition, simultaneousHandlers: _internalSimultaneousHandlers, enableHandlePanningGesture, handleHeight, handleComponent: _providedHandleComponent, handleStyle: _providedHandleStyle, handleIndicatorStyle: _providedIndicatorStyle, }: BottomSheetHandleContainerProps): JSX.Element | null; -declare const BottomSheetHandleContainer: React.MemoExoticComponent; -export default BottomSheetHandleContainer; diff --git a/lib/typescript/components/bottomSheetHandleContainer/index.d.ts b/lib/typescript/components/bottomSheetHandleContainer/index.d.ts deleted file mode 100644 index 959f0ad03..000000000 --- a/lib/typescript/components/bottomSheetHandleContainer/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './BottomSheetHandleContainer'; diff --git a/lib/typescript/components/bottomSheetHandleContainer/types.d.ts b/lib/typescript/components/bottomSheetHandleContainer/types.d.ts deleted file mode 100644 index c3c2ae928..000000000 --- a/lib/typescript/components/bottomSheetHandleContainer/types.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -import type { PanGestureHandlerProperties } from 'react-native-gesture-handler'; -import type Animated from 'react-native-reanimated'; -import type { BottomSheetProps } from '../bottomSheet'; -import type { BottomSheetHandleProps } from '../bottomSheetHandle'; -import type { useInteractivePanGestureHandlerConfigs } from '../../hooks/useGestureHandler'; - -export interface BottomSheetHandleContainerProps - extends Pick, - Pick< - BottomSheetProps, - | 'handleComponent' - | 'enableHandlePanningGesture' - | 'handleIndicatorStyle' - | 'handleStyle' - >, - Pick< - useInteractivePanGestureHandlerConfigs, - | 'enableOverDrag' - | 'enablePanDownToClose' - | 'overDragResistanceFactor' - | 'keyboardBehavior' - >, - BottomSheetHandleProps { - handleHeight: Animated.SharedValue; -} diff --git a/lib/typescript/components/bottomSheetModal/BottomSheetModal.d.ts b/lib/typescript/components/bottomSheetModal/BottomSheetModal.d.ts deleted file mode 100644 index 6475e6d77..000000000 --- a/lib/typescript/components/bottomSheetModal/BottomSheetModal.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import React from 'react'; -import type { BottomSheetModalMethods } from '../../types'; -import type { BottomSheetModalProps } from './types'; -declare type BottomSheetModal = BottomSheetModalMethods; -declare const BottomSheetModal: React.MemoExoticComponent>>; -export default BottomSheetModal; diff --git a/lib/typescript/components/bottomSheetModal/constants.d.ts b/lib/typescript/components/bottomSheetModal/constants.d.ts deleted file mode 100644 index c355a699e..000000000 --- a/lib/typescript/components/bottomSheetModal/constants.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare const DEFAULT_STACK_BEHAVIOR = "replace"; -declare const DEFAULT_ENABLE_DISMISS_ON_CLOSE = true; -export { DEFAULT_STACK_BEHAVIOR, DEFAULT_ENABLE_DISMISS_ON_CLOSE }; diff --git a/lib/typescript/components/bottomSheetModal/index.d.ts b/lib/typescript/components/bottomSheetModal/index.d.ts deleted file mode 100644 index 46ca7733b..000000000 --- a/lib/typescript/components/bottomSheetModal/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './BottomSheetModal'; -export type { BottomSheetModalProps, BottomSheetModalPrivateMethods, BottomSheetModalStackBehavior, } from './types'; diff --git a/lib/typescript/components/bottomSheetModal/types.d.ts b/lib/typescript/components/bottomSheetModal/types.d.ts deleted file mode 100644 index bc1e71a4e..000000000 --- a/lib/typescript/components/bottomSheetModal/types.d.ts +++ /dev/null @@ -1,61 +0,0 @@ -import type React from 'react'; -import type { BottomSheetProps } from '../bottomSheet'; -import type { MODAL_STACK_BEHAVIOR } from '../../constants'; - -export interface BottomSheetModalPrivateMethods { - dismiss: (force?: boolean) => void; - minimize: () => void; - restore: () => void; -} - -export type BottomSheetModalStackBehavior = keyof typeof MODAL_STACK_BEHAVIOR; - -export interface BottomSheetModalProps - extends Omit { - /** - * Modal name to help identify the modal for later on. - * @type string - * @default nanoid generated unique key. - */ - name?: string; - - /** - * Defines the stack behavior when modal mount. - * - `push` it will mount the modal on top of current modal. - * - `replace` it will minimize the current modal then mount the modal. - * @type `push` | `replace` - * @default replace - */ - stackBehavior?: BottomSheetModalStackBehavior; - - /** - * Enable dismiss the modal when it is closed. - * @type boolean - * @default true - */ - enableDismissOnClose?: boolean; - - /** - * Add a custom container like FullWindowOverlay - * allow to fix issue like https://github.com/gorhom/react-native-bottom-sheet/issues/832 - * @type React.ComponentType - * @default undefined - */ - containerComponent?: React.ComponentType>; - - // callbacks - /** - * Callback when the modal dismissed. - * @type () => void; - */ - onDismiss?: () => void; - - /** - * A scrollable node or normal view. - * @type React.ReactNode[] | React.ReactNode | (({ data: any }?) => React.ReactElement) - */ - children: - | (({ data: any }?) => React.ReactElement) - | React.ReactNode[] - | React.ReactNode; -} diff --git a/lib/typescript/components/bottomSheetModalProvider/BottomSheetModalProvider.d.ts b/lib/typescript/components/bottomSheetModalProvider/BottomSheetModalProvider.d.ts deleted file mode 100644 index 1246e05fe..000000000 --- a/lib/typescript/components/bottomSheetModalProvider/BottomSheetModalProvider.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { BottomSheetModalProviderProps } from './types'; -declare const BottomSheetModalProviderWrapper: ({ children, }: BottomSheetModalProviderProps) => JSX.Element; -export default BottomSheetModalProviderWrapper; diff --git a/lib/typescript/components/bottomSheetModalProvider/index.d.ts b/lib/typescript/components/bottomSheetModalProvider/index.d.ts deleted file mode 100644 index 31ec2b8e1..000000000 --- a/lib/typescript/components/bottomSheetModalProvider/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './BottomSheetModalProvider'; diff --git a/lib/typescript/components/bottomSheetModalProvider/types.d.ts b/lib/typescript/components/bottomSheetModalProvider/types.d.ts deleted file mode 100644 index 78f2464c6..000000000 --- a/lib/typescript/components/bottomSheetModalProvider/types.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { ReactNode } from 'react'; -import type { BottomSheetModalPrivateMethods } from '../bottomSheetModal'; - -export interface BottomSheetModalRef { - key: string; - ref: { - current: BottomSheetModalPrivateMethods; - }; - willUnmount: boolean; -} - -export interface BottomSheetModalProviderProps { - children?: ReactNode; -} diff --git a/lib/typescript/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.d.ts b/lib/typescript/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.d.ts deleted file mode 100644 index 038ea811c..000000000 --- a/lib/typescript/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import React from 'react'; -import { RefreshControlProps } from 'react-native'; -declare const BottomSheetRefreshControl: React.MemoExoticComponent>>>>; -export default BottomSheetRefreshControl; diff --git a/lib/typescript/components/bottomSheetRefreshControl/BottomSheetRefreshControl.d.ts b/lib/typescript/components/bottomSheetRefreshControl/BottomSheetRefreshControl.d.ts deleted file mode 100644 index 04adc0874..000000000 --- a/lib/typescript/components/bottomSheetRefreshControl/BottomSheetRefreshControl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: () => null; -export default _default; diff --git a/lib/typescript/components/bottomSheetRefreshControl/index.d.ts b/lib/typescript/components/bottomSheetRefreshControl/index.d.ts deleted file mode 100644 index 7d09eeec2..000000000 --- a/lib/typescript/components/bottomSheetRefreshControl/index.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type React from 'react'; -import type { RefreshControlProps } from 'react-native'; -import type { NativeViewGestureHandlerProps } from 'react-native-gesture-handler'; -declare const _default: React.MemoExoticComponent>>>>; -export default _default; diff --git a/lib/typescript/components/bottomSheetScrollable/BottomSheetFlatList.d.ts b/lib/typescript/components/bottomSheetScrollable/BottomSheetFlatList.d.ts deleted file mode 100644 index bebcdc8e0..000000000 --- a/lib/typescript/components/bottomSheetScrollable/BottomSheetFlatList.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -/// -import type { BottomSheetFlatListMethods, BottomSheetFlatListProps } from './types'; -declare const BottomSheetFlatList: import("react").MemoExoticComponent, "children" | "style" | "hitSlop" | "onLayout" | "pointerEvents" | "removeClippedSubviews" | "testID" | "nativeID" | "collapsable" | "needsOffscreenAlphaCompositing" | "renderToHardwareTextureAndroid" | "focusable" | "shouldRasterizeIOS" | "isTVSelectable" | "hasTVPreferredFocus" | "tvParallaxProperties" | "tvParallaxShiftDistanceX" | "tvParallaxShiftDistanceY" | "tvParallaxTiltAngle" | "tvParallaxMagnification" | "onStartShouldSetResponder" | "onMoveShouldSetResponder" | "onResponderEnd" | "onResponderGrant" | "onResponderReject" | "onResponderMove" | "onResponderRelease" | "onResponderStart" | "onResponderTerminationRequest" | "onResponderTerminate" | "onStartShouldSetResponderCapture" | "onMoveShouldSetResponderCapture" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "onTouchCancel" | "onTouchEndCapture" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "accessibilityRole" | "accessibilityState" | "accessibilityHint" | "accessibilityValue" | "onAccessibilityAction" | "accessibilityLiveRegion" | "importantForAccessibility" | "accessibilityElementsHidden" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors" | "indicatorStyle" | "animatedProps" | "layout" | "entering" | "exiting" | "data" | "contentOffset" | "ItemSeparatorComponent" | "ListEmptyComponent" | "ListFooterComponent" | "ListFooterComponentStyle" | "ListHeaderComponent" | "ListHeaderComponentStyle" | "columnWrapperStyle" | "keyboardShouldPersistTaps" | "extraData" | "getItemLayout" | "horizontal" | "initialNumToRender" | "initialScrollIndex" | "keyExtractor" | "legacyImplementation" | "numColumns" | "onEndReached" | "onEndReachedThreshold" | "onRefresh" | "onViewableItemsChanged" | "refreshing" | "renderItem" | "viewabilityConfig" | "fadingEdgeLength" | "debug" | "disableVirtualization" | "getItem" | "getItemCount" | "inverted" | "listKey" | "maxToRenderPerBatch" | "onScrollToIndexFailed" | "progressViewOffset" | "renderScrollComponent" | "updateCellsBatchingPeriod" | "viewabilityConfigCallbackPairs" | "windowSize" | "CellRendererComponent" | "contentContainerStyle" | "invertStickyHeaders" | "keyboardDismissMode" | "onContentSizeChange" | "onScrollBeginDrag" | "onScrollEndDrag" | "onMomentumScrollEnd" | "onMomentumScrollBegin" | "pagingEnabled" | "scrollEnabled" | "showsHorizontalScrollIndicator" | "showsVerticalScrollIndicator" | "stickyHeaderHiddenOnScroll" | "refreshControl" | "snapToInterval" | "snapToOffsets" | "snapToStart" | "snapToEnd" | "stickyHeaderIndices" | "disableIntervalMomentum" | "disableScrollViewPanResponder" | "StickyHeaderComponent" | "alwaysBounceHorizontal" | "alwaysBounceVertical" | "automaticallyAdjustContentInsets" | "automaticallyAdjustKeyboardInsets" | "automaticallyAdjustsScrollIndicatorInsets" | "bounces" | "bouncesZoom" | "canCancelContentTouches" | "centerContent" | "contentInset" | "contentInsetAdjustmentBehavior" | "directionalLockEnabled" | "maintainVisibleContentPosition" | "maximumZoomScale" | "minimumZoomScale" | "onScrollAnimationEnd" | "pinchGestureEnabled" | "scrollIndicatorInsets" | "scrollToOverflowEnabled" | "scrollsToTop" | "snapToAlignment" | "onScrollToTop" | "zoomScale" | "endFillColor" | "scrollPerfTag" | "overScrollMode" | "nestedScrollEnabled" | "persistentScrollbar" | keyof import("./types").BottomSheetScrollableProps> & import("react").RefAttributes>>; -declare const _default: (props: BottomSheetFlatListProps) => ReturnType; -export default _default; diff --git a/lib/typescript/components/bottomSheetScrollable/BottomSheetScrollView.d.ts b/lib/typescript/components/bottomSheetScrollable/BottomSheetScrollView.d.ts deleted file mode 100644 index 87a54af5d..000000000 --- a/lib/typescript/components/bottomSheetScrollable/BottomSheetScrollView.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -/// -import type { BottomSheetScrollViewMethods, BottomSheetScrollViewProps } from './types'; -declare const BottomSheetScrollView: import("react").MemoExoticComponent & import("react").RefAttributes>>; -declare const _default: (props: BottomSheetScrollViewProps) => ReturnType; -export default _default; diff --git a/lib/typescript/components/bottomSheetScrollable/BottomSheetSectionList.d.ts b/lib/typescript/components/bottomSheetScrollable/BottomSheetSectionList.d.ts deleted file mode 100644 index d010a869b..000000000 --- a/lib/typescript/components/bottomSheetScrollable/BottomSheetSectionList.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/// -import { DefaultSectionT } from 'react-native'; -import type { BottomSheetSectionListMethods, BottomSheetSectionListProps } from './types'; -declare const BottomSheetSectionList: import("react").MemoExoticComponent, "children" | "style" | "hitSlop" | "onLayout" | "pointerEvents" | "removeClippedSubviews" | "testID" | "nativeID" | "collapsable" | "needsOffscreenAlphaCompositing" | "renderToHardwareTextureAndroid" | "focusable" | "shouldRasterizeIOS" | "isTVSelectable" | "hasTVPreferredFocus" | "tvParallaxProperties" | "tvParallaxShiftDistanceX" | "tvParallaxShiftDistanceY" | "tvParallaxTiltAngle" | "tvParallaxMagnification" | "onStartShouldSetResponder" | "onMoveShouldSetResponder" | "onResponderEnd" | "onResponderGrant" | "onResponderReject" | "onResponderMove" | "onResponderRelease" | "onResponderStart" | "onResponderTerminationRequest" | "onResponderTerminate" | "onStartShouldSetResponderCapture" | "onMoveShouldSetResponderCapture" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "onTouchCancel" | "onTouchEndCapture" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "accessibilityRole" | "accessibilityState" | "accessibilityHint" | "accessibilityValue" | "onAccessibilityAction" | "accessibilityLiveRegion" | "importantForAccessibility" | "accessibilityElementsHidden" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors" | "indicatorStyle" | "animatedProps" | "layout" | "entering" | "exiting" | "data" | "contentOffset" | "ItemSeparatorComponent" | "ListEmptyComponent" | "ListFooterComponent" | "ListFooterComponentStyle" | "ListHeaderComponent" | "ListHeaderComponentStyle" | "keyboardShouldPersistTaps" | "extraData" | "getItemLayout" | "horizontal" | "initialNumToRender" | "initialScrollIndex" | "keyExtractor" | "legacyImplementation" | "onEndReached" | "onEndReachedThreshold" | "onRefresh" | "onViewableItemsChanged" | "refreshing" | "renderItem" | "viewabilityConfig" | "fadingEdgeLength" | "debug" | "disableVirtualization" | "getItem" | "getItemCount" | "inverted" | "listKey" | "maxToRenderPerBatch" | "onScrollToIndexFailed" | "progressViewOffset" | "renderScrollComponent" | "updateCellsBatchingPeriod" | "viewabilityConfigCallbackPairs" | "windowSize" | "CellRendererComponent" | "contentContainerStyle" | "invertStickyHeaders" | "keyboardDismissMode" | "onContentSizeChange" | "onScroll" | "onScrollBeginDrag" | "onScrollEndDrag" | "onMomentumScrollEnd" | "onMomentumScrollBegin" | "pagingEnabled" | "scrollEnabled" | "showsHorizontalScrollIndicator" | "showsVerticalScrollIndicator" | "stickyHeaderHiddenOnScroll" | "refreshControl" | "snapToInterval" | "snapToOffsets" | "snapToStart" | "snapToEnd" | "stickyHeaderIndices" | "disableIntervalMomentum" | "disableScrollViewPanResponder" | "StickyHeaderComponent" | "alwaysBounceHorizontal" | "alwaysBounceVertical" | "automaticallyAdjustContentInsets" | "automaticallyAdjustKeyboardInsets" | "automaticallyAdjustsScrollIndicatorInsets" | "bounces" | "bouncesZoom" | "canCancelContentTouches" | "centerContent" | "contentInset" | "contentInsetAdjustmentBehavior" | "directionalLockEnabled" | "maintainVisibleContentPosition" | "maximumZoomScale" | "minimumZoomScale" | "onScrollAnimationEnd" | "pinchGestureEnabled" | "scrollIndicatorInsets" | "scrollToOverflowEnabled" | "scrollsToTop" | "snapToAlignment" | "onScrollToTop" | "zoomScale" | "endFillColor" | "scrollPerfTag" | "overScrollMode" | "nestedScrollEnabled" | "persistentScrollbar" | "SectionSeparatorComponent" | "renderSectionHeader" | "renderSectionFooter" | "sections" | "stickySectionHeadersEnabled" | keyof import("./types").BottomSheetScrollableProps> & import("react").RefAttributes>>; -declare const _default: (props: BottomSheetSectionListProps) => ReturnType; -export default _default; diff --git a/lib/typescript/components/bottomSheetScrollable/BottomSheetVirtualizedList.d.ts b/lib/typescript/components/bottomSheetScrollable/BottomSheetVirtualizedList.d.ts deleted file mode 100644 index 56cf93803..000000000 --- a/lib/typescript/components/bottomSheetScrollable/BottomSheetVirtualizedList.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -/// -import type { BottomSheetVirtualizedListMethods, BottomSheetVirtualizedListProps } from './types'; -declare const BottomSheetVirtualizedList: import("react").MemoExoticComponent, "children" | "style" | "hitSlop" | "onLayout" | "pointerEvents" | "removeClippedSubviews" | "testID" | "nativeID" | "collapsable" | "needsOffscreenAlphaCompositing" | "renderToHardwareTextureAndroid" | "focusable" | "shouldRasterizeIOS" | "isTVSelectable" | "hasTVPreferredFocus" | "tvParallaxProperties" | "tvParallaxShiftDistanceX" | "tvParallaxShiftDistanceY" | "tvParallaxTiltAngle" | "tvParallaxMagnification" | "onStartShouldSetResponder" | "onMoveShouldSetResponder" | "onResponderEnd" | "onResponderGrant" | "onResponderReject" | "onResponderMove" | "onResponderRelease" | "onResponderStart" | "onResponderTerminationRequest" | "onResponderTerminate" | "onStartShouldSetResponderCapture" | "onMoveShouldSetResponderCapture" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "onTouchCancel" | "onTouchEndCapture" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "accessibilityRole" | "accessibilityState" | "accessibilityHint" | "accessibilityValue" | "onAccessibilityAction" | "accessibilityLiveRegion" | "importantForAccessibility" | "accessibilityElementsHidden" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors" | "indicatorStyle" | "animatedProps" | "layout" | "entering" | "exiting" | "data" | "contentOffset" | "ListEmptyComponent" | "ListFooterComponent" | "ListHeaderComponent" | "keyboardShouldPersistTaps" | "extraData" | "getItemLayout" | "horizontal" | "initialNumToRender" | "initialScrollIndex" | "keyExtractor" | "onEndReached" | "onEndReachedThreshold" | "onRefresh" | "onViewableItemsChanged" | "refreshing" | "renderItem" | "viewabilityConfig" | "fadingEdgeLength" | "debug" | "disableVirtualization" | "getItem" | "getItemCount" | "inverted" | "listKey" | "maxToRenderPerBatch" | "onScrollToIndexFailed" | "progressViewOffset" | "renderScrollComponent" | "updateCellsBatchingPeriod" | "viewabilityConfigCallbackPairs" | "windowSize" | "CellRendererComponent" | "contentContainerStyle" | "invertStickyHeaders" | "keyboardDismissMode" | "onContentSizeChange" | "onScroll" | "onScrollBeginDrag" | "onScrollEndDrag" | "onMomentumScrollEnd" | "onMomentumScrollBegin" | "pagingEnabled" | "scrollEnabled" | "showsHorizontalScrollIndicator" | "showsVerticalScrollIndicator" | "stickyHeaderHiddenOnScroll" | "refreshControl" | "snapToInterval" | "snapToOffsets" | "snapToStart" | "snapToEnd" | "stickyHeaderIndices" | "disableIntervalMomentum" | "disableScrollViewPanResponder" | "StickyHeaderComponent" | "alwaysBounceHorizontal" | "alwaysBounceVertical" | "automaticallyAdjustContentInsets" | "automaticallyAdjustKeyboardInsets" | "automaticallyAdjustsScrollIndicatorInsets" | "bounces" | "bouncesZoom" | "canCancelContentTouches" | "centerContent" | "contentInset" | "contentInsetAdjustmentBehavior" | "directionalLockEnabled" | "maintainVisibleContentPosition" | "maximumZoomScale" | "minimumZoomScale" | "onScrollAnimationEnd" | "pinchGestureEnabled" | "scrollIndicatorInsets" | "scrollToOverflowEnabled" | "scrollsToTop" | "snapToAlignment" | "onScrollToTop" | "zoomScale" | "endFillColor" | "scrollPerfTag" | "overScrollMode" | "nestedScrollEnabled" | "persistentScrollbar" | keyof import("./types").BottomSheetScrollableProps> & import("react").RefAttributes>>; -declare const _default: (props: BottomSheetVirtualizedListProps) => ReturnType; -export default _default; diff --git a/lib/typescript/components/bottomSheetScrollable/createBottomSheetScrollableComponent.d.ts b/lib/typescript/components/bottomSheetScrollable/createBottomSheetScrollableComponent.d.ts deleted file mode 100644 index 7fdd0895b..000000000 --- a/lib/typescript/components/bottomSheetScrollable/createBottomSheetScrollableComponent.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import React from 'react'; -import { SCROLLABLE_TYPE } from '../../constants'; -export declare function createBottomSheetScrollableComponent(type: SCROLLABLE_TYPE, ScrollableComponent: any): React.ForwardRefExoticComponent & React.RefAttributes>; diff --git a/lib/typescript/components/bottomSheetScrollable/index.d.ts b/lib/typescript/components/bottomSheetScrollable/index.d.ts deleted file mode 100644 index 87f61734e..000000000 --- a/lib/typescript/components/bottomSheetScrollable/index.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export { createBottomSheetScrollableComponent } from './createBottomSheetScrollableComponent'; -export { default as BottomSheetSectionList } from './BottomSheetSectionList'; -export { default as BottomSheetFlatList } from './BottomSheetFlatList'; -export { default as BottomSheetScrollView } from './BottomSheetScrollView'; -export { default as BottomSheetVirtualizedList } from './BottomSheetVirtualizedList'; -export type { BottomSheetFlatListMethods, BottomSheetScrollViewMethods, BottomSheetSectionListMethods, BottomSheetVirtualizedListMethods, BottomSheetScrollableProps, } from './types'; diff --git a/lib/typescript/components/bottomSheetScrollable/styles.d.ts b/lib/typescript/components/bottomSheetScrollable/styles.d.ts deleted file mode 100644 index efb2494d9..000000000 --- a/lib/typescript/components/bottomSheetScrollable/styles.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare const styles: { - container: { - flex: number; - overflow: "visible"; - }; -}; diff --git a/lib/typescript/components/bottomSheetScrollable/types.d.ts b/lib/typescript/components/bottomSheetScrollable/types.d.ts deleted file mode 100644 index f5763681c..000000000 --- a/lib/typescript/components/bottomSheetScrollable/types.d.ts +++ /dev/null @@ -1,276 +0,0 @@ -import type { - DependencyList, - EffectCallback, - ReactNode, - Ref, - RefObject, -} from 'react'; -import type { - VirtualizedListProps, - ScrollViewProps, - FlatListProps, - SectionListProps, - SectionListScrollParams, - View, - ScrollViewComponent, - NodeHandle, - ScrollResponderMixin, -} from 'react-native'; -import type Animated from 'react-native-reanimated'; -import type { ScrollEventsHandlersHookType } from '../../types'; - -export interface BottomSheetScrollableProps { - /** - * Adjust the scrollable bottom margin to avoid the animated footer. - * - * @type boolean - * @default false - */ - enableFooterMarginAdjustment?: boolean; - - /** - * This needed when bottom sheet used with multiple scrollables to allow bottom sheet - * detect the current scrollable ref, especially when used with `React Navigation`. - * You will need to provide `useFocusEffect` from `@react-navigation/native`. - * - * @type (effect: EffectCallback, deps?: DependencyList) => void - * @default useEffect - */ - focusHook?: (effect: EffectCallback, deps?: DependencyList) => void; - - /** - * Custom hook to provide scroll events handler, which will allow advance and - * customize handling for scrollables. - * - * @warning this is an experimental feature and the hook signature can change without a major version bump. - * @type ScrollEventsHandlersHookType - * @default useScrollEventsHandlersDefault - */ - scrollEventsHandlersHook?: ScrollEventsHandlersHookType; -} - -export type ScrollableProps = - | ScrollViewProps - | FlatListProps - | SectionListProps; - -//#region FlatList -export type BottomSheetFlatListProps = Omit< - Animated.AnimateProps>, - 'decelerationRate' | 'onScroll' | 'scrollEventThrottle' -> & - BottomSheetScrollableProps & { - ref?: Ref; - }; - -export interface BottomSheetFlatListMethods { - /** - * Scrolls to the end of the content. May be janky without `getItemLayout` prop. - */ - scrollToEnd: (params?: { animated?: boolean | null }) => void; - - /** - * Scrolls to the item at the specified index such that it is positioned in the viewable area - * such that viewPosition 0 places it at the top, 1 at the bottom, and 0.5 centered in the middle. - * Cannot scroll to locations outside the render window without specifying the getItemLayout prop. - */ - scrollToIndex: (params: { - animated?: boolean | null; - index: number; - viewOffset?: number; - viewPosition?: number; - }) => void; - - /** - * Requires linear scan through data - use `scrollToIndex` instead if possible. - * May be janky without `getItemLayout` prop. - */ - scrollToItem: (params: { - animated?: boolean | null; - item: any; - viewPosition?: number; - }) => void; - - /** - * Scroll to a specific content pixel offset, like a normal `ScrollView`. - */ - scrollToOffset: (params: { - animated?: boolean | null; - offset: number; - }) => void; - - /** - * Tells the list an interaction has occured, which should trigger viewability calculations, - * e.g. if waitForInteractions is true and the user has not scrolled. This is typically called - * by taps on items or by navigation actions. - */ - recordInteraction: () => void; - - /** - * Displays the scroll indicators momentarily. - */ - flashScrollIndicators: () => void; - - /** - * Provides a handle to the underlying scroll responder. - */ - getScrollResponder: () => ScrollResponderMixin | null | undefined; - - /** - * Provides a reference to the underlying host component - */ - getNativeScrollRef: () => - | RefObject - | RefObject - | null - | undefined; - - getScrollableNode: () => any; - - // TODO: use `unknown` instead of `any` for Typescript >= 3.0 - setNativeProps: (props: { [key: string]: any }) => void; -} -//#endregion - -//#region ScrollView -export type BottomSheetScrollViewProps = Omit< - Animated.AnimateProps, - 'decelerationRate' | 'scrollEventThrottle' -> & - BottomSheetScrollableProps & { - ref?: Ref; - children: ReactNode | ReactNode[]; - }; - -export interface BottomSheetScrollViewMethods { - /** - * Scrolls to a given x, y offset, either immediately or with a smooth animation. - * Syntax: - * - * scrollTo(options: {x: number = 0; y: number = 0; animated: boolean = true}) - * - * Note: The weird argument signature is due to the fact that, for historical reasons, - * the function also accepts separate arguments as an alternative to the options object. - * This is deprecated due to ambiguity (y before x), and SHOULD NOT BE USED. - */ - scrollTo( - y?: number | { x?: number; y?: number; animated?: boolean }, - x?: number, - animated?: boolean - ): void; - - /** - * A helper function that scrolls to the end of the scrollview; - * If this is a vertical ScrollView, it scrolls to the bottom. - * If this is a horizontal ScrollView scrolls to the right. - * - * The options object has an animated prop, that enables the scrolling animation or not. - * The animated prop defaults to true - */ - scrollToEnd(options?: { animated: boolean }): void; - - /** - * Returns a reference to the underlying scroll responder, which supports - * operations like `scrollTo`. All ScrollView-like components should - * implement this method so that they can be composed while providing access - * to the underlying scroll responder's methods. - */ - getScrollResponder(): ScrollResponderMixin; - - getScrollableNode(): any; - - // Undocumented - getInnerViewNode(): any; - - /** - * @deprecated Use scrollTo instead - */ - scrollWithoutAnimationTo?: (y: number, x: number) => void; - - /** - * This function sends props straight to native. They will not participate in - * future diff process - this means that if you do not include them in the - * next render, they will remain active (see [Direct - * Manipulation](https://reactnative.dev/docs/direct-manipulation)). - */ - setNativeProps(nativeProps: object): void; -} -//#endregion - -//#region SectionList -type BottomSheetSectionListProps = Omit< - Animated.AnimateProps>, - 'decelerationRate' | 'scrollEventThrottle' -> & - BottomSheetScrollableProps & { - ref?: Ref; - }; - -export interface BottomSheetSectionListMethods { - /** - * Scrolls to the item at the specified sectionIndex and itemIndex (within the section) - * positioned in the viewable area such that viewPosition 0 places it at the top - * (and may be covered by a sticky header), 1 at the bottom, and 0.5 centered in the middle. - */ - scrollToLocation(params: SectionListScrollParams): void; - - /** - * Tells the list an interaction has occurred, which should trigger viewability calculations, e.g. - * if `waitForInteractions` is true and the user has not scrolled. This is typically called by - * taps on items or by navigation actions. - */ - recordInteraction(): void; - - /** - * Displays the scroll indicators momentarily. - * - * @platform ios - */ - flashScrollIndicators(): void; - - /** - * Provides a handle to the underlying scroll responder. - */ - getScrollResponder(): ScrollResponderMixin | undefined; - - /** - * Provides a handle to the underlying scroll node. - */ - getScrollableNode(): NodeHandle | undefined; -} -//#endregion - -//#region -export type BottomSheetVirtualizedListProps = Omit< - Animated.AnimateProps>, - 'decelerationRate' | 'scrollEventThrottle' -> & - BottomSheetScrollableProps & { - ref?: Ref; - }; - -export interface BottomSheetVirtualizedListMethods { - scrollToEnd: (params?: { animated?: boolean }) => void; - scrollToIndex: (params: { - animated?: boolean; - index: number; - viewOffset?: number; - viewPosition?: number; - }) => void; - scrollToItem: (params: { - animated?: boolean; - item: any; - viewPosition?: number; - }) => void; - - /** - * Scroll to a specific content pixel offset in the list. - * Param `offset` expects the offset to scroll to. In case of horizontal is true, the - * offset is the x-value, in any other case the offset is the y-value. - * Param `animated` (true by default) defines whether the list should do an animation while scrolling. - */ - scrollToOffset: (params: { animated?: boolean; offset: number }) => void; - - recordInteraction: () => void; -} -//#endregion diff --git a/lib/typescript/components/bottomSheetTextInput/BottomSheetTextInput.d.ts b/lib/typescript/components/bottomSheetTextInput/BottomSheetTextInput.d.ts deleted file mode 100644 index 121b45f56..000000000 --- a/lib/typescript/components/bottomSheetTextInput/BottomSheetTextInput.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import React from 'react'; -import type { BottomSheetTextInputProps } from './types'; -declare const BottomSheetTextInput: React.MemoExoticComponent>>>>>; -export default BottomSheetTextInput; diff --git a/lib/typescript/components/bottomSheetTextInput/index.d.ts b/lib/typescript/components/bottomSheetTextInput/index.d.ts deleted file mode 100644 index fc7fc37ee..000000000 --- a/lib/typescript/components/bottomSheetTextInput/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './BottomSheetTextInput'; -export type { BottomSheetTextInputProps } from './types'; diff --git a/lib/typescript/components/bottomSheetTextInput/types.d.ts b/lib/typescript/components/bottomSheetTextInput/types.d.ts deleted file mode 100644 index fcc75c4ea..000000000 --- a/lib/typescript/components/bottomSheetTextInput/types.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { TextInputProps } from 'react-native'; -export interface BottomSheetTextInputProps extends TextInputProps { -} diff --git a/lib/typescript/components/bottomSheetView/BottomSheetView.d.ts b/lib/typescript/components/bottomSheetView/BottomSheetView.d.ts deleted file mode 100644 index d600ce5d9..000000000 --- a/lib/typescript/components/bottomSheetView/BottomSheetView.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import React from 'react'; -import type { BottomSheetViewProps } from './types'; -declare function BottomSheetViewComponent({ focusHook: useFocusHook, enableFooterMarginAdjustment, onLayout, style, children, ...rest }: BottomSheetViewProps): JSX.Element; -declare const BottomSheetView: React.MemoExoticComponent; -export default BottomSheetView; diff --git a/lib/typescript/components/bottomSheetView/index.d.ts b/lib/typescript/components/bottomSheetView/index.d.ts deleted file mode 100644 index 0cbb27a09..000000000 --- a/lib/typescript/components/bottomSheetView/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './BottomSheetView'; diff --git a/lib/typescript/components/bottomSheetView/styles.d.ts b/lib/typescript/components/bottomSheetView/styles.d.ts deleted file mode 100644 index 49983eda3..000000000 --- a/lib/typescript/components/bottomSheetView/styles.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export declare const styles: { - container: {}; -}; diff --git a/lib/typescript/components/bottomSheetView/types.d.ts b/lib/typescript/components/bottomSheetView/types.d.ts deleted file mode 100644 index 989a8f0f9..000000000 --- a/lib/typescript/components/bottomSheetView/types.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -import type { EffectCallback, DependencyList, ReactNode } from 'react'; -import type { ViewProps as RNViewProps } from 'react-native'; - -export interface BottomSheetViewProps extends RNViewProps { - /** - * Adjust the scrollable bottom margin to avoid the animated footer. - * - * @type boolean - * @default false - */ - enableFooterMarginAdjustment?: boolean; - - /** - * This needed when bottom sheet used with multiple scrollables to allow bottom sheet - * detect the current scrollable ref, especially when used with `React Navigation`. - * You will need to provide `useFocusEffect` from `@react-navigation/native`. - * - * @type (effect: EffectCallback, deps?: DependencyList) => void - * @default useEffect - */ - focusHook?: (effect: EffectCallback, deps?: DependencyList) => void; - - children: ReactNode[] | ReactNode; -} diff --git a/lib/typescript/components/touchables/Touchables.d.ts b/lib/typescript/components/touchables/Touchables.d.ts deleted file mode 100644 index 67b0085d0..000000000 --- a/lib/typescript/components/touchables/Touchables.d.ts +++ /dev/null @@ -1 +0,0 @@ -export { TouchableOpacity, TouchableHighlight, TouchableWithoutFeedback, } from 'react-native-gesture-handler'; diff --git a/lib/typescript/components/touchables/Touchables.ios.d.ts b/lib/typescript/components/touchables/Touchables.ios.d.ts deleted file mode 100644 index 76a6869c3..000000000 --- a/lib/typescript/components/touchables/Touchables.ios.d.ts +++ /dev/null @@ -1 +0,0 @@ -export { TouchableOpacity, TouchableHighlight, TouchableWithoutFeedback, } from 'react-native'; diff --git a/lib/typescript/components/touchables/index.d.ts b/lib/typescript/components/touchables/index.d.ts deleted file mode 100644 index 6b1384d78..000000000 --- a/lib/typescript/components/touchables/index.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { TouchableOpacity as RNTouchableOpacity, TouchableHighlight as RNTouchableHighlight, TouchableWithoutFeedback as RNTouchableWithoutFeedback } from 'react-native'; -declare const _default: { - TouchableOpacity: typeof RNTouchableOpacity; - TouchableHighlight: typeof RNTouchableHighlight; - TouchableWithoutFeedback: typeof RNTouchableWithoutFeedback; -}; -export default _default; diff --git a/lib/typescript/constants.d.ts b/lib/typescript/constants.d.ts deleted file mode 100644 index 49d4b6ac6..000000000 --- a/lib/typescript/constants.d.ts +++ /dev/null @@ -1,90 +0,0 @@ -import Animated from 'react-native-reanimated'; -declare const WINDOW_HEIGHT: number, WINDOW_WIDTH: number; -declare const SCREEN_HEIGHT: number, SCREEN_WIDTH: number; -declare enum GESTURE_SOURCE { - UNDETERMINED = 0, - SCROLLABLE = 1, - HANDLE = 2, - CONTENT = 3 -} -declare enum SHEET_STATE { - CLOSED = 0, - OPENED = 1, - EXTENDED = 2, - OVER_EXTENDED = 3, - FILL_PARENT = 4 -} -declare enum SCROLLABLE_STATE { - LOCKED = 0, - UNLOCKED = 1, - UNDETERMINED = 2 -} -declare enum SCROLLABLE_TYPE { - UNDETERMINED = 0, - VIEW = 1, - FLATLIST = 2, - SCROLLVIEW = 3, - SECTIONLIST = 4, - VIRTUALIZEDLIST = 5 -} -declare enum ANIMATION_STATE { - UNDETERMINED = 0, - RUNNING = 1, - STOPPED = 2, - INTERRUPTED = 3 -} -declare enum ANIMATION_SOURCE { - NONE = 0, - MOUNT = 1, - GESTURE = 2, - USER = 3, - CONTAINER_RESIZE = 4, - SNAP_POINT_CHANGE = 5, - KEYBOARD = 6 -} -declare enum ANIMATION_METHOD { - TIMING = 0, - SPRING = 1 -} -declare enum KEYBOARD_STATE { - UNDETERMINED = 0, - SHOWN = 1, - HIDDEN = 2 -} -declare const ANIMATION_EASING: Animated.EasingFunction; -declare const ANIMATION_DURATION = 250; -declare const ANIMATION_CONFIGS: { - damping: number; - stiffness: number; - mass: number; - overshootClamping: boolean; - restDisplacementThreshold: number; - restSpeedThreshold: number; -} | { - duration: number; - easing: Animated.EasingFunction; -}; -declare const SCROLLABLE_DECELERATION_RATE_MAPPER: { - 2: number; - 0: number; - 1: number; -}; -declare const MODAL_STACK_BEHAVIOR: { - replace: string; - push: string; -}; -declare const KEYBOARD_BEHAVIOR: { - readonly interactive: "interactive"; - readonly extend: "extend"; - readonly fillParent: "fillParent"; -}; -declare const KEYBOARD_BLUR_BEHAVIOR: { - readonly none: "none"; - readonly restore: "restore"; -}; -declare const KEYBOARD_INPUT_MODE: { - readonly adjustPan: "adjustPan"; - readonly adjustResize: "adjustResize"; -}; -declare const KEYBOARD_DISMISS_THRESHOLD = 12.5; -export { GESTURE_SOURCE, SHEET_STATE, ANIMATION_STATE, ANIMATION_METHOD, ANIMATION_SOURCE, SCROLLABLE_TYPE, SCROLLABLE_STATE, KEYBOARD_STATE, WINDOW_HEIGHT, WINDOW_WIDTH, SCREEN_HEIGHT, SCREEN_WIDTH, SCROLLABLE_DECELERATION_RATE_MAPPER, MODAL_STACK_BEHAVIOR, KEYBOARD_BEHAVIOR, KEYBOARD_BLUR_BEHAVIOR, KEYBOARD_INPUT_MODE, KEYBOARD_DISMISS_THRESHOLD, ANIMATION_CONFIGS, ANIMATION_EASING, ANIMATION_DURATION, }; diff --git a/lib/typescript/contexts/external.d.ts b/lib/typescript/contexts/external.d.ts deleted file mode 100644 index 1677edad9..000000000 --- a/lib/typescript/contexts/external.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -/// -import type { BottomSheetMethods, BottomSheetVariables } from '../types'; -export declare const BottomSheetContext: import("react").Context<(BottomSheetMethods & BottomSheetVariables) | null>; -export declare const BottomSheetProvider: import("react").Provider<(BottomSheetMethods & BottomSheetVariables) | null>; diff --git a/lib/typescript/contexts/gesture.d.ts b/lib/typescript/contexts/gesture.d.ts deleted file mode 100644 index d6abb440b..000000000 --- a/lib/typescript/contexts/gesture.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/// -import type { PanGestureHandlerGestureEvent } from 'react-native-gesture-handler'; -export interface BottomSheetGestureHandlersContextType { - contentPanGestureHandler: (event: PanGestureHandlerGestureEvent) => void; - handlePanGestureHandler: (event: PanGestureHandlerGestureEvent) => void; - scrollablePanGestureHandler: (event: PanGestureHandlerGestureEvent) => void; -} -export declare const BottomSheetGestureHandlersContext: import("react").Context; diff --git a/lib/typescript/contexts/index.d.ts b/lib/typescript/contexts/index.d.ts deleted file mode 100644 index 99e74deee..000000000 --- a/lib/typescript/contexts/index.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export { BottomSheetContext, BottomSheetProvider } from './external'; -export { BottomSheetInternalContext, BottomSheetInternalProvider, } from './internal'; -export { BottomSheetGestureHandlersContext } from './gesture'; -export { BottomSheetModalContext, BottomSheetModalProvider, } from './modal/external'; -export { BottomSheetModalInternalContext, BottomSheetModalInternalProvider, } from './modal/internal'; -export type { BottomSheetModalInternalContextType } from './modal/internal'; diff --git a/lib/typescript/contexts/internal.d.ts b/lib/typescript/contexts/internal.d.ts deleted file mode 100644 index 0ef41a63a..000000000 --- a/lib/typescript/contexts/internal.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { RefObject } from 'react'; -import type { PanGestureHandlerProps, State } from 'react-native-gesture-handler'; -import type Animated from 'react-native-reanimated'; -import type { AnimateToPositionType, BottomSheetProps } from '../components/bottomSheet/types'; -import type { ANIMATION_STATE, KEYBOARD_STATE, SCROLLABLE_STATE, SCROLLABLE_TYPE, SHEET_STATE } from '../constants'; -import type { Scrollable, ScrollableRef } from '../types'; -export interface BottomSheetInternalContextType extends Pick, Required> { - animatedAnimationState: Animated.SharedValue; - animatedSheetState: Animated.SharedValue; - animatedScrollableState: Animated.SharedValue; - animatedKeyboardState: Animated.SharedValue; - animatedContentGestureState: Animated.SharedValue; - animatedHandleGestureState: Animated.SharedValue; - animatedSnapPoints: Animated.SharedValue; - animatedPosition: Animated.SharedValue; - animatedIndex: Animated.SharedValue; - animatedContainerHeight: Animated.SharedValue; - animatedContentHeight: Animated.SharedValue; - animatedHighestSnapPoint: Animated.SharedValue; - animatedClosedPosition: Animated.SharedValue; - animatedFooterHeight: Animated.SharedValue; - animatedHandleHeight: Animated.SharedValue; - animatedKeyboardHeight: Animated.SharedValue; - animatedKeyboardHeightInContainer: Animated.SharedValue; - animatedScrollableType: Animated.SharedValue; - animatedScrollableContentOffsetY: Animated.SharedValue; - animatedScrollableOverrideState: Animated.SharedValue; - isScrollableRefreshable: Animated.SharedValue; - isContentHeightFixed: Animated.SharedValue; - isInTemporaryPosition: Animated.SharedValue; - shouldHandleKeyboardEvents: Animated.SharedValue; - stopAnimation: () => void; - animateToPosition: AnimateToPositionType; - setScrollableRef: (ref: ScrollableRef) => void; - removeScrollableRef: (ref: RefObject) => void; -} -export declare const BottomSheetInternalContext: import("react").Context; -export declare const BottomSheetInternalProvider: import("react").Provider; diff --git a/lib/typescript/contexts/modal/external.d.ts b/lib/typescript/contexts/modal/external.d.ts deleted file mode 100644 index ac9f1a620..000000000 --- a/lib/typescript/contexts/modal/external.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/// -export interface BottomSheetModalContextType { - dismiss: (key?: string) => boolean; - dismissAll: () => void; -} -export declare const BottomSheetModalContext: import("react").Context; -export declare const BottomSheetModalProvider: import("react").Provider; diff --git a/lib/typescript/contexts/modal/internal.d.ts b/lib/typescript/contexts/modal/internal.d.ts deleted file mode 100644 index 7efa216fe..000000000 --- a/lib/typescript/contexts/modal/internal.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Ref } from 'react'; -import type { Insets } from 'react-native'; -import type Animated from 'react-native-reanimated'; -import type BottomSheet from '../../components/bottomSheet'; -import type { BottomSheetModalStackBehavior } from '../../components/bottomSheetModal'; -export interface BottomSheetModalInternalContextType { - containerHeight: Animated.SharedValue; - containerOffset: Animated.SharedValue>; - mountSheet: (key: string, ref: Ref, stackBehavior: BottomSheetModalStackBehavior) => void; - unmountSheet: (key: string) => void; - willUnmountSheet: (key: string) => void; -} -export declare const BottomSheetModalInternalContext: import("react").Context; -export declare const BottomSheetModalInternalProvider: import("react").Provider; diff --git a/lib/typescript/hooks/index.d.ts b/lib/typescript/hooks/index.d.ts deleted file mode 100644 index e26873f68..000000000 --- a/lib/typescript/hooks/index.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -export { useBottomSheet } from './useBottomSheet'; -export { useBottomSheetInternal } from './useBottomSheetInternal'; -export { useBottomSheetModal } from './useBottomSheetModal'; -export { useBottomSheetModalInternal } from './useBottomSheetModalInternal'; -export { useScrollable } from './useScrollable'; -export { useScrollableSetter } from './useScrollableSetter'; -export { useScrollHandler } from './useScrollHandler'; -export { useGestureHandler } from './useGestureHandler'; -export { useGestureEventsHandlersDefault } from './useGestureEventsHandlersDefault'; -export { useKeyboard } from './useKeyboard'; -export { useStableCallback } from './useStableCallback'; -export { usePropsValidator } from './usePropsValidator'; -export { useNormalizedSnapPoints } from './useNormalizedSnapPoints'; -export { useReactiveSharedValue } from './useReactiveSharedValue'; -export { useBottomSheetDynamicSnapPoints } from './useBottomSheetDynamicSnapPoints'; -export { useBottomSheetGestureHandlers } from './useBottomSheetGestureHandlers'; diff --git a/lib/typescript/hooks/useBottomSheet.d.ts b/lib/typescript/hooks/useBottomSheet.d.ts deleted file mode 100644 index 8f657033e..000000000 --- a/lib/typescript/hooks/useBottomSheet.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare const useBottomSheet: () => import("../types").BottomSheetMethods & import("../types").BottomSheetVariables; diff --git a/lib/typescript/hooks/useBottomSheetDynamicSnapPoints.d.ts b/lib/typescript/hooks/useBottomSheetDynamicSnapPoints.d.ts deleted file mode 100644 index 36db692d0..000000000 --- a/lib/typescript/hooks/useBottomSheetDynamicSnapPoints.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -/// -/** - * Provides dynamic content height calculating functionalities, by - * replacing the placeholder `CONTENT_HEIGHT` with calculated layout. - * @example - * [0, 'CONTENT_HEIGHT', '100%'] - * @param initialSnapPoints your snap point with content height placeholder. - * @returns { - * - animatedSnapPoints: an animated snap points to be set on `BottomSheet` or `BottomSheetModal`. - * - animatedHandleHeight: an animated handle height callback node to be set on `BottomSheet` or `BottomSheetModal`. - * - animatedContentHeight: an animated content height callback node to be set on `BottomSheet` or `BottomSheetModal`. - * - handleContentLayout: a `onLayout` callback method to be set on `BottomSheetView` component. - * } - * @deprecated will be deprecated in the next major release! please use the new introduce prop `enableDynamicSizing`. - */ -export declare const useBottomSheetDynamicSnapPoints: (initialSnapPoints: Array) => { - animatedSnapPoints: Readonly<{ - value: (string | number)[]; - }>; - animatedHandleHeight: import("react-native-reanimated").SharedValue; - animatedContentHeight: import("react-native-reanimated").SharedValue; - handleContentLayout: ({ nativeEvent: { layout: { height }, }, }: { - nativeEvent: { - layout: { - height: number; - }; - }; - }) => void; -}; diff --git a/lib/typescript/hooks/useBottomSheetGestureHandlers.d.ts b/lib/typescript/hooks/useBottomSheetGestureHandlers.d.ts deleted file mode 100644 index 3e101b681..000000000 --- a/lib/typescript/hooks/useBottomSheetGestureHandlers.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare const useBottomSheetGestureHandlers: () => import("../contexts/gesture").BottomSheetGestureHandlersContextType; diff --git a/lib/typescript/hooks/useBottomSheetInternal.d.ts b/lib/typescript/hooks/useBottomSheetInternal.d.ts deleted file mode 100644 index b0f278645..000000000 --- a/lib/typescript/hooks/useBottomSheetInternal.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { BottomSheetInternalContextType } from '../contexts/internal'; -export declare function useBottomSheetInternal(unsafe?: false): BottomSheetInternalContextType; -export declare function useBottomSheetInternal(unsafe: true): BottomSheetInternalContextType | null; diff --git a/lib/typescript/hooks/useBottomSheetModal.d.ts b/lib/typescript/hooks/useBottomSheetModal.d.ts deleted file mode 100644 index 25ddcfd2e..000000000 --- a/lib/typescript/hooks/useBottomSheetModal.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare const useBottomSheetModal: () => import("../contexts/modal/external").BottomSheetModalContextType; diff --git a/lib/typescript/hooks/useBottomSheetModalInternal.d.ts b/lib/typescript/hooks/useBottomSheetModalInternal.d.ts deleted file mode 100644 index fc6511e91..000000000 --- a/lib/typescript/hooks/useBottomSheetModalInternal.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { BottomSheetModalInternalContextType } from '../contexts'; -export declare function useBottomSheetModalInternal(unsafe?: false): BottomSheetModalInternalContextType; -export declare function useBottomSheetModalInternal(unsafe: true): BottomSheetModalInternalContextType | null; diff --git a/lib/typescript/hooks/useBottomSheetSpringConfigs.d.ts b/lib/typescript/hooks/useBottomSheetSpringConfigs.d.ts deleted file mode 100644 index 4c6f55160..000000000 --- a/lib/typescript/hooks/useBottomSheetSpringConfigs.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { WithSpringConfig } from 'react-native-reanimated'; -/** - * Generate spring animation configs. - * @param configs overridable configs. - */ -export declare const useBottomSheetSpringConfigs: (configs: Omit) => Omit; diff --git a/lib/typescript/hooks/useBottomSheetTimingConfigs.d.ts b/lib/typescript/hooks/useBottomSheetTimingConfigs.d.ts deleted file mode 100644 index 0a4a2bff5..000000000 --- a/lib/typescript/hooks/useBottomSheetTimingConfigs.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import type { WithTimingConfig } from 'react-native-reanimated'; -/** - * Generate timing animation configs. - * @default - * - easing: Easing.out(Easing.exp) - * - duration 250 - * @param configs overridable configs. - */ -export declare const useBottomSheetTimingConfigs: (configs: WithTimingConfig) => WithTimingConfig; diff --git a/lib/typescript/hooks/useGestureEventsHandlersDefault.d.ts b/lib/typescript/hooks/useGestureEventsHandlersDefault.d.ts deleted file mode 100644 index 86b8e7ef9..000000000 --- a/lib/typescript/hooks/useGestureEventsHandlersDefault.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import type { GestureEventsHandlersHookType } from '../types'; -export declare const useGestureEventsHandlersDefault: GestureEventsHandlersHookType; diff --git a/lib/typescript/hooks/useGestureHandler.d.ts b/lib/typescript/hooks/useGestureHandler.d.ts deleted file mode 100644 index 4139eeca6..000000000 --- a/lib/typescript/hooks/useGestureHandler.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import Animated from 'react-native-reanimated'; -import { State, PanGestureHandlerGestureEvent } from 'react-native-gesture-handler'; -import { GESTURE_SOURCE } from '../constants'; -import type { GestureEventHandlerCallbackType } from '../types'; -export declare const useGestureHandler: (type: GESTURE_SOURCE, state: Animated.SharedValue, gestureSource: Animated.SharedValue, handleOnStart: GestureEventHandlerCallbackType, handleOnActive: GestureEventHandlerCallbackType, handleOnEnd: GestureEventHandlerCallbackType) => (event: PanGestureHandlerGestureEvent) => void; diff --git a/lib/typescript/hooks/useKeyboard.d.ts b/lib/typescript/hooks/useKeyboard.d.ts deleted file mode 100644 index 0b8a7b71f..000000000 --- a/lib/typescript/hooks/useKeyboard.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/// -import { KeyboardEventEasing } from 'react-native'; -import { KEYBOARD_STATE } from '../constants'; -export declare const useKeyboard: () => { - state: import("react-native-reanimated").SharedValue; - height: import("react-native-reanimated").SharedValue; - animationEasing: import("react-native-reanimated").SharedValue; - animationDuration: import("react-native-reanimated").SharedValue; - shouldHandleKeyboardEvents: import("react-native-reanimated").SharedValue; -}; diff --git a/lib/typescript/hooks/useNormalizedSnapPoints.d.ts b/lib/typescript/hooks/useNormalizedSnapPoints.d.ts deleted file mode 100644 index a39f96d7b..000000000 --- a/lib/typescript/hooks/useNormalizedSnapPoints.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import Animated from 'react-native-reanimated'; -import type { BottomSheetProps } from '../components/bottomSheet'; -/** - * Convert percentage snap points to pixels in screen and calculate - * the accurate snap points positions. - * @param snapPoints provided snap points. - * @param containerHeight BottomSheetContainer height. - * @param contentHeight content size. - * @param handleHeight handle size. - * @param enableDynamicSizing - * @param maxDynamicContentSize - * @returns {Animated.SharedValue} - */ -export declare const useNormalizedSnapPoints: (snapPoints: BottomSheetProps['snapPoints'], containerHeight: Animated.SharedValue, contentHeight: Animated.SharedValue, handleHeight: Animated.SharedValue, enableDynamicSizing: BottomSheetProps['enableDynamicSizing'], maxDynamicContentSize: BottomSheetProps['maxDynamicContentSize']) => Readonly>; diff --git a/lib/typescript/hooks/usePropsValidator.d.ts b/lib/typescript/hooks/usePropsValidator.d.ts deleted file mode 100644 index c4c52504f..000000000 --- a/lib/typescript/hooks/usePropsValidator.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { BottomSheetProps } from '../components/bottomSheet'; -/** - * @todo - * replace this with `prop-types`. - */ -export declare const usePropsValidator: ({ index, snapPoints, enableDynamicSizing, topInset, bottomInset, }: BottomSheetProps) => void; diff --git a/lib/typescript/hooks/useReactiveSharedValue.d.ts b/lib/typescript/hooks/useReactiveSharedValue.d.ts deleted file mode 100644 index dc907a513..000000000 --- a/lib/typescript/hooks/useReactiveSharedValue.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import Animated from 'react-native-reanimated'; -import type { Primitive } from '../types'; -export declare const useReactiveSharedValue: (value: T) => T extends Primitive ? Animated.SharedValue : T; diff --git a/lib/typescript/hooks/useScrollEventsHandlersDefault.d.ts b/lib/typescript/hooks/useScrollEventsHandlersDefault.d.ts deleted file mode 100644 index 7509b0992..000000000 --- a/lib/typescript/hooks/useScrollEventsHandlersDefault.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { ScrollEventsHandlersHookType } from '../types'; -export declare type ScrollEventContextType = { - initialContentOffsetY: number; - shouldLockInitialPosition: boolean; -}; -export declare const useScrollEventsHandlersDefault: ScrollEventsHandlersHookType; diff --git a/lib/typescript/hooks/useScrollHandler.d.ts b/lib/typescript/hooks/useScrollHandler.d.ts deleted file mode 100644 index f33479f40..000000000 --- a/lib/typescript/hooks/useScrollHandler.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/// -/// -import type { Scrollable, ScrollableEvent } from '../types'; -export declare const useScrollHandler: (useScrollEventsHandlers?: import("../types").ScrollEventsHandlersHookType, onScroll?: ScrollableEvent | undefined, onScrollBeginDrag?: ScrollableEvent | undefined, onScrollEndDrag?: ScrollableEvent | undefined) => { - scrollHandler: (event: import("react-native").NativeSyntheticEvent) => void; - scrollableRef: import("react").RefObject; - scrollableContentOffsetY: import("react-native-reanimated").SharedValue; -}; diff --git a/lib/typescript/hooks/useScrollable.d.ts b/lib/typescript/hooks/useScrollable.d.ts deleted file mode 100644 index 006906f8b..000000000 --- a/lib/typescript/hooks/useScrollable.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// -import { RefObject } from 'react'; -import { SCROLLABLE_STATE, SCROLLABLE_TYPE } from '../constants'; -import type { ScrollableRef, Scrollable } from '../types'; -export declare const useScrollable: () => { - scrollableRef: RefObject; - animatedScrollableType: import("react-native-reanimated").SharedValue; - animatedScrollableContentOffsetY: import("react-native-reanimated").SharedValue; - animatedScrollableOverrideState: import("react-native-reanimated").SharedValue; - isScrollableRefreshable: import("react-native-reanimated").SharedValue; - setScrollableRef: (ref: ScrollableRef) => void; - removeScrollableRef: (ref: RefObject) => void; -}; diff --git a/lib/typescript/hooks/useScrollableSetter.d.ts b/lib/typescript/hooks/useScrollableSetter.d.ts deleted file mode 100644 index 18dabef22..000000000 --- a/lib/typescript/hooks/useScrollableSetter.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import React from 'react'; -import Animated from 'react-native-reanimated'; -import { SCROLLABLE_TYPE } from '../constants'; -import type { Scrollable } from '../types'; -export declare const useScrollableSetter: (ref: React.RefObject, type: SCROLLABLE_TYPE, contentOffsetY: Animated.SharedValue, refreshable: boolean, useFocusHook?: typeof React.useEffect) => void; diff --git a/lib/typescript/hooks/useStableCallback.d.ts b/lib/typescript/hooks/useStableCallback.d.ts deleted file mode 100644 index 92d4f1f74..000000000 --- a/lib/typescript/hooks/useStableCallback.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -declare type Callback = (...args: any[]) => any; -/** - * Provide a stable version of useCallback - * https://gist.github.com/JakeCoxon/c7ebf6e6496f8468226fd36b596e1985 - */ -export declare const useStableCallback: (callback: Callback) => (...args: any) => any; -export {}; diff --git a/lib/typescript/index.d.ts b/lib/typescript/index.d.ts deleted file mode 100644 index de0359718..000000000 --- a/lib/typescript/index.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -export { default } from './components/bottomSheet'; -export { default as BottomSheetModal } from './components/bottomSheetModal'; -export { default as BottomSheetModalProvider } from './components/bottomSheetModalProvider'; -export { useBottomSheet } from './hooks/useBottomSheet'; -export { useBottomSheetModal } from './hooks/useBottomSheetModal'; -export { useBottomSheetSpringConfigs } from './hooks/useBottomSheetSpringConfigs'; -export { useBottomSheetTimingConfigs } from './hooks/useBottomSheetTimingConfigs'; -export { useBottomSheetInternal } from './hooks/useBottomSheetInternal'; -export { useBottomSheetModalInternal } from './hooks/useBottomSheetModalInternal'; -export { useBottomSheetDynamicSnapPoints } from './hooks/useBottomSheetDynamicSnapPoints'; -export { useScrollEventsHandlersDefault } from './hooks/useScrollEventsHandlersDefault'; -export { useGestureEventsHandlersDefault } from './hooks/useGestureEventsHandlersDefault'; -export { useBottomSheetGestureHandlers } from './hooks/useBottomSheetGestureHandlers'; -export { useScrollHandler } from './hooks/useScrollHandler'; -export { useScrollableSetter } from './hooks/useScrollableSetter'; -export { BottomSheetScrollView, BottomSheetSectionList, BottomSheetFlatList, BottomSheetVirtualizedList, } from './components/bottomSheetScrollable'; -export { default as BottomSheetHandle } from './components/bottomSheetHandle'; -export { default as BottomSheetDraggableView } from './components/bottomSheetDraggableView'; -export { default as BottomSheetView } from './components/bottomSheetView'; -export { default as BottomSheetTextInput } from './components/bottomSheetTextInput'; -export { default as BottomSheetBackdrop } from './components/bottomSheetBackdrop'; -export { default as BottomSheetFooter } from './components/bottomSheetFooter'; -export { default as BottomSheetFooterContainer } from './components/bottomSheetFooterContainer/BottomSheetFooterContainer'; -export declare const TouchableHighlight: typeof import("react-native").TouchableHighlight, TouchableOpacity: typeof import("react-native").TouchableOpacity, TouchableWithoutFeedback: typeof import("react-native").TouchableWithoutFeedback; -export { createBottomSheetScrollableComponent } from './components/bottomSheetScrollable'; -export type { BottomSheetProps } from './components/bottomSheet'; -export type { BottomSheetModalProps } from './components/bottomSheetModal'; -export type { BottomSheetHandleProps } from './components/bottomSheetHandle'; -export type { BottomSheetBackgroundProps } from './components/bottomSheetBackground'; -export type { BottomSheetBackdropProps } from './components/bottomSheetBackdrop'; -export type { BottomSheetFooterProps } from './components/bottomSheetFooter'; -export type { BottomSheetFlatListMethods, BottomSheetScrollViewMethods, BottomSheetSectionListMethods, BottomSheetVirtualizedListMethods, BottomSheetScrollableProps, } from './components/bottomSheetScrollable'; -export type { ScrollEventsHandlersHookType, GestureEventsHandlersHookType, ScrollEventHandlerCallbackType, GestureEventHandlerCallbackType, } from './types'; -export * from './constants'; -export { enableLogging } from './utilities/logger'; diff --git a/lib/typescript/types.d.ts b/lib/typescript/types.d.ts deleted file mode 100644 index 803ac5097..000000000 --- a/lib/typescript/types.d.ts +++ /dev/null @@ -1,165 +0,0 @@ -import type React from 'react'; -import type { - FlatList, - ScrollView, - SectionList, - NativeScrollEvent, - NativeSyntheticEvent, -} from 'react-native'; -import type { - GestureEventPayload, - PanGestureHandlerEventPayload, -} from 'react-native-gesture-handler'; -import type { - SharedValue, - WithSpringConfig, - WithTimingConfig, -} from 'react-native-reanimated'; -import type { GESTURE_SOURCE } from './constants'; - -//#region Methods -export interface BottomSheetMethods { - /** - * Snap to one of the provided points from `snapPoints`. - * @param index snap point index. - * @param animationConfigs snap animation configs. - * - * @see {WithSpringConfig} - * @see {WithTimingConfig} - */ - snapToIndex: ( - index: number, - animationConfigs?: WithSpringConfig | WithTimingConfig - ) => void; - /** - * Snap to a position out of provided `snapPoints`. - * @param position position in pixel or percentage. - * @param animationConfigs snap animation configs. - * - * @see {WithSpringConfig} - * @see {WithTimingConfig} - */ - snapToPosition: ( - position: number | string, - animationConfigs?: WithSpringConfig | WithTimingConfig - ) => void; - /** - * Snap to the maximum provided point from `snapPoints`. - * @param animationConfigs snap animation configs. - * - * @see {WithSpringConfig} - * @see {WithTimingConfig} - */ - expand: (animationConfigs?: WithSpringConfig | WithTimingConfig) => void; - /** - * Snap to the minimum provided point from `snapPoints`. - * @param animationConfigs snap animation configs. - * - * @see {WithSpringConfig} - * @see {WithTimingConfig} - */ - collapse: (animationConfigs?: WithSpringConfig | WithTimingConfig) => void; - /** - * Close the bottom sheet. - * @param animationConfigs snap animation configs. - * - * @see {WithSpringConfig} - * @see {WithTimingConfig} - */ - close: (animationConfigs?: WithSpringConfig | WithTimingConfig) => void; - /** - * Force close the bottom sheet, this prevent any interruptions till the sheet is closed. - * @param animationConfigs snap animation configs. - * - * @see {WithSpringConfig} - * @see {WithTimingConfig} - */ - forceClose: (animationConfigs?: WithSpringConfig | WithTimingConfig) => void; -} -export interface BottomSheetModalMethods extends BottomSheetMethods { - /** - * Mount and present the bottom sheet modal to the initial snap point. - * @param data to be passed to the modal. - */ - present: (data?: any) => void; - /** - * Close and unmount the bottom sheet modal. - * @param animationConfigs snap animation configs. - * - * @see {WithSpringConfig} - * @see {WithTimingConfig} - */ - dismiss: (animationConfigs?: WithSpringConfig | WithTimingConfig) => void; -} -//#endregion - -export interface BottomSheetVariables { - /** - * Current sheet position index. - * @type SharedValue - */ - animatedIndex: SharedValue; - /** - * Current sheet position. - * @type SharedValue - */ - animatedPosition: SharedValue; -} - -//#region scrollables -export type Scrollable = FlatList | ScrollView | SectionList; -export type ScrollableRef = { - id: number; - node: React.RefObject; -}; -export type ScrollableEvent = ( - event: Pick, 'nativeEvent'> -) => void; -//#endregion - -//#region utils -export type Primitive = string | number | boolean; -export interface Insets { - top: number; - bottom: number; - left: number; - right: number; -} -//#endregion - -//#region hooks -export type GestureEventPayloadType = GestureEventPayload & - PanGestureHandlerEventPayload; - -export type GestureEventContextType = { - didStart?: boolean; -}; - -export type GestureEventHandlerCallbackType = ( - source: GESTURE_SOURCE, - payload: GestureEventPayloadType, - context: C -) => void; - -export type GestureEventsHandlersHookType = () => { - handleOnStart: GestureEventHandlerCallbackType; - handleOnActive: GestureEventHandlerCallbackType; - handleOnEnd: GestureEventHandlerCallbackType; -}; - -type ScrollEventHandlerCallbackType = ( - payload: NativeScrollEvent, - context: C -) => void; - -export type ScrollEventsHandlersHookType = ( - ref: React.RefObject, - contentOffsetY: SharedValue -) => { - handleOnScroll?: ScrollEventHandlerCallbackType; - handleOnBeginDrag?: ScrollEventHandlerCallbackType; - handleOnEndDrag?: ScrollEventHandlerCallbackType; - handleOnMomentumBegin?: ScrollEventHandlerCallbackType; - handleOnMomentumEnd?: ScrollEventHandlerCallbackType; -}; -//#endregion diff --git a/lib/typescript/utilities/animate.d.ts b/lib/typescript/utilities/animate.d.ts deleted file mode 100644 index 2657d12a9..000000000 --- a/lib/typescript/utilities/animate.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { WithSpringConfig, WithTimingConfig, AnimationCallback } from 'react-native-reanimated'; -interface AnimateParams { - point: number; - velocity?: number; - configs?: WithSpringConfig | WithTimingConfig; - onComplete?: AnimationCallback; -} -export declare const animate: ({ point, configs, velocity, onComplete, }: AnimateParams) => number; -export {}; diff --git a/lib/typescript/utilities/clamp.d.ts b/lib/typescript/utilities/clamp.d.ts deleted file mode 100644 index 23e0f07c0..000000000 --- a/lib/typescript/utilities/clamp.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare const clamp: (value: number, lowerBound: number, upperBound: number) => number; diff --git a/lib/typescript/utilities/easingExp.d.ts b/lib/typescript/utilities/easingExp.d.ts deleted file mode 100644 index 717ba69de..000000000 --- a/lib/typescript/utilities/easingExp.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * A modified version of the default AnimatedEasing.exp, - * to insure its value never goes below `0`. - * @see https://github.com/software-mansion/react-native-reanimated/issues/1610 - * @param t number - */ -export declare const exp: (t: number) => number; diff --git a/lib/typescript/utilities/getKeyboardAnimationConfigs.d.ts b/lib/typescript/utilities/getKeyboardAnimationConfigs.d.ts deleted file mode 100644 index d9fcd5454..000000000 --- a/lib/typescript/utilities/getKeyboardAnimationConfigs.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import type { KeyboardEventEasing } from 'react-native'; -export declare const getKeyboardAnimationConfigs: (easing: KeyboardEventEasing, duration: number) => { - easing: (value: number) => number; - duration: number; - damping?: undefined; - stiffness?: undefined; - mass?: undefined; - overshootClamping?: undefined; - restDisplacementThreshold?: undefined; - restSpeedThreshold?: undefined; -} | { - damping: number; - stiffness: number; - mass: number; - overshootClamping: boolean; - restDisplacementThreshold: number; - restSpeedThreshold: number; - easing?: undefined; - duration?: undefined; -}; diff --git a/lib/typescript/utilities/getRefNativeTag.d.ts b/lib/typescript/utilities/getRefNativeTag.d.ts deleted file mode 100644 index 691c489b5..000000000 --- a/lib/typescript/utilities/getRefNativeTag.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function getRefNativeTag(ref: unknown): number; diff --git a/lib/typescript/utilities/id.d.ts b/lib/typescript/utilities/id.d.ts deleted file mode 100644 index 9e9ac9216..000000000 --- a/lib/typescript/utilities/id.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare const id: () => number; diff --git a/lib/typescript/utilities/index.d.ts b/lib/typescript/utilities/index.d.ts deleted file mode 100644 index a50b4da63..000000000 --- a/lib/typescript/utilities/index.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export { normalizeSnapPoint } from './normalizeSnapPoint'; -export { animate } from './animate'; -export { getKeyboardAnimationConfigs } from './getKeyboardAnimationConfigs'; -export { print } from './logger'; -export { noop, workletNoop } from './noop'; diff --git a/lib/typescript/utilities/logger.d.ts b/lib/typescript/utilities/logger.d.ts deleted file mode 100644 index ac1a2af97..000000000 --- a/lib/typescript/utilities/logger.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -interface PrintOptions { - component?: string; - method?: string; - params?: Record | string | number | boolean; -} -declare type Print = (options: PrintOptions) => void; -declare const enableLogging: () => void; -declare let print: Print; -export { print, enableLogging }; diff --git a/lib/typescript/utilities/noop.d.ts b/lib/typescript/utilities/noop.d.ts deleted file mode 100644 index 00569af52..000000000 --- a/lib/typescript/utilities/noop.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare const workletNoop: () => void; -declare const noop: () => void; -export { noop, workletNoop }; diff --git a/lib/typescript/utilities/normalizeSnapPoint.d.ts b/lib/typescript/utilities/normalizeSnapPoint.d.ts deleted file mode 100644 index 03dbc29cd..000000000 --- a/lib/typescript/utilities/normalizeSnapPoint.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Converts a snap point to fixed numbers. - */ -export declare const normalizeSnapPoint: (snapPoint: number | string, containerHeight: number) => number; diff --git a/lib/typescript/utilities/snapPoint.d.ts b/lib/typescript/utilities/snapPoint.d.ts deleted file mode 100644 index bb7a8c3ca..000000000 --- a/lib/typescript/utilities/snapPoint.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare const snapPoint: (value: number, velocity: number, points: ReadonlyArray) => number; diff --git a/lib/typescript/utilities/validateSnapPoint.d.ts b/lib/typescript/utilities/validateSnapPoint.d.ts deleted file mode 100644 index b24411781..000000000 --- a/lib/typescript/utilities/validateSnapPoint.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare const validateSnapPoint: (snapPoint: any) => void;