@tamagui/core 1.126.14 → 1.126.15
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/hooks/useElementLayout.cjs +8 -3
- package/dist/cjs/hooks/useElementLayout.js +8 -2
- package/dist/cjs/hooks/useElementLayout.js.map +1 -1
- package/dist/cjs/hooks/useElementLayout.native.js +8 -2
- package/dist/cjs/hooks/useElementLayout.native.js.map +2 -2
- package/dist/cjs/index.cjs +3 -2
- package/dist/cjs/index.js +3 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.native.js +4 -2
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/esm/hooks/useElementLayout.js +8 -2
- package/dist/esm/hooks/useElementLayout.js.map +1 -1
- package/dist/esm/hooks/useElementLayout.mjs +8 -4
- package/dist/esm/hooks/useElementLayout.mjs.map +1 -1
- package/dist/esm/hooks/useElementLayout.native.js +7 -3
- package/dist/esm/hooks/useElementLayout.native.js.map +1 -1
- package/dist/esm/index.js +5 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs +3 -3
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +3 -3
- package/dist/esm/index.native.js.map +1 -1
- package/dist/native.js +47 -41
- package/dist/native.js.map +3 -3
- package/dist/test.native.js +47 -41
- package/dist/test.native.js.map +3 -3
- package/package.json +7 -7
- package/src/hooks/useElementLayout.tsx +10 -1
- package/src/index.tsx +2 -1
- package/types/hooks/useElementLayout.d.ts +3 -0
- package/types/hooks/useElementLayout.d.ts.map +1 -1
- package/types/index.d.ts +1 -1
- package/types/index.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/core",
|
|
3
|
-
"version": "1.126.
|
|
3
|
+
"version": "1.126.15",
|
|
4
4
|
"source": "src/index.tsx",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -35,14 +35,14 @@
|
|
|
35
35
|
"native-test.d.ts"
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@tamagui/react-native-media-driver": "1.126.
|
|
39
|
-
"@tamagui/react-native-use-pressable": "1.126.
|
|
40
|
-
"@tamagui/react-native-use-responder-events": "1.126.
|
|
41
|
-
"@tamagui/use-event": "1.126.
|
|
42
|
-
"@tamagui/web": "1.126.
|
|
38
|
+
"@tamagui/react-native-media-driver": "1.126.15",
|
|
39
|
+
"@tamagui/react-native-use-pressable": "1.126.15",
|
|
40
|
+
"@tamagui/react-native-use-responder-events": "1.126.15",
|
|
41
|
+
"@tamagui/use-event": "1.126.15",
|
|
42
|
+
"@tamagui/web": "1.126.15"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@tamagui/build": "1.126.
|
|
45
|
+
"@tamagui/build": "1.126.15",
|
|
46
46
|
"@testing-library/react": "^16.1.0",
|
|
47
47
|
"csstype": "^3.0.10",
|
|
48
48
|
"typescript": "^5.8.2",
|
|
@@ -9,6 +9,13 @@ import type { RefObject } from 'react'
|
|
|
9
9
|
const LayoutHandlers = new WeakMap<HTMLElement, Function>()
|
|
10
10
|
const Nodes = new Set<HTMLElement>()
|
|
11
11
|
|
|
12
|
+
type LayoutMeasurementStatus = 'inactive' | 'active'
|
|
13
|
+
|
|
14
|
+
let status: LayoutMeasurementStatus = 'active'
|
|
15
|
+
export function setOnLayoutStrategy(state: LayoutMeasurementStatus) {
|
|
16
|
+
status = state
|
|
17
|
+
}
|
|
18
|
+
|
|
12
19
|
export type LayoutValue = {
|
|
13
20
|
x: number
|
|
14
21
|
y: number
|
|
@@ -78,7 +85,9 @@ if (isClient) {
|
|
|
78
85
|
// note that getBoundingClientRect() does not thrash layout if its after an animation frame
|
|
79
86
|
rAF!(layoutOnAnimationFrame)
|
|
80
87
|
function layoutOnAnimationFrame() {
|
|
81
|
-
|
|
88
|
+
if (status !== 'inactive') {
|
|
89
|
+
Nodes.forEach(updateLayoutIfChanged)
|
|
90
|
+
}
|
|
82
91
|
rAF!(layoutOnAnimationFrame)
|
|
83
92
|
}
|
|
84
93
|
} else {
|
package/src/index.tsx
CHANGED
|
@@ -21,17 +21,18 @@ import {
|
|
|
21
21
|
} from '@tamagui/web'
|
|
22
22
|
import React from 'react'
|
|
23
23
|
|
|
24
|
+
import { addNativeValidStyles } from './addNativeValidStyles'
|
|
24
25
|
import { createOptimizedView } from './createOptimizedView'
|
|
25
26
|
import { getBaseViews } from './getBaseViews'
|
|
26
27
|
import { getRect } from './helpers/getRect'
|
|
27
28
|
import { measureLayout, useElementLayout } from './hooks/useElementLayout'
|
|
28
29
|
import type { RNTextProps, RNViewProps } from './reactNativeTypes'
|
|
29
30
|
import { usePressability } from './vendor/Pressability'
|
|
30
|
-
import { addNativeValidStyles } from './addNativeValidStyles'
|
|
31
31
|
|
|
32
32
|
// helpful for usage outside of tamagui
|
|
33
33
|
export {
|
|
34
34
|
getElementLayoutEvent,
|
|
35
|
+
setOnLayoutStrategy,
|
|
35
36
|
type LayoutEvent,
|
|
36
37
|
} from './hooks/useElementLayout'
|
|
37
38
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { type TamaguiComponentStateRef } from '@tamagui/web';
|
|
2
2
|
import type { RefObject } from 'react';
|
|
3
|
+
type LayoutMeasurementStatus = 'inactive' | 'active';
|
|
4
|
+
export declare function setOnLayoutStrategy(state: LayoutMeasurementStatus): void;
|
|
3
5
|
export type LayoutValue = {
|
|
4
6
|
x: number;
|
|
5
7
|
y: number;
|
|
@@ -18,4 +20,5 @@ export type LayoutEvent = {
|
|
|
18
20
|
export declare const getElementLayoutEvent: (target: HTMLElement) => LayoutEvent;
|
|
19
21
|
export declare const measureLayout: (node: HTMLElement, relativeTo: HTMLElement | null, callback: (x: number, y: number, width: number, height: number, left: number, top: number) => void) => void;
|
|
20
22
|
export declare function useElementLayout(ref: RefObject<TamaguiComponentStateRef>, onLayout?: ((e: LayoutEvent) => void) | null): void;
|
|
23
|
+
export {};
|
|
21
24
|
//# sourceMappingURL=useElementLayout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useElementLayout.d.ts","sourceRoot":"","sources":["../../src/hooks/useElementLayout.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,wBAAwB,EAE9B,MAAM,cAAc,CAAA;AACrB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAKtC,MAAM,MAAM,WAAW,GAAG;IACxB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,WAAW,EAAE;QACX,MAAM,EAAE,WAAW,CAAA;QACnB,MAAM,EAAE,GAAG,CAAA;KACZ,CAAA;IACD,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;
|
|
1
|
+
{"version":3,"file":"useElementLayout.d.ts","sourceRoot":"","sources":["../../src/hooks/useElementLayout.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,wBAAwB,EAE9B,MAAM,cAAc,CAAA;AACrB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAKtC,KAAK,uBAAuB,GAAG,UAAU,GAAG,QAAQ,CAAA;AAGpD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,uBAAuB,QAEjE;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,WAAW,EAAE;QACX,MAAM,EAAE,WAAW,CAAA;QACnB,MAAM,EAAE,GAAG,CAAA;KACZ,CAAA;IACD,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAoED,eAAO,MAAM,qBAAqB,GAAI,QAAQ,WAAW,KAAG,WAe3D,CAAA;AAGD,eAAO,MAAM,aAAa,GACxB,MAAM,WAAW,EACjB,YAAY,WAAW,GAAG,IAAI,EAC9B,UAAU,CACR,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,KACR,IAAI,SAcV,CAAA;AASD,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,SAAS,CAAC,wBAAwB,CAAC,EACxC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,KAAK,IAAI,CAAC,GAAG,IAAI,QAuB7C"}
|
package/types/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { StackNonStyleProps, StackStyleBase, TamaDefer, TamaguiComponent, TamaguiElement, TamaguiTextElement, TextNonStyleProps, TextProps, TextStylePropsBase } from '@tamagui/web';
|
|
2
2
|
import { createTamagui as createTamaguiWeb } from '@tamagui/web';
|
|
3
3
|
import type { RNTextProps, RNViewProps } from './reactNativeTypes';
|
|
4
|
-
export { getElementLayoutEvent, type LayoutEvent, } from './hooks/useElementLayout';
|
|
4
|
+
export { getElementLayoutEvent, setOnLayoutStrategy, type LayoutEvent, } from './hooks/useElementLayout';
|
|
5
5
|
type RNExclusiveViewProps = Omit<RNViewProps, keyof StackNonStyleProps>;
|
|
6
6
|
export interface RNTamaguiViewNonStyleProps extends StackNonStyleProps, RNExclusiveViewProps {
|
|
7
7
|
}
|
package/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,kBAAkB,EAClB,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,SAAS,EACT,kBAAkB,EACnB,MAAM,cAAc,CAAA;AACrB,OAAO,EAKL,aAAa,IAAI,gBAAgB,EAElC,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,kBAAkB,EAClB,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,SAAS,EACT,kBAAkB,EACnB,MAAM,cAAc,CAAA;AACrB,OAAO,EAKL,aAAa,IAAI,gBAAgB,EAElC,MAAM,cAAc,CAAA;AAQrB,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAIlE,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,KAAK,WAAW,GACjB,MAAM,0BAA0B,CAAA;AAOjC,KAAK,oBAAoB,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,kBAAkB,CAAC,CAAA;AACvE,MAAM,WAAW,0BACf,SAAQ,kBAAkB,EACxB,oBAAoB;CAAG;AAE3B,KAAK,aAAa,GAAG,gBAAgB,CACnC,SAAS,EACT,cAAc,EACd,0BAA0B,EAC1B,cAAc,EACd,EAAE,CACH,CAAA;AAED,KAAK,oBAAoB,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,SAAS,CAAC,CAAA;AAC9D,MAAM,WAAW,0BACf,SAAQ,iBAAiB,EACvB,oBAAoB;CAAG;AAE3B,KAAK,aAAa,GAAG,gBAAgB,CACnC,SAAS,EACT,kBAAkB,EAClB,0BAA0B,EAC1B,kBAAkB,EAClB,EAAE,CACH,CAAA;AAGD,cAAc,cAAc,CAAA;AAG5B,cAAc,oBAAoB,CAAA;AAGlC,eAAO,MAAM,aAAa,EAAE,OAAO,gBAOlC,CAAA;AAmLD,eAAO,MAAM,IAAI,EAAqB,aAAa,CAAA;AACnD,eAAO,MAAM,KAAK,EAAsB,aAAa,CAAA;AACrD,eAAO,MAAM,IAAI,EAAqB,aAAa,CAAA"}
|