@tamagui/core 1.85.12 → 1.86.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/dist/cjs/hooks/usePlatformMethods.js +1 -1
- package/dist/cjs/hooks/usePlatformMethods.js.map +1 -1
- package/dist/cjs/hooks/usePlatformMethods.native.js +1 -1
- package/dist/cjs/hooks/usePlatformMethods.native.js.map +1 -1
- package/dist/cjs/index.js +26 -25
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.native.js +1 -1
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/esm/hooks/usePlatformMethods.js +1 -1
- package/dist/esm/hooks/usePlatformMethods.js.map +1 -1
- package/dist/esm/hooks/usePlatformMethods.native.js +1 -1
- package/dist/esm/hooks/usePlatformMethods.native.js.map +1 -1
- package/dist/esm/index.js +26 -25
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.native.js +1 -1
- package/dist/esm/index.native.js.map +1 -1
- package/dist/native.js +32 -35
- package/dist/native.js.map +1 -1
- package/dist/test.native.js +11 -11
- package/dist/test.native.js.map +1 -1
- package/package.json +6 -6
- package/src/hooks/usePlatformMethods.ts +14 -13
- package/src/index.tsx +4 -6
- package/types/hooks/usePlatformMethods.d.ts.map +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.
|
|
3
|
+
"version": "1.86.0",
|
|
4
4
|
"source": "src/index.tsx",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -35,16 +35,16 @@
|
|
|
35
35
|
"native-test.d.ts"
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@tamagui/react-native-use-pressable": "1.
|
|
39
|
-
"@tamagui/react-native-use-responder-events": "1.
|
|
40
|
-
"@tamagui/use-event": "1.
|
|
41
|
-
"@tamagui/web": "1.
|
|
38
|
+
"@tamagui/react-native-use-pressable": "1.86.0",
|
|
39
|
+
"@tamagui/react-native-use-responder-events": "1.86.0",
|
|
40
|
+
"@tamagui/use-event": "1.86.0",
|
|
41
|
+
"@tamagui/web": "1.86.0"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"react": "*"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@tamagui/build": "1.
|
|
47
|
+
"@tamagui/build": "1.86.0",
|
|
48
48
|
"@testing-library/react": "^14.0.0",
|
|
49
49
|
"csstype": "^3.0.10",
|
|
50
50
|
"react": "^18.2.0",
|
|
@@ -8,19 +8,20 @@ import { measureLayout } from './useElementLayout'
|
|
|
8
8
|
export function usePlatformMethods(hostRef: RefObject<Element>) {
|
|
9
9
|
useIsomorphicLayoutEffect(() => {
|
|
10
10
|
const node = hostRef.current
|
|
11
|
-
if (
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
11
|
+
if (node) {
|
|
12
|
+
// @ts-ignore
|
|
13
|
+
node.measure ||= (callback) => measureLayout(node, null, callback)
|
|
14
|
+
// @ts-ignore
|
|
15
|
+
node.measureLayout ||= (relativeToNode, success) =>
|
|
16
|
+
measureLayout(node as HTMLElement, relativeToNode, success)
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
node.measureInWindow ||= (callback) => {
|
|
19
|
+
if (!node) return
|
|
20
|
+
setTimeout(() => {
|
|
21
|
+
const { height, left, top, width } = getRect(node as HTMLElement)!
|
|
22
|
+
callback(left, top, width, height)
|
|
23
|
+
}, 0)
|
|
24
|
+
}
|
|
24
25
|
}
|
|
25
26
|
}, [hostRef])
|
|
26
27
|
}
|
package/src/index.tsx
CHANGED
|
@@ -55,7 +55,7 @@ const baseViews = getBaseViews()
|
|
|
55
55
|
setupHooks({
|
|
56
56
|
getBaseViews,
|
|
57
57
|
|
|
58
|
-
usePropsTransform(elementType, propsIn,
|
|
58
|
+
usePropsTransform(elementType, propsIn, stateRef, willHydrate) {
|
|
59
59
|
if (process.env.TAMAGUI_TARGET === 'web') {
|
|
60
60
|
const isDOM = typeof elementType === 'string'
|
|
61
61
|
|
|
@@ -95,11 +95,9 @@ setupHooks({
|
|
|
95
95
|
|
|
96
96
|
if (willHydrate || isDOM) {
|
|
97
97
|
// only necessary for DOM elements, but we need the hooks to stay around
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
!isDOM ? undefined : (onLayout as any)
|
|
102
|
-
)
|
|
98
|
+
const hostRef = { current: stateRef.current.host as Element }
|
|
99
|
+
usePlatformMethods(hostRef)
|
|
100
|
+
useElementLayout(hostRef, !isDOM ? undefined : (onLayout as any))
|
|
103
101
|
useResponderEvents(
|
|
104
102
|
hostRef,
|
|
105
103
|
!isDOM
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePlatformMethods.d.ts","sourceRoot":"","sources":["../../src/hooks/usePlatformMethods.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAMjC,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,SAAS,CAAC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"usePlatformMethods.d.ts","sourceRoot":"","sources":["../../src/hooks/usePlatformMethods.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAMjC,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,SAAS,CAAC,OAAO,CAAC,QAmB7D"}
|
package/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,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