@tamagui/image 2.7.7 → 3.0.0-beta.643.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.
Files changed (92) hide show
  1. package/dist/cjs/Image.cjs +25 -45
  2. package/dist/cjs/Image.native.cjs +29 -0
  3. package/dist/cjs/Image.native.js +16 -20
  4. package/dist/cjs/Image.native.js.map +1 -1
  5. package/dist/cjs/createImage.cjs +112 -145
  6. package/dist/cjs/createImage.native.cjs +133 -0
  7. package/dist/cjs/createImage.native.js +116 -145
  8. package/dist/cjs/createImage.native.js.map +1 -1
  9. package/dist/cjs/index.cjs +10 -11
  10. package/dist/cjs/index.native.cjs +22 -0
  11. package/dist/cjs/index.native.js +10 -10
  12. package/dist/cjs/index.native.js.map +1 -1
  13. package/dist/cjs/types.cjs +10 -11
  14. package/dist/cjs/types.native.cjs +19 -0
  15. package/dist/cjs/types.native.js +10 -10
  16. package/dist/cjs/types.native.js.map +1 -1
  17. package/dist/esm/Image.mjs +13 -28
  18. package/dist/esm/Image.mjs.map +1 -1
  19. package/dist/esm/Image.native.js +4 -4
  20. package/dist/esm/Image.native.js.map +1 -1
  21. package/dist/esm/createImage.mjs +100 -128
  22. package/dist/esm/createImage.mjs.map +1 -1
  23. package/dist/esm/createImage.native.js +105 -130
  24. package/dist/esm/createImage.native.js.map +1 -1
  25. package/dist/esm/index.js +3 -3
  26. package/dist/esm/index.mjs +3 -3
  27. package/dist/esm/index.native.js +3 -3
  28. package/dist/esm/types.mjs +0 -2
  29. package/dist/esm/types.native.js +0 -2
  30. package/dist/jsx/Image.mjs +13 -28
  31. package/dist/jsx/Image.mjs.map +1 -1
  32. package/dist/jsx/Image.native.cjs +29 -0
  33. package/dist/jsx/Image.native.js +16 -20
  34. package/dist/jsx/Image.native.js.map +1 -1
  35. package/dist/jsx/createImage.mjs +100 -128
  36. package/dist/jsx/createImage.mjs.map +1 -1
  37. package/dist/jsx/createImage.native.cjs +133 -0
  38. package/dist/jsx/createImage.native.js +116 -145
  39. package/dist/jsx/createImage.native.js.map +1 -1
  40. package/dist/jsx/index.js +3 -3
  41. package/dist/jsx/index.mjs +3 -3
  42. package/dist/jsx/index.native.cjs +22 -0
  43. package/dist/jsx/index.native.js +10 -10
  44. package/dist/jsx/index.native.js.map +1 -1
  45. package/dist/jsx/types.mjs +0 -2
  46. package/dist/jsx/types.native.cjs +19 -0
  47. package/dist/jsx/types.native.js +10 -10
  48. package/dist/jsx/types.native.js.map +1 -1
  49. package/package.json +8 -7
  50. package/src/Image.tsx +5 -4
  51. package/src/createImage.tsx +99 -89
  52. package/types/Image.d.ts.map +1 -1
  53. package/types/Image.native.d.ts +4 -4
  54. package/types/Image.native.d.ts.map +1 -1
  55. package/types/createImage.d.ts +4 -4
  56. package/types/createImage.d.ts.map +1 -1
  57. package/dist/cjs/v1/Image.cjs +0 -101
  58. package/dist/cjs/v1/Image.native.js +0 -123
  59. package/dist/cjs/v1/Image.native.js.map +0 -1
  60. package/dist/cjs/v1/index.cjs +0 -20
  61. package/dist/cjs/v1/index.native.js +0 -23
  62. package/dist/cjs/v1/index.native.js.map +0 -1
  63. package/dist/esm/index.js.map +0 -1
  64. package/dist/esm/index.mjs.map +0 -1
  65. package/dist/esm/index.native.js.map +0 -1
  66. package/dist/esm/types.mjs.map +0 -1
  67. package/dist/esm/types.native.js.map +0 -1
  68. package/dist/esm/v1/Image.mjs +0 -65
  69. package/dist/esm/v1/Image.mjs.map +0 -1
  70. package/dist/esm/v1/Image.native.js +0 -84
  71. package/dist/esm/v1/Image.native.js.map +0 -1
  72. package/dist/esm/v1/index.mjs +0 -2
  73. package/dist/esm/v1/index.mjs.map +0 -1
  74. package/dist/esm/v1/index.native.js +0 -2
  75. package/dist/esm/v1/index.native.js.map +0 -1
  76. package/dist/jsx/index.js.map +0 -1
  77. package/dist/jsx/index.mjs.map +0 -1
  78. package/dist/jsx/types.mjs.map +0 -1
  79. package/dist/jsx/v1/Image.mjs +0 -65
  80. package/dist/jsx/v1/Image.mjs.map +0 -1
  81. package/dist/jsx/v1/Image.native.js +0 -123
  82. package/dist/jsx/v1/Image.native.js.map +0 -1
  83. package/dist/jsx/v1/index.mjs +0 -2
  84. package/dist/jsx/v1/index.mjs.map +0 -1
  85. package/dist/jsx/v1/index.native.js +0 -23
  86. package/dist/jsx/v1/index.native.js.map +0 -1
  87. package/src/v1/Image.tsx +0 -144
  88. package/src/v1/index.ts +0 -1
  89. package/types/v1/Image.d.ts +0 -36
  90. package/types/v1/Image.d.ts.map +0 -1
  91. package/types/v1/index.d.ts +0 -2
  92. package/types/v1/index.d.ts.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","v1_exports","module","exports"],"sources":["../../../src/v1/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,UAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAP,YAAc,CAAAK,UAAA","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc;AACd,cAAc","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc;AACd,cAAc","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc;AACd,cAAc","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":[],"sourcesContent":[],"mappings":"","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":[],"sourcesContent":[],"mappings":"","ignoreList":[]}
