@mustmove/bottom-sheet 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/bottomSheet/BottomSheet.js +1310 -0
- package/lib/commonjs/components/bottomSheet/BottomSheet.js.map +1 -0
- package/lib/commonjs/components/bottomSheet/BottomSheetBody.js +43 -0
- package/lib/commonjs/components/bottomSheet/BottomSheetBody.js.map +1 -0
- package/lib/commonjs/components/bottomSheet/BottomSheetContent.js +197 -0
- package/lib/commonjs/components/bottomSheet/BottomSheetContent.js.map +1 -0
- package/lib/commonjs/components/bottomSheet/constants.js +34 -0
- package/lib/commonjs/components/bottomSheet/constants.js.map +1 -0
- package/lib/commonjs/components/bottomSheet/index.js +14 -0
- package/lib/commonjs/components/bottomSheet/index.js.map +1 -0
- package/lib/commonjs/components/bottomSheet/styles.js +17 -0
- package/lib/commonjs/components/bottomSheet/styles.js.map +1 -0
- package/lib/commonjs/components/bottomSheetBackdrop/BottomSheetBackdrop.js +115 -0
- package/lib/commonjs/components/bottomSheetBackdrop/BottomSheetBackdrop.js.map +1 -0
- package/lib/commonjs/components/bottomSheetBackdrop/constants.js +16 -0
- package/lib/commonjs/components/bottomSheetBackdrop/constants.js.map +1 -0
- package/lib/commonjs/components/bottomSheetBackdrop/index.js +13 -0
- package/lib/commonjs/components/bottomSheetBackdrop/index.js.map +1 -0
- package/lib/commonjs/components/bottomSheetBackdrop/styles.js +14 -0
- package/lib/commonjs/components/bottomSheetBackdrop/styles.js.map +1 -0
- package/lib/commonjs/components/bottomSheetBackground/BottomSheetBackground.js +24 -0
- package/lib/commonjs/components/bottomSheetBackground/BottomSheetBackground.js.map +1 -0
- package/lib/commonjs/components/bottomSheetBackground/BottomSheetBackgroundContainer.js +33 -0
- package/lib/commonjs/components/bottomSheetBackground/BottomSheetBackgroundContainer.js.map +1 -0
- package/lib/commonjs/components/bottomSheetBackground/index.js +13 -0
- package/lib/commonjs/components/bottomSheetBackground/index.js.map +1 -0
- package/lib/commonjs/components/bottomSheetBackground/styles.js +15 -0
- package/lib/commonjs/components/bottomSheetBackground/styles.js.map +1 -0
- package/lib/commonjs/components/bottomSheetDraggableView/BottomSheetDraggableView.js +94 -0
- package/lib/commonjs/components/bottomSheetDraggableView/BottomSheetDraggableView.js.map +1 -0
- package/lib/commonjs/components/bottomSheetDraggableView/index.js +14 -0
- package/lib/commonjs/components/bottomSheetDraggableView/index.js.map +1 -0
- package/lib/commonjs/components/bottomSheetFooter/BottomSheetFooter.js +111 -0
- package/lib/commonjs/components/bottomSheetFooter/BottomSheetFooter.js.map +1 -0
- package/lib/commonjs/components/bottomSheetFooter/BottomSheetFooterContainer.js +54 -0
- package/lib/commonjs/components/bottomSheetFooter/BottomSheetFooterContainer.js.map +1 -0
- package/lib/commonjs/components/bottomSheetFooter/index.js +20 -0
- package/lib/commonjs/components/bottomSheetFooter/index.js.map +1 -0
- package/lib/commonjs/components/bottomSheetFooter/styles.js +18 -0
- package/lib/commonjs/components/bottomSheetFooter/styles.js.map +1 -0
- package/lib/commonjs/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.js +53 -0
- package/lib/commonjs/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.js.map +1 -0
- package/lib/commonjs/components/bottomSheetGestureHandlersProvider/index.js +14 -0
- package/lib/commonjs/components/bottomSheetGestureHandlersProvider/index.js.map +1 -0
- package/lib/commonjs/components/bottomSheetHandle/BottomSheetHandle.js +43 -0
- package/lib/commonjs/components/bottomSheetHandle/BottomSheetHandle.js.map +1 -0
- package/lib/commonjs/components/bottomSheetHandle/BottomSheetHandleContainer.js +153 -0
- package/lib/commonjs/components/bottomSheetHandle/BottomSheetHandleContainer.js.map +1 -0
- package/lib/commonjs/components/bottomSheetHandle/constants.js +11 -0
- package/lib/commonjs/components/bottomSheetHandle/constants.js.map +1 -0
- package/lib/commonjs/components/bottomSheetHandle/index.js +21 -0
- package/lib/commonjs/components/bottomSheetHandle/index.js.map +1 -0
- package/lib/commonjs/components/bottomSheetHandle/styles.js +27 -0
- package/lib/commonjs/components/bottomSheetHandle/styles.js.map +1 -0
- package/lib/commonjs/components/bottomSheetHostingContainer/BottomSheetHostingContainer.js +110 -0
- package/lib/commonjs/components/bottomSheetHostingContainer/BottomSheetHostingContainer.js.map +1 -0
- package/lib/commonjs/components/bottomSheetHostingContainer/index.js +13 -0
- package/lib/commonjs/components/bottomSheetHostingContainer/index.js.map +1 -0
- package/lib/commonjs/components/bottomSheetHostingContainer/styles.js +14 -0
- package/lib/commonjs/components/bottomSheetHostingContainer/styles.js.map +1 -0
- package/lib/commonjs/components/bottomSheetHostingContainer/styles.web.js +17 -0
- package/lib/commonjs/components/bottomSheetHostingContainer/styles.web.js.map +1 -0
- package/lib/commonjs/components/bottomSheetModal/BottomSheetModal.js +387 -0
- package/lib/commonjs/components/bottomSheetModal/BottomSheetModal.js.map +1 -0
- package/lib/commonjs/components/bottomSheetModal/constants.js +9 -0
- package/lib/commonjs/components/bottomSheetModal/constants.js.map +1 -0
- package/lib/commonjs/components/bottomSheetModal/index.js +14 -0
- package/lib/commonjs/components/bottomSheetModal/index.js.map +1 -0
- package/lib/commonjs/components/bottomSheetModalProvider/BottomSheetModalProvider.js +172 -0
- package/lib/commonjs/components/bottomSheetModalProvider/BottomSheetModalProvider.js.map +1 -0
- package/lib/commonjs/components/bottomSheetModalProvider/index.js +14 -0
- package/lib/commonjs/components/bottomSheetModalProvider/index.js.map +1 -0
- package/lib/commonjs/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.js +64 -0
- package/lib/commonjs/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.js.map +1 -0
- package/lib/commonjs/components/bottomSheetRefreshControl/BottomSheetRefreshControl.js +9 -0
- package/lib/commonjs/components/bottomSheetRefreshControl/BottomSheetRefreshControl.js.map +1 -0
- package/lib/commonjs/components/bottomSheetRefreshControl/index.js +10 -0
- package/lib/commonjs/components/bottomSheetRefreshControl/index.js.map +1 -0
- package/lib/commonjs/components/bottomSheetScrollable/BottomSheetDraggableScrollable.js +23 -0
- package/lib/commonjs/components/bottomSheetScrollable/BottomSheetDraggableScrollable.js.map +1 -0
- package/lib/commonjs/components/bottomSheetScrollable/BottomSheetFlashList.js +66 -0
- package/lib/commonjs/components/bottomSheetScrollable/BottomSheetFlashList.js.map +1 -0
- package/lib/commonjs/components/bottomSheetScrollable/BottomSheetFlashList.web.js +9 -0
- package/lib/commonjs/components/bottomSheetScrollable/BottomSheetFlashList.web.js.map +1 -0
- package/lib/commonjs/components/bottomSheetScrollable/BottomSheetFlatList.js +18 -0
- package/lib/commonjs/components/bottomSheetScrollable/BottomSheetFlatList.js.map +1 -0
- package/lib/commonjs/components/bottomSheetScrollable/BottomSheetScrollView.js +18 -0
- package/lib/commonjs/components/bottomSheetScrollable/BottomSheetScrollView.js.map +1 -0
- package/lib/commonjs/components/bottomSheetScrollable/BottomSheetSectionList.js +18 -0
- package/lib/commonjs/components/bottomSheetScrollable/BottomSheetSectionList.js.map +1 -0
- package/lib/commonjs/components/bottomSheetScrollable/BottomSheetVirtualizedList.js +18 -0
- package/lib/commonjs/components/bottomSheetScrollable/BottomSheetVirtualizedList.js.map +1 -0
- package/lib/commonjs/components/bottomSheetScrollable/ScrollableContainer.android.js +40 -0
- package/lib/commonjs/components/bottomSheetScrollable/ScrollableContainer.android.js.map +1 -0
- package/lib/commonjs/components/bottomSheetScrollable/ScrollableContainer.js +24 -0
- package/lib/commonjs/components/bottomSheetScrollable/ScrollableContainer.js.map +1 -0
- package/lib/commonjs/components/bottomSheetScrollable/ScrollableContainer.web.js +84 -0
- package/lib/commonjs/components/bottomSheetScrollable/ScrollableContainer.web.js.map +1 -0
- package/lib/commonjs/components/bottomSheetScrollable/createBottomSheetScrollableComponent.js +117 -0
- package/lib/commonjs/components/bottomSheetScrollable/createBottomSheetScrollableComponent.js.map +1 -0
- package/lib/commonjs/components/bottomSheetScrollable/index.js +49 -0
- package/lib/commonjs/components/bottomSheetScrollable/index.js.map +1 -0
- package/lib/commonjs/components/bottomSheetScrollable/styles.js +14 -0
- package/lib/commonjs/components/bottomSheetScrollable/styles.js.map +1 -0
- package/lib/commonjs/components/bottomSheetScrollable/useBottomSheetContentSizeSetter.js +39 -0
- package/lib/commonjs/components/bottomSheetScrollable/useBottomSheetContentSizeSetter.js.map +1 -0
- package/lib/commonjs/components/bottomSheetTextInput/BottomSheetTextInput.js +106 -0
- package/lib/commonjs/components/bottomSheetTextInput/BottomSheetTextInput.js.map +1 -0
- package/lib/commonjs/components/bottomSheetTextInput/index.js +14 -0
- package/lib/commonjs/components/bottomSheetTextInput/index.js.map +1 -0
- package/lib/commonjs/components/bottomSheetTextInput/types.js +6 -0
- package/lib/commonjs/components/bottomSheetTextInput/types.js.map +1 -0
- package/lib/commonjs/components/bottomSheetView/BottomSheetView.js +91 -0
- package/lib/commonjs/components/bottomSheetView/BottomSheetView.js.map +1 -0
- package/lib/commonjs/components/bottomSheetView/index.js +14 -0
- package/lib/commonjs/components/bottomSheetView/index.js.map +1 -0
- package/lib/commonjs/components/bottomSheetView/styles.js +16 -0
- package/lib/commonjs/components/bottomSheetView/styles.js.map +1 -0
- package/lib/commonjs/components/touchables/Touchables.ios.js +25 -0
- package/lib/commonjs/components/touchables/Touchables.ios.js.map +1 -0
- package/lib/commonjs/components/touchables/Touchables.js +25 -0
- package/lib/commonjs/components/touchables/Touchables.js.map +1 -0
- package/lib/commonjs/components/touchables/index.js +13 -0
- package/lib/commonjs/components/touchables/index.js.map +1 -0
- package/lib/commonjs/constants.js +138 -0
- package/lib/commonjs/constants.js.map +1 -0
- package/lib/commonjs/contexts/external.js +10 -0
- package/lib/commonjs/contexts/external.js.map +1 -0
- package/lib/commonjs/contexts/gesture.js +10 -0
- package/lib/commonjs/contexts/gesture.js.map +1 -0
- package/lib/commonjs/contexts/index.js +65 -0
- package/lib/commonjs/contexts/index.js.map +1 -0
- package/lib/commonjs/contexts/internal.js +10 -0
- package/lib/commonjs/contexts/internal.js.map +1 -0
- package/lib/commonjs/contexts/modal/external.js +10 -0
- package/lib/commonjs/contexts/modal/external.js.map +1 -0
- package/lib/commonjs/contexts/modal/internal.js +10 -0
- package/lib/commonjs/contexts/modal/internal.js.map +1 -0
- package/lib/commonjs/hooks/index.js +132 -0
- package/lib/commonjs/hooks/index.js.map +1 -0
- package/lib/commonjs/hooks/useAnimatedDetents.js +95 -0
- package/lib/commonjs/hooks/useAnimatedDetents.js.map +1 -0
- package/lib/commonjs/hooks/useAnimatedKeyboard.js +125 -0
- package/lib/commonjs/hooks/useAnimatedKeyboard.js.map +1 -0
- package/lib/commonjs/hooks/useAnimatedLayout.js +90 -0
- package/lib/commonjs/hooks/useAnimatedLayout.js.map +1 -0
- package/lib/commonjs/hooks/useBottomSheet.js +17 -0
- package/lib/commonjs/hooks/useBottomSheet.js.map +1 -0
- package/lib/commonjs/hooks/useBottomSheetContentContainerStyle.js +77 -0
- package/lib/commonjs/hooks/useBottomSheetContentContainerStyle.js.map +1 -0
- package/lib/commonjs/hooks/useBottomSheetGestureHandlers.js +17 -0
- package/lib/commonjs/hooks/useBottomSheetGestureHandlers.js.map +1 -0
- package/lib/commonjs/hooks/useBottomSheetInternal.js +16 -0
- package/lib/commonjs/hooks/useBottomSheetInternal.js.map +1 -0
- package/lib/commonjs/hooks/useBottomSheetModal.js +17 -0
- package/lib/commonjs/hooks/useBottomSheetModal.js.map +1 -0
- package/lib/commonjs/hooks/useBottomSheetModalInternal.js +16 -0
- package/lib/commonjs/hooks/useBottomSheetModalInternal.js.map +1 -0
- package/lib/commonjs/hooks/useBottomSheetScrollableCreator.js +58 -0
- package/lib/commonjs/hooks/useBottomSheetScrollableCreator.js.map +1 -0
- package/lib/commonjs/hooks/useBottomSheetSpringConfigs.js +15 -0
- package/lib/commonjs/hooks/useBottomSheetSpringConfigs.js.map +1 -0
- package/lib/commonjs/hooks/useBottomSheetTimingConfigs.js +32 -0
- package/lib/commonjs/hooks/useBottomSheetTimingConfigs.js.map +1 -0
- package/lib/commonjs/hooks/useBoundingClientRect.js +66 -0
- package/lib/commonjs/hooks/useBoundingClientRect.js.map +1 -0
- package/lib/commonjs/hooks/useGestureEventsHandlersDefault.js +299 -0
- package/lib/commonjs/hooks/useGestureEventsHandlersDefault.js.map +1 -0
- package/lib/commonjs/hooks/useGestureEventsHandlersDefault.web.js +295 -0
- package/lib/commonjs/hooks/useGestureEventsHandlersDefault.web.js.map +1 -0
- package/lib/commonjs/hooks/useGestureHandler.js +56 -0
- package/lib/commonjs/hooks/useGestureHandler.js.map +1 -0
- package/lib/commonjs/hooks/usePropsValidator.js +54 -0
- package/lib/commonjs/hooks/usePropsValidator.js.map +1 -0
- package/lib/commonjs/hooks/useReactiveSharedValue.js +48 -0
- package/lib/commonjs/hooks/useReactiveSharedValue.js.map +1 -0
- package/lib/commonjs/hooks/useScrollEventsHandlersDefault.js +132 -0
- package/lib/commonjs/hooks/useScrollEventsHandlersDefault.js.map +1 -0
- package/lib/commonjs/hooks/useScrollHandler.js +62 -0
- package/lib/commonjs/hooks/useScrollHandler.js.map +1 -0
- package/lib/commonjs/hooks/useScrollHandler.web.js +130 -0
- package/lib/commonjs/hooks/useScrollHandler.web.js.map +1 -0
- package/lib/commonjs/hooks/useScrollable.js +103 -0
- package/lib/commonjs/hooks/useScrollable.js.map +1 -0
- package/lib/commonjs/hooks/useScrollableSetter.js +47 -0
- package/lib/commonjs/hooks/useScrollableSetter.js.map +1 -0
- package/lib/commonjs/hooks/useStableCallback.js +25 -0
- package/lib/commonjs/hooks/useStableCallback.js.map +1 -0
- package/lib/commonjs/index.js +282 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/utilities/animate.js +41 -0
- package/lib/commonjs/utilities/animate.js.map +1 -0
- package/lib/commonjs/utilities/clamp.js +13 -0
- package/lib/commonjs/utilities/clamp.js.map +1 -0
- package/lib/commonjs/utilities/easingExp.js +19 -0
- package/lib/commonjs/utilities/easingExp.js.map +1 -0
- package/lib/commonjs/utilities/findNodeHandle.js +13 -0
- package/lib/commonjs/utilities/findNodeHandle.js.map +1 -0
- package/lib/commonjs/utilities/findNodeHandle.web.js +32 -0
- package/lib/commonjs/utilities/findNodeHandle.web.js.map +1 -0
- package/lib/commonjs/utilities/getKeyboardAnimationConfigs.js +44 -0
- package/lib/commonjs/utilities/getKeyboardAnimationConfigs.js.map +1 -0
- package/lib/commonjs/utilities/getRefNativeTag.web.js +11 -0
- package/lib/commonjs/utilities/getRefNativeTag.web.js.map +1 -0
- package/lib/commonjs/utilities/id.js +13 -0
- package/lib/commonjs/utilities/id.js.map +1 -0
- package/lib/commonjs/utilities/index.js +61 -0
- package/lib/commonjs/utilities/index.js.map +1 -0
- package/lib/commonjs/utilities/isFabricInstalled.js +16 -0
- package/lib/commonjs/utilities/isFabricInstalled.js.map +1 -0
- package/lib/commonjs/utilities/logger.js +44 -0
- package/lib/commonjs/utilities/logger.js.map +1 -0
- package/lib/commonjs/utilities/noop.js +13 -0
- package/lib/commonjs/utilities/noop.js.map +1 -0
- package/lib/commonjs/utilities/normalizeSnapPoint.js +22 -0
- package/lib/commonjs/utilities/normalizeSnapPoint.js.map +1 -0
- package/lib/commonjs/utilities/snapPoint.js +16 -0
- package/lib/commonjs/utilities/snapPoint.js.map +1 -0
- package/lib/commonjs/utilities/validateSnapPoint.js +15 -0
- package/lib/commonjs/utilities/validateSnapPoint.js.map +1 -0
- package/lib/module/components/bottomSheet/BottomSheet.js +1303 -0
- package/lib/module/components/bottomSheet/BottomSheet.js.map +1 -0
- package/lib/module/components/bottomSheet/BottomSheetBody.js +38 -0
- package/lib/module/components/bottomSheet/BottomSheetBody.js.map +1 -0
- package/lib/module/components/bottomSheet/BottomSheetContent.js +191 -0
- package/lib/module/components/bottomSheet/BottomSheetContent.js.map +1 -0
- package/lib/module/components/bottomSheet/constants.js +38 -0
- package/lib/module/components/bottomSheet/constants.js.map +1 -0
- package/lib/module/components/bottomSheet/index.js +4 -0
- package/lib/module/components/bottomSheet/index.js.map +1 -0
- package/lib/module/components/bottomSheet/styles.js +13 -0
- package/lib/module/components/bottomSheet/styles.js.map +1 -0
- package/lib/module/components/bottomSheetBackdrop/BottomSheetBackdrop.js +110 -0
- package/lib/module/components/bottomSheetBackdrop/BottomSheetBackdrop.js.map +1 -0
- package/lib/module/components/bottomSheetBackdrop/constants.js +13 -0
- package/lib/module/components/bottomSheetBackdrop/constants.js.map +1 -0
- package/lib/module/components/bottomSheetBackdrop/index.js +4 -0
- package/lib/module/components/bottomSheetBackdrop/index.js.map +1 -0
- package/lib/module/components/bottomSheetBackdrop/styles.js +10 -0
- package/lib/module/components/bottomSheetBackdrop/styles.js.map +1 -0
- package/lib/module/components/bottomSheetBackground/BottomSheetBackground.js +19 -0
- package/lib/module/components/bottomSheetBackground/BottomSheetBackground.js.map +1 -0
- package/lib/module/components/bottomSheetBackground/BottomSheetBackgroundContainer.js +28 -0
- package/lib/module/components/bottomSheetBackground/BottomSheetBackgroundContainer.js.map +1 -0
- package/lib/module/components/bottomSheetBackground/index.js +4 -0
- package/lib/module/components/bottomSheetBackground/index.js.map +1 -0
- package/lib/module/components/bottomSheetBackground/styles.js +11 -0
- package/lib/module/components/bottomSheetBackground/styles.js.map +1 -0
- package/lib/module/components/bottomSheetDraggableView/BottomSheetDraggableView.js +88 -0
- package/lib/module/components/bottomSheetDraggableView/BottomSheetDraggableView.js.map +1 -0
- package/lib/module/components/bottomSheetDraggableView/index.js +4 -0
- package/lib/module/components/bottomSheetDraggableView/index.js.map +1 -0
- package/lib/module/components/bottomSheetFooter/BottomSheetFooter.js +106 -0
- package/lib/module/components/bottomSheetFooter/BottomSheetFooter.js.map +1 -0
- package/lib/module/components/bottomSheetFooter/BottomSheetFooterContainer.js +49 -0
- package/lib/module/components/bottomSheetFooter/BottomSheetFooterContainer.js.map +1 -0
- package/lib/module/components/bottomSheetFooter/index.js +5 -0
- package/lib/module/components/bottomSheetFooter/index.js.map +1 -0
- package/lib/module/components/bottomSheetFooter/styles.js +14 -0
- package/lib/module/components/bottomSheetFooter/styles.js.map +1 -0
- package/lib/module/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.js +48 -0
- package/lib/module/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.js.map +1 -0
- package/lib/module/components/bottomSheetGestureHandlersProvider/index.js +4 -0
- package/lib/module/components/bottomSheetGestureHandlersProvider/index.js.map +1 -0
- package/lib/module/components/bottomSheetHandle/BottomSheetHandle.js +38 -0
- package/lib/module/components/bottomSheetHandle/BottomSheetHandle.js.map +1 -0
- package/lib/module/components/bottomSheetHandle/BottomSheetHandleContainer.js +147 -0
- package/lib/module/components/bottomSheetHandle/BottomSheetHandleContainer.js.map +1 -0
- package/lib/module/components/bottomSheetHandle/constants.js +8 -0
- package/lib/module/components/bottomSheetHandle/constants.js.map +1 -0
- package/lib/module/components/bottomSheetHandle/index.js +5 -0
- package/lib/module/components/bottomSheetHandle/index.js.map +1 -0
- package/lib/module/components/bottomSheetHandle/styles.js +23 -0
- package/lib/module/components/bottomSheetHandle/styles.js.map +1 -0
- package/lib/module/components/bottomSheetHostingContainer/BottomSheetHostingContainer.js +105 -0
- package/lib/module/components/bottomSheetHostingContainer/BottomSheetHostingContainer.js.map +1 -0
- package/lib/module/components/bottomSheetHostingContainer/index.js +4 -0
- package/lib/module/components/bottomSheetHostingContainer/index.js.map +1 -0
- package/lib/module/components/bottomSheetHostingContainer/styles.js +10 -0
- package/lib/module/components/bottomSheetHostingContainer/styles.js.map +1 -0
- package/lib/module/components/bottomSheetHostingContainer/styles.web.js +13 -0
- package/lib/module/components/bottomSheetHostingContainer/styles.web.js.map +1 -0
- package/lib/module/components/bottomSheetModal/BottomSheetModal.js +381 -0
- package/lib/module/components/bottomSheetModal/BottomSheetModal.js.map +1 -0
- package/lib/module/components/bottomSheetModal/constants.js +6 -0
- package/lib/module/components/bottomSheetModal/constants.js.map +1 -0
- package/lib/module/components/bottomSheetModal/index.js +4 -0
- package/lib/module/components/bottomSheetModal/index.js.map +1 -0
- package/lib/module/components/bottomSheetModalProvider/BottomSheetModalProvider.js +167 -0
- package/lib/module/components/bottomSheetModalProvider/BottomSheetModalProvider.js.map +1 -0
- package/lib/module/components/bottomSheetModalProvider/index.js +4 -0
- package/lib/module/components/bottomSheetModalProvider/index.js.map +1 -0
- package/lib/module/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.js +59 -0
- package/lib/module/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.js.map +1 -0
- package/lib/module/components/bottomSheetRefreshControl/BottomSheetRefreshControl.js +4 -0
- package/lib/module/components/bottomSheetRefreshControl/BottomSheetRefreshControl.js.map +1 -0
- package/lib/module/components/bottomSheetRefreshControl/index.js +5 -0
- package/lib/module/components/bottomSheetRefreshControl/index.js.map +1 -0
- package/lib/module/components/bottomSheetScrollable/BottomSheetDraggableScrollable.js +18 -0
- package/lib/module/components/bottomSheetScrollable/BottomSheetDraggableScrollable.js.map +1 -0
- package/lib/module/components/bottomSheetScrollable/BottomSheetFlashList.js +60 -0
- package/lib/module/components/bottomSheetScrollable/BottomSheetFlashList.js.map +1 -0
- package/lib/module/components/bottomSheetScrollable/BottomSheetFlashList.web.js +4 -0
- package/lib/module/components/bottomSheetScrollable/BottomSheetFlashList.web.js.map +1 -0
- package/lib/module/components/bottomSheetScrollable/BottomSheetFlatList.js +13 -0
- package/lib/module/components/bottomSheetScrollable/BottomSheetFlatList.js.map +1 -0
- package/lib/module/components/bottomSheetScrollable/BottomSheetScrollView.js +13 -0
- package/lib/module/components/bottomSheetScrollable/BottomSheetScrollView.js.map +1 -0
- package/lib/module/components/bottomSheetScrollable/BottomSheetSectionList.js +13 -0
- package/lib/module/components/bottomSheetScrollable/BottomSheetSectionList.js.map +1 -0
- package/lib/module/components/bottomSheetScrollable/BottomSheetVirtualizedList.js +13 -0
- package/lib/module/components/bottomSheetScrollable/BottomSheetVirtualizedList.js.map +1 -0
- package/lib/module/components/bottomSheetScrollable/ScrollableContainer.android.js +34 -0
- package/lib/module/components/bottomSheetScrollable/ScrollableContainer.android.js.map +1 -0
- package/lib/module/components/bottomSheetScrollable/ScrollableContainer.js +19 -0
- package/lib/module/components/bottomSheetScrollable/ScrollableContainer.js.map +1 -0
- package/lib/module/components/bottomSheetScrollable/ScrollableContainer.web.js +78 -0
- package/lib/module/components/bottomSheetScrollable/ScrollableContainer.web.js.map +1 -0
- package/lib/module/components/bottomSheetScrollable/createBottomSheetScrollableComponent.js +112 -0
- package/lib/module/components/bottomSheetScrollable/createBottomSheetScrollableComponent.js.map +1 -0
- package/lib/module/components/bottomSheetScrollable/index.js +9 -0
- package/lib/module/components/bottomSheetScrollable/index.js.map +1 -0
- package/lib/module/components/bottomSheetScrollable/styles.js +10 -0
- package/lib/module/components/bottomSheetScrollable/styles.js.map +1 -0
- package/lib/module/components/bottomSheetScrollable/useBottomSheetContentSizeSetter.js +36 -0
- package/lib/module/components/bottomSheetScrollable/useBottomSheetContentSizeSetter.js.map +1 -0
- package/lib/module/components/bottomSheetTextInput/BottomSheetTextInput.js +101 -0
- package/lib/module/components/bottomSheetTextInput/BottomSheetTextInput.js.map +1 -0
- package/lib/module/components/bottomSheetTextInput/index.js +4 -0
- package/lib/module/components/bottomSheetTextInput/index.js.map +1 -0
- package/lib/module/components/bottomSheetTextInput/types.js +4 -0
- package/lib/module/components/bottomSheetTextInput/types.js.map +1 -0
- package/lib/module/components/bottomSheetView/BottomSheetView.js +86 -0
- package/lib/module/components/bottomSheetView/BottomSheetView.js.map +1 -0
- package/lib/module/components/bottomSheetView/index.js +4 -0
- package/lib/module/components/bottomSheetView/index.js.map +1 -0
- package/lib/module/components/bottomSheetView/styles.js +12 -0
- package/lib/module/components/bottomSheetView/styles.js.map +1 -0
- package/lib/module/components/touchables/Touchables.ios.js +4 -0
- package/lib/module/components/touchables/Touchables.ios.js.map +1 -0
- package/lib/module/components/touchables/Touchables.js +4 -0
- package/lib/module/components/touchables/Touchables.js.map +1 -0
- package/lib/module/components/touchables/index.js +11 -0
- package/lib/module/components/touchables/index.js.map +1 -0
- package/lib/module/constants.js +131 -0
- package/lib/module/constants.js.map +1 -0
- package/lib/module/contexts/external.js +6 -0
- package/lib/module/contexts/external.js.map +1 -0
- package/lib/module/contexts/gesture.js +6 -0
- package/lib/module/contexts/gesture.js.map +1 -0
- package/lib/module/contexts/index.js +8 -0
- package/lib/module/contexts/index.js.map +1 -0
- package/lib/module/contexts/internal.js +6 -0
- package/lib/module/contexts/internal.js.map +1 -0
- package/lib/module/contexts/modal/external.js +6 -0
- package/lib/module/contexts/modal/external.js.map +1 -0
- package/lib/module/contexts/modal/internal.js +6 -0
- package/lib/module/contexts/modal/internal.js.map +1 -0
- package/lib/module/hooks/index.js +29 -0
- package/lib/module/hooks/index.js.map +1 -0
- package/lib/module/hooks/useAnimatedDetents.js +91 -0
- package/lib/module/hooks/useAnimatedDetents.js.map +1 -0
- package/lib/module/hooks/useAnimatedKeyboard.js +120 -0
- package/lib/module/hooks/useAnimatedKeyboard.js.map +1 -0
- package/lib/module/hooks/useAnimatedLayout.js +86 -0
- package/lib/module/hooks/useAnimatedLayout.js.map +1 -0
- package/lib/module/hooks/useBottomSheet.js +12 -0
- package/lib/module/hooks/useBottomSheet.js.map +1 -0
- package/lib/module/hooks/useBottomSheetContentContainerStyle.js +73 -0
- package/lib/module/hooks/useBottomSheetContentContainerStyle.js.map +1 -0
- package/lib/module/hooks/useBottomSheetGestureHandlers.js +12 -0
- package/lib/module/hooks/useBottomSheetGestureHandlers.js.map +1 -0
- package/lib/module/hooks/useBottomSheetInternal.js +12 -0
- package/lib/module/hooks/useBottomSheetInternal.js.map +1 -0
- package/lib/module/hooks/useBottomSheetModal.js +12 -0
- package/lib/module/hooks/useBottomSheetModal.js.map +1 -0
- package/lib/module/hooks/useBottomSheetModalInternal.js +12 -0
- package/lib/module/hooks/useBottomSheetModalInternal.js.map +1 -0
- package/lib/module/hooks/useBottomSheetScrollableCreator.js +54 -0
- package/lib/module/hooks/useBottomSheetScrollableCreator.js.map +1 -0
- package/lib/module/hooks/useBottomSheetSpringConfigs.js +10 -0
- package/lib/module/hooks/useBottomSheetSpringConfigs.js.map +1 -0
- package/lib/module/hooks/useBottomSheetTimingConfigs.js +28 -0
- package/lib/module/hooks/useBottomSheetTimingConfigs.js.map +1 -0
- package/lib/module/hooks/useBoundingClientRect.js +62 -0
- package/lib/module/hooks/useBoundingClientRect.js.map +1 -0
- package/lib/module/hooks/useGestureEventsHandlersDefault.js +294 -0
- package/lib/module/hooks/useGestureEventsHandlersDefault.js.map +1 -0
- package/lib/module/hooks/useGestureEventsHandlersDefault.web.js +290 -0
- package/lib/module/hooks/useGestureEventsHandlersDefault.web.js.map +1 -0
- package/lib/module/hooks/useGestureHandler.js +51 -0
- package/lib/module/hooks/useGestureHandler.js.map +1 -0
- package/lib/module/hooks/usePropsValidator.js +49 -0
- package/lib/module/hooks/usePropsValidator.js.map +1 -0
- package/lib/module/hooks/useReactiveSharedValue.js +43 -0
- package/lib/module/hooks/useReactiveSharedValue.js.map +1 -0
- package/lib/module/hooks/useScrollEventsHandlersDefault.js +127 -0
- package/lib/module/hooks/useScrollEventsHandlersDefault.js.map +1 -0
- package/lib/module/hooks/useScrollHandler.js +57 -0
- package/lib/module/hooks/useScrollHandler.js.map +1 -0
- package/lib/module/hooks/useScrollHandler.web.js +125 -0
- package/lib/module/hooks/useScrollHandler.web.js.map +1 -0
- package/lib/module/hooks/useScrollable.js +98 -0
- package/lib/module/hooks/useScrollable.js.map +1 -0
- package/lib/module/hooks/useScrollableSetter.js +42 -0
- package/lib/module/hooks/useScrollableSetter.js.map +1 -0
- package/lib/module/hooks/useStableCallback.js +21 -0
- package/lib/module/hooks/useStableCallback.js.map +1 -0
- package/lib/module/index.js +53 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/utilities/animate.js +36 -0
- package/lib/module/utilities/animate.js.map +1 -0
- package/lib/module/utilities/clamp.js +8 -0
- package/lib/module/utilities/clamp.js.map +1 -0
- package/lib/module/utilities/easingExp.js +14 -0
- package/lib/module/utilities/easingExp.js.map +1 -0
- package/lib/module/utilities/findNodeHandle.js +4 -0
- package/lib/module/utilities/findNodeHandle.js.map +1 -0
- package/lib/module/utilities/findNodeHandle.web.js +28 -0
- package/lib/module/utilities/findNodeHandle.web.js.map +1 -0
- package/lib/module/utilities/getKeyboardAnimationConfigs.js +39 -0
- package/lib/module/utilities/getKeyboardAnimationConfigs.js.map +1 -0
- package/lib/module/utilities/getRefNativeTag.web.js +7 -0
- package/lib/module/utilities/getRefNativeTag.web.js.map +1 -0
- package/lib/module/utilities/id.js +8 -0
- package/lib/module/utilities/id.js.map +1 -0
- package/lib/module/utilities/index.js +10 -0
- package/lib/module/utilities/index.js.map +1 -0
- package/lib/module/utilities/isFabricInstalled.js +12 -0
- package/lib/module/utilities/isFabricInstalled.js.map +1 -0
- package/lib/module/utilities/logger.js +39 -0
- package/lib/module/utilities/logger.js.map +1 -0
- package/lib/module/utilities/noop.js +8 -0
- package/lib/module/utilities/noop.js.map +1 -0
- package/lib/module/utilities/normalizeSnapPoint.js +17 -0
- package/lib/module/utilities/normalizeSnapPoint.js.map +1 -0
- package/lib/module/utilities/snapPoint.js +11 -0
- package/lib/module/utilities/snapPoint.js.map +1 -0
- package/lib/module/utilities/validateSnapPoint.js +9 -0
- package/lib/module/utilities/validateSnapPoint.js.map +1 -0
- package/lib/typescript/components/bottomSheet/BottomSheet.d.ts +7 -0
- package/lib/typescript/components/bottomSheet/BottomSheet.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheet/BottomSheetBody.d.ts +10 -0
- package/lib/typescript/components/bottomSheet/BottomSheetBody.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheet/BottomSheetContent.d.ts +12 -0
- package/lib/typescript/components/bottomSheet/BottomSheetContent.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheet/constants.d.ts +21 -0
- package/lib/typescript/components/bottomSheet/constants.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheet/index.d.ts +3 -0
- package/lib/typescript/components/bottomSheet/index.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheet/styles.d.ts +10 -0
- package/lib/typescript/components/bottomSheet/styles.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheet/types.d.ts +358 -0
- package/lib/typescript/components/bottomSheetBackdrop/BottomSheetBackdrop.d.ts +4 -0
- package/lib/typescript/components/bottomSheetBackdrop/BottomSheetBackdrop.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetBackdrop/constants.d.ts +11 -0
- package/lib/typescript/components/bottomSheetBackdrop/constants.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetBackdrop/index.d.ts +3 -0
- package/lib/typescript/components/bottomSheetBackdrop/index.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetBackdrop/styles.d.ts +11 -0
- package/lib/typescript/components/bottomSheetBackdrop/styles.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetBackdrop/types.d.ts +58 -0
- package/lib/typescript/components/bottomSheetBackground/BottomSheetBackground.d.ts +4 -0
- package/lib/typescript/components/bottomSheetBackground/BottomSheetBackground.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetBackground/BottomSheetBackgroundContainer.d.ts +4 -0
- package/lib/typescript/components/bottomSheetBackground/BottomSheetBackgroundContainer.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetBackground/index.d.ts +3 -0
- package/lib/typescript/components/bottomSheetBackground/index.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetBackground/styles.d.ts +9 -0
- package/lib/typescript/components/bottomSheetBackground/styles.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetBackground/types.d.ts +12 -0
- package/lib/typescript/components/bottomSheetDraggableView/BottomSheetDraggableView.d.ts +5 -0
- package/lib/typescript/components/bottomSheetDraggableView/BottomSheetDraggableView.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetDraggableView/index.d.ts +2 -0
- package/lib/typescript/components/bottomSheetDraggableView/index.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetDraggableView/types.d.ts +9 -0
- package/lib/typescript/components/bottomSheetFooter/BottomSheetFooter.d.ts +6 -0
- package/lib/typescript/components/bottomSheetFooter/BottomSheetFooter.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetFooter/BottomSheetFooterContainer.d.ts +4 -0
- package/lib/typescript/components/bottomSheetFooter/BottomSheetFooterContainer.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetFooter/index.d.ts +4 -0
- package/lib/typescript/components/bottomSheetFooter/index.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetFooter/styles.d.ts +11 -0
- package/lib/typescript/components/bottomSheetFooter/styles.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetFooter/types.d.ts +41 -0
- package/lib/typescript/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.d.ts +5 -0
- package/lib/typescript/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetGestureHandlersProvider/index.d.ts +2 -0
- package/lib/typescript/components/bottomSheetGestureHandlersProvider/index.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetGestureHandlersProvider/types.d.ts +8 -0
- package/lib/typescript/components/bottomSheetHandle/BottomSheetHandle.d.ts +6 -0
- package/lib/typescript/components/bottomSheetHandle/BottomSheetHandle.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetHandle/BottomSheetHandleContainer.d.ts +6 -0
- package/lib/typescript/components/bottomSheetHandle/BottomSheetHandleContainer.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetHandle/constants.d.ts +6 -0
- package/lib/typescript/components/bottomSheetHandle/constants.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetHandle/index.d.ts +4 -0
- package/lib/typescript/components/bottomSheetHandle/index.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetHandle/styles.d.ts +17 -0
- package/lib/typescript/components/bottomSheetHandle/styles.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetHandle/types.d.ts +52 -0
- package/lib/typescript/components/bottomSheetHostingContainer/BottomSheetHostingContainer.d.ts +6 -0
- package/lib/typescript/components/bottomSheetHostingContainer/BottomSheetHostingContainer.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetHostingContainer/index.d.ts +3 -0
- package/lib/typescript/components/bottomSheetHostingContainer/index.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetHostingContainer/styles.d.ts +11 -0
- package/lib/typescript/components/bottomSheetHostingContainer/styles.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetHostingContainer/styles.web.d.ts +10 -0
- package/lib/typescript/components/bottomSheetHostingContainer/styles.web.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetHostingContainer/types.d.ts +17 -0
- package/lib/typescript/components/bottomSheetModal/BottomSheetModal.d.ts +10 -0
- package/lib/typescript/components/bottomSheetModal/BottomSheetModal.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetModal/constants.d.ts +4 -0
- package/lib/typescript/components/bottomSheetModal/constants.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetModal/index.d.ts +3 -0
- package/lib/typescript/components/bottomSheetModal/index.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetModal/types.d.ts +67 -0
- package/lib/typescript/components/bottomSheetModalProvider/BottomSheetModalProvider.d.ts +5 -0
- package/lib/typescript/components/bottomSheetModalProvider/BottomSheetModalProvider.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetModalProvider/index.d.ts +2 -0
- package/lib/typescript/components/bottomSheetModalProvider/index.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetModalProvider/types.d.ts +12 -0
- package/lib/typescript/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.d.ts +10 -0
- package/lib/typescript/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetRefreshControl/BottomSheetRefreshControl.d.ts +3 -0
- package/lib/typescript/components/bottomSheetRefreshControl/BottomSheetRefreshControl.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetRefreshControl/index.d.ts +9 -0
- package/lib/typescript/components/bottomSheetRefreshControl/index.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetScrollable/BottomSheetDraggableScrollable.d.ts +9 -0
- package/lib/typescript/components/bottomSheetScrollable/BottomSheetDraggableScrollable.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetScrollable/BottomSheetFlashList.d.ts +11 -0
- package/lib/typescript/components/bottomSheetScrollable/BottomSheetFlashList.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetScrollable/BottomSheetFlashList.web.d.ts +3 -0
- package/lib/typescript/components/bottomSheetScrollable/BottomSheetFlashList.web.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetScrollable/BottomSheetFlatList.d.ts +5 -0
- package/lib/typescript/components/bottomSheetScrollable/BottomSheetFlatList.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetScrollable/BottomSheetScrollView.d.ts +5 -0
- package/lib/typescript/components/bottomSheetScrollable/BottomSheetScrollView.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetScrollable/BottomSheetSectionList.d.ts +6 -0
- package/lib/typescript/components/bottomSheetScrollable/BottomSheetSectionList.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetScrollable/BottomSheetVirtualizedList.d.ts +5 -0
- package/lib/typescript/components/bottomSheetScrollable/BottomSheetVirtualizedList.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetScrollable/ScrollableContainer.android.d.ts +13 -0
- package/lib/typescript/components/bottomSheetScrollable/ScrollableContainer.android.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetScrollable/ScrollableContainer.d.ts +9 -0
- package/lib/typescript/components/bottomSheetScrollable/ScrollableContainer.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetScrollable/ScrollableContainer.web.d.ts +14 -0
- package/lib/typescript/components/bottomSheetScrollable/ScrollableContainer.web.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetScrollable/createBottomSheetScrollableComponent.d.ts +4 -0
- package/lib/typescript/components/bottomSheetScrollable/createBottomSheetScrollableComponent.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetScrollable/index.d.ts +8 -0
- package/lib/typescript/components/bottomSheetScrollable/index.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetScrollable/styles.d.ts +7 -0
- package/lib/typescript/components/bottomSheetScrollable/styles.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetScrollable/types.d.ts +280 -0
- package/lib/typescript/components/bottomSheetScrollable/useBottomSheetContentSizeSetter.d.ts +8 -0
- package/lib/typescript/components/bottomSheetScrollable/useBottomSheetContentSizeSetter.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetTextInput/BottomSheetTextInput.d.ts +6 -0
- package/lib/typescript/components/bottomSheetTextInput/BottomSheetTextInput.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetTextInput/index.d.ts +3 -0
- package/lib/typescript/components/bottomSheetTextInput/index.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetTextInput/types.d.ts +4 -0
- package/lib/typescript/components/bottomSheetTextInput/types.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetView/BottomSheetView.d.ts +6 -0
- package/lib/typescript/components/bottomSheetView/BottomSheetView.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetView/index.d.ts +2 -0
- package/lib/typescript/components/bottomSheetView/index.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetView/styles.d.ts +9 -0
- package/lib/typescript/components/bottomSheetView/styles.d.ts.map +1 -0
- package/lib/typescript/components/bottomSheetView/types.d.ts +24 -0
- package/lib/typescript/components/touchables/Touchables.d.ts +2 -0
- package/lib/typescript/components/touchables/Touchables.d.ts.map +1 -0
- package/lib/typescript/components/touchables/Touchables.ios.d.ts +2 -0
- package/lib/typescript/components/touchables/Touchables.ios.d.ts.map +1 -0
- package/lib/typescript/components/touchables/index.d.ts +8 -0
- package/lib/typescript/components/touchables/index.d.ts.map +1 -0
- package/lib/typescript/constants.d.ts +96 -0
- package/lib/typescript/constants.d.ts.map +1 -0
- package/lib/typescript/contexts/external.d.ts +4 -0
- package/lib/typescript/contexts/external.d.ts.map +1 -0
- package/lib/typescript/contexts/gesture.d.ts +9 -0
- package/lib/typescript/contexts/gesture.d.ts.map +1 -0
- package/lib/typescript/contexts/index.d.ts +7 -0
- package/lib/typescript/contexts/index.d.ts.map +1 -0
- package/lib/typescript/contexts/internal.d.ts +29 -0
- package/lib/typescript/contexts/internal.d.ts.map +1 -0
- package/lib/typescript/contexts/modal/external.d.ts +7 -0
- package/lib/typescript/contexts/modal/external.d.ts.map +1 -0
- package/lib/typescript/contexts/modal/internal.d.ts +14 -0
- package/lib/typescript/contexts/modal/internal.d.ts.map +1 -0
- package/lib/typescript/hooks/index.d.ts +19 -0
- package/lib/typescript/hooks/index.d.ts.map +1 -0
- package/lib/typescript/hooks/useAnimatedDetents.d.ts +20 -0
- package/lib/typescript/hooks/useAnimatedDetents.d.ts.map +1 -0
- package/lib/typescript/hooks/useAnimatedKeyboard.d.ts +6 -0
- package/lib/typescript/hooks/useAnimatedKeyboard.d.ts.map +1 -0
- package/lib/typescript/hooks/useAnimatedLayout.d.ts +26 -0
- package/lib/typescript/hooks/useAnimatedLayout.d.ts.map +1 -0
- package/lib/typescript/hooks/useBottomSheet.d.ts +2 -0
- package/lib/typescript/hooks/useBottomSheet.d.ts.map +1 -0
- package/lib/typescript/hooks/useBottomSheetContentContainerStyle.d.ts +3 -0
- package/lib/typescript/hooks/useBottomSheetContentContainerStyle.d.ts.map +1 -0
- package/lib/typescript/hooks/useBottomSheetGestureHandlers.d.ts +2 -0
- package/lib/typescript/hooks/useBottomSheetGestureHandlers.d.ts.map +1 -0
- package/lib/typescript/hooks/useBottomSheetInternal.d.ts +4 -0
- package/lib/typescript/hooks/useBottomSheetInternal.d.ts.map +1 -0
- package/lib/typescript/hooks/useBottomSheetModal.d.ts +2 -0
- package/lib/typescript/hooks/useBottomSheetModal.d.ts.map +1 -0
- package/lib/typescript/hooks/useBottomSheetModalInternal.d.ts +4 -0
- package/lib/typescript/hooks/useBottomSheetModalInternal.d.ts.map +1 -0
- package/lib/typescript/hooks/useBottomSheetScrollableCreator.d.ts +29 -0
- package/lib/typescript/hooks/useBottomSheetScrollableCreator.d.ts.map +1 -0
- package/lib/typescript/hooks/useBottomSheetSpringConfigs.d.ts +7 -0
- package/lib/typescript/hooks/useBottomSheetSpringConfigs.d.ts.map +1 -0
- package/lib/typescript/hooks/useBottomSheetTimingConfigs.d.ts +21 -0
- package/lib/typescript/hooks/useBottomSheetTimingConfigs.d.ts.map +1 -0
- package/lib/typescript/hooks/useBoundingClientRect.d.ts +42 -0
- package/lib/typescript/hooks/useBoundingClientRect.d.ts.map +1 -0
- package/lib/typescript/hooks/useGestureEventsHandlersDefault.d.ts +3 -0
- package/lib/typescript/hooks/useGestureEventsHandlersDefault.d.ts.map +1 -0
- package/lib/typescript/hooks/useGestureEventsHandlersDefault.web.d.ts +8 -0
- package/lib/typescript/hooks/useGestureEventsHandlersDefault.web.d.ts.map +1 -0
- package/lib/typescript/hooks/useGestureHandler.d.ts +3 -0
- package/lib/typescript/hooks/useGestureHandler.d.ts.map +1 -0
- package/lib/typescript/hooks/usePropsValidator.d.ts +7 -0
- package/lib/typescript/hooks/usePropsValidator.d.ts.map +1 -0
- package/lib/typescript/hooks/useReactiveSharedValue.d.ts +4 -0
- package/lib/typescript/hooks/useReactiveSharedValue.d.ts.map +1 -0
- package/lib/typescript/hooks/useScrollEventsHandlersDefault.d.ts +7 -0
- package/lib/typescript/hooks/useScrollEventsHandlersDefault.d.ts.map +1 -0
- package/lib/typescript/hooks/useScrollHandler.d.ts +7 -0
- package/lib/typescript/hooks/useScrollHandler.d.ts.map +1 -0
- package/lib/typescript/hooks/useScrollHandler.web.d.ts +11 -0
- package/lib/typescript/hooks/useScrollHandler.web.d.ts.map +1 -0
- package/lib/typescript/hooks/useScrollable.d.ts +11 -0
- package/lib/typescript/hooks/useScrollable.d.ts.map +1 -0
- package/lib/typescript/hooks/useScrollableSetter.d.ts +6 -0
- package/lib/typescript/hooks/useScrollableSetter.d.ts.map +1 -0
- package/lib/typescript/hooks/useStableCallback.d.ts +7 -0
- package/lib/typescript/hooks/useStableCallback.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +35 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/types.d.ts +336 -0
- package/lib/typescript/utilities/animate.d.ts +11 -0
- package/lib/typescript/utilities/animate.d.ts.map +1 -0
- package/lib/typescript/utilities/clamp.d.ts +2 -0
- package/lib/typescript/utilities/clamp.d.ts.map +1 -0
- package/lib/typescript/utilities/easingExp.d.ts +8 -0
- package/lib/typescript/utilities/easingExp.d.ts.map +1 -0
- package/lib/typescript/utilities/findNodeHandle.d.ts +2 -0
- package/lib/typescript/utilities/findNodeHandle.d.ts.map +1 -0
- package/lib/typescript/utilities/findNodeHandle.web.d.ts +3 -0
- package/lib/typescript/utilities/findNodeHandle.web.d.ts.map +1 -0
- package/lib/typescript/utilities/getKeyboardAnimationConfigs.d.ts +21 -0
- package/lib/typescript/utilities/getKeyboardAnimationConfigs.d.ts.map +1 -0
- package/lib/typescript/utilities/getRefNativeTag.web.d.ts +3 -0
- package/lib/typescript/utilities/getRefNativeTag.web.d.ts.map +1 -0
- package/lib/typescript/utilities/id.d.ts +2 -0
- package/lib/typescript/utilities/id.d.ts.map +1 -0
- package/lib/typescript/utilities/index.d.ts +8 -0
- package/lib/typescript/utilities/index.d.ts.map +1 -0
- package/lib/typescript/utilities/isFabricInstalled.d.ts +7 -0
- package/lib/typescript/utilities/isFabricInstalled.d.ts.map +1 -0
- package/lib/typescript/utilities/logger.d.ts +11 -0
- package/lib/typescript/utilities/logger.d.ts.map +1 -0
- package/lib/typescript/utilities/noop.d.ts +4 -0
- package/lib/typescript/utilities/noop.d.ts.map +1 -0
- package/lib/typescript/utilities/normalizeSnapPoint.d.ts +5 -0
- package/lib/typescript/utilities/normalizeSnapPoint.d.ts.map +1 -0
- package/lib/typescript/utilities/snapPoint.d.ts +2 -0
- package/lib/typescript/utilities/snapPoint.d.ts.map +1 -0
- package/lib/typescript/utilities/validateSnapPoint.d.ts +2 -0
- package/lib/typescript/utilities/validateSnapPoint.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/components/bottomSheet/BottomSheetContent.tsx +0 -1
|
@@ -0,0 +1,1310 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _invariant = _interopRequireDefault(require("invariant"));
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _reactNative = require("react-native");
|
|
10
|
+
var _reactNativeGestureHandler = require("react-native-gesture-handler");
|
|
11
|
+
var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
|
|
12
|
+
var _constants = require("../../constants");
|
|
13
|
+
var _contexts = require("../../contexts");
|
|
14
|
+
var _hooks = require("../../hooks");
|
|
15
|
+
var _utilities = require("../../utilities");
|
|
16
|
+
var _bottomSheetBackground = require("../bottomSheetBackground");
|
|
17
|
+
var _bottomSheetFooter = require("../bottomSheetFooter");
|
|
18
|
+
var _bottomSheetGestureHandlersProvider = _interopRequireDefault(require("../bottomSheetGestureHandlersProvider"));
|
|
19
|
+
var _bottomSheetHandle = require("../bottomSheetHandle");
|
|
20
|
+
var _bottomSheetHostingContainer = require("../bottomSheetHostingContainer");
|
|
21
|
+
var _BottomSheetBody = require("./BottomSheetBody");
|
|
22
|
+
var _BottomSheetContent = require("./BottomSheetContent");
|
|
23
|
+
var _constants2 = require("./constants");
|
|
24
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
26
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
27
|
+
// import BottomSheetDebugView from '../bottomSheetDebugView';
|
|
28
|
+
|
|
29
|
+
_reactNativeReanimated.default.addWhitelistedUIProps({
|
|
30
|
+
decelerationRate: true
|
|
31
|
+
});
|
|
32
|
+
const BottomSheetComponent = /*#__PURE__*/(0, _react.forwardRef)(function BottomSheet(props, ref) {
|
|
33
|
+
//#region extract props
|
|
34
|
+
const {
|
|
35
|
+
// animations configurations
|
|
36
|
+
animationConfigs: _providedAnimationConfigs,
|
|
37
|
+
// configurations
|
|
38
|
+
index: _providedIndex = 0,
|
|
39
|
+
snapPoints: _providedSnapPoints,
|
|
40
|
+
animateOnMount = _constants2.DEFAULT_ANIMATE_ON_MOUNT,
|
|
41
|
+
enableContentPanningGesture = _constants2.DEFAULT_ENABLE_CONTENT_PANNING_GESTURE,
|
|
42
|
+
enableHandlePanningGesture,
|
|
43
|
+
enableOverDrag = _constants2.DEFAULT_ENABLE_OVER_DRAG,
|
|
44
|
+
enablePanDownToClose = _constants2.DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE,
|
|
45
|
+
enableDynamicSizing = _constants2.DEFAULT_DYNAMIC_SIZING,
|
|
46
|
+
overDragResistanceFactor = _constants2.DEFAULT_OVER_DRAG_RESISTANCE_FACTOR,
|
|
47
|
+
overrideReduceMotion: _providedOverrideReduceMotion,
|
|
48
|
+
// styles
|
|
49
|
+
style,
|
|
50
|
+
containerStyle: _providedContainerStyle,
|
|
51
|
+
backgroundStyle: _providedBackgroundStyle,
|
|
52
|
+
handleStyle: _providedHandleStyle,
|
|
53
|
+
handleIndicatorStyle: _providedHandleIndicatorStyle,
|
|
54
|
+
// hooks
|
|
55
|
+
gestureEventsHandlersHook,
|
|
56
|
+
// keyboard
|
|
57
|
+
keyboardBehavior = _constants2.DEFAULT_KEYBOARD_BEHAVIOR,
|
|
58
|
+
keyboardBlurBehavior = _constants2.DEFAULT_KEYBOARD_BLUR_BEHAVIOR,
|
|
59
|
+
android_keyboardInputMode = _constants2.DEFAULT_KEYBOARD_INPUT_MODE,
|
|
60
|
+
enableBlurKeyboardOnGesture = _constants2.DEFAULT_ENABLE_BLUR_KEYBOARD_ON_GESTURE,
|
|
61
|
+
// layout
|
|
62
|
+
containerLayoutState,
|
|
63
|
+
topInset = 0,
|
|
64
|
+
bottomInset = 0,
|
|
65
|
+
maxDynamicContentSize,
|
|
66
|
+
containerHeight,
|
|
67
|
+
containerOffset,
|
|
68
|
+
// animated callback shared values
|
|
69
|
+
animatedPosition: _providedAnimatedPosition,
|
|
70
|
+
animatedIndex: _providedAnimatedIndex,
|
|
71
|
+
// gestures
|
|
72
|
+
simultaneousHandlers: _providedSimultaneousHandlers,
|
|
73
|
+
waitFor: _providedWaitFor,
|
|
74
|
+
activeOffsetX: _providedActiveOffsetX,
|
|
75
|
+
activeOffsetY: _providedActiveOffsetY,
|
|
76
|
+
failOffsetX: _providedFailOffsetX,
|
|
77
|
+
failOffsetY: _providedFailOffsetY,
|
|
78
|
+
// callbacks
|
|
79
|
+
onChange: _providedOnChange,
|
|
80
|
+
onClose: _providedOnClose,
|
|
81
|
+
onAnimate: _providedOnAnimate,
|
|
82
|
+
// private
|
|
83
|
+
$modal = false,
|
|
84
|
+
detached = false,
|
|
85
|
+
// components
|
|
86
|
+
handleComponent = _bottomSheetHandle.BottomSheetHandle,
|
|
87
|
+
backdropComponent: BackdropComponent,
|
|
88
|
+
backgroundComponent,
|
|
89
|
+
footerComponent,
|
|
90
|
+
children,
|
|
91
|
+
// accessibility
|
|
92
|
+
accessible: _providedAccessible = _constants2.DEFAULT_ACCESSIBLE,
|
|
93
|
+
accessibilityLabel: _providedAccessibilityLabel = _constants2.DEFAULT_ACCESSIBILITY_LABEL,
|
|
94
|
+
accessibilityRole: _providedAccessibilityRole = _constants2.DEFAULT_ACCESSIBILITY_ROLE
|
|
95
|
+
} = props;
|
|
96
|
+
//#endregion
|
|
97
|
+
|
|
98
|
+
//#region validate props
|
|
99
|
+
if (__DEV__) {
|
|
100
|
+
// biome-ignore lint/correctness/useHookAtTopLevel: used in development only.
|
|
101
|
+
(0, _hooks.usePropsValidator)({
|
|
102
|
+
index: _providedIndex,
|
|
103
|
+
snapPoints: _providedSnapPoints,
|
|
104
|
+
enableDynamicSizing,
|
|
105
|
+
topInset,
|
|
106
|
+
bottomInset,
|
|
107
|
+
containerHeight,
|
|
108
|
+
containerOffset
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
//#endregion
|
|
112
|
+
|
|
113
|
+
//#region layout variables
|
|
114
|
+
const animatedLayoutState = (0, _hooks.useAnimatedLayout)(containerLayoutState, topInset, bottomInset, $modal, handleComponent === null);
|
|
115
|
+
const animatedDetentsState = (0, _hooks.useAnimatedDetents)(_providedSnapPoints, animatedLayoutState, enableDynamicSizing, maxDynamicContentSize, detached, $modal, bottomInset);
|
|
116
|
+
const animatedSheetHeight = (0, _reactNativeReanimated.useDerivedValue)(() => {
|
|
117
|
+
const {
|
|
118
|
+
containerHeight
|
|
119
|
+
} = animatedLayoutState.get();
|
|
120
|
+
const {
|
|
121
|
+
highestDetentPosition
|
|
122
|
+
} = animatedDetentsState.get();
|
|
123
|
+
if (highestDetentPosition === undefined) {
|
|
124
|
+
return _constants.INITIAL_LAYOUT_VALUE;
|
|
125
|
+
}
|
|
126
|
+
return containerHeight - highestDetentPosition;
|
|
127
|
+
}, [animatedLayoutState, animatedDetentsState]);
|
|
128
|
+
const animatedCurrentIndex = (0, _hooks.useReactiveSharedValue)(animateOnMount ? -1 : _providedIndex);
|
|
129
|
+
const animatedPosition = (0, _reactNativeReanimated.useSharedValue)(_constants2.INITIAL_POSITION);
|
|
130
|
+
|
|
131
|
+
// conditional
|
|
132
|
+
const isAnimatedOnMount = (0, _reactNativeReanimated.useSharedValue)(!animateOnMount || _providedIndex === -1);
|
|
133
|
+
const isLayoutCalculated = (0, _reactNativeReanimated.useDerivedValue)(() => {
|
|
134
|
+
let isContainerHeightCalculated = false;
|
|
135
|
+
const {
|
|
136
|
+
containerHeight,
|
|
137
|
+
handleHeight
|
|
138
|
+
} = animatedLayoutState.get();
|
|
139
|
+
//container height was provided.
|
|
140
|
+
if (containerHeight !== null || containerHeight !== undefined) {
|
|
141
|
+
isContainerHeightCalculated = true;
|
|
142
|
+
}
|
|
143
|
+
// container height did set.
|
|
144
|
+
if (containerHeight !== _constants.INITIAL_LAYOUT_VALUE) {
|
|
145
|
+
isContainerHeightCalculated = true;
|
|
146
|
+
}
|
|
147
|
+
let isHandleHeightCalculated = false;
|
|
148
|
+
// handle component is null.
|
|
149
|
+
if (handleComponent === null) {
|
|
150
|
+
isHandleHeightCalculated = true;
|
|
151
|
+
}
|
|
152
|
+
// handle height did set.
|
|
153
|
+
if (handleHeight !== _constants.INITIAL_LAYOUT_VALUE) {
|
|
154
|
+
isHandleHeightCalculated = true;
|
|
155
|
+
}
|
|
156
|
+
let isSnapPointsNormalized = false;
|
|
157
|
+
const {
|
|
158
|
+
detents
|
|
159
|
+
} = animatedDetentsState.get();
|
|
160
|
+
// the first snap point did normalized
|
|
161
|
+
if (detents) {
|
|
162
|
+
isSnapPointsNormalized = true;
|
|
163
|
+
}
|
|
164
|
+
return isContainerHeightCalculated && isHandleHeightCalculated && isSnapPointsNormalized;
|
|
165
|
+
}, [animatedLayoutState, animatedDetentsState, handleComponent]);
|
|
166
|
+
const isInTemporaryPosition = (0, _reactNativeReanimated.useSharedValue)(false);
|
|
167
|
+
const animatedContainerHeightDidChange = (0, _reactNativeReanimated.useSharedValue)(false);
|
|
168
|
+
|
|
169
|
+
// gesture
|
|
170
|
+
const animatedContentGestureState = (0, _reactNativeReanimated.useSharedValue)(_reactNativeGestureHandler.State.UNDETERMINED);
|
|
171
|
+
const animatedHandleGestureState = (0, _reactNativeReanimated.useSharedValue)(_reactNativeGestureHandler.State.UNDETERMINED);
|
|
172
|
+
//#endregion
|
|
173
|
+
|
|
174
|
+
//#region hooks variables
|
|
175
|
+
// keyboard
|
|
176
|
+
const {
|
|
177
|
+
state: animatedKeyboardState,
|
|
178
|
+
textInputNodesRef
|
|
179
|
+
} = (0, _hooks.useAnimatedKeyboard)();
|
|
180
|
+
const userReduceMotionSetting = (0, _reactNativeReanimated.useReducedMotion)();
|
|
181
|
+
const reduceMotion = (0, _react.useMemo)(() => {
|
|
182
|
+
return !_providedOverrideReduceMotion || _providedOverrideReduceMotion === _reactNativeReanimated.ReduceMotion.System ? userReduceMotionSetting : _providedOverrideReduceMotion === _reactNativeReanimated.ReduceMotion.Always;
|
|
183
|
+
}, [userReduceMotionSetting, _providedOverrideReduceMotion]);
|
|
184
|
+
//#endregion
|
|
185
|
+
|
|
186
|
+
//#region state/dynamic variables
|
|
187
|
+
// states
|
|
188
|
+
const animatedAnimationState = (0, _reactNativeReanimated.useSharedValue)({
|
|
189
|
+
status: _constants.ANIMATION_STATUS.UNDETERMINED,
|
|
190
|
+
source: _constants.ANIMATION_SOURCE.MOUNT
|
|
191
|
+
});
|
|
192
|
+
const animatedSheetState = (0, _reactNativeReanimated.useDerivedValue)(() => {
|
|
193
|
+
const {
|
|
194
|
+
detents,
|
|
195
|
+
closedDetentPosition
|
|
196
|
+
} = animatedDetentsState.get();
|
|
197
|
+
if (!detents || detents.length === 0 || closedDetentPosition === undefined) {
|
|
198
|
+
return _constants.SHEET_STATE.CLOSED;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// closed position = position >= container height
|
|
202
|
+
if (animatedPosition.value >= closedDetentPosition) {
|
|
203
|
+
return _constants.SHEET_STATE.CLOSED;
|
|
204
|
+
}
|
|
205
|
+
const {
|
|
206
|
+
containerHeight
|
|
207
|
+
} = animatedLayoutState.get();
|
|
208
|
+
// extended position = container height - sheet height
|
|
209
|
+
const extendedPosition = containerHeight - animatedSheetHeight.value;
|
|
210
|
+
if (animatedPosition.value === extendedPosition) {
|
|
211
|
+
return _constants.SHEET_STATE.EXTENDED;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// extended position with keyboard =
|
|
215
|
+
// container height - (sheet height + keyboard height in root container)
|
|
216
|
+
const keyboardHeightInContainer = animatedKeyboardState.get().heightWithinContainer;
|
|
217
|
+
const extendedPositionWithKeyboard = Math.max(0, containerHeight - (animatedSheetHeight.value + keyboardHeightInContainer));
|
|
218
|
+
|
|
219
|
+
// detect if keyboard is open and the sheet is in temporary position
|
|
220
|
+
if (keyboardBehavior === _constants.KEYBOARD_BEHAVIOR.interactive && isInTemporaryPosition.value && animatedPosition.value === extendedPositionWithKeyboard) {
|
|
221
|
+
return _constants.SHEET_STATE.EXTENDED;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// fill parent = 0
|
|
225
|
+
if (animatedPosition.value === 0) {
|
|
226
|
+
return _constants.SHEET_STATE.FILL_PARENT;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// detect if position is below extended point
|
|
230
|
+
if (animatedPosition.value < extendedPosition) {
|
|
231
|
+
return _constants.SHEET_STATE.OVER_EXTENDED;
|
|
232
|
+
}
|
|
233
|
+
return _constants.SHEET_STATE.OPENED;
|
|
234
|
+
}, [animatedLayoutState, animatedDetentsState, animatedKeyboardState, animatedPosition, animatedSheetHeight, isInTemporaryPosition, keyboardBehavior]);
|
|
235
|
+
const {
|
|
236
|
+
state: animatedScrollableState,
|
|
237
|
+
status: animatedScrollableStatus,
|
|
238
|
+
setScrollableRef,
|
|
239
|
+
removeScrollableRef
|
|
240
|
+
} = (0, _hooks.useScrollable)(enableContentPanningGesture, animatedSheetState, animatedKeyboardState, animatedAnimationState);
|
|
241
|
+
// dynamic
|
|
242
|
+
const animatedIndex = (0, _reactNativeReanimated.useDerivedValue)(() => {
|
|
243
|
+
const {
|
|
244
|
+
detents
|
|
245
|
+
} = animatedDetentsState.get();
|
|
246
|
+
if (!detents || detents.length === 0) {
|
|
247
|
+
return -1;
|
|
248
|
+
}
|
|
249
|
+
const adjustedSnapPoints = detents.slice().reverse();
|
|
250
|
+
const adjustedSnapPointsIndexes = detents.slice().map((_, index) => index).reverse();
|
|
251
|
+
const {
|
|
252
|
+
containerHeight
|
|
253
|
+
} = animatedLayoutState.get();
|
|
254
|
+
/**
|
|
255
|
+
* we add the close state index `-1`
|
|
256
|
+
*/
|
|
257
|
+
adjustedSnapPoints.push(containerHeight);
|
|
258
|
+
adjustedSnapPointsIndexes.push(-1);
|
|
259
|
+
const currentIndex = isLayoutCalculated.value ? (0, _reactNativeReanimated.interpolate)(animatedPosition.value, adjustedSnapPoints, adjustedSnapPointsIndexes, _reactNativeReanimated.Extrapolation.CLAMP) : -1;
|
|
260
|
+
const {
|
|
261
|
+
status: animationStatus,
|
|
262
|
+
source: animationSource,
|
|
263
|
+
nextIndex,
|
|
264
|
+
nextPosition
|
|
265
|
+
} = animatedAnimationState.get();
|
|
266
|
+
/**
|
|
267
|
+
* if the sheet is currently running an animation by the keyboard opening,
|
|
268
|
+
* then we clamp the index on android with resize keyboard mode.
|
|
269
|
+
*/
|
|
270
|
+
if (android_keyboardInputMode === _constants.KEYBOARD_INPUT_MODE.adjustResize && animationStatus === _constants.ANIMATION_STATUS.RUNNING && animationSource === _constants.ANIMATION_SOURCE.KEYBOARD && isInTemporaryPosition.value) {
|
|
271
|
+
return Math.max(animatedCurrentIndex.value, currentIndex);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* if the sheet is currently running an animation by snap point change - usually caused
|
|
276
|
+
* by dynamic content height -, then we return the next position index.
|
|
277
|
+
*/
|
|
278
|
+
if (animationStatus === _constants.ANIMATION_STATUS.RUNNING && animationSource === _constants.ANIMATION_SOURCE.SNAP_POINT_CHANGE && nextIndex !== undefined && nextPosition !== undefined) {
|
|
279
|
+
return nextIndex;
|
|
280
|
+
}
|
|
281
|
+
return currentIndex;
|
|
282
|
+
}, [android_keyboardInputMode, animatedAnimationState, animatedLayoutState, animatedCurrentIndex, animatedPosition, animatedDetentsState, isInTemporaryPosition, isLayoutCalculated]);
|
|
283
|
+
//#endregion
|
|
284
|
+
|
|
285
|
+
//#region private methods
|
|
286
|
+
const handleOnChange = (0, _react.useCallback)(function handleOnChange(index, position) {
|
|
287
|
+
if (__DEV__) {
|
|
288
|
+
(0, _utilities.print)({
|
|
289
|
+
component: 'BottomSheet',
|
|
290
|
+
method: 'handleOnChange',
|
|
291
|
+
category: 'callback',
|
|
292
|
+
params: {
|
|
293
|
+
index,
|
|
294
|
+
position
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
if (!_providedOnChange) {
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
const {
|
|
302
|
+
dynamicDetentIndex
|
|
303
|
+
} = animatedDetentsState.get();
|
|
304
|
+
_providedOnChange(index, position, index === dynamicDetentIndex ? _constants.SNAP_POINT_TYPE.DYNAMIC : _constants.SNAP_POINT_TYPE.PROVIDED);
|
|
305
|
+
}, [_providedOnChange, animatedDetentsState]);
|
|
306
|
+
const handleOnAnimate = (0, _react.useCallback)(function handleOnAnimate(targetIndex, targetPosition) {
|
|
307
|
+
if (__DEV__) {
|
|
308
|
+
(0, _utilities.print)({
|
|
309
|
+
component: 'BottomSheet',
|
|
310
|
+
method: 'handleOnAnimate',
|
|
311
|
+
category: 'callback',
|
|
312
|
+
params: {
|
|
313
|
+
toIndex: targetIndex,
|
|
314
|
+
toPosition: targetPosition,
|
|
315
|
+
fromIndex: animatedCurrentIndex.value,
|
|
316
|
+
fromPosition: animatedPosition.value
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
if (targetIndex === animatedCurrentIndex.get()) {
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
if (!_providedOnAnimate) {
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
_providedOnAnimate(animatedCurrentIndex.value, targetIndex, animatedPosition.value, targetPosition);
|
|
327
|
+
}, [_providedOnAnimate, animatedCurrentIndex, animatedPosition]);
|
|
328
|
+
const handleOnClose = (0, _react.useCallback)(function handleOnClose() {
|
|
329
|
+
if (__DEV__) {
|
|
330
|
+
(0, _utilities.print)({
|
|
331
|
+
component: 'BottomSheet',
|
|
332
|
+
method: 'handleOnClose',
|
|
333
|
+
category: 'callback'
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
if (!_providedOnClose) {
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
_providedOnClose();
|
|
340
|
+
}, [_providedOnClose]);
|
|
341
|
+
//#endregion
|
|
342
|
+
|
|
343
|
+
//#region animation
|
|
344
|
+
const stopAnimation = (0, _react.useCallback)(() => {
|
|
345
|
+
'worklet';
|
|
346
|
+
|
|
347
|
+
(0, _reactNativeReanimated.cancelAnimation)(animatedPosition);
|
|
348
|
+
animatedAnimationState.set({
|
|
349
|
+
status: _constants.ANIMATION_STATUS.STOPPED,
|
|
350
|
+
source: _constants.ANIMATION_SOURCE.NONE
|
|
351
|
+
});
|
|
352
|
+
}, [animatedPosition, animatedAnimationState]);
|
|
353
|
+
const animateToPositionCompleted = (0, _react.useCallback)(function animateToPositionCompleted(isFinished) {
|
|
354
|
+
'worklet';
|
|
355
|
+
|
|
356
|
+
if (!isFinished) {
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
const {
|
|
360
|
+
nextIndex,
|
|
361
|
+
nextPosition
|
|
362
|
+
} = animatedAnimationState.get();
|
|
363
|
+
if (__DEV__) {
|
|
364
|
+
(0, _reactNativeReanimated.runOnJS)(_utilities.print)({
|
|
365
|
+
component: 'BottomSheet',
|
|
366
|
+
method: 'animateToPositionCompleted',
|
|
367
|
+
params: {
|
|
368
|
+
currentIndex: animatedCurrentIndex.value,
|
|
369
|
+
nextIndex,
|
|
370
|
+
nextPosition
|
|
371
|
+
}
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
if (nextIndex === undefined || nextPosition === undefined) {
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
// callbacks
|
|
379
|
+
if (nextIndex !== animatedCurrentIndex.get()) {
|
|
380
|
+
(0, _reactNativeReanimated.runOnJS)(handleOnChange)(nextIndex, nextPosition);
|
|
381
|
+
}
|
|
382
|
+
if (nextIndex === -1) {
|
|
383
|
+
(0, _reactNativeReanimated.runOnJS)(handleOnClose)();
|
|
384
|
+
}
|
|
385
|
+
animatedCurrentIndex.set(nextIndex);
|
|
386
|
+
|
|
387
|
+
// reset values
|
|
388
|
+
animatedContainerHeightDidChange.set(false);
|
|
389
|
+
isAnimatedOnMount.set(true);
|
|
390
|
+
animatedAnimationState.set({
|
|
391
|
+
status: _constants.ANIMATION_STATUS.STOPPED,
|
|
392
|
+
source: _constants.ANIMATION_SOURCE.NONE,
|
|
393
|
+
nextIndex: undefined,
|
|
394
|
+
nextPosition: undefined,
|
|
395
|
+
isForcedClosing: undefined
|
|
396
|
+
});
|
|
397
|
+
}, [handleOnChange, handleOnClose, animatedCurrentIndex, animatedAnimationState, animatedContainerHeightDidChange, isAnimatedOnMount]);
|
|
398
|
+
const animateToPosition = (0, _react.useCallback)(function animateToPosition(position, source, velocity = 0, configs) {
|
|
399
|
+
'worklet';
|
|
400
|
+
|
|
401
|
+
if (__DEV__) {
|
|
402
|
+
(0, _reactNativeReanimated.runOnJS)(_utilities.print)({
|
|
403
|
+
component: 'BottomSheet',
|
|
404
|
+
method: 'animateToPosition',
|
|
405
|
+
params: {
|
|
406
|
+
currentPosition: animatedPosition.value,
|
|
407
|
+
nextPosition: position,
|
|
408
|
+
source
|
|
409
|
+
}
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
if (position === undefined) {
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
415
|
+
if (position === animatedPosition.get()) {
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
// early exit if there is a running animation to
|
|
420
|
+
// the same position
|
|
421
|
+
const {
|
|
422
|
+
status: animationStatus,
|
|
423
|
+
nextPosition
|
|
424
|
+
} = animatedAnimationState.get();
|
|
425
|
+
if (animationStatus === _constants.ANIMATION_STATUS.RUNNING && position === nextPosition) {
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
// stop animation if it is running
|
|
430
|
+
if (animationStatus === _constants.ANIMATION_STATUS.RUNNING) {
|
|
431
|
+
stopAnimation();
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* offset the position if keyboard is shown and behavior not extend.
|
|
436
|
+
*/
|
|
437
|
+
let offset = 0;
|
|
438
|
+
const {
|
|
439
|
+
status,
|
|
440
|
+
heightWithinContainer
|
|
441
|
+
} = animatedKeyboardState.get();
|
|
442
|
+
const sheetState = animatedSheetState.get();
|
|
443
|
+
if (status === _constants.KEYBOARD_STATUS.SHOWN && keyboardBehavior !== _constants.KEYBOARD_BEHAVIOR.extend && ([_constants.ANIMATION_SOURCE.KEYBOARD, _constants.ANIMATION_SOURCE.SNAP_POINT_CHANGE].includes(source) || sheetState === _constants.SHEET_STATE.OVER_EXTENDED)) {
|
|
444
|
+
offset = heightWithinContainer;
|
|
445
|
+
}
|
|
446
|
+
const {
|
|
447
|
+
detents,
|
|
448
|
+
closedDetentPosition,
|
|
449
|
+
highestDetentPosition
|
|
450
|
+
} = animatedDetentsState.get();
|
|
451
|
+
let index = detents?.indexOf(position + offset) ?? -1;
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* because keyboard position is not part of the detents array,
|
|
455
|
+
* we will need to manually set the index to the highest detent index.
|
|
456
|
+
*/
|
|
457
|
+
if (index === -1 && status === _constants.KEYBOARD_STATUS.SHOWN && position !== closedDetentPosition) {
|
|
458
|
+
index = highestDetentPosition ?? _constants2.DEFAULT_KEYBOARD_INDEX;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* set the animation state
|
|
463
|
+
*/
|
|
464
|
+
animatedAnimationState.set(state => {
|
|
465
|
+
'worklet';
|
|
466
|
+
|
|
467
|
+
return {
|
|
468
|
+
...state,
|
|
469
|
+
status: _constants.ANIMATION_STATUS.RUNNING,
|
|
470
|
+
source,
|
|
471
|
+
nextIndex: index,
|
|
472
|
+
nextPosition: position
|
|
473
|
+
};
|
|
474
|
+
});
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* fire `onAnimate` callback
|
|
478
|
+
*/
|
|
479
|
+
(0, _reactNativeReanimated.runOnJS)(handleOnAnimate)(index, position);
|
|
480
|
+
|
|
481
|
+
/**
|
|
482
|
+
* start animation
|
|
483
|
+
*/
|
|
484
|
+
animatedPosition.value = (0, _utilities.animate)({
|
|
485
|
+
point: position,
|
|
486
|
+
configs: configs || _providedAnimationConfigs,
|
|
487
|
+
velocity,
|
|
488
|
+
overrideReduceMotion: _providedOverrideReduceMotion,
|
|
489
|
+
onComplete: animateToPositionCompleted
|
|
490
|
+
});
|
|
491
|
+
}, [handleOnAnimate, stopAnimation, animateToPositionCompleted, keyboardBehavior, _providedAnimationConfigs, _providedOverrideReduceMotion, animatedDetentsState, animatedAnimationState, animatedKeyboardState, animatedPosition, animatedSheetState]);
|
|
492
|
+
/**
|
|
493
|
+
* Set to position without animation.
|
|
494
|
+
*
|
|
495
|
+
* @param targetPosition position to be set.
|
|
496
|
+
*/
|
|
497
|
+
const setToPosition = (0, _react.useCallback)(function setToPosition(targetPosition) {
|
|
498
|
+
'worklet';
|
|
499
|
+
|
|
500
|
+
if (targetPosition === undefined || targetPosition !== targetPosition) {
|
|
501
|
+
return;
|
|
502
|
+
}
|
|
503
|
+
if (targetPosition === animatedPosition.get() && !animatedContainerHeightDidChange.value) {
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
506
|
+
const {
|
|
507
|
+
status: animationStatus,
|
|
508
|
+
nextPosition
|
|
509
|
+
} = animatedAnimationState.get();
|
|
510
|
+
|
|
511
|
+
// early exit if there is a running animation to
|
|
512
|
+
// the same position
|
|
513
|
+
if (animationStatus === _constants.ANIMATION_STATUS.RUNNING && targetPosition === nextPosition) {
|
|
514
|
+
return;
|
|
515
|
+
}
|
|
516
|
+
if (__DEV__) {
|
|
517
|
+
(0, _reactNativeReanimated.runOnJS)(_utilities.print)({
|
|
518
|
+
component: 'BottomSheet',
|
|
519
|
+
method: 'setToPosition',
|
|
520
|
+
params: {
|
|
521
|
+
currentPosition: animatedPosition.value,
|
|
522
|
+
targetPosition
|
|
523
|
+
}
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* store next position
|
|
529
|
+
*/
|
|
530
|
+
const {
|
|
531
|
+
detents
|
|
532
|
+
} = animatedDetentsState.get();
|
|
533
|
+
const index = detents?.indexOf(targetPosition) ?? -1;
|
|
534
|
+
animatedAnimationState.set(state => {
|
|
535
|
+
'worklet';
|
|
536
|
+
|
|
537
|
+
return {
|
|
538
|
+
...state,
|
|
539
|
+
nextPosition: targetPosition,
|
|
540
|
+
nextIndex: index
|
|
541
|
+
};
|
|
542
|
+
});
|
|
543
|
+
stopAnimation();
|
|
544
|
+
|
|
545
|
+
// set values
|
|
546
|
+
animatedPosition.value = targetPosition;
|
|
547
|
+
animatedContainerHeightDidChange.value = false;
|
|
548
|
+
}, [stopAnimation, animatedPosition, animatedContainerHeightDidChange, animatedAnimationState, animatedDetentsState]);
|
|
549
|
+
//#endregion
|
|
550
|
+
|
|
551
|
+
//#region private methods
|
|
552
|
+
/**
|
|
553
|
+
* Calculate and evaluate the current position based on multiple
|
|
554
|
+
* local states.
|
|
555
|
+
*/
|
|
556
|
+
const getEvaluatedPosition = (0, _react.useCallback)(function getEvaluatedPosition(source) {
|
|
557
|
+
'worklet';
|
|
558
|
+
|
|
559
|
+
const currentIndex = animatedCurrentIndex.value;
|
|
560
|
+
const {
|
|
561
|
+
detents,
|
|
562
|
+
highestDetentPosition,
|
|
563
|
+
closedDetentPosition
|
|
564
|
+
} = animatedDetentsState.get();
|
|
565
|
+
const keyboardStatus = animatedKeyboardState.get().status;
|
|
566
|
+
if (detents === undefined || highestDetentPosition === undefined || closedDetentPosition === undefined) {
|
|
567
|
+
return;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* if the keyboard blur behavior is restore and keyboard is hidden,
|
|
572
|
+
* then we return the previous snap point.
|
|
573
|
+
*/
|
|
574
|
+
if (source === _constants.ANIMATION_SOURCE.KEYBOARD && keyboardBlurBehavior === _constants.KEYBOARD_BLUR_BEHAVIOR.restore && keyboardStatus === _constants.KEYBOARD_STATUS.HIDDEN && animatedContentGestureState.value !== _reactNativeGestureHandler.State.ACTIVE && animatedHandleGestureState.value !== _reactNativeGestureHandler.State.ACTIVE) {
|
|
575
|
+
isInTemporaryPosition.value = false;
|
|
576
|
+
const nextPosition = detents[currentIndex];
|
|
577
|
+
return nextPosition;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* if the keyboard appearance behavior is extend and keyboard is shown,
|
|
582
|
+
* then we return the heights snap point.
|
|
583
|
+
*/
|
|
584
|
+
if (keyboardBehavior === _constants.KEYBOARD_BEHAVIOR.extend && keyboardStatus === _constants.KEYBOARD_STATUS.SHOWN) {
|
|
585
|
+
return highestDetentPosition;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
/**
|
|
589
|
+
* if the keyboard appearance behavior is fill parent and keyboard is shown,
|
|
590
|
+
* then we return 0 ( full screen ).
|
|
591
|
+
*/
|
|
592
|
+
if (keyboardBehavior === _constants.KEYBOARD_BEHAVIOR.fillParent && keyboardStatus === _constants.KEYBOARD_STATUS.SHOWN) {
|
|
593
|
+
isInTemporaryPosition.value = true;
|
|
594
|
+
return 0;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* if the keyboard appearance behavior is interactive and keyboard is shown,
|
|
599
|
+
* then we return the heights points minus the keyboard in container height.
|
|
600
|
+
*/
|
|
601
|
+
if (keyboardBehavior === _constants.KEYBOARD_BEHAVIOR.interactive && keyboardStatus === _constants.KEYBOARD_STATUS.SHOWN &&
|
|
602
|
+
// ensure that this logic does not run on android
|
|
603
|
+
// with resize input mode
|
|
604
|
+
!(_reactNative.Platform.OS === 'android' && android_keyboardInputMode === 'adjustResize')) {
|
|
605
|
+
isInTemporaryPosition.value = true;
|
|
606
|
+
const keyboardHeightInContainer = animatedKeyboardState.get().heightWithinContainer;
|
|
607
|
+
return Math.max(0, highestDetentPosition - keyboardHeightInContainer);
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* if the bottom sheet is in temporary position, then we return
|
|
612
|
+
* the current position.
|
|
613
|
+
*/
|
|
614
|
+
if (isInTemporaryPosition.value) {
|
|
615
|
+
return animatedPosition.value;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
/**
|
|
619
|
+
* if the bottom sheet did not animate on mount,
|
|
620
|
+
* then we return the provided index or the closed position.
|
|
621
|
+
*/
|
|
622
|
+
if (!isAnimatedOnMount.value) {
|
|
623
|
+
return _providedIndex === -1 ? closedDetentPosition : detents[_providedIndex];
|
|
624
|
+
}
|
|
625
|
+
const {
|
|
626
|
+
status,
|
|
627
|
+
nextIndex,
|
|
628
|
+
nextPosition
|
|
629
|
+
} = animatedAnimationState.get();
|
|
630
|
+
|
|
631
|
+
/**
|
|
632
|
+
* if the evaluated position is for a snap change source while the sheet is currently running
|
|
633
|
+
* an animation and the next position is different than the detent at next index,
|
|
634
|
+
* then we return the detent at next index.
|
|
635
|
+
*
|
|
636
|
+
* https://github.com/gorhom/react-native-bottom-sheet/issues/2431
|
|
637
|
+
*/
|
|
638
|
+
if (source === _constants.ANIMATION_SOURCE.SNAP_POINT_CHANGE && status === _constants.ANIMATION_STATUS.RUNNING && nextIndex !== undefined && nextPosition !== undefined && detents[nextIndex] !== nextPosition) {
|
|
639
|
+
return detents[nextIndex];
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
/**
|
|
643
|
+
* return the current index position.
|
|
644
|
+
*/
|
|
645
|
+
return detents[currentIndex];
|
|
646
|
+
}, [animatedContentGestureState, animatedCurrentIndex, animatedHandleGestureState, animatedAnimationState, animatedKeyboardState, animatedPosition, animatedDetentsState, isInTemporaryPosition, isAnimatedOnMount, keyboardBehavior, keyboardBlurBehavior, _providedIndex, android_keyboardInputMode]);
|
|
647
|
+
|
|
648
|
+
/**
|
|
649
|
+
* Evaluate the bottom sheet position based based on a event source and other local states.
|
|
650
|
+
*/
|
|
651
|
+
const evaluatePosition = (0, _react.useCallback)(function evaluatePosition(source, animationConfigs) {
|
|
652
|
+
'worklet';
|
|
653
|
+
|
|
654
|
+
const {
|
|
655
|
+
status: animationStatus,
|
|
656
|
+
nextIndex,
|
|
657
|
+
isForcedClosing
|
|
658
|
+
} = animatedAnimationState.get();
|
|
659
|
+
const {
|
|
660
|
+
detents,
|
|
661
|
+
closedDetentPosition
|
|
662
|
+
} = animatedDetentsState.get();
|
|
663
|
+
if (detents === undefined || detents.length === 0 || closedDetentPosition === undefined) {
|
|
664
|
+
return;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
/**
|
|
668
|
+
* if a force closing is running and source not from user, then we early exit
|
|
669
|
+
*/
|
|
670
|
+
if (isForcedClosing && source !== _constants.ANIMATION_SOURCE.USER) {
|
|
671
|
+
return;
|
|
672
|
+
}
|
|
673
|
+
/**
|
|
674
|
+
* when evaluating the position while layout is not calculated, then we early exit till it is.
|
|
675
|
+
*/
|
|
676
|
+
if (!isLayoutCalculated.value) {
|
|
677
|
+
return;
|
|
678
|
+
}
|
|
679
|
+
const proposedPosition = getEvaluatedPosition(source);
|
|
680
|
+
if (proposedPosition === undefined) {
|
|
681
|
+
return;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
/**
|
|
685
|
+
* when evaluating the position while the mount animation not been handled,
|
|
686
|
+
* then we evaluate on mount use cases.
|
|
687
|
+
*/
|
|
688
|
+
if (!isAnimatedOnMount.value) {
|
|
689
|
+
/**
|
|
690
|
+
* if animate on mount is set to true, then we animate to the propose position,
|
|
691
|
+
* else, we set the position with out animation.
|
|
692
|
+
*/
|
|
693
|
+
if (animateOnMount) {
|
|
694
|
+
animateToPosition(proposedPosition, _constants.ANIMATION_SOURCE.MOUNT, undefined, animationConfigs);
|
|
695
|
+
} else {
|
|
696
|
+
setToPosition(proposedPosition);
|
|
697
|
+
isAnimatedOnMount.value = true;
|
|
698
|
+
}
|
|
699
|
+
return;
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
/**
|
|
703
|
+
* when evaluating the position while the bottom sheet is animating.
|
|
704
|
+
*/
|
|
705
|
+
if (animationStatus === _constants.ANIMATION_STATUS.RUNNING) {
|
|
706
|
+
const nextPositionIndex = nextIndex ?? _constants2.INITIAL_VALUE;
|
|
707
|
+
/**
|
|
708
|
+
* when evaluating the position while the bottom sheet is
|
|
709
|
+
* closing, then we force closing the bottom sheet with no animation.
|
|
710
|
+
*/
|
|
711
|
+
if (nextPositionIndex === -1 && !isInTemporaryPosition.value) {
|
|
712
|
+
setToPosition(closedDetentPosition);
|
|
713
|
+
return;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
/**
|
|
717
|
+
* when evaluating the position while it's animating to
|
|
718
|
+
* a position other than the current position, then we
|
|
719
|
+
* restart the animation.
|
|
720
|
+
*/
|
|
721
|
+
if (nextPositionIndex !== animatedCurrentIndex.value) {
|
|
722
|
+
animateToPosition(detents[nextPositionIndex], source, undefined, animationConfigs);
|
|
723
|
+
return;
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
/**
|
|
728
|
+
* when evaluating the position while the bottom sheet is in closed
|
|
729
|
+
* position and not animating, we re-set the position to closed position.
|
|
730
|
+
*/
|
|
731
|
+
if (animationStatus !== _constants.ANIMATION_STATUS.RUNNING && animatedCurrentIndex.value === -1) {
|
|
732
|
+
/**
|
|
733
|
+
* early exit if reduce motion is enabled and index is out of sync with position.
|
|
734
|
+
*/
|
|
735
|
+
if (reduceMotion && detents[animatedIndex.value] !== animatedPosition.value) {
|
|
736
|
+
return;
|
|
737
|
+
}
|
|
738
|
+
setToPosition(closedDetentPosition);
|
|
739
|
+
return;
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
/**
|
|
743
|
+
* when evaluating the position after the container resize, then we
|
|
744
|
+
* force the bottom sheet to the proposed position with no
|
|
745
|
+
* animation.
|
|
746
|
+
*/
|
|
747
|
+
if (animatedContainerHeightDidChange.value) {
|
|
748
|
+
setToPosition(proposedPosition);
|
|
749
|
+
return;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
/**
|
|
753
|
+
* we fall back to the proposed position.
|
|
754
|
+
*/
|
|
755
|
+
animateToPosition(proposedPosition, source, undefined, animationConfigs);
|
|
756
|
+
}, [getEvaluatedPosition, animateToPosition, setToPosition, reduceMotion, animateOnMount, animatedAnimationState, animatedContainerHeightDidChange, animatedCurrentIndex, animatedIndex, animatedPosition, animatedDetentsState, isAnimatedOnMount, isInTemporaryPosition, isLayoutCalculated]);
|
|
757
|
+
//#endregion
|
|
758
|
+
|
|
759
|
+
//#region public methods
|
|
760
|
+
const handleSnapToIndex = (0, _hooks.useStableCallback)(function handleSnapToIndex(index, animationConfigs) {
|
|
761
|
+
const {
|
|
762
|
+
detents
|
|
763
|
+
} = animatedDetentsState.get();
|
|
764
|
+
const isLayoutReady = isLayoutCalculated.get();
|
|
765
|
+
if (detents === undefined || detents.length === 0) {
|
|
766
|
+
return;
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
// early exit if layout is not ready yet.
|
|
770
|
+
if (!isLayoutReady) {
|
|
771
|
+
return;
|
|
772
|
+
}
|
|
773
|
+
(0, _invariant.default)(index >= -1 && index <= detents.length - 1, `'index' was provided but out of the provided snap points range! expected value to be between -1, ${detents.length - 1}`);
|
|
774
|
+
if (__DEV__) {
|
|
775
|
+
(0, _utilities.print)({
|
|
776
|
+
component: 'BottomSheet',
|
|
777
|
+
method: 'handleSnapToIndex',
|
|
778
|
+
params: {
|
|
779
|
+
index
|
|
780
|
+
}
|
|
781
|
+
});
|
|
782
|
+
}
|
|
783
|
+
const targetPosition = detents[index];
|
|
784
|
+
|
|
785
|
+
/**
|
|
786
|
+
* exit method if :
|
|
787
|
+
* - layout is not calculated.
|
|
788
|
+
* - already animating to next position.
|
|
789
|
+
* - sheet is forced closing.
|
|
790
|
+
*/
|
|
791
|
+
const {
|
|
792
|
+
nextPosition,
|
|
793
|
+
nextIndex,
|
|
794
|
+
isForcedClosing
|
|
795
|
+
} = animatedAnimationState.get();
|
|
796
|
+
if (!isLayoutCalculated.value || index === nextIndex || targetPosition === nextPosition || isForcedClosing) {
|
|
797
|
+
return;
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
/**
|
|
801
|
+
* reset temporary position boolean.
|
|
802
|
+
*/
|
|
803
|
+
isInTemporaryPosition.value = false;
|
|
804
|
+
(0, _reactNativeReanimated.runOnUI)(animateToPosition)(targetPosition, _constants.ANIMATION_SOURCE.USER, 0, animationConfigs);
|
|
805
|
+
});
|
|
806
|
+
const handleSnapToPosition = (0, _react.useCallback)(function handleSnapToPosition(position, animationConfigs) {
|
|
807
|
+
'worklet';
|
|
808
|
+
|
|
809
|
+
if (__DEV__) {
|
|
810
|
+
(0, _utilities.print)({
|
|
811
|
+
component: 'BottomSheet',
|
|
812
|
+
method: 'handleSnapToPosition',
|
|
813
|
+
params: {
|
|
814
|
+
position
|
|
815
|
+
}
|
|
816
|
+
});
|
|
817
|
+
}
|
|
818
|
+
const {
|
|
819
|
+
containerHeight
|
|
820
|
+
} = animatedLayoutState.get();
|
|
821
|
+
/**
|
|
822
|
+
* normalized provided position.
|
|
823
|
+
*/
|
|
824
|
+
const targetPosition = (0, _utilities.normalizeSnapPoint)(position, containerHeight);
|
|
825
|
+
|
|
826
|
+
/**
|
|
827
|
+
* exit method if :
|
|
828
|
+
* - layout is not calculated.
|
|
829
|
+
* - already animating to next position.
|
|
830
|
+
* - sheet is forced closing.
|
|
831
|
+
*/
|
|
832
|
+
const {
|
|
833
|
+
nextPosition,
|
|
834
|
+
isForcedClosing
|
|
835
|
+
} = animatedAnimationState.get();
|
|
836
|
+
if (!isLayoutCalculated || targetPosition === nextPosition || isForcedClosing) {
|
|
837
|
+
return;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
/**
|
|
841
|
+
* mark the new position as temporary.
|
|
842
|
+
*/
|
|
843
|
+
isInTemporaryPosition.value = true;
|
|
844
|
+
(0, _reactNativeReanimated.runOnUI)(animateToPosition)(targetPosition, _constants.ANIMATION_SOURCE.USER, 0, animationConfigs);
|
|
845
|
+
}, [animateToPosition, isInTemporaryPosition, isLayoutCalculated, animatedLayoutState, animatedAnimationState]);
|
|
846
|
+
const handleClose = (0, _react.useCallback)(function handleClose(animationConfigs) {
|
|
847
|
+
if (__DEV__) {
|
|
848
|
+
(0, _utilities.print)({
|
|
849
|
+
component: 'BottomSheet',
|
|
850
|
+
method: 'handleClose'
|
|
851
|
+
});
|
|
852
|
+
}
|
|
853
|
+
const closedDetentPosition = animatedDetentsState.get().closedDetentPosition;
|
|
854
|
+
if (closedDetentPosition === undefined) {
|
|
855
|
+
return;
|
|
856
|
+
}
|
|
857
|
+
const targetPosition = closedDetentPosition;
|
|
858
|
+
|
|
859
|
+
/**
|
|
860
|
+
* exit method if :
|
|
861
|
+
* - layout is not calculated.
|
|
862
|
+
* - already animating to next position.
|
|
863
|
+
* - sheet is forced closing.
|
|
864
|
+
*/
|
|
865
|
+
const {
|
|
866
|
+
nextPosition,
|
|
867
|
+
isForcedClosing
|
|
868
|
+
} = animatedAnimationState.get();
|
|
869
|
+
if (!isLayoutCalculated.value || targetPosition === nextPosition || isForcedClosing) {
|
|
870
|
+
return;
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
/**
|
|
874
|
+
* reset temporary position variable.
|
|
875
|
+
*/
|
|
876
|
+
isInTemporaryPosition.value = false;
|
|
877
|
+
(0, _reactNativeReanimated.runOnUI)(animateToPosition)(targetPosition, _constants.ANIMATION_SOURCE.USER, 0, animationConfigs);
|
|
878
|
+
}, [animateToPosition, isLayoutCalculated, isInTemporaryPosition, animatedDetentsState, animatedAnimationState]);
|
|
879
|
+
const handleForceClose = (0, _react.useCallback)(function handleForceClose(animationConfigs) {
|
|
880
|
+
if (__DEV__) {
|
|
881
|
+
(0, _utilities.print)({
|
|
882
|
+
component: 'BottomSheet',
|
|
883
|
+
method: 'handleForceClose'
|
|
884
|
+
});
|
|
885
|
+
}
|
|
886
|
+
const closedDetentPosition = animatedDetentsState.get().closedDetentPosition;
|
|
887
|
+
if (closedDetentPosition === undefined) {
|
|
888
|
+
return;
|
|
889
|
+
}
|
|
890
|
+
const targetPosition = closedDetentPosition;
|
|
891
|
+
|
|
892
|
+
/**
|
|
893
|
+
* exit method if :
|
|
894
|
+
* - already animating to next position.
|
|
895
|
+
* - sheet is forced closing.
|
|
896
|
+
*/
|
|
897
|
+
const {
|
|
898
|
+
nextPosition,
|
|
899
|
+
isForcedClosing
|
|
900
|
+
} = animatedAnimationState.get();
|
|
901
|
+
if (targetPosition === nextPosition || isForcedClosing) {
|
|
902
|
+
return;
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
/**
|
|
906
|
+
* reset temporary position variable.
|
|
907
|
+
*/
|
|
908
|
+
isInTemporaryPosition.value = false;
|
|
909
|
+
|
|
910
|
+
/**
|
|
911
|
+
* set force closing variable.
|
|
912
|
+
*/
|
|
913
|
+
animatedAnimationState.set(state => {
|
|
914
|
+
'worklet';
|
|
915
|
+
|
|
916
|
+
return {
|
|
917
|
+
...state,
|
|
918
|
+
isForcedClosing: true
|
|
919
|
+
};
|
|
920
|
+
});
|
|
921
|
+
(0, _reactNativeReanimated.runOnUI)(animateToPosition)(targetPosition, _constants.ANIMATION_SOURCE.USER, 0, animationConfigs);
|
|
922
|
+
}, [animateToPosition, isInTemporaryPosition, animatedDetentsState, animatedAnimationState]);
|
|
923
|
+
const handleExpand = (0, _react.useCallback)(function handleExpand(animationConfigs) {
|
|
924
|
+
if (__DEV__) {
|
|
925
|
+
(0, _utilities.print)({
|
|
926
|
+
component: 'BottomSheet',
|
|
927
|
+
method: 'handleExpand'
|
|
928
|
+
});
|
|
929
|
+
}
|
|
930
|
+
const {
|
|
931
|
+
detents
|
|
932
|
+
} = animatedDetentsState.get();
|
|
933
|
+
if (detents === undefined || detents.length === 0) {
|
|
934
|
+
return;
|
|
935
|
+
}
|
|
936
|
+
const targetIndex = detents.length - 1;
|
|
937
|
+
const targetPosition = detents[targetIndex];
|
|
938
|
+
|
|
939
|
+
/**
|
|
940
|
+
* exit method if :
|
|
941
|
+
* - layout is not calculated.
|
|
942
|
+
* - already animating to next position.
|
|
943
|
+
* - sheet is forced closing.
|
|
944
|
+
*/
|
|
945
|
+
const {
|
|
946
|
+
nextPosition,
|
|
947
|
+
nextIndex,
|
|
948
|
+
isForcedClosing
|
|
949
|
+
} = animatedAnimationState.get();
|
|
950
|
+
if (!isLayoutCalculated.value || targetIndex === nextIndex || targetPosition === nextPosition || isForcedClosing) {
|
|
951
|
+
return;
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
/**
|
|
955
|
+
* reset temporary position boolean.
|
|
956
|
+
*/
|
|
957
|
+
isInTemporaryPosition.value = false;
|
|
958
|
+
(0, _reactNativeReanimated.runOnUI)(animateToPosition)(targetPosition, _constants.ANIMATION_SOURCE.USER, 0, animationConfigs);
|
|
959
|
+
}, [animateToPosition, isInTemporaryPosition, isLayoutCalculated, animatedDetentsState, animatedAnimationState]);
|
|
960
|
+
const handleCollapse = (0, _react.useCallback)(function handleCollapse(animationConfigs) {
|
|
961
|
+
if (__DEV__) {
|
|
962
|
+
(0, _utilities.print)({
|
|
963
|
+
component: 'BottomSheet',
|
|
964
|
+
method: 'handleCollapse'
|
|
965
|
+
});
|
|
966
|
+
}
|
|
967
|
+
const {
|
|
968
|
+
detents
|
|
969
|
+
} = animatedDetentsState.get();
|
|
970
|
+
if (detents === undefined || detents.length === 0) {
|
|
971
|
+
return;
|
|
972
|
+
}
|
|
973
|
+
const targetPosition = detents[0];
|
|
974
|
+
|
|
975
|
+
/**
|
|
976
|
+
* exit method if :
|
|
977
|
+
* - layout is not calculated.
|
|
978
|
+
* - already animating to next position.
|
|
979
|
+
* - sheet is forced closing.
|
|
980
|
+
*/
|
|
981
|
+
const {
|
|
982
|
+
nextPosition,
|
|
983
|
+
nextIndex,
|
|
984
|
+
isForcedClosing
|
|
985
|
+
} = animatedAnimationState.get();
|
|
986
|
+
if (!isLayoutCalculated || nextIndex === 0 || targetPosition === nextPosition || isForcedClosing) {
|
|
987
|
+
return;
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
/**
|
|
991
|
+
* reset temporary position boolean.
|
|
992
|
+
*/
|
|
993
|
+
isInTemporaryPosition.value = false;
|
|
994
|
+
(0, _reactNativeReanimated.runOnUI)(animateToPosition)(targetPosition, _constants.ANIMATION_SOURCE.USER, 0, animationConfigs);
|
|
995
|
+
}, [animateToPosition, isLayoutCalculated, isInTemporaryPosition, animatedDetentsState, animatedAnimationState]);
|
|
996
|
+
(0, _react.useImperativeHandle)(ref, () => ({
|
|
997
|
+
snapToIndex: handleSnapToIndex,
|
|
998
|
+
snapToPosition: handleSnapToPosition,
|
|
999
|
+
expand: handleExpand,
|
|
1000
|
+
collapse: handleCollapse,
|
|
1001
|
+
close: handleClose,
|
|
1002
|
+
forceClose: handleForceClose
|
|
1003
|
+
}));
|
|
1004
|
+
//#endregion
|
|
1005
|
+
|
|
1006
|
+
//#region contexts variables
|
|
1007
|
+
const internalContextVariables = (0, _react.useMemo)(() => ({
|
|
1008
|
+
textInputNodesRef,
|
|
1009
|
+
enableContentPanningGesture,
|
|
1010
|
+
enableDynamicSizing,
|
|
1011
|
+
overDragResistanceFactor,
|
|
1012
|
+
enableOverDrag,
|
|
1013
|
+
enablePanDownToClose,
|
|
1014
|
+
animatedAnimationState,
|
|
1015
|
+
animatedSheetState,
|
|
1016
|
+
animatedScrollableState,
|
|
1017
|
+
animatedScrollableStatus,
|
|
1018
|
+
animatedContentGestureState,
|
|
1019
|
+
animatedHandleGestureState,
|
|
1020
|
+
animatedKeyboardState,
|
|
1021
|
+
animatedLayoutState,
|
|
1022
|
+
animatedIndex,
|
|
1023
|
+
animatedPosition,
|
|
1024
|
+
animatedSheetHeight,
|
|
1025
|
+
animatedDetentsState,
|
|
1026
|
+
isInTemporaryPosition,
|
|
1027
|
+
simultaneousHandlers: _providedSimultaneousHandlers,
|
|
1028
|
+
waitFor: _providedWaitFor,
|
|
1029
|
+
activeOffsetX: _providedActiveOffsetX,
|
|
1030
|
+
activeOffsetY: _providedActiveOffsetY,
|
|
1031
|
+
failOffsetX: _providedFailOffsetX,
|
|
1032
|
+
failOffsetY: _providedFailOffsetY,
|
|
1033
|
+
enableBlurKeyboardOnGesture,
|
|
1034
|
+
animateToPosition,
|
|
1035
|
+
stopAnimation,
|
|
1036
|
+
setScrollableRef,
|
|
1037
|
+
removeScrollableRef
|
|
1038
|
+
}), [textInputNodesRef, animatedIndex, animatedPosition, animatedSheetHeight, animatedLayoutState, animatedContentGestureState, animatedHandleGestureState, animatedAnimationState, animatedKeyboardState, animatedSheetState, animatedScrollableState, animatedScrollableStatus, animatedDetentsState, isInTemporaryPosition, enableContentPanningGesture, overDragResistanceFactor, enableOverDrag, enablePanDownToClose, enableDynamicSizing, enableBlurKeyboardOnGesture, _providedSimultaneousHandlers, _providedWaitFor, _providedActiveOffsetX, _providedActiveOffsetY, _providedFailOffsetX, _providedFailOffsetY, setScrollableRef, removeScrollableRef, animateToPosition, stopAnimation]);
|
|
1039
|
+
const externalContextVariables = (0, _react.useMemo)(() => ({
|
|
1040
|
+
animatedIndex,
|
|
1041
|
+
animatedPosition,
|
|
1042
|
+
snapToIndex: handleSnapToIndex,
|
|
1043
|
+
snapToPosition: handleSnapToPosition,
|
|
1044
|
+
expand: handleExpand,
|
|
1045
|
+
collapse: handleCollapse,
|
|
1046
|
+
close: handleClose,
|
|
1047
|
+
forceClose: handleForceClose
|
|
1048
|
+
}), [animatedIndex, animatedPosition, handleSnapToIndex, handleSnapToPosition, handleExpand, handleCollapse, handleClose, handleForceClose]);
|
|
1049
|
+
//#endregion
|
|
1050
|
+
|
|
1051
|
+
//#region effects
|
|
1052
|
+
(0, _reactNativeReanimated.useAnimatedReaction)(() => animatedLayoutState.get().containerHeight, (result, previous) => {
|
|
1053
|
+
if (result === _constants.INITIAL_LAYOUT_VALUE) {
|
|
1054
|
+
return;
|
|
1055
|
+
}
|
|
1056
|
+
animatedContainerHeightDidChange.value = result !== previous;
|
|
1057
|
+
const {
|
|
1058
|
+
closedDetentPosition
|
|
1059
|
+
} = animatedDetentsState.get();
|
|
1060
|
+
if (closedDetentPosition === undefined) {
|
|
1061
|
+
return;
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
/**
|
|
1065
|
+
* When user close the bottom sheet while the keyboard open on Android with
|
|
1066
|
+
* software keyboard layout mode set to resize, the close position would be
|
|
1067
|
+
* set to the container height - the keyboard height, and when the keyboard
|
|
1068
|
+
* closes, the container height and here we restart the animation again.
|
|
1069
|
+
*
|
|
1070
|
+
* [read more](https://github.com/gorhom/react-native-bottom-sheet/issues/2163)
|
|
1071
|
+
*/
|
|
1072
|
+
const {
|
|
1073
|
+
status: animationStatus,
|
|
1074
|
+
source: animationSource,
|
|
1075
|
+
nextIndex
|
|
1076
|
+
} = animatedAnimationState.get();
|
|
1077
|
+
if (animationStatus === _constants.ANIMATION_STATUS.RUNNING && animationSource === _constants.ANIMATION_SOURCE.GESTURE && nextIndex === -1) {
|
|
1078
|
+
animateToPosition(closedDetentPosition, _constants.ANIMATION_SOURCE.GESTURE);
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
/**
|
|
1082
|
+
* On Android with adjustResize, when the container grows back after
|
|
1083
|
+
* keyboard dismiss, force evaluate position to avoid race condition
|
|
1084
|
+
* between keyboardDidHide and container resize events.
|
|
1085
|
+
*/
|
|
1086
|
+
if (_reactNative.Platform.OS === 'android' && android_keyboardInputMode === _constants.KEYBOARD_INPUT_MODE.adjustResize && previous !== null && previous !== _constants.INITIAL_LAYOUT_VALUE && result > previous) {
|
|
1087
|
+
evaluatePosition(_constants.ANIMATION_SOURCE.CONTAINER_RESIZE);
|
|
1088
|
+
}
|
|
1089
|
+
}, [animatedContainerHeightDidChange, animatedAnimationState, animatedDetentsState, android_keyboardInputMode, evaluatePosition]);
|
|
1090
|
+
|
|
1091
|
+
/**
|
|
1092
|
+
* Reaction to the `snapPoints` change, to insure that the sheet position reflect
|
|
1093
|
+
* to the current point correctly.
|
|
1094
|
+
*
|
|
1095
|
+
* @alias OnSnapPointsChange
|
|
1096
|
+
*/
|
|
1097
|
+
(0, _reactNativeReanimated.useAnimatedReaction)(() => animatedDetentsState.get().detents, (result, previous) => {
|
|
1098
|
+
/**
|
|
1099
|
+
* if values did not change, and did handle on mount animation
|
|
1100
|
+
* then we early exit the method.
|
|
1101
|
+
*/
|
|
1102
|
+
if (JSON.stringify(result) === JSON.stringify(previous) && isAnimatedOnMount.value) {
|
|
1103
|
+
return;
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
/**
|
|
1107
|
+
* if layout is not calculated yet, then we exit the method.
|
|
1108
|
+
*/
|
|
1109
|
+
if (!isLayoutCalculated.value) {
|
|
1110
|
+
return;
|
|
1111
|
+
}
|
|
1112
|
+
if (__DEV__) {
|
|
1113
|
+
(0, _reactNativeReanimated.runOnJS)(_utilities.print)({
|
|
1114
|
+
component: 'BottomSheet',
|
|
1115
|
+
method: 'useAnimatedReaction::OnSnapPointChange',
|
|
1116
|
+
category: 'effect',
|
|
1117
|
+
params: {
|
|
1118
|
+
result
|
|
1119
|
+
}
|
|
1120
|
+
});
|
|
1121
|
+
}
|
|
1122
|
+
evaluatePosition(_constants.ANIMATION_SOURCE.SNAP_POINT_CHANGE);
|
|
1123
|
+
}, [isLayoutCalculated, isAnimatedOnMount, animatedDetentsState]);
|
|
1124
|
+
|
|
1125
|
+
/**
|
|
1126
|
+
* Reaction to the keyboard state change.
|
|
1127
|
+
*
|
|
1128
|
+
* @alias OnKeyboardStateChange
|
|
1129
|
+
*/
|
|
1130
|
+
(0, _reactNativeReanimated.useAnimatedReaction)(() => animatedKeyboardState.get().status + animatedKeyboardState.get().height, (result, _previousResult) => {
|
|
1131
|
+
/**
|
|
1132
|
+
* if keyboard state is equal to the previous state, then exit the method
|
|
1133
|
+
*/
|
|
1134
|
+
if (result === _previousResult) {
|
|
1135
|
+
return;
|
|
1136
|
+
}
|
|
1137
|
+
const {
|
|
1138
|
+
status,
|
|
1139
|
+
height,
|
|
1140
|
+
easing,
|
|
1141
|
+
duration,
|
|
1142
|
+
target
|
|
1143
|
+
} = animatedKeyboardState.get();
|
|
1144
|
+
|
|
1145
|
+
/**
|
|
1146
|
+
* if state is undetermined, then we early exit.
|
|
1147
|
+
*/
|
|
1148
|
+
if (status === _constants.KEYBOARD_STATUS.UNDETERMINED) {
|
|
1149
|
+
return;
|
|
1150
|
+
}
|
|
1151
|
+
const {
|
|
1152
|
+
status: animationStatus,
|
|
1153
|
+
source: animationSource
|
|
1154
|
+
} = animatedAnimationState.get();
|
|
1155
|
+
/**
|
|
1156
|
+
* if keyboard is hidden by customer gesture, then we early exit.
|
|
1157
|
+
*/
|
|
1158
|
+
if (status === _constants.KEYBOARD_STATUS.HIDDEN && animationStatus === _constants.ANIMATION_STATUS.RUNNING && animationSource === _constants.ANIMATION_SOURCE.GESTURE) {
|
|
1159
|
+
return;
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
/**
|
|
1163
|
+
* Calculate the keyboard height in the container.
|
|
1164
|
+
*/
|
|
1165
|
+
const containerOffset = animatedLayoutState.get().containerOffset;
|
|
1166
|
+
let heightWithinContainer = height === 0 ? 0 : $modal ? Math.abs(height - Math.abs(bottomInset - containerOffset.bottom)) : Math.abs(height - containerOffset.bottom);
|
|
1167
|
+
if (__DEV__) {
|
|
1168
|
+
(0, _reactNativeReanimated.runOnJS)(_utilities.print)({
|
|
1169
|
+
component: 'BottomSheet',
|
|
1170
|
+
method: 'useAnimatedReaction::OnKeyboardStateChange',
|
|
1171
|
+
category: 'effect',
|
|
1172
|
+
params: {
|
|
1173
|
+
status,
|
|
1174
|
+
height,
|
|
1175
|
+
heightWithinContainer,
|
|
1176
|
+
containerOffset
|
|
1177
|
+
}
|
|
1178
|
+
});
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
/**
|
|
1182
|
+
* if platform is android and the input mode is resize, then exit the method
|
|
1183
|
+
*/
|
|
1184
|
+
if (_reactNative.Platform.OS === 'android' && android_keyboardInputMode === _constants.KEYBOARD_INPUT_MODE.adjustResize) {
|
|
1185
|
+
heightWithinContainer = 0;
|
|
1186
|
+
if (keyboardBehavior === _constants.KEYBOARD_BEHAVIOR.interactive) {
|
|
1187
|
+
animatedKeyboardState.set({
|
|
1188
|
+
target,
|
|
1189
|
+
status,
|
|
1190
|
+
height,
|
|
1191
|
+
easing,
|
|
1192
|
+
duration,
|
|
1193
|
+
heightWithinContainer
|
|
1194
|
+
});
|
|
1195
|
+
return;
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
animatedKeyboardState.set(state => ({
|
|
1199
|
+
...state,
|
|
1200
|
+
heightWithinContainer
|
|
1201
|
+
}));
|
|
1202
|
+
|
|
1203
|
+
/**
|
|
1204
|
+
* if user is interacting with sheet, then exit the method
|
|
1205
|
+
*/
|
|
1206
|
+
const hasActiveGesture = animatedContentGestureState.value === _reactNativeGestureHandler.State.ACTIVE || animatedContentGestureState.value === _reactNativeGestureHandler.State.BEGAN || animatedHandleGestureState.value === _reactNativeGestureHandler.State.ACTIVE || animatedHandleGestureState.value === _reactNativeGestureHandler.State.BEGAN;
|
|
1207
|
+
if (hasActiveGesture) {
|
|
1208
|
+
return;
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
/**
|
|
1212
|
+
* if new keyboard state is hidden and blur behavior is none, then exit the method
|
|
1213
|
+
*/
|
|
1214
|
+
if (status === _constants.KEYBOARD_STATUS.HIDDEN && keyboardBlurBehavior === _constants.KEYBOARD_BLUR_BEHAVIOR.none) {
|
|
1215
|
+
return;
|
|
1216
|
+
}
|
|
1217
|
+
const animationConfigs = (0, _utilities.getKeyboardAnimationConfigs)(easing, duration);
|
|
1218
|
+
evaluatePosition(_constants.ANIMATION_SOURCE.KEYBOARD, animationConfigs);
|
|
1219
|
+
}, [$modal, bottomInset, keyboardBehavior, keyboardBlurBehavior, android_keyboardInputMode, animatedKeyboardState, animatedLayoutState, getEvaluatedPosition]);
|
|
1220
|
+
|
|
1221
|
+
/**
|
|
1222
|
+
* sets provided animated position
|
|
1223
|
+
*/
|
|
1224
|
+
(0, _reactNativeReanimated.useAnimatedReaction)(() => animatedPosition.value, _animatedPosition => {
|
|
1225
|
+
if (_providedAnimatedPosition) {
|
|
1226
|
+
_providedAnimatedPosition.value = _animatedPosition + topInset;
|
|
1227
|
+
}
|
|
1228
|
+
}, [_providedAnimatedPosition, topInset]);
|
|
1229
|
+
|
|
1230
|
+
/**
|
|
1231
|
+
* sets provided animated index
|
|
1232
|
+
*/
|
|
1233
|
+
(0, _reactNativeReanimated.useAnimatedReaction)(() => animatedIndex.value, _animatedIndex => {
|
|
1234
|
+
if (_providedAnimatedIndex) {
|
|
1235
|
+
_providedAnimatedIndex.value = _animatedIndex;
|
|
1236
|
+
}
|
|
1237
|
+
}, [_providedAnimatedIndex]);
|
|
1238
|
+
|
|
1239
|
+
/**
|
|
1240
|
+
* React to `index` prop to snap the sheet to the new position.
|
|
1241
|
+
*
|
|
1242
|
+
* @alias onIndexChange
|
|
1243
|
+
*/
|
|
1244
|
+
(0, _react.useEffect)(() => {
|
|
1245
|
+
// early exit, if animate on mount is set and it did not animate yet.
|
|
1246
|
+
if (animateOnMount && !isAnimatedOnMount.value) {
|
|
1247
|
+
return;
|
|
1248
|
+
}
|
|
1249
|
+
handleSnapToIndex(_providedIndex);
|
|
1250
|
+
}, [animateOnMount, _providedIndex, isAnimatedOnMount, handleSnapToIndex]);
|
|
1251
|
+
//#endregion
|
|
1252
|
+
|
|
1253
|
+
// render
|
|
1254
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_contexts.BottomSheetProvider, {
|
|
1255
|
+
value: externalContextVariables,
|
|
1256
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_contexts.BottomSheetInternalProvider, {
|
|
1257
|
+
value: internalContextVariables,
|
|
1258
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_bottomSheetGestureHandlersProvider.default, {
|
|
1259
|
+
gestureEventsHandlersHook: gestureEventsHandlersHook,
|
|
1260
|
+
children: [BackdropComponent ? /*#__PURE__*/(0, _jsxRuntime.jsx)(BackdropComponent, {
|
|
1261
|
+
animatedIndex: animatedIndex,
|
|
1262
|
+
animatedPosition: animatedPosition,
|
|
1263
|
+
style: _reactNative.StyleSheet.absoluteFillObject
|
|
1264
|
+
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_bottomSheetHostingContainer.BottomSheetHostingContainer, {
|
|
1265
|
+
shouldCalculateHeight: !$modal,
|
|
1266
|
+
layoutState: animatedLayoutState,
|
|
1267
|
+
containerLayoutState: containerLayoutState,
|
|
1268
|
+
topInset: topInset,
|
|
1269
|
+
bottomInset: bottomInset,
|
|
1270
|
+
detached: detached,
|
|
1271
|
+
style: _providedContainerStyle,
|
|
1272
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_BottomSheetBody.BottomSheetBody, {
|
|
1273
|
+
style: style,
|
|
1274
|
+
children: [backgroundComponent === null ? null : /*#__PURE__*/(0, _jsxRuntime.jsx)(_bottomSheetBackground.BottomSheetBackgroundContainer, {
|
|
1275
|
+
animatedIndex: animatedIndex,
|
|
1276
|
+
animatedPosition: animatedPosition,
|
|
1277
|
+
backgroundComponent: backgroundComponent,
|
|
1278
|
+
backgroundStyle: _providedBackgroundStyle
|
|
1279
|
+
}, "BottomSheetBackgroundContainer"), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_BottomSheetContent.BottomSheetContent, {
|
|
1280
|
+
pointerEvents: "box-none",
|
|
1281
|
+
accessible: _providedAccessible ?? undefined,
|
|
1282
|
+
accessibilityRole: _providedAccessibilityRole ?? undefined,
|
|
1283
|
+
accessibilityLabel: _providedAccessibilityLabel ?? undefined,
|
|
1284
|
+
keyboardBehavior: keyboardBehavior,
|
|
1285
|
+
detached: detached,
|
|
1286
|
+
children: [children, footerComponent ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_bottomSheetFooter.BottomSheetFooterContainer, {
|
|
1287
|
+
footerComponent: footerComponent
|
|
1288
|
+
}) : null]
|
|
1289
|
+
}), handleComponent !== null ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_bottomSheetHandle.BottomSheetHandleContainer, {
|
|
1290
|
+
animatedIndex: animatedIndex,
|
|
1291
|
+
animatedPosition: animatedPosition,
|
|
1292
|
+
enableHandlePanningGesture: enableHandlePanningGesture,
|
|
1293
|
+
enableOverDrag: enableOverDrag,
|
|
1294
|
+
enablePanDownToClose: enablePanDownToClose,
|
|
1295
|
+
overDragResistanceFactor: overDragResistanceFactor,
|
|
1296
|
+
keyboardBehavior: keyboardBehavior,
|
|
1297
|
+
handleComponent: handleComponent,
|
|
1298
|
+
handleStyle: _providedHandleStyle,
|
|
1299
|
+
handleIndicatorStyle: _providedHandleIndicatorStyle
|
|
1300
|
+
}, "BottomSheetHandleContainer") : null]
|
|
1301
|
+
})
|
|
1302
|
+
}, "BottomSheetContainer")]
|
|
1303
|
+
})
|
|
1304
|
+
})
|
|
1305
|
+
});
|
|
1306
|
+
});
|
|
1307
|
+
const BottomSheet = /*#__PURE__*/(0, _react.memo)(BottomSheetComponent);
|
|
1308
|
+
BottomSheet.displayName = 'BottomSheet';
|
|
1309
|
+
var _default = exports.default = BottomSheet;
|
|
1310
|
+
//# sourceMappingURL=BottomSheet.js.map
|