@tamagui/image 1.9.5 → 1.9.7

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/Image.js CHANGED
@@ -23,6 +23,7 @@ __export(Image_exports, {
23
23
  module.exports = __toCommonJS(Image_exports);
24
24
  var import_jsx_runtime = require("react/jsx-runtime");
25
25
  var import_core = require("@tamagui/core");
26
+ var import_react = require("react");
26
27
  var import_react_native = require("react-native");
27
28
  (0, import_core.setupReactNative)({
28
29
  Image: import_react_native.Image
@@ -33,12 +34,14 @@ const StyledImage = (0, import_core.styled)(import_react_native.Image, {
33
34
  source: { uri: "" },
34
35
  zIndex: 1
35
36
  });
36
- const Image = StyledImage.extractable((inProps) => {
37
- const props = (0, import_core.useMediaPropsActive)(inProps);
38
- const { src, ...rest } = props;
39
- const source = typeof src === "string" ? { uri: src, ...import_core.isWeb && { width: props.width, height: props.height } } : src;
40
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledImage, { source, ...rest });
41
- });
37
+ const Image = StyledImage.extractable(
38
+ (0, import_react.forwardRef)((inProps, ref) => {
39
+ const props = (0, import_core.useMediaPropsActive)(inProps);
40
+ const { src, ...rest } = props;
41
+ const source = typeof src === "string" ? { uri: src, ...import_core.isWeb && { width: props.width, height: props.height } } : src;
42
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledImage, { ref, source, ...rest });
43
+ })
44
+ );
42
45
  // Annotate the CommonJS export names for ESM import in node:
43
46
  0 && (module.exports = {
44
47
  Image
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/Image.tsx"],
4
- "sourcesContent": ["import {\n GetProps,\n RadiusTokens,\n StackProps,\n isWeb,\n setupReactNative,\n styled,\n useMediaPropsActive,\n} from '@tamagui/core'\nimport React from 'react'\nimport { Image as RNImage } from 'react-native'\n\nsetupReactNative({\n Image: RNImage,\n})\n\nconst StyledImage = styled(RNImage, {\n name: 'Image',\n position: 'relative',\n source: { uri: '' },\n zIndex: 1,\n})\n\ntype StyledImageProps = Omit<GetProps<typeof StyledImage>, 'borderRadius'> & {\n borderRadius?: RadiusTokens\n}\n\ntype BaseProps = Omit<\n StyledImageProps,\n 'source' | 'width' | 'height' | 'style' | 'onLayout'\n> & {\n width: number | string\n height: number | string\n src: string | StyledImageProps['source']\n}\n\nexport type ImageProps = BaseProps & Omit<StackProps, keyof BaseProps>\n\nexport const Image: React.FC<ImageProps> = StyledImage.extractable((inProps) => {\n const props = useMediaPropsActive(inProps)\n const { src, ...rest } = props\n const source =\n typeof src === 'string'\n ? { uri: src, ...(isWeb && { width: props.width, height: props.height }) }\n : src\n\n // must set defaultSource to allow SSR, default it to the same as src\n return <StyledImage source={source} {...(rest as any)} />\n})\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA+CS;AA/CT,kBAQO;AAEP,0BAAiC;AAAA,IAEjC,8BAAiB;AAAA,EACf,OAAO,oBAAAA;AACT,CAAC;AAED,MAAM,kBAAc,oBAAO,oBAAAA,OAAS;AAAA,EAClC,MAAM;AAAA,EACN,UAAU;AAAA,EACV,QAAQ,EAAE,KAAK,GAAG;AAAA,EAClB,QAAQ;AACV,CAAC;AAiBM,MAAM,QAA8B,YAAY,YAAY,CAAC,YAAY;AAC9E,QAAM,YAAQ,iCAAoB,OAAO;AACzC,QAAM,EAAE,KAAK,GAAG,KAAK,IAAI;AACzB,QAAM,SACJ,OAAO,QAAQ,WACX,EAAE,KAAK,KAAK,GAAI,qBAAS,EAAE,OAAO,MAAM,OAAO,QAAQ,MAAM,OAAO,EAAG,IACvE;AAGN,SAAO,4CAAC,eAAY,QAAiB,GAAI,MAAc;AACzD,CAAC;",
4
+ "sourcesContent": ["import {\n GetProps,\n RadiusTokens,\n StackProps,\n isWeb,\n setupReactNative,\n styled,\n useMediaPropsActive,\n} from '@tamagui/core'\nimport React, { forwardRef } from 'react'\nimport { Image as RNImage } from 'react-native'\n\nsetupReactNative({\n Image: RNImage,\n})\n\nconst StyledImage = styled(RNImage, {\n name: 'Image',\n position: 'relative',\n source: { uri: '' },\n zIndex: 1,\n})\n\ntype StyledImageProps = Omit<GetProps<typeof StyledImage>, 'borderRadius'> & {\n borderRadius?: RadiusTokens\n}\n\ntype BaseProps = Omit<\n StyledImageProps,\n 'source' | 'width' | 'height' | 'style' | 'onLayout'\n> & {\n width: number | string\n height: number | string\n src: string | StyledImageProps['source']\n}\n\nexport type ImageProps = BaseProps & Omit<StackProps, keyof BaseProps>\n\nexport const Image: React.FC<ImageProps> = StyledImage.extractable(\n forwardRef((inProps, ref) => {\n const props = useMediaPropsActive(inProps)\n const { src, ...rest } = props\n const source =\n typeof src === 'string'\n ? { uri: src, ...(isWeb && { width: props.width, height: props.height }) }\n : src\n\n // must set defaultSource to allow SSR, default it to the same as src\n return <StyledImage ref={ref} source={source} {...(rest as any)} />\n })\n)\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgDW;AAhDX,kBAQO;AACP,mBAAkC;AAClC,0BAAiC;AAAA,IAEjC,8BAAiB;AAAA,EACf,OAAO,oBAAAA;AACT,CAAC;AAED,MAAM,kBAAc,oBAAO,oBAAAA,OAAS;AAAA,EAClC,MAAM;AAAA,EACN,UAAU;AAAA,EACV,QAAQ,EAAE,KAAK,GAAG;AAAA,EAClB,QAAQ;AACV,CAAC;AAiBM,MAAM,QAA8B,YAAY;AAAA,MACrD,yBAAW,CAAC,SAAS,QAAQ;AAC3B,UAAM,YAAQ,iCAAoB,OAAO;AACzC,UAAM,EAAE,KAAK,GAAG,KAAK,IAAI;AACzB,UAAM,SACJ,OAAO,QAAQ,WACX,EAAE,KAAK,KAAK,GAAI,qBAAS,EAAE,OAAO,MAAM,OAAO,QAAQ,MAAM,OAAO,EAAG,IACvE;AAGN,WAAO,4CAAC,eAAY,KAAU,QAAiB,GAAI,MAAc;AAAA,EACnE,CAAC;AACH;",
6
6
  "names": ["RNImage"]
7
7
  }
package/dist/esm/Image.js CHANGED
@@ -5,6 +5,7 @@ import {
5
5
  styled,
6
6
  useMediaPropsActive
7
7
  } from "@tamagui/core";
8
+ import { forwardRef } from "react";
8
9
  import { Image as RNImage } from "react-native";
9
10
  setupReactNative({
10
11
  Image: RNImage
@@ -15,12 +16,14 @@ const StyledImage = styled(RNImage, {
15
16
  source: { uri: "" },
16
17
  zIndex: 1
17
18
  });
18
- const Image = StyledImage.extractable((inProps) => {
19
- const props = useMediaPropsActive(inProps);
20
- const { src, ...rest } = props;
21
- const source = typeof src === "string" ? { uri: src, ...isWeb && { width: props.width, height: props.height } } : src;
22
- return /* @__PURE__ */ jsx(StyledImage, { source, ...rest });
23
- });
19
+ const Image = StyledImage.extractable(
20
+ forwardRef((inProps, ref) => {
21
+ const props = useMediaPropsActive(inProps);
22
+ const { src, ...rest } = props;
23
+ const source = typeof src === "string" ? { uri: src, ...isWeb && { width: props.width, height: props.height } } : src;
24
+ return /* @__PURE__ */ jsx(StyledImage, { ref, source, ...rest });
25
+ })
26
+ );
24
27
  export {
25
28
  Image
26
29
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/Image.tsx"],
4
- "sourcesContent": ["import {\n GetProps,\n RadiusTokens,\n StackProps,\n isWeb,\n setupReactNative,\n styled,\n useMediaPropsActive,\n} from '@tamagui/core'\nimport React from 'react'\nimport { Image as RNImage } from 'react-native'\n\nsetupReactNative({\n Image: RNImage,\n})\n\nconst StyledImage = styled(RNImage, {\n name: 'Image',\n position: 'relative',\n source: { uri: '' },\n zIndex: 1,\n})\n\ntype StyledImageProps = Omit<GetProps<typeof StyledImage>, 'borderRadius'> & {\n borderRadius?: RadiusTokens\n}\n\ntype BaseProps = Omit<\n StyledImageProps,\n 'source' | 'width' | 'height' | 'style' | 'onLayout'\n> & {\n width: number | string\n height: number | string\n src: string | StyledImageProps['source']\n}\n\nexport type ImageProps = BaseProps & Omit<StackProps, keyof BaseProps>\n\nexport const Image: React.FC<ImageProps> = StyledImage.extractable((inProps) => {\n const props = useMediaPropsActive(inProps)\n const { src, ...rest } = props\n const source =\n typeof src === 'string'\n ? { uri: src, ...(isWeb && { width: props.width, height: props.height }) }\n : src\n\n // must set defaultSource to allow SSR, default it to the same as src\n return <StyledImage source={source} {...(rest as any)} />\n})\n"],
5
- "mappings": "AA+CS;AA/CT;AAAA,EAIE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,SAAS,eAAe;AAEjC,iBAAiB;AAAA,EACf,OAAO;AACT,CAAC;AAED,MAAM,cAAc,OAAO,SAAS;AAAA,EAClC,MAAM;AAAA,EACN,UAAU;AAAA,EACV,QAAQ,EAAE,KAAK,GAAG;AAAA,EAClB,QAAQ;AACV,CAAC;AAiBM,MAAM,QAA8B,YAAY,YAAY,CAAC,YAAY;AAC9E,QAAM,QAAQ,oBAAoB,OAAO;AACzC,QAAM,EAAE,KAAK,GAAG,KAAK,IAAI;AACzB,QAAM,SACJ,OAAO,QAAQ,WACX,EAAE,KAAK,KAAK,GAAI,SAAS,EAAE,OAAO,MAAM,OAAO,QAAQ,MAAM,OAAO,EAAG,IACvE;AAGN,SAAO,oBAAC,eAAY,QAAiB,GAAI,MAAc;AACzD,CAAC;",
4
+ "sourcesContent": ["import {\n GetProps,\n RadiusTokens,\n StackProps,\n isWeb,\n setupReactNative,\n styled,\n useMediaPropsActive,\n} from '@tamagui/core'\nimport React, { forwardRef } from 'react'\nimport { Image as RNImage } from 'react-native'\n\nsetupReactNative({\n Image: RNImage,\n})\n\nconst StyledImage = styled(RNImage, {\n name: 'Image',\n position: 'relative',\n source: { uri: '' },\n zIndex: 1,\n})\n\ntype StyledImageProps = Omit<GetProps<typeof StyledImage>, 'borderRadius'> & {\n borderRadius?: RadiusTokens\n}\n\ntype BaseProps = Omit<\n StyledImageProps,\n 'source' | 'width' | 'height' | 'style' | 'onLayout'\n> & {\n width: number | string\n height: number | string\n src: string | StyledImageProps['source']\n}\n\nexport type ImageProps = BaseProps & Omit<StackProps, keyof BaseProps>\n\nexport const Image: React.FC<ImageProps> = StyledImage.extractable(\n forwardRef((inProps, ref) => {\n const props = useMediaPropsActive(inProps)\n const { src, ...rest } = props\n const source =\n typeof src === 'string'\n ? { uri: src, ...(isWeb && { width: props.width, height: props.height }) }\n : src\n\n // must set defaultSource to allow SSR, default it to the same as src\n return <StyledImage ref={ref} source={source} {...(rest as any)} />\n })\n)\n"],
5
+ "mappings": "AAgDW;AAhDX;AAAA,EAIE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAgB,kBAAkB;AAClC,SAAS,SAAS,eAAe;AAEjC,iBAAiB;AAAA,EACf,OAAO;AACT,CAAC;AAED,MAAM,cAAc,OAAO,SAAS;AAAA,EAClC,MAAM;AAAA,EACN,UAAU;AAAA,EACV,QAAQ,EAAE,KAAK,GAAG;AAAA,EAClB,QAAQ;AACV,CAAC;AAiBM,MAAM,QAA8B,YAAY;AAAA,EACrD,WAAW,CAAC,SAAS,QAAQ;AAC3B,UAAM,QAAQ,oBAAoB,OAAO;AACzC,UAAM,EAAE,KAAK,GAAG,KAAK,IAAI;AACzB,UAAM,SACJ,OAAO,QAAQ,WACX,EAAE,KAAK,KAAK,GAAI,SAAS,EAAE,OAAO,MAAM,OAAO,QAAQ,MAAM,OAAO,EAAG,IACvE;AAGN,WAAO,oBAAC,eAAY,KAAU,QAAiB,GAAI,MAAc;AAAA,EACnE,CAAC;AACH;",
6
6
  "names": []
7
7
  }
@@ -5,6 +5,7 @@ import {
5
5
  styled,
6
6
  useMediaPropsActive
7
7
  } from "@tamagui/core";
8
+ import { forwardRef } from "react";
8
9
  import { Image as RNImage } from "react-native";
9
10
  setupReactNative({
10
11
  Image: RNImage
@@ -15,12 +16,14 @@ const StyledImage = styled(RNImage, {
15
16
  source: { uri: "" },
16
17
  zIndex: 1
17
18
  });
18
- const Image = StyledImage.extractable((inProps) => {
19
- const props = useMediaPropsActive(inProps);
20
- const { src, ...rest } = props;
21
- const source = typeof src === "string" ? { uri: src, ...isWeb && { width: props.width, height: props.height } } : src;
22
- return /* @__PURE__ */ jsx(StyledImage, { source, ...rest });
23
- });
19
+ const Image = StyledImage.extractable(
20
+ forwardRef((inProps, ref) => {
21
+ const props = useMediaPropsActive(inProps);
22
+ const { src, ...rest } = props;
23
+ const source = typeof src === "string" ? { uri: src, ...isWeb && { width: props.width, height: props.height } } : src;
24
+ return /* @__PURE__ */ jsx(StyledImage, { ref, source, ...rest });
25
+ })
26
+ );
24
27
  export {
25
28
  Image
26
29
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/Image.tsx"],
4
- "sourcesContent": ["import {\n GetProps,\n RadiusTokens,\n StackProps,\n isWeb,\n setupReactNative,\n styled,\n useMediaPropsActive,\n} from '@tamagui/core'\nimport React from 'react'\nimport { Image as RNImage } from 'react-native'\n\nsetupReactNative({\n Image: RNImage,\n})\n\nconst StyledImage = styled(RNImage, {\n name: 'Image',\n position: 'relative',\n source: { uri: '' },\n zIndex: 1,\n})\n\ntype StyledImageProps = Omit<GetProps<typeof StyledImage>, 'borderRadius'> & {\n borderRadius?: RadiusTokens\n}\n\ntype BaseProps = Omit<\n StyledImageProps,\n 'source' | 'width' | 'height' | 'style' | 'onLayout'\n> & {\n width: number | string\n height: number | string\n src: string | StyledImageProps['source']\n}\n\nexport type ImageProps = BaseProps & Omit<StackProps, keyof BaseProps>\n\nexport const Image: React.FC<ImageProps> = StyledImage.extractable((inProps) => {\n const props = useMediaPropsActive(inProps)\n const { src, ...rest } = props\n const source =\n typeof src === 'string'\n ? { uri: src, ...(isWeb && { width: props.width, height: props.height }) }\n : src\n\n // must set defaultSource to allow SSR, default it to the same as src\n return <StyledImage source={source} {...(rest as any)} />\n})\n"],
5
- "mappings": "AA+CS;AA/CT;AAAA,EAIE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,SAAS,eAAe;AAEjC,iBAAiB;AAAA,EACf,OAAO;AACT,CAAC;AAED,MAAM,cAAc,OAAO,SAAS;AAAA,EAClC,MAAM;AAAA,EACN,UAAU;AAAA,EACV,QAAQ,EAAE,KAAK,GAAG;AAAA,EAClB,QAAQ;AACV,CAAC;AAiBM,MAAM,QAA8B,YAAY,YAAY,CAAC,YAAY;AAC9E,QAAM,QAAQ,oBAAoB,OAAO;AACzC,QAAM,EAAE,KAAK,GAAG,KAAK,IAAI;AACzB,QAAM,SACJ,OAAO,QAAQ,WACX,EAAE,KAAK,KAAK,GAAI,SAAS,EAAE,OAAO,MAAM,OAAO,QAAQ,MAAM,OAAO,EAAG,IACvE;AAGN,SAAO,oBAAC,eAAY,QAAiB,GAAI,MAAc;AACzD,CAAC;",
4
+ "sourcesContent": ["import {\n GetProps,\n RadiusTokens,\n StackProps,\n isWeb,\n setupReactNative,\n styled,\n useMediaPropsActive,\n} from '@tamagui/core'\nimport React, { forwardRef } from 'react'\nimport { Image as RNImage } from 'react-native'\n\nsetupReactNative({\n Image: RNImage,\n})\n\nconst StyledImage = styled(RNImage, {\n name: 'Image',\n position: 'relative',\n source: { uri: '' },\n zIndex: 1,\n})\n\ntype StyledImageProps = Omit<GetProps<typeof StyledImage>, 'borderRadius'> & {\n borderRadius?: RadiusTokens\n}\n\ntype BaseProps = Omit<\n StyledImageProps,\n 'source' | 'width' | 'height' | 'style' | 'onLayout'\n> & {\n width: number | string\n height: number | string\n src: string | StyledImageProps['source']\n}\n\nexport type ImageProps = BaseProps & Omit<StackProps, keyof BaseProps>\n\nexport const Image: React.FC<ImageProps> = StyledImage.extractable(\n forwardRef((inProps, ref) => {\n const props = useMediaPropsActive(inProps)\n const { src, ...rest } = props\n const source =\n typeof src === 'string'\n ? { uri: src, ...(isWeb && { width: props.width, height: props.height }) }\n : src\n\n // must set defaultSource to allow SSR, default it to the same as src\n return <StyledImage ref={ref} source={source} {...(rest as any)} />\n })\n)\n"],
5
+ "mappings": "AAgDW;AAhDX;AAAA,EAIE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAgB,kBAAkB;AAClC,SAAS,SAAS,eAAe;AAEjC,iBAAiB;AAAA,EACf,OAAO;AACT,CAAC;AAED,MAAM,cAAc,OAAO,SAAS;AAAA,EAClC,MAAM;AAAA,EACN,UAAU;AAAA,EACV,QAAQ,EAAE,KAAK,GAAG;AAAA,EAClB,QAAQ;AACV,CAAC;AAiBM,MAAM,QAA8B,YAAY;AAAA,EACrD,WAAW,CAAC,SAAS,QAAQ;AAC3B,UAAM,QAAQ,oBAAoB,OAAO;AACzC,UAAM,EAAE,KAAK,GAAG,KAAK,IAAI;AACzB,UAAM,SACJ,OAAO,QAAQ,WACX,EAAE,KAAK,KAAK,GAAI,SAAS,EAAE,OAAO,MAAM,OAAO,QAAQ,MAAM,OAAO,EAAG,IACvE;AAGN,WAAO,oBAAC,eAAY,KAAU,QAAiB,GAAI,MAAc;AAAA,EACnE,CAAC;AACH;",
6
6
  "names": []
7
7
  }
package/dist/jsx/Image.js CHANGED
@@ -4,6 +4,7 @@ import {
4
4
  styled,
5
5
  useMediaPropsActive
6
6
  } from "@tamagui/core";
7
+ import { forwardRef } from "react";
7
8
  import { Image as RNImage } from "react-native";
8
9
  setupReactNative({
9
10
  Image: RNImage
@@ -14,12 +15,14 @@ const StyledImage = styled(RNImage, {
14
15
  source: { uri: "" },
15
16
  zIndex: 1
16
17
  });
17
- const Image = StyledImage.extractable((inProps) => {
18
- const props = useMediaPropsActive(inProps);
19
- const { src, ...rest } = props;
20
- const source = typeof src === "string" ? { uri: src, ...isWeb && { width: props.width, height: props.height } } : src;
21
- return <StyledImage source={source} {...rest} />;
22
- });
18
+ const Image = StyledImage.extractable(
19
+ forwardRef((inProps, ref) => {
20
+ const props = useMediaPropsActive(inProps);
21
+ const { src, ...rest } = props;
22
+ const source = typeof src === "string" ? { uri: src, ...isWeb && { width: props.width, height: props.height } } : src;
23
+ return <StyledImage ref={ref} source={source} {...rest} />;
24
+ })
25
+ );
23
26
  export {
24
27
  Image
25
28
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/Image.tsx"],
4
- "sourcesContent": ["import {\n GetProps,\n RadiusTokens,\n StackProps,\n isWeb,\n setupReactNative,\n styled,\n useMediaPropsActive,\n} from '@tamagui/core'\nimport React from 'react'\nimport { Image as RNImage } from 'react-native'\n\nsetupReactNative({\n Image: RNImage,\n})\n\nconst StyledImage = styled(RNImage, {\n name: 'Image',\n position: 'relative',\n source: { uri: '' },\n zIndex: 1,\n})\n\ntype StyledImageProps = Omit<GetProps<typeof StyledImage>, 'borderRadius'> & {\n borderRadius?: RadiusTokens\n}\n\ntype BaseProps = Omit<\n StyledImageProps,\n 'source' | 'width' | 'height' | 'style' | 'onLayout'\n> & {\n width: number | string\n height: number | string\n src: string | StyledImageProps['source']\n}\n\nexport type ImageProps = BaseProps & Omit<StackProps, keyof BaseProps>\n\nexport const Image: React.FC<ImageProps> = StyledImage.extractable((inProps) => {\n const props = useMediaPropsActive(inProps)\n const { src, ...rest } = props\n const source =\n typeof src === 'string'\n ? { uri: src, ...(isWeb && { width: props.width, height: props.height }) }\n : src\n\n // must set defaultSource to allow SSR, default it to the same as src\n return <StyledImage source={source} {...(rest as any)} />\n})\n"],
5
- "mappings": "AAAA;AAAA,EAIE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,SAAS,eAAe;AAEjC,iBAAiB;AAAA,EACf,OAAO;AACT,CAAC;AAED,MAAM,cAAc,OAAO,SAAS;AAAA,EAClC,MAAM;AAAA,EACN,UAAU;AAAA,EACV,QAAQ,EAAE,KAAK,GAAG;AAAA,EAClB,QAAQ;AACV,CAAC;AAiBM,MAAM,QAA8B,YAAY,YAAY,CAAC,YAAY;AAC9E,QAAM,QAAQ,oBAAoB,OAAO;AACzC,QAAM,EAAE,KAAK,GAAG,KAAK,IAAI;AACzB,QAAM,SACJ,OAAO,QAAQ,WACX,EAAE,KAAK,KAAK,GAAI,SAAS,EAAE,OAAO,MAAM,OAAO,QAAQ,MAAM,OAAO,EAAG,IACvE;AAGN,SAAO,CAAC,YAAY,QAAQ,YAAa,MAAc;AACzD,CAAC;",
4
+ "sourcesContent": ["import {\n GetProps,\n RadiusTokens,\n StackProps,\n isWeb,\n setupReactNative,\n styled,\n useMediaPropsActive,\n} from '@tamagui/core'\nimport React, { forwardRef } from 'react'\nimport { Image as RNImage } from 'react-native'\n\nsetupReactNative({\n Image: RNImage,\n})\n\nconst StyledImage = styled(RNImage, {\n name: 'Image',\n position: 'relative',\n source: { uri: '' },\n zIndex: 1,\n})\n\ntype StyledImageProps = Omit<GetProps<typeof StyledImage>, 'borderRadius'> & {\n borderRadius?: RadiusTokens\n}\n\ntype BaseProps = Omit<\n StyledImageProps,\n 'source' | 'width' | 'height' | 'style' | 'onLayout'\n> & {\n width: number | string\n height: number | string\n src: string | StyledImageProps['source']\n}\n\nexport type ImageProps = BaseProps & Omit<StackProps, keyof BaseProps>\n\nexport const Image: React.FC<ImageProps> = StyledImage.extractable(\n forwardRef((inProps, ref) => {\n const props = useMediaPropsActive(inProps)\n const { src, ...rest } = props\n const source =\n typeof src === 'string'\n ? { uri: src, ...(isWeb && { width: props.width, height: props.height }) }\n : src\n\n // must set defaultSource to allow SSR, default it to the same as src\n return <StyledImage ref={ref} source={source} {...(rest as any)} />\n })\n)\n"],
5
+ "mappings": "AAAA;AAAA,EAIE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAgB,kBAAkB;AAClC,SAAS,SAAS,eAAe;AAEjC,iBAAiB;AAAA,EACf,OAAO;AACT,CAAC;AAED,MAAM,cAAc,OAAO,SAAS;AAAA,EAClC,MAAM;AAAA,EACN,UAAU;AAAA,EACV,QAAQ,EAAE,KAAK,GAAG;AAAA,EAClB,QAAQ;AACV,CAAC;AAiBM,MAAM,QAA8B,YAAY;AAAA,EACrD,WAAW,CAAC,SAAS,QAAQ;AAC3B,UAAM,QAAQ,oBAAoB,OAAO;AACzC,UAAM,EAAE,KAAK,GAAG,KAAK,IAAI;AACzB,UAAM,SACJ,OAAO,QAAQ,WACX,EAAE,KAAK,KAAK,GAAI,SAAS,EAAE,OAAO,MAAM,OAAO,QAAQ,MAAM,OAAO,EAAG,IACvE;AAGN,WAAO,CAAC,YAAY,KAAK,KAAK,QAAQ,YAAa,MAAc;AAAA,EACnE,CAAC;AACH;",
6
6
  "names": []
7
7
  }
@@ -4,6 +4,7 @@ import {
4
4
  styled,
5
5
  useMediaPropsActive
6
6
  } from "@tamagui/core";
7
+ import { forwardRef } from "react";
7
8
  import { Image as RNImage } from "react-native";
8
9
  setupReactNative({
9
10
  Image: RNImage
@@ -14,12 +15,14 @@ const StyledImage = styled(RNImage, {
14
15
  source: { uri: "" },
15
16
  zIndex: 1
16
17
  });
17
- const Image = StyledImage.extractable((inProps) => {
18
- const props = useMediaPropsActive(inProps);
19
- const { src, ...rest } = props;
20
- const source = typeof src === "string" ? { uri: src, ...isWeb && { width: props.width, height: props.height } } : src;
21
- return <StyledImage source={source} {...rest} />;
22
- });
18
+ const Image = StyledImage.extractable(
19
+ forwardRef((inProps, ref) => {
20
+ const props = useMediaPropsActive(inProps);
21
+ const { src, ...rest } = props;
22
+ const source = typeof src === "string" ? { uri: src, ...isWeb && { width: props.width, height: props.height } } : src;
23
+ return <StyledImage ref={ref} source={source} {...rest} />;
24
+ })
25
+ );
23
26
  export {
24
27
  Image
25
28
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/Image.tsx"],
4
- "sourcesContent": ["import {\n GetProps,\n RadiusTokens,\n StackProps,\n isWeb,\n setupReactNative,\n styled,\n useMediaPropsActive,\n} from '@tamagui/core'\nimport React from 'react'\nimport { Image as RNImage } from 'react-native'\n\nsetupReactNative({\n Image: RNImage,\n})\n\nconst StyledImage = styled(RNImage, {\n name: 'Image',\n position: 'relative',\n source: { uri: '' },\n zIndex: 1,\n})\n\ntype StyledImageProps = Omit<GetProps<typeof StyledImage>, 'borderRadius'> & {\n borderRadius?: RadiusTokens\n}\n\ntype BaseProps = Omit<\n StyledImageProps,\n 'source' | 'width' | 'height' | 'style' | 'onLayout'\n> & {\n width: number | string\n height: number | string\n src: string | StyledImageProps['source']\n}\n\nexport type ImageProps = BaseProps & Omit<StackProps, keyof BaseProps>\n\nexport const Image: React.FC<ImageProps> = StyledImage.extractable((inProps) => {\n const props = useMediaPropsActive(inProps)\n const { src, ...rest } = props\n const source =\n typeof src === 'string'\n ? { uri: src, ...(isWeb && { width: props.width, height: props.height }) }\n : src\n\n // must set defaultSource to allow SSR, default it to the same as src\n return <StyledImage source={source} {...(rest as any)} />\n})\n"],
5
- "mappings": "AAAA;AAAA,EAIE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,SAAS,eAAe;AAEjC,iBAAiB;AAAA,EACf,OAAO;AACT,CAAC;AAED,MAAM,cAAc,OAAO,SAAS;AAAA,EAClC,MAAM;AAAA,EACN,UAAU;AAAA,EACV,QAAQ,EAAE,KAAK,GAAG;AAAA,EAClB,QAAQ;AACV,CAAC;AAiBM,MAAM,QAA8B,YAAY,YAAY,CAAC,YAAY;AAC9E,QAAM,QAAQ,oBAAoB,OAAO;AACzC,QAAM,EAAE,KAAK,GAAG,KAAK,IAAI;AACzB,QAAM,SACJ,OAAO,QAAQ,WACX,EAAE,KAAK,KAAK,GAAI,SAAS,EAAE,OAAO,MAAM,OAAO,QAAQ,MAAM,OAAO,EAAG,IACvE;AAGN,SAAO,CAAC,YAAY,QAAQ,YAAa,MAAc;AACzD,CAAC;",
4
+ "sourcesContent": ["import {\n GetProps,\n RadiusTokens,\n StackProps,\n isWeb,\n setupReactNative,\n styled,\n useMediaPropsActive,\n} from '@tamagui/core'\nimport React, { forwardRef } from 'react'\nimport { Image as RNImage } from 'react-native'\n\nsetupReactNative({\n Image: RNImage,\n})\n\nconst StyledImage = styled(RNImage, {\n name: 'Image',\n position: 'relative',\n source: { uri: '' },\n zIndex: 1,\n})\n\ntype StyledImageProps = Omit<GetProps<typeof StyledImage>, 'borderRadius'> & {\n borderRadius?: RadiusTokens\n}\n\ntype BaseProps = Omit<\n StyledImageProps,\n 'source' | 'width' | 'height' | 'style' | 'onLayout'\n> & {\n width: number | string\n height: number | string\n src: string | StyledImageProps['source']\n}\n\nexport type ImageProps = BaseProps & Omit<StackProps, keyof BaseProps>\n\nexport const Image: React.FC<ImageProps> = StyledImage.extractable(\n forwardRef((inProps, ref) => {\n const props = useMediaPropsActive(inProps)\n const { src, ...rest } = props\n const source =\n typeof src === 'string'\n ? { uri: src, ...(isWeb && { width: props.width, height: props.height }) }\n : src\n\n // must set defaultSource to allow SSR, default it to the same as src\n return <StyledImage ref={ref} source={source} {...(rest as any)} />\n })\n)\n"],
5
+ "mappings": "AAAA;AAAA,EAIE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAgB,kBAAkB;AAClC,SAAS,SAAS,eAAe;AAEjC,iBAAiB;AAAA,EACf,OAAO;AACT,CAAC;AAED,MAAM,cAAc,OAAO,SAAS;AAAA,EAClC,MAAM;AAAA,EACN,UAAU;AAAA,EACV,QAAQ,EAAE,KAAK,GAAG;AAAA,EAClB,QAAQ;AACV,CAAC;AAiBM,MAAM,QAA8B,YAAY;AAAA,EACrD,WAAW,CAAC,SAAS,QAAQ;AAC3B,UAAM,QAAQ,oBAAoB,OAAO;AACzC,UAAM,EAAE,KAAK,GAAG,KAAK,IAAI;AACzB,UAAM,SACJ,OAAO,QAAQ,WACX,EAAE,KAAK,KAAK,GAAI,SAAS,EAAE,OAAO,MAAM,OAAO,QAAQ,MAAM,OAAO,EAAG,IACvE;AAGN,WAAO,CAAC,YAAY,KAAK,KAAK,QAAQ,YAAa,MAAc;AAAA,EACnE,CAAC;AACH;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/image",
3
- "version": "1.9.5",
3
+ "version": "1.9.7",
4
4
  "sideEffects": [
5
5
  "*.css"
6
6
  ],
@@ -23,14 +23,14 @@
23
23
  "clean:build": "tamagui-build clean:build"
24
24
  },
25
25
  "dependencies": {
26
- "@tamagui/core": "1.9.5"
26
+ "@tamagui/core": "1.9.7"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "react": "*",
30
30
  "react-native": "*"
31
31
  },
32
32
  "devDependencies": {
33
- "@tamagui/build": "1.9.5",
33
+ "@tamagui/build": "1.9.7",
34
34
  "react": "^18.2.0",
35
35
  "react-native": "^0.71.4"
36
36
  },
package/src/Image.tsx CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  styled,
8
8
  useMediaPropsActive,
9
9
  } from '@tamagui/core'
10
- import React from 'react'
10
+ import React, { forwardRef } from 'react'
11
11
  import { Image as RNImage } from 'react-native'
12
12
 
13
13
  setupReactNative({
@@ -36,14 +36,16 @@ type BaseProps = Omit<
36
36
 
37
37
  export type ImageProps = BaseProps & Omit<StackProps, keyof BaseProps>
38
38
 
39
- export const Image: React.FC<ImageProps> = StyledImage.extractable((inProps) => {
40
- const props = useMediaPropsActive(inProps)
41
- const { src, ...rest } = props
42
- const source =
43
- typeof src === 'string'
44
- ? { uri: src, ...(isWeb && { width: props.width, height: props.height }) }
45
- : src
39
+ export const Image: React.FC<ImageProps> = StyledImage.extractable(
40
+ forwardRef((inProps, ref) => {
41
+ const props = useMediaPropsActive(inProps)
42
+ const { src, ...rest } = props
43
+ const source =
44
+ typeof src === 'string'
45
+ ? { uri: src, ...(isWeb && { width: props.width, height: props.height }) }
46
+ : src
46
47
 
47
- // must set defaultSource to allow SSR, default it to the same as src
48
- return <StyledImage source={source} {...(rest as any)} />
49
- })
48
+ // must set defaultSource to allow SSR, default it to the same as src
49
+ return <StyledImage ref={ref} source={source} {...(rest as any)} />
50
+ })
51
+ )
@@ -1 +1 @@
1
- {"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../src/Image.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,UAAU,EAKX,MAAM,eAAe,CAAA;AACtB,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,QAAA,MAAM,WAAW;;;;;;;;EAKf,CAAA;AAEF,KAAK,gBAAgB,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,WAAW,CAAC,EAAE,cAAc,CAAC,GAAG;IAC3E,YAAY,CAAC,EAAE,YAAY,CAAA;CAC5B,CAAA;AAED,KAAK,SAAS,GAAG,IAAI,CACnB,gBAAgB,EAChB,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,UAAU,CACrD,GAAG;IACF,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;IACtB,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAA;CACzC,CAAA;AAED,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,IAAI,CAAC,UAAU,EAAE,MAAM,SAAS,CAAC,CAAA;AAEtE,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAUrC,CAAA"}
1
+ {"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../src/Image.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,UAAU,EAKX,MAAM,eAAe,CAAA;AACtB,OAAO,KAAqB,MAAM,OAAO,CAAA;AAOzC,QAAA,MAAM,WAAW;;;;;;;;EAKf,CAAA;AAEF,KAAK,gBAAgB,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,WAAW,CAAC,EAAE,cAAc,CAAC,GAAG;IAC3E,YAAY,CAAC,EAAE,YAAY,CAAA;CAC5B,CAAA;AAED,KAAK,SAAS,GAAG,IAAI,CACnB,gBAAgB,EAChB,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,UAAU,CACrD,GAAG;IACF,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;IACtB,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAA;CACzC,CAAA;AAED,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,IAAI,CAAC,UAAU,EAAE,MAAM,SAAS,CAAC,CAAA;AAEtE,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAYtC,CAAA"}