@tamagui/core 1.126.15 → 1.126.16
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 +5 -1
- package/dist/cjs/hooks/useElementLayout.js +4 -1
- package/dist/cjs/hooks/useElementLayout.js.map +1 -1
- package/dist/cjs/hooks/useElementLayout.native.js +7 -2
- package/dist/cjs/hooks/useElementLayout.native.js.map +2 -2
- package/dist/esm/hooks/useElementLayout.js +4 -1
- package/dist/esm/hooks/useElementLayout.js.map +1 -1
- package/dist/esm/hooks/useElementLayout.mjs +5 -1
- package/dist/esm/hooks/useElementLayout.mjs.map +1 -1
- package/dist/esm/hooks/useElementLayout.native.js +11 -2
- package/dist/esm/hooks/useElementLayout.native.js.map +1 -1
- package/dist/native.js +8 -3
- package/dist/native.js.map +2 -2
- package/dist/test.native.js +8 -3
- package/dist/test.native.js.map +2 -2
- package/package.json +7 -7
- package/src/hooks/useElementLayout.tsx +16 -1
- package/types/hooks/useElementLayout.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.16",
|
|
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.16",
|
|
39
|
+
"@tamagui/react-native-use-pressable": "1.126.16",
|
|
40
|
+
"@tamagui/react-native-use-responder-events": "1.126.16",
|
|
41
|
+
"@tamagui/use-event": "1.126.16",
|
|
42
|
+
"@tamagui/web": "1.126.16"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@tamagui/build": "1.126.
|
|
45
|
+
"@tamagui/build": "1.126.16",
|
|
46
46
|
"@testing-library/react": "^16.1.0",
|
|
47
47
|
"csstype": "^3.0.10",
|
|
48
48
|
"typescript": "^5.8.2",
|
|
@@ -44,6 +44,10 @@ if (isClient) {
|
|
|
44
44
|
let avoidUpdates = true
|
|
45
45
|
const queuedUpdates = new Map<HTMLElement, Function>()
|
|
46
46
|
|
|
47
|
+
// track frame timing to detect sync work and avoid updates during heavy periods
|
|
48
|
+
let lastFrameAt = Date.now()
|
|
49
|
+
const numDroppedFramesUntilPause = 2 // adjust sensitivity
|
|
50
|
+
|
|
47
51
|
___onDidFinishClientRender(() => {
|
|
48
52
|
avoidUpdates = false
|
|
49
53
|
if (queuedUpdates) {
|
|
@@ -85,8 +89,19 @@ if (isClient) {
|
|
|
85
89
|
// note that getBoundingClientRect() does not thrash layout if its after an animation frame
|
|
86
90
|
rAF!(layoutOnAnimationFrame)
|
|
87
91
|
function layoutOnAnimationFrame() {
|
|
92
|
+
const now = Date.now()
|
|
93
|
+
const timeSinceLastFrame = now - lastFrameAt
|
|
94
|
+
lastFrameAt = now
|
|
95
|
+
|
|
88
96
|
if (status !== 'inactive') {
|
|
89
|
-
|
|
97
|
+
// avoid updates if we've been dropping frames (indicates sync work happening)
|
|
98
|
+
const expectedFrameTime = 16.67 // ~60fps
|
|
99
|
+
const hasRecentSyncWork =
|
|
100
|
+
timeSinceLastFrame > expectedFrameTime * numDroppedFramesUntilPause
|
|
101
|
+
|
|
102
|
+
if (!hasRecentSyncWork) {
|
|
103
|
+
Nodes.forEach(updateLayoutIfChanged)
|
|
104
|
+
}
|
|
90
105
|
}
|
|
91
106
|
rAF!(layoutOnAnimationFrame)
|
|
92
107
|
}
|
|
@@ -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,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;
|
|
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,C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