@tamagui/native 3.0.0-beta.924.1 → 3.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/dist/cjs/PressBoundary.cjs +2 -48
- package/dist/cjs/PressBoundary.native.cjs +3 -3
- package/dist/cjs/PressBoundary.native.js +3 -3
- package/dist/cjs/PressBoundary.native.js.map +1 -1
- package/dist/cjs/components.cjs +6 -2
- package/dist/cjs/components.native.cjs +6 -2
- package/dist/cjs/components.native.js +6 -2
- package/dist/cjs/components.native.js.map +1 -1
- package/dist/cjs/expoUIMenuAdapter.native.cjs +1 -5
- package/dist/cjs/expoUIMenuAdapter.native.js +1 -5
- package/dist/cjs/expoUIMenuAdapter.native.js.map +1 -1
- package/dist/cjs/expoUIMenuView.cjs +82 -0
- package/dist/cjs/expoUIMenuView.native.cjs +100 -0
- package/dist/cjs/expoUIMenuView.native.js +102 -0
- package/dist/cjs/expoUIMenuView.native.js.map +1 -0
- package/dist/cjs/index.cjs +0 -2
- package/dist/cjs/index.native.cjs +0 -2
- package/dist/cjs/index.native.js +0 -2
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/nativeMenuContext.cjs +3 -1
- package/dist/cjs/nativeMenuContext.native.cjs +6 -1
- package/dist/cjs/nativeMenuContext.native.js +6 -1
- package/dist/cjs/nativeMenuContext.native.js.map +1 -1
- package/dist/cjs/setup-expo-ui-menu.cjs +6 -1
- package/dist/cjs/setup-expo-ui-menu.native.cjs +6 -1
- package/dist/cjs/setup-expo-ui-menu.native.js +6 -1
- package/dist/cjs/setup-expo-ui-menu.native.js.map +1 -1
- package/dist/cjs/setup-one-portal.cjs +23 -0
- package/dist/cjs/setup-one-portal.native.cjs +25 -0
- package/dist/cjs/setup-one-portal.native.js +27 -0
- package/dist/cjs/setup-one-portal.native.js.map +1 -0
- package/dist/esm/PressBoundary.mjs +3 -43
- package/dist/esm/PressBoundary.mjs.map +1 -1
- package/dist/esm/PressBoundary.native.js.map +1 -1
- package/dist/esm/components.mjs +6 -2
- package/dist/esm/components.mjs.map +1 -1
- package/dist/esm/components.native.js +6 -2
- package/dist/esm/components.native.js.map +1 -1
- package/dist/esm/expoUIMenuAdapter.native.js +1 -5
- package/dist/esm/expoUIMenuAdapter.native.js.map +1 -1
- package/dist/esm/expoUIMenuView.mjs +63 -0
- package/dist/esm/expoUIMenuView.mjs.map +1 -0
- package/dist/esm/expoUIMenuView.native.js +73 -0
- package/dist/esm/expoUIMenuView.native.js.map +1 -0
- package/dist/esm/index.js +1 -2
- package/dist/esm/index.mjs +1 -2
- package/dist/esm/index.native.js +1 -2
- package/dist/esm/nativeMenuContext.mjs +3 -1
- package/dist/esm/nativeMenuContext.mjs.map +1 -1
- package/dist/esm/nativeMenuContext.native.js +6 -1
- package/dist/esm/nativeMenuContext.native.js.map +1 -1
- package/dist/esm/setup-burnt.mjs +1 -6
- package/dist/esm/setup-burnt.native.js +0 -5
- package/dist/esm/setup-expo-ui-menu.mjs +6 -6
- package/dist/esm/setup-expo-ui-menu.mjs.map +1 -1
- package/dist/esm/setup-expo-ui-menu.native.js +6 -6
- package/dist/esm/setup-expo-ui-menu.native.js.map +1 -1
- package/dist/esm/setup-gesture-handler.mjs +1 -6
- package/dist/esm/setup-gesture-handler.native.js +0 -5
- package/dist/esm/setup-keyboard-controller.native.js +0 -5
- package/dist/esm/setup-one-portal.mjs +26 -0
- package/dist/esm/setup-one-portal.mjs.map +1 -0
- package/dist/esm/setup-one-portal.native.js +26 -0
- package/dist/esm/setup-one-portal.native.js.map +1 -0
- package/dist/esm/setup-teleport.mjs +1 -6
- package/dist/esm/setup-teleport.native.js +0 -5
- package/dist/esm/setup-worklets.mjs +1 -6
- package/dist/esm/setup-worklets.native.js +0 -5
- package/dist/esm/setup-zeego.mjs +2 -7
- package/dist/esm/setup-zeego.native.js +0 -5
- package/package.json +28 -26
- package/setup-one-portal/index.cjs +2 -0
- package/setup-one-portal/index.js +2 -0
- package/setup-one-portal/index.native.cjs +2 -0
- package/setup-one-portal/index.native.js +2 -0
- package/setup-one-portal.cjs +1 -0
- package/src/PressBoundary.native.tsx +75 -0
- package/src/PressBoundary.tsx +16 -83
- package/src/components.tsx +3 -2
- package/src/expoUIMenuAdapter.tsx +2 -2
- package/src/expoUIMenuView.tsx +124 -0
- package/src/gesture-handler.ts +1 -1
- package/src/index.ts +0 -7
- package/src/nativeMenuContext.ts +7 -1
- package/src/setup-expo-ui-menu.ts +9 -1
- package/src/setup-one-portal.ts +32 -0
- package/src/types.ts +11 -5
- package/types/PressBoundary.d.ts +13 -14
- package/types/PressBoundary.d.ts.map +2 -2
- package/types/PressBoundary.native.d.ts +8 -0
- package/types/PressBoundary.native.d.ts.map +11 -0
- package/types/components.d.ts.map +1 -1
- package/types/expoUIMenuAdapter.d.ts +27 -1
- package/types/expoUIMenuAdapter.d.ts.map +2 -2
- package/types/expoUIMenuView.d.ts +24 -0
- package/types/expoUIMenuView.d.ts.map +11 -0
- package/types/gesture-handler.d.ts +1 -1
- package/types/gesture-handler.d.ts.map +1 -1
- package/types/index.d.ts +1 -5
- package/types/index.d.ts.map +2 -2
- package/types/nativeMenuContext.d.ts.map +2 -2
- package/types/setup-expo-ui-menu.d.ts.map +1 -1
- package/types/setup-one-portal.d.ts +3 -0
- package/types/setup-one-portal.d.ts.map +11 -0
- package/types/types.d.ts +10 -4
- package/types/types.d.ts.map +2 -2
- package/dist/cjs/linearGradientState.cjs +0 -41
- package/dist/cjs/linearGradientState.native.cjs +0 -43
- package/dist/cjs/linearGradientState.native.js +0 -45
- package/dist/cjs/linearGradientState.native.js.map +0 -1
- package/dist/cjs/setup-expo-linear-gradient.cjs +0 -16
- package/dist/cjs/setup-expo-linear-gradient.native.cjs +0 -18
- package/dist/cjs/setup-expo-linear-gradient.native.js +0 -20
- package/dist/cjs/setup-expo-linear-gradient.native.js.map +0 -1
- package/dist/esm/linearGradientState.mjs +0 -22
- package/dist/esm/linearGradientState.mjs.map +0 -1
- package/dist/esm/linearGradientState.native.js +0 -22
- package/dist/esm/linearGradientState.native.js.map +0 -1
- package/dist/esm/setup-expo-linear-gradient.mjs +0 -24
- package/dist/esm/setup-expo-linear-gradient.mjs.map +0 -1
- package/dist/esm/setup-expo-linear-gradient.native.js +0 -24
- package/dist/esm/setup-expo-linear-gradient.native.js.map +0 -1
- package/setup-expo-linear-gradient/index.cjs +0 -2
- package/setup-expo-linear-gradient/index.js +0 -2
- package/setup-expo-linear-gradient/index.native.cjs +0 -2
- package/setup-expo-linear-gradient/index.native.js +0 -2
- package/setup-expo-linear-gradient.cjs +0 -1
- package/src/linearGradientState.ts +0 -27
- package/src/setup-expo-linear-gradient.ts +0 -36
- package/types/linearGradientState.d.ts +0 -9
- package/types/linearGradientState.d.ts.map +0 -11
- package/types/setup-expo-linear-gradient.d.ts +0 -3
- package/types/setup-expo-linear-gradient.d.ts.map +0 -11
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"mappings": "
|
|
2
|
+
"mappings": "AAAA,cAAc,WAAW,WAAW;AAEpC,cAAc,0BAA0B;;;;;;;;;AAUxC,OAAO,iBAAS,cAAc,EAC5B,YACC,qBAAqB;CAAE,MAAM;IAAiB",
|
|
3
3
|
"names": [],
|
|
4
4
|
"sources": [
|
|
5
5
|
"src/PressBoundary.tsx"
|
|
6
6
|
],
|
|
7
7
|
"version": 3,
|
|
8
8
|
"sourcesContent": [
|
|
9
|
-
"import
|
|
9
|
+
"import type { ReactNode, Ref } from 'react'\n\nimport type { PressBoundaryProps } from './types'\n\n/**\n * Renders children as-is.\n *\n * The boundary exists to arbitrate Tamagui's shared press ownership with\n * react-native-gesture-handler, which only runs on native, so on web there is\n * nothing to claim and no view worth adding. `ref` is accepted and ignored for\n * the same reason: there is no host node here to hand back.\n */\nexport function PressBoundary({\n children,\n}: PressBoundaryProps & { ref?: Ref<unknown> }): ReactNode {\n return <>{children}</>\n}\n"
|
|
10
10
|
]
|
|
11
11
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type ViewInstance } from "react-native";
|
|
3
|
+
import type { PressBoundaryProps } from "./types";
|
|
4
|
+
export declare const PressBoundary: (props: PressBoundaryProps & {
|
|
5
|
+
ref?: React.Ref<ViewInstance>;
|
|
6
|
+
}) => React.ReactNode;
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=PressBoundary.native.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mappings": "AACA,OAAO,WAAW;AAClB,cAAoB,oBAAoB;AAMxC,cAAc,0BAA0B;AAgBxC,OAAO,cAAM,gBACX,OAAO,qBAAqB;CAAE,MAAM,MAAM,IAAI;MAC3C,MAAM",
|
|
3
|
+
"names": [],
|
|
4
|
+
"sources": [
|
|
5
|
+
"src/PressBoundary.native.tsx"
|
|
6
|
+
],
|
|
7
|
+
"version": 3,
|
|
8
|
+
"sourcesContent": [
|
|
9
|
+
"import { createRefComponent } from '@tamagui/compose-refs'\nimport React from 'react'\nimport { View, type ViewInstance } from 'react-native'\nimport {\n claimExternalPressOwnership,\n releaseExternalPressOwnership,\n type ExternalPressOwnershipToken,\n} from './gestureState'\nimport type { PressBoundaryProps } from './types'\n\nfunction composeFirst<T extends (...args: any[]) => void>(ours: T, theirs?: T) {\n return (...args: Parameters<T>) => {\n ours(...args)\n theirs?.(...args)\n }\n}\n\nfunction composeLast<T extends (...args: any[]) => void>(theirs: T | undefined, ours: T) {\n return (...args: Parameters<T>) => {\n theirs?.(...args)\n ours(...args)\n }\n}\n\nexport const PressBoundary: (\n props: PressBoundaryProps & { ref?: React.Ref<ViewInstance> }\n) => React.ReactNode = createRefComponent<ViewInstance, PressBoundaryProps>(\n function PressBoundary(\n {\n enabled,\n stopPropagation,\n debugName,\n onTouchStart,\n onTouchEnd,\n onTouchCancel,\n onResponderGrant,\n onResponderRelease,\n onResponderTerminate,\n ...props\n },\n forwardedRef\n ) {\n const tokenRef = React.useRef<ExternalPressOwnershipToken | null>(null)\n const isEnabled = enabled ?? stopPropagation ?? true\n\n const claim = React.useCallback((): void => {\n if (!isEnabled) return\n if (tokenRef.current) {\n releaseExternalPressOwnership(tokenRef.current, debugName)\n }\n tokenRef.current = claimExternalPressOwnership(debugName)\n }, [debugName, isEnabled])\n\n const release = React.useCallback((): void => {\n if (!tokenRef.current) return\n releaseExternalPressOwnership(tokenRef.current, debugName)\n tokenRef.current = null\n }, [debugName])\n\n React.useEffect(() => release, [release])\n\n return (\n <View\n ref={forwardedRef}\n {...props}\n onTouchStart={composeFirst(claim, onTouchStart)}\n onTouchEnd={composeLast(onTouchEnd, release)}\n onTouchCancel={composeLast(onTouchCancel, release)}\n onResponderGrant={composeFirst(claim, onResponderGrant)}\n onResponderRelease={composeLast(onResponderRelease, release)}\n onResponderTerminate={composeLast(onResponderTerminate, release)}\n />\n )\n }\n)\n"
|
|
10
|
+
]
|
|
11
|
+
}
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
],
|
|
7
7
|
"version": 3,
|
|
8
8
|
"sourcesContent": [
|
|
9
|
-
"import type { ReactNode } from 'react'\nimport { getPortal } from './portalState'\nimport type {\n NativePortalProps,\n NativePortalHostProps,\n NativePortalProviderProps,\n} from './types'\n\nexport type { NativePortalProps, NativePortalHostProps, NativePortalProviderProps }\n\n/**\n * Renders children into a teleport Portal when available.\n * Returns null when teleport is not set up (allows fallback handling by caller).\n */\nexport function NativePortal({\n hostName = 'root',\n children,\n}: NativePortalProps): ReactNode {\n const state = getPortal().state\n if (state.type !== 'teleport') return null\n\n const { Portal } = (globalThis as any).__tamagui_teleport\n return <Portal hostName={hostName}>{children}</Portal>\n}\n\n/**\n * Renders a teleport PortalHost when available.\n * Returns null when teleport is not set up.\n */\nexport function NativePortalHost({ name }: NativePortalHostProps): ReactNode {\n const state = getPortal().state\n if (state.type !== 'teleport') return null\n\n const { PortalHost } = (globalThis as any).__tamagui_teleport\n return <PortalHost name={name} />\n}\n\n/**\n * Wraps children with teleport PortalProvider when available.\n * Returns children as-is when teleport is not set up.\n */\nexport function NativePortalProvider({ children }: NativePortalProviderProps): ReactNode {\n const state = getPortal().state\n if (state.type !== 'teleport') return <>{children}</>\n\n const { PortalProvider } = (globalThis as any).__tamagui_teleport\n return <PortalProvider>{children}</PortalProvider>\n}\n"
|
|
9
|
+
"import type { ReactNode } from 'react'\nimport { getPortal } from './portalState'\nimport type {\n NativePortalProps,\n NativePortalHostProps,\n NativePortalProviderProps,\n} from './types'\n\nexport type { NativePortalProps, NativePortalHostProps, NativePortalProviderProps }\n\n/**\n * Renders children into a teleport Portal when available.\n * Returns null when teleport is not set up (allows fallback handling by caller).\n */\nexport function NativePortal({\n hostName = 'root',\n children,\n}: NativePortalProps): ReactNode {\n const state = getPortal().state\n if (state.type !== 'teleport') return null\n\n const { Portal } = (globalThis as any).__tamagui_teleport\n return <Portal hostName={hostName}>{children}</Portal>\n}\n\n/**\n * Renders a teleport PortalHost when available.\n * Returns null when teleport is not set up.\n */\nexport function NativePortalHost({ name }: NativePortalHostProps): ReactNode {\n const state = getPortal().state\n if (state.type !== 'teleport') return null\n\n const { PortalHost, hostStyle } = (globalThis as any).__tamagui_teleport\n return <PortalHost name={name} style={hostStyle} />\n}\n\n/**\n * Wraps children with teleport PortalProvider when available.\n * Returns children as-is when teleport is not set up.\n */\nexport function NativePortalProvider({ children }: NativePortalProviderProps): ReactNode {\n const state = getPortal().state\n if (state.type !== 'teleport') return <>{children}</>\n\n const { PortalProvider } = (globalThis as any).__tamagui_teleport\n if (!PortalProvider) return <>{children}</>\n return <PortalProvider>{children}</PortalProvider>\n}\n"
|
|
10
10
|
]
|
|
11
11
|
}
|
|
@@ -1,5 +1,31 @@
|
|
|
1
|
-
import type { ComponentType } from "react";
|
|
1
|
+
import type { ComponentType, ReactNode } from "react";
|
|
2
2
|
import type { NativeMenuAdapter } from "./nativeMenuState";
|
|
3
|
+
export type ExpoMenuAction = {
|
|
4
|
+
id: string;
|
|
5
|
+
title: string;
|
|
6
|
+
image?: unknown;
|
|
7
|
+
state?: "on" | "off";
|
|
8
|
+
attributes?: {
|
|
9
|
+
destructive?: boolean;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
hidden?: boolean;
|
|
12
|
+
};
|
|
13
|
+
subactions?: ExpoMenuAction[];
|
|
14
|
+
displayInline?: boolean;
|
|
15
|
+
};
|
|
16
|
+
export type ExpoMenuViewProps = {
|
|
17
|
+
actions: ExpoMenuAction[];
|
|
18
|
+
title?: string;
|
|
19
|
+
shouldOpenOnLongPress?: boolean;
|
|
20
|
+
onPressAction?: (event: {
|
|
21
|
+
nativeEvent: {
|
|
22
|
+
event: string;
|
|
23
|
+
};
|
|
24
|
+
}) => void;
|
|
25
|
+
onOpenMenu?: () => void;
|
|
26
|
+
onCloseMenu?: () => void;
|
|
27
|
+
children?: ReactNode;
|
|
28
|
+
};
|
|
3
29
|
export type ExpoUIMenuAdapterOptions = {
|
|
4
30
|
MenuView: ComponentType<any>;
|
|
5
31
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"mappings": "AAAA,cAAc,
|
|
2
|
+
"mappings": "AAAA,cAAc,eAA6B,iBAAiB;AAG5D,cAAc,yBAA2C;AAEzD,YAAY,iBAAiB;CAC3B;CACA;CACA;CACA,QAAQ,OAAO;CACf,aAAa;EACX;EACA;EACA;;CAEF,aAAa;CACb;;AAGF,YAAY,oBAAoB;CAC9B,SAAS;CACT;CACA;CACA,iBAAiB,OAAO;EAAE,aAAa;GAAE;;;CACzC;CACA;CACA,WAAW;;AAGb,YAAY,2BAA2B;CACrC,UAAU;;AAgEZ,OAAO,iBAAS,wBAAwB,EACtC,YACC,2BAA2B",
|
|
3
3
|
"names": [],
|
|
4
4
|
"sources": [
|
|
5
5
|
"src/expoUIMenuAdapter.tsx"
|
|
6
6
|
],
|
|
7
7
|
"version": 3,
|
|
8
8
|
"sourcesContent": [
|
|
9
|
-
"import type { ComponentType, ReactElement, ReactNode } from 'react'\nimport React from 'react'\n\nimport type { NativeMenuAdapter, NativeMenuModule } from './nativeMenuState'\n\ntype ExpoMenuAction = {\n id: string\n title: string\n image?: unknown\n state?: 'on' | 'off'\n attributes?: {\n destructive?: boolean\n disabled?: boolean\n hidden?: boolean\n }\n subactions?: ExpoMenuAction[]\n displayInline?: boolean\n}\n\ntype ExpoMenuViewProps = {\n actions: ExpoMenuAction[]\n title?: string\n shouldOpenOnLongPress?: boolean\n onPressAction?: (event: { nativeEvent: { event: string } }) => void\n onOpenMenu?: () => void\n onCloseMenu?: () => void\n children?: ReactNode\n}\n\nexport type ExpoUIMenuAdapterOptions = {\n MenuView: ComponentType<any>\n}\n\ntype MarkerProps = {\n children?: ReactNode\n [key: string]: unknown\n}\n\nfunction marker(name: string): ComponentType<MarkerProps> {\n const Marker = () => null\n Marker.displayName = `ExpoUI${name}`\n return Marker\n}\n\nfunction isMarkerType(candidate: unknown, type: ComponentType<MarkerProps>): boolean {\n if (candidate === type) return true\n // createMenu runs every native component through withNativeMenu, which wraps\n // it in a new function component and copies the marker's displayName onto the\n // wrapper. that wrapper is a different reference, so an identity-only check\n // matches nothing and every item silently comes back with an empty title, no\n // icon, and no submenu. fall back to the (unique, ExpoUI-prefixed) name.\n const wanted = (type as { displayName?: string }).displayName\n if (!wanted) return false\n return (\n typeof candidate === 'function' &&\n (candidate as { displayName?: string }).displayName === wanted\n )\n}\n\nfunction elementOfType(\n children: ReactNode,\n type: ComponentType<MarkerProps>\n): ReactElement<MarkerProps> | null {\n for (const child of React.Children.toArray(children)) {\n if (React.isValidElement<MarkerProps>(child) && isMarkerType(child.type, type)) {\n return child\n }\n }\n return null\n}\n\nconst warnedUnsupported = new Set<string>()\n\n// @expo/ui's MenuAction carries no subtitle, and its MenuView has no preview or\n// auxiliary view. these are decorations on a menu that is otherwise complete, so\n// drop them and warn once. throwing took down the whole app for an optional\n// embellishment. apps cannot avoid this without forking their markup per adapter.\nfunction warnUnsupported(feature: string) {\n if (warnedUnsupported.has(feature) || process.env.NODE_ENV === 'production') {\n return\n }\n warnedUnsupported.add(feature)\n console.warn(\n `[Tamagui] @expo/ui/community/menu does not support ${feature}, so it will not render. ` +\n `Register a different native menu adapter if you need it.`\n )\n}\n\nfunction textFromNode(node: ReactNode): string {\n if (typeof node === 'string' || typeof node === 'number') return String(node)\n if (!React.isValidElement<MarkerProps>(node)) return ''\n return React.Children.toArray(node.props.children).map(textFromNode).join('')\n}\n\nexport function createExpoUIMenuAdapter({\n MenuView,\n}: ExpoUIMenuAdapterOptions): NativeMenuAdapter {\n const NativeMenuView: ComponentType<ExpoMenuViewProps> = MenuView\n\n function createModule(isContextMenu: boolean): NativeMenuModule {\n const Trigger = marker('Trigger')\n const Content = marker('Content')\n const Item = marker('Item')\n const ItemTitle = marker('ItemTitle')\n const ItemSubtitle = marker('ItemSubtitle')\n const ItemIcon = marker('ItemIcon')\n const ItemImage = marker('ItemImage')\n const ItemIndicator = marker('ItemIndicator')\n const Group = marker('Group')\n const Label = marker('Label')\n const Separator = marker('Separator')\n const Sub = marker('Sub')\n const SubTrigger = marker('SubTrigger')\n const SubContent = marker('SubContent')\n const CheckboxItem = marker('CheckboxItem')\n const Preview = marker('Preview')\n const Auxiliary = marker('Auxiliary')\n\n function Root({\n children,\n onOpenChange,\n onOpenWillChange,\n }: {\n children?: ReactNode\n onOpenChange?: (open: boolean) => void\n onOpenWillChange?: (open: boolean) => void\n }) {\n const trigger = elementOfType(children, Trigger)\n const content = elementOfType(children, Content)\n const preview = elementOfType(children, Preview)\n const auxiliary = elementOfType(children, Auxiliary)\n\n if (preview || auxiliary) {\n warnUnsupported('context-menu previews or auxiliary views')\n }\n if (!trigger || !content) {\n throw new Error('Tamagui native menus require one Trigger and one Content')\n }\n\n let nextId = 0\n const handlers = new Map<string, () => void>()\n\n function actionId(element: ReactElement<MarkerProps>): string {\n return element.key == null\n ? `tamagui-menu-${nextId++}`\n : String(element.key).replace(/^\\.\\$/, '')\n }\n\n function itemTitle(element: ReactElement<MarkerProps>): string {\n if (typeof element.props.textValue === 'string') return element.props.textValue\n const title = elementOfType(element.props.children, ItemTitle)\n return title ? textFromNode(title.props.children) : ''\n }\n\n function actionImage(element: ReactElement<MarkerProps>): unknown {\n const image = elementOfType(element.props.children, ItemImage)\n if (image?.props.source) return image.props.source\n const icon = elementOfType(element.props.children, ItemIcon)\n if (!icon) return undefined\n const ios = icon.props.ios\n if (\n typeof ios === 'object' &&\n ios &&\n 'name' in ios &&\n typeof ios.name === 'string'\n ) {\n return ios.name\n }\n return typeof icon.props.iosIconName === 'string'\n ? icon.props.iosIconName\n : undefined\n }\n\n function attributes(\n element: ReactElement<MarkerProps>\n ): ExpoMenuAction['attributes'] {\n const destructive = element.props.destructive === true\n const disabled = element.props.disabled === true\n const hidden = element.props.hidden === true\n return destructive || disabled || hidden\n ? { destructive, disabled, hidden }\n : undefined\n }\n\n function actionsFrom(childrenToParse: ReactNode): ExpoMenuAction[] {\n const actions: ExpoMenuAction[] = []\n let section: ExpoMenuAction[] | null = null\n\n function append(action: ExpoMenuAction) {\n if (section) {\n section.push(action)\n } else {\n actions.push(action)\n }\n }\n\n function flushSection() {\n if (!section?.length) {\n section = []\n return\n }\n actions.push({\n id: `tamagui-menu-section-${nextId++}`,\n title: '',\n subactions: section,\n displayInline: true,\n })\n section = []\n }\n\n for (const child of React.Children.toArray(childrenToParse)) {\n if (!React.isValidElement<MarkerProps>(child)) continue\n\n if (isMarkerType(child.type, Separator)) {\n if (!section) section = actions.splice(0)\n flushSection()\n continue\n }\n\n if (isMarkerType(child.type, Group)) {\n const label = elementOfType(child.props.children, Label)\n append({\n id: actionId(child),\n title: label ? textFromNode(label.props.children) : '',\n subactions: actionsFrom(child.props.children),\n displayInline: true,\n })\n continue\n }\n\n if (isMarkerType(child.type, Sub)) {\n const subTrigger = elementOfType(child.props.children, SubTrigger)\n const subContent = elementOfType(child.props.children, SubContent)\n if (!subTrigger || !subContent) {\n throw new Error(\n 'Tamagui native submenus require one SubTrigger and SubContent'\n )\n }\n append({\n id: actionId(child),\n title: itemTitle(subTrigger),\n image: actionImage(subTrigger),\n attributes: attributes(subTrigger),\n subactions: actionsFrom(subContent.props.children),\n })\n continue\n }\n\n if (!isMarkerType(child.type, Item) && !isMarkerType(child.type, CheckboxItem))\n continue\n\n if (elementOfType(child.props.children, ItemSubtitle)) {\n warnUnsupported('menu item subtitles')\n }\n\n const id = actionId(child)\n if (isMarkerType(child.type, CheckboxItem)) {\n const current =\n child.props.value === true ||\n child.props.value === 'on' ||\n child.props.checked === true\n const onValueChange = child.props.onValueChange\n const onCheckedChange = child.props.onCheckedChange\n handlers.set(id, () => {\n if (typeof onValueChange === 'function') {\n onValueChange(current ? 'off' : 'on', current ? 'on' : 'off')\n } else if (typeof onCheckedChange === 'function') {\n onCheckedChange(!current)\n }\n })\n append({\n id,\n title: itemTitle(child),\n image: actionImage(child),\n state: current ? 'on' : 'off',\n attributes: attributes(child),\n })\n continue\n }\n\n const onSelect = child.props.onSelect\n if (typeof onSelect === 'function') {\n handlers.set(id, () => onSelect())\n }\n append({\n id,\n title: itemTitle(child),\n image: actionImage(child),\n attributes: attributes(child),\n })\n }\n\n if (section) flushSection()\n return actions\n }\n\n const label = elementOfType(content.props.children, Label)\n const triggerAction = trigger.props.action\n\n return (\n <NativeMenuView\n actions={actionsFrom(content.props.children)}\n title={label ? textFromNode(label.props.children) : undefined}\n shouldOpenOnLongPress={\n triggerAction === 'longPress' || (triggerAction !== 'press' && isContextMenu)\n }\n onPressAction={(event) => handlers.get(event.nativeEvent.event)?.()}\n onOpenMenu={() => {\n onOpenWillChange?.(true)\n onOpenChange?.(true)\n }}\n onCloseMenu={() => {\n onOpenWillChange?.(false)\n onOpenChange?.(false)\n }}\n >\n {trigger.props.children}\n </NativeMenuView>\n )\n }\n\n return {\n Root,\n Trigger,\n Content,\n Item,\n ItemTitle,\n ItemSubtitle,\n ItemIcon,\n ItemImage,\n ItemIndicator,\n Group,\n Label,\n Separator,\n Sub,\n SubTrigger,\n SubContent,\n CheckboxItem,\n Preview,\n Auxiliary,\n }\n }\n\n return {\n name: 'expo-ui',\n Menu: createModule(false),\n ContextMenu: createModule(true),\n }\n}\n"
|
|
9
|
+
"import type { ComponentType, ReactElement, ReactNode } from 'react'\nimport React from 'react'\n\nimport type { NativeMenuAdapter, NativeMenuModule } from './nativeMenuState'\n\nexport type ExpoMenuAction = {\n id: string\n title: string\n image?: unknown\n state?: 'on' | 'off'\n attributes?: {\n destructive?: boolean\n disabled?: boolean\n hidden?: boolean\n }\n subactions?: ExpoMenuAction[]\n displayInline?: boolean\n}\n\nexport type ExpoMenuViewProps = {\n actions: ExpoMenuAction[]\n title?: string\n shouldOpenOnLongPress?: boolean\n onPressAction?: (event: { nativeEvent: { event: string } }) => void\n onOpenMenu?: () => void\n onCloseMenu?: () => void\n children?: ReactNode\n}\n\nexport type ExpoUIMenuAdapterOptions = {\n MenuView: ComponentType<any>\n}\n\ntype MarkerProps = {\n children?: ReactNode\n [key: string]: unknown\n}\n\nfunction marker(name: string): ComponentType<MarkerProps> {\n const Marker = () => null\n Marker.displayName = `ExpoUI${name}`\n return Marker\n}\n\nfunction isMarkerType(candidate: unknown, type: ComponentType<MarkerProps>): boolean {\n if (candidate === type) return true\n // createMenu runs every native component through withNativeMenu, which wraps\n // it in a new function component and copies the marker's displayName onto the\n // wrapper. that wrapper is a different reference, so an identity-only check\n // matches nothing and every item silently comes back with an empty title, no\n // icon, and no submenu. fall back to the (unique, ExpoUI-prefixed) name.\n const wanted = (type as { displayName?: string }).displayName\n if (!wanted) return false\n return (\n typeof candidate === 'function' &&\n (candidate as { displayName?: string }).displayName === wanted\n )\n}\n\nfunction elementOfType(\n children: ReactNode,\n type: ComponentType<MarkerProps>\n): ReactElement<MarkerProps> | null {\n for (const child of React.Children.toArray(children)) {\n if (React.isValidElement<MarkerProps>(child) && isMarkerType(child.type, type)) {\n return child\n }\n }\n return null\n}\n\nconst warnedUnsupported = new Set<string>()\n\n// @expo/ui's MenuAction carries no subtitle, and its MenuView has no preview or\n// auxiliary view. these are decorations on a menu that is otherwise complete, so\n// drop them and warn once. throwing took down the whole app for an optional\n// embellishment. apps cannot avoid this without forking their markup per adapter.\nfunction warnUnsupported(feature: string) {\n if (warnedUnsupported.has(feature) || process.env.NODE_ENV === 'production') {\n return\n }\n warnedUnsupported.add(feature)\n console.warn(\n `[Tamagui] @expo/ui/community/menu does not support ${feature}, so it will not render. ` +\n `Register a different native menu adapter if you need it.`\n )\n}\n\nfunction textFromNode(node: ReactNode): string {\n if (typeof node === 'string' || typeof node === 'number') return String(node)\n if (!React.isValidElement<MarkerProps>(node)) return ''\n return React.Children.toArray(node.props.children).map(textFromNode).join('')\n}\n\nexport function createExpoUIMenuAdapter({\n MenuView,\n}: ExpoUIMenuAdapterOptions): NativeMenuAdapter {\n const NativeMenuView: ComponentType<ExpoMenuViewProps> = MenuView\n\n function createModule(isContextMenu: boolean): NativeMenuModule {\n const Trigger = marker('Trigger')\n const Content = marker('Content')\n const Item = marker('Item')\n const ItemTitle = marker('ItemTitle')\n const ItemSubtitle = marker('ItemSubtitle')\n const ItemIcon = marker('ItemIcon')\n const ItemImage = marker('ItemImage')\n const ItemIndicator = marker('ItemIndicator')\n const Group = marker('Group')\n const Label = marker('Label')\n const Separator = marker('Separator')\n const Sub = marker('Sub')\n const SubTrigger = marker('SubTrigger')\n const SubContent = marker('SubContent')\n const CheckboxItem = marker('CheckboxItem')\n const Preview = marker('Preview')\n const Auxiliary = marker('Auxiliary')\n\n function Root({\n children,\n onOpenChange,\n onOpenWillChange,\n }: {\n children?: ReactNode\n onOpenChange?: (open: boolean) => void\n onOpenWillChange?: (open: boolean) => void\n }) {\n const trigger = elementOfType(children, Trigger)\n const content = elementOfType(children, Content)\n const preview = elementOfType(children, Preview)\n const auxiliary = elementOfType(children, Auxiliary)\n\n if (preview || auxiliary) {\n warnUnsupported('context-menu previews or auxiliary views')\n }\n if (!trigger || !content) {\n throw new Error('Tamagui native menus require one Trigger and one Content')\n }\n\n let nextId = 0\n const handlers = new Map<string, () => void>()\n\n function actionId(element: ReactElement<MarkerProps>): string {\n return element.key == null\n ? `tamagui-menu-${nextId++}`\n : String(element.key).replace(/^\\.\\$/, '')\n }\n\n function itemTitle(element: ReactElement<MarkerProps>): string {\n if (typeof element.props.textValue === 'string') return element.props.textValue\n const title = elementOfType(element.props.children, ItemTitle)\n return title ? textFromNode(title.props.children) : ''\n }\n\n function actionImage(element: ReactElement<MarkerProps>): unknown {\n const image = elementOfType(element.props.children, ItemImage)\n if (image?.props.source) return image.props.source\n const icon = elementOfType(element.props.children, ItemIcon)\n if (!icon) return undefined\n const ios = icon.props.ios\n if (\n typeof ios === 'object' &&\n ios &&\n 'name' in ios &&\n typeof ios.name === 'string'\n ) {\n return ios.name\n }\n return typeof icon.props.iosIconName === 'string'\n ? icon.props.iosIconName\n : undefined\n }\n\n function attributes(\n element: ReactElement<MarkerProps>\n ): ExpoMenuAction['attributes'] {\n const destructive = element.props.destructive === true\n const disabled = element.props.disabled === true\n const hidden = element.props.hidden === true\n return destructive || disabled || hidden\n ? { destructive, disabled, hidden }\n : undefined\n }\n\n function actionsFrom(childrenToParse: ReactNode): ExpoMenuAction[] {\n const actions: ExpoMenuAction[] = []\n let section: ExpoMenuAction[] | null = null\n\n function append(action: ExpoMenuAction) {\n if (section) {\n section.push(action)\n } else {\n actions.push(action)\n }\n }\n\n function flushSection() {\n if (!section?.length) {\n section = []\n return\n }\n actions.push({\n id: `tamagui-menu-section-${nextId++}`,\n title: '',\n subactions: section,\n displayInline: true,\n })\n section = []\n }\n\n for (const child of React.Children.toArray(childrenToParse)) {\n if (!React.isValidElement<MarkerProps>(child)) continue\n\n if (isMarkerType(child.type, Separator)) {\n if (!section) section = actions.splice(0)\n flushSection()\n continue\n }\n\n if (isMarkerType(child.type, Group)) {\n const label = elementOfType(child.props.children, Label)\n append({\n id: actionId(child),\n title: label ? textFromNode(label.props.children) : '',\n subactions: actionsFrom(child.props.children),\n displayInline: true,\n })\n continue\n }\n\n if (isMarkerType(child.type, Sub)) {\n const subTrigger = elementOfType(child.props.children, SubTrigger)\n const subContent = elementOfType(child.props.children, SubContent)\n if (!subTrigger || !subContent) {\n throw new Error(\n 'Tamagui native submenus require one SubTrigger and SubContent'\n )\n }\n append({\n id: actionId(child),\n title: itemTitle(subTrigger),\n image: actionImage(subTrigger),\n attributes: attributes(subTrigger),\n subactions: actionsFrom(subContent.props.children),\n })\n continue\n }\n\n if (!isMarkerType(child.type, Item) && !isMarkerType(child.type, CheckboxItem))\n continue\n\n if (elementOfType(child.props.children, ItemSubtitle)) {\n warnUnsupported('menu item subtitles')\n }\n\n const id = actionId(child)\n if (isMarkerType(child.type, CheckboxItem)) {\n const current =\n child.props.value === true ||\n child.props.value === 'on' ||\n child.props.checked === true\n const onValueChange = child.props.onValueChange\n const onCheckedChange = child.props.onCheckedChange\n handlers.set(id, () => {\n if (typeof onValueChange === 'function') {\n onValueChange(current ? 'off' : 'on', current ? 'on' : 'off')\n } else if (typeof onCheckedChange === 'function') {\n onCheckedChange(!current)\n }\n })\n append({\n id,\n title: itemTitle(child),\n image: actionImage(child),\n state: current ? 'on' : 'off',\n attributes: attributes(child),\n })\n continue\n }\n\n const onSelect = child.props.onSelect\n if (typeof onSelect === 'function') {\n handlers.set(id, () => onSelect())\n }\n append({\n id,\n title: itemTitle(child),\n image: actionImage(child),\n attributes: attributes(child),\n })\n }\n\n if (section) flushSection()\n return actions\n }\n\n const label = elementOfType(content.props.children, Label)\n const triggerAction = trigger.props.action\n\n return (\n <NativeMenuView\n actions={actionsFrom(content.props.children)}\n title={label ? textFromNode(label.props.children) : undefined}\n shouldOpenOnLongPress={\n triggerAction === 'longPress' || (triggerAction !== 'press' && isContextMenu)\n }\n onPressAction={(event) => handlers.get(event.nativeEvent.event)?.()}\n onOpenMenu={() => {\n onOpenWillChange?.(true)\n onOpenChange?.(true)\n }}\n onCloseMenu={() => {\n onOpenWillChange?.(false)\n onOpenChange?.(false)\n }}\n >\n {trigger.props.children}\n </NativeMenuView>\n )\n }\n\n return {\n Root,\n Trigger,\n Content,\n Item,\n ItemTitle,\n ItemSubtitle,\n ItemIcon,\n ItemImage,\n ItemIndicator,\n Group,\n Label,\n Separator,\n Sub,\n SubTrigger,\n SubContent,\n CheckboxItem,\n Preview,\n Auxiliary,\n }\n }\n\n return {\n name: 'expo-ui',\n Menu: createModule(false),\n ContextMenu: createModule(true),\n }\n}\n"
|
|
10
10
|
]
|
|
11
11
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ComponentType } from "react";
|
|
2
|
+
import type { ExpoMenuViewProps } from "./expoUIMenuAdapter";
|
|
3
|
+
type SwiftUIModule = {
|
|
4
|
+
Button: ComponentType<any>;
|
|
5
|
+
ContextMenu: ComponentType<any> & {
|
|
6
|
+
Trigger: ComponentType<any>;
|
|
7
|
+
Items: ComponentType<any>;
|
|
8
|
+
};
|
|
9
|
+
Host: ComponentType<any>;
|
|
10
|
+
Menu: ComponentType<any>;
|
|
11
|
+
RNHostView: ComponentType<any>;
|
|
12
|
+
Section: ComponentType<any>;
|
|
13
|
+
Toggle: ComponentType<any>;
|
|
14
|
+
};
|
|
15
|
+
type SwiftUIModifiersModule = {
|
|
16
|
+
disabled: (value: boolean) => unknown;
|
|
17
|
+
};
|
|
18
|
+
export declare function createExpoUIMenuView({ swiftUI, modifiers }: {
|
|
19
|
+
swiftUI: SwiftUIModule;
|
|
20
|
+
modifiers: SwiftUIModifiersModule;
|
|
21
|
+
}): ComponentType<ExpoMenuViewProps>;
|
|
22
|
+
export {};
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=expoUIMenuView.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mappings": "AAAA,cAAc,qBAAgC;AAG9C,cAA8B,yBAAyB;KAalD,gBAAgB;CACnB,QAAQ;CACR,aAAa,qBAAqB;EAChC,SAAS;EACT,OAAO;;CAET,MAAM;CACN,MAAM;CACN,YAAY;CACZ,SAAS;CACT,QAAQ;;KAGL,yBAAyB;CAC5B,WAAW;;AAGb,OAAO,iBAAS,qBAAqB,EACnC,SACA,aACC;CACD,SAAS;CACT,WAAW;IACT,cAAc",
|
|
3
|
+
"names": [],
|
|
4
|
+
"sources": [
|
|
5
|
+
"src/expoUIMenuView.tsx"
|
|
6
|
+
],
|
|
7
|
+
"version": 3,
|
|
8
|
+
"sourcesContent": [
|
|
9
|
+
"import type { ComponentType, ReactNode } from 'react'\nimport React from 'react'\n\nimport type { ExpoMenuAction, ExpoMenuViewProps } from './expoUIMenuAdapter'\n\n// the swiftui menu behind every native Menu and ContextMenu trigger on ios,\n// composed from @expo/ui/swift-ui the same way @expo/ui's community MenuView\n// is, minus `matchContents` on the Host. that flag copies each SwiftUI\n// measurement back onto the host's yoga node as a fixed height, and yoga then\n// measures the trigger's react-native children against that height, so trigger\n// content can shrink but never grow: a row that mounts empty and fills in later\n// stays at 0pt, and a streaming paragraph stays at its first line count. without\n// the flag the host takes its height from the hosted react-native subtree like\n// any other view, and RNHostView still sizes the SwiftUI side from that\n// subtree's yoga bounds.\n\ntype SwiftUIModule = {\n Button: ComponentType<any>\n ContextMenu: ComponentType<any> & {\n Trigger: ComponentType<any>\n Items: ComponentType<any>\n }\n Host: ComponentType<any>\n Menu: ComponentType<any>\n RNHostView: ComponentType<any>\n Section: ComponentType<any>\n Toggle: ComponentType<any>\n}\n\ntype SwiftUIModifiersModule = {\n disabled: (value: boolean) => unknown\n}\n\nexport function createExpoUIMenuView({\n swiftUI,\n modifiers,\n}: {\n swiftUI: SwiftUIModule\n modifiers: SwiftUIModifiersModule\n}): ComponentType<ExpoMenuViewProps> {\n const { Button, ContextMenu, Host, Menu, RNHostView, Section, Toggle } = swiftUI\n\n function renderAction(\n action: ExpoMenuAction,\n onPressAction: ExpoMenuViewProps['onPressAction']\n ): ReactNode {\n if (action.attributes?.hidden) return null\n const { subactions, displayInline, state, attributes, image, title } = action\n const systemImage = typeof image === 'string' ? image : undefined\n\n if (subactions && subactions.length > 0) {\n const children = subactions.map((sub) => renderAction(sub, onPressAction))\n if (displayInline) {\n return (\n <Section key={action.id} title={title}>\n {children}\n </Section>\n )\n }\n return (\n <Menu key={action.id} label={title} systemImage={systemImage}>\n {children}\n </Menu>\n )\n }\n\n const fire = () => onPressAction?.({ nativeEvent: { event: action.id } })\n const itemModifiers = attributes?.disabled ? [modifiers.disabled(true)] : undefined\n\n if (state === 'on' || state === 'off') {\n return (\n <Toggle\n key={action.id}\n label={title}\n systemImage={systemImage}\n isOn={state === 'on'}\n onIsOnChange={fire}\n modifiers={itemModifiers}\n />\n )\n }\n\n return (\n <Button\n key={action.id}\n label={title}\n systemImage={systemImage}\n role={attributes?.destructive ? 'destructive' : undefined}\n modifiers={itemModifiers}\n onPress={fire}\n />\n )\n }\n\n return function ExpoUIMenuView({\n actions,\n onPressAction,\n shouldOpenOnLongPress,\n title,\n children,\n }: ExpoMenuViewProps) {\n const items = actions.map((action) => renderAction(action, onPressAction))\n const body = title ? <Section title={title}>{items}</Section> : items\n // RNHostView takes exactly one element, so the trigger children ride in a\n // fragment\n const trigger = (\n <RNHostView matchContents>\n <>{children}</>\n </RNHostView>\n )\n return (\n <Host ignoreSafeArea=\"all\">\n {shouldOpenOnLongPress ? (\n <ContextMenu>\n <ContextMenu.Trigger>{trigger}</ContextMenu.Trigger>\n <ContextMenu.Items>{body}</ContextMenu.Items>\n </ContextMenu>\n ) : (\n <Menu label={trigger}>{body}</Menu>\n )}\n </Host>\n )\n }\n}\n"
|
|
10
|
+
]
|
|
11
|
+
}
|
|
@@ -2,7 +2,7 @@ export { getGestureHandler } from "./gestureState";
|
|
|
2
2
|
export type { ExternalPressOwnershipToken, GestureHandlerAccessor, PressGestureConfig } from "./gestureState";
|
|
3
3
|
export { claimExternalPressOwnership as unstable_claimExternalPressOwnership, hasExternalPressOwnership as unstable_hasExternalPressOwnership, releaseExternalPressOwnership as unstable_releaseExternalPressOwnership } from "./gestureState";
|
|
4
4
|
export { PressBoundary } from "./PressBoundary";
|
|
5
|
-
export type { PressBoundaryProps } from "./
|
|
5
|
+
export type { PressBoundaryProps } from "./types";
|
|
6
6
|
export { getGestureHandlerConfig, setupGestureHandler, type GestureHandlerConfig } from "./setup-gesture-handler";
|
|
7
7
|
|
|
8
8
|
//# sourceMappingURL=gesture-handler.d.ts.map
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
],
|
|
7
7
|
"version": 3,
|
|
8
8
|
"sourcesContent": [
|
|
9
|
-
"export { getGestureHandler } from './gestureState'\nexport type {\n ExternalPressOwnershipToken,\n GestureHandlerAccessor,\n PressGestureConfig,\n} from './gestureState'\nexport {\n claimExternalPressOwnership as unstable_claimExternalPressOwnership,\n hasExternalPressOwnership as unstable_hasExternalPressOwnership,\n releaseExternalPressOwnership as unstable_releaseExternalPressOwnership,\n} from './gestureState'\nexport { PressBoundary } from './PressBoundary'\nexport type { PressBoundaryProps } from './
|
|
9
|
+
"export { getGestureHandler } from './gestureState'\nexport type {\n ExternalPressOwnershipToken,\n GestureHandlerAccessor,\n PressGestureConfig,\n} from './gestureState'\nexport {\n claimExternalPressOwnership as unstable_claimExternalPressOwnership,\n hasExternalPressOwnership as unstable_hasExternalPressOwnership,\n releaseExternalPressOwnership as unstable_releaseExternalPressOwnership,\n} from './gestureState'\nexport { PressBoundary } from './PressBoundary'\nexport type { PressBoundaryProps } from './types'\nexport {\n getGestureHandlerConfig,\n setupGestureHandler,\n type GestureHandlerConfig,\n} from './setup-gesture-handler'\n"
|
|
10
10
|
]
|
|
11
11
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -10,15 +10,13 @@
|
|
|
10
10
|
* import '@tamagui/native/setup-gesture-handler'
|
|
11
11
|
* import '@tamagui/native/setup-worklets'
|
|
12
12
|
* import '@tamagui/native/setup-safe-area'
|
|
13
|
-
* import '@tamagui/native/expo-linear-gradient'
|
|
14
13
|
* import '@tamagui/native/setup-keyboard-controller'
|
|
15
14
|
*
|
|
16
15
|
* // Then use Tamagui components normally
|
|
17
16
|
* // Sheet will automatically use native gestures when available
|
|
18
|
-
* // LinearGradient will use expo-linear-gradient when installed
|
|
19
17
|
* ```
|
|
20
18
|
*/
|
|
21
|
-
export type { NativePortalState, GestureState, WorkletsState, SafeAreaState, SafeAreaInsets, SafeAreaFrame, SafeAreaMetrics,
|
|
19
|
+
export type { NativePortalState, GestureState, WorkletsState, SafeAreaState, SafeAreaInsets, SafeAreaFrame, SafeAreaMetrics, BurntState, NativePortalProps, NativePortalHostProps, NativePortalProviderProps } from "./types";
|
|
22
20
|
export type { NativeMenuAdapter, NativeMenuModule } from "./nativeMenuState";
|
|
23
21
|
export { getPortal } from "./portalState";
|
|
24
22
|
export type { PortalAccessor } from "./portalState";
|
|
@@ -30,8 +28,6 @@ export { getWorklets } from "./workletsState";
|
|
|
30
28
|
export type { WorkletsAccessor } from "./workletsState";
|
|
31
29
|
export { getSafeArea, hasSafeAreaSetup } from "./safeAreaState";
|
|
32
30
|
export type { SafeAreaAccessor } from "./safeAreaState";
|
|
33
|
-
export { getLinearGradient } from "./linearGradientState";
|
|
34
|
-
export type { LinearGradientAccessor } from "./linearGradientState";
|
|
35
31
|
export { isKeyboardControllerEnabled, getKeyboardControllerState, setKeyboardControllerState } from "./keyboardControllerState";
|
|
36
32
|
export type { KeyboardControllerState } from "./keyboardControllerState";
|
|
37
33
|
export { getNativeMenuAdapter, registerNativeMenuAdapter } from "./nativeMenuState";
|
package/types/index.d.ts.map
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"mappings": "
|
|
2
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAoBA,cACE,mBACA,cACA,eACA,eACA,gBACA,eACA,iBACA,YACA,mBACA,uBACA,iCACK;AACP,cAAc,mBAAmB,wBAAwB;AAGzD,SAAS,iBAAiB;AAC1B,cAAc,sBAAsB;AAGpC,SAAS,yBAAyB;AAClC,SACE,+BAA+B,sCAC/B,6BAA6B,oCAC7B,iCAAiC,8CAC5B;AACP,cACE,6BACA,wBACA,0BACK;AAGP,cAAc,4BAA4B;AAG1C,SAAS,mBAAmB;AAC5B,cAAc,wBAAwB;AAGtC,SAAS,aAAa,wBAAwB;AAC9C,cAAc,wBAAwB;AAGtC,SACE,6BACA,4BACA,kCACK;AACP,cAAc,+BAA+B;AAG7C,SAAS,sBAAsB,iCAAiC;AAChE,SAAS,+BAA+B;AACxC,cAAc,gCAAgC;AAC9C,SAAS,yBAAyB;AAGlC,SAAS,gBAAgB;AACzB,cAAc,qBAAqB;AAGnC,SAAS,cAAc,kBAAkB,4BAA4B",
|
|
3
3
|
"names": [],
|
|
4
4
|
"sources": [
|
|
5
5
|
"src/index.ts"
|
|
6
6
|
],
|
|
7
7
|
"version": 3,
|
|
8
8
|
"sourcesContent": [
|
|
9
|
-
"/**\n * @tamagui/native\n *\n * Native setup modules for Tamagui. Import these at the top of your app entry point.\n *\n * @example\n * ```tsx\n * // In your app entry (index.js or App.tsx)\n * import '@tamagui/native/setup-teleport'\n * import '@tamagui/native/setup-gesture-handler'\n * import '@tamagui/native/setup-worklets'\n * import '@tamagui/native/setup-safe-area'\n * import '@tamagui/native/
|
|
9
|
+
"/**\n * @tamagui/native\n *\n * Native setup modules for Tamagui. Import these at the top of your app entry point.\n *\n * @example\n * ```tsx\n * // In your app entry (index.js or App.tsx)\n * import '@tamagui/native/setup-teleport'\n * import '@tamagui/native/setup-gesture-handler'\n * import '@tamagui/native/setup-worklets'\n * import '@tamagui/native/setup-safe-area'\n * import '@tamagui/native/setup-keyboard-controller'\n *\n * // Then use Tamagui components normally\n * // Sheet will automatically use native gestures when available\n * ```\n */\n\n// types\nexport type {\n NativePortalState,\n GestureState,\n WorkletsState,\n SafeAreaState,\n SafeAreaInsets,\n SafeAreaFrame,\n SafeAreaMetrics,\n BurntState,\n NativePortalProps,\n NativePortalHostProps,\n NativePortalProviderProps,\n} from './types'\nexport type { NativeMenuAdapter, NativeMenuModule } from './nativeMenuState'\n\n// portal\nexport { getPortal } from './portalState'\nexport type { PortalAccessor } from './portalState'\n\n// gesture handler\nexport { getGestureHandler } from './gestureState'\nexport {\n claimExternalPressOwnership as unstable_claimExternalPressOwnership,\n hasExternalPressOwnership as unstable_hasExternalPressOwnership,\n releaseExternalPressOwnership as unstable_releaseExternalPressOwnership,\n} from './gestureState'\nexport type {\n ExternalPressOwnershipToken,\n GestureHandlerAccessor,\n PressGestureConfig,\n} from './gestureState'\n// NOTE: setupGestureHandler is exported from setup-gesture-handler.ts entry point,\n// not here, to avoid bundler pulling in RNGH require during tree-shaking\nexport type { GestureHandlerConfig } from './setup-gesture-handler'\n\n// worklets\nexport { getWorklets } from './workletsState'\nexport type { WorkletsAccessor } from './workletsState'\n\n// safe area\nexport { getSafeArea, hasSafeAreaSetup } from './safeAreaState'\nexport type { SafeAreaAccessor } from './safeAreaState'\n\n// keyboard controller state exports (safe - no side effects)\nexport {\n isKeyboardControllerEnabled,\n getKeyboardControllerState,\n setKeyboardControllerState,\n} from './keyboardControllerState'\nexport type { KeyboardControllerState } from './keyboardControllerState'\n\n// native menus\nexport { getNativeMenuAdapter, registerNativeMenuAdapter } from './nativeMenuState'\nexport { createExpoUIMenuAdapter } from './expoUIMenuAdapter'\nexport type { ExpoUIMenuAdapterOptions } from './expoUIMenuAdapter'\nexport { NativeMenuContext } from './nativeMenuContext'\n\n// burnt (native toasts)\nexport { getBurnt } from './burntState'\nexport type { BurntAccessor } from './burntState'\n\n// components\nexport { NativePortal, NativePortalHost, NativePortalProvider } from './components'\n"
|
|
10
10
|
]
|
|
11
11
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
2
|
+
"mappings": "AAAA,YAAY,WAAW;AASvB,OAAO,cAAM,mBAAmB,MAAM",
|
|
3
3
|
"names": [],
|
|
4
4
|
"sources": [
|
|
5
5
|
"src/nativeMenuContext.ts"
|
|
6
6
|
],
|
|
7
7
|
"version": 3,
|
|
8
8
|
"sourcesContent": [
|
|
9
|
-
"import type React from 'react'\nimport { createContext } from 'react'\n\nexport const NativeMenuContext: React.Context<boolean> = createContext(false)\n"
|
|
9
|
+
"import type React from 'react'\nimport { createContext } from 'react'\n\n// one context per runtime: core reads it and the menu packages provide it, so a\n// second copy of this module (a bundled core, a duplicated install) must not\n// split them into two contexts that never see each other\nconst KEY = '__tamagui_native_menu_context__'\nconst g = globalThis as typeof globalThis & { [KEY]?: React.Context<boolean> }\n\nexport const NativeMenuContext: React.Context<boolean> = (g[KEY] ??= createContext(false))\n"
|
|
10
10
|
]
|
|
11
11
|
}
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
],
|
|
7
7
|
"version": 3,
|
|
8
8
|
"sourcesContent": [
|
|
9
|
-
"/**\n * Setup Expo UI for Tamagui native Menu and ContextMenu components.\n *\n * Import this module once at the top of the app entry point after installing\n * `@expo/ui`.\n */\n\nimport { createExpoUIMenuAdapter } from './expoUIMenuAdapter'\nimport { registerNativeMenuAdapter } from './nativeMenuState'\n\nfunction setup(): void {\n let MenuView\n try {\n MenuView
|
|
9
|
+
"/**\n * Setup Expo UI for Tamagui native Menu and ContextMenu components.\n *\n * Import this module once at the top of the app entry point after installing\n * `@expo/ui`.\n */\n\nimport { createExpoUIMenuAdapter } from './expoUIMenuAdapter'\nimport { createExpoUIMenuView } from './expoUIMenuView'\nimport { registerNativeMenuAdapter } from './nativeMenuState'\nimport { Platform } from 'react-native'\n\nfunction setup(): void {\n let MenuView\n try {\n MenuView =\n Platform.OS === 'ios'\n ? createExpoUIMenuView({\n swiftUI: require('@expo/ui/swift-ui'),\n modifiers: require('@expo/ui/swift-ui/modifiers'),\n })\n : require('@expo/ui/community/menu').MenuView\n } catch (error) {\n if (process.env.NODE_ENV === 'development') {\n console.warn('Error setting up Expo UI native menus', error)\n }\n return\n }\n\n registerNativeMenuAdapter(createExpoUIMenuAdapter({ MenuView }))\n}\n\nsetup()\n"
|
|
10
10
|
]
|
|
11
11
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mappings": "",
|
|
3
|
+
"names": [],
|
|
4
|
+
"sources": [
|
|
5
|
+
"src/setup-one-portal.ts"
|
|
6
|
+
],
|
|
7
|
+
"version": 3,
|
|
8
|
+
"sourcesContent": [
|
|
9
|
+
"/**\n * Setup native portal support for Tamagui with One's native portals\n * (One.UI.Portal and One.UI.PortalHost), an alternative to setup-teleport.\n *\n * Import this module at the top of your app entry point:\n *\n * @example\n * ```tsx\n * import '@tamagui/native/setup-one-portal'\n * ```\n */\n\nimport { getPortal } from './portalState'\n\nfunction setup(): void {\n const g = globalThis as any\n if (g.__tamagui_native_portal_setup) return\n g.__tamagui_native_portal_setup = true\n\n const { One } = require('one')\n // one's portals keep their react tree without a provider and lay content out\n // against the host's own size, so the host fills its parent.\n g.__tamagui_teleport = {\n Portal: One.UI.Portal,\n PortalHost: One.UI.PortalHost,\n hostStyle: { position: 'absolute', top: 0, right: 0, bottom: 0, left: 0 },\n }\n getPortal().set({ enabled: true, type: 'teleport' })\n}\n\n// run setup immediately on import\nsetup()\n"
|
|
10
|
+
]
|
|
11
|
+
}
|
package/types/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ViewProps } from "@tamagui/react-native-types";
|
|
1
2
|
import type { ReactNode } from "react";
|
|
2
3
|
export type NativePortalState = {
|
|
3
4
|
enabled: boolean;
|
|
@@ -50,10 +51,6 @@ export type NativePortalHostProps = {
|
|
|
50
51
|
export type NativePortalProviderProps = {
|
|
51
52
|
children: ReactNode;
|
|
52
53
|
};
|
|
53
|
-
export interface LinearGradientState {
|
|
54
|
-
enabled: boolean;
|
|
55
|
-
Component: any;
|
|
56
|
-
}
|
|
57
54
|
export interface BurntState {
|
|
58
55
|
enabled: boolean;
|
|
59
56
|
toast: ((options: any) => void) | null;
|
|
@@ -69,5 +66,14 @@ export interface KeyboardControllerState {
|
|
|
69
66
|
KeyboardEvents: any;
|
|
70
67
|
KeyboardStickyView: any;
|
|
71
68
|
}
|
|
69
|
+
export interface PressBoundaryProps extends ViewProps {
|
|
70
|
+
enabled?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Alias for enabling the boundary. The behavior is limited to Tamagui's
|
|
73
|
+
* shared press ownership and does not patch arbitrary RN bubbling.
|
|
74
|
+
*/
|
|
75
|
+
stopPropagation?: boolean;
|
|
76
|
+
debugName?: string | null;
|
|
77
|
+
}
|
|
72
78
|
|
|
73
79
|
//# sourceMappingURL=types.d.ts.map
|
package/types/types.d.ts.map
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"mappings": "AAAA,cAAc,iBAAiB;AAE/B,YAAY,oBAAoB;CAC9B;CACA,MAAM,aAAa;;AAGrB,iBAAiB,aAAa;CAC5B;CACA;CACA;CACA;CAIA;;AAGF,iBAAiB,cAAc;CAC7B;CACA;CACA;CACA;CACA;;AAGF,iBAAiB,eAAe;CAC9B;CACA;CACA;CACA;;AAGF,iBAAiB,cAAc;CAC7B;CACA;CACA;CACA;;AAGF,iBAAiB,gBAAgB;CAC/B,QAAQ;CACR,OAAO;;AAGT,iBAAiB,cAAc;CAC7B;CACA;CACA,0BAA0B;CAC1B,yBAAyB;CACzB,gBAAgB;;AAGlB,YAAY,oBAAoB;CAC9B;CACA,UAAU;;AAGZ,YAAY,wBAAwB;CAClC;;AAGF,YAAY,4BAA4B;CACtC,UAAU;;AAGZ,iBAAiB,
|
|
2
|
+
"mappings": "AAAA,cAAc,iBAAiB;AAC/B,cAAc,iBAAiB;AAE/B,YAAY,oBAAoB;CAC9B;CACA,MAAM,aAAa;;AAGrB,iBAAiB,aAAa;CAC5B;CACA;CACA;CACA;CAIA;;AAGF,iBAAiB,cAAc;CAC7B;CACA;CACA;CACA;CACA;;AAGF,iBAAiB,eAAe;CAC9B;CACA;CACA;CACA;;AAGF,iBAAiB,cAAc;CAC7B;CACA;CACA;CACA;;AAGF,iBAAiB,gBAAgB;CAC/B,QAAQ;CACR,OAAO;;AAGT,iBAAiB,cAAc;CAC7B;CACA;CACA,0BAA0B;CAC1B,yBAAyB;CACzB,gBAAgB;;AAGlB,YAAY,oBAAoB;CAC9B;CACA,UAAU;;AAGZ,YAAY,wBAAwB;CAClC;;AAGF,YAAY,4BAA4B;CACtC,UAAU;;AAGZ,iBAAiB,WAAW;CAC1B;CACA,SAAS;CACT;;AAGF,iBAAiB,wBAAwB;CACvC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;AAGF,iBAAiB,2BAA2B,UAAU;CACpD;;;;;CAKA;CACA",
|
|
3
3
|
"names": [],
|
|
4
4
|
"sources": [
|
|
5
5
|
"src/types.ts"
|
|
6
6
|
],
|
|
7
7
|
"version": 3,
|
|
8
8
|
"sourcesContent": [
|
|
9
|
-
"import type { ReactNode } from 'react'\n\nexport type NativePortalState = {\n enabled: boolean\n type: 'teleport' | 'legacy' | null\n}\n\nexport interface GestureState {\n enabled: boolean\n Gesture: any\n GestureDetector: any\n ScrollView: any\n // rngh's GestureHandlerRootView. native portals can render outside the app's\n // root gesture view, so components that portal rngh gestures need to\n // re-establish one around their content.\n RootView: any\n}\n\nexport interface WorkletsState {\n enabled: boolean\n Worklets: any\n useRunOnJS: any\n useWorklet: any\n createWorkletContextValue: any\n}\n\nexport interface SafeAreaInsets {\n top: number\n right: number\n bottom: number\n left: number\n}\n\nexport interface SafeAreaFrame {\n x: number\n y: number\n width: number\n height: number\n}\n\nexport interface SafeAreaMetrics {\n insets: SafeAreaInsets\n frame: SafeAreaFrame\n}\n\nexport interface SafeAreaState {\n didSetup: boolean\n enabled: boolean\n useSafeAreaInsets: (() => SafeAreaInsets) | null\n useSafeAreaFrame: (() => SafeAreaFrame) | null\n initialMetrics: SafeAreaMetrics | null\n}\n\nexport type NativePortalProps = {\n hostName?: string\n children: ReactNode\n}\n\nexport type NativePortalHostProps = {\n name: string\n}\n\nexport type NativePortalProviderProps = {\n children: ReactNode\n}\n\nexport interface
|
|
9
|
+
"import type { ViewProps } from '@tamagui/react-native-types'\nimport type { ReactNode } from 'react'\n\nexport type NativePortalState = {\n enabled: boolean\n type: 'teleport' | 'legacy' | null\n}\n\nexport interface GestureState {\n enabled: boolean\n Gesture: any\n GestureDetector: any\n ScrollView: any\n // rngh's GestureHandlerRootView. native portals can render outside the app's\n // root gesture view, so components that portal rngh gestures need to\n // re-establish one around their content.\n RootView: any\n}\n\nexport interface WorkletsState {\n enabled: boolean\n Worklets: any\n useRunOnJS: any\n useWorklet: any\n createWorkletContextValue: any\n}\n\nexport interface SafeAreaInsets {\n top: number\n right: number\n bottom: number\n left: number\n}\n\nexport interface SafeAreaFrame {\n x: number\n y: number\n width: number\n height: number\n}\n\nexport interface SafeAreaMetrics {\n insets: SafeAreaInsets\n frame: SafeAreaFrame\n}\n\nexport interface SafeAreaState {\n didSetup: boolean\n enabled: boolean\n useSafeAreaInsets: (() => SafeAreaInsets) | null\n useSafeAreaFrame: (() => SafeAreaFrame) | null\n initialMetrics: SafeAreaMetrics | null\n}\n\nexport type NativePortalProps = {\n hostName?: string\n children: ReactNode\n}\n\nexport type NativePortalHostProps = {\n name: string\n}\n\nexport type NativePortalProviderProps = {\n children: ReactNode\n}\n\nexport interface BurntState {\n enabled: boolean\n toast: ((options: any) => void) | null\n dismissAllAlerts: (() => void) | null\n}\n\nexport interface KeyboardControllerState {\n enabled: boolean\n KeyboardProvider: any\n KeyboardAwareScrollView: any\n useKeyboardHandler: any\n useReanimatedKeyboardAnimation: any\n KeyboardController: any\n KeyboardEvents: any\n KeyboardStickyView: any\n}\n\nexport interface PressBoundaryProps extends ViewProps {\n enabled?: boolean\n /**\n * Alias for enabling the boundary. The behavior is limited to Tamagui's\n * shared press ownership and does not patch arbitrary RN bubbling.\n */\n stopPropagation?: boolean\n debugName?: string | null\n}\n"
|
|
10
10
|
]
|
|
11
11
|
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all) __defProp(target, name, {
|
|
7
|
-
get: all[name],
|
|
8
|
-
enumerable: true
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
-
get: () => from[key],
|
|
15
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
-
var linearGradientState_exports = {};
|
|
22
|
-
__export(linearGradientState_exports, { getLinearGradient: () => getLinearGradient });
|
|
23
|
-
module.exports = __toCommonJS(linearGradientState_exports);
|
|
24
|
-
var import_globalState = require("./globalState.cjs");
|
|
25
|
-
const state = (0, import_globalState.createGlobalState)(`linear_gradient`, {
|
|
26
|
-
enabled: false,
|
|
27
|
-
Component: null
|
|
28
|
-
});
|
|
29
|
-
function getLinearGradient() {
|
|
30
|
-
return {
|
|
31
|
-
get isEnabled() {
|
|
32
|
-
return state.get().enabled;
|
|
33
|
-
},
|
|
34
|
-
get state() {
|
|
35
|
-
return state.get();
|
|
36
|
-
},
|
|
37
|
-
set(newState) {
|
|
38
|
-
state.set(newState);
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all) __defProp(target, name, {
|
|
9
|
-
get: all[name],
|
|
10
|
-
enumerable: true
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
-
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
-
get: () => from[key],
|
|
17
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
|
-
var linearGradientState_exports = {};
|
|
24
|
-
__export(linearGradientState_exports, { getLinearGradient: () => getLinearGradient });
|
|
25
|
-
module.exports = __toCommonJS(linearGradientState_exports);
|
|
26
|
-
var import_globalState = require("./globalState.native.js");
|
|
27
|
-
var state = (0, import_globalState.createGlobalState)(`linear_gradient`, {
|
|
28
|
-
enabled: false,
|
|
29
|
-
Component: null
|
|
30
|
-
});
|
|
31
|
-
function getLinearGradient() {
|
|
32
|
-
return {
|
|
33
|
-
get isEnabled() {
|
|
34
|
-
return state.get().enabled;
|
|
35
|
-
},
|
|
36
|
-
get state() {
|
|
37
|
-
return state.get();
|
|
38
|
-
},
|
|
39
|
-
set(newState) {
|
|
40
|
-
state.set(newState);
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all) __defProp(target, name, {
|
|
9
|
-
get: all[name],
|
|
10
|
-
enumerable: true
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
-
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
-
get: () => from[key],
|
|
17
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
|
-
var linearGradientState_exports = {};
|
|
24
|
-
__export(linearGradientState_exports, { getLinearGradient: () => getLinearGradient });
|
|
25
|
-
module.exports = __toCommonJS(linearGradientState_exports);
|
|
26
|
-
var import_globalState = require("./globalState.native.js");
|
|
27
|
-
var state = (0, import_globalState.createGlobalState)(`linear_gradient`, {
|
|
28
|
-
enabled: false,
|
|
29
|
-
Component: null
|
|
30
|
-
});
|
|
31
|
-
function getLinearGradient() {
|
|
32
|
-
return {
|
|
33
|
-
get isEnabled() {
|
|
34
|
-
return state.get().enabled;
|
|
35
|
-
},
|
|
36
|
-
get state() {
|
|
37
|
-
return state.get();
|
|
38
|
-
},
|
|
39
|
-
set(newState) {
|
|
40
|
-
state.set(newState);
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
//# sourceMappingURL=linearGradientState.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"linearGradientState.native.js","names":[],"sources":["cjs/linearGradientState.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 __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar linearGradientState_exports = {};\n__export(linearGradientState_exports, {\n getLinearGradient: () => getLinearGradient\n});\nmodule.exports = __toCommonJS(linearGradientState_exports);\nvar import_globalState = require(\"./globalState\");\nvar state = (0, import_globalState.createGlobalState)(`linear_gradient`, {\n enabled: false,\n Component: null\n});\nfunction getLinearGradient() {\n return {\n get isEnabled() {\n return state.get().enabled;\n },\n get state() {\n return state.get();\n },\n set(newState) {\n state.set(newState);\n }\n };\n}\n//# sourceMappingURL=linearGradientState.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,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,8BAA8B,CAAC;AACnC,SAAS,6BAA6B,EACpC,yBAAyB,kBAC3B,CAAC;AACD,OAAO,UAAU,aAAa,2BAA2B;AACzD,IAAI,qBAAqB,QAAQ,yBAAe;AAChD,IAAI,SAAS,GAAG,mBAAmB,kBAAiB,CAAE,mBAAmB;CACvE,SAAS;CACT,WAAW;AACb,CAAC;AACD,SAAS,oBAAoB;CAC3B,OAAO;EACL,IAAI,YAAY;GACd,OAAO,MAAM,IAAI,CAAC,CAAC;EACrB;EACA,IAAI,QAAQ;GACV,OAAO,MAAM,IAAI;EACnB;EACA,IAAI,UAAU;GACZ,MAAM,IAAI,QAAQ;EACpB;CACF;AACF"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
var import_linearGradientState = require("./linearGradientState.cjs");
|
|
2
|
-
function setup() {
|
|
3
|
-
const g = globalThis;
|
|
4
|
-
if (g.__tamagui_native_linear_gradient_setup) return;
|
|
5
|
-
g.__tamagui_native_linear_gradient_setup = true;
|
|
6
|
-
try {
|
|
7
|
-
const expoLinearGradient = require("expo-linear-gradient");
|
|
8
|
-
if (expoLinearGradient?.LinearGradient) {
|
|
9
|
-
(0, import_linearGradientState.getLinearGradient)().set({
|
|
10
|
-
enabled: true,
|
|
11
|
-
Component: expoLinearGradient.LinearGradient
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
} catch {}
|
|
15
|
-
}
|
|
16
|
-
setup();
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var import_linearGradientState = require("./linearGradientState.native.js");
|
|
4
|
-
function setup() {
|
|
5
|
-
var g = globalThis;
|
|
6
|
-
if (g.__tamagui_native_linear_gradient_setup) return;
|
|
7
|
-
g.__tamagui_native_linear_gradient_setup = true;
|
|
8
|
-
try {
|
|
9
|
-
var expoLinearGradient = require("expo-linear-gradient");
|
|
10
|
-
if (expoLinearGradient === null || expoLinearGradient === void 0 ? void 0 : expoLinearGradient.LinearGradient) {
|
|
11
|
-
(0, import_linearGradientState.getLinearGradient)().set({
|
|
12
|
-
enabled: true,
|
|
13
|
-
Component: expoLinearGradient.LinearGradient
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
} catch (e) {}
|
|
17
|
-
}
|
|
18
|
-
setup();
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var import_linearGradientState = require("./linearGradientState.native.js");
|
|
4
|
-
function setup() {
|
|
5
|
-
var g = globalThis;
|
|
6
|
-
if (g.__tamagui_native_linear_gradient_setup) return;
|
|
7
|
-
g.__tamagui_native_linear_gradient_setup = true;
|
|
8
|
-
try {
|
|
9
|
-
var expoLinearGradient = require("expo-linear-gradient");
|
|
10
|
-
if (expoLinearGradient === null || expoLinearGradient === void 0 ? void 0 : expoLinearGradient.LinearGradient) {
|
|
11
|
-
(0, import_linearGradientState.getLinearGradient)().set({
|
|
12
|
-
enabled: true,
|
|
13
|
-
Component: expoLinearGradient.LinearGradient
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
} catch (e) {}
|
|
17
|
-
}
|
|
18
|
-
setup();
|
|
19
|
-
|
|
20
|
-
//# sourceMappingURL=setup-expo-linear-gradient.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setup-expo-linear-gradient.native.js","names":[],"sources":["cjs/setup-expo-linear-gradient.native.js"],"sourcesContent":["\"use strict\";\nvar import_linearGradientState = require(\"./linearGradientState\");\nfunction setup() {\n var g = globalThis;\n if (g.__tamagui_native_linear_gradient_setup) return;\n g.__tamagui_native_linear_gradient_setup = true;\n try {\n var expoLinearGradient = require(\"expo-linear-gradient\");\n if (expoLinearGradient === null || expoLinearGradient === void 0 ? void 0 : expoLinearGradient.LinearGradient) {\n (0, import_linearGradientState.getLinearGradient)().set({\n enabled: true,\n Component: expoLinearGradient.LinearGradient\n });\n }\n } catch (e) {\n }\n}\nsetup();\n//# sourceMappingURL=setup-expo-linear-gradient.js.map\n"],"mappings":";;;AACA,IAAI,6BAA6B,QAAQ,iCAAuB;AAChE,SAAS,QAAQ;CACf,IAAI,IAAI;CACR,IAAI,EAAE,wCAAwC;CAC9C,EAAE,yCAAyC;CAC3C,IAAI;EACF,IAAI,qBAAqB,QAAQ,sBAAsB;EACvD,IAAI,uBAAuB,QAAQ,uBAAuB,KAAK,IAAI,KAAK,IAAI,mBAAmB,gBAAgB;GAC7G,CAAC,GAAG,2BAA2B,kBAAiB,CAAE,CAAC,CAAC,IAAI;IACtD,SAAS;IACT,WAAW,mBAAmB;GAChC,CAAC;EACH;CACF,SAAS,GAAG,CACZ;AACF;AACA,MAAM"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { createGlobalState } from "./globalState.mjs";
|
|
2
|
-
|
|
3
|
-
const state = createGlobalState(`linear_gradient`, {
|
|
4
|
-
enabled: false,
|
|
5
|
-
Component: null
|
|
6
|
-
});
|
|
7
|
-
function getLinearGradient() {
|
|
8
|
-
return {
|
|
9
|
-
get isEnabled() {
|
|
10
|
-
return state.get().enabled;
|
|
11
|
-
},
|
|
12
|
-
get state() {
|
|
13
|
-
return state.get();
|
|
14
|
-
},
|
|
15
|
-
set(newState) {
|
|
16
|
-
state.set(newState);
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export { getLinearGradient };
|
|
22
|
-
//# sourceMappingURL=linearGradientState.mjs.map
|