@tamagui/adapt 1.92.1 → 1.93.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/Adapt.js +4 -2
- package/dist/cjs/Adapt.js.map +1 -1
- package/dist/cjs/Adapt.native.js +2 -2
- package/dist/cjs/Adapt.native.js.map +2 -2
- package/dist/esm/Adapt.js +5 -3
- package/dist/esm/Adapt.js.map +1 -1
- package/dist/esm/Adapt.mjs +3 -3
- package/dist/esm/Adapt.native.js +3 -3
- package/dist/esm/Adapt.native.js.map +2 -2
- package/package.json +5 -5
- package/src/Adapt.tsx +9 -3
- package/types/Adapt.d.ts +1 -1
- package/types/Adapt.d.ts.map +1 -1
package/dist/cjs/Adapt.js
CHANGED
|
@@ -24,7 +24,9 @@ var import_constants = require("@tamagui/constants"), import_constants2 = requir
|
|
|
24
24
|
const AdaptParentContext = (0, import_react.createContext)(null), AdaptContents = (props) => {
|
|
25
25
|
const context = (0, import_react.useContext)(AdaptParentContext);
|
|
26
26
|
if (!context?.Contents)
|
|
27
|
-
throw new Error(
|
|
27
|
+
throw new Error(
|
|
28
|
+
process.env.NODE_ENV === "production" ? "tamagui.dev/docs/intro/errors#warning-002" : "You're rendering a Tamagui <Adapt /> component without nesting it inside a parent that is able to adapt."
|
|
29
|
+
);
|
|
28
30
|
return (0, import_react.createElement)(context.Contents, props);
|
|
29
31
|
};
|
|
30
32
|
AdaptContents.shouldForwardSpace = !0;
|
|
@@ -49,7 +51,7 @@ const useAdaptParent = ({
|
|
|
49
51
|
function({ platform, when, children }) {
|
|
50
52
|
const context = (0, import_react.useContext)(AdaptParentContext), media = (0, import_core.useMedia)();
|
|
51
53
|
let enabled = !platform;
|
|
52
|
-
return platform === "touch" && (enabled = import_constants2.isTouchable), platform === "native" && (enabled = !import_constants.isWeb), platform === "web" && (enabled = import_constants.isWeb), when && !media[when] && (enabled = !1), (0, import_constants.useIsomorphicLayoutEffect)(() => {
|
|
54
|
+
return platform === "touch" && (enabled = import_constants2.isTouchable), platform === "native" && (enabled = !import_constants.isWeb), platform === "web" && (enabled = import_constants.isWeb), platform === "ios" && (enabled = import_constants.isIos), platform === "android" && (enabled = import_constants.isAndroid), when && !media[when] && (enabled = !1), (0, import_constants.useIsomorphicLayoutEffect)(() => {
|
|
53
55
|
enabled && context?.setWhen(when || enabled);
|
|
54
56
|
}, [when, context, enabled]), enabled ? children : null;
|
|
55
57
|
},
|
package/dist/cjs/Adapt.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Adapt.tsx"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAmE,+BACnEA,oBAA4B,+BAE5B,cAAyB,0BACzB,iBAAqC,6BACrC,eAA4E,kBAkDpE;AAhCD,MAAM,yBAAqB,4BAA0C,IAAI,GAGnE,gBAAgB,CAAC,UAAe;AAC3C,QAAM,cAAU,yBAAW,kBAAkB;AAC7C,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI;AAAA,MACR,QAAQ,IAAI,aAAa,eACrB,8CACA;AAAA,IACN;AAEF,aAAO,4BAAc,QAAQ,UAAU,KAAK;AAC9C;AAEA,cAAc,qBAAqB;AAE5B,MAAM,iBAAiB,CAAC;AAAA,EAC7B;AACF,MAEM;AACJ,QAAM,CAAC,MAAM,OAAO,QAAI,uBAAe,IAAI;AAmB3C,SAAO;AAAA,IACL,mBAlBoB,sBAAQ,MAAM;AAClC,YAAM,UAA+B;AAAA,QACnC;AAAA,QACA;AAAA,MACF;AAEA,eAAS,kBAAkB,OAA2B;AACpD,eACE,4CAAC,mBAAmB,UAAnB,EAA4B,OAAO,SACjC,gBAAM,UACT;AAAA,MAEJ;AAEA,aAAO;AAAA,IACT,GAAG,CAAC,QAAQ,CAAC;AAAA,IAIX;AAAA,EACF;AACF,GAEa,YAAQ;AAAA,EACnB,SAAe,EAAE,UAAU,MAAM,SAAS,GAAe;AACvD,UAAM,cAAU,yBAAW,kBAAkB,GACvC,YAAQ,sBAAS;AAEvB,QAAI,UAAU,CAAC;AAgBf,WAfI,aAAa,YAAS,UAAU,gCAChC,aAAa,aAAU,UAAU,CAAC,yBAClC,aAAa,UAAO,UAAU,yBAC9B,aAAa,UAAO,UAAU,yBAC9B,aAAa,cAAW,UAAU,6BAElC,QAAQ,CAAC,MAAM,IAAI,MACrB,UAAU,SAGZ,4CAA0B,MAAM;AAC9B,MAAK,WACL,SAAS,QAAS,QAAQ,OAAgB;AAAA,IAC5C,GAAG,CAAC,MAAM,SAAS,OAAO,CAAC,GAEtB,UAIE,WAHE;AAAA,EAIX;AAAA,EACA;AAAA,IACE,UAAU;AAAA,EACZ;AACF;",
|
|
5
5
|
"names": ["import_constants"]
|
|
6
6
|
}
|
package/dist/cjs/Adapt.native.js
CHANGED
|
@@ -72,7 +72,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
72
72
|
var AdaptParentContext = /* @__PURE__ */ (0, import_react.createContext)(null), AdaptContents = function(props) {
|
|
73
73
|
var context = (0, import_react.useContext)(AdaptParentContext);
|
|
74
74
|
if (!(context != null && context.Contents))
|
|
75
|
-
throw new Error("Adapt
|
|
75
|
+
throw new Error(process.env.NODE_ENV === "production" ? "tamagui.dev/docs/intro/errors#warning-002" : "You're rendering a Tamagui <Adapt /> component without nesting it inside a parent that is able to adapt.");
|
|
76
76
|
return /* @__PURE__ */ (0, import_react.createElement)(context.Contents, props);
|
|
77
77
|
};
|
|
78
78
|
AdaptContents.shouldForwardSpace = !0;
|
|
@@ -97,7 +97,7 @@ var useAdaptParent = function(param) {
|
|
|
97
97
|
};
|
|
98
98
|
}, Adapt = (0, import_helpers.withStaticProperties)(function(param) {
|
|
99
99
|
var platform = param.platform, when = param.when, children = param.children, context = (0, import_react.useContext)(AdaptParentContext), media = (0, import_core.useMedia)(), enabled = !platform;
|
|
100
|
-
return platform === "touch" && (enabled = import_constants2.isTouchable), platform === "native" && (enabled = !import_constants.isWeb), platform === "web" && (enabled = import_constants.isWeb), when && !media[when] && (enabled = !1), (0, import_constants.useIsomorphicLayoutEffect)(function() {
|
|
100
|
+
return platform === "touch" && (enabled = import_constants2.isTouchable), platform === "native" && (enabled = !import_constants.isWeb), platform === "web" && (enabled = import_constants.isWeb), platform === "ios" && (enabled = import_constants.isIos), platform === "android" && (enabled = import_constants.isAndroid), when && !media[when] && (enabled = !1), (0, import_constants.useIsomorphicLayoutEffect)(function() {
|
|
101
101
|
enabled && (context == null || context.setWhen(when || enabled));
|
|
102
102
|
}, [
|
|
103
103
|
when,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Users/n8/tamagui/packages/adapt/src/Adapt.tsx"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;uDAAA,
|
|
5
|
-
"names": ["import_constants", "AdaptParentContext", "createContext", "AdaptContents", "props", "context", "useContext", "Contents", "Error", "createElement", "shouldForwardSpace", "useAdaptParent", "useState", "when", "setWhen", "AdaptProvider", "useMemo", "AdaptProviderView", "_jsx", "Provider", "value", "children", "Adapt", "withStaticProperties", "platform", "media", "useMedia", "enabled", "isTouchable", "isWeb", "useIsomorphicLayoutEffect"]
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;uDAAA,mBAAmE,+BACnEA,oBAA4B,+BAE5B,cAAyB,0BACzB,iBAAqC,6BACrC,eAA4E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBrE,IAAMC,qBAAqBC,gDAA0C,IAAA,GAG/DC,gBAAgB,SAACC,OAAAA;AAC5B,MAAMC,cAAUC,yBAAWL,kBAAAA;AAC3B,MAAI,EAACI,WAAAA,QAAAA,QAASE;AACZ,UAAM,IAAIC,MACRC,QAAQC,IAAIC,aAAa,eACpB,8CACA,0GAAA;AAGT,SAAOC,gDAAcP,QAAQE,UAAUH,KAAAA;AACzC;AAEAD,cAAcU,qBAAqB;AAE5B,IAAMC,iBAAiB,SAAA,OAAA;MAC5BP,WAAAA,MAAAA,UAIwBQ,YAAAA,qBAAAA,uBAAe,IAAA,GAAA,CAAA,GAAhCC,OAAiBD,UAAAA,CAAAA,GAAXE,UAAWF,UAAAA,CAAAA,GAElBG,oBAAgBC,sBAAQ,WAAA;QAMnBC,oBAAT,SAA2BhB,OAAyB;AAClD,aACE,uCAAAiB,KAACpB,mBAAmBqB,UAAQ;QAACC,OAAOlB;kBACjCD,MAAMoB;;IAGb,GAXMnB,UAA+B;MACnCE;MACAU;IACF;AAUA,WAAOG;EACT,GAAG;IAACb;GAAS;AAEb,SAAO;IACLW;IACAF;EACF;AACF,GAEaS,YAAQC,qCACnB,SAAe,OAAwC;MAAtCC,WAAF,MAAEA,UAAUX,OAAZ,MAAYA,MAAMQ,WAAlB,MAAkBA,UACzBnB,cAAUC,yBAAWL,kBAAAA,GACrB2B,YAAQC,sBAAAA,GAEVC,UAAU,CAACH;AAgBf,SAfIA,aAAa,YAASG,UAAUC,gCAChCJ,aAAa,aAAUG,UAAU,CAACE,yBAClCL,aAAa,UAAOG,UAAUE,yBAC9BL,aAAa,UAAOG,UAAUG,yBAC9BN,aAAa,cAAWG,UAAUI,6BAElClB,QAAQ,CAACY,MAAMZ,IAAAA,MACjBc,UAAU,SAGZK,4CAA0B,WAAA;AACxB,IAAKL,YACLzB,WAAAA,QAAAA,QAASY,QAASD,QAAQc,OAAAA;EAC5B,GAAG;IAACd;IAAMX;IAASyB;GAAQ,GAEtBA,UAIEN,WAHE;AAIX,GACA;EACEjB,UAAUJ;AACZ,CAAA;",
|
|
5
|
+
"names": ["import_constants", "AdaptParentContext", "createContext", "AdaptContents", "props", "context", "useContext", "Contents", "Error", "process", "env", "NODE_ENV", "createElement", "shouldForwardSpace", "useAdaptParent", "useState", "when", "setWhen", "AdaptProvider", "useMemo", "AdaptProviderView", "_jsx", "Provider", "value", "children", "Adapt", "withStaticProperties", "platform", "media", "useMedia", "enabled", "isTouchable", "isWeb", "isIos", "isAndroid", "useIsomorphicLayoutEffect"]
|
|
6
6
|
}
|
package/dist/esm/Adapt.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isWeb, useIsomorphicLayoutEffect } from "@tamagui/constants";
|
|
1
|
+
import { isAndroid, isIos, isWeb, useIsomorphicLayoutEffect } from "@tamagui/constants";
|
|
2
2
|
import { isTouchable } from "@tamagui/constants";
|
|
3
3
|
import { useMedia } from "@tamagui/core";
|
|
4
4
|
import { withStaticProperties } from "@tamagui/helpers";
|
|
@@ -7,7 +7,9 @@ import { jsx } from "react/jsx-runtime";
|
|
|
7
7
|
const AdaptParentContext = createContext(null), AdaptContents = (props) => {
|
|
8
8
|
const context = useContext(AdaptParentContext);
|
|
9
9
|
if (!context?.Contents)
|
|
10
|
-
throw new Error(
|
|
10
|
+
throw new Error(
|
|
11
|
+
process.env.NODE_ENV === "production" ? "tamagui.dev/docs/intro/errors#warning-002" : "You're rendering a Tamagui <Adapt /> component without nesting it inside a parent that is able to adapt."
|
|
12
|
+
);
|
|
11
13
|
return createElement(context.Contents, props);
|
|
12
14
|
};
|
|
13
15
|
AdaptContents.shouldForwardSpace = !0;
|
|
@@ -32,7 +34,7 @@ const useAdaptParent = ({
|
|
|
32
34
|
function({ platform, when, children }) {
|
|
33
35
|
const context = useContext(AdaptParentContext), media = useMedia();
|
|
34
36
|
let enabled = !platform;
|
|
35
|
-
return platform === "touch" && (enabled = isTouchable), platform === "native" && (enabled = !isWeb), platform === "web" && (enabled = isWeb), when && !media[when] && (enabled = !1), useIsomorphicLayoutEffect(() => {
|
|
37
|
+
return platform === "touch" && (enabled = isTouchable), platform === "native" && (enabled = !isWeb), platform === "web" && (enabled = isWeb), platform === "ios" && (enabled = isIos), platform === "android" && (enabled = isAndroid), when && !media[when] && (enabled = !1), useIsomorphicLayoutEffect(() => {
|
|
36
38
|
enabled && context?.setWhen(when || enabled);
|
|
37
39
|
}, [when, context, enabled]), enabled ? children : null;
|
|
38
40
|
},
|
package/dist/esm/Adapt.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Adapt.tsx"],
|
|
4
|
-
"mappings": "AAAA,SAAS,OAAO,iCAAiC;
|
|
4
|
+
"mappings": "AAAA,SAAS,WAAW,OAAO,OAAO,iCAAiC;AACnE,SAAS,mBAAmB;AAE5B,SAAS,gBAAgB;AACzB,SAAS,4BAA4B;AACrC,SAAS,eAAe,eAAe,YAAY,SAAS,gBAAgB;AAkDpE;AAhCD,MAAM,qBAAqB,cAA0C,IAAI,GAGnE,gBAAgB,CAAC,UAAe;AAC3C,QAAM,UAAU,WAAW,kBAAkB;AAC7C,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI;AAAA,MACR,QAAQ,IAAI,aAAa,eACrB,8CACA;AAAA,IACN;AAEF,SAAO,cAAc,QAAQ,UAAU,KAAK;AAC9C;AAEA,cAAc,qBAAqB;AAE5B,MAAM,iBAAiB,CAAC;AAAA,EAC7B;AACF,MAEM;AACJ,QAAM,CAAC,MAAM,OAAO,IAAI,SAAe,IAAI;AAmB3C,SAAO;AAAA,IACL,eAlBoB,QAAQ,MAAM;AAClC,YAAM,UAA+B;AAAA,QACnC;AAAA,QACA;AAAA,MACF;AAEA,eAAS,kBAAkB,OAA2B;AACpD,eACE,oBAAC,mBAAmB,UAAnB,EAA4B,OAAO,SACjC,gBAAM,UACT;AAAA,MAEJ;AAEA,aAAO;AAAA,IACT,GAAG,CAAC,QAAQ,CAAC;AAAA,IAIX;AAAA,EACF;AACF,GAEa,QAAQ;AAAA,EACnB,SAAe,EAAE,UAAU,MAAM,SAAS,GAAe;AACvD,UAAM,UAAU,WAAW,kBAAkB,GACvC,QAAQ,SAAS;AAEvB,QAAI,UAAU,CAAC;AAgBf,WAfI,aAAa,YAAS,UAAU,cAChC,aAAa,aAAU,UAAU,CAAC,QAClC,aAAa,UAAO,UAAU,QAC9B,aAAa,UAAO,UAAU,QAC9B,aAAa,cAAW,UAAU,YAElC,QAAQ,CAAC,MAAM,IAAI,MACrB,UAAU,KAGZ,0BAA0B,MAAM;AAC9B,MAAK,WACL,SAAS,QAAS,QAAQ,OAAgB;AAAA,IAC5C,GAAG,CAAC,MAAM,SAAS,OAAO,CAAC,GAEtB,UAIE,WAHE;AAAA,EAIX;AAAA,EACA;AAAA,IACE,UAAU;AAAA,EACZ;AACF;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/esm/Adapt.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isWeb, useIsomorphicLayoutEffect } from "@tamagui/constants";
|
|
1
|
+
import { isAndroid, isIos, isWeb, useIsomorphicLayoutEffect } from "@tamagui/constants";
|
|
2
2
|
import { isTouchable } from "@tamagui/constants";
|
|
3
3
|
import { useMedia } from "@tamagui/core";
|
|
4
4
|
import { withStaticProperties } from "@tamagui/helpers";
|
|
@@ -7,7 +7,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
7
7
|
const AdaptParentContext = createContext(null),
|
|
8
8
|
AdaptContents = props => {
|
|
9
9
|
const context = useContext(AdaptParentContext);
|
|
10
|
-
if (!context?.Contents) throw new Error("Adapt
|
|
10
|
+
if (!context?.Contents) throw new Error(process.env.NODE_ENV === "production" ? "tamagui.dev/docs/intro/errors#warning-002" : "You're rendering a Tamagui <Adapt /> component without nesting it inside a parent that is able to adapt.");
|
|
11
11
|
return createElement(context.Contents, props);
|
|
12
12
|
};
|
|
13
13
|
AdaptContents.shouldForwardSpace = !0;
|
|
@@ -40,7 +40,7 @@ const useAdaptParent = ({
|
|
|
40
40
|
const context = useContext(AdaptParentContext),
|
|
41
41
|
media = useMedia();
|
|
42
42
|
let enabled = !platform;
|
|
43
|
-
return platform === "touch" && (enabled = isTouchable), platform === "native" && (enabled = !isWeb), platform === "web" && (enabled = isWeb), when && !media[when] && (enabled = !1), useIsomorphicLayoutEffect(() => {
|
|
43
|
+
return platform === "touch" && (enabled = isTouchable), platform === "native" && (enabled = !isWeb), platform === "web" && (enabled = isWeb), platform === "ios" && (enabled = isIos), platform === "android" && (enabled = isAndroid), when && !media[when] && (enabled = !1), useIsomorphicLayoutEffect(() => {
|
|
44
44
|
enabled && context?.setWhen(when || enabled);
|
|
45
45
|
}, [when, context, enabled]), enabled ? children : null;
|
|
46
46
|
}, {
|
package/dist/esm/Adapt.native.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { isWeb, useIsomorphicLayoutEffect } from "@tamagui/constants";
|
|
2
|
+
import { isAndroid, isIos, isWeb, useIsomorphicLayoutEffect } from "@tamagui/constants";
|
|
3
3
|
import { isTouchable } from "@tamagui/constants";
|
|
4
4
|
import { useMedia } from "@tamagui/core";
|
|
5
5
|
import { withStaticProperties } from "@tamagui/helpers";
|
|
@@ -54,7 +54,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
54
54
|
var AdaptParentContext = /* @__PURE__ */ createContext(null), AdaptContents = function(props) {
|
|
55
55
|
var context = useContext(AdaptParentContext);
|
|
56
56
|
if (!(context != null && context.Contents))
|
|
57
|
-
throw new Error("Adapt
|
|
57
|
+
throw new Error(process.env.NODE_ENV === "production" ? "tamagui.dev/docs/intro/errors#warning-002" : "You're rendering a Tamagui <Adapt /> component without nesting it inside a parent that is able to adapt.");
|
|
58
58
|
return /* @__PURE__ */ createElement(context.Contents, props);
|
|
59
59
|
};
|
|
60
60
|
AdaptContents.shouldForwardSpace = !0;
|
|
@@ -79,7 +79,7 @@ var useAdaptParent = function(param) {
|
|
|
79
79
|
};
|
|
80
80
|
}, Adapt = withStaticProperties(function(param) {
|
|
81
81
|
var platform = param.platform, when = param.when, children = param.children, context = useContext(AdaptParentContext), media = useMedia(), enabled = !platform;
|
|
82
|
-
return platform === "touch" && (enabled = isTouchable), platform === "native" && (enabled = !isWeb), platform === "web" && (enabled = isWeb), when && !media[when] && (enabled = !1), useIsomorphicLayoutEffect(function() {
|
|
82
|
+
return platform === "touch" && (enabled = isTouchable), platform === "native" && (enabled = !isWeb), platform === "web" && (enabled = isWeb), platform === "ios" && (enabled = isIos), platform === "android" && (enabled = isAndroid), when && !media[when] && (enabled = !1), useIsomorphicLayoutEffect(function() {
|
|
83
83
|
enabled && (context == null || context.setWhen(when || enabled));
|
|
84
84
|
}, [
|
|
85
85
|
when,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Users/n8/tamagui/packages/adapt/src/Adapt.tsx"],
|
|
4
|
-
"mappings": ";AAAA,SAASA,OAAOC,iCAAiC;
|
|
5
|
-
"names": ["isWeb", "useIsomorphicLayoutEffect", "isTouchable", "useMedia", "withStaticProperties", "createContext", "createElement", "useContext", "useMemo", "useState", "AdaptParentContext", "AdaptContents", "props", "context", "Contents", "Error", "shouldForwardSpace", "useAdaptParent", "when", "setWhen", "AdaptProvider", "AdaptProviderView", "Provider", "value", "children", "Adapt", "platform", "media", "enabled"]
|
|
4
|
+
"mappings": ";AAAA,SAASA,WAAWC,OAAOC,OAAOC,iCAAiC;AACnE,SAASC,mBAAmB;AAE5B,SAASC,gBAAgB;AACzB,SAASC,4BAA4B;AACrC,SAASC,eAAeC,eAAeC,YAAYC,SAASC,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBrE,IAAMC,qBAAqBL,8BAA0C,IAAA,GAG/DM,gBAAgB,SAACC,OAAAA;AAC5B,MAAMC,UAAUN,WAAWG,kBAAAA;AAC3B,MAAI,EAACG,WAAAA,QAAAA,QAASC;AACZ,UAAM,IAAIC,MACRC,QAAQC,IAAIC,aAAa,eACpB,8CACA,0GAAA;AAGT,SAAOZ,8BAAcO,QAAQC,UAAUF,KAAAA;AACzC;AAEAD,cAAcQ,qBAAqB;AAE5B,IAAMC,iBAAiB,SAAA,OAAA;MAC5BN,WAAAA,MAAAA,UAIwBL,YAAAA,iBAAAA,SAAe,IAAA,GAAA,CAAA,GAAhCY,OAAiBZ,UAAAA,CAAAA,GAAXa,UAAWb,UAAAA,CAAAA,GAElBc,gBAAgBf,QAAQ,WAAA;QAMnBgB,oBAAT,SAA2BZ,OAAyB;AAClD,aACE,qBAACF,mBAAmBe,UAAQ;QAACC,OAAOb;kBACjCD,MAAMe;;IAGb,GAXMd,UAA+B;MACnCC;MACAQ;IACF;AAUA,WAAOE;EACT,GAAG;IAACV;GAAS;AAEb,SAAO;IACLS;IACAF;EACF;AACF,GAEaO,QAAQxB,qBACnB,SAAe,OAAwC;MAAtCyB,WAAF,MAAEA,UAAUR,OAAZ,MAAYA,MAAMM,WAAlB,MAAkBA,UACzBd,UAAUN,WAAWG,kBAAAA,GACrBoB,QAAQ3B,SAAAA,GAEV4B,UAAU,CAACF;AAgBf,SAfIA,aAAa,YAASE,UAAU7B,cAChC2B,aAAa,aAAUE,UAAU,CAAC/B,QAClC6B,aAAa,UAAOE,UAAU/B,QAC9B6B,aAAa,UAAOE,UAAUhC,QAC9B8B,aAAa,cAAWE,UAAUjC,YAElCuB,QAAQ,CAACS,MAAMT,IAAAA,MACjBU,UAAU,KAGZ9B,0BAA0B,WAAA;AACxB,IAAK8B,YACLlB,WAAAA,QAAAA,QAASS,QAASD,QAAQU,OAAAA;EAC5B,GAAG;IAACV;IAAMR;IAASkB;GAAQ,GAEtBA,UAIEJ,WAHE;AAIX,GACA;EACEb,UAAUH;AACZ,CAAA;",
|
|
5
|
+
"names": ["isAndroid", "isIos", "isWeb", "useIsomorphicLayoutEffect", "isTouchable", "useMedia", "withStaticProperties", "createContext", "createElement", "useContext", "useMemo", "useState", "AdaptParentContext", "AdaptContents", "props", "context", "Contents", "Error", "process", "env", "NODE_ENV", "shouldForwardSpace", "useAdaptParent", "when", "setWhen", "AdaptProvider", "AdaptProviderView", "Provider", "value", "children", "Adapt", "platform", "media", "enabled"]
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/adapt",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.93.0",
|
|
4
4
|
"types": "./types/index.d.ts",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@tamagui/constants": "1.
|
|
31
|
-
"@tamagui/core": "1.
|
|
32
|
-
"@tamagui/helpers": "1.
|
|
30
|
+
"@tamagui/constants": "1.93.0",
|
|
31
|
+
"@tamagui/core": "1.93.0",
|
|
32
|
+
"@tamagui/helpers": "1.93.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@tamagui/build": "1.
|
|
35
|
+
"@tamagui/build": "1.93.0"
|
|
36
36
|
},
|
|
37
37
|
"publishConfig": {
|
|
38
38
|
"access": "public"
|
package/src/Adapt.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isWeb, useIsomorphicLayoutEffect } from '@tamagui/constants'
|
|
1
|
+
import { isAndroid, isIos, isWeb, useIsomorphicLayoutEffect } from '@tamagui/constants'
|
|
2
2
|
import { isTouchable } from '@tamagui/constants'
|
|
3
3
|
import type { MediaQueryKey } from '@tamagui/core'
|
|
4
4
|
import { useMedia } from '@tamagui/core'
|
|
@@ -9,7 +9,7 @@ type MediaQueryKeyString = MediaQueryKey extends string ? MediaQueryKey : never
|
|
|
9
9
|
|
|
10
10
|
export type AdaptProps = {
|
|
11
11
|
when?: MediaQueryKeyString
|
|
12
|
-
platform?: 'native' | 'web' | 'touch'
|
|
12
|
+
platform?: 'native' | 'web' | 'touch' | 'ios' | 'android'
|
|
13
13
|
children?: any
|
|
14
14
|
}
|
|
15
15
|
|
|
@@ -27,7 +27,11 @@ export const AdaptParentContext = createContext<AdaptParentContextI | null>(null
|
|
|
27
27
|
export const AdaptContents = (props: any) => {
|
|
28
28
|
const context = useContext(AdaptParentContext)
|
|
29
29
|
if (!context?.Contents) {
|
|
30
|
-
throw new Error(
|
|
30
|
+
throw new Error(
|
|
31
|
+
process.env.NODE_ENV === 'production'
|
|
32
|
+
? `tamagui.dev/docs/intro/errors#warning-002`
|
|
33
|
+
: `You're rendering a Tamagui <Adapt /> component without nesting it inside a parent that is able to adapt.`
|
|
34
|
+
)
|
|
31
35
|
}
|
|
32
36
|
return createElement(context.Contents, props)
|
|
33
37
|
}
|
|
@@ -73,6 +77,8 @@ export const Adapt = withStaticProperties(
|
|
|
73
77
|
if (platform === 'touch') enabled = isTouchable
|
|
74
78
|
if (platform === 'native') enabled = !isWeb
|
|
75
79
|
if (platform === 'web') enabled = isWeb
|
|
80
|
+
if (platform === 'ios') enabled = isIos
|
|
81
|
+
if (platform === 'android') enabled = isAndroid
|
|
76
82
|
|
|
77
83
|
if (when && !media[when]) {
|
|
78
84
|
enabled = false
|
package/types/Adapt.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { MediaQueryKey } from '@tamagui/core';
|
|
|
3
3
|
type MediaQueryKeyString = MediaQueryKey extends string ? MediaQueryKey : never;
|
|
4
4
|
export type AdaptProps = {
|
|
5
5
|
when?: MediaQueryKeyString;
|
|
6
|
-
platform?: 'native' | 'web' | 'touch';
|
|
6
|
+
platform?: 'native' | 'web' | 'touch' | 'ios' | 'android';
|
|
7
7
|
children?: any;
|
|
8
8
|
};
|
|
9
9
|
type When = MediaQueryKeyString | boolean | null;
|
package/types/Adapt.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Adapt.d.ts","sourceRoot":"","sources":["../src/Adapt.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAKlD,KAAK,mBAAmB,GAAG,aAAa,SAAS,MAAM,GAAG,aAAa,GAAG,KAAK,CAAA;AAE/E,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,CAAC,EAAE,mBAAmB,CAAA;IAC1B,QAAQ,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"Adapt.d.ts","sourceRoot":"","sources":["../src/Adapt.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAKlD,KAAK,mBAAmB,GAAG,aAAa,SAAS,MAAM,GAAG,aAAa,GAAG,KAAK,CAAA;AAE/E,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,CAAC,EAAE,mBAAmB,CAAA;IAC1B,QAAQ,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,OAAO,GAAG,KAAK,GAAG,SAAS,CAAA;IACzD,QAAQ,CAAC,EAAE,GAAG,CAAA;CACf,CAAA;AAED,KAAK,IAAI,GAAG,mBAAmB,GAAG,OAAO,GAAG,IAAI,CAAA;AAEhD,KAAK,SAAS,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAA;AACpC,KAAK,mBAAmB,GAAG;IACzB,QAAQ,EAAE,SAAS,CAAA;IACnB,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,GAAG,CAAA;CAC7B,CAAA;AAED,eAAO,MAAM,kBAAkB,qDAAkD,CAAA;AAGjF,eAAO,MAAM,aAAa;YAAW,GAAG;;CAUvC,CAAA;AAID,eAAO,MAAM,cAAc;cAGf,mBAAmB,CAAC,UAAU,CAAC;;2BAUL;QAAE,QAAQ,CAAC,EAAE,GAAG,CAAA;KAAE;;CAevD,CAAA;AAED,eAAO,MAAM,KAAK,kCAC6B,UAAU;;gBA7CpB,GAAG;;;CA0EvC,CAAA"}
|