@tamagui/native 2.0.0-rc.9 → 2.1.0
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/.turbo/turbo-build.log +2 -0
- package/dist/cjs/PressBoundary.cjs +92 -0
- package/dist/cjs/PressBoundary.native.js +105 -0
- package/dist/cjs/PressBoundary.native.js.map +1 -0
- package/dist/cjs/burntState.cjs +14 -12
- package/dist/cjs/burntState.native.js +18 -16
- package/dist/cjs/burntState.native.js.map +1 -1
- package/dist/cjs/components.cjs +20 -15
- package/dist/cjs/components.native.js +24 -22
- package/dist/cjs/components.native.js.map +1 -1
- package/dist/cjs/gesture-handler.cjs +36 -0
- package/dist/cjs/gesture-handler.native.js +39 -0
- package/dist/cjs/gesture-handler.native.js.map +1 -0
- package/dist/cjs/gestureState.cjs +201 -23
- package/dist/cjs/gestureState.native.js +217 -39
- package/dist/cjs/gestureState.native.js.map +1 -1
- package/dist/cjs/globalState.cjs +17 -11
- package/dist/cjs/globalState.native.js +17 -11
- package/dist/cjs/globalState.native.js.map +1 -1
- package/dist/cjs/index.cjs +27 -20
- package/dist/cjs/index.native.js +27 -20
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/keyboardControllerState.cjs +14 -12
- package/dist/cjs/keyboardControllerState.native.js +23 -21
- package/dist/cjs/keyboardControllerState.native.js.map +1 -1
- package/dist/cjs/linearGradientState.cjs +14 -12
- package/dist/cjs/linearGradientState.native.js +17 -15
- package/dist/cjs/linearGradientState.native.js.map +1 -1
- package/dist/cjs/nativeMenuContext.cjs +29 -0
- package/dist/cjs/nativeMenuContext.native.js +32 -0
- package/dist/cjs/nativeMenuContext.native.js.map +1 -0
- package/dist/cjs/portalState.cjs +14 -12
- package/dist/cjs/portalState.native.js +17 -15
- package/dist/cjs/portalState.native.js.map +1 -1
- package/dist/cjs/safeAreaState.cjs +38 -30
- package/dist/cjs/safeAreaState.native.js +39 -31
- package/dist/cjs/safeAreaState.native.js.map +1 -1
- package/dist/cjs/setup-burnt.cjs +9 -8
- package/dist/cjs/setup-burnt.native.js +9 -8
- package/dist/cjs/setup-burnt.native.js.map +1 -1
- package/dist/cjs/setup-expo-linear-gradient.cjs +9 -8
- package/dist/cjs/setup-expo-linear-gradient.native.js +9 -8
- package/dist/cjs/setup-expo-linear-gradient.native.js.map +1 -1
- package/dist/cjs/setup-gesture-handler.cjs +69 -20
- package/dist/cjs/setup-gesture-handler.native.js +69 -20
- package/dist/cjs/setup-gesture-handler.native.js.map +1 -1
- package/dist/cjs/setup-keyboard-controller.native.js +20 -17
- package/dist/cjs/setup-safe-area.cjs +3 -1
- package/dist/cjs/setup-safe-area.native.js +15 -17
- package/dist/cjs/setup-safe-area.native.js.map +1 -1
- package/dist/cjs/setup-teleport.cjs +13 -13
- package/dist/cjs/setup-teleport.native.js +13 -13
- package/dist/cjs/setup-teleport.native.js.map +1 -1
- package/dist/cjs/setup-worklets.cjs +11 -8
- package/dist/cjs/setup-worklets.native.js +11 -8
- package/dist/cjs/setup-worklets.native.js.map +1 -1
- package/dist/cjs/setup-zeego.cjs +12 -9
- package/dist/cjs/setup-zeego.native.js +12 -9
- package/dist/cjs/setup-zeego.native.js.map +1 -1
- package/dist/cjs/types.cjs +7 -5
- package/dist/cjs/types.native.js +7 -5
- package/dist/cjs/types.native.js.map +1 -1
- package/dist/cjs/workletsState.cjs +14 -12
- package/dist/cjs/workletsState.native.js +20 -18
- package/dist/cjs/workletsState.native.js.map +1 -1
- package/dist/cjs/zeegoState.cjs +14 -12
- package/dist/cjs/zeegoState.native.js +18 -16
- package/dist/cjs/zeegoState.native.js.map +1 -1
- package/dist/esm/PressBoundary.mjs +56 -0
- package/dist/esm/PressBoundary.mjs.map +1 -0
- package/dist/esm/PressBoundary.native.js +66 -0
- package/dist/esm/PressBoundary.native.js.map +1 -0
- package/dist/esm/burntState.mjs +2 -2
- package/dist/esm/burntState.native.js +2 -2
- package/dist/esm/components.mjs +6 -3
- package/dist/esm/components.mjs.map +1 -1
- package/dist/esm/components.native.js +10 -10
- package/dist/esm/components.native.js.map +1 -1
- package/dist/esm/gesture-handler.mjs +6 -0
- package/dist/esm/gesture-handler.mjs.map +1 -0
- package/dist/esm/gesture-handler.native.js +6 -0
- package/dist/esm/gesture-handler.native.js.map +1 -0
- package/dist/esm/gestureState.mjs +186 -13
- package/dist/esm/gestureState.mjs.map +1 -1
- package/dist/esm/gestureState.native.js +198 -25
- package/dist/esm/gestureState.native.js.map +1 -1
- package/dist/esm/globalState.mjs +5 -1
- package/dist/esm/globalState.mjs.map +1 -1
- package/dist/esm/globalState.native.js +5 -1
- package/dist/esm/globalState.native.js.map +1 -1
- package/dist/esm/index.js +12 -28
- package/dist/esm/index.js.map +1 -6
- package/dist/esm/index.mjs +3 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +3 -1
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/keyboardControllerState.mjs +2 -2
- package/dist/esm/keyboardControllerState.native.js +2 -2
- package/dist/esm/linearGradientState.mjs +2 -2
- package/dist/esm/linearGradientState.native.js +2 -2
- package/dist/esm/nativeMenuContext.mjs +4 -0
- package/dist/esm/nativeMenuContext.mjs.map +1 -0
- package/dist/esm/nativeMenuContext.native.js +4 -0
- package/dist/esm/nativeMenuContext.native.js.map +1 -0
- package/dist/esm/portalState.mjs +2 -2
- package/dist/esm/portalState.native.js +2 -2
- package/dist/esm/safeAreaState.mjs +26 -20
- package/dist/esm/safeAreaState.mjs.map +1 -1
- package/dist/esm/safeAreaState.native.js +26 -20
- package/dist/esm/safeAreaState.native.js.map +1 -1
- package/dist/esm/setup-burnt.mjs +9 -8
- package/dist/esm/setup-burnt.mjs.map +1 -1
- package/dist/esm/setup-burnt.native.js +9 -8
- package/dist/esm/setup-burnt.native.js.map +1 -1
- package/dist/esm/setup-expo-linear-gradient.mjs +9 -8
- package/dist/esm/setup-expo-linear-gradient.mjs.map +1 -1
- package/dist/esm/setup-expo-linear-gradient.native.js +9 -8
- package/dist/esm/setup-expo-linear-gradient.native.js.map +1 -1
- package/dist/esm/setup-gesture-handler.mjs +43 -21
- package/dist/esm/setup-gesture-handler.mjs.map +1 -1
- package/dist/esm/setup-gesture-handler.native.js +43 -21
- package/dist/esm/setup-gesture-handler.native.js.map +1 -1
- package/dist/esm/setup-keyboard-controller.native.js +20 -17
- package/dist/esm/setup-safe-area.mjs +2 -0
- package/dist/esm/setup-safe-area.mjs.map +1 -1
- package/dist/esm/setup-safe-area.native.js +15 -17
- package/dist/esm/setup-safe-area.native.js.map +1 -1
- package/dist/esm/setup-teleport.mjs +13 -13
- package/dist/esm/setup-teleport.mjs.map +1 -1
- package/dist/esm/setup-teleport.native.js +13 -13
- package/dist/esm/setup-teleport.native.js.map +1 -1
- package/dist/esm/setup-worklets.mjs +11 -8
- package/dist/esm/setup-worklets.mjs.map +1 -1
- package/dist/esm/setup-worklets.native.js +11 -8
- package/dist/esm/setup-worklets.native.js.map +1 -1
- package/dist/esm/setup-zeego.mjs +12 -9
- package/dist/esm/setup-zeego.mjs.map +1 -1
- package/dist/esm/setup-zeego.native.js +12 -9
- package/dist/esm/setup-zeego.native.js.map +1 -1
- package/dist/esm/workletsState.mjs +2 -2
- package/dist/esm/workletsState.native.js +2 -2
- package/dist/esm/zeegoState.mjs +2 -2
- package/dist/esm/zeegoState.native.js +2 -2
- package/gesture-handler/index.cjs +1 -0
- package/gesture-handler/index.js +1 -0
- package/gesture-handler/index.native.cjs +1 -0
- package/gesture-handler/index.native.js +1 -0
- package/gesture-handler.cjs +1 -0
- package/package.json +48 -77
- package/setup-burnt/index.cjs +2 -0
- package/setup-burnt/index.js +2 -0
- package/setup-burnt/index.native.cjs +2 -0
- package/setup-burnt/index.native.js +2 -0
- package/setup-expo-linear-gradient/index.cjs +2 -0
- package/setup-expo-linear-gradient/index.js +2 -0
- package/setup-expo-linear-gradient/index.native.cjs +2 -0
- package/setup-expo-linear-gradient/index.native.js +2 -0
- package/setup-gesture-handler/index.cjs +2 -0
- package/setup-gesture-handler/index.js +2 -0
- package/setup-gesture-handler/index.native.cjs +2 -0
- package/setup-gesture-handler/index.native.js +2 -0
- package/setup-keyboard-controller/index.cjs +2 -0
- package/setup-keyboard-controller/index.js +2 -0
- package/setup-keyboard-controller/index.native.cjs +2 -0
- package/setup-keyboard-controller/index.native.js +2 -0
- package/setup-safe-area/index.cjs +2 -0
- package/setup-safe-area/index.js +2 -0
- package/setup-safe-area/index.native.cjs +2 -0
- package/setup-safe-area/index.native.js +2 -0
- package/setup-teleport/index.cjs +2 -0
- package/setup-teleport/index.js +2 -0
- package/setup-teleport/index.native.cjs +2 -0
- package/setup-teleport/index.native.js +2 -0
- package/setup-worklets/index.cjs +2 -0
- package/setup-worklets/index.js +2 -0
- package/setup-worklets/index.native.cjs +2 -0
- package/setup-worklets/index.native.js +2 -0
- package/setup-zeego/index.cjs +2 -0
- package/setup-zeego/index.js +2 -0
- package/setup-zeego/index.native.cjs +2 -0
- package/setup-zeego/index.native.js +2 -0
- package/src/PressBoundary.tsx +81 -0
- package/src/gesture-handler.ts +17 -0
- package/src/gestureState.ts +319 -11
- package/src/index.ts +13 -1
- package/src/nativeMenuContext.ts +4 -0
- package/src/setup-gesture-handler.ts +52 -10
- package/src/types.ts +4 -0
- package/tsconfig.json +12 -0
- package/types/PressBoundary.d.ts +14 -0
- package/types/PressBoundary.d.ts.map +11 -0
- package/types/burntState.d.ts.map +2 -2
- package/types/components.d.ts.map +2 -2
- package/types/gesture-handler.d.ts +8 -0
- package/types/gesture-handler.d.ts.map +11 -0
- package/types/gestureState.d.ts +5 -0
- package/types/gestureState.d.ts.map +4 -4
- package/types/globalState.d.ts.map +2 -2
- package/types/index.d.ts +4 -1
- package/types/index.d.ts.map +4 -4
- package/types/keyboardControllerState.d.ts.map +2 -2
- package/types/linearGradientState.d.ts.map +2 -2
- package/types/nativeMenuContext.d.ts +4 -0
- package/types/nativeMenuContext.d.ts.map +11 -0
- package/types/portalState.d.ts.map +2 -2
- package/types/safeAreaState.d.ts.map +2 -2
- package/types/setup-burnt.d.ts.map +2 -2
- package/types/setup-expo-linear-gradient.d.ts.map +2 -2
- package/types/setup-gesture-handler.d.ts +8 -1
- package/types/setup-gesture-handler.d.ts.map +4 -4
- package/types/setup-keyboard-controller.d.ts.map +2 -2
- package/types/setup-keyboard-controller.web.d.ts.map +2 -2
- package/types/setup-safe-area.d.ts.map +2 -2
- package/types/setup-teleport.d.ts.map +2 -2
- package/types/setup-worklets.d.ts.map +2 -2
- package/types/setup-zeego.d.ts.map +2 -2
- package/types/types.d.ts +1 -0
- package/types/types.d.ts.map +4 -4
- package/types/workletsState.d.ts.map +2 -2
- package/types/zeegoState.d.ts.map +2 -2
- package/dist/cjs/burntState.js +0 -39
- package/dist/cjs/burntState.js.map +0 -6
- package/dist/cjs/components.js +0 -41
- package/dist/cjs/components.js.map +0 -6
- package/dist/cjs/gestureState.js +0 -57
- package/dist/cjs/gestureState.js.map +0 -6
- package/dist/cjs/globalState.js +0 -34
- package/dist/cjs/globalState.js.map +0 -6
- package/dist/cjs/index.js +0 -33
- package/dist/cjs/index.js.map +0 -6
- package/dist/cjs/keyboardControllerState.js +0 -42
- package/dist/cjs/keyboardControllerState.js.map +0 -6
- package/dist/cjs/linearGradientState.js +0 -38
- package/dist/cjs/linearGradientState.js.map +0 -6
- package/dist/cjs/portalState.js +0 -38
- package/dist/cjs/portalState.js.map +0 -6
- package/dist/cjs/safeAreaState.js +0 -48
- package/dist/cjs/safeAreaState.js.map +0 -6
- package/dist/cjs/setup-burnt.js +0 -18
- package/dist/cjs/setup-burnt.js.map +0 -6
- package/dist/cjs/setup-expo-linear-gradient.js +0 -17
- package/dist/cjs/setup-expo-linear-gradient.js.map +0 -6
- package/dist/cjs/setup-gesture-handler.js +0 -24
- package/dist/cjs/setup-gesture-handler.js.map +0 -6
- package/dist/cjs/setup-keyboard-controller.js +0 -1
- package/dist/cjs/setup-keyboard-controller.js.map +0 -6
- package/dist/cjs/setup-safe-area.js +0 -2
- package/dist/cjs/setup-safe-area.js.map +0 -6
- package/dist/cjs/setup-teleport.js +0 -17
- package/dist/cjs/setup-teleport.js.map +0 -6
- package/dist/cjs/setup-worklets.js +0 -20
- package/dist/cjs/setup-worklets.js.map +0 -6
- package/dist/cjs/setup-zeego.js +0 -19
- package/dist/cjs/setup-zeego.js.map +0 -6
- package/dist/cjs/types.js +0 -14
- package/dist/cjs/types.js.map +0 -6
- package/dist/cjs/workletsState.js +0 -41
- package/dist/cjs/workletsState.js.map +0 -6
- package/dist/cjs/zeegoState.js +0 -39
- package/dist/cjs/zeegoState.js.map +0 -6
- package/dist/esm/burntState.js +0 -23
- package/dist/esm/burntState.js.map +0 -6
- package/dist/esm/components.js +0 -26
- package/dist/esm/components.js.map +0 -6
- package/dist/esm/gestureState.js +0 -41
- package/dist/esm/gestureState.js.map +0 -6
- package/dist/esm/globalState.js +0 -18
- package/dist/esm/globalState.js.map +0 -6
- package/dist/esm/keyboardControllerState.js +0 -26
- package/dist/esm/keyboardControllerState.js.map +0 -6
- package/dist/esm/linearGradientState.js +0 -22
- package/dist/esm/linearGradientState.js.map +0 -6
- package/dist/esm/portalState.js +0 -22
- package/dist/esm/portalState.js.map +0 -6
- package/dist/esm/safeAreaState.js +0 -32
- package/dist/esm/safeAreaState.js.map +0 -6
- package/dist/esm/setup-burnt.js +0 -18
- package/dist/esm/setup-burnt.js.map +0 -6
- package/dist/esm/setup-expo-linear-gradient.js +0 -17
- package/dist/esm/setup-expo-linear-gradient.js.map +0 -6
- package/dist/esm/setup-gesture-handler.js +0 -24
- package/dist/esm/setup-gesture-handler.js.map +0 -6
- package/dist/esm/setup-keyboard-controller.js +0 -1
- package/dist/esm/setup-keyboard-controller.js.map +0 -6
- package/dist/esm/setup-safe-area.js +0 -2
- package/dist/esm/setup-safe-area.js.map +0 -6
- package/dist/esm/setup-teleport.js +0 -17
- package/dist/esm/setup-teleport.js.map +0 -6
- package/dist/esm/setup-worklets.js +0 -20
- package/dist/esm/setup-worklets.js.map +0 -6
- package/dist/esm/setup-zeego.js +0 -19
- package/dist/esm/setup-zeego.js.map +0 -6
- package/dist/esm/types.js +0 -1
- package/dist/esm/types.js.map +0 -6
- package/dist/esm/workletsState.js +0 -25
- package/dist/esm/workletsState.js.map +0 -6
- package/dist/esm/zeegoState.js +0 -23
- package/dist/esm/zeegoState.js.map +0 -6
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"mappings": "AACA,cAAc,oBAAoB;
|
|
2
|
+
"mappings": "AACA,cAAc,oBAAoB;AAkDlC,OAAO,iBAAS,+BACd,sBACA;AAwEF,iBAAiB,OAAO;CACtB;CACA;CACA;CACA;;AAGF,YAAY,qBAAqB;CAC/B;CACA,aAAa;CACb,cAAc;CACd,WAAW;CACX,eAAe;CACf;CACA,mBAAmB;;AAGrB,iBAAiB,uBAAuB;UAC7B;UACA,OAAO;CAChB,IAAI,SAAS,QAAQ;CACrB;CACA,mBAAmB,QAAQ;;AAG7B,YAAY;AAgBZ,OAAO,iBAAS,4BACd,4BACC;AAeH,OAAO,iBAAS,8BACd,OAAO,gDACP;AAQF,OAAO,iBAAS,qBAAqB",
|
|
3
3
|
"names": [],
|
|
4
4
|
"sources": [
|
|
5
5
|
"src/gestureState.ts"
|
|
6
6
|
],
|
|
7
|
+
"version": 3,
|
|
7
8
|
"sourcesContent": [
|
|
8
|
-
"import { createGlobalState } from './globalState'\nimport type { GestureState } from './types'\n\nconst state = createGlobalState<GestureState>(`gesture`, {\n enabled: false,\n Gesture: null,\n GestureDetector: null,\n ScrollView: null,\n})\n\nexport interface Insets {\n top?: number\n left?: number\n bottom?: number\n right?: number\n}\n\nexport type PressGestureConfig = {\n onPressIn?: (e: any) => void\n onPressOut?: (e: any) => void\n onPress?: (e: any) => void\n onLongPress?: (e: any) => void\n delayLongPress?: number\n hitSlop?: number | Insets | null\n}\n\nexport interface GestureHandlerAccessor {\n readonly isEnabled: boolean\n readonly state: GestureState\n set(updates: Partial<GestureState>): void\n disable(): void\n createPressGesture(config: PressGestureConfig): any\n}\n\nexport function getGestureHandler(): GestureHandlerAccessor {\n return {\n get isEnabled(): boolean {\n return state.get().enabled\n },\n get state(): GestureState {\n return state.get()\n },\n set(updates: Partial<GestureState>): void {\n Object.assign(state.get(), updates)\n },\n\n disable(): void {\n state.get().enabled = false\n },\n\n createPressGesture(config: PressGestureConfig): any {\n const { Gesture } = state.get()\n if (!Gesture) return null\n\n const longPressDuration = config.delayLongPress ?? 500\n\n // Tap gesture for regular presses\n // Use long maxDuration to not cancel during long presses\n const tap = Gesture.Tap()\n .runOnJS(true)\n .maxDuration(10000) // allow very long presses\n .onBegin((e: any) => {\n config.onPressIn?.(e)\n })\n .onEnd((e: any) => {\n config.onPress?.(e)\n })\n .onFinalize((e: any) => {\n config.onPressOut?.(e)\n })\n\n if (config.hitSlop) tap.hitSlop(config.hitSlop)\n\n // if no long press handler, just use tap\n if (!config.onLongPress) return tap\n\n // LongPress gesture for long press handling\n const longPress = Gesture.LongPress()\n .runOnJS(true)\n .minDuration(longPressDuration)\n .onBegin((e: any) => config.onPressIn?.(e))\n .onStart((e: any) => config.onLongPress?.(e))\n .onFinalize((e: any) => config.onPressOut?.(e))\n\n if (config.hitSlop) longPress.hitSlop(config.hitSlop)\n\n // exclusive: longPress has priority, tap is fallback for quick presses\n return Gesture.Exclusive(longPress, tap)\n },\n }\n}\n"
|
|
9
|
-
]
|
|
10
|
-
"version": 3
|
|
9
|
+
"import { createGlobalState } from './globalState'\nimport type { GestureState } from './types'\n\nconst state = createGlobalState<GestureState>(`gesture`, {\n enabled: false,\n Gesture: null,\n GestureDetector: null,\n ScrollView: null,\n RootView: null,\n})\n\ntype GestureEnabledFreezeState = {\n frozen: boolean\n enabled: boolean\n warned: boolean\n}\n\nconst GESTURE_ENABLED_FREEZE_KEY = '__tamagui_gesture_enabled_freeze__'\n\nfunction getGestureEnabledFreezeState(): GestureEnabledFreezeState {\n const g = globalThis as typeof globalThis & {\n [GESTURE_ENABLED_FREEZE_KEY]?: GestureEnabledFreezeState\n }\n\n if (!g[GESTURE_ENABLED_FREEZE_KEY]) {\n g[GESTURE_ENABLED_FREEZE_KEY] = {\n frozen: false,\n enabled: false,\n warned: false,\n }\n }\n\n return g[GESTURE_ENABLED_FREEZE_KEY]!\n}\n\nfunction warnGestureEnabledMutationIgnored(source: string) {\n const freezeState = getGestureEnabledFreezeState()\n\n if (freezeState.warned || process.env.NODE_ENV === 'production') {\n return\n }\n\n freezeState.warned = true\n\n console.warn(\n `[Tamagui] Ignored ${source} because gesture handler press events were already ` +\n `${freezeState.enabled ? 'enabled' : 'disabled'} when TamaguiProvider mounted. ` +\n `Configure gesture handler mode before the first render.`\n )\n}\n\nexport function canChangeGestureHandlerEnabled(\n nextEnabled: boolean,\n source: string\n): boolean {\n const freezeState = getGestureEnabledFreezeState()\n\n if (!freezeState.frozen || freezeState.enabled === nextEnabled) {\n return true\n }\n\n warnGestureEnabledMutationIgnored(source)\n return false\n}\n\nlet pressGestureDebugId = 0\nlet externalPressDebugId = 0\n\n// distance in dp the finger may travel before a press is treated as a\n// scroll/drag and cancelled. tracked in absolute (screen) coordinates by the\n// Tap's onTouchesMove (see createPressGesture) so a view translating under a\n// stationary finger - a sheet sliding on keyboard open/close, a sheet open\n// animation - does not cancel the press; only genuine finger travel does.\n// this also makes scroll-cancels-press work for any scroll container (a plain\n// RN ScrollView/FlatList or an RNGH one), since the press cancels itself\n// rather than relying on a parent RNGH gesture to steal it.\nconst PRESS_MOVE_CANCEL_DISTANCE = 12\nconst PRESS_MOVE_CANCEL_DISTANCE_SQ =\n PRESS_MOVE_CANCEL_DISTANCE * PRESS_MOVE_CANCEL_DISTANCE\n\n// minimal shapes of the RNGH gesture events createPressGesture reads. RNGH is\n// injected at runtime (GestureState.Gesture is untyped), so this module keeps\n// no type dependency on react-native-gesture-handler - these name just the\n// fields the press gesture touches.\ntype GesturePoint = {\n absoluteX: number\n absoluteY: number\n}\ntype GestureBeginEvent = Partial<GesturePoint>\ntype GestureTouchEvent = {\n changedTouches?: GesturePoint[]\n allTouches?: GesturePoint[]\n}\n\ntype PressOwnerSource = 'internal' | 'external' | null\n\nfunction getEventPointerId(e: any): number | null {\n const pointerId =\n e?.pointerId ??\n e?.pointer?.id ??\n e?.event?.pointerId ??\n e?.event?.pointer?.id ??\n e?.nativeEvent?.pointerId ??\n e?.nativeEvent?.id ??\n e?.event?.nativeEvent?.pointerId ??\n e?.event?.nativeEvent?.id ??\n null\n\n return pointerId == null || Number.isNaN(pointerId) ? null : Number(pointerId)\n}\n\n/**\n * Global press coordination - ensures only innermost pressable fires press events,\n * matching RN Pressable/responder system semantics where deepest component wins.\n * Uses a grace period to allow child gestures to steal ownership from parent,\n * since RNGH fires parent gestures before child gestures.\n */\nconst pressState = {\n owner: null as object | null,\n ownerId: null as number | null,\n ownerSource: null as PressOwnerSource,\n ownerPointerId: null as number | null,\n timestamp: 0,\n}\n\nexport interface Insets {\n top?: number\n left?: number\n bottom?: number\n right?: number\n}\n\nexport type PressGestureConfig = {\n debugName?: string | null\n onPressIn?: (e: any) => void\n onPressOut?: (e: any) => void\n onPress?: (e: any) => void\n onLongPress?: (e: any) => void\n delayLongPress?: number\n hitSlop?: number | Insets | null\n}\n\nexport interface GestureHandlerAccessor {\n readonly isEnabled: boolean\n readonly state: GestureState\n set(updates: Partial<GestureState>): void\n disable(): void\n createPressGesture(config: PressGestureConfig): any\n}\n\nexport type ExternalPressOwnershipToken = object\n\nfunction resetPressOwner() {\n pressState.owner = null\n pressState.ownerId = null\n pressState.ownerSource = null\n pressState.ownerPointerId = null\n pressState.timestamp = 0\n}\n\nfunction resetStaleOwner(now: number, debugName?: string | null) {\n if (now - pressState.timestamp > 2000) {\n resetPressOwner()\n }\n}\n\nexport function claimExternalPressOwnership(\n debugName?: string | null\n): ExternalPressOwnershipToken {\n const now = Date.now()\n resetStaleOwner(now, debugName)\n\n const token = {}\n const ownerId = ++externalPressDebugId\n\n pressState.owner = token\n pressState.ownerId = ownerId\n pressState.ownerSource = 'external'\n pressState.timestamp = now\n\n return token\n}\n\nexport function releaseExternalPressOwnership(\n token: ExternalPressOwnershipToken | null | undefined,\n debugName?: string | null\n): void {\n if (!token || pressState.owner !== token) {\n return\n }\n resetPressOwner()\n}\n\nexport function getGestureHandler(): GestureHandlerAccessor {\n return {\n get isEnabled(): boolean {\n return state.get().enabled\n },\n get state(): GestureState {\n return state.get()\n },\n set(updates: Partial<GestureState>): void {\n if (\n updates.enabled !== undefined &&\n !canChangeGestureHandlerEnabled(updates.enabled, 'getGestureHandler().set()')\n ) {\n return\n }\n\n Object.assign(state.get(), updates)\n },\n\n disable(): void {\n if (!canChangeGestureHandlerEnabled(false, 'getGestureHandler().disable()')) {\n return\n }\n\n state.get().enabled = false\n },\n\n createPressGesture(config: PressGestureConfig): any {\n const { Gesture } = state.get()\n if (!Gesture) return null\n\n const longPressDuration = config.delayLongPress ?? 500\n\n // unique token for this gesture instance - used to track ownership\n const myToken = {}\n const myDebugId = ++pressGestureDebugId\n // mutable gesture state kept on an object so handler bodies that get\n // workletized by react-native-worklets (>=0.7.4) see live values.\n // primitive `let`s get frozen into the worklet's serialized __closure\n // at factory time, so reassignments from workletized handlers never\n // propagate out. object property mutation goes through the captured\n // reference and is always observed.\n const flags = {\n didLongPress: false,\n didPressIn: false,\n pressInTimer: null as ReturnType<typeof setTimeout> | null,\n // absolute (screen) coords of the press start, and whether the finger\n // has since travelled far enough to be treated as a scroll/drag.\n moveStartX: null as number | null,\n moveStartY: 0,\n cancelledByMove: false,\n }\n\n // Grace period for child gestures to steal ownership from parent.\n // RNGH fires parent before child, but we want innermost to win.\n // Claims typically span a few ms, 24ms gives enough room to observe\n // ordering while debugging slower frames.\n const GRACE_PERIOD_MS = process.env.TAMAGUI_RNGH_PRESS_DELAY\n ? +process.env.TAMAGUI_RNGH_PRESS_DELAY\n : 24\n\n const tryClaimOwnership = (e: any) => {\n const now = Date.now()\n resetStaleOwner(now, config.debugName)\n\n const currentPointerId = getEventPointerId(e)\n const isSameTouchPointer =\n currentPointerId == null ||\n pressState.ownerPointerId == null ||\n pressState.ownerPointerId === currentPointerId\n\n if (\n pressState.owner === null ||\n (pressState.ownerSource === 'internal' && isSameTouchPointer)\n ) {\n pressState.owner = myToken\n pressState.ownerId = myDebugId\n pressState.ownerSource = 'internal'\n pressState.ownerPointerId = currentPointerId\n pressState.timestamp = now\n }\n return pressState.owner === myToken\n }\n\n const isOwner = () => pressState.owner === myToken\n\n const releaseOwnership = () => {\n if (flags.pressInTimer) {\n clearTimeout(flags.pressInTimer)\n flags.pressInTimer = null\n }\n if (pressState.owner === myToken) {\n resetPressOwner()\n }\n }\n\n const firePressIn = (e: any) => {\n if (!flags.didPressIn && isOwner()) {\n flags.didPressIn = true\n config.onPressIn?.(e)\n }\n }\n\n const schedulePressIn = (e: any) => {\n if (flags.pressInTimer) {\n clearTimeout(flags.pressInTimer)\n }\n flags.pressInTimer = setTimeout(() => {\n flags.pressInTimer = null\n if (isOwner()) {\n firePressIn(e)\n }\n }, GRACE_PERIOD_MS + 1)\n }\n\n // Tap gesture for regular presses.\n //\n // maxDuration is long so long-presses aren't cut off. We deliberately do\n // not use RNGH's .maxDistance(): it measures finger travel in the gesture\n // view's own coordinate space, so a view that translates under a\n // stationary finger (a sheet sliding on keyboard open/close, a sheet open\n // animation) reads as finger movement and silently cancels the press -\n // onPress never fires. Instead onTouchesMove tracks the finger in\n // absolute (screen) coordinates and cancels only on genuine finger\n // travel. That also makes scroll-cancels-press work for any scroll\n // container, since the press cancels itself instead of depending on a\n // parent RNGH gesture to steal the touch.\n const tap = Gesture.Tap()\n .runOnJS(true)\n .maxDuration(10000) // allow very long presses\n .onBegin((e: GestureBeginEvent) => {\n flags.didLongPress = false\n flags.didPressIn = false\n flags.cancelledByMove = false\n flags.moveStartX = typeof e.absoluteX === 'number' ? e.absoluteX : null\n flags.moveStartY = typeof e.absoluteY === 'number' ? e.absoluteY : 0\n tryClaimOwnership(e)\n // Defer onPressIn until after the grace window so child pressables\n // can steal ownership, but flush it on tap end for very fast taps.\n schedulePressIn(e)\n })\n .onTouchesMove((e: GestureTouchEvent) => {\n if (flags.cancelledByMove || flags.moveStartX === null) return\n const touch = e.changedTouches?.[0] ?? e.allTouches?.[0]\n if (!touch) return\n const dx = touch.absoluteX - flags.moveStartX\n const dy = touch.absoluteY - flags.moveStartY\n if (dx * dx + dy * dy <= PRESS_MOVE_CANCEL_DISTANCE_SQ) return\n // finger has travelled far enough to be a scroll/drag, not a tap.\n // release the pressStyle now (mid-scroll, so it doesn't stay stuck)\n // and make onEnd skip onPress on finger lift.\n flags.cancelledByMove = true\n if (flags.pressInTimer) {\n clearTimeout(flags.pressInTimer)\n flags.pressInTimer = null\n }\n if (flags.didPressIn) {\n flags.didPressIn = false\n config.onPressOut?.(e)\n }\n releaseOwnership()\n })\n .onEnd((e: unknown) => {\n if (isOwner() && !flags.didLongPress && !flags.cancelledByMove) {\n firePressIn(e)\n config.onPress?.(e)\n }\n })\n .onFinalize((e: unknown) => {\n if (isOwner()) {\n config.onPressOut?.(e)\n releaseOwnership()\n } else if (flags.didPressIn) {\n // we already fired onPressIn but lost ownership before finalize\n // (e.g. finger dragged onto a sibling pressable and that one\n // claimed ownership). fire onPressOut so callers can clear their\n // press state - otherwise pressStyle stays stuck on this view.\n flags.didPressIn = false\n config.onPressOut?.(e)\n }\n })\n\n if (config.hitSlop) tap.hitSlop(config.hitSlop)\n\n // if no long press handler, just use tap\n if (!config.onLongPress) return tap\n\n // LongPress gesture for long press handling\n const longPress = Gesture.LongPress()\n .runOnJS(true)\n .minDuration(longPressDuration)\n .onStart((e: any) => {\n flags.didLongPress = true\n if (isOwner()) {\n firePressIn(e)\n config.onLongPress?.(e)\n }\n })\n\n if (config.hitSlop) longPress.hitSlop(config.hitSlop)\n\n // exclusive: longPress has priority, tap is fallback for quick presses\n return Gesture.Exclusive(longPress, tap)\n },\n }\n}\n"
|
|
10
|
+
]
|
|
11
11
|
}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
"sources": [
|
|
5
5
|
"src/globalState.ts"
|
|
6
6
|
],
|
|
7
|
+
"version": 3,
|
|
7
8
|
"sourcesContent": [
|
|
8
9
|
"export function createGlobalState<T extends { enabled: boolean }>(\n key: string,\n defaultValue: T\n): {\n get: () => T\n set: (next: T) => void\n} {\n const GLOBAL_KEY = `__tamagui_${key}__`\n\n type TamaguiGlobal = typeof globalThis & {\n [GLOBAL_KEY]?: T\n }\n\n function getGlobalState(): T {\n const g = globalThis as TamaguiGlobal\n if (!g[GLOBAL_KEY]) {\n // reset on module load so reloadReactNative gets a clean state\n // (globalThis persists across reloads but module scope re-evaluates)\n g[GLOBAL_KEY] = defaultValue\n }\n return g[GLOBAL_KEY]!\n }\n\n function setGlobalState(newState: T): void {\n ;(globalThis as TamaguiGlobal)[GLOBAL_KEY] = newState\n }\n\n return {\n get: getGlobalState,\n set: setGlobalState,\n }\n}\n"
|
|
9
|
-
]
|
|
10
|
-
"version": 3
|
|
10
|
+
]
|
|
11
11
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -22,7 +22,9 @@ export type { NativePortalState, GestureState, WorkletsState, SafeAreaState, Saf
|
|
|
22
22
|
export { getPortal } from "./portalState";
|
|
23
23
|
export type { PortalAccessor } from "./portalState";
|
|
24
24
|
export { getGestureHandler } from "./gestureState";
|
|
25
|
-
export
|
|
25
|
+
export { claimExternalPressOwnership as unstable_claimExternalPressOwnership, releaseExternalPressOwnership as unstable_releaseExternalPressOwnership } from "./gestureState";
|
|
26
|
+
export type { ExternalPressOwnershipToken, GestureHandlerAccessor, PressGestureConfig } from "./gestureState";
|
|
27
|
+
export type { GestureHandlerConfig } from "./setup-gesture-handler";
|
|
26
28
|
export { getWorklets } from "./workletsState";
|
|
27
29
|
export type { WorkletsAccessor } from "./workletsState";
|
|
28
30
|
export { getSafeArea } from "./safeAreaState";
|
|
@@ -33,6 +35,7 @@ export { isKeyboardControllerEnabled, getKeyboardControllerState, setKeyboardCon
|
|
|
33
35
|
export type { KeyboardControllerState } from "./keyboardControllerState";
|
|
34
36
|
export { getZeego } from "./zeegoState";
|
|
35
37
|
export type { ZeegoAccessor } from "./zeegoState";
|
|
38
|
+
export { NativeMenuContext } from "./nativeMenuContext";
|
|
36
39
|
export { getBurnt } from "./burntState";
|
|
37
40
|
export type { BurntAccessor } from "./burntState";
|
|
38
41
|
export { NativePortal, NativePortalHost, NativePortalProvider } from "./components";
|
package/types/index.d.ts.map
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAsBA,cACE,mBACA,cACA,eACA,eACA,gBACA,eACA,iBACA,qBACA,YACA,YACA,mBACA,uBACA,iCACK;AAGP,SAAS,iBAAiB;AAC1B,cAAc,sBAAsB;AAGpC,SAAS,yBAAyB;AAClC,
|
|
2
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAsBA,cACE,mBACA,cACA,eACA,eACA,gBACA,eACA,iBACA,qBACA,YACA,YACA,mBACA,uBACA,iCACK;AAGP,SAAS,iBAAiB;AAC1B,cAAc,sBAAsB;AAGpC,SAAS,yBAAyB;AAClC,SACE,+BAA+B,sCAC/B,iCAAiC,8CAC5B;AACP,cACE,6BACA,wBACA,0BACK;AAGP,cAAc,4BAA4B;AAG1C,SAAS,mBAAmB;AAC5B,cAAc,wBAAwB;AAGtC,SAAS,mBAAmB;AAC5B,cAAc,wBAAwB;AAGtC,SAAS,yBAAyB;AAClC,cAAc,8BAA8B;AAG5C,SACE,6BACA,4BACA,kCACK;AACP,cAAc,+BAA+B;AAG7C,SAAS,gBAAgB;AACzB,cAAc,qBAAqB;AACnC,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
|
+
"version": 3,
|
|
7
8
|
"sourcesContent": [
|
|
8
|
-
"/**\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/expo-linear-gradient'\n * import '@tamagui/native/setup-keyboard-controller'\n *\n * // Then use Tamagui components normally\n * // Sheet will automatically use native gestures when available\n * // LinearGradient will use expo-linear-gradient when installed\n * ```\n */\n\n// types\nexport type {\n NativePortalState,\n GestureState,\n WorkletsState,\n SafeAreaState,\n SafeAreaInsets,\n SafeAreaFrame,\n SafeAreaMetrics,\n LinearGradientState,\n ZeegoState,\n BurntState,\n NativePortalProps,\n NativePortalHostProps,\n NativePortalProviderProps,\n} from './types'\n\n// portal\nexport { getPortal } from './portalState'\nexport type { PortalAccessor } from './portalState'\n\n// gesture handler\nexport { getGestureHandler } from './gestureState'\nexport type {
|
|
9
|
-
]
|
|
10
|
-
"version": 3
|
|
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/expo-linear-gradient'\n * import '@tamagui/native/setup-keyboard-controller'\n *\n * // Then use Tamagui components normally\n * // Sheet will automatically use native gestures when available\n * // LinearGradient will use expo-linear-gradient when installed\n * ```\n */\n\n// types\nexport type {\n NativePortalState,\n GestureState,\n WorkletsState,\n SafeAreaState,\n SafeAreaInsets,\n SafeAreaFrame,\n SafeAreaMetrics,\n LinearGradientState,\n ZeegoState,\n BurntState,\n NativePortalProps,\n NativePortalHostProps,\n NativePortalProviderProps,\n} from './types'\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 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 } from './safeAreaState'\nexport type { SafeAreaAccessor } from './safeAreaState'\n\n// linear gradient\nexport { getLinearGradient } from './linearGradientState'\nexport type { LinearGradientAccessor } from './linearGradientState'\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// zeego (native menus)\nexport { getZeego } from './zeegoState'\nexport type { ZeegoAccessor } from './zeegoState'\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
|
+
]
|
|
11
11
|
}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
"sources": [
|
|
5
5
|
"src/keyboardControllerState.ts"
|
|
6
6
|
],
|
|
7
|
+
"version": 3,
|
|
7
8
|
"sourcesContent": [
|
|
8
9
|
"import { createGlobalState } from './globalState'\nimport type { KeyboardControllerState } from './types'\n\nexport type { KeyboardControllerState }\n\nconst state = createGlobalState<KeyboardControllerState>(`keyboard_controller`, {\n enabled: false,\n KeyboardProvider: null,\n KeyboardAwareScrollView: null,\n useKeyboardHandler: null,\n useReanimatedKeyboardAnimation: null,\n KeyboardController: null,\n KeyboardEvents: null,\n KeyboardStickyView: null,\n})\n\nexport function isKeyboardControllerEnabled(): boolean {\n return state.get().enabled\n}\n\nexport function getKeyboardControllerState(): KeyboardControllerState {\n return state.get()\n}\n\nexport function setKeyboardControllerState(\n updates: Partial<KeyboardControllerState>\n): void {\n Object.assign(state.get(), updates)\n}\n"
|
|
9
|
-
]
|
|
10
|
-
"version": 3
|
|
10
|
+
]
|
|
11
11
|
}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
"sources": [
|
|
5
5
|
"src/linearGradientState.ts"
|
|
6
6
|
],
|
|
7
|
+
"version": 3,
|
|
7
8
|
"sourcesContent": [
|
|
8
9
|
"import { createGlobalState } from './globalState'\nimport type { LinearGradientState } from './types'\n\nconst state = createGlobalState<LinearGradientState>(`linear_gradient`, {\n enabled: false,\n Component: null,\n})\n\nexport interface LinearGradientAccessor {\n readonly isEnabled: boolean\n readonly state: LinearGradientState\n set(newState: LinearGradientState): void\n}\n\nexport function getLinearGradient(): LinearGradientAccessor {\n return {\n get isEnabled(): boolean {\n return state.get().enabled\n },\n get state(): LinearGradientState {\n return state.get()\n },\n set(newState: LinearGradientState): void {\n state.set(newState)\n },\n }\n}\n"
|
|
9
|
-
]
|
|
10
|
-
"version": 3
|
|
10
|
+
]
|
|
11
11
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mappings": "AAAA,YAAY,WAAW;AAGvB,OAAO,cAAM,mBAAmB,MAAM",
|
|
3
|
+
"names": [],
|
|
4
|
+
"sources": [
|
|
5
|
+
"src/nativeMenuContext.ts"
|
|
6
|
+
],
|
|
7
|
+
"version": 3,
|
|
8
|
+
"sourcesContent": [
|
|
9
|
+
"import type React from 'react'\nimport { createContext } from 'react'\n\nexport const NativeMenuContext: React.Context<boolean> = createContext(false)\n"
|
|
10
|
+
]
|
|
11
|
+
}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
"sources": [
|
|
5
5
|
"src/portalState.ts"
|
|
6
6
|
],
|
|
7
|
+
"version": 3,
|
|
7
8
|
"sourcesContent": [
|
|
8
9
|
"import { createGlobalState } from './globalState'\nimport type { NativePortalState } from './types'\n\nconst state = createGlobalState<NativePortalState>(`portal`, {\n enabled: false,\n type: null,\n})\n\nexport interface PortalAccessor {\n readonly isEnabled: boolean\n readonly state: NativePortalState\n set(newState: NativePortalState): void\n}\n\nexport function getPortal(): PortalAccessor {\n return {\n get isEnabled(): boolean {\n return state.get().enabled\n },\n get state(): NativePortalState {\n return state.get()\n },\n set(newState: NativePortalState): void {\n state.set(newState)\n },\n }\n}\n"
|
|
9
|
-
]
|
|
10
|
-
"version": 3
|
|
10
|
+
]
|
|
11
11
|
}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
"sources": [
|
|
5
5
|
"src/safeAreaState.ts"
|
|
6
6
|
],
|
|
7
|
+
"version": 3,
|
|
7
8
|
"sourcesContent": [
|
|
8
9
|
"import { createGlobalState } from './globalState'\nimport type { SafeAreaState, SafeAreaInsets, SafeAreaFrame } from './types'\n\nconst state = createGlobalState<SafeAreaState>(`safe_area`, {\n enabled: false,\n useSafeAreaInsets: null,\n useSafeAreaFrame: null,\n initialMetrics: null,\n})\n\nconst defaultInsets: SafeAreaInsets = { top: 0, right: 0, bottom: 0, left: 0 }\nconst defaultFrame: SafeAreaFrame = { x: 0, y: 0, width: 0, height: 0 }\n\nexport interface SafeAreaAccessor {\n readonly isEnabled: boolean\n readonly state: SafeAreaState\n set(updates: Partial<SafeAreaState>): void\n /** Get initial insets (non-reactive, for style resolution) */\n getInsets(): SafeAreaInsets\n /** Get initial frame (non-reactive) */\n getFrame(): SafeAreaFrame\n}\n\nexport function getSafeArea(): SafeAreaAccessor {\n return {\n get isEnabled() {\n return state.get().enabled\n },\n get state() {\n return state.get()\n },\n set(updates: Partial<SafeAreaState>) {\n Object.assign(state.get(), updates)\n },\n getInsets() {\n const s = state.get()\n if (!s.enabled || !s.initialMetrics) {\n return defaultInsets\n }\n return s.initialMetrics.insets\n },\n getFrame() {\n const s = state.get()\n if (!s.enabled || !s.initialMetrics) {\n return defaultFrame\n }\n return s.initialMetrics.frame\n },\n }\n}\n"
|
|
9
|
-
]
|
|
10
|
-
"version": 3
|
|
10
|
+
]
|
|
11
11
|
}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
"sources": [
|
|
5
5
|
"src/setup-burnt.ts"
|
|
6
6
|
],
|
|
7
|
+
"version": 3,
|
|
7
8
|
"sourcesContent": [
|
|
8
9
|
"/**\n * Setup burnt for Tamagui native toasts.\n *\n * Simply import this module at the top of your app entry point:\n *\n * @example\n * ```tsx\n * import '@tamagui/native/setup-burnt'\n * ```\n *\n * This automatically detects and configures burnt for use with\n * native Toast functionality.\n */\n\nimport { getBurnt } from './burntState'\n\nfunction setup(): void {\n const g = globalThis as any\n if (g.__tamagui_native_burnt_setup) return\n g.__tamagui_native_burnt_setup = true\n\n try {\n const Burnt = require('burnt') as typeof import('burnt')\n\n if (Burnt) {\n getBurnt().set({\n enabled: true,\n toast: Burnt.toast,\n dismissAllAlerts: Burnt.dismissAllAlerts,\n })\n }\n } catch {\n // burnt not installed\n }\n}\n\n// run setup immediately on import\nsetup()\n"
|
|
9
|
-
]
|
|
10
|
-
"version": 3
|
|
10
|
+
]
|
|
11
11
|
}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
"sources": [
|
|
5
5
|
"src/setup-expo-linear-gradient.ts"
|
|
6
6
|
],
|
|
7
|
+
"version": 3,
|
|
7
8
|
"sourcesContent": [
|
|
8
9
|
"/**\n * Setup expo-linear-gradient for Tamagui.\n *\n * Simply import this module at the top of your app entry point:\n *\n * @example\n * ```tsx\n * import '@tamagui/native/setup-expo-linear-gradient'\n * ```\n *\n * This automatically detects and configures expo-linear-gradient.\n * If not installed, LinearGradient will log a warning on native.\n */\n\nimport { getLinearGradient } from './linearGradientState'\n\nfunction setup(): void {\n const g = globalThis as any\n if (g.__tamagui_native_linear_gradient_setup) return\n g.__tamagui_native_linear_gradient_setup = true\n\n try {\n const expoLinearGradient = require('expo-linear-gradient')\n if (expoLinearGradient?.LinearGradient) {\n getLinearGradient().set({\n enabled: true,\n Component: expoLinearGradient.LinearGradient,\n })\n }\n } catch {\n // expo-linear-gradient not installed, will use CSS fallback\n }\n}\n\n// run setup immediately on import\nsetup()\n"
|
|
9
|
-
]
|
|
10
|
-
"version": 3
|
|
10
|
+
]
|
|
11
11
|
}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export interface GestureHandlerConfig {
|
|
2
|
+
/** use RNGH for press events on Tamagui components (default: true) */
|
|
3
|
+
pressEvents?: boolean;
|
|
4
|
+
/** use RNGH for Sheet drag gestures (default: true) */
|
|
5
|
+
sheet?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function getGestureHandlerConfig(): GestureHandlerConfig;
|
|
8
|
+
export declare function setupGestureHandler(config?: GestureHandlerConfig): void;
|
|
2
9
|
|
|
3
10
|
//# sourceMappingURL=setup-gesture-handler.d.ts.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"mappings": "",
|
|
2
|
+
"mappings": "AAqBA,iBAAiB,qBAAqB;;CAEpC;;CAEA;;AAQF,OAAO,iBAAS,2BAA2B;AAI3C,OAAO,iBAAS,oBAAoB,SAAS",
|
|
3
3
|
"names": [],
|
|
4
4
|
"sources": [
|
|
5
5
|
"src/setup-gesture-handler.ts"
|
|
6
6
|
],
|
|
7
|
+
"version": 3,
|
|
7
8
|
"sourcesContent": [
|
|
8
|
-
"/**\n * Setup gesture handler for Tamagui native components.\n *\n * Simply import this module at the top of your app entry point:\n *\n * @example\n * ```tsx\n * import '@tamagui/native/setup-gesture-handler'\n * ```\n *\n * This automatically detects and configures react-native-gesture-handler\n * for use with Sheet and other gesture-aware components.\n */\n\nimport { getGestureHandler } from './gestureState'\n\
|
|
9
|
-
]
|
|
10
|
-
"version": 3
|
|
9
|
+
"/**\n * Setup gesture handler for Tamagui native components.\n *\n * Simply import this module at the top of your app entry point:\n *\n * @example\n * ```tsx\n * // auto-setup with all features enabled\n * import '@tamagui/native/setup-gesture-handler'\n *\n * // or configure selectively\n * import { setupGestureHandler } from '@tamagui/native/setup-gesture-handler'\n * setupGestureHandler({ pressEvents: true, sheet: false })\n * ```\n *\n * This automatically detects and configures react-native-gesture-handler\n * for use with Sheet and other gesture-aware components.\n */\n\nimport { canChangeGestureHandlerEnabled, getGestureHandler } from './gestureState'\n\nexport interface GestureHandlerConfig {\n /** use RNGH for press events on Tamagui components (default: true) */\n pressEvents?: boolean\n /** use RNGH for Sheet drag gestures (default: true) */\n sheet?: boolean\n}\n\nlet currentConfig: GestureHandlerConfig = {\n pressEvents: true,\n sheet: true,\n}\n\nexport function getGestureHandlerConfig(): GestureHandlerConfig {\n return currentConfig\n}\n\nexport function setupGestureHandler(config?: GestureHandlerConfig): void {\n const g = globalThis as any\n\n // override config if provided\n if (config) {\n currentConfig = config\n\n if (\n config.pressEvents !== undefined &&\n !canChangeGestureHandlerEnabled(\n config.pressEvents !== false,\n 'setupGestureHandler()'\n )\n ) {\n currentConfig = {\n ...currentConfig,\n pressEvents: getGestureHandler().isEnabled,\n }\n }\n }\n\n // allow re-running setup to change config\n const isFirstRun = !g.__tamagui_native_gesture_setup_complete\n g.__tamagui_native_gesture_setup_complete = true\n\n try {\n // dynamically require RNGH - it should already be imported by the app\n const rngh = require('react-native-gesture-handler')\n const { Gesture, GestureDetector, ScrollView, GestureHandlerRootView } = rngh\n\n if (Gesture && GestureDetector) {\n // only enable if pressEvents is true\n getGestureHandler().set({\n enabled: currentConfig.pressEvents !== false,\n Gesture,\n GestureDetector,\n ScrollView: ScrollView || null,\n RootView: GestureHandlerRootView || null,\n })\n\n // sheet state - only enable if sheet is true\n g.__tamagui_sheet_gesture_state__ = {\n enabled: currentConfig.sheet !== false,\n Gesture,\n GestureDetector,\n ScrollView: ScrollView || null,\n RootView: GestureHandlerRootView || null,\n }\n }\n } catch {\n // RNGH not available, that's fine\n }\n}\n\n// run setup immediately on import (can be overridden by calling setupGestureHandler)\nsetupGestureHandler()\n"
|
|
10
|
+
]
|
|
11
11
|
}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
"sources": [
|
|
5
5
|
"src/setup-keyboard-controller.ts"
|
|
6
6
|
],
|
|
7
|
+
"version": 3,
|
|
7
8
|
"sourcesContent": [
|
|
8
9
|
"/**\n * Setup keyboard controller for Tamagui native components.\n *\n * Simply import this module at the top of your app entry point:\n *\n * @example\n * ```tsx\n * import '@tamagui/native/setup-keyboard-controller'\n * ```\n *\n * This automatically detects and configures react-native-keyboard-controller\n * for use with Sheet and other keyboard-aware components.\n *\n * When enabled, Sheet gains:\n * - Frame-by-frame keyboard tracking (60/120 FPS)\n * - Smooth gesture + keyboard handoff\n * - Interactive keyboard dismiss on sheet drag\n */\n\nimport { setKeyboardControllerState } from './keyboardControllerState'\n\nfunction setup() {\n const g = globalThis as any\n if (g.__tamagui_native_keyboard_controller_setup_complete) {\n return\n }\n g.__tamagui_native_keyboard_controller_setup_complete = true\n\n try {\n // dynamically require keyboard-controller - it should already be imported by the app\n const rnkc = require('react-native-keyboard-controller')\n const {\n KeyboardProvider,\n KeyboardAwareScrollView,\n useKeyboardHandler,\n useReanimatedKeyboardAnimation,\n KeyboardController,\n KeyboardEvents,\n KeyboardStickyView,\n } = rnkc\n\n if (useKeyboardHandler && KeyboardProvider) {\n setKeyboardControllerState({\n enabled: true,\n KeyboardProvider: KeyboardProvider || null,\n KeyboardAwareScrollView: KeyboardAwareScrollView || null,\n useKeyboardHandler: useKeyboardHandler || null,\n useReanimatedKeyboardAnimation: useReanimatedKeyboardAnimation || null,\n KeyboardController: KeyboardController || null,\n KeyboardEvents: KeyboardEvents || null,\n KeyboardStickyView: KeyboardStickyView || null,\n })\n }\n } catch {\n // keyboard-controller not available, that's fine\n }\n}\n\n// run setup immediately on import\nsetup()\n"
|
|
9
|
-
]
|
|
10
|
-
"version": 3
|
|
10
|
+
]
|
|
11
11
|
}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
"sources": [
|
|
5
5
|
"src/setup-keyboard-controller.web.ts"
|
|
6
6
|
],
|
|
7
|
+
"version": 3,
|
|
7
8
|
"sourcesContent": [
|
|
8
9
|
"/**\n * Web stub for keyboard controller setup.\n * No-op on web - keyboard-controller is native-only.\n */\n\n// intentionally empty - web doesn't need keyboard-controller\n"
|
|
9
|
-
]
|
|
10
|
-
"version": 3
|
|
10
|
+
]
|
|
11
11
|
}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
"sources": [
|
|
5
5
|
"src/setup-safe-area.ts"
|
|
6
6
|
],
|
|
7
|
+
"version": 3,
|
|
7
8
|
"sourcesContent": [
|
|
8
9
|
"/**\n * Setup react-native-safe-area-context for Tamagui native components.\n *\n * Simply import this module at the top of your app entry point:\n *\n * @example\n * ```tsx\n * import '@tamagui/native/setup-safe-area'\n * ```\n *\n * This automatically detects and configures react-native-safe-area-context\n * for use with Tamagui components that need safe area awareness.\n *\n * Note: You must still wrap your app with SafeAreaProvider yourself:\n * ```tsx\n * import { SafeAreaProvider } from 'react-native-safe-area-context'\n * <SafeAreaProvider>\n * <App />\n * </SafeAreaProvider>\n * ```\n *\n * On web, this is a no-op since CSS env(safe-area-inset-*) values work natively.\n */\n\nimport { getSafeArea } from './safeAreaState'\n\nfunction setup() {\n // only run on native\n if (process.env.TAMAGUI_TARGET !== 'native') {\n return\n }\n\n const g = globalThis as any\n if (g.__tamagui_native_safe_area_setup_complete) {\n return\n }\n g.__tamagui_native_safe_area_setup_complete = true\n\n try {\n const safeAreaContext = require('react-native-safe-area-context')\n const { useSafeAreaInsets, useSafeAreaFrame, initialWindowMetrics } = safeAreaContext\n\n if (useSafeAreaInsets) {\n getSafeArea().set({\n enabled: true,\n useSafeAreaInsets,\n useSafeAreaFrame: useSafeAreaFrame || null,\n initialMetrics: initialWindowMetrics || null,\n })\n }\n } catch {\n // react-native-safe-area-context not available\n }\n}\n\nsetup()\n"
|
|
9
|
-
]
|
|
10
|
-
"version": 3
|
|
10
|
+
]
|
|
11
11
|
}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
"sources": [
|
|
5
5
|
"src/setup-teleport.ts"
|
|
6
6
|
],
|
|
7
|
+
"version": 3,
|
|
7
8
|
"sourcesContent": [
|
|
8
9
|
"/**\n * Setup native portal support for Tamagui.\n *\n * Simply import this module at the top of your app entry point:\n *\n * @example\n * ```tsx\n * import '@tamagui/native/setup-teleport'\n * ```\n *\n * This automatically detects and configures react-native-teleport for portals.\n * Falls back to legacy RN shims if teleport is not installed.\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 // try teleport first (preferred)\n try {\n const teleport = require('react-native-teleport')\n if (teleport?.Portal && teleport?.PortalHost && teleport?.PortalProvider) {\n g.__tamagui_teleport = teleport\n getPortal().set({ enabled: true, type: 'teleport' })\n return\n }\n } catch {\n // react-native-teleport not installed, that's ok\n }\n}\n\n// run setup immediately on import\nsetup()\n"
|
|
9
|
-
]
|
|
10
|
-
"version": 3
|
|
10
|
+
]
|
|
11
11
|
}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
"sources": [
|
|
5
5
|
"src/setup-worklets.ts"
|
|
6
6
|
],
|
|
7
|
+
"version": 3,
|
|
7
8
|
"sourcesContent": [
|
|
8
9
|
"/**\n * Setup worklets for Tamagui native components.\n *\n * Simply import this module at the top of your app entry point:\n *\n * @example\n * ```tsx\n * import '@tamagui/native/setup-worklets'\n * ```\n *\n * This automatically detects and configures react-native-worklets-core\n * for use with Sheet and other components that benefit from synchronous\n * native-thread execution.\n *\n * When combined with setup-gesture-handler, Sheet gets native-quality\n * gesture coordination between sheet dragging and scroll views.\n *\n * @see https://docs.swmansion.com/react-native-worklets/docs/\n */\n\nimport { getWorklets } from './workletsState'\n\nfunction setup() {\n const g = globalThis as any\n if (g.__tamagui_native_worklets_setup_complete) {\n return\n }\n g.__tamagui_native_worklets_setup_complete = true\n\n try {\n // dynamically require worklets-core\n const worklets = require('react-native-worklets-core')\n\n if (worklets) {\n getWorklets().set({\n enabled: true,\n Worklets: worklets.Worklets,\n useRunOnJS: worklets.useRunOnJS,\n useWorklet: worklets.useWorklet,\n createWorkletContextValue: worklets.createWorkletContextValue,\n })\n }\n } catch {\n // worklets not available, that's fine - will fall back to JS thread\n }\n}\n\n// run setup immediately on import\nsetup()\n"
|
|
9
|
-
]
|
|
10
|
-
"version": 3
|
|
10
|
+
]
|
|
11
11
|
}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
"sources": [
|
|
5
5
|
"src/setup-zeego.ts"
|
|
6
6
|
],
|
|
7
|
+
"version": 3,
|
|
7
8
|
"sourcesContent": [
|
|
8
9
|
"/**\n * Setup zeego for Tamagui native menus.\n *\n * Simply import this module at the top of your app entry point:\n *\n * @example\n * ```tsx\n * import '@tamagui/native/setup-zeego'\n * ```\n *\n * This automatically detects and configures zeego for use with\n * Menu and ContextMenu native mode.\n */\n\nimport { getZeego } from './zeegoState'\n\nfunction setup(): void {\n const g = globalThis as any\n if (g.__tamagui_native_zeego_setup) return\n g.__tamagui_native_zeego_setup = true\n\n try {\n const DropdownMenu = require('zeego/dropdown-menu')\n const ContextMenu = require('zeego/context-menu')\n\n if (DropdownMenu && ContextMenu) {\n getZeego().set({\n enabled: true,\n DropdownMenu,\n ContextMenu,\n })\n }\n } catch (err) {\n if (process.env.NODE_ENV === 'development') {\n console.warn(`Error setting up Zeego`, err)\n }\n // zeego not installed\n }\n}\n\n// run setup immediately on import\nsetup()\n"
|
|
9
|
-
]
|
|
10
|
-
"version": 3
|
|
10
|
+
]
|
|
11
11
|
}
|
package/types/types.d.ts
CHANGED
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;;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,0BAA0B;CAC1B,yBAAyB;CACzB,gBAAgB;;AAGlB,YAAY,oBAAoB;CAC9B;CACA,UAAU;;AAGZ,YAAY,wBAAwB;CAClC;;AAGF,YAAY,4BAA4B;CACtC,UAAU;;AAGZ,iBAAiB,oBAAoB;CACnC;CACA;;AAGF,iBAAiB,WAAW;CAC1B;CACA;CACA;;AAGF,iBAAiB,WAAW;CAC1B;CACA,SAAS;CACT;;AAGF,iBAAiB,wBAAwB;CACvC;CACA;CACA;CACA;CACA;CACA;CACA;CACA",
|
|
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,0BAA0B;CAC1B,yBAAyB;CACzB,gBAAgB;;AAGlB,YAAY,oBAAoB;CAC9B;CACA,UAAU;;AAGZ,YAAY,wBAAwB;CAClC;;AAGF,YAAY,4BAA4B;CACtC,UAAU;;AAGZ,iBAAiB,oBAAoB;CACnC;CACA;;AAGF,iBAAiB,WAAW;CAC1B;CACA;CACA;;AAGF,iBAAiB,WAAW;CAC1B;CACA,SAAS;CACT;;AAGF,iBAAiB,wBAAwB;CACvC;CACA;CACA;CACA;CACA;CACA;CACA;CACA",
|
|
3
3
|
"names": [],
|
|
4
4
|
"sources": [
|
|
5
5
|
"src/types.ts"
|
|
6
6
|
],
|
|
7
|
+
"version": 3,
|
|
7
8
|
"sourcesContent": [
|
|
8
|
-
"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}\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 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 LinearGradientState {\n enabled: boolean\n Component: any\n}\n\nexport interface ZeegoState {\n enabled: boolean\n DropdownMenu: any\n ContextMenu: any\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"
|
|
9
|
-
]
|
|
10
|
-
"version": 3
|
|
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 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 LinearGradientState {\n enabled: boolean\n Component: any\n}\n\nexport interface ZeegoState {\n enabled: boolean\n DropdownMenu: any\n ContextMenu: any\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"
|
|
10
|
+
]
|
|
11
11
|
}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
"sources": [
|
|
5
5
|
"src/workletsState.ts"
|
|
6
6
|
],
|
|
7
|
+
"version": 3,
|
|
7
8
|
"sourcesContent": [
|
|
8
9
|
"import { createGlobalState } from './globalState'\nimport type { WorkletsState } from './types'\n\nconst state = createGlobalState<WorkletsState>(`worklets`, {\n enabled: false,\n Worklets: null,\n useRunOnJS: null,\n useWorklet: null,\n createWorkletContextValue: null,\n})\n\nexport interface WorkletsAccessor {\n readonly isEnabled: boolean\n readonly state: WorkletsState\n set(updates: Partial<WorkletsState>): void\n}\n\nexport function getWorklets(): WorkletsAccessor {\n return {\n get isEnabled(): boolean {\n return state.get().enabled\n },\n get state(): WorkletsState {\n return state.get()\n },\n set(updates: Partial<WorkletsState>): void {\n Object.assign(state.get(), updates)\n },\n }\n}\n"
|
|
9
|
-
]
|
|
10
|
-
"version": 3
|
|
10
|
+
]
|
|
11
11
|
}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
"sources": [
|
|
5
5
|
"src/zeegoState.ts"
|
|
6
6
|
],
|
|
7
|
+
"version": 3,
|
|
7
8
|
"sourcesContent": [
|
|
8
9
|
"import { createGlobalState } from './globalState'\nimport type { ZeegoState } from './types'\n\nconst state = createGlobalState<ZeegoState>(`zeego`, {\n enabled: false,\n DropdownMenu: null,\n ContextMenu: null,\n})\n\nexport interface ZeegoAccessor {\n readonly isEnabled: boolean\n readonly state: ZeegoState\n set(newState: ZeegoState): void\n}\n\nexport function getZeego(): ZeegoAccessor {\n return {\n get isEnabled(): boolean {\n return state.get().enabled\n },\n get state(): ZeegoState {\n return state.get()\n },\n set(newState: ZeegoState): void {\n state.set(newState)\n },\n }\n}\n"
|
|
9
|
-
]
|
|
10
|
-
"version": 3
|
|
10
|
+
]
|
|
11
11
|
}
|
package/dist/cjs/burntState.js
DELETED
|
@@ -1,39 +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)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
8
|
-
}, __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
10
|
-
for (let key of __getOwnPropNames(from))
|
|
11
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
15
|
-
var burntState_exports = {};
|
|
16
|
-
__export(burntState_exports, {
|
|
17
|
-
getBurnt: () => getBurnt
|
|
18
|
-
});
|
|
19
|
-
module.exports = __toCommonJS(burntState_exports);
|
|
20
|
-
var import_globalState = require("./globalState");
|
|
21
|
-
const state = (0, import_globalState.createGlobalState)("burnt", {
|
|
22
|
-
enabled: !1,
|
|
23
|
-
toast: null,
|
|
24
|
-
dismissAllAlerts: null
|
|
25
|
-
});
|
|
26
|
-
function getBurnt() {
|
|
27
|
-
return {
|
|
28
|
-
get isEnabled() {
|
|
29
|
-
return state.get().enabled;
|
|
30
|
-
},
|
|
31
|
-
get state() {
|
|
32
|
-
return state.get();
|
|
33
|
-
},
|
|
34
|
-
set(newState) {
|
|
35
|
-
state.set(newState);
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=burntState.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/burntState.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAkC;AAGlC,MAAM,YAAQ,sCAA8B,SAAS;AAAA,EACnD,SAAS;AAAA,EACT,OAAO;AAAA,EACP,kBAAkB;AACpB,CAAC;AAQM,SAAS,WAA0B;AACxC,SAAO;AAAA,IACL,IAAI,YAAqB;AACvB,aAAO,MAAM,IAAI,EAAE;AAAA,IACrB;AAAA,IACA,IAAI,QAAoB;AACtB,aAAO,MAAM,IAAI;AAAA,IACnB;AAAA,IACA,IAAI,UAA4B;AAC9B,YAAM,IAAI,QAAQ;AAAA,IACpB;AAAA,EACF;AACF;",
|
|
5
|
-
"names": []
|
|
6
|
-
}
|
package/dist/cjs/components.js
DELETED
|
@@ -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)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
8
|
-
}, __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
10
|
-
for (let key of __getOwnPropNames(from))
|
|
11
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
15
|
-
var components_exports = {};
|
|
16
|
-
__export(components_exports, {
|
|
17
|
-
NativePortal: () => NativePortal,
|
|
18
|
-
NativePortalHost: () => NativePortalHost,
|
|
19
|
-
NativePortalProvider: () => NativePortalProvider
|
|
20
|
-
});
|
|
21
|
-
module.exports = __toCommonJS(components_exports);
|
|
22
|
-
var import_portalState = require("./portalState"), import_jsx_runtime = require("react/jsx-runtime");
|
|
23
|
-
function NativePortal({
|
|
24
|
-
hostName = "root",
|
|
25
|
-
children
|
|
26
|
-
}) {
|
|
27
|
-
if ((0, import_portalState.getPortal)().state.type !== "teleport") return null;
|
|
28
|
-
const { Portal } = globalThis.__tamagui_teleport;
|
|
29
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Portal, { hostName, children });
|
|
30
|
-
}
|
|
31
|
-
function NativePortalHost({ name }) {
|
|
32
|
-
if ((0, import_portalState.getPortal)().state.type !== "teleport") return null;
|
|
33
|
-
const { PortalHost } = globalThis.__tamagui_teleport;
|
|
34
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PortalHost, { name });
|
|
35
|
-
}
|
|
36
|
-
function NativePortalProvider({ children }) {
|
|
37
|
-
if ((0, import_portalState.getPortal)().state.type !== "teleport") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
|
|
38
|
-
const { PortalProvider } = globalThis.__tamagui_teleport;
|
|
39
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PortalProvider, { children });
|
|
40
|
-
}
|
|
41
|
-
//# sourceMappingURL=components.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/components.tsx"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,yBAA0B,0BAqBjB;AARF,SAAS,aAAa;AAAA,EAC3B,WAAW;AAAA,EACX;AACF,GAAiC;AAE/B,UADc,8BAAU,EAAE,MAChB,SAAS,WAAY,QAAO;AAEtC,QAAM,EAAE,OAAO,IAAK,WAAmB;AACvC,SAAO,4CAAC,UAAO,UAAqB,UAAS;AAC/C;AAMO,SAAS,iBAAiB,EAAE,KAAK,GAAqC;AAE3E,UADc,8BAAU,EAAE,MAChB,SAAS,WAAY,QAAO;AAEtC,QAAM,EAAE,WAAW,IAAK,WAAmB;AAC3C,SAAO,4CAAC,cAAW,MAAY;AACjC;AAMO,SAAS,qBAAqB,EAAE,SAAS,GAAyC;AAEvF,UADc,8BAAU,EAAE,MAChB,SAAS,WAAY,QAAO,2EAAG,UAAS;AAElD,QAAM,EAAE,eAAe,IAAK,WAAmB;AAC/C,SAAO,4CAAC,kBAAgB,UAAS;AACnC;",
|
|
5
|
-
"names": []
|
|
6
|
-
}
|
package/dist/cjs/gestureState.js
DELETED
|
@@ -1,57 +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)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
8
|
-
}, __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
10
|
-
for (let key of __getOwnPropNames(from))
|
|
11
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
15
|
-
var gestureState_exports = {};
|
|
16
|
-
__export(gestureState_exports, {
|
|
17
|
-
getGestureHandler: () => getGestureHandler
|
|
18
|
-
});
|
|
19
|
-
module.exports = __toCommonJS(gestureState_exports);
|
|
20
|
-
var import_globalState = require("./globalState");
|
|
21
|
-
const state = (0, import_globalState.createGlobalState)("gesture", {
|
|
22
|
-
enabled: !1,
|
|
23
|
-
Gesture: null,
|
|
24
|
-
GestureDetector: null,
|
|
25
|
-
ScrollView: null
|
|
26
|
-
});
|
|
27
|
-
function getGestureHandler() {
|
|
28
|
-
return {
|
|
29
|
-
get isEnabled() {
|
|
30
|
-
return state.get().enabled;
|
|
31
|
-
},
|
|
32
|
-
get state() {
|
|
33
|
-
return state.get();
|
|
34
|
-
},
|
|
35
|
-
set(updates) {
|
|
36
|
-
Object.assign(state.get(), updates);
|
|
37
|
-
},
|
|
38
|
-
disable() {
|
|
39
|
-
state.get().enabled = !1;
|
|
40
|
-
},
|
|
41
|
-
createPressGesture(config) {
|
|
42
|
-
const { Gesture } = state.get();
|
|
43
|
-
if (!Gesture) return null;
|
|
44
|
-
const longPressDuration = config.delayLongPress ?? 500, tap = Gesture.Tap().runOnJS(!0).maxDuration(1e4).onBegin((e) => {
|
|
45
|
-
config.onPressIn?.(e);
|
|
46
|
-
}).onEnd((e) => {
|
|
47
|
-
config.onPress?.(e);
|
|
48
|
-
}).onFinalize((e) => {
|
|
49
|
-
config.onPressOut?.(e);
|
|
50
|
-
});
|
|
51
|
-
if (config.hitSlop && tap.hitSlop(config.hitSlop), !config.onLongPress) return tap;
|
|
52
|
-
const longPress = Gesture.LongPress().runOnJS(!0).minDuration(longPressDuration).onBegin((e) => config.onPressIn?.(e)).onStart((e) => config.onLongPress?.(e)).onFinalize((e) => config.onPressOut?.(e));
|
|
53
|
-
return config.hitSlop && longPress.hitSlop(config.hitSlop), Gesture.Exclusive(longPress, tap);
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
//# sourceMappingURL=gestureState.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/gestureState.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAkC;AAGlC,MAAM,YAAQ,sCAAgC,WAAW;AAAA,EACvD,SAAS;AAAA,EACT,SAAS;AAAA,EACT,iBAAiB;AAAA,EACjB,YAAY;AACd,CAAC;AA0BM,SAAS,oBAA4C;AAC1D,SAAO;AAAA,IACL,IAAI,YAAqB;AACvB,aAAO,MAAM,IAAI,EAAE;AAAA,IACrB;AAAA,IACA,IAAI,QAAsB;AACxB,aAAO,MAAM,IAAI;AAAA,IACnB;AAAA,IACA,IAAI,SAAsC;AACxC,aAAO,OAAO,MAAM,IAAI,GAAG,OAAO;AAAA,IACpC;AAAA,IAEA,UAAgB;AACd,YAAM,IAAI,EAAE,UAAU;AAAA,IACxB;AAAA,IAEA,mBAAmB,QAAiC;AAClD,YAAM,EAAE,QAAQ,IAAI,MAAM,IAAI;AAC9B,UAAI,CAAC,QAAS,QAAO;AAErB,YAAM,oBAAoB,OAAO,kBAAkB,KAI7C,MAAM,QAAQ,IAAI,EACrB,QAAQ,EAAI,EACZ,YAAY,GAAK,EACjB,QAAQ,CAAC,MAAW;AACnB,eAAO,YAAY,CAAC;AAAA,MACtB,CAAC,EACA,MAAM,CAAC,MAAW;AACjB,eAAO,UAAU,CAAC;AAAA,MACpB,CAAC,EACA,WAAW,CAAC,MAAW;AACtB,eAAO,aAAa,CAAC;AAAA,MACvB,CAAC;AAKH,UAHI,OAAO,WAAS,IAAI,QAAQ,OAAO,OAAO,GAG1C,CAAC,OAAO,YAAa,QAAO;AAGhC,YAAM,YAAY,QAAQ,UAAU,EACjC,QAAQ,EAAI,EACZ,YAAY,iBAAiB,EAC7B,QAAQ,CAAC,MAAW,OAAO,YAAY,CAAC,CAAC,EACzC,QAAQ,CAAC,MAAW,OAAO,cAAc,CAAC,CAAC,EAC3C,WAAW,CAAC,MAAW,OAAO,aAAa,CAAC,CAAC;AAEhD,aAAI,OAAO,WAAS,UAAU,QAAQ,OAAO,OAAO,GAG7C,QAAQ,UAAU,WAAW,GAAG;AAAA,IACzC;AAAA,EACF;AACF;",
|
|
5
|
-
"names": []
|
|
6
|
-
}
|
package/dist/cjs/globalState.js
DELETED
|
@@ -1,34 +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)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
8
|
-
}, __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
10
|
-
for (let key of __getOwnPropNames(from))
|
|
11
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
15
|
-
var globalState_exports = {};
|
|
16
|
-
__export(globalState_exports, {
|
|
17
|
-
createGlobalState: () => createGlobalState
|
|
18
|
-
});
|
|
19
|
-
module.exports = __toCommonJS(globalState_exports);
|
|
20
|
-
function createGlobalState(key, defaultValue) {
|
|
21
|
-
const GLOBAL_KEY = `__tamagui_${key}__`;
|
|
22
|
-
function getGlobalState() {
|
|
23
|
-
const g = globalThis;
|
|
24
|
-
return g[GLOBAL_KEY] || (g[GLOBAL_KEY] = defaultValue), g[GLOBAL_KEY];
|
|
25
|
-
}
|
|
26
|
-
function setGlobalState(newState) {
|
|
27
|
-
globalThis[GLOBAL_KEY] = newState;
|
|
28
|
-
}
|
|
29
|
-
return {
|
|
30
|
-
get: getGlobalState,
|
|
31
|
-
set: setGlobalState
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=globalState.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/globalState.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,SAAS,kBACd,KACA,cAIA;AACA,QAAM,aAAa,aAAa,GAAG;AAMnC,WAAS,iBAAoB;AAC3B,UAAM,IAAI;AACV,WAAK,EAAE,UAAU,MAGf,EAAE,UAAU,IAAI,eAEX,EAAE,UAAU;AAAA,EACrB;AAEA,WAAS,eAAe,UAAmB;AACxC,IAAC,WAA6B,UAAU,IAAI;AAAA,EAC/C;AAEA,SAAO;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,EACP;AACF;",
|
|
5
|
-
"names": []
|
|
6
|
-
}
|