@tamagui/sheet 3.0.0-beta.1479.1 → 3.0.0-beta.1540.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/dist/cjs/Sheet.cjs +29 -12
- package/dist/cjs/Sheet.native.cjs +29 -12
- package/dist/cjs/Sheet.native.js +29 -12
- package/dist/cjs/Sheet.native.js.map +1 -1
- package/dist/cjs/SheetScrollView.cjs +13 -1
- package/dist/cjs/SheetScrollView.native.cjs +14 -1
- package/dist/cjs/SheetScrollView.native.js +14 -1
- package/dist/cjs/SheetScrollView.native.js.map +1 -1
- package/dist/cjs/nativeSheet.cjs +1 -1
- package/dist/cjs/nativeSheet.native.cjs +66 -55
- package/dist/cjs/nativeSheet.native.js +66 -55
- package/dist/cjs/nativeSheet.native.js.map +1 -1
- package/dist/cjs/useSheetOffscreenSize.cjs +3 -1
- package/dist/cjs/useSheetOffscreenSize.native.cjs +3 -2
- package/dist/cjs/useSheetOffscreenSize.native.js +3 -2
- package/dist/cjs/useSheetOffscreenSize.native.js.map +1 -1
- package/dist/cjs/useSheetOpenState.cjs +9 -3
- package/dist/cjs/useSheetOpenState.native.cjs +11 -2
- package/dist/cjs/useSheetOpenState.native.js +11 -2
- package/dist/cjs/useSheetOpenState.native.js.map +1 -1
- package/dist/cjs/useSheetProviderProps.cjs +5 -94
- package/dist/cjs/useSheetProviderProps.native.cjs +5 -103
- package/dist/cjs/useSheetProviderProps.native.js +5 -103
- package/dist/cjs/useSheetProviderProps.native.js.map +1 -1
- package/dist/cjs/useSheetState.cjs +120 -0
- package/dist/cjs/useSheetState.native.cjs +131 -0
- package/dist/cjs/useSheetState.native.js +133 -0
- package/dist/cjs/useSheetState.native.js.map +1 -0
- package/dist/esm/Sheet.mjs +29 -12
- package/dist/esm/Sheet.mjs.map +1 -1
- package/dist/esm/Sheet.native.js +29 -12
- package/dist/esm/Sheet.native.js.map +1 -1
- package/dist/esm/SheetScrollView.mjs +14 -2
- package/dist/esm/SheetScrollView.mjs.map +1 -1
- package/dist/esm/SheetScrollView.native.js +15 -2
- package/dist/esm/SheetScrollView.native.js.map +1 -1
- package/dist/esm/nativeSheet.mjs +1 -1
- package/dist/esm/nativeSheet.mjs.map +1 -1
- package/dist/esm/nativeSheet.native.js +69 -58
- package/dist/esm/nativeSheet.native.js.map +1 -1
- package/dist/esm/useSheetOffscreenSize.mjs +3 -1
- package/dist/esm/useSheetOffscreenSize.mjs.map +1 -1
- package/dist/esm/useSheetOffscreenSize.native.js +3 -2
- package/dist/esm/useSheetOffscreenSize.native.js.map +1 -1
- package/dist/esm/useSheetOpenState.mjs +9 -3
- package/dist/esm/useSheetOpenState.mjs.map +1 -1
- package/dist/esm/useSheetOpenState.native.js +11 -2
- package/dist/esm/useSheetOpenState.native.js.map +1 -1
- package/dist/esm/useSheetProviderProps.mjs +5 -88
- package/dist/esm/useSheetProviderProps.mjs.map +1 -1
- package/dist/esm/useSheetProviderProps.native.js +5 -97
- package/dist/esm/useSheetProviderProps.native.js.map +1 -1
- package/dist/esm/useSheetState.mjs +95 -0
- package/dist/esm/useSheetState.mjs.map +1 -0
- package/dist/esm/useSheetState.native.js +104 -0
- package/dist/esm/useSheetState.native.js.map +1 -0
- package/dist/jsx/Sheet.mjs +29 -12
- package/dist/jsx/Sheet.mjs.map +1 -1
- package/dist/jsx/Sheet.native.cjs +29 -12
- package/dist/jsx/Sheet.native.js +29 -12
- package/dist/jsx/Sheet.native.js.map +1 -1
- package/dist/jsx/SheetScrollView.mjs +14 -2
- package/dist/jsx/SheetScrollView.mjs.map +1 -1
- package/dist/jsx/SheetScrollView.native.cjs +14 -1
- package/dist/jsx/SheetScrollView.native.js +14 -1
- package/dist/jsx/SheetScrollView.native.js.map +1 -1
- package/dist/jsx/nativeSheet.mjs +1 -1
- package/dist/jsx/nativeSheet.mjs.map +1 -1
- package/dist/jsx/nativeSheet.native.cjs +66 -55
- package/dist/jsx/nativeSheet.native.js +66 -55
- package/dist/jsx/nativeSheet.native.js.map +1 -1
- package/dist/jsx/useSheetOffscreenSize.mjs +3 -1
- package/dist/jsx/useSheetOffscreenSize.mjs.map +1 -1
- package/dist/jsx/useSheetOffscreenSize.native.cjs +3 -2
- package/dist/jsx/useSheetOffscreenSize.native.js +3 -2
- package/dist/jsx/useSheetOffscreenSize.native.js.map +1 -1
- package/dist/jsx/useSheetOpenState.mjs +9 -3
- package/dist/jsx/useSheetOpenState.mjs.map +1 -1
- package/dist/jsx/useSheetOpenState.native.cjs +11 -2
- package/dist/jsx/useSheetOpenState.native.js +11 -2
- package/dist/jsx/useSheetOpenState.native.js.map +1 -1
- package/dist/jsx/useSheetProviderProps.mjs +5 -88
- package/dist/jsx/useSheetProviderProps.mjs.map +1 -1
- package/dist/jsx/useSheetProviderProps.native.cjs +5 -103
- package/dist/jsx/useSheetProviderProps.native.js +5 -103
- package/dist/jsx/useSheetProviderProps.native.js.map +1 -1
- package/dist/jsx/useSheetState.mjs +95 -0
- package/dist/jsx/useSheetState.mjs.map +1 -0
- package/dist/jsx/useSheetState.native.cjs +131 -0
- package/dist/jsx/useSheetState.native.js +133 -0
- package/dist/jsx/useSheetState.native.js.map +1 -0
- package/package.json +22 -22
- package/src/Sheet.tsx +44 -15
- package/src/SheetScrollView.tsx +22 -3
- package/src/nativeSheet.native.tsx +89 -64
- package/src/nativeSheet.ts +7 -10
- package/src/types.tsx +29 -4
- package/src/useSheetOffscreenSize.tsx +3 -7
- package/src/useSheetOpenState.tsx +10 -2
- package/src/useSheetProviderProps.tsx +18 -149
- package/src/useSheetState.tsx +139 -0
- package/types/Sheet.d.ts +32 -32
- package/types/Sheet.d.ts.map +1 -1
- package/types/SheetScrollView.d.ts.map +1 -1
- package/types/nativeSheet.d.ts +8 -9
- package/types/nativeSheet.d.ts.map +1 -1
- package/types/nativeSheet.native.d.ts +4 -4
- package/types/nativeSheet.native.d.ts.map +1 -1
- package/types/types.d.ts +22 -4
- package/types/types.d.ts.map +1 -1
- package/types/useSheetOffscreenSize.d.ts +1 -1
- package/types/useSheetOffscreenSize.d.ts.map +1 -1
- package/types/useSheetOpenState.d.ts +3 -1
- package/types/useSheetOpenState.d.ts.map +1 -1
- package/types/useSheetProviderProps.d.ts +15 -13
- package/types/useSheetProviderProps.d.ts.map +1 -1
- package/types/useSheetState.d.ts +26 -0
- package/types/useSheetState.d.ts.map +1 -0
package/dist/jsx/Sheet.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sheet.js","names":[],"sources":["jsx/Sheet.js"],"sourcesContent":["import { AdaptCapabilities, useAdaptContext, useAdaptIsActive } from \"@tamagui/adapt\";\nimport { useComposedRefs } from \"@tamagui/compose-refs\";\nimport { isWeb } from \"@tamagui/constants\";\nimport {\n createRefComponent,\n createStyledHOC,\n styled,\n View\n} from \"@tamagui/core\";\nimport { composeEventHandlers, withStaticProperties } from \"@tamagui/helpers\";\nimport { resolveViewZIndex } from \"@tamagui/portal\";\nimport { RemoveScroll } from \"@tamagui/remove-scroll\";\nimport { XStack, YStack } from \"@tamagui/stacks\";\nimport { useDidFinishSSR } from \"@tamagui/use-did-finish-ssr\";\nimport { StackZIndexContext } from \"@tamagui/z-index-stack\";\nimport { useContext, useEffect, useMemo, useRef } from \"react\";\nimport {\n SHEET_BACKGROUND_NAME,\n SHEET_CONTAINER_NAME,\n SHEET_HANDLE_NAME,\n SHEET_OVERLAY_MARKER,\n SHEET_OVERLAY_NAME\n} from \"./constants\";\nimport { getNativeSheet } from \"./nativeSheet\";\nimport {\n SheetOverlayLayerContext,\n useAnimatedPosition,\n useSheetContext\n} from \"./SheetContext\";\nimport { SheetImplementationCustom } from \"./SheetImplementationCustom\";\nimport { SheetScrollView } from \"./SheetScrollView\";\nimport { useSheetController } from \"./useSheetController\";\nimport { useSheetOffscreenSize } from \"./useSheetOffscreenSize\";\nimport { getMaxViewportHeight } from \"./webViewport\";\nexport * from \"./types\";\nimport { jsx, jsxs } from \"react/jsx-runtime\";\nconst SheetHandleFrame = styled(XStack, {\n displayName: SHEET_HANDLE_NAME,\n // the behavior Handle ships no opacity rules; open/close aesthetics (fade in\n // when open, dim when idle) live in the copied skin. see the canonical skin.\n variants: {\n open: {\n true: {\n pointerEvents: \"auto\"\n },\n false: {\n pointerEvents: \"none\"\n }\n }\n }\n});\nconst SheetOverlayFrame = styled(YStack, {\n displayName: SHEET_OVERLAY_NAME,\n inset: 0,\n position: \"absolute\",\n zIndex: 1e5 - 1,\n pointerEvents: \"auto\",\n variants: {\n open: {\n true: {\n pointerEvents: \"auto\"\n },\n false: {\n pointerEvents: \"none\"\n }\n }\n }\n});\nObject.assign(SheetOverlayFrame.staticConfig, { [SHEET_OVERLAY_MARKER]: true });\nconst SheetContainerFrame = styled(YStack, {\n displayName: SHEET_CONTAINER_NAME,\n flex: 1,\n position: \"relative\",\n zIndex: 0,\n width: \"100%\",\n maxHeight: \"100%\"\n});\nconst SheetBackgroundFrame = styled(YStack, {\n displayName: SHEET_BACKGROUND_NAME,\n position: \"absolute\",\n top: 0,\n left: 0,\n right: 0,\n zIndex: -1,\n pointerEvents: \"none\"\n});\nconst SheetHandle = createStyledHOC(\n SheetHandleFrame,\n ({ scope, ...props }, forwardedRef) => {\n const context = useSheetContext(scope);\n const composedRef = useComposedRefs(context.handleRef, forwardedRef);\n const wasDraggingRef = useRef(false);\n useEffect(() => {\n if (!context.scrollBridge) return;\n return context.scrollBridge.onParentDragging((isDragging) => {\n if (isDragging) {\n wasDraggingRef.current = true;\n }\n });\n }, [context.scrollBridge]);\n if (context.onlyShowContainer) {\n return null;\n }\n return /* @__PURE__ */ jsx(\n SheetHandleFrame,\n {\n ref: composedRef,\n onPressIn: () => {\n wasDraggingRef.current = false;\n },\n onPress: () => {\n if (wasDraggingRef.current) {\n wasDraggingRef.current = false;\n return;\n }\n const max = context.snapPoints.length + (context.dismissOnSnapToBottom ? -1 : 0);\n const nextPos = (context.position + 1) % max;\n context.setPosition(nextPos);\n },\n open: context.open,\n ...props\n }\n );\n }\n);\nconst SheetOverlay = createStyledHOC(\n SheetOverlayFrame,\n (propsIn, ref) => {\n const { scope, ...props } = propsIn;\n const context = useSheetContext(scope);\n const isInOverlayLayer = useContext(SheetOverlayLayerContext);\n const didWarn = useRef(false);\n if (context.onlyShowContainer) {\n return null;\n }\n if (!isInOverlayLayer) {\n if (process.env.NODE_ENV === \"development\" && !didWarn.current) {\n didWarn.current = true;\n console.error(\n \"Sheet.Overlay must be a direct child of Sheet. Move it next to Sheet.Handle and Sheet.Container.\"\n );\n }\n return null;\n }\n return /* @__PURE__ */ jsx(\n SheetOverlayFrame,\n {\n ...props,\n ref,\n onPress: composeEventHandlers(\n props.onPress,\n context.dismissOnOverlayPress ? () => {\n context.setOpen(false);\n } : void 0\n )\n }\n );\n }\n);\nconst SheetContainer = createStyledHOC(\n SheetContainerFrame,\n ({\n scope,\n adjustPaddingForOffscreenContent,\n children,\n ...props\n }, forwardedRef) => {\n const context = useSheetContext(scope);\n const { hasFit, disableRemoveScroll, frameSize, contentRef, open } = context;\n const composedContentRef = useComposedRefs(forwardedRef, contentRef);\n const offscreenSize = useSheetOffscreenSize(context);\n const stableFrameSize = useRef(frameSize);\n useEffect(() => {\n if (open && frameSize) {\n stableFrameSize.current = frameSize;\n }\n }, [open, frameSize]);\n const sheetContents = useMemo(() => {\n const shouldUseFixedHeight = hasFit && !open && stableFrameSize.current;\n return /* @__PURE__ */ jsxs(\n SheetContainerFrame,\n {\n ref: composedContentRef,\n flex: hasFit && open ? 0 : 1,\n flexBasis: hasFit ? \"auto\" : void 0,\n height: shouldUseFixedHeight ? stableFrameSize.current : hasFit ? void 0 : frameSize,\n pointerEvents: open ? \"auto\" : \"none\",\n \"data-state\": open ? \"open\" : \"closed\",\n ...props,\n children: [\n /* @__PURE__ */ jsx(StackZIndexContext, { zIndex: resolveViewZIndex(props.zIndex), children }),\n adjustPaddingForOffscreenContent && /* @__PURE__ */ jsx(View, { \"data-sheet-offscreen-pad\": true, height: offscreenSize, width: \"100%\" })\n ]\n }\n );\n }, [open, props, frameSize, offscreenSize, adjustPaddingForOffscreenContent, hasFit]);\n return /* @__PURE__ */ jsx(RemoveScroll, { enabled: !disableRemoveScroll && context.open, children: sheetContents });\n }\n);\nconst SheetBackground = createStyledHOC(\n SheetBackgroundFrame,\n ({ scope, disableHideBottomOverflow, ...props }, forwardedRef) => {\n const context = useSheetContext(scope);\n const bottomOverflow = isWeb ? Math.max(context.frameSize, getMaxViewportHeight()) : context.frameSize;\n return /* @__PURE__ */ jsx(\n SheetBackgroundFrame,\n {\n ref: forwardedRef,\n \"data-sheet-background\": \"\",\n bottom: disableHideBottomOverflow ? 0 : -bottomOverflow,\n ...props\n }\n );\n }\n);\nconst SheetRoot = createRefComponent(\n function SheetRoot2(props, ref) {\n const hydrated = useDidFinishSSR();\n const isAdapted = useAdaptIsActive();\n const adaptContext = useAdaptContext();\n const { isShowingNonSheet } = useSheetController(props.scope);\n const shouldUseAdapt = Boolean(\n adaptContext.open !== void 0 || adaptContext.onOpenChange\n );\n const isShowingAdaptNonSheet = shouldUseAdapt && !adaptContext.active && adaptContext.open;\n let SheetImplementation = SheetImplementationCustom;\n if (props.native) {\n const impl = getNativeSheet(\"ios\");\n if (impl) {\n SheetImplementation = impl;\n }\n }\n if (isShowingAdaptNonSheet || isShowingNonSheet || !hydrated) {\n return null;\n }\n const implementation = /* @__PURE__ */ jsx(SheetImplementation, { ref, ...props });\n return isAdapted ? /* @__PURE__ */ jsx(AdaptCapabilities, { scroll: true, overlay: true, dismiss: true, children: implementation }) : implementation;\n }\n);\nconst sheetParts = {\n Container: SheetContainer,\n Background: SheetBackground,\n Overlay: SheetOverlay,\n Handle: SheetHandle,\n ScrollView: SheetScrollView\n};\nconst SheetControlled = withStaticProperties(\n SheetRoot,\n sheetParts\n);\nconst Sheet = withStaticProperties(SheetRoot, {\n Root: SheetRoot,\n Controlled: SheetControlled,\n useAnimatedPosition,\n ...sheetParts\n});\nexport {\n Sheet,\n SheetBackground,\n SheetContainer,\n SheetControlled,\n S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IAAI,0BAA0B,qBAAqB,CAAC,UAAU;EAC5D,OAAO;CACT;CACA,MAAM,iBAAiC,oBAAI,qBAAqB;EAAE;EAAK,GAAG;CAAM,CAAC;CACjF,OAAO,YAA4B,oBAAI,mBAAmB;EAAE,QAAQ;EAAM,SAAS;EAAM,SAAS;EAAM,UAAU;CAAe,CAAC,IAAI;AACxI,CACF;AACA,MAAM,aAAa;CACjB,WAAW;CACX,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,YAAY;AACd;AACA,MAAM,kBAAkB,qBACtB,WACA,UACF;AACA,MAAM,QAAQ,qBAAqB,WAAW;CAC5C,MAAM;CACN,YAAY;CACZ;CACA,GAAG;AACL,CAAC"}
|
|
1
|
+
{"version":3,"file":"Sheet.js","names":[],"sources":["jsx/Sheet.js"],"sourcesContent":["import { AdaptCapabilities, useAdaptContext, useAdaptIsActive } from \"@tamagui/adapt\";\nimport { useComposedRefs } from \"@tamagui/compose-refs\";\nimport { isWeb } from \"@tamagui/constants\";\nimport {\n createRefComponent,\n createStyledHOC,\n styled,\n View\n} from \"@tamagui/core\";\nimport { composeEventHandlers, withStaticProperties } from \"@tamagui/helpers\";\nimport { resolveViewZIndex } from \"@tamagui/portal\";\nimport { RemoveScroll } from \"@tamagui/remove-scroll\";\nimport { XStack, YStack } from \"@tamagui/stacks\";\nimport { useDidFinishSSR } from \"@tamagui/use-did-finish-ssr\";\nimport { StackZIndexContext } from \"@tamagui/z-index-stack\";\nimport { useContext, useEffect, useMemo, useRef } from \"react\";\nimport {\n SHEET_BACKGROUND_NAME,\n SHEET_CONTAINER_NAME,\n SHEET_HANDLE_NAME,\n SHEET_OVERLAY_MARKER,\n SHEET_OVERLAY_NAME\n} from \"./constants\";\nimport { getNativeSheet } from \"./nativeSheet\";\nimport {\n SheetOverlayLayerContext,\n useAnimatedPosition,\n useSheetContext\n} from \"./SheetContext\";\nimport { SheetImplementationCustom } from \"./SheetImplementationCustom\";\nimport { SheetScrollView } from \"./SheetScrollView\";\nimport { useSheetController } from \"./useSheetController\";\nimport { useSheetOffscreenSize } from \"./useSheetOffscreenSize\";\nimport { getMaxViewportHeight } from \"./webViewport\";\nexport * from \"./types\";\nimport { jsx, jsxs } from \"react/jsx-runtime\";\nconst SheetHandleFrame = styled(XStack, {\n displayName: SHEET_HANDLE_NAME,\n // the behavior Handle ships no opacity rules; open/close aesthetics (fade in\n // when open, dim when idle) live in the copied skin. see the canonical skin.\n variants: {\n open: {\n true: {\n pointerEvents: \"auto\"\n },\n false: {\n pointerEvents: \"none\"\n }\n }\n }\n});\nconst SheetOverlayFrame = styled(YStack, {\n displayName: SHEET_OVERLAY_NAME,\n inset: 0,\n position: \"absolute\",\n zIndex: 1e5 - 1,\n pointerEvents: \"auto\",\n variants: {\n open: {\n true: {\n pointerEvents: \"auto\"\n },\n false: {\n pointerEvents: \"none\"\n }\n }\n }\n});\nObject.assign(SheetOverlayFrame.staticConfig, { [SHEET_OVERLAY_MARKER]: true });\nconst SheetContainerFrame = styled(YStack, {\n displayName: SHEET_CONTAINER_NAME,\n flex: 1,\n position: \"relative\",\n zIndex: 0,\n width: \"100%\"\n});\nconst SheetBackgroundFrame = styled(YStack, {\n displayName: SHEET_BACKGROUND_NAME,\n position: \"absolute\",\n top: 0,\n left: 0,\n right: 0,\n zIndex: -1,\n pointerEvents: \"none\"\n});\nconst SheetHandle = createStyledHOC(\n SheetHandleFrame,\n ({ scope, ...props }, forwardedRef) => {\n const context = useSheetContext(scope);\n const composedRef = useComposedRefs(context.handleRef, forwardedRef);\n const wasDraggingRef = useRef(false);\n useEffect(() => {\n if (!context.scrollBridge) return;\n return context.scrollBridge.onParentDragging((isDragging) => {\n if (isDragging) {\n wasDraggingRef.current = true;\n }\n });\n }, [context.scrollBridge]);\n if (context.onlyShowContainer) {\n return null;\n }\n return /* @__PURE__ */ jsx(\n SheetHandleFrame,\n {\n ref: composedRef,\n onPressIn: () => {\n wasDraggingRef.current = false;\n },\n onPress: () => {\n if (wasDraggingRef.current) {\n wasDraggingRef.current = false;\n return;\n }\n const max = context.snapPoints.length + (context.dismissOnSnapToBottom ? -1 : 0);\n const nextPos = (context.position + 1) % max;\n context.setPosition(nextPos);\n },\n open: context.open,\n ...props\n }\n );\n }\n);\nconst SheetOverlay = createStyledHOC(\n SheetOverlayFrame,\n (propsIn, ref) => {\n const { scope, ...props } = propsIn;\n const context = useSheetContext(scope);\n const isInOverlayLayer = useContext(SheetOverlayLayerContext);\n const didWarn = useRef(false);\n if (context.onlyShowContainer) {\n return null;\n }\n if (!isInOverlayLayer) {\n if (process.env.NODE_ENV === \"development\" && !didWarn.current) {\n didWarn.current = true;\n console.error(\n \"Sheet.Overlay must be a direct child of Sheet. Move it next to Sheet.Handle and Sheet.Container.\"\n );\n }\n return null;\n }\n return /* @__PURE__ */ jsx(\n SheetOverlayFrame,\n {\n ...props,\n ref,\n onPress: composeEventHandlers(\n props.onPress,\n context.dismissOnOverlayPress ? () => {\n context.setOpen(false);\n } : void 0\n )\n }\n );\n }\n);\nconst SheetContainer = createStyledHOC(\n SheetContainerFrame,\n ({\n scope,\n adjustPaddingForOffscreenContent,\n children,\n ...props\n }, forwardedRef) => {\n const context = useSheetContext(scope);\n const { hasFit, frameSize, contentRef, open } = context;\n const composedContentRef = useComposedRefs(forwardedRef, contentRef);\n const offscreenSize = useSheetOffscreenSize(context);\n const stableFrameSize = useRef(frameSize);\n useEffect(() => {\n if (open && frameSize) {\n stableFrameSize.current = frameSize;\n }\n }, [open, frameSize]);\n const sheetContents = useMemo(() => {\n if (context.onlyShowContainer) {\n return /* @__PURE__ */ jsx(\n SheetContainerFrame,\n {\n ref: composedContentRef,\n flex: hasFit ? 0 : 1,\n flexBasis: hasFit ? \"auto\" : void 0,\n maxHeight: hasFit ? void 0 : \"100%\",\n pointerEvents: open ? \"auto\" : \"none\",\n \"data-state\": open ? \"open\" : \"closed\",\n ...props,\n onLayout: composeEventHandlers(props.onLayout, (event) => {\n context.setFrameSize(event.nativeEvent.layout.height);\n }),\n children: /* @__PURE__ */ jsx(StackZIndexContext, { zIndex: resolveViewZIndex(props.zIndex), children })\n }\n );\n }\n const shouldUseFixedHeight = hasFit && !open && stableFrameSize.current;\n return /* @__PURE__ */ jsxs(\n SheetContainerFrame,\n {\n ref: composedContentRef,\n flex: hasFit && open ? 0 : 1,\n flexBasis: hasFit ? \"auto\" : void 0,\n maxHeight: \"100%\",\n height: shouldUseFixedHeight ? stableFrameSize.current : hasFit ? void 0 : frameSize,\n pointerEvents: open ? \"auto\" : \"none\",\n \"data-state\": open ? \"open\" : \"closed\",\n ...props,\n children: [\n /* @__PURE__ */ jsx(StackZIndexContext, { zIndex: resolveViewZIndex(props.zIndex), children }),\n adjustPaddingForOffscreenContent && /* @__PURE__ */ jsx(View, { \"data-sheet-offscreen-pad\": true, height: offscreenSize, width: \"100%\" })\n ]\n }\n );\n }, [\n open,\n props,\n frameSize,\n offscreenSize,\n adjustPaddingForOffscreenContent,\n hasFit,\n context.onlyShowContainer,\n context.setFrameSize\n ]);\n if (context.onlyShowContainer) return sheetContents;\n return /* @__PURE__ */ jsx(RemoveScroll, { enabled: !context.disableRemoveScroll && context.open, children: sheetContents });\n }\n);\nconst SheetBackground = createStyledHOC(\n SheetBackgroundFrame,\n ({ scope, disableHideBottomOverflow, ...props }, forwardedRef) => {\n const context = useSheetContext(scope);\n if (context.onlyShowContainer) return null;\n const bottomOverflow = isWeb ? Math.max(context.frameSize, getMaxViewportHeight()) : context.frameSize;\n return /* @__PURE__ */ jsx(\n SheetBackgroundFrame,\n {\n ref: forwardedRef,\n \"data-sheet-background\": \"\",\n bottom: disableHideBottomOverflow ? 0 : -bottomOverflow,\n ...props\n }\n );\n }\n);\nconst SheetRoot = createRefComponent(\n function SheetRoot2(props, ref) {\n const hydrated = useDidFinishSSR();\n const isAdapted = useAdaptIsActive();\n const adaptContext = useAdaptContext();\n const { isShowingNonSheet } = useSheetController(props.scope);\n const shouldUseAdapt = Boolean(\n adaptContext.open !== void 0 || adaptContext.onOpenChange\n );\n const isShowingAdaptNonSheet = shouldUseAdapt && !adaptContext.active && adaptContext.open;\n const nativeImplementation = props.native === true || Array.isArray(props.native) && props.native.includes(\"ios\") ? getNativeSheet(\"ios\") : null;\n const SheetImplementation = nativeImplementation ?? SheetImplementationCustom;\n if (isShowingAdaptNonSheet || isShowingNonSheet || !hydrated) {\n return null;\n }\n const implementation = /* @__PURE__ */ jsx(SheetImplementation, { ref, ...props });\n return isAdapted ? /* @__PURE__ */ jsx(AdaptCapabilities, { scroll: true, overlay: true, dismiss: true, children: implementation }) : implementation;\n }\n);\nconst sheetParts = {\n Container: SheetContainer,\n Background: SheetBackground,\n Overlay: SheetOverlay,\n Handle: SheetHandle,\n ScrollView: SheetScrollView\n};\nconst SheetControlled = withStaticProperties(\n SheetRoot,\n sheetParts\n);\nconst Sheet = withStaticProperties(SheetRoot, {\n Root: SheetRoot,\n Controlled: SheetControlled,\n useAnimatedPosition,\n ...sheetParts\n});\nexport {\n Sheet,\n SheetBackground,\n SheetContainer,\n SheetControlled,\n SheetHandle,\n SheetOverlay,\n SheetRoot\n};\n//# sourceMappingURL=Sheet.js.map\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAM,mBAAmB,OAAO,QAAQ;CACtC,aAAa;CAGb,UAAU,EACR,MAAM;EACJ,MAAM,EACJ,eAAe,OACjB;EACA,OAAO,EACL,eAAe,OACjB;CACF,EACF;AACF,CAAC;AACD,MAAM,oBAAoB,OAAO,QAAQ;CACvC,aAAa;CACb,OAAO;CACP,UAAU;CACV,QAAQ,MAAM;CACd,eAAe;CACf,UAAU,EACR,MAAM;EACJ,MAAM,EACJ,eAAe,OACjB;EACA,OAAO,EACL,eAAe,OACjB;CACF,EACF;AACF,CAAC;AACD,OAAO,OAAO,kBAAkB,cAAc,GAAG,uBAAuB,KAAK,CAAC;AAC9E,MAAM,sBAAsB,OAAO,QAAQ;CACzC,aAAa;CACb,MAAM;CACN,UAAU;CACV,QAAQ;CACR,OAAO;AACT,CAAC;AAC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E;EAAK,GAAG;CAAM,CAAC;CACjF,OAAO,YAA4B,oBAAI,mBAAmB;EAAE,QAAQ;EAAM,SAAS;EAAM,SAAS;EAAM,UAAU;CAAe,CAAC,IAAI;AACxI,CACF;AACA,MAAM,aAAa;CACjB,WAAW;CACX,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,YAAY;AACd;AACA,MAAM,kBAAkB,qBACtB,WACA,UACF;AACA,MAAM,QAAQ,qBAAqB,WAAW;CAC5C,MAAM;CACN,YAAY;CACZ;CACA,GAAG;AACL,CAAC"}
|
|
@@ -77,8 +77,7 @@ var SheetContainerFrame = (0, import_core.styled)(import_stacks.YStack, {
|
|
|
77
77
|
flex: 1,
|
|
78
78
|
position: "relative",
|
|
79
79
|
zIndex: 0,
|
|
80
|
-
width: "100%"
|
|
81
|
-
maxHeight: "100%"
|
|
80
|
+
width: "100%"
|
|
82
81
|
});
|
|
83
82
|
var SheetBackgroundFrame = (0, import_core.styled)(import_stacks.YStack, {
|
|
84
83
|
displayName: import_constants2.SHEET_BACKGROUND_NAME,
|
|
@@ -149,7 +148,7 @@ var SheetOverlay = (0, import_core.createStyledHOC)(SheetOverlayFrame, function(
|
|
|
149
148
|
var SheetContainer = (0, import_core.createStyledHOC)(SheetContainerFrame, function(param, forwardedRef) {
|
|
150
149
|
var { scope, adjustPaddingForOffscreenContent, children, ...props } = param;
|
|
151
150
|
var context = (0, import_SheetContext.useSheetContext)(scope);
|
|
152
|
-
var { hasFit,
|
|
151
|
+
var { hasFit, frameSize, contentRef, open } = context;
|
|
153
152
|
var composedContentRef = (0, import_compose_refs.useComposedRefs)(forwardedRef, contentRef);
|
|
154
153
|
var offscreenSize = (0, import_useSheetOffscreenSize.useSheetOffscreenSize)(context);
|
|
155
154
|
var stableFrameSize = (0, import_react.useRef)(frameSize);
|
|
@@ -159,11 +158,30 @@ var SheetContainer = (0, import_core.createStyledHOC)(SheetContainerFrame, funct
|
|
|
159
158
|
}
|
|
160
159
|
}, [open, frameSize]);
|
|
161
160
|
var sheetContents = (0, import_react.useMemo)(function() {
|
|
161
|
+
if (context.onlyShowContainer) {
|
|
162
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SheetContainerFrame, {
|
|
163
|
+
ref: composedContentRef,
|
|
164
|
+
flex: hasFit ? 0 : 1,
|
|
165
|
+
flexBasis: hasFit ? "auto" : void 0,
|
|
166
|
+
maxHeight: hasFit ? void 0 : "100%",
|
|
167
|
+
pointerEvents: open ? "auto" : "none",
|
|
168
|
+
"data-state": open ? "open" : "closed",
|
|
169
|
+
...props,
|
|
170
|
+
onLayout: (0, import_helpers.composeEventHandlers)(props.onLayout, function(event) {
|
|
171
|
+
context.setFrameSize(event.nativeEvent.layout.height);
|
|
172
|
+
}),
|
|
173
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_z_index_stack.StackZIndexContext, {
|
|
174
|
+
zIndex: (0, import_portal.resolveViewZIndex)(props.zIndex),
|
|
175
|
+
children
|
|
176
|
+
})
|
|
177
|
+
});
|
|
178
|
+
}
|
|
162
179
|
var shouldUseFixedHeight = hasFit && !open && stableFrameSize.current;
|
|
163
180
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SheetContainerFrame, {
|
|
164
181
|
ref: composedContentRef,
|
|
165
182
|
flex: hasFit && open ? 0 : 1,
|
|
166
183
|
flexBasis: hasFit ? "auto" : void 0,
|
|
184
|
+
maxHeight: "100%",
|
|
167
185
|
height: shouldUseFixedHeight ? stableFrameSize.current : hasFit ? void 0 : frameSize,
|
|
168
186
|
pointerEvents: open ? "auto" : "none",
|
|
169
187
|
"data-state": open ? "open" : "closed",
|
|
@@ -183,16 +201,20 @@ var SheetContainer = (0, import_core.createStyledHOC)(SheetContainerFrame, funct
|
|
|
183
201
|
frameSize,
|
|
184
202
|
offscreenSize,
|
|
185
203
|
adjustPaddingForOffscreenContent,
|
|
186
|
-
hasFit
|
|
204
|
+
hasFit,
|
|
205
|
+
context.onlyShowContainer,
|
|
206
|
+
context.setFrameSize
|
|
187
207
|
]);
|
|
208
|
+
if (context.onlyShowContainer) return sheetContents;
|
|
188
209
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_remove_scroll.RemoveScroll, {
|
|
189
|
-
enabled: !disableRemoveScroll && context.open,
|
|
210
|
+
enabled: !context.disableRemoveScroll && context.open,
|
|
190
211
|
children: sheetContents
|
|
191
212
|
});
|
|
192
213
|
});
|
|
193
214
|
var SheetBackground = (0, import_core.createStyledHOC)(SheetBackgroundFrame, function(param, forwardedRef) {
|
|
194
215
|
var { scope, disableHideBottomOverflow, ...props } = param;
|
|
195
216
|
var context = (0, import_SheetContext.useSheetContext)(scope);
|
|
217
|
+
if (context.onlyShowContainer) return null;
|
|
196
218
|
var bottomOverflow = import_constants.isWeb ? Math.max(context.frameSize, (0, import_webViewport.getMaxViewportHeight)()) : context.frameSize;
|
|
197
219
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SheetBackgroundFrame, {
|
|
198
220
|
ref: forwardedRef,
|
|
@@ -208,13 +230,8 @@ var SheetRoot = (0, import_core.createRefComponent)(function SheetRoot2(props, r
|
|
|
208
230
|
var { isShowingNonSheet } = (0, import_useSheetController.useSheetController)(props.scope);
|
|
209
231
|
var shouldUseAdapt = Boolean(adaptContext.open !== void 0 || adaptContext.onOpenChange);
|
|
210
232
|
var isShowingAdaptNonSheet = shouldUseAdapt && !adaptContext.active && adaptContext.open;
|
|
211
|
-
var
|
|
212
|
-
|
|
213
|
-
var impl = (0, import_nativeSheet.getNativeSheet)("ios");
|
|
214
|
-
if (impl) {
|
|
215
|
-
SheetImplementation = impl;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
233
|
+
var nativeImplementation = props.native === true || Array.isArray(props.native) && props.native.includes("ios") ? (0, import_nativeSheet.getNativeSheet)("ios") : null;
|
|
234
|
+
var SheetImplementation = nativeImplementation !== null && nativeImplementation !== void 0 ? nativeImplementation : import_SheetImplementationCustom.SheetImplementationCustom;
|
|
218
235
|
if (isShowingAdaptNonSheet || isShowingNonSheet || !hydrated) {
|
|
219
236
|
return null;
|
|
220
237
|
}
|
package/dist/jsx/Sheet.native.js
CHANGED
|
@@ -77,8 +77,7 @@ var SheetContainerFrame = (0, import_core.styled)(import_stacks.YStack, {
|
|
|
77
77
|
flex: 1,
|
|
78
78
|
position: "relative",
|
|
79
79
|
zIndex: 0,
|
|
80
|
-
width: "100%"
|
|
81
|
-
maxHeight: "100%"
|
|
80
|
+
width: "100%"
|
|
82
81
|
});
|
|
83
82
|
var SheetBackgroundFrame = (0, import_core.styled)(import_stacks.YStack, {
|
|
84
83
|
displayName: import_constants2.SHEET_BACKGROUND_NAME,
|
|
@@ -149,7 +148,7 @@ var SheetOverlay = (0, import_core.createStyledHOC)(SheetOverlayFrame, function(
|
|
|
149
148
|
var SheetContainer = (0, import_core.createStyledHOC)(SheetContainerFrame, function(param, forwardedRef) {
|
|
150
149
|
var { scope, adjustPaddingForOffscreenContent, children, ...props } = param;
|
|
151
150
|
var context = (0, import_SheetContext.useSheetContext)(scope);
|
|
152
|
-
var { hasFit,
|
|
151
|
+
var { hasFit, frameSize, contentRef, open } = context;
|
|
153
152
|
var composedContentRef = (0, import_compose_refs.useComposedRefs)(forwardedRef, contentRef);
|
|
154
153
|
var offscreenSize = (0, import_useSheetOffscreenSize.useSheetOffscreenSize)(context);
|
|
155
154
|
var stableFrameSize = (0, import_react.useRef)(frameSize);
|
|
@@ -159,11 +158,30 @@ var SheetContainer = (0, import_core.createStyledHOC)(SheetContainerFrame, funct
|
|
|
159
158
|
}
|
|
160
159
|
}, [open, frameSize]);
|
|
161
160
|
var sheetContents = (0, import_react.useMemo)(function() {
|
|
161
|
+
if (context.onlyShowContainer) {
|
|
162
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SheetContainerFrame, {
|
|
163
|
+
ref: composedContentRef,
|
|
164
|
+
flex: hasFit ? 0 : 1,
|
|
165
|
+
flexBasis: hasFit ? "auto" : void 0,
|
|
166
|
+
maxHeight: hasFit ? void 0 : "100%",
|
|
167
|
+
pointerEvents: open ? "auto" : "none",
|
|
168
|
+
"data-state": open ? "open" : "closed",
|
|
169
|
+
...props,
|
|
170
|
+
onLayout: (0, import_helpers.composeEventHandlers)(props.onLayout, function(event) {
|
|
171
|
+
context.setFrameSize(event.nativeEvent.layout.height);
|
|
172
|
+
}),
|
|
173
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_z_index_stack.StackZIndexContext, {
|
|
174
|
+
zIndex: (0, import_portal.resolveViewZIndex)(props.zIndex),
|
|
175
|
+
children
|
|
176
|
+
})
|
|
177
|
+
});
|
|
178
|
+
}
|
|
162
179
|
var shouldUseFixedHeight = hasFit && !open && stableFrameSize.current;
|
|
163
180
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SheetContainerFrame, {
|
|
164
181
|
ref: composedContentRef,
|
|
165
182
|
flex: hasFit && open ? 0 : 1,
|
|
166
183
|
flexBasis: hasFit ? "auto" : void 0,
|
|
184
|
+
maxHeight: "100%",
|
|
167
185
|
height: shouldUseFixedHeight ? stableFrameSize.current : hasFit ? void 0 : frameSize,
|
|
168
186
|
pointerEvents: open ? "auto" : "none",
|
|
169
187
|
"data-state": open ? "open" : "closed",
|
|
@@ -183,16 +201,20 @@ var SheetContainer = (0, import_core.createStyledHOC)(SheetContainerFrame, funct
|
|
|
183
201
|
frameSize,
|
|
184
202
|
offscreenSize,
|
|
185
203
|
adjustPaddingForOffscreenContent,
|
|
186
|
-
hasFit
|
|
204
|
+
hasFit,
|
|
205
|
+
context.onlyShowContainer,
|
|
206
|
+
context.setFrameSize
|
|
187
207
|
]);
|
|
208
|
+
if (context.onlyShowContainer) return sheetContents;
|
|
188
209
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_remove_scroll.RemoveScroll, {
|
|
189
|
-
enabled: !disableRemoveScroll && context.open,
|
|
210
|
+
enabled: !context.disableRemoveScroll && context.open,
|
|
190
211
|
children: sheetContents
|
|
191
212
|
});
|
|
192
213
|
});
|
|
193
214
|
var SheetBackground = (0, import_core.createStyledHOC)(SheetBackgroundFrame, function(param, forwardedRef) {
|
|
194
215
|
var { scope, disableHideBottomOverflow, ...props } = param;
|
|
195
216
|
var context = (0, import_SheetContext.useSheetContext)(scope);
|
|
217
|
+
if (context.onlyShowContainer) return null;
|
|
196
218
|
var bottomOverflow = import_constants.isWeb ? Math.max(context.frameSize, (0, import_webViewport.getMaxViewportHeight)()) : context.frameSize;
|
|
197
219
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SheetBackgroundFrame, {
|
|
198
220
|
ref: forwardedRef,
|
|
@@ -208,13 +230,8 @@ var SheetRoot = (0, import_core.createRefComponent)(function SheetRoot2(props, r
|
|
|
208
230
|
var { isShowingNonSheet } = (0, import_useSheetController.useSheetController)(props.scope);
|
|
209
231
|
var shouldUseAdapt = Boolean(adaptContext.open !== void 0 || adaptContext.onOpenChange);
|
|
210
232
|
var isShowingAdaptNonSheet = shouldUseAdapt && !adaptContext.active && adaptContext.open;
|
|
211
|
-
var
|
|
212
|
-
|
|
213
|
-
var impl = (0, import_nativeSheet.getNativeSheet)("ios");
|
|
214
|
-
if (impl) {
|
|
215
|
-
SheetImplementation = impl;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
233
|
+
var nativeImplementation = props.native === true || Array.isArray(props.native) && props.native.includes("ios") ? (0, import_nativeSheet.getNativeSheet)("ios") : null;
|
|
234
|
+
var SheetImplementation = nativeImplementation !== null && nativeImplementation !== void 0 ? nativeImplementation : import_SheetImplementationCustom.SheetImplementationCustom;
|
|
218
235
|
if (isShowingAdaptNonSheet || isShowingNonSheet || !hydrated) {
|
|
219
236
|
return null;
|
|
220
237
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sheet.native.js","names":[],"sources":["jsx/Sheet.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, \"default\"), secondTarget && __copyProps(secondTarget, mod, \"default\"));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar Sheet_exports = {};\n__export(Sheet_exports, {\n Sheet: () => Sheet,\n SheetBackground: () => SheetBackground,\n SheetContainer: () => SheetContainer,\n SheetControlled: () => SheetControlled,\n SheetHandle: () => SheetHandle,\n SheetOverlay: () => SheetOverlay,\n SheetRoot: () => SheetRoot\n});\nmodule.exports = __toCommonJS(Sheet_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_adapt = require(\"@tamagui/adapt\");\nvar import_compose_refs = require(\"@tamagui/compose-refs\");\nvar import_constants = require(\"@tamagui/constants\");\nvar import_core = require(\"@tamagui/core\");\nvar import_helpers = require(\"@tamagui/helpers\");\nvar import_portal = require(\"@tamagui/portal\");\nvar import_remove_scroll = require(\"@tamagui/remove-scroll\");\nvar import_stacks = require(\"@tamagui/stacks\");\nvar import_use_did_finish_ssr = require(\"@tamagui/use-did-finish-ssr\");\nvar import_z_index_stack = require(\"@tamagui/z-index-stack\");\nvar import_react = require(\"react\");\nvar import_constants2 = require(\"./constants\");\nvar import_nativeSheet = require(\"./nativeSheet\");\nvar import_SheetContext = require(\"./SheetContext\");\nvar import_SheetImplementationCustom = require(\"./SheetImplementationCustom\");\nvar import_SheetScrollView = require(\"./SheetScrollView\");\nvar import_useSheetController = require(\"./useSheetController\");\nvar import_useSheetOffscreenSize = require(\"./useSheetOffscreenSize\");\nvar import_webViewport = require(\"./webViewport\");\n__reExport(Sheet_exports, require(\"./types\"), module.exports);\nvar SheetHandleFrame = (0, import_core.styled)(import_stacks.XStack, {\n displayName: import_constants2.SHEET_HANDLE_NAME,\n // the behavior Handle ships no opacity rules; open/close aesthetics (fade in\n // when open, dim when idle) live in the copied skin. see the canonical skin.\n variants: {\n open: {\n true: {\n pointerEvents: \"auto\"\n },\n false: {\n pointerEvents: \"none\"\n }\n }\n }\n});\nvar SheetOverlayFrame = (0, import_core.styled)(import_stacks.YStack, {\n displayName: import_constants2.SHEET_OVERLAY_NAME,\n inset: 0,\n position: \"absolute\",\n zIndex: 1e5 - 1,\n pointerEvents: \"auto\",\n variants: {\n open: {\n true: {\n pointerEvents: \"auto\"\n },\n false: {\n pointerEvents: \"none\"\n }\n }\n }\n});\nObject.assign(SheetOverlayFrame.staticConfig, {\n [import_constants2.SHEET_OVERLAY_MARKER]: true\n});\nvar SheetContainerFrame = (0, import_core.styled)(import_stacks.YStack, {\n displayName: import_constants2.SHEET_CONTAINER_NAME,\n flex: 1,\n position: \"relative\",\n zIndex: 0,\n width: \"100%\",\n maxHeight: \"100%\"\n});\nvar SheetBackgroundFrame = (0, import_core.styled)(import_stacks.YStack, {\n displayName: import_constants2.SHEET_BACKGROUND_NAME,\n position: \"absolute\",\n top: 0,\n left: 0,\n right: 0,\n zIndex: -1,\n pointerEvents: \"none\"\n});\nvar SheetHandle = (0, import_core.createStyledHOC)(SheetHandleFrame, function(param, forwardedRef) {\n var { scope, ...props } = param;\n var context = (0, import_SheetContext.useSheetContext)(scope);\n var composedRef = (0, import_compose_refs.useComposedRefs)(context.handleRef, forwardedRef);\n var wasDraggingRef = (0, import_react.useRef)(false);\n (0, import_react.useEffect)(function() {\n if (!context.scrollBridge) return;\n return context.scrollBridge.onParentDragging(function(isDragging) {\n if (isDragging) {\n wasDraggingRef.current = true;\n }\n });\n }, [\n context.scrollBridge\n ]);\n if (context.onlyShowContainer) {\n return null;\n }\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SheetHandleFrame, {\n ref: composedRef,\n onPressIn: function() {\n wasDraggingRef.current = false;\n },\n onPress: function() {\n if (wasDraggingRef.current) {\n wasDraggingRef.current = false;\n return;\n }\n var max = context.snapPoints.length + (context.dismissOnSnapToBottom ? -1 : 0);\n var nextPos = (context.position + 1) % max;\n context.setPosition(nextPos);\n },\n open: context.open,\n ...props\n });\n});\nvar SheetOverlay = (0, import_core.createStyledHOC)(SheetOverlayFrame, function(propsIn, ref) {\n var { scope, ...props } = propsIn;\n var context = (0, import_SheetContext.useSheetContext)(scope);\n var isInOverlayLayer = (0, import_react.useContext)(import_SheetContext.SheetOverlayLayerContext);\n var didWarn = (0, import_react.useRef)(false);\n if (context.onlyShowContainer) {\n return null;\n }\n if (!isInOverlayLayer) {\n if (process.env.NODE_ENV === \"development\" && !didWarn.current) {\n didWarn.current = true;\n console.error(\"Sheet.Overlay must be a direct child of Sheet. Move it next to Sheet.Handle and Sheet.Container.\");\n }\n return null;\n }\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SheetOverlayFrame, {\n ...props,\n ref,\n onPress: (0, import_helpers.composeEventHandlers)(props.onPress, context.dismissOnOverlayPress ? function() {\n context.setOpen(false);\n } : void 0)\n });\n});\nvar SheetContainer = (0, import_core.createStyledHOC)(SheetContainerFrame, function(param, forwardedRef) {\n var { scope, adjustPaddingForOffscreenContent, children, ...props } = param;\n var context = (0, import_SheetContext.useSheetContext)(scope);\n var { hasFit, disableRemoveScroll, frameSize, contentRef, open } = context;\n var composedContentRef = (0, import_compose_refs.useComposedRefs)(forwardedRef, contentRef);\n var offscreenSize = (0, import_useSheetOffscreenSize.useSheetOffscreenSize)(context);\n var stableFrameSize = (0, import_react.useRef)(frameSize);\n (0, import_react.useEffect)(function() {\n if (open && frameSize) {\n stableFrameSize.current = frameSize;\n }\n }, [\n open,\n frameSize\n ]);\n var sheetContents = (0, import_react.useMemo)(function() {\n var shouldUseFixedHeight = hasFit && !open && stableFrameSize.current;\n return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SheetContainerFrame, {\n ref: composedContentRef,\n flex: hasFit && open ? 0 : 1,\n flexBasis: hasFit ? \"auto\" : void 0,\n height: shouldUseFixedHeight ? stableFrameSize.current : hasFit ? void 0 : frameSize,\n pointerEvents: open ? \"auto\" : \"none\",\n \"data-state\": open ? \"open\" : \"closed\",\n ...props,\n children: [\n /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_z_index_stack.StackZIndexContext, {\n zIndex: (0, import_portal.resolveViewZIndex)(props.zIndex),\n children\n }),\n adjustPaddingForOffscreenContent && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.View, {\n \"data-sheet-offscreen-pad\": true,\n height: offscreenSize,\n width: \"100%\"\n })\n ]\n });\n }, [\n open,\n props,\n frameSize,\n offscreenSize,\n adjustPaddingForOffscreenContent,\n hasFit\n ]);\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_remove_scroll.RemoveScroll, {\n enabled: !disableRemoveScroll && context.open,\n children: sheetContents\n });\n});\nvar SheetBackground = (0, import_core.createStyledHOC)(SheetBackgroundFrame, function(param, forwardedRef) {\n var { scope, disableHideBottomOverflow, ...props } = param;\n var context = (0, import_SheetContext.useSheetContext)(scope);\n var bottomOverflow = import_constants.isWeb ? Math.max(context.frameSize, (0, import_webViewport.getMaxViewportHeight)()) : context.frameSize;\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SheetBackgroundFrame, {\n ref: forwardedRef,\n \"data-sheet-background\": \"\",\n bottom: disableHideBottomOverflow ? 0 : -bottomOverflow,\n ...props\n });\n});\nvar SheetRoot = (0, import_core.createRefComponent)(function SheetRoot2(props, ref) {\n var hydrated = (0, import_use_did_finish_ssr.useDidFinishSSR)();\n var isAdapted = (0, import_adapt.useAdaptIsActive)();\n var adaptContext = (0, import_adapt.useAdaptContext)();\n var { isShowingNonSheet } = (0, import_useSheetController.useSheetController)(props.scope);\n var shouldUseAdapt = Boolean(adaptContext.open !== void 0 || adaptContext.onOpenChange);\n var isShowingAdaptNonSheet = shouldUseAdapt && !adaptContext.active && adaptContext.open;\n var SheetImplementation = import_SheetImplementationCustom.SheetImplementationCustom;\n if (props.native) {\n var impl = (0, import_nativeSheet.getNativeSheet)(\"ios\");\n if (impl) {\n SheetImplementation = impl;\n }\n }\n if (isShowingAdaptNonSheet || isShowingNonSheet || !hydrated) {\n return null;\n }\n var implementation = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SheetImplementation, {\n ref,\n ...props\n });\n return isAdapted ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_adapt.AdaptCapabilities, {\n scroll: true,\n overlay: true,\n dismiss: true,\n children: implementation\n }) : implementation;\n});\nvar sheetParts = {\n Container: SheetContainer,\n Background: SheetBackground,\n Overlay: SheetOverlay,\n Handle: SheetHandle,\n ScrollView: import_SheetScrollView.SheetScrollView\n};\nvar SheetControlled = (0, import_helpers.withStaticProperties)(SheetRoot, sheetParts);\nvar Sheet = (0, import_helpers.withStaticProperties)(SheetRoot, {\n Root: SheetRoot,\n Controlled: SheetControlled,\n useAnimatedPosition: import_SheetContext.useAnimatedPosition,\n ...sheetParts\n});\n//# sourceMappingURL=Sheet.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAA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AC7F,QAAQ;EACR,SAAS;EACT,SAAS;EACT,UAAU;CACZ,CAAC,IAAI;AACP,CAAC;AACD,IAAI,aAAa;CACf,WAAW;CACX,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,YAAY,uBAAuB;AACrC;AACA,IAAI,mBAAmB,GAAG,eAAe,qBAAoB,CAAE,WAAW,UAAU;AACpF,IAAI,SAAS,GAAG,eAAe,qBAAoB,CAAE,WAAW;CAC9D,MAAM;CACN,YAAY;CACZ,qBAAqB,oBAAoB;CACzC,GAAG;AACL,CAAC"}
|
|
1
|
+
{"version":3,"file":"Sheet.native.js","names":[],"sources":["jsx/Sheet.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, \"default\"), secondTarget && __copyProps(secondTarget, mod, \"default\"));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar Sheet_exports = {};\n__export(Sheet_exports, {\n Sheet: () => Sheet,\n SheetBackground: () => SheetBackground,\n SheetContainer: () => SheetContainer,\n SheetControlled: () => SheetControlled,\n SheetHandle: () => SheetHandle,\n SheetOverlay: () => SheetOverlay,\n SheetRoot: () => SheetRoot\n});\nmodule.exports = __toCommonJS(Sheet_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_adapt = require(\"@tamagui/adapt\");\nvar import_compose_refs = require(\"@tamagui/compose-refs\");\nvar import_constants = require(\"@tamagui/constants\");\nvar import_core = require(\"@tamagui/core\");\nvar import_helpers = require(\"@tamagui/helpers\");\nvar import_portal = require(\"@tamagui/portal\");\nvar import_remove_scroll = require(\"@tamagui/remove-scroll\");\nvar import_stacks = require(\"@tamagui/stacks\");\nvar import_use_did_finish_ssr = require(\"@tamagui/use-did-finish-ssr\");\nvar import_z_index_stack = require(\"@tamagui/z-index-stack\");\nvar import_react = require(\"react\");\nvar import_constants2 = require(\"./constants\");\nvar import_nativeSheet = require(\"./nativeSheet\");\nvar import_SheetContext = require(\"./SheetContext\");\nvar import_SheetImplementationCustom = require(\"./SheetImplementationCustom\");\nvar import_SheetScrollView = require(\"./SheetScrollView\");\nvar import_useSheetController = require(\"./useSheetController\");\nvar import_useSheetOffscreenSize = require(\"./useSheetOffscreenSize\");\nvar import_webViewport = require(\"./webViewport\");\n__reExport(Sheet_exports, require(\"./types\"), module.exports);\nvar SheetHandleFrame = (0, import_core.styled)(import_stacks.XStack, {\n displayName: import_constants2.SHEET_HANDLE_NAME,\n // the behavior Handle ships no opacity rules; open/close aesthetics (fade in\n // when open, dim when idle) live in the copied skin. see the canonical skin.\n variants: {\n open: {\n true: {\n pointerEvents: \"auto\"\n },\n false: {\n pointerEvents: \"none\"\n }\n }\n }\n});\nvar SheetOverlayFrame = (0, import_core.styled)(import_stacks.YStack, {\n displayName: import_constants2.SHEET_OVERLAY_NAME,\n inset: 0,\n position: \"absolute\",\n zIndex: 1e5 - 1,\n pointerEvents: \"auto\",\n variants: {\n open: {\n true: {\n pointerEvents: \"auto\"\n },\n false: {\n pointerEvents: \"none\"\n }\n }\n }\n});\nObject.assign(SheetOverlayFrame.staticConfig, {\n [import_constants2.SHEET_OVERLAY_MARKER]: true\n});\nvar SheetContainerFrame = (0, import_core.styled)(import_stacks.YStack, {\n displayName: import_constants2.SHEET_CONTAINER_NAME,\n flex: 1,\n position: \"relative\",\n zIndex: 0,\n width: \"100%\"\n});\nvar SheetBackgroundFrame = (0, import_core.styled)(import_stacks.YStack, {\n displayName: import_constants2.SHEET_BACKGROUND_NAME,\n position: \"absolute\",\n top: 0,\n left: 0,\n right: 0,\n zIndex: -1,\n pointerEvents: \"none\"\n});\nvar SheetHandle = (0, import_core.createStyledHOC)(SheetHandleFrame, function(param, forwardedRef) {\n var { scope, ...props } = param;\n var context = (0, import_SheetContext.useSheetContext)(scope);\n var composedRef = (0, import_compose_refs.useComposedRefs)(context.handleRef, forwardedRef);\n var wasDraggingRef = (0, import_react.useRef)(false);\n (0, import_react.useEffect)(function() {\n if (!context.scrollBridge) return;\n return context.scrollBridge.onParentDragging(function(isDragging) {\n if (isDragging) {\n wasDraggingRef.current = true;\n }\n });\n }, [\n context.scrollBridge\n ]);\n if (context.onlyShowContainer) {\n return null;\n }\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SheetHandleFrame, {\n ref: composedRef,\n onPressIn: function() {\n wasDraggingRef.current = false;\n },\n onPress: function() {\n if (wasDraggingRef.current) {\n wasDraggingRef.current = false;\n return;\n }\n var max = context.snapPoints.length + (context.dismissOnSnapToBottom ? -1 : 0);\n var nextPos = (context.position + 1) % max;\n context.setPosition(nextPos);\n },\n open: context.open,\n ...props\n });\n});\nvar SheetOverlay = (0, import_core.createStyledHOC)(SheetOverlayFrame, function(propsIn, ref) {\n var { scope, ...props } = propsIn;\n var context = (0, import_SheetContext.useSheetContext)(scope);\n var isInOverlayLayer = (0, import_react.useContext)(import_SheetContext.SheetOverlayLayerContext);\n var didWarn = (0, import_react.useRef)(false);\n if (context.onlyShowContainer) {\n return null;\n }\n if (!isInOverlayLayer) {\n if (process.env.NODE_ENV === \"development\" && !didWarn.current) {\n didWarn.current = true;\n console.error(\"Sheet.Overlay must be a direct child of Sheet. Move it next to Sheet.Handle and Sheet.Container.\");\n }\n return null;\n }\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SheetOverlayFrame, {\n ...props,\n ref,\n onPress: (0, import_helpers.composeEventHandlers)(props.onPress, context.dismissOnOverlayPress ? function() {\n context.setOpen(false);\n } : void 0)\n });\n});\nvar SheetContainer = (0, import_core.createStyledHOC)(SheetContainerFrame, function(param, forwardedRef) {\n var { scope, adjustPaddingForOffscreenContent, children, ...props } = param;\n var context = (0, import_SheetContext.useSheetContext)(scope);\n var { hasFit, frameSize, contentRef, open } = context;\n var composedContentRef = (0, import_compose_refs.useComposedRefs)(forwardedRef, contentRef);\n var offscreenSize = (0, import_useSheetOffscreenSize.useSheetOffscreenSize)(context);\n var stableFrameSize = (0, import_react.useRef)(frameSize);\n (0, import_react.useEffect)(function() {\n if (open && frameSize) {\n stableFrameSize.current = frameSize;\n }\n }, [\n open,\n frameSize\n ]);\n var sheetContents = (0, import_react.useMemo)(function() {\n if (context.onlyShowContainer) {\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SheetContainerFrame, {\n ref: composedContentRef,\n flex: hasFit ? 0 : 1,\n flexBasis: hasFit ? \"auto\" : void 0,\n maxHeight: hasFit ? void 0 : \"100%\",\n pointerEvents: open ? \"auto\" : \"none\",\n \"data-state\": open ? \"open\" : \"closed\",\n ...props,\n onLayout: (0, import_helpers.composeEventHandlers)(props.onLayout, function(event) {\n context.setFrameSize(event.nativeEvent.layout.height);\n }),\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_z_index_stack.StackZIndexContext, {\n zIndex: (0, import_portal.resolveViewZIndex)(props.zIndex),\n children\n })\n });\n }\n var shouldUseFixedHeight = hasFit && !open && stableFrameSize.current;\n return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SheetContainerFrame, {\n ref: composedContentRef,\n flex: hasFit && open ? 0 : 1,\n flexBasis: hasFit ? \"auto\" : void 0,\n maxHeight: \"100%\",\n height: shouldUseFixedHeight ? stableFrameSize.current : hasFit ? void 0 : frameSize,\n pointerEvents: open ? \"auto\" : \"none\",\n \"data-state\": open ? \"open\" : \"closed\",\n ...props,\n children: [\n /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_z_index_stack.StackZIndexContext, {\n zIndex: (0, import_portal.resolveViewZIndex)(props.zIndex),\n children\n }),\n adjustPaddingForOffscreenContent && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.View, {\n \"data-sheet-offscreen-pad\": true,\n height: offscreenSize,\n width: \"100%\"\n })\n ]\n });\n }, [\n open,\n props,\n frameSize,\n offscreenSize,\n adjustPaddingForOffscreenContent,\n hasFit,\n context.onlyShowContainer,\n context.setFrameSize\n ]);\n if (context.onlyShowContainer) return sheetContents;\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_remove_scroll.RemoveScroll, {\n enabled: !context.disableRemoveScroll && context.open,\n children: sheetContents\n });\n});\nvar SheetBackground = (0, import_core.createStyledHOC)(SheetBackgroundFrame, function(param, forwardedRef) {\n var { scope, disableHideBottomOverflow, ...props } = param;\n var context = (0, import_SheetContext.useSheetContext)(scope);\n if (context.onlyShowContainer) return null;\n var bottomOverflow = import_constants.isWeb ? Math.max(context.frameSize, (0, import_webViewport.getMaxViewportHeight)()) : context.frameSize;\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SheetBackgroundFrame, {\n ref: forwardedRef,\n \"data-sheet-background\": \"\",\n bottom: disableHideBottomOverflow ? 0 : -bottomOverflow,\n ...props\n });\n});\nvar SheetRoot = (0, import_core.createRefComponent)(function SheetRoot2(props, ref) {\n var hydrated = (0, import_use_did_finish_ssr.useDidFinishSSR)();\n var isAdapted = (0, import_adapt.useAdaptIsActive)();\n var adaptContext = (0, import_adapt.useAdaptContext)();\n var { isShowingNonSheet } = (0, import_useSheetController.useSheetController)(props.scope);\n var shouldUseAdapt = Boolean(adaptContext.open !== void 0 || adaptContext.onOpenChange);\n var isShowingAdaptNonSheet = shouldUseAdapt && !adaptContext.active && adaptContext.open;\n var nativeImplementation = props.native === true || Array.isArray(props.native) && props.native.includes(\"ios\") ? (0, import_nativeSheet.getNativeSheet)(\"ios\") : null;\n var SheetImplementation = nativeImplementation !== null && nativeImplementation !== void 0 ? nativeImplementation : import_SheetImplementationCustom.SheetImplementationCustom;\n if (isShowingAdaptNonSheet || isShowingNonSheet || !hydrated) {\n return null;\n }\n var implementation = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SheetImplementation, {\n ref,\n ...props\n });\n return isAdapted ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_adapt.AdaptCapabilities, {\n scroll: true,\n overlay: true,\n dismiss: true,\n children: implementation\n }) : implementation;\n});\nvar sheetParts = {\n Container: SheetContainer,\n Background: SheetBackground,\n Overlay: SheetOverlay,\n Handle: SheetHandle,\n ScrollView: import_SheetScrollView.SheetScrollView\n};\nvar SheetControlled = (0, import_helpers.withStaticProperties)(SheetRoot, sheetParts);\nvar Sheet = (0, import_helpers.withStaticProperties)(SheetRoot, {\n Root: SheetRoot,\n Controlled: SheetControlled,\n useAnimatedPosition: import_SheetContext.useAnimatedPosition,\n ...sheetParts\n});\n//# sourceMappingURL=Sheet.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,cAAc,QAAQ,KAAK,kBAAkB,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B,kBAAkB,CAAC,aAAa,UAAU,aAAa;CACpF,IAAI,uBAAuB,MAAM,WAAW,QAAQ,MAAM,QAAQ,MAAM,MAAM,KAAK,MAAM,OAAO,SAAS,KAAK,KAAK,GAAG,mBAAmB,eAAc,CAAE,KAAK,IAAI;CAClK,IAAI,sBAAsB,yBAAyB,QAAQ,yBAAyB,KAAK,IAAI,uBAAuB,iCAAiC;CACrJ,IAAI,0BAA0B,qBAAqB,CAAC,UAAU;EAC5D,OAAO;CACT;CACA,IAAI,iBAAiC,iBAAC,GAAG,mBAAmB,IAAG,CAAE,qBAAqB;EACpF;EACA,GAAG;CACL,CAAC;CACD,OAAO,YAA4B,iBAAC,GAAG,mBAAmB,IAAG,CAAE,aAAa,mBAAmB;EAC7F,QAAQ;EACR,SAAS;EACT,SAAS;EACT,UAAU;CACZ,CAAC,IAAI;AACP,CAAC;AACD,IAAI,aAAa;CACf,WAAW;CACX,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,YAAY,uBAAuB;AACrC;AACA,IAAI,mBAAmB,GAAG,eAAe,qBAAoB,CAAE,WAAW,UAAU;AACpF,IAAI,SAAS,GAAG,eAAe,qBAAoB,CAAE,WAAW;CAC9D,MAAM;CACN,YAAY;CACZ,qBAAqB,oBAAoB;CACzC,GAAG;AACL,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { composeRefs } from "@tamagui/compose-refs";
|
|
2
|
-
import { View, createStyledHOC, isWeb } from "@tamagui/core";
|
|
2
|
+
import { View, createRefComponent, createStyledHOC, isWeb } from "@tamagui/core";
|
|
3
3
|
import { ScrollView } from "@tamagui/scroll-view";
|
|
4
4
|
import { useControllableState } from "@tamagui/use-controllable-state";
|
|
5
5
|
import React, { useEffect, useRef, useState } from "react";
|
|
@@ -12,8 +12,9 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
12
12
|
|
|
13
13
|
const SHEET_SCROLL_VIEW_NAME = "SheetScrollView";
|
|
14
14
|
const sheetContentStyle = { minHeight: "100%" };
|
|
15
|
-
const
|
|
15
|
+
const SheetScrollViewCustom = createRefComponent(({ scope, children, onScroll, scrollEnabled: scrollEnabledProp, style, ...props }, ref) => {
|
|
16
16
|
const context = useSheetContext(scope);
|
|
17
|
+
if (context.onlyShowContainer) throw new Error("Custom Sheet scrolling requires a custom Sheet");
|
|
17
18
|
const gestureContext = useGestureSheetContext();
|
|
18
19
|
const { scrollBridge, setHasScrollView, hasFit, screenSize } = context;
|
|
19
20
|
const keyboardOccludedHeight = Math.max(0, context.keyboardOccludedHeight || 0);
|
|
@@ -282,6 +283,17 @@ const SheetScrollView = createStyledHOC(ScrollView, ({ scope, children, onScroll
|
|
|
282
283
|
style: scrollViewStyle,
|
|
283
284
|
children: contentWrapper
|
|
284
285
|
});
|
|
286
|
+
});
|
|
287
|
+
const SheetScrollView = createStyledHOC(ScrollView, ({ scope, ...props }, ref) => {
|
|
288
|
+
const context = useSheetContext(scope);
|
|
289
|
+
return context.onlyShowContainer ? /* @__PURE__ */ jsx(ScrollView, {
|
|
290
|
+
...props,
|
|
291
|
+
ref
|
|
292
|
+
}) : /* @__PURE__ */ jsx(SheetScrollViewCustom, {
|
|
293
|
+
...props,
|
|
294
|
+
scope,
|
|
295
|
+
ref
|
|
296
|
+
});
|
|
285
297
|
}, {
|
|
286
298
|
disableTheme: true,
|
|
287
299
|
displayName: SHEET_SCROLL_VIEW_NAME
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SheetScrollView.js","names":[],"sources":["jsx/SheetScrollView.js"],"sourcesContent":["import { composeRefs } from \"@tamagui/compose-refs\";\nimport { createStyledHOC, isWeb, View } from \"@tamagui/core\";\nimport { ScrollView } from \"@tamagui/scroll-view\";\nimport { useControllableState } from \"@tamagui/use-controllable-state\";\nimport React, { useEffect, useRef, useState } from \"react\";\nimport { useGestureSheetContext } from \"./GestureSheetContext\";\nimport { getGestureHandlerState, isGestureHandlerEnabled } from \"./gestureState\";\nimport { useSheetContext } from \"./SheetContext\";\nimport { useSheetScrollViewGestures } from \"./useSheetScrollViewGestures\";\nimport {\n getStableLayoutViewportHeight,\n getWebKeyboardBottomInset,\n getWebKeyboardResizeHeight,\n isEditableElement,\n MIN_KEYBOARD_HEIGHT\n} from \"./webViewport\";\nimport { jsx, jsxs } from \"react/jsx-runtime\";\nconst SHEET_SCROLL_VIEW_NAME = \"SheetScrollView\";\nconst sheetContentStyle = { minHeight: \"100%\" };\nconst SheetScrollView = createStyledHOC(\n ScrollView,\n ({\n scope,\n children,\n onScroll,\n scrollEnabled: scrollEnabledProp,\n style,\n ...props\n }, ref) => {\n const context = useSheetContext(scope);\n const gestureContext = useGestureSheetContext();\n const { scrollBridge, setHasScrollView, hasFit, screenSize } = context;\n const keyboardOccludedHeight = Math.max(0, context.keyboardOccludedHeight || 0);\n const isKeyboardVisible = context.isKeyboardVisible === true || isWeb && getWebKeyboardResizeHeight() >= MIN_KEYBOARD_HEIGHT;\n const [scrollEnabled] = useControllableState({\n prop: scrollEnabledProp,\n defaultProp: true\n });\n const scrollRef = React.useRef(null);\n const [hasScrollableContent, setHasScrollableContent] = useState(true);\n const parentHeight = useRef(0);\n const contentHeight = useRef(0);\n const frozenFrameHeight = Math.max(0, context.keyboardStableFrameHeight || 0);\n const fitSizingProps = hasFit ? {\n flex: void 0,\n height: void 0,\n maxHeight: screenSize || void 0\n } : { flex: 1 };\n const contentContainerStyle = hasFit ? void 0 : sheetContentStyle;\n const keyboardFrozenOverride = hasFit && isKeyboardVisible && frozenFrameHeight > 0 ? { height: frozenFrameHeight, maxHeight: frozenFrameHeight } : null;\n const scrollViewStyle = [\n ...Array.isArray(style) ? style : [style],\n keyboardFrozenOverride\n ];\n const panGestureRef = gestureContext?.panGestureRef;\n const { ScrollView: RNGHScrollView } = getGestureHandlerState();\n const useRNGHScrollView = isGestureHandlerEnabled() && RNGHScrollView && panGestureRef;\n const currentScrollOffset = useRef(0);\n const lastEmittedScrollOffset = useRef(0);\n const lockedScrollY = useRef(0);\n const focusedInputScrollFrame = useRef(0);\n const setScrollEnabled = (next, lockTo) => {\n if (!next) {\n const lockY = lockTo ?? scrollBridge.scrollLockY ?? currentScrollOffset.current;\n if (scrollBridge.enabled === false && scrollBridge.scrollLockY === lockY) {\n return;\n }\n scrollBridge.enabled = false;\n lockedScrollY.current = lockY;\n scrollBridge.scrollLockY = lockY;\n if (currentScrollOffset.current !== lockY) {\n scrollRef.current?.scrollTo?.({ x: 0, y: lockY, animated: false });\n currentScrollOffset.current = lockY;\n }\n } else {\n if (scrollBridge.enabled === true && scrollBridge.scrollLockY === void 0) {\n return;\n }\n scrollBridge.enabled = true;\n lockedScrollY.current = currentScrollOffset.current;\n scrollBridge.scrollLockY = void 0;\n }\n };\n const forceScrollTo = (y) => {\n scrollRef.current?.scrollTo?.({ x: 0, y, animated: false });\n currentScrollOffset.current = y;\n };\n const emitManualScroll = React.useCallback(\n (node, y) => {\n currentScrollOffset.current = y;\n scrollBridge.y = y;\n if (y > 0) scrollBridge.scrollStartY = -1;\n lastEmittedScrollOffset.current = y;\n onScroll?.({\n nativeEvent: {\n contentOffset: {\n x: node.scrollLeft,\n y\n },\n contentSize: {\n height: node.scrollHeight,\n width: node.scrollWidth\n },\n layoutMeasurement: {\n height: node.offsetHeight,\n width: node.offsetWidth\n }\n },\n timeStamp: Date.now()\n });\n },\n [onScroll, scrollBridge]\n );\n const scrollFocusedInputClearOfKeyboard = React.useCallback(() => {\n if (!isWeb || !hasFit || !isKeyboardVisible || keyboardOccludedHeight <= 0) {\n return;\n }\n const node = scrollRef.current?.getScrollableNode();\n const active = document.activeElement;\n if (!node || !active || !isEditableElement(active) || !node.contains(active)) {\n return;\n }\n const keyboardHeight = Math.max(keyboardOccludedHeight, getWebKeyboardBottomInset());\n if (keyboardHeight <= 0) return;\n const activeRect = active.getBoundingClientRect();\n const nodeRect = node.getBoundingClientRect();\n const margin = 12;\n const keyboardTop = getStableLayoutViewportHeight() - keyboardHeight;\n const visibleTop = nodeRect.top + margin;\n const visibleBottom = Math.min(nodeRect.bottom, keyboardTop) - margin;\n let nextScrollTop = node.scrollTop;\n if (activeRect.bottom > visibleBottom) {\n nextScrollTop += Math.ceil(activeRect.bottom - visibleBottom);\n } else if (activeRect.top < visibleTop) {\n nextScrollTop -= Math.ceil(visibleTop - activeRect.top);\n }\n const maxScrollTop = Math.max(0, node.scrollHeight - node.clientHeight);\n nextScrollTop = Math.max(0, Math.min(maxScrollTop, nextScrollTop));\n if (nextScrollTop === node.scrollTop) return;\n node.scrollTop = nextScrollTop;\n currentScrollOffset.current = nextScrollTop;\n scrollBridge.y = nextScrollTop;\n if (nextScrollTop > 0) scrollBridge.scrollStartY = -1;\n }, [hasFit, isKeyboardVisible, keyboardOccludedHeight, scrollBridge]);\n const scheduleFocusedInputScroll = React.useCallback(() => {\n if (!isWeb || !hasFit) return;\n cancelAnimationFrame(focusedInputScrollFrame.current);\n focusedInputScrollFrame.current = requestAnimationFrame(() => {\n scrollFocusedInputClearOfKeyboard();\n focusedInputScrollFrame.current = requestAnimationFrame(\n scrollFocusedInputClearOfKeyboard\n );\n });\n }, [hasFit, scrollFocusedInputClearOfKeyboard]);\n useEffect(() => {\n if (!isWeb || !hasFit) return;\n scheduleFocusedInputScroll();\n window.addEventListener(\"focusin\", scheduleFocusedInputScroll);\n window.visualViewport?.addEventListener(\"resize\", scheduleFocusedInputScroll);\n return () => {\n cancelAnimationFrame(focusedInputScrollFrame.current);\n window.removeEventListener(\"focusin\", scheduleFocusedInputScroll);\n window.visualViewport?.removeEventListener(\"resize\", scheduleFocusedInputScroll);\n };\n }, [hasFit, scheduleFocusedInputScroll]);\n useEffect(() => {\n setHasScrollView(true);\n if (isGestureHandlerEnabled()) {\n scrollBridge.setScrollEnabled = setScrollEnabled;\n scrollBridge.forceScrollTo = forceScrollTo;\n }\n return () => {\n setHasScrollView(false);\n scrollBridge.setScrollEnabled = void 0;\n scrollBridge.forceScrollTo = void 0;\n };\n }, []);\n const updateScrollable = () => {\n if (parentHeight.current && contentHeight.current) {\n setHasScrollableContent(contentHeight.current > parentHeight.current);\n }\n };\n const recordFitHeight = (height) => {\n parentHeight.current = height;\n };\n useEffect(() => {\n scrollBridge.hasScrollableContent = hasScrollableContent;\n }, [hasScrollableContent]);\n const gestureProps = useSheetScrollViewGestures({\n scrollRef,\n scrollBridge,\n hasScrollableContent,\n scrollEnabled,\n setScrollEnabled,\n onManualScroll: emitManualScroll\n });\n const contentWrapper = /* @__PURE__ */ jsxs(\n View,\n {\n onLayout: (e) => {\n const height = Math.floor(e.nativeEvent.layout.height);\n if (height !== contentHeight.current) {\n contentHeight.current = height;\n updateScrollable();\n if (keyboardOccludedHeight > 0) {\n scheduleFocusedInputScroll();\n }\n }\n },\n children: [\n children,\n keyboardOccludedHeight > 0 && /* @__PURE__ */ jsx(\n View,\n {\n \"data-sheet-keyboard-scroll-pad\": true,\n height: keyboardOccludedHeight,\n width: \"100%\"\n }\n )\n ]\n }\n );\n if (useRNGHScrollView && RNGHScrollView && panGestureRef) {\n const RNGHComponent = RNGHScrollView;\n return /* @__PURE__ */ jsx(\n RNGHComponent,\n {\n ref: composeRefs(scrollRef, ref),\n style: [fitSizingProps, ...scrollViewStyle],\n scrollEventThrottle: 1,\n scrollEnabled,\n simultaneousHandlers: [panGestureRef],\n onLayout: (e) => {\n recordFitHeight(Math.ceil(e.nativeEvent.layout.height));\n updateScrollable();\n },\n onScroll: (e) => {\n const { y } = e.nativeEvent.contentOffset;\n currentScrollOffset.current = y;\n if (scrollBridge.scrollLockY !== void 0) {\n if (y !== scrollBridge.scrollLockY) {\n scrollRef.current?.scrollTo?.({\n x: 0,\n y: scrollBridge.scrollLockY,\n animated: false\n });\n }\n currentScrollOffset.current = scrollBridge.scrollLockY;\n scrollBridge.y = scrollBridge.scrollLockY;\n if (lastEmittedScrollOffset.current !== scrollBridge.scrollLockY) {\n lastEmittedScrollOffset.current = scrollBridge.scrollLockY;\n onScroll?.({\n ...e,\n nativeEvent: {\n ...e.nativeEvent,\n contentOffset: {\n ...e.nativeEvent.contentOffset,\n y: scrollBridge.scrollLockY\n }\n }\n });\n }\n return;\n }\n scrollBridge.y = y;\n if (y > 0) scrollBridge.scrollStartY = -1;\n lastEmittedScrollOffset.current = y;\n onScroll?.(e);\n },\n contentContainerStyle,\n bounces: false,\n keyboardShouldPersistTaps: \"always\",\n keyboardDismissMode: \"none\",\n ...props,\n children: contentWrapper\n }\n );\n }\n return /* @__PURE__ */ jsx(\n ScrollView,\n {\n ...fitSizingProps,\n onLayout: (e) => {\n recordFitHeight(Math.ceil(e.nativeEvent.layout.height));\n updateScrollable();\n },\n ref: composeRefs(scrollRef, ref),\n scrollEventThrottle: 1,\n className: \"_ovs-contain\",\n scrollEnabled,\n onScroll: (e) => {\n const { y } = e.nativeEvent.contentOffset;\n currentScrollOffset.current = y;\n scrollBridge.y = y;\n if (y > 0) scrollBridge.scrollStartY = -1;\n lastEmittedScrollOffset.current = y;\n onScroll?.(e);\n },\n contentContainerStyle,\n ...gestureProps,\n ...props,\n style: scrollViewStyle,\n children: contentWrapper\n }\n );\n },\n {\n disableTheme: true,\n displayName: SHEET_SCROLL_VIEW_NAME\n }\n);\nexport {\n SheetScrollView\n};\n//# sourceMappingURL=SheetScrollView.js.map\n"],"mappings":";;;;;;;;;;;;;AAiBA,MAAM,yBAAyB;AAC/B,MAAM,oBAAoB,EAAE,WAAW,OAAO;AAC9C,MAAM,kBAAkB,gBACtB,aACC,EACC,OACA,UACA,UACA,eAAe,mBACf,OACA,GAAG,SACF,QAAQ;CACT,MAAM,UAAU,gBAAgB,KAAK;CACrC,MAAM,iBAAiB,uBAAuB;CAC9C,MAAM,EAAE,cAAc,kBAAkB,QAAQ,eAAe;CAC/D,MAAM,yBAAyB,KAAK,IAAI,GAAG,QAAQ,0BAA0B,CAAC;CAC9E,MAAM,oBAAoB,QAAQ,sBAAsB,QAAQ,SAAS,2BAA2B,KAAK;CACzG,MAAM,CAAC,iBAAiB,qBAAqB;EAC3C,MAAM;EACN,aAAa;CACf,C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,EAAE;QACL,eAAe;SACb,GAAG,EAAE,YAAY;SACjB,GAAG,aAAa;QAClB;OACF;MACF,CAAC;KACH;KACA;IACF;IACA,aAAa,IAAI;IACjB,IAAI,IAAI,GAAG,aAAa,eAAe,CAAC;IACxC,wBAAwB,UAAU;IAClC,WAAW,CAAC;GACd;GACA;GACA,SAAS;GACT,2BAA2B;GAC3B,qBAAqB;GACrB,GAAG;GACH,UAAU;EACZ,CACF;CACF;CACA,OAAuB,oBACrB,YACA;EACE,GAAG;EACH,WAAW,MAAM;GACf,gBAAgB,KAAK,KAAK,EAAE,YAAY,OAAO,MAAM,CAAC;GACtD,iBAAiB;EACnB;EACA,KAAK,YAAY,WAAW,GAAG;EAC/B,qBAAqB;EACrB,WAAW;EACX;EACA,WAAW,MAAM;GACf,MAAM,EAAE,MAAM,EAAE,YAAY;GAC5B,oBAAoB,UAAU;GAC9B,aAAa,IAAI;GACjB,IAAI,IAAI,GAAG,aAAa,eAAe,CAAC;GACxC,wBAAwB,UAAU;GAClC,WAAW,CAAC;EACd;EACA;EACA,GAAG;EACH,GAAG;EACH,OAAO;EACP,UAAU;CACZ,CACF;AACF,GACA;CACE,cAAc;CACd,aAAa;AACf,CACF"}
|
|
1
|
+
{"version":3,"file":"SheetScrollView.js","names":[],"sources":["jsx/SheetScrollView.js"],"sourcesContent":["import { composeRefs } from \"@tamagui/compose-refs\";\nimport {\n createRefComponent,\n createStyledHOC,\n isWeb,\n View\n} from \"@tamagui/core\";\nimport { ScrollView } from \"@tamagui/scroll-view\";\nimport { useControllableState } from \"@tamagui/use-controllable-state\";\nimport React, { useEffect, useRef, useState } from \"react\";\nimport { useGestureSheetContext } from \"./GestureSheetContext\";\nimport { getGestureHandlerState, isGestureHandlerEnabled } from \"./gestureState\";\nimport { useSheetContext } from \"./SheetContext\";\nimport { useSheetScrollViewGestures } from \"./useSheetScrollViewGestures\";\nimport {\n getStableLayoutViewportHeight,\n getWebKeyboardBottomInset,\n getWebKeyboardResizeHeight,\n isEditableElement,\n MIN_KEYBOARD_HEIGHT\n} from \"./webViewport\";\nimport { jsx, jsxs } from \"react/jsx-runtime\";\nconst SHEET_SCROLL_VIEW_NAME = \"SheetScrollView\";\nconst sheetContentStyle = { minHeight: \"100%\" };\nconst SheetScrollViewCustom = createRefComponent(\n ({\n scope,\n children,\n onScroll,\n scrollEnabled: scrollEnabledProp,\n style,\n ...props\n }, ref) => {\n const context = useSheetContext(scope);\n if (context.onlyShowContainer)\n throw new Error(\"Custom Sheet scrolling requires a custom Sheet\");\n const gestureContext = useGestureSheetContext();\n const { scrollBridge, setHasScrollView, hasFit, screenSize } = context;\n const keyboardOccludedHeight = Math.max(0, context.keyboardOccludedHeight || 0);\n const isKeyboardVisible = context.isKeyboardVisible === true || isWeb && getWebKeyboardResizeHeight() >= MIN_KEYBOARD_HEIGHT;\n const [scrollEnabled] = useControllableState({\n prop: scrollEnabledProp,\n defaultProp: true\n });\n const scrollRef = React.useRef(null);\n const [hasScrollableContent, setHasScrollableContent] = useState(true);\n const parentHeight = useRef(0);\n const contentHeight = useRef(0);\n const frozenFrameHeight = Math.max(0, context.keyboardStableFrameHeight || 0);\n const fitSizingProps = hasFit ? {\n flex: void 0,\n height: void 0,\n maxHeight: screenSize || void 0\n } : { flex: 1 };\n const contentContainerStyle = hasFit ? void 0 : sheetContentStyle;\n const keyboardFrozenOverride = hasFit && isKeyboardVisible && frozenFrameHeight > 0 ? { height: frozenFrameHeight, maxHeight: frozenFrameHeight } : null;\n const scrollViewStyle = [\n ...Array.isArray(style) ? style : [style],\n keyboardFrozenOverride\n ];\n const panGestureRef = gestureContext?.panGestureRef;\n const { ScrollView: RNGHScrollView } = getGestureHandlerState();\n const useRNGHScrollView = isGestureHandlerEnabled() && RNGHScrollView && panGestureRef;\n const currentScrollOffset = useRef(0);\n const lastEmittedScrollOffset = useRef(0);\n const lockedScrollY = useRef(0);\n const focusedInputScrollFrame = useRef(0);\n const setScrollEnabled = (next, lockTo) => {\n if (!next) {\n const lockY = lockTo ?? scrollBridge.scrollLockY ?? currentScrollOffset.current;\n if (scrollBridge.enabled === false && scrollBridge.scrollLockY === lockY) {\n return;\n }\n scrollBridge.enabled = false;\n lockedScrollY.current = lockY;\n scrollBridge.scrollLockY = lockY;\n if (currentScrollOffset.current !== lockY) {\n scrollRef.current?.scrollTo?.({ x: 0, y: lockY, animated: false });\n currentScrollOffset.current = lockY;\n }\n } else {\n if (scrollBridge.enabled === true && scrollBridge.scrollLockY === void 0) {\n return;\n }\n scrollBridge.enabled = true;\n lockedScrollY.current = currentScrollOffset.current;\n scrollBridge.scrollLockY = void 0;\n }\n };\n const forceScrollTo = (y) => {\n scrollRef.current?.scrollTo?.({ x: 0, y, animated: false });\n currentScrollOffset.current = y;\n };\n const emitManualScroll = React.useCallback(\n (node, y) => {\n currentScrollOffset.current = y;\n scrollBridge.y = y;\n if (y > 0) scrollBridge.scrollStartY = -1;\n lastEmittedScrollOffset.current = y;\n onScroll?.({\n nativeEvent: {\n contentOffset: {\n x: node.scrollLeft,\n y\n },\n contentSize: {\n height: node.scrollHeight,\n width: node.scrollWidth\n },\n layoutMeasurement: {\n height: node.offsetHeight,\n width: node.offsetWidth\n }\n },\n timeStamp: Date.now()\n });\n },\n [onScroll, scrollBridge]\n );\n const scrollFocusedInputClearOfKeyboard = React.useCallback(() => {\n if (!isWeb || !hasFit || !isKeyboardVisible || keyboardOccludedHeight <= 0) {\n return;\n }\n const node = scrollRef.current?.getScrollableNode();\n const active = document.activeElement;\n if (!node || !active || !isEditableElement(active) || !node.contains(active)) {\n return;\n }\n const keyboardHeight = Math.max(keyboardOccludedHeight, getWebKeyboardBottomInset());\n if (keyboardHeight <= 0) return;\n const activeRect = active.getBoundingClientRect();\n const nodeRect = node.getBoundingClientRect();\n const margin = 12;\n const keyboardTop = getStableLayoutViewportHeight() - keyboardHeight;\n const visibleTop = nodeRect.top + margin;\n const visibleBottom = Math.min(nodeRect.bottom, keyboardTop) - margin;\n let nextScrollTop = node.scrollTop;\n if (activeRect.bottom > visibleBottom) {\n nextScrollTop += Math.ceil(activeRect.bottom - visibleBottom);\n } else if (activeRect.top < visibleTop) {\n nextScrollTop -= Math.ceil(visibleTop - activeRect.top);\n }\n const maxScrollTop = Math.max(0, node.scrollHeight - node.clientHeight);\n nextScrollTop = Math.max(0, Math.min(maxScrollTop, nextScrollTop));\n if (nextScrollTop === node.scrollTop) return;\n node.scrollTop = nextScrollTop;\n currentScrollOffset.current = nextScrollTop;\n scrollBridge.y = nextScrollTop;\n if (nextScrollTop > 0) scrollBridge.scrollStartY = -1;\n }, [hasFit, isKeyboardVisible, keyboardOccludedHeight, scrollBridge]);\n const scheduleFocusedInputScroll = React.useCallback(() => {\n if (!isWeb || !hasFit) return;\n cancelAnimationFrame(focusedInputScrollFrame.current);\n focusedInputScrollFrame.current = requestAnimationFrame(() => {\n scrollFocusedInputClearOfKeyboard();\n focusedInputScrollFrame.current = requestAnimationFrame(\n scrollFocusedInputClearOfKeyboard\n );\n });\n }, [hasFit, scrollFocusedInputClearOfKeyboard]);\n useEffect(() => {\n if (!isWeb || !hasFit) return;\n scheduleFocusedInputScroll();\n window.addEventListener(\"focusin\", scheduleFocusedInputScroll);\n window.visualViewport?.addEventListener(\"resize\", scheduleFocusedInputScroll);\n return () => {\n cancelAnimationFrame(focusedInputScrollFrame.current);\n window.removeEventListener(\"focusin\", scheduleFocusedInputScroll);\n window.visualViewport?.removeEventListener(\"resize\", scheduleFocusedInputScroll);\n };\n }, [hasFit, scheduleFocusedInputScroll]);\n useEffect(() => {\n setHasScrollView(true);\n if (isGestureHandlerEnabled()) {\n scrollBridge.setScrollEnabled = setScrollEnabled;\n scrollBridge.forceScrollTo = forceScrollTo;\n }\n return () => {\n setHasScrollView(false);\n scrollBridge.setScrollEnabled = void 0;\n scrollBridge.forceScrollTo = void 0;\n };\n }, []);\n const updateScrollable = () => {\n if (parentHeight.current && contentHeight.current) {\n setHasScrollableContent(contentHeight.current > parentHeight.current);\n }\n };\n const recordFitHeight = (height) => {\n parentHeight.current = height;\n };\n useEffect(() => {\n scrollBridge.hasScrollableContent = hasScrollableContent;\n }, [hasScrollableContent]);\n const gestureProps = useSheetScrollViewGestures({\n scrollRef,\n scrollBridge,\n hasScrollableContent,\n scrollEnabled,\n setScrollEnabled,\n onManualScroll: emitManualScroll\n });\n const contentWrapper = /* @__PURE__ */ jsxs(\n View,\n {\n onLayout: (e) => {\n const height = Math.floor(e.nativeEvent.layout.height);\n if (height !== contentHeight.current) {\n contentHeight.current = height;\n updateScrollable();\n if (keyboardOccludedHeight > 0) {\n scheduleFocusedInputScroll();\n }\n }\n },\n children: [\n children,\n keyboardOccludedHeight > 0 && /* @__PURE__ */ jsx(\n View,\n {\n \"data-sheet-keyboard-scroll-pad\": true,\n height: keyboardOccludedHeight,\n width: \"100%\"\n }\n )\n ]\n }\n );\n if (useRNGHScrollView && RNGHScrollView && panGestureRef) {\n const RNGHComponent = RNGHScrollView;\n return /* @__PURE__ */ jsx(\n RNGHComponent,\n {\n ref: composeRefs(scrollRef, ref),\n style: [fitSizingProps, ...scrollViewStyle],\n scrollEventThrottle: 1,\n scrollEnabled,\n simultaneousHandlers: [panGestureRef],\n onLayout: (e) => {\n recordFitHeight(Math.ceil(e.nativeEvent.layout.height));\n updateScrollable();\n },\n onScroll: (e) => {\n const { y } = e.nativeEvent.contentOffset;\n currentScrollOffset.current = y;\n if (scrollBridge.scrollLockY !== void 0) {\n if (y !== scrollBridge.scrollLockY) {\n scrollRef.current?.scrollTo?.({\n x: 0,\n y: scrollBridge.scrollLockY,\n animated: false\n });\n }\n currentScrollOffset.current = scrollBridge.scrollLockY;\n scrollBridge.y = scrollBridge.scrollLockY;\n if (lastEmittedScrollOffset.current !== scrollBridge.scrollLockY) {\n lastEmittedScrollOffset.current = scrollBridge.scrollLockY;\n onScroll?.({\n ...e,\n nativeEvent: {\n ...e.nativeEvent,\n contentOffset: {\n ...e.nativeEvent.contentOffset,\n y: scrollBridge.scrollLockY\n }\n }\n });\n }\n return;\n }\n scrollBridge.y = y;\n if (y > 0) scrollBridge.scrollStartY = -1;\n lastEmittedScrollOffset.current = y;\n onScroll?.(e);\n },\n contentContainerStyle,\n bounces: false,\n keyboardShouldPersistTaps: \"always\",\n keyboardDismissMode: \"none\",\n ...props,\n children: contentWrapper\n }\n );\n }\n return /* @__PURE__ */ jsx(\n ScrollView,\n {\n ...fitSizingProps,\n onLayout: (e) => {\n recordFitHeight(Math.ceil(e.nativeEvent.layout.height));\n updateScrollable();\n },\n ref: composeRefs(scrollRef, ref),\n scrollEventThrottle: 1,\n className: \"_ovs-contain\",\n scrollEnabled,\n onScroll: (e) => {\n const { y } = e.nativeEvent.contentOffset;\n currentScrollOffset.current = y;\n scrollBridge.y = y;\n if (y > 0) scrollBridge.scrollStartY = -1;\n lastEmittedScrollOffset.current = y;\n onScroll?.(e);\n },\n contentContainerStyle,\n ...gestureProps,\n ...props,\n style: scrollViewStyle,\n children: contentWrapper\n }\n );\n }\n);\nconst SheetScrollView = createStyledHOC(\n ScrollView,\n ({ scope, ...props }, ref) => {\n const context = useSheetContext(scope);\n return context.onlyShowContainer ? /* @__PURE__ */ jsx(ScrollView, { ...props, ref }) : /* @__PURE__ */ jsx(SheetScrollViewCustom, { ...props, scope, ref });\n },\n {\n disableTheme: true,\n displayName: SHEET_SCROLL_VIEW_NAME\n }\n);\nexport {\n SheetScrollView\n};\n//# sourceMappingURL=SheetScrollView.js.map\n"],"mappings":";;;;;;;;;;;;;AAsBA,MAAM,yBAAyB;AAC/B,MAAM,oBAAoB,EAAE,WAAW,OAAO;AAC9C,MAAM,wBAAwB,oBAC3B,EACC,OACA,UACA,UACA,eAAe,mBACf,OACA,GAAG,SACF,QAAQ;CACT,MAAM,UAAU,gBAAgB,KAAK;CACrC,IAAI,QAAQ,mBACV,MAAM,IAAI,MAAM,gDAAgD;CAClE,MAAM,iBAAiB,uBAAuB;CAC9C,MAAM,EAAE,cAAc,kBAAkB,QAAQ,eAAe;CAC/D,MAAM,yBAAyB,KAAK,IAA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ACA,oBAAoB,UAAU,aAAa;KAC3C,aAAa,IAAI,aAAa;KAC9B,IAAI,wBAAwB,YAAY,aAAa,aAAa;MAChE,wBAAwB,UAAU,aAAa;MAC/C,WAAW;OACT,GAAG;OACH,aAAa;QACX,GAAG,EAAE;QACL,eAAe;SACb,GAAG,EAAE,YAAY;SACjB,GAAG,aAAa;QAClB;OACF;MACF,CAAC;KACH;KACA;IACF;IACA,aAAa,IAAI;IACjB,IAAI,IAAI,GAAG,aAAa,eAAe,CAAC;IACxC,wBAAwB,UAAU;IAClC,WAAW,CAAC;GACd;GACA;GACA,SAAS;GACT,2BAA2B;GAC3B,qBAAqB;GACrB,GAAG;GACH,UAAU;EACZ,CACF;CACF;CACA,OAAuB,oBACrB,YACA;EACE,GAAG;EACH,WAAW,MAAM;GACf,gBAAgB,KAAK,KAAK,EAAE,YAAY,OAAO,MAAM,CAAC;GACtD,iBAAiB;EACnB;EACA,KAAK,YAAY,WAAW,GAAG;EAC/B,qBAAqB;EACrB,WAAW;EACX;EACA,WAAW,MAAM;GACf,MAAM,EAAE,MAAM,EAAE,YAAY;GAC5B,oBAAoB,UAAU;GAC9B,aAAa,IAAI;GACjB,IAAI,IAAI,GAAG,aAAa,eAAe,CAAC;GACxC,wBAAwB,UAAU;GAClC,WAAW,CAAC;EACd;EACA;EACA,GAAG;EACH,GAAG;EACH,OAAO;EACP,UAAU;CACZ,CACF;AACF,CACF;AACA,MAAM,kBAAkB,gBACtB,aACC,EAAE,OAAO,GAAG,SAAS,QAAQ;CAC5B,MAAM,UAAU,gBAAgB,KAAK;CACrC,OAAO,QAAQ,oBAAoC,oBAAI,YAAY;EAAE,GAAG;EAAO;CAAI,CAAC,IAAoB,oBAAI,uBAAuB;EAAE,GAAG;EAAO;EAAO;CAAI,CAAC;AAC7J,GACA;CACE,cAAc;CACd,aAAa;AACf,CACF"}
|
|
@@ -42,9 +42,10 @@ var import_useSheetScrollViewGestures = require("./useSheetScrollViewGestures.na
|
|
|
42
42
|
var import_webViewport = require("./webViewport.native.js");
|
|
43
43
|
var SHEET_SCROLL_VIEW_NAME = "SheetScrollView";
|
|
44
44
|
var sheetContentStyle = { minHeight: "100%" };
|
|
45
|
-
var
|
|
45
|
+
var SheetScrollViewCustom = (0, import_core.createRefComponent)(function(param, ref) {
|
|
46
46
|
var { scope, children, onScroll, scrollEnabled: scrollEnabledProp, style, ...props } = param;
|
|
47
47
|
var context = (0, import_SheetContext.useSheetContext)(scope);
|
|
48
|
+
if (context.onlyShowContainer) throw new Error("Custom Sheet scrolling requires a custom Sheet");
|
|
48
49
|
var gestureContext = (0, import_GestureSheetContext.useGestureSheetContext)();
|
|
49
50
|
var { scrollBridge, setHasScrollView, hasFit, screenSize } = context;
|
|
50
51
|
var keyboardOccludedHeight = Math.max(0, context.keyboardOccludedHeight || 0);
|
|
@@ -320,6 +321,18 @@ var SheetScrollView = (0, import_core.createStyledHOC)(import_scroll_view.Scroll
|
|
|
320
321
|
style: scrollViewStyle,
|
|
321
322
|
children: contentWrapper
|
|
322
323
|
});
|
|
324
|
+
});
|
|
325
|
+
var SheetScrollView = (0, import_core.createStyledHOC)(import_scroll_view.ScrollView, function(param, ref) {
|
|
326
|
+
var { scope, ...props } = param;
|
|
327
|
+
var context = (0, import_SheetContext.useSheetContext)(scope);
|
|
328
|
+
return context.onlyShowContainer ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_scroll_view.ScrollView, {
|
|
329
|
+
...props,
|
|
330
|
+
ref
|
|
331
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SheetScrollViewCustom, {
|
|
332
|
+
...props,
|
|
333
|
+
scope,
|
|
334
|
+
ref
|
|
335
|
+
});
|
|
323
336
|
}, {
|
|
324
337
|
disableTheme: true,
|
|
325
338
|
displayName: SHEET_SCROLL_VIEW_NAME
|
|
@@ -42,9 +42,10 @@ var import_useSheetScrollViewGestures = require("./useSheetScrollViewGestures.na
|
|
|
42
42
|
var import_webViewport = require("./webViewport.native.js");
|
|
43
43
|
var SHEET_SCROLL_VIEW_NAME = "SheetScrollView";
|
|
44
44
|
var sheetContentStyle = { minHeight: "100%" };
|
|
45
|
-
var
|
|
45
|
+
var SheetScrollViewCustom = (0, import_core.createRefComponent)(function(param, ref) {
|
|
46
46
|
var { scope, children, onScroll, scrollEnabled: scrollEnabledProp, style, ...props } = param;
|
|
47
47
|
var context = (0, import_SheetContext.useSheetContext)(scope);
|
|
48
|
+
if (context.onlyShowContainer) throw new Error("Custom Sheet scrolling requires a custom Sheet");
|
|
48
49
|
var gestureContext = (0, import_GestureSheetContext.useGestureSheetContext)();
|
|
49
50
|
var { scrollBridge, setHasScrollView, hasFit, screenSize } = context;
|
|
50
51
|
var keyboardOccludedHeight = Math.max(0, context.keyboardOccludedHeight || 0);
|
|
@@ -320,6 +321,18 @@ var SheetScrollView = (0, import_core.createStyledHOC)(import_scroll_view.Scroll
|
|
|
320
321
|
style: scrollViewStyle,
|
|
321
322
|
children: contentWrapper
|
|
322
323
|
});
|
|
324
|
+
});
|
|
325
|
+
var SheetScrollView = (0, import_core.createStyledHOC)(import_scroll_view.ScrollView, function(param, ref) {
|
|
326
|
+
var { scope, ...props } = param;
|
|
327
|
+
var context = (0, import_SheetContext.useSheetContext)(scope);
|
|
328
|
+
return context.onlyShowContainer ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_scroll_view.ScrollView, {
|
|
329
|
+
...props,
|
|
330
|
+
ref
|
|
331
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SheetScrollViewCustom, {
|
|
332
|
+
...props,
|
|
333
|
+
scope,
|
|
334
|
+
ref
|
|
335
|
+
});
|
|
323
336
|
}, {
|
|
324
337
|
disableTheme: true,
|
|
325
338
|
displayName: SHEET_SCROLL_VIEW_NAME
|