@tamagui/adapt 1.26.0 → 1.26.1
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/package.json +3 -3
- package/dist/esm/Adapt.mjs +0 -67
- package/dist/esm/Adapt.mjs.map +0 -6
- package/dist/esm/index.mjs +0 -2
- package/dist/esm/index.mjs.map +0 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/adapt",
|
|
3
|
-
"version": "1.26.
|
|
3
|
+
"version": "1.26.1",
|
|
4
4
|
"types": "./types/index.d.ts",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@tamagui/core": "1.26.
|
|
29
|
+
"@tamagui/core": "1.26.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@tamagui/build": "1.26.
|
|
32
|
+
"@tamagui/build": "1.26.1"
|
|
33
33
|
},
|
|
34
34
|
"publishConfig": {
|
|
35
35
|
"access": "public"
|
package/dist/esm/Adapt.mjs
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
isTouchable,
|
|
4
|
-
isWeb,
|
|
5
|
-
useIsomorphicLayoutEffect,
|
|
6
|
-
withStaticProperties
|
|
7
|
-
} from "@tamagui/core";
|
|
8
|
-
import { createContext, createElement, useContext, useMemo, useState } from "react";
|
|
9
|
-
const AdaptParentContext = createContext(null);
|
|
10
|
-
const AdaptContents = (props) => {
|
|
11
|
-
const context = useContext(AdaptParentContext);
|
|
12
|
-
if (!(context == null ? void 0 : context.Contents)) {
|
|
13
|
-
throw new Error("Adapt not supported by this component");
|
|
14
|
-
}
|
|
15
|
-
return createElement(context.Contents, props);
|
|
16
|
-
};
|
|
17
|
-
AdaptContents.shouldForwardSpace = true;
|
|
18
|
-
const useAdaptParent = ({
|
|
19
|
-
Contents
|
|
20
|
-
}) => {
|
|
21
|
-
const [when, setWhen] = useState(null);
|
|
22
|
-
const AdaptProvider = useMemo(() => {
|
|
23
|
-
const context = {
|
|
24
|
-
Contents,
|
|
25
|
-
setWhen
|
|
26
|
-
};
|
|
27
|
-
function AdaptProviderView(props) {
|
|
28
|
-
return /* @__PURE__ */ jsx(AdaptParentContext.Provider, { value: context, children: props.children });
|
|
29
|
-
}
|
|
30
|
-
return AdaptProviderView;
|
|
31
|
-
}, [Contents]);
|
|
32
|
-
return {
|
|
33
|
-
AdaptProvider,
|
|
34
|
-
when
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
const Adapt = withStaticProperties(
|
|
38
|
-
function Adapt2({ platform, when, children }) {
|
|
39
|
-
const context = useContext(AdaptParentContext);
|
|
40
|
-
let enabled = !platform;
|
|
41
|
-
if (platform === "touch")
|
|
42
|
-
enabled = isTouchable;
|
|
43
|
-
if (platform === "native")
|
|
44
|
-
enabled = !isWeb;
|
|
45
|
-
if (platform === "web")
|
|
46
|
-
enabled = isWeb;
|
|
47
|
-
useIsomorphicLayoutEffect(() => {
|
|
48
|
-
if (!enabled)
|
|
49
|
-
return;
|
|
50
|
-
context == null ? void 0 : context.setWhen(when || enabled);
|
|
51
|
-
}, [when, context, enabled]);
|
|
52
|
-
if (!enabled) {
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
return children;
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
Contents: AdaptContents
|
|
59
|
-
}
|
|
60
|
-
);
|
|
61
|
-
export {
|
|
62
|
-
Adapt,
|
|
63
|
-
AdaptContents,
|
|
64
|
-
AdaptParentContext,
|
|
65
|
-
useAdaptParent
|
|
66
|
-
};
|
|
67
|
-
//# sourceMappingURL=Adapt.mjs.map
|
package/dist/esm/Adapt.mjs.map
DELETED
|
@@ -1,6 +0,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