@@ -1,65 +0,0 @@
1
- import React from "react";
2
- import { isWeb } from "@tamagui/constants";
3
- import { styled, usePropsAndStyle } from "@tamagui/web";
4
- import { Image as Image$1 } from "react-native-web";
5
- import { jsx } from "react/jsx-runtime";
6
- const StyledImage = styled(Image$1, {
7
- name: "Image"
8
- });
9
- let hasWarned = false;
10
- const Image = StyledImage.styleable((inProps, ref) => {
11
- const [props, style] = usePropsAndStyle(inProps);
12
- const {
13
- src,
14
- source,
15
- objectFit,
16
- ...rest
17
- } = props;
18
- if (process.env.NODE_ENV === "development") {
19
- if (typeof src === "string") {
20
- if (typeof props.width === "string" && props.width[0] !== "$" || typeof props.height === "string" && props.height[0] !== "$") {
21
- if (!hasWarned) {
22
- hasWarned = true;
23
- console.warn(`React Native expects a numerical width/height. If you want to use a percent you must define the "source" prop with width, height, and uri.`);
24
- }
25
- }
26
- }
27
- }
28
- let finalSource = typeof src === "string" ? {
29
- uri: src,
30
- ...(isWeb && {
31
- width: props.width || style?.width,
32
- height: props.height || style?.height
33
- })
34
- } : source ?? src;
35
- if (finalSource && typeof finalSource === "object") {
36
- if (process.env.NODE_ENV === "development" && process.env.TAMAGUI_IMAGE_CHECK_ERROR) React.useEffect(() => {
37
- async function run() {
38
- if (typeof src === "string") try {
39
- await fetch(src).then(res => res.text());
40
- } catch (err) {
41
- console.error(`Error loading image: ${src}`, {
42
- props
43
- });
44
- }
45
- }
46
- run();
47
- }, [src]);
48
- if (finalSource["default"]) finalSource = finalSource["default"];
49
- }
50
- return /* @__PURE__ */jsx(Image$1, {
51
- resizeMode: objectFit,
52
- ref,
53
- source: finalSource,
54
- style,
55
- ...rest
56
- });
57
- });
58
- Image.getSize = Image$1.getSize;
59
- Image.getSizeWithHeaders = Image$1.getSizeWithHeaders;
60
- Image.prefetch = Image$1.prefetch;
61
- Image.prefetchWithMetadata = Image$1.prefetchWithMetadata;
62
- Image.abortPrefetch = Image$1.abortPrefetch;
63
- Image.queryCache = Image$1.queryCache;
64
- export { Image };
65
- //# sourceMappingURL=Image.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["React","isWeb","styled","usePropsAndStyle","Image","Image$1","jsx","StyledImage","name","hasWarned","styleable","inProps","ref","props","style","src","source","objectFit","rest","process","env","NODE_ENV","width","height","console","warn","finalSource","uri","TAMAGUI_IMAGE_CHECK_ERROR","useEffect","run","fetch","then","res","text","err","error","resizeMode","getSize","getSizeWithHeaders","prefetch","prefetchWithMetadata","abortPrefetch","queryCache"],"sources":["Image.mjs"],"sourcesContent":["import React from \"react\";\nimport { isWeb } from \"@tamagui/constants\";\nimport { styled, usePropsAndStyle } from \"@tamagui/web\";\nimport { Image as Image$1 } from \"react-native-web\";\nimport { jsx } from \"react/jsx-runtime\";\n\nconst StyledImage = styled(Image$1, { name: \"Image\" });\nlet hasWarned = false;\nconst Image = StyledImage.styleable((inProps, ref) => {\n\tconst [props, style] = usePropsAndStyle(inProps);\n\tconst { src, source, objectFit, ...rest } = props;\n\tif (process.env.NODE_ENV === \"development\") {\n\t\tif (typeof src === \"string\") {\n\t\t\tif (typeof props.width === \"string\" && props.width[0] !== \"$\" || typeof props.height === \"string\" && props.height[0] !== \"$\") {\n\t\t\t\tif (!hasWarned) {\n\t\t\t\t\thasWarned = true;\n\t\t\t\t\tconsole.warn(`React Native expects a numerical width/height. If you want to use a percent you must define the \"source\" prop with width, height, and uri.`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tlet finalSource = typeof src === \"string\" ? {\n\t\turi: src,\n\t\t...isWeb && {\n\t\t\twidth: props.width || style?.width,\n\t\t\theight: props.height || style?.height\n\t\t}\n\t} : source ?? src;\n\tif (finalSource && typeof finalSource === \"object\") {\n\t\tif (process.env.NODE_ENV === \"development\" && process.env.TAMAGUI_IMAGE_CHECK_ERROR) React.useEffect(() => {\n\t\t\tasync function run() {\n\t\t\t\tif (typeof src === \"string\") try {\n\t\t\t\t\tawait fetch(src).then((res) => res.text());\n\t\t\t\t} catch (err) {\n\t\t\t\t\tconsole.error(`Error loading image: ${src}`, { props });\n\t\t\t\t}\n\t\t\t}\n\t\t\trun();\n\t\t}, [src]);\n\t\tif (finalSource[\"default\"]) finalSource = finalSource[\"default\"];\n\t}\n\treturn /* @__PURE__ */ jsx(Image$1, {\n\t\tresizeMode: objectFit,\n\t\tref,\n\t\tsource: finalSource,\n\t\tstyle,\n\t\t...rest\n\t});\n});\nImage.getSize = Image$1.getSize;\nImage.getSizeWithHeaders = Image$1.getSizeWithHeaders;\nImage.prefetch = Image$1.prefetch;\nImage.prefetchWithMetadata = Image$1.prefetchWithMetadata;\nImage.abortPrefetch = Image$1.abortPrefetch;\nImage.queryCache = Image$1.queryCache;\n\nexport { Image };"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,KAAK,QAAQ,oBAAoB;AAC1C,SAASC,MAAM,EAAEC,gBAAgB,QAAQ,cAAc;AACvD,SAASC,KAAK,IAAIC,OAAO,QAAQ,kBAAkB;AACnD,SAASC,GAAG,QAAQ,mBAAmB;AAEvC,MAAMC,WAAW,GAAGL,MAAM,CAACG,OAAO,EAAE;EAAEG,IAAI,EAAE;AAAQ,CAAC,CAAC;AACtD,IAAIC,SAAS,GAAG,KAAK;AACrB,MAAML,KAAK,GAAGG,WAAW,CAACG,SAAS,CAAC,CAACC,OAAO,EAAEC,GAAG,KAAK;EACrD,MAAM,CAACC,KAAK,EAAEC,KAAK,CAAC,GAAGX,gBAAgB,CAACQ,OAAO,CAAC;EAChD,MAAM;IAAEI,GAAG;IAAEC,MAAM;IAAEC,SAAS;IAAE,GAAGC;EAAK,CAAC,GAAGL,KAAK;EACjD,IAAIM,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,aAAa,EAAE;IAC3C,IAAI,OAAON,GAAG,KAAK,QAAQ,EAAE;MAC5B,IAAI,OAAOF,KAAK,CAACS,KAAK,KAAK,QAAQ,IAAIT,KAAK,CAACS,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,OAAOT,KAAK,CAACU,MAAM,KAAK,QAAQ,IAAIV,KAAK,CAACU,MAAM,CAAC,CAAC,CAAC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AGI;EACJ,CAAC,CAAC;AACH,CAAC,CAAC;AACFd,KAAK,CAACkC,OAAO,GAAGjC,OAAO,CAACiC,OAAO;AAC/BlC,KAAK,CAACmC,kBAAkB,GAAGlC,OAAO,CAACkC,kBAAkB;AACrDnC,KAAK,CAACoC,QAAQ,GAAGnC,OAAO,CAACmC,QAAQ;AACjCpC,KAAK,CAACqC,oBAAoB,GAAGpC,OAAO,CAACoC,oBAAoB;AACzDrC,KAAK,CAACsC,aAAa,GAAGrC,OAAO,CAACqC,aAAa;AAC3CtC,KAAK,CAACuC,UAAU,GAAGtC,OAAO,CAACsC,UAAU;AAErC,SAASvC,KAAK","ignoreList":[]}
@@ -1,84 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import React from "react";
3
- import { isWeb } from "@tamagui/constants";
4
- import { styled, usePropsAndStyle } from "@tamagui/web";
5
- import { Image as Image$1 } from "react-native";
6
- function _type_of(obj) {
7
- "@swc/helpers - typeof";
8
-
9
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
10
- }
11
- var StyledImage = styled(Image$1, {
12
- name: "Image"
13
- });
14
- var hasWarned = false;
15
- var Image = StyledImage.styleable(function (inProps, ref) {
16
- var [props, style] = usePropsAndStyle(inProps);
17
- var {
18
- src,
19
- source,
20
- objectFit,
21
- ...rest
22
- } = props;
23
- if (process.env.NODE_ENV === "development") {
24
- if (typeof src === "string") {
25
- if (typeof props.width === "string" && props.width[0] !== "$" || typeof props.height === "string" && props.height[0] !== "$") {
26
- if (!hasWarned) {
27
- hasWarned = true;
28
- console.warn(`React Native expects a numerical width/height. If you want to use a percent you must define the "source" prop with width, height, and uri.`);
29
- }
30
- }
31
- }
32
- }
33
- var finalSource = typeof src === "string" ? {
34
- uri: src,
35
- ...(isWeb && {
36
- width: props.width || (style === null || style === void 0 ? void 0 : style.width),
37
- height: props.height || (style === null || style === void 0 ? void 0 : style.height)
38
- })
39
- } : source !== null && source !== void 0 ? source : src;
40
- if (finalSource && (typeof finalSource === "undefined" ? "undefined" : _type_of(finalSource)) === "object") {
41
- if (!Array.isArray(finalSource)) {
42
- if (typeof finalSource.uri === "number") {
43
- finalSource = finalSource.uri;
44
- if (source && (typeof source === "undefined" ? "undefined" : _type_of(source)) === "object" && !Array.isArray(source)) {
45
- var _style, _style1;
46
- var _width;
47
- (_width = (_style = style).width) !== null && _width !== void 0 || (_style.width = source.width);
48
- var _height;
49
- (_height = (_style1 = style).height) !== null && _height !== void 0 || (_style1.height = source.height);
50
- }
51
- }
52
- }
53
- if (process.env.NODE_ENV === "development" && process.env.TAMAGUI_IMAGE_CHECK_ERROR) React.useEffect(function () {
54
- async function run() {
55
- if (typeof src === "string") try {
56
- await fetch(src).then(function (res) {
57
- return res.text();
58
- });
59
- } catch (err) {
60
- console.error(`Error loading image: ${src}`, {
61
- props
62
- });
63
- }
64
- }
65
- run();
66
- }, [src]);
67
- if (finalSource["default"]) finalSource = finalSource["default"];
68
- }
69
- return /* @__PURE__ */jsx(Image$1, {
70
- resizeMode: objectFit,
71
- ref,
72
- source: finalSource,
73
- style,
74
- ...rest
75
- });
76
- });
77
- Image.getSize = Image$1.getSize;
78
- Image.getSizeWithHeaders = Image$1.getSizeWithHeaders;
79
- Image.prefetch = Image$1.prefetch;
80
- Image.prefetchWithMetadata = Image$1.prefetchWithMetadata;
81
- Image.abortPrefetch = Image$1.abortPrefetch;
82
- Image.queryCache = Image$1.queryCache;
83
- export { Image };
84
- //# sourceMappingURL=Image.native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["jsx","React","isWeb","styled","usePropsAndStyle","Image","Image$1","_type_of","obj","Symbol","constructor","StyledImage","name","hasWarned","styleable","inProps","ref","props","style","src","source","objectFit","rest","process","env","NODE_ENV","width","height","console","warn","finalSource","uri","Array","isArray","_style","_style1","_width","_height","TAMAGUI_IMAGE_CHECK_ERROR","useEffect","run","fetch","then","res","text","err","error","resizeMode","getSize","getSizeWithHeaders","prefetch","prefetchWithMetadata","abortPrefetch","queryCache"],"sources":["Image.native.js"],"sourcesContent":["import { jsx } from \"react/jsx-runtime\";\nimport React from \"react\";\nimport { isWeb } from \"@tamagui/constants\";\nimport { styled, usePropsAndStyle } from \"@tamagui/web\";\nimport { Image as Image$1 } from \"react-native\";\n\nfunction _type_of(obj) {\n\t\"@swc/helpers - typeof\";\n\treturn obj && typeof Symbol !== \"undefined\" && obj.constructor === Symbol ? \"symbol\" : typeof obj;\n}\nvar StyledImage = styled(Image$1, { name: \"Image\" });\nvar hasWarned = false;\nvar Image = StyledImage.styleable(function(inProps, ref) {\n\tvar [props, style] = usePropsAndStyle(inProps);\n\tvar { src, source, objectFit, ...rest } = props;\n\tif (process.env.NODE_ENV === \"development\") {\n\t\tif (typeof src === \"string\") {\n\t\t\tif (typeof props.width === \"string\" && props.width[0] !== \"$\" || typeof props.height === \"string\" && props.height[0] !== \"$\") {\n\t\t\t\tif (!hasWarned) {\n\t\t\t\t\thasWarned = true;\n\t\t\t\t\tconsole.warn(`React Native expects a numerical width/height. If you want to use a percent you must define the \"source\" prop with width, height, and uri.`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tvar finalSource = typeof src === \"string\" ? {\n\t\turi: src,\n\t\t...isWeb && {\n\t\t\twidth: props.width || (style === null || style === void 0 ? void 0 : style.width),\n\t\t\theight: props.height || (style === null || style === void 0 ? void 0 : style.height)\n\t\t}\n\t} : source !== null && source !== void 0 ? source : src;\n\tif (finalSource && (typeof finalSource === \"undefined\" ? \"undefined\" : _type_of(finalSource)) === \"object\") {\n\t\tif (!Array.isArray(finalSource)) {\n\t\t\tif (typeof finalSource.uri === \"number\") {\n\t\t\t\tfinalSource = finalSource.uri;\n\t\t\t\tif (source && (typeof source === \"undefined\" ? \"undefined\" : _type_of(source)) === \"object\" && !Array.isArray(source)) {\n\t\t\t\t\tvar _style, _style1;\n\t\t\t\t\tvar _width;\n\t\t\t\t\t(_width = (_style = style).width) !== null && _width !== void 0 || (_style.width = source.width);\n\t\t\t\t\tvar _height;\n\t\t\t\t\t(_height = (_style1 = style).height) !== null && _height !== void 0 || (_style1.height = source.height);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (process.env.NODE_ENV === \"development\" && process.env.TAMAGUI_IMAGE_CHECK_ERROR) React.useEffect(function() {\n\t\t\tasync function run() {\n\t\t\t\tif (typeof src === \"string\") try {\n\t\t\t\t\tawait fetch(src).then(function(res) {\n\t\t\t\t\t\treturn res.text();\n\t\t\t\t\t});\n\t\t\t\t} catch (err) {\n\t\t\t\t\tconsole.error(`Error loading image: ${src}`, { props });\n\t\t\t\t}\n\t\t\t}\n\t\t\trun();\n\t\t}, [src]);\n\t\tif (finalSource[\"default\"]) finalSource = finalSource[\"default\"];\n\t}\n\treturn /* @__PURE__ */ jsx(Image$1, {\n\t\tresizeMode: objectFit,\n\t\tref,\n\t\tsource: finalSource,\n\t\tstyle,\n\t\t...rest\n\t});\n});\nImage.getSize = Image$1.getSize;\nImage.getSizeWithHeaders = Image$1.getSizeWithHeaders;\nImage.prefetch = Image$1.prefetch;\nImage.prefetchWithMetadata = Image$1.prefetchWithMetadata;\nImage.abortPrefetch = Image$1.abortPrefetch;\nImage.queryCache = Image$1.queryCache;\n\nexport { Image };"],"mappings":"AAAA,SAASA,GAAG,QAAQ,mBAAmB;AACvC,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,KAAK,QAAQ,oBAAoB;AAC1C,SAASC,MAAM,EAAEC,gBAAgB,QAAQ,cAAc;AACvD,SAASC,KAAK,IAAIC,OAAO,QAAQ,cAAc;AAE/C,SAASC,QAAQA,CAACC,GAAG,EAAE;EACtB,uBAAuB;;EACvB,OAAOA,GAAG,IAAI,OAAOC,MAAM,KAAK,WAAW,IAAID,GAAG,CAACE,WAAW,KAAKD,MAAM,GAAG,QAAQ,GAAG,OAAOD,GAAG;AAClG;AACA,IAAIG,WAAW,GAAGR,MAAM,CAACG,OAAO,EAAE;EAAEM,IAAI,EAAE;AAAQ,CAAC,CAAC;A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C,GAAG,EAAE;UACbjB,OAAO,CAACkB,KAAK,CAAC,wBAAwB3B,GAAG,EAAE,EAAE;YAAEF;UAAM,CAAC,CAAC;QACxD;MACD;MACAuB,GAAG,CAAC,CAAC;IACN,CAAC,EAAE,CAACrB,GAAG,CAAC,CAAC;IACT,IAAIW,WAAW,CAAC,SAAS,CAAC,EAAEA,WAAW,GAAGA,WAAW,CAAC,SAAS,CAAC;EACjE;EACA,OAAO,eAAgB9B,GAAG,CAACM,OAAO,EAAE;IACnCyC,UAAU,EAAE1B,SAAS;IACrBL,GAAG;IACHI,MAAM,EAAEU,WAAW;IACnBZ,KAAK;IACL,GAAGI;EACJ,CAAC,CAAC;AACH,CAAC,CAAC;AACFjB,KAAK,CAAC2C,OAAO,GAAG1C,OAAO,CAAC0C,OAAO;AAC/B3C,KAAK,CAAC4C,kBAAkB,GAAG3C,OAAO,CAAC2C,kBAAkB;AACrD5C,KAAK,CAAC6C,QAAQ,GAAG5C,OAAO,CAAC4C,QAAQ;AACjC7C,KAAK,CAAC8C,oBAAoB,GAAG7C,OAAO,CAAC6C,oBAAoB;AACzD9C,KAAK,CAAC+C,aAAa,GAAG9C,OAAO,CAAC8C,aAAa;AAC3C/C,KAAK,CAACgD,UAAU,GAAG/C,OAAO,CAAC+C,UAAU;AAErC,SAAShD,KAAK","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- export * from "./Image.mjs";
2
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["../../../src/v1/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- export * from "./Image.native.js";
2
- //# sourceMappingURL=index.native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["../../../src/v1/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc;AACd,cAAc","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc;AACd,cAAc","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":[],"sourcesContent":[],"mappings":"","ignoreList":[]}
@@ -1,65 +0,0 @@
1
- import React from "react";
2
- import { isWeb } from "@tamagui/constants";
3
- import { styled, usePropsAndStyle } from "@tamagui/web";
4
- import { Image as Image$1 } from "react-native-web";
5
- import { jsx } from "react/jsx-runtime";
6
- const StyledImage = styled(Image$1, {
7
- name: "Image"
8
- });
9
- let hasWarned = false;
10
- const Image = StyledImage.styleable((inProps, ref) => {
11
- const [props, style] = usePropsAndStyle(inProps);
12
- const {
13
- src,
14
- source,
15
- objectFit,
16
- ...rest
17
- } = props;
18
- if (process.env.NODE_ENV === "development") {
19
- if (typeof src === "string") {
20
- if (typeof props.width === "string" && props.width[0] !== "$" || typeof props.height === "string" && props.height[0] !== "$") {
21
- if (!hasWarned) {
22
- hasWarned = true;
23
- console.warn(`React Native expects a numerical width/height. If you want to use a percent you must define the "source" prop with width, height, and uri.`);
24
- }
25
- }
26
- }
27
- }
28
- let finalSource = typeof src === "string" ? {
29
- uri: src,
30
- ...(isWeb && {
31
- width: props.width || style?.width,
32
- height: props.height || style?.height
33
- })
34
- } : source ?? src;
35
- if (finalSource && typeof finalSource === "object") {
36
- if (process.env.NODE_ENV === "development" && process.env.TAMAGUI_IMAGE_CHECK_ERROR) React.useEffect(() => {
37
- async function run() {
38
- if (typeof src === "string") try {
39
- await fetch(src).then(res => res.text());
40
- } catch (err) {
41
- console.error(`Error loading image: ${src}`, {
42
- props
43
- });
44
- }
45
- }
46
- run();
47
- }, [src]);
48
- if (finalSource["default"]) finalSource = finalSource["default"];
49
- }
50
- return /* @__PURE__ */jsx(Image$1, {
51
- resizeMode: objectFit,
52
- ref,
53
- source: finalSource,
54
- style,
55
- ...rest
56
- });
57
- });
58
- Image.getSize = Image$1.getSize;
59
- Image.getSizeWithHeaders = Image$1.getSizeWithHeaders;
60
- Image.prefetch = Image$1.prefetch;
61
- Image.prefetchWithMetadata = Image$1.prefetchWithMetadata;
62
- Image.abortPrefetch = Image$1.abortPrefetch;
63
- Image.queryCache = Image$1.queryCache;
64
- export { Image };
65
- //# sourceMappingURL=Image.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["React","isWeb","styled","usePropsAndStyle","Image","Image$1","jsx","StyledImage","name","hasWarned","styleable","inProps","ref","props","style","src","source","objectFit","rest","process","env","NODE_ENV","width","height","console","warn","finalSource","uri","TAMAGUI_IMAGE_CHECK_ERROR","useEffect","run","fetch","then","res","text","err","error","resizeMode","getSize","getSizeWithHeaders","prefetch","prefetchWithMetadata","abortPrefetch","queryCache"],"sources":["Image.mjs"],"sourcesContent":["import React from \"react\";\nimport { isWeb } from \"@tamagui/constants\";\nimport { styled, usePropsAndStyle } from \"@tamagui/web\";\nimport { Image as Image$1 } from \"react-native-web\";\nimport { jsx } from \"react/jsx-runtime\";\n\nconst StyledImage = styled(Image$1, { name: \"Image\" });\nlet hasWarned = false;\nconst Image = StyledImage.styleable((inProps, ref) => {\n\tconst [props, style] = usePropsAndStyle(inProps);\n\tconst { src, source, objectFit, ...rest } = props;\n\tif (process.env.NODE_ENV === \"development\") {\n\t\tif (typeof src === \"string\") {\n\t\t\tif (typeof props.width === \"string\" && props.width[0] !== \"$\" || typeof props.height === \"string\" && props.height[0] !== \"$\") {\n\t\t\t\tif (!hasWarned) {\n\t\t\t\t\thasWarned = true;\n\t\t\t\t\tconsole.warn(`React Native expects a numerical width/height. If you want to use a percent you must define the \"source\" prop with width, height, and uri.`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tlet finalSource = typeof src === \"string\" ? {\n\t\turi: src,\n\t\t...isWeb && {\n\t\t\twidth: props.width || style?.width,\n\t\t\theight: props.height || style?.height\n\t\t}\n\t} : source ?? src;\n\tif (finalSource && typeof finalSource === \"object\") {\n\t\tif (process.env.NODE_ENV === \"development\" && process.env.TAMAGUI_IMAGE_CHECK_ERROR) React.useEffect(() => {\n\t\t\tasync function run() {\n\t\t\t\tif (typeof src === \"string\") try {\n\t\t\t\t\tawait fetch(src).then((res) => res.text());\n\t\t\t\t} catch (err) {\n\t\t\t\t\tconsole.error(`Error loading image: ${src}`, { props });\n\t\t\t\t}\n\t\t\t}\n\t\t\trun();\n\t\t}, [src]);\n\t\tif (finalSource[\"default\"]) finalSource = finalSource[\"default\"];\n\t}\n\treturn /* @__PURE__ */ jsx(Image$1, {\n\t\tresizeMode: objectFit,\n\t\tref,\n\t\tsource: finalSource,\n\t\tstyle,\n\t\t...rest\n\t});\n});\nImage.getSize = Image$1.getSize;\nImage.getSizeWithHeaders = Image$1.getSizeWithHeaders;\nImage.prefetch = Image$1.prefetch;\nImage.prefetchWithMetadata = Image$1.prefetchWithMetadata;\nImage.abortPrefetch = Image$1.abortPrefetch;\nImage.queryCache = Image$1.queryCache;\n\nexport { Image };"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,KAAK,QAAQ,oBAAoB;AAC1C,SAASC,MAAM,EAAEC,gBAAgB,QAAQ,cAAc;AACvD,SAASC,KAAK,IAAIC,OAAO,QAAQ,kBAAkB;AACnD,SAASC,GAAG,QAAQ,mBAAmB;AAEvC,MAAMC,WAAW,GAAGL,MAAM,CAACG,OAAO,EAAE;EAAEG,IAAI,EAAE;AAAQ,CAAC,CAAC;AACtD,IAAIC,SAAS,GAAG,KAAK;AACrB,MAAML,KAAK,GAAGG,WAAW,CAACG,SAAS,CAAC,CAACC,OAAO,EAAEC,GAAG,KAAK;EACrD,MAAM,CAACC,KAAK,EAAEC,KAAK,CAAC,GAAGX,gBAAgB,CAACQ,OAAO,CAAC;EAChD,MAAM;IAAEI,GAAG;IAAEC,MAAM;IAAEC,SAAS;IAAE,GAAGC;EAAK,CAAC,GAAGL,KAAK;EACjD,IAAIM,OA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ACAiB,GAAG,CAAC,CAAC;IACN,CAAC,EAAE,CAACf,GAAG,CAAC,CAAC;IACT,IAAIW,WAAW,CAAC,SAAS,CAAC,EAAEA,WAAW,GAAGA,WAAW,CAAC,SAAS,CAAC;EACjE;EACA,OAAO,eAAgBpB,GAAG,CAACD,OAAO,EAAE;IACnCgC,UAAU,EAAEpB,SAAS;IACrBL,GAAG;IACHI,MAAM,EAAEU,WAAW;IACnBZ,KAAK;IACL,GAAGI;EACJ,CAAC,CAAC;AACH,CAAC,CAAC;AACFd,KAAK,CAACkC,OAAO,GAAGjC,OAAO,CAACiC,OAAO;AAC/BlC,KAAK,CAACmC,kBAAkB,GAAGlC,OAAO,CAACkC,kBAAkB;AACrDnC,KAAK,CAACoC,QAAQ,GAAGnC,OAAO,CAACmC,QAAQ;AACjCpC,KAAK,CAACqC,oBAAoB,GAAGpC,OAAO,CAACoC,oBAAoB;AACzDrC,KAAK,CAACsC,aAAa,GAAGrC,OAAO,CAACqC,aAAa;AAC3CtC,KAAK,CAACuC,UAAU,GAAGtC,OAAO,CAACsC,UAAU;AAErC,SAASvC,KAAK","ignoreList":[]}
@@ -1,123 +0,0 @@
1
- "use strict";
2
-
3
- var __create = Object.create;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __export = (target, all) => {
10
- for (var name in all) __defProp(target, name, {
11
- get: all[name],
12
- enumerable: true
13
- });
14
- };
15
- var __copyProps = (to, from, except, desc) => {
16
- if (from && typeof from === "object" || typeof from === "function") {
17
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
18
- get: () => from[key],
19
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
20
- });
21
- }
22
- return to;
23
- };
24
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
25
- // If the importer is in node compatibility mode or this is not an ESM
26
- // file that has been converted to a CommonJS file using a Babel-
27
- // compatible transform (i.e. "__esModule" has not been set), then set
28
- // "default" to the CommonJS "module.exports" for node compatibility.
29
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
30
- value: mod,
31
- enumerable: true
32
- }) : target, mod));
33
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
34
- value: true
35
- }), mod);
36
- var Image_exports = {};
37
- __export(Image_exports, {
38
- Image: () => Image
39
- });
40
- module.exports = __toCommonJS(Image_exports);
41
- var import_jsx_runtime = require("react/jsx-runtime");
42
- var import_react = __toESM(require("react"), 1);
43
- var import_constants = require("@tamagui/constants");
44
- var import_web = require("@tamagui/web");
45
- var import_react_native = require("react-native");
46
- function _type_of(obj) {
47
- "@swc/helpers - typeof";
48
-
49
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
50
- }
51
- var StyledImage = (0, import_web.styled)(import_react_native.Image, {
52
- name: "Image"
53
- });
54
- var hasWarned = false;
55
- var Image = StyledImage.styleable(function (inProps, ref) {
56
- var [props, style] = (0, import_web.usePropsAndStyle)(inProps);
57
- var {
58
- src,
59
- source,
60
- objectFit,
61
- ...rest
62
- } = props;
63
- if (process.env.NODE_ENV === "development") {
64
- if (typeof src === "string") {
65
- if (typeof props.width === "string" && props.width[0] !== "$" || typeof props.height === "string" && props.height[0] !== "$") {
66
- if (!hasWarned) {
67
- hasWarned = true;
68
- console.warn(`React Native expects a numerical width/height. If you want to use a percent you must define the "source" prop with width, height, and uri.`);
69
- }
70
- }
71
- }
72
- }
73
- var finalSource = typeof src === "string" ? {
74
- uri: src,
75
- ...(import_constants.isWeb && {
76
- width: props.width || (style === null || style === void 0 ? void 0 : style.width),
77
- height: props.height || (style === null || style === void 0 ? void 0 : style.height)
78
- })
79
- } : source !== null && source !== void 0 ? source : src;
80
- if (finalSource && (typeof finalSource === "undefined" ? "undefined" : _type_of(finalSource)) === "object") {
81
- if (!Array.isArray(finalSource)) {
82
- if (typeof finalSource.uri === "number") {
83
- finalSource = finalSource.uri;
84
- if (source && (typeof source === "undefined" ? "undefined" : _type_of(source)) === "object" && !Array.isArray(source)) {
85
- var _style, _style1;
86
- var _width;
87
- (_width = (_style = style).width) !== null && _width !== void 0 || (_style.width = source.width);
88
- var _height;
89
- (_height = (_style1 = style).height) !== null && _height !== void 0 || (_style1.height = source.height);
90
- }
91
- }
92
- }
93
- if (process.env.NODE_ENV === "development" && process.env.TAMAGUI_IMAGE_CHECK_ERROR) import_react.default.useEffect(function () {
94
- async function run() {
95
- if (typeof src === "string") try {
96
- await fetch(src).then(function (res) {
97
- return res.text();
98
- });
99
- } catch (err) {
100
- console.error(`Error loading image: ${src}`, {
101
- props
102
- });
103
- }
104
- }
105
- run();
106
- }, [src]);
107
- if (finalSource["default"]) finalSource = finalSource["default"];
108
- }
109
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_react_native.Image, {
110
- resizeMode: objectFit,
111
- ref,
112
- source: finalSource,
113
- style,
114
- ...rest
115
- });
116
- });
117
- Image.getSize = import_react_native.Image.getSize;
118
- Image.getSizeWithHeaders = import_react_native.Image.getSizeWithHeaders;
119
- Image.prefetch = import_react_native.Image.prefetch;
120
- Image.prefetchWithMetadata = import_react_native.Image.prefetchWithMetadata;
121
- Image.abortPrefetch = import_react_native.Image.abortPrefetch;
122
- Image.queryCache = import_react_native.Image.queryCache;
123
- //# sourceMappingURL=Image.native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["__create","Object","create","__defProp","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__getProtoOf","getPrototypeOf","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toESM","mod","isNodeMode","__esModule","value","__toCommonJS","Image_exports","Image","module","exports","import_jsx_runtime","require","import_react","import_constants","import_web","import_react_native","_type_of","obj","Symbol","constructor","StyledImage","styled","hasWarned","styleable","inProps","ref","props","style","usePropsAndStyle","src","source","objectFit","rest","process","env","NODE_ENV","width","height","console","warn","finalSource","uri","isWeb","Array","isArray","_style","_style1","_width","_height"],"sources":["../../../src/v1/Image.tsx"],"sourcesContent":[null],"mappings":"AAAA,YAAO;;AACP,IAAAA,QAAS,GAAAC,MAAA,CAAaC,MAAA;AAQtB,IAAAC,SAAS,GAAAF,MAAQ,CAAAG,cAAA;AAEjB,IAAAC,gBAAkB,GAAAJ,MAAA,CAAAK,wBAAe;AAqH7B,IAAAC,iBAAA,GAAAN,MAAA,CAAAO,mBAAA;AAnHJ,IAAAC,YAAM,GAAAR,MAAc,CAAAS,cAAgB;AAAA,IAClCC,YAAM,GAAAV,MAAA,CAAAW,SAAA,CAAAC,cAAA;AACR,IAACC,QAAA,GAAAA,CAAAC,MAAA,EAAAC,GAAA;EAmCD,KAAI,IAAAC,IAAA,IAAYD,GAAA,EAAAb,SAAA,CAAAY,MAAA,EAAAE,IAAA;IAMTC,GAAA,EAAMF,GAAA,CAAAC,IAAQ;IACnBE,UAAO;EACP;AAEA;AACE,IAAAC,WAAW,GAAAA,CAAAC,EAAA,EAAQC,IAAA,EAAAC,MAAU,EAAAC,IAAA;EAC3B,IAAAF,IAAA,IACG,OAAOA,IAAM,aAAU,WAAYA,IAAM,KAAM,UAAO;IAGvD,SAAAG,GAAK,IAAAlB,iBAAW,CAAAe,IAAA,QAAAX,YAAA,CAAAe,IAAA,CAAAL,EAAA,EAAAI,GAAA,KAAAA,GAAA,KAAAF,MAAA,EAAApB,SAAA,CAAAkB,EAAA,EAAAI,GAAA;MACdP,GAAA,EAAAA,CAAA,KAAAI,IAAA,CAAAG,GAAY;MACZN,UAAA,IAAAK,IAAQ,GAAAnB,gBAAA,CAAAiB,IAAA,EAAAG,GAAA,MAAAD,IAAA,CAAAL;IAAA;EACN;EACF,OACFE,EAAA;AAAA;AACF,IAC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A,CAAAO,MAAA","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- export * from "./Image.mjs";
2
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["../../../src/v1/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc","ignoreList":[]}
@@ -1,23 +0,0 @@
1
- "use strict";
2
-
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __copyProps = (to, from, except, desc) => {
8
- if (from && typeof from === "object" || typeof from === "function") {
9
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
10
- get: () => from[key],
11
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
12
- });
13
- }
14
- return to;
15
- };
16
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
17
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
18
- value: true
19
- }), mod);
20
- var v1_exports = {};
21
- module.exports = __toCommonJS(v1_exports);
22
- __reExport(v1_exports, require("./Image.native.js"), module.exports);
23
- //# sourceMappingURL=index.native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["../../../src/v1/index.ts"],"sourcesContent":[null],"mappings":"AAAA","ignoreList":[]}
package/src/v1/Image.tsx DELETED
@@ -1,144 +0,0 @@
1
- import React from 'react'
2
- import { isWeb } from '@tamagui/constants'
3
- import type {
4
- GetProps,
5
- RadiusTokens,
6
- SizeTokens,
7
- ViewProps,
8
- ThemeValueFallback,
9
- } from '@tamagui/web'
10
- import { styled, usePropsAndStyle } from '@tamagui/web'
11
- import type { FC } from 'react'
12
- import { Image as RNImage } from 'react-native'
13
-
14
- const StyledImage = styled(RNImage, {
15
- name: 'Image',
16
- })
17
-
18
- type StyledImageProps = Omit<GetProps<typeof StyledImage>, 'borderRadius'> & {
19
- borderRadius?: RadiusTokens
20
- }
21
-
22
- type BaseProps = Omit<
23
- StyledImageProps,
24
- 'width' | 'height' | 'style' | 'onLayout' | 'resizeMode'
25
- > & {
26
- width?: string | number | SizeTokens | ThemeValueFallback
27
- height?: string | number | SizeTokens | ThemeValueFallback
28
-
29
- /**
30
- * @deprecated use `source` instead to disambiguate width/height style from width/height of the actual image
31
- */
32
- src?: string | StyledImageProps['source']
33
- /** @deprecated use objectFit instead */
34
- resizeMode?: StyledImageProps['resizeMode']
35
- objectFit?: React.CSSProperties['objectFit']
36
- }
37
-
38
- export type ImageProps = BaseProps & Omit<ViewProps, keyof BaseProps>
39
-
40
- type RNImageType = typeof RNImage
41
-
42
- type ImageType = FC<ImageProps> & {
43
- getSize: RNImageType['getSize']
44
- getSizeWithHeaders: RNImageType['getSizeWithHeaders']
45
- prefetch: RNImageType['prefetch']
46
- prefetchWithMetadata: RNImageType['prefetchWithMetadata']
47
- abortPrefetch: RNImageType['abortPrefetch']
48
- queryCache: RNImageType['queryCache']
49
- }
50
-
51
- let hasWarned = false
52
-
53
- /**
54
- * @summary An image is a component that displays an image.
55
- * @see — Docs https://tamagui.dev/ui/image
56
- */
57
- export const Image = StyledImage.styleable<ImageProps>((inProps, ref) => {
58
- const [props, style] = usePropsAndStyle(inProps)
59
- const { src, source, objectFit, ...rest } = props
60
-
61
- if (process.env.NODE_ENV === 'development') {
62
- if (typeof src === 'string') {
63
- if (
64
- (typeof props.width === 'string' && props.width[0] !== '$') ||
65
- (typeof props.height === 'string' && props.height[0] !== '$')
66
- ) {
67
- if (!hasWarned) {
68
- hasWarned = true
69
- console.warn(
70
- `React Native expects a numerical width/height. If you want to use a percent you must define the "source" prop with width, height, and uri.`
71
- )
72
- }
73
- }
74
- }
75
- }
76
-
77
- let finalSource =
78
- typeof src === 'string'
79
- ? {
80
- uri: src,
81
- ...(isWeb && {
82
- width: props.width || style?.width,
83
- height: props.height || style?.height,
84
- }),
85
- }
86
- : (source ?? src)
87
-
88
- if (finalSource && typeof finalSource === 'object') {
89
- if (process.env.TAMAGUI_TARGET === 'native') {
90
- // fix: normalize import style images
91
- if (!Array.isArray(finalSource)) {
92
- if (typeof finalSource.uri === 'number') {
93
- finalSource = finalSource.uri
94
- if (source && typeof source === 'object' && !Array.isArray(source)) {
95
- // @ts-ignore
96
- style.width ??= source.width
97
- // @ts-ignore
98
- style.height ??= source.height
99
- }
100
- }
101
- }
102
- }
103
-
104
- if (process.env.NODE_ENV === 'development' && process.env.TAMAGUI_IMAGE_CHECK_ERROR) {
105
- // lets add an onload timeout and warning if it fails to load in console
106
- React.useEffect(() => {
107
- async function run() {
108
- if (typeof src === 'string') {
109
- try {
110
- await fetch(src).then((res) => res.text())
111
- } catch (err) {
112
- console.error(`Error loading image: ${src}`, { props })
113
- }
114
- }
115
- }
116
-
117
- run()
118
- }, [src])
119
- }
120
-
121
- // require compat across native/web
122
- if (finalSource['default']) {
123
- finalSource = finalSource['default']
124
- }
125
- }
126
-
127
- // must set defaultSource to allow SSR, default it to the same as src
128
- return (
129
- <RNImage
130
- resizeMode={objectFit}
131
- ref={ref}
132
- source={finalSource}
133
- style={style}
134
- {...(rest as any)}
135
- />
136
- )
137
- }) as any as ImageType
138
-
139
- Image.getSize = RNImage.getSize
140
- Image.getSizeWithHeaders = RNImage.getSizeWithHeaders
141
- Image.prefetch = RNImage.prefetch
142
- Image.prefetchWithMetadata = RNImage.prefetchWithMetadata
143
- Image.abortPrefetch = RNImage.abortPrefetch
144
- Image.queryCache = RNImage.queryCache
package/src/v1/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from './Image'