@tamagui/native 2.0.0-1769320275396 → 2.0.0-1769401121849
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/gestureState.cjs +7 -1
- package/dist/cjs/gestureState.js +7 -1
- package/dist/cjs/gestureState.js.map +1 -1
- package/dist/cjs/gestureState.native.js +3 -3
- package/dist/cjs/gestureState.native.js.map +1 -1
- package/dist/cjs/index.cjs +4 -0
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.native.js +4 -0
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/linearGradientState.cjs +42 -0
- package/dist/cjs/linearGradientState.js +34 -0
- package/dist/cjs/linearGradientState.js.map +6 -0
- package/dist/cjs/linearGradientState.native.js +45 -0
- package/dist/cjs/linearGradientState.native.js.map +1 -0
- package/dist/cjs/safeAreaState.cjs +68 -0
- package/dist/cjs/safeAreaState.js +52 -0
- package/dist/cjs/safeAreaState.js.map +6 -0
- package/dist/cjs/safeAreaState.native.js +71 -0
- package/dist/cjs/safeAreaState.native.js.map +1 -0
- package/dist/cjs/setup-expo-linear-gradient.cjs +15 -0
- package/dist/cjs/setup-expo-linear-gradient.js +17 -0
- package/dist/cjs/setup-expo-linear-gradient.js.map +6 -0
- package/dist/cjs/setup-expo-linear-gradient.native.js +18 -0
- package/dist/cjs/setup-expo-linear-gradient.native.js.map +1 -0
- package/dist/cjs/setup-safe-area.cjs +1 -0
- package/dist/cjs/setup-safe-area.js +2 -0
- package/dist/cjs/setup-safe-area.js.map +6 -0
- package/dist/cjs/setup-safe-area.native.js +25 -0
- package/dist/cjs/setup-safe-area.native.js.map +1 -0
- package/dist/esm/gestureState.js +7 -1
- package/dist/esm/gestureState.js.map +1 -1
- package/dist/esm/gestureState.mjs +7 -1
- package/dist/esm/gestureState.mjs.map +1 -1
- package/dist/esm/gestureState.native.js +3 -3
- package/dist/esm/gestureState.native.js.map +1 -1
- package/dist/esm/index.js +4 -0
- package/dist/esm/index.js.map +1 -1
- 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/linearGradientState.js +18 -0
- package/dist/esm/linearGradientState.js.map +6 -0
- package/dist/esm/linearGradientState.mjs +19 -0
- package/dist/esm/linearGradientState.mjs.map +1 -0
- package/dist/esm/linearGradientState.native.js +19 -0
- package/dist/esm/linearGradientState.native.js.map +1 -0
- package/dist/esm/safeAreaState.js +36 -0
- package/dist/esm/safeAreaState.js.map +6 -0
- package/dist/esm/safeAreaState.mjs +45 -0
- package/dist/esm/safeAreaState.mjs.map +1 -0
- package/dist/esm/safeAreaState.native.js +45 -0
- package/dist/esm/safeAreaState.native.js.map +1 -0
- package/dist/esm/setup-expo-linear-gradient.js +17 -0
- package/dist/esm/setup-expo-linear-gradient.js.map +6 -0
- package/dist/esm/setup-expo-linear-gradient.mjs +16 -0
- package/dist/esm/setup-expo-linear-gradient.mjs.map +1 -0
- package/dist/esm/setup-expo-linear-gradient.native.js +16 -0
- package/dist/esm/setup-expo-linear-gradient.native.js.map +1 -0
- package/dist/esm/setup-safe-area.js +2 -0
- package/dist/esm/setup-safe-area.js.map +6 -0
- package/dist/esm/setup-safe-area.mjs +2 -0
- package/dist/esm/setup-safe-area.mjs.map +1 -0
- package/dist/esm/setup-safe-area.native.js +23 -0
- package/dist/esm/setup-safe-area.native.js.map +1 -0
- package/package.json +25 -3
- package/src/gestureState.ts +9 -3
- package/src/index.ts +16 -0
- package/src/linearGradientState.ts +23 -0
- package/src/safeAreaState.ts +57 -0
- package/src/setup-expo-linear-gradient.ts +36 -0
- package/src/setup-safe-area.ts +56 -0
- package/src/types.ts +31 -0
- package/types/gestureState.d.ts.map +1 -1
- package/types/index.d.ts +8 -1
- package/types/index.d.ts.map +2 -2
- package/types/linearGradientState.d.ts +9 -0
- package/types/linearGradientState.d.ts.map +11 -0
- package/types/safeAreaState.d.ts +13 -0
- package/types/safeAreaState.d.ts.map +11 -0
- package/types/setup-expo-linear-gradient.d.ts +3 -0
- package/types/setup-expo-linear-gradient.d.ts.map +11 -0
- package/types/setup-safe-area.d.ts +3 -0
- package/types/setup-safe-area.d.ts.map +11 -0
- package/types/types.d.ts +26 -0
- package/types/types.d.ts.map +2 -2
- package/dist/cjs/setup-portal.cjs +0 -66
- package/dist/cjs/setup-portal.js +0 -53
- package/dist/cjs/setup-portal.js.map +0 -6
- package/dist/cjs/setup-portal.native.js +0 -74
- package/dist/cjs/setup-portal.native.js.map +0 -1
- package/dist/esm/setup-portal.js +0 -37
- package/dist/esm/setup-portal.js.map +0 -6
- package/dist/esm/setup-portal.mjs +0 -43
- package/dist/esm/setup-portal.mjs.map +0 -1
- package/dist/esm/setup-portal.native.js +0 -48
- package/dist/esm/setup-portal.native.js.map +0 -1
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { SafeAreaState, SafeAreaInsets, SafeAreaFrame } from './types'
|
|
2
|
+
|
|
3
|
+
const GLOBAL_KEY = '__tamagui_native_safe_area_state__'
|
|
4
|
+
|
|
5
|
+
function getGlobalState(): SafeAreaState {
|
|
6
|
+
const g = globalThis as any
|
|
7
|
+
if (!g[GLOBAL_KEY]) {
|
|
8
|
+
g[GLOBAL_KEY] = {
|
|
9
|
+
enabled: false,
|
|
10
|
+
useSafeAreaInsets: null,
|
|
11
|
+
useSafeAreaFrame: null,
|
|
12
|
+
initialMetrics: null,
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return g[GLOBAL_KEY]
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const defaultInsets: SafeAreaInsets = { top: 0, right: 0, bottom: 0, left: 0 }
|
|
19
|
+
const defaultFrame: SafeAreaFrame = { x: 0, y: 0, width: 0, height: 0 }
|
|
20
|
+
|
|
21
|
+
export interface SafeAreaAccessor {
|
|
22
|
+
readonly isEnabled: boolean
|
|
23
|
+
readonly state: SafeAreaState
|
|
24
|
+
set(updates: Partial<SafeAreaState>): void
|
|
25
|
+
/** Get initial insets (non-reactive, for style resolution) */
|
|
26
|
+
getInsets(): SafeAreaInsets
|
|
27
|
+
/** Get initial frame (non-reactive) */
|
|
28
|
+
getFrame(): SafeAreaFrame
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function getSafeArea(): SafeAreaAccessor {
|
|
32
|
+
return {
|
|
33
|
+
get isEnabled() {
|
|
34
|
+
return getGlobalState().enabled
|
|
35
|
+
},
|
|
36
|
+
get state() {
|
|
37
|
+
return getGlobalState()
|
|
38
|
+
},
|
|
39
|
+
set(updates: Partial<SafeAreaState>) {
|
|
40
|
+
Object.assign(getGlobalState(), updates)
|
|
41
|
+
},
|
|
42
|
+
getInsets() {
|
|
43
|
+
const state = getGlobalState()
|
|
44
|
+
if (!state.enabled || !state.initialMetrics) {
|
|
45
|
+
return defaultInsets
|
|
46
|
+
}
|
|
47
|
+
return state.initialMetrics.insets
|
|
48
|
+
},
|
|
49
|
+
getFrame() {
|
|
50
|
+
const state = getGlobalState()
|
|
51
|
+
if (!state.enabled || !state.initialMetrics) {
|
|
52
|
+
return defaultFrame
|
|
53
|
+
}
|
|
54
|
+
return state.initialMetrics.frame
|
|
55
|
+
},
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Setup expo-linear-gradient for Tamagui.
|
|
3
|
+
*
|
|
4
|
+
* Simply import this module at the top of your app entry point:
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* import '@tamagui/native/expo-linear-gradient'
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* This automatically detects and configures expo-linear-gradient.
|
|
12
|
+
* If not installed, LinearGradient will use a CSS-based fallback on native.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { getLinearGradient } from './linearGradientState'
|
|
16
|
+
|
|
17
|
+
function setup(): void {
|
|
18
|
+
const g = globalThis as any
|
|
19
|
+
if (g.__tamagui_native_linear_gradient_setup) return
|
|
20
|
+
g.__tamagui_native_linear_gradient_setup = true
|
|
21
|
+
|
|
22
|
+
try {
|
|
23
|
+
const expoLinearGradient = require('expo-linear-gradient')
|
|
24
|
+
if (expoLinearGradient?.LinearGradient) {
|
|
25
|
+
getLinearGradient().set({
|
|
26
|
+
enabled: true,
|
|
27
|
+
Component: expoLinearGradient.LinearGradient,
|
|
28
|
+
})
|
|
29
|
+
}
|
|
30
|
+
} catch {
|
|
31
|
+
// expo-linear-gradient not installed, will use CSS fallback
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// run setup immediately on import
|
|
36
|
+
setup()
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Setup react-native-safe-area-context for Tamagui native components.
|
|
3
|
+
*
|
|
4
|
+
* Simply import this module at the top of your app entry point:
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* import '@tamagui/native/setup-safe-area'
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* This automatically detects and configures react-native-safe-area-context
|
|
12
|
+
* for use with Tamagui components that need safe area awareness.
|
|
13
|
+
*
|
|
14
|
+
* Note: You must still wrap your app with SafeAreaProvider yourself:
|
|
15
|
+
* ```tsx
|
|
16
|
+
* import { SafeAreaProvider } from 'react-native-safe-area-context'
|
|
17
|
+
* <SafeAreaProvider>
|
|
18
|
+
* <App />
|
|
19
|
+
* </SafeAreaProvider>
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* On web, this is a no-op since CSS env(safe-area-inset-*) values work natively.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import { getSafeArea } from './safeAreaState'
|
|
26
|
+
|
|
27
|
+
function setup() {
|
|
28
|
+
// only run on native
|
|
29
|
+
if (process.env.TAMAGUI_TARGET !== 'native') {
|
|
30
|
+
return
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const g = globalThis as any
|
|
34
|
+
if (g.__tamagui_native_safe_area_setup_complete) {
|
|
35
|
+
return
|
|
36
|
+
}
|
|
37
|
+
g.__tamagui_native_safe_area_setup_complete = true
|
|
38
|
+
|
|
39
|
+
try {
|
|
40
|
+
const safeAreaContext = require('react-native-safe-area-context')
|
|
41
|
+
const { useSafeAreaInsets, useSafeAreaFrame, initialWindowMetrics } = safeAreaContext
|
|
42
|
+
|
|
43
|
+
if (useSafeAreaInsets) {
|
|
44
|
+
getSafeArea().set({
|
|
45
|
+
enabled: true,
|
|
46
|
+
useSafeAreaInsets,
|
|
47
|
+
useSafeAreaFrame: useSafeAreaFrame || null,
|
|
48
|
+
initialMetrics: initialWindowMetrics || null,
|
|
49
|
+
})
|
|
50
|
+
}
|
|
51
|
+
} catch {
|
|
52
|
+
// react-native-safe-area-context not available
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
setup()
|
package/src/types.ts
CHANGED
|
@@ -20,6 +20,32 @@ export interface WorkletsState {
|
|
|
20
20
|
createWorkletContextValue: any
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
export interface SafeAreaInsets {
|
|
24
|
+
top: number
|
|
25
|
+
right: number
|
|
26
|
+
bottom: number
|
|
27
|
+
left: number
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface SafeAreaFrame {
|
|
31
|
+
x: number
|
|
32
|
+
y: number
|
|
33
|
+
width: number
|
|
34
|
+
height: number
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface SafeAreaMetrics {
|
|
38
|
+
insets: SafeAreaInsets
|
|
39
|
+
frame: SafeAreaFrame
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface SafeAreaState {
|
|
43
|
+
enabled: boolean
|
|
44
|
+
useSafeAreaInsets: (() => SafeAreaInsets) | null
|
|
45
|
+
useSafeAreaFrame: (() => SafeAreaFrame) | null
|
|
46
|
+
initialMetrics: SafeAreaMetrics | null
|
|
47
|
+
}
|
|
48
|
+
|
|
23
49
|
export type NativePortalProps = {
|
|
24
50
|
hostName?: string
|
|
25
51
|
children: ReactNode
|
|
@@ -32,3 +58,8 @@ export type NativePortalHostProps = {
|
|
|
32
58
|
export type NativePortalProviderProps = {
|
|
33
59
|
children: ReactNode
|
|
34
60
|
}
|
|
61
|
+
|
|
62
|
+
export interface LinearGradientState {
|
|
63
|
+
enabled: boolean
|
|
64
|
+
Component: any
|
|
65
|
+
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"src/gestureState.ts"
|
|
6
6
|
],
|
|
7
7
|
"sourcesContent": [
|
|
8
|
-
"import type { GestureState } from './types'\n\nconst GLOBAL_KEY = '__tamagui_native_gesture_state__'\n\nfunction getGlobalState(): GestureState {\n const g = globalThis as any\n if (!g[GLOBAL_KEY]) {\n g[GLOBAL_KEY] = {\n enabled: false,\n Gesture: null,\n GestureDetector: null,\n ScrollView: null,\n }\n }\n return g[GLOBAL_KEY]\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?: any\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 getGlobalState().enabled\n },\n get state(): GestureState {\n return getGlobalState()\n },\n set(updates: Partial<GestureState>): void {\n const state = getGlobalState()\n Object.assign(state, updates)\n },\n\n disable(): void {\n const state = getGlobalState()\n state.enabled = false\n },\n\n createPressGesture(config: PressGestureConfig): any {\n const { Gesture } = getGlobalState()\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) => config.onPressIn?.(e))\n .onEnd((e: any) => config.onPress?.(e))\n .onFinalize((e: any) => config.onPressOut?.(e))\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"
|
|
8
|
+
"import type { GestureState } from './types'\n\nconst GLOBAL_KEY = '__tamagui_native_gesture_state__'\n\nfunction getGlobalState(): GestureState {\n const g = globalThis as any\n if (!g[GLOBAL_KEY]) {\n g[GLOBAL_KEY] = {\n enabled: false,\n Gesture: null,\n GestureDetector: null,\n ScrollView: null,\n }\n }\n return g[GLOBAL_KEY]\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?: any\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 getGlobalState().enabled\n },\n get state(): GestureState {\n return getGlobalState()\n },\n set(updates: Partial<GestureState>): void {\n const state = getGlobalState()\n Object.assign(state, updates)\n },\n\n disable(): void {\n const state = getGlobalState()\n state.enabled = false\n },\n\n createPressGesture(config: PressGestureConfig): any {\n const { Gesture } = getGlobalState()\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
9
|
],
|
|
10
10
|
"version": 3
|
|
11
11
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -9,18 +9,25 @@
|
|
|
9
9
|
* import '@tamagui/native/setup-teleport'
|
|
10
10
|
* import '@tamagui/native/setup-gesture-handler'
|
|
11
11
|
* import '@tamagui/native/setup-worklets'
|
|
12
|
+
* import '@tamagui/native/setup-safe-area'
|
|
13
|
+
* import '@tamagui/native/expo-linear-gradient'
|
|
12
14
|
*
|
|
13
15
|
* // Then use Tamagui components normally
|
|
14
16
|
* // Sheet will automatically use native gestures when available
|
|
17
|
+
* // LinearGradient will use expo-linear-gradient when installed
|
|
15
18
|
* ```
|
|
16
19
|
*/
|
|
17
|
-
export type { NativePortalState, GestureState, WorkletsState, NativePortalProps, NativePortalHostProps, NativePortalProviderProps } from "./types";
|
|
20
|
+
export type { NativePortalState, GestureState, WorkletsState, SafeAreaState, SafeAreaInsets, SafeAreaFrame, SafeAreaMetrics, LinearGradientState, NativePortalProps, NativePortalHostProps, NativePortalProviderProps } from "./types";
|
|
18
21
|
export { getPortal } from "./portalState";
|
|
19
22
|
export type { PortalAccessor } from "./portalState";
|
|
20
23
|
export { getGestureHandler } from "./gestureState";
|
|
21
24
|
export type { GestureHandlerAccessor, PressGestureConfig } from "./gestureState";
|
|
22
25
|
export { getWorklets } from "./workletsState";
|
|
23
26
|
export type { WorkletsAccessor } from "./workletsState";
|
|
27
|
+
export { getSafeArea } from "./safeAreaState";
|
|
28
|
+
export type { SafeAreaAccessor } from "./safeAreaState";
|
|
29
|
+
export { getLinearGradient } from "./linearGradientState";
|
|
30
|
+
export type { LinearGradientAccessor } from "./linearGradientState";
|
|
24
31
|
export { NativePortal, NativePortalHost, NativePortalProvider } from "./components";
|
|
25
32
|
|
|
26
33
|
//# sourceMappingURL=index.d.ts.map
|
package/types/index.d.ts.map
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"mappings": "
|
|
2
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAqBA,cACE,mBACA,cACA,eACA,eACA,gBACA,eACA,iBACA,qBACA,mBACA,uBACA,iCACK;AAGP,SAAS,iBAAiB;AAC1B,cAAc,sBAAsB;AAGpC,SAAS,yBAAyB;AAClC,cAAc,wBAAwB,0BAA0B;AAGhE,SAAS,mBAAmB;AAC5B,cAAc,wBAAwB;AAGtC,SAAS,mBAAmB;AAC5B,cAAc,wBAAwB;AAGtC,SAAS,yBAAyB;AAClC,cAAc,8BAA8B;AAG5C,SAAS,cAAc,kBAAkB,4BAA4B",
|
|
3
3
|
"names": [],
|
|
4
4
|
"sources": [
|
|
5
5
|
"src/index.ts"
|
|
6
6
|
],
|
|
7
7
|
"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 *\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 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 { GestureHandlerAccessor, PressGestureConfig } from './gestureState'\n\n// worklets\nexport { getWorklets } from './workletsState'\nexport type { WorkletsAccessor } from './workletsState'\n\n// components\nexport { NativePortal, NativePortalHost, NativePortalProvider } from './components'\n"
|
|
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 *\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 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 { GestureHandlerAccessor, PressGestureConfig } from './gestureState'\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// components\nexport { NativePortal, NativePortalHost, NativePortalProvider } from './components'\n"
|
|
9
9
|
],
|
|
10
10
|
"version": 3
|
|
11
11
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { LinearGradientState } from "./types";
|
|
2
|
+
export interface LinearGradientAccessor {
|
|
3
|
+
readonly isEnabled: boolean;
|
|
4
|
+
readonly state: LinearGradientState;
|
|
5
|
+
set(newState: LinearGradientState): void;
|
|
6
|
+
}
|
|
7
|
+
export declare function getLinearGradient(): LinearGradientAccessor;
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=linearGradientState.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mappings": "AAAA,cAAc,2BAA2B;AAIzC,iBAAiB,uBAAuB;UAC7B;UACA,OAAO;CAChB,IAAI,UAAU;;AAGhB,OAAO,iBAAS,qBAAqB",
|
|
3
|
+
"names": [],
|
|
4
|
+
"sources": [
|
|
5
|
+
"src/linearGradientState.ts"
|
|
6
|
+
],
|
|
7
|
+
"sourcesContent": [
|
|
8
|
+
"import type { LinearGradientState } from './types'\n\nlet state: LinearGradientState = { enabled: false, Component: null }\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.enabled\n },\n get state(): LinearGradientState {\n return state\n },\n set(newState: LinearGradientState): void {\n state = newState\n },\n }\n}\n"
|
|
9
|
+
],
|
|
10
|
+
"version": 3
|
|
11
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { SafeAreaState, SafeAreaInsets, SafeAreaFrame } from "./types";
|
|
2
|
+
export interface SafeAreaAccessor {
|
|
3
|
+
readonly isEnabled: boolean;
|
|
4
|
+
readonly state: SafeAreaState;
|
|
5
|
+
set(updates: Partial<SafeAreaState>): void;
|
|
6
|
+
/** Get initial insets (non-reactive, for style resolution) */
|
|
7
|
+
getInsets(): SafeAreaInsets;
|
|
8
|
+
/** Get initial frame (non-reactive) */
|
|
9
|
+
getFrame(): SafeAreaFrame;
|
|
10
|
+
}
|
|
11
|
+
export declare function getSafeArea(): SafeAreaAccessor;
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=safeAreaState.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mappings": "AAAA,cAAc,eAAe,gBAAgB,qBAAqB;AAoBlE,iBAAiB,iBAAiB;UACvB;UACA,OAAO;CAChB,IAAI,SAAS,QAAQ;;CAErB,aAAa;;CAEb,YAAY;;AAGd,OAAO,iBAAS,eAAe",
|
|
3
|
+
"names": [],
|
|
4
|
+
"sources": [
|
|
5
|
+
"src/safeAreaState.ts"
|
|
6
|
+
],
|
|
7
|
+
"sourcesContent": [
|
|
8
|
+
"import type { SafeAreaState, SafeAreaInsets, SafeAreaFrame } from './types'\n\nconst GLOBAL_KEY = '__tamagui_native_safe_area_state__'\n\nfunction getGlobalState(): SafeAreaState {\n const g = globalThis as any\n if (!g[GLOBAL_KEY]) {\n g[GLOBAL_KEY] = {\n enabled: false,\n useSafeAreaInsets: null,\n useSafeAreaFrame: null,\n initialMetrics: null,\n }\n }\n return g[GLOBAL_KEY]\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 getGlobalState().enabled\n },\n get state() {\n return getGlobalState()\n },\n set(updates: Partial<SafeAreaState>) {\n Object.assign(getGlobalState(), updates)\n },\n getInsets() {\n const state = getGlobalState()\n if (!state.enabled || !state.initialMetrics) {\n return defaultInsets\n }\n return state.initialMetrics.insets\n },\n getFrame() {\n const state = getGlobalState()\n if (!state.enabled || !state.initialMetrics) {\n return defaultFrame\n }\n return state.initialMetrics.frame\n },\n }\n}\n"
|
|
9
|
+
],
|
|
10
|
+
"version": 3
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mappings": "",
|
|
3
|
+
"names": [],
|
|
4
|
+
"sources": [
|
|
5
|
+
"src/setup-expo-linear-gradient.ts"
|
|
6
|
+
],
|
|
7
|
+
"sourcesContent": [
|
|
8
|
+
"/**\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/expo-linear-gradient'\n * ```\n *\n * This automatically detects and configures expo-linear-gradient.\n * If not installed, LinearGradient will use a CSS-based fallback 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
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mappings": "",
|
|
3
|
+
"names": [],
|
|
4
|
+
"sources": [
|
|
5
|
+
"src/setup-safe-area.ts"
|
|
6
|
+
],
|
|
7
|
+
"sourcesContent": [
|
|
8
|
+
"/**\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
|
|
11
|
+
}
|
package/types/types.d.ts
CHANGED
|
@@ -16,6 +16,28 @@ export interface WorkletsState {
|
|
|
16
16
|
useWorklet: any;
|
|
17
17
|
createWorkletContextValue: any;
|
|
18
18
|
}
|
|
19
|
+
export interface SafeAreaInsets {
|
|
20
|
+
top: number;
|
|
21
|
+
right: number;
|
|
22
|
+
bottom: number;
|
|
23
|
+
left: number;
|
|
24
|
+
}
|
|
25
|
+
export interface SafeAreaFrame {
|
|
26
|
+
x: number;
|
|
27
|
+
y: number;
|
|
28
|
+
width: number;
|
|
29
|
+
height: number;
|
|
30
|
+
}
|
|
31
|
+
export interface SafeAreaMetrics {
|
|
32
|
+
insets: SafeAreaInsets;
|
|
33
|
+
frame: SafeAreaFrame;
|
|
34
|
+
}
|
|
35
|
+
export interface SafeAreaState {
|
|
36
|
+
enabled: boolean;
|
|
37
|
+
useSafeAreaInsets: (() => SafeAreaInsets) | null;
|
|
38
|
+
useSafeAreaFrame: (() => SafeAreaFrame) | null;
|
|
39
|
+
initialMetrics: SafeAreaMetrics | null;
|
|
40
|
+
}
|
|
19
41
|
export type NativePortalProps = {
|
|
20
42
|
hostName?: string;
|
|
21
43
|
children: ReactNode;
|
|
@@ -26,5 +48,9 @@ export type NativePortalHostProps = {
|
|
|
26
48
|
export type NativePortalProviderProps = {
|
|
27
49
|
children: ReactNode;
|
|
28
50
|
};
|
|
51
|
+
export interface LinearGradientState {
|
|
52
|
+
enabled: boolean;
|
|
53
|
+
Component: any;
|
|
54
|
+
}
|
|
29
55
|
|
|
30
56
|
//# 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;;AAGF,iBAAiB,cAAc;CAC7B;CACA;CACA;CACA;CACA;;AAGF,YAAY,oBAAoB;CAC9B;CACA,UAAU;;AAGZ,YAAY,wBAAwB;CAClC;;AAGF,YAAY,4BAA4B;CACtC,UAAU",
|
|
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",
|
|
3
3
|
"names": [],
|
|
4
4
|
"sources": [
|
|
5
5
|
"src/types.ts"
|
|
6
6
|
],
|
|
7
7
|
"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 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"
|
|
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"
|
|
9
9
|
],
|
|
10
10
|
"version": 3
|
|
11
11
|
}
|
|
@@ -1,66 +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: !0
|
|
9
|
-
});
|
|
10
|
-
},
|
|
11
|
-
__copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
13
|
-
get: () => from[key],
|
|
14
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
-
});
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
19
|
-
value: !0
|
|
20
|
-
}), mod);
|
|
21
|
-
var setup_portal_exports = {};
|
|
22
|
-
__export(setup_portal_exports, {
|
|
23
|
-
setupNativePortal: () => setupNativePortal
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(setup_portal_exports);
|
|
26
|
-
var import_portalState = require("./portalState.cjs");
|
|
27
|
-
const IS_FABRIC = typeof global < "u" && !!(global._IS_FABRIC ?? global.nativeFabricUIManager);
|
|
28
|
-
function setup() {
|
|
29
|
-
const g = globalThis;
|
|
30
|
-
if (!g.__tamagui_native_portal_setup) {
|
|
31
|
-
g.__tamagui_native_portal_setup = !0;
|
|
32
|
-
try {
|
|
33
|
-
const teleport = require("react-native-teleport");
|
|
34
|
-
if (teleport?.Portal && teleport?.PortalHost && teleport?.PortalProvider) {
|
|
35
|
-
g.__tamagui_teleport = teleport, (0, import_portalState.setNativePortalState)({
|
|
36
|
-
enabled: !0,
|
|
37
|
-
type: "teleport"
|
|
38
|
-
});
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
} catch {}
|
|
42
|
-
if (IS_FABRIC) {
|
|
43
|
-
try {
|
|
44
|
-
const mod = require("react-native/Libraries/Renderer/shims/ReactFabric");
|
|
45
|
-
g.__tamagui_portal_create = mod?.default?.createPortal ?? mod.createPortal, (0, import_portalState.setNativePortalState)({
|
|
46
|
-
enabled: !0,
|
|
47
|
-
type: "legacy"
|
|
48
|
-
});
|
|
49
|
-
} catch (err) {
|
|
50
|
-
console.info("Note: error importing fabric portal, native portals disabled", err);
|
|
51
|
-
}
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
try {
|
|
55
|
-
const mod = require("react-native/Libraries/Renderer/shims/ReactNative");
|
|
56
|
-
g.__tamagui_portal_create = mod?.default?.createPortal ?? mod.createPortal, (0, import_portalState.setNativePortalState)({
|
|
57
|
-
enabled: !0,
|
|
58
|
-
type: "legacy"
|
|
59
|
-
});
|
|
60
|
-
} catch (err) {
|
|
61
|
-
console.info("Note: error importing native portal, native portals disabled", err);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
setup();
|
|
66
|
-
const setupNativePortal = setup;
|
package/dist/cjs/setup-portal.js
DELETED
|
@@ -1,53 +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 setup_portal_exports = {};
|
|
16
|
-
__export(setup_portal_exports, {
|
|
17
|
-
setupNativePortal: () => setupNativePortal
|
|
18
|
-
});
|
|
19
|
-
module.exports = __toCommonJS(setup_portal_exports);
|
|
20
|
-
var import_portalState = require("./portalState");
|
|
21
|
-
const IS_FABRIC = typeof global < "u" && !!(global._IS_FABRIC ?? global.nativeFabricUIManager);
|
|
22
|
-
function setup() {
|
|
23
|
-
const g = globalThis;
|
|
24
|
-
if (!g.__tamagui_native_portal_setup) {
|
|
25
|
-
g.__tamagui_native_portal_setup = !0;
|
|
26
|
-
try {
|
|
27
|
-
const teleport = require("react-native-teleport");
|
|
28
|
-
if (teleport?.Portal && teleport?.PortalHost && teleport?.PortalProvider) {
|
|
29
|
-
g.__tamagui_teleport = teleport, (0, import_portalState.setNativePortalState)({ enabled: !0, type: "teleport" });
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
} catch {
|
|
33
|
-
}
|
|
34
|
-
if (IS_FABRIC) {
|
|
35
|
-
try {
|
|
36
|
-
const mod = require("react-native/Libraries/Renderer/shims/ReactFabric");
|
|
37
|
-
g.__tamagui_portal_create = mod?.default?.createPortal ?? mod.createPortal, (0, import_portalState.setNativePortalState)({ enabled: !0, type: "legacy" });
|
|
38
|
-
} catch (err) {
|
|
39
|
-
console.info("Note: error importing fabric portal, native portals disabled", err);
|
|
40
|
-
}
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
try {
|
|
44
|
-
const mod = require("react-native/Libraries/Renderer/shims/ReactNative");
|
|
45
|
-
g.__tamagui_portal_create = mod?.default?.createPortal ?? mod.createPortal, (0, import_portalState.setNativePortalState)({ enabled: !0, type: "legacy" });
|
|
46
|
-
} catch (err) {
|
|
47
|
-
console.info("Note: error importing native portal, native portals disabled", err);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
setup();
|
|
52
|
-
const setupNativePortal = setup;
|
|
53
|
-
//# sourceMappingURL=setup-portal.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/setup-portal.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAcA,yBAAqC;AAErC,MAAM,YACJ,OAAO,SAAW,OAClB,GAAS,OAAe,cAAe,OAAe;AAExD,SAAS,QAAQ;AACf,QAAM,IAAI;AACV,MAAI,GAAE,+BACN;AAAA,MAAE,gCAAgC;AAGlC,QAAI;AACF,YAAM,WAAW,QAAQ,uBAAuB;AAChD,UAAI,UAAU,UAAU,UAAU,cAAc,UAAU,gBAAgB;AACxE,UAAE,qBAAqB,cACvB,yCAAqB,EAAE,SAAS,IAAM,MAAM,WAAW,CAAC;AACxD;AAAA,MACF;AAAA,IACF,QAAQ;AAAA,IAER;AAGA,QAAI,WAAW;AACb,UAAI;AACF,cAAM,MAAM,QAAQ,mDAAmD;AACvE,UAAE,0BAA0B,KAAK,SAAS,gBAAgB,IAAI,kBAC9D,yCAAqB,EAAE,SAAS,IAAM,MAAM,SAAS,CAAC;AAAA,MACxD,SAAS,KAAK;AACZ,gBAAQ,KAAK,gEAAgE,GAAG;AAAA,MAClF;AACA;AAAA,IACF;AAEA,QAAI;AACF,YAAM,MAAM,QAAQ,mDAAmD;AACvE,QAAE,0BAA0B,KAAK,SAAS,gBAAgB,IAAI,kBAC9D,yCAAqB,EAAE,SAAS,IAAM,MAAM,SAAS,CAAC;AAAA,IACxD,SAAS,KAAK;AACZ,cAAQ,KAAK,gEAAgE,GAAG;AAAA,IAClF;AAAA;AACF;AAGA,MAAM;AAGC,MAAM,oBAAoB;",
|
|
5
|
-
"names": []
|
|
6
|
-
}
|
|
@@ -1,74 +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: !0
|
|
11
|
-
});
|
|
12
|
-
},
|
|
13
|
-
__copyProps = (to, from, except, desc) => {
|
|
14
|
-
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
15
|
-
get: () => from[key],
|
|
16
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
-
});
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
-
value: !0
|
|
22
|
-
}), mod);
|
|
23
|
-
var setup_portal_exports = {};
|
|
24
|
-
__export(setup_portal_exports, {
|
|
25
|
-
setupNativePortal: () => setupNativePortal
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(setup_portal_exports);
|
|
28
|
-
var import_portalState = require("./portalState.native.js"),
|
|
29
|
-
_global__IS_FABRIC,
|
|
30
|
-
IS_FABRIC = typeof global < "u" && !!((_global__IS_FABRIC = global._IS_FABRIC) !== null && _global__IS_FABRIC !== void 0 ? _global__IS_FABRIC : global.nativeFabricUIManager);
|
|
31
|
-
function setup() {
|
|
32
|
-
var g = globalThis;
|
|
33
|
-
if (!g.__tamagui_native_portal_setup) {
|
|
34
|
-
g.__tamagui_native_portal_setup = !0;
|
|
35
|
-
try {
|
|
36
|
-
var teleport = require("react-native-teleport");
|
|
37
|
-
if (teleport?.Portal && teleport?.PortalHost && teleport?.PortalProvider) {
|
|
38
|
-
g.__tamagui_teleport = teleport, (0, import_portalState.setNativePortalState)({
|
|
39
|
-
enabled: !0,
|
|
40
|
-
type: "teleport"
|
|
41
|
-
});
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
} catch {}
|
|
45
|
-
if (IS_FABRIC) {
|
|
46
|
-
try {
|
|
47
|
-
var _mod_default,
|
|
48
|
-
mod = require("react-native/Libraries/Renderer/shims/ReactFabric"),
|
|
49
|
-
_mod_default_createPortal;
|
|
50
|
-
g.__tamagui_portal_create = (_mod_default_createPortal = mod == null || (_mod_default = mod.default) === null || _mod_default === void 0 ? void 0 : _mod_default.createPortal) !== null && _mod_default_createPortal !== void 0 ? _mod_default_createPortal : mod.createPortal, (0, import_portalState.setNativePortalState)({
|
|
51
|
-
enabled: !0,
|
|
52
|
-
type: "legacy"
|
|
53
|
-
});
|
|
54
|
-
} catch (err) {
|
|
55
|
-
console.info("Note: error importing fabric portal, native portals disabled", err);
|
|
56
|
-
}
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
try {
|
|
60
|
-
var _mod_default1,
|
|
61
|
-
mod1 = require("react-native/Libraries/Renderer/shims/ReactNative"),
|
|
62
|
-
_mod_default_createPortal1;
|
|
63
|
-
g.__tamagui_portal_create = (_mod_default_createPortal1 = mod1 == null || (_mod_default1 = mod1.default) === null || _mod_default1 === void 0 ? void 0 : _mod_default1.createPortal) !== null && _mod_default_createPortal1 !== void 0 ? _mod_default_createPortal1 : mod1.createPortal, (0, import_portalState.setNativePortalState)({
|
|
64
|
-
enabled: !0,
|
|
65
|
-
type: "legacy"
|
|
66
|
-
});
|
|
67
|
-
} catch (err) {
|
|
68
|
-
console.info("Note: error importing native portal, native portals disabled", err);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
setup();
|
|
73
|
-
var setupNativePortal = setup;
|
|
74
|
-
//# sourceMappingURL=setup-portal.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","setup_portal_exports","__export","setupNativePortal","module","exports","import_portalState","require","_global__IS_FABRIC","IS_FABRIC","global","_IS_FABRIC","nativeFabricUIManager","setup","g","globalThis","__tamagui_native_portal_setup","teleport","Portal","PortalHost","PortalProvider","__tamagui_teleport","setNativePortalState","enabled","type","_mod_default","_mod_default_createPortal","__tamagui_portal_create","default","createPortal","err","console","info","_mod_default1","mod1","_mod_default_createPortal1"],"sources":["../../src/setup-portal.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,oBAAA;AAAAC,QAAA,CAAAD,oBAAA;EAAAE,iBAAA,EAAAA,CAAA,KAAAA;AAAA;AAcAC,MAAA,CAAAC,OAAA,GAAAT,YAAqC,CAAAK,oBAAA;AAErC,IAAAK,kBACE,GAAOC,OAAA,0BACE;EAAeC,kBAAe;EAAAC,SAAe,UAAAC,MAAA,cAAAF,kBAAA,GAAAE,MAAA,CAAAC,UAAA,cAAAH,kBAAA,cAAAA,kBAAA,GAAAE,MAAA,CAAAE,qBAAA;AAExD,SAASC,MAAA,EAAQ;EACf,IAAAC,CAAA,GAAMC,UAAI;EACV,IAAI,CAAAD,CAAA,CAAEE,6BAAA,EACN;IAAAF,CAAA,CAAEE,6BAAA,GAAgC;IAGlC,IAAI;MACF,IAAAC,QAAM,GAAAV,OAAW,wBAAQ;MACzB,IAAIU,QAAA,EAAUC,MAAA,IAAUD,QAAA,EAAUE,UAAA,IAAcF,QAAA,EAAUG,cAAA,EAAgB;QACxEN,CAAA,CAAEO,kBAAA,GAAqBJ,QAAA,MACvBX,kBAAA,CAAAgB,oBAAA,EAAqB;UACrBC,OAAA;UACFC,IAAA;QACF;QAEA;MAGA;IACE,QAAI,CACF;IACA,IAAAf,SAAE;MAEJ;QACE,IAAAgB,YAAa;UAAA5B,GAAA,GAAAU,OAAA,oDAAmE;UAAAmB,yBAAA;QAClFZ,CAAA,CAAAa,uBAAA,IAAAD,yBAAA,GAAA7B,GAAA,aAAA4B,YAAA,GAAA5B,GAAA,CAAA+B,OAAA,cAAAH,YAAA,uBAAAA,YAAA,CAAAI,YAAA,cAAAH,yBAAA,cAAAA,yBAAA,GAAA7B,GAAA,CAAAgC,YAAA,MAAAvB,kBAAA,CAAAgB,oBAAA;UACAC,OAAA;UACFC,IAAA;QAEI;MACF,SAAMM,GAAM;QACVC,OAAA,CAAAC,IAAA,+DAA4D,EAAAF,GAC9D;MACF;MACE;IACF;IAAA;MACF,IAAAG,aAAA;QAAAC,IAAA,GAAA3B,OAAA;QAAA4B,0BAAA;MAGMrB,CAAA,CAAAa,uBAAA,IAAAQ,0BAAA,GAAAD,IAAA,aAAAD,aAAA,GAAAC,IAAA,CAAAN,OAAA,cAAAK,aAAA,uBAAAA,aAAA,CAAAJ,YAAA,cAAAM,0BAAA,cAAAA,0BAAA,GAAAD,IAAA,CAAAL,YAAA,MAAAvB,kBAAA,CAAAgB,oBAAA;QAGOC,OAAA","ignoreList":[]}
|