@tamagui/adapt 1.92.1 → 1.93.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/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("Adapt not supported by this component");
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
  },
@@ -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,uBAAiD,+BACjDA,oBAA4B,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
  "names": ["import_constants"]
6
6
  }
@@ -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 not supported by this component");
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,mBAAiD,+BACjDA,oBAA4B,+BAE5B,cAAyB,0BACzB,iBAAqC,6BACrC,eAA4E;;;;;;;;;;;;;;;;;;;;;;;;;;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ptParentContext", "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("Adapt not supported by this component");
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
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/Adapt.tsx"],
4
- "mappings": "AAAA,SAAS,OAAO,iCAAiC;AACjD,SAAS,mBAAmB;AAE5B,SAAS,gBAAgB;AACzB,SAAS,4BAA4B;AACrC,SAAS,eAAe,eAAe,YAAY,SAAS,gBAAgB;AA8CpE;AA5BD,MAAM,qBAAqB,cAA0C,IAAI,GAGnE,gBAAgB,CAAC,UAAe;AAC3C,QAAM,UAAU,WAAW,kBAAkB;AAC7C,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,uCAAuC;AAEzD,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,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AAC,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
  }
@@ -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 not supported by this component");
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
  }, {
@@ -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 not supported by this component");
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;AACjD,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,MAAM,uCAAA;AAElB,SAAOT,8BAAcO,QAAQC,UAAUF,KAAAA;AACzC;AAEAD,cAAcK,qBAAqB;AAE5B,IAAMC,iBAAiB,SAAA,OAAA;MAC5BH,WAAAA,MAAAA,UAIwBL,YAAAA,iBAAAA,SAAe,IAAA,GAAA,CAAA,GAAhCS,OAAiBT,UAAAA,CAAAA,GAAXU,UAAWV,UAAAA,CAAAA,GAElBW,gBAAgBZ,QAAQ,WAAA;QAMnBa,oBAAT,SAA2BT,OAAyB;AAClD,aACE,qBAACF,mBAAmBY,UAAQ;QAACC,OAAOV;kBACjCD,MAAMY;;IAGb,GAXMX,UAA+B;MACnCC;MACAK;IACF;AAUA,WAAOE;EACT,GAAG;IAACP;GAAS;AAEb,SAAO;IACLM;IACAF;EACF;AACF,GAEaO,QAAQrB,qBACnB,SAAe,OAAwC;MAAtCsB,WAAF,MAAEA,UAAUR,OAAZ,MAAYA,MAAMM,WAAlB,MAAkBA,UACzBX,UAAUN,WAAWG,kBAAAA,GACrBiB,QAAQxB,SAAAA,GAEVyB,UAAU,CAACF;AAcf,SAbIA,aAAa,YAASE,UAAU1B,cAChCwB,aAAa,aAAUE,UAAU,CAAC5B,QAClC0B,aAAa,UAAOE,UAAU5B,QAE9BkB,QAAQ,CAACS,MAAMT,IAAAA,MACjBU,UAAU,KAGZ3B,0BAA0B,WAAA;AACxB,IAAK2B,YACLf,WAAAA,QAAAA,QAASM,QAASD,QAAQU,OAAAA;EAC5B,GAAG;IAACV;IAAML;IAASe;GAAQ,GAEtBA,UAIEJ,WAHE;AAIX,GACA;EACEV,UAAUH;AACZ,CAAA;",
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.92.1",
3
+ "version": "1.93.1",
4
4
  "types": "./types/index.d.ts",
5
5
  "main": "dist/cjs",
6
6
  "module": "dist/esm",
@@ -21,18 +21,18 @@
21
21
  "./package.json": "./package.json",
22
22
  ".": {
23
23
  "types": "./types/index.d.ts",
24
- "import": "./dist/esm/index.js",
24
+ "import": "./dist/esm/index.mjs",
25
25
  "require": "./dist/cjs/index.js",
26
26
  "react-native": "./dist/cjs/index.native.js"
27
27
  }
28
28
  },
29
29
  "dependencies": {
30
- "@tamagui/constants": "1.92.1",
31
- "@tamagui/core": "1.92.1",
32
- "@tamagui/helpers": "1.92.1"
30
+ "@tamagui/constants": "1.93.1",
31
+ "@tamagui/core": "1.93.1",
32
+ "@tamagui/helpers": "1.93.1"
33
33
  },
34
34
  "devDependencies": {
35
- "@tamagui/build": "1.92.1"
35
+ "@tamagui/build": "1.93.1"
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('Adapt not supported by this component')
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;
@@ -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;IACrC,QAAQ,CAAC,EAAE,GAAG,CAAA;CACf,CAAA;AAED,KAAK,IAAI,GAAG,mBAAmB,GAAG,OAAO,GAAG,IAAI,CAAA;AAEhD,KAAK,SAAS,GAAG,CAAC,KAAK,EAA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