@sendbird/uikit-react-native-foundation 3.4.2 → 3.4.3

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.
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
+ var _reactNative = require("react-native");
8
9
  var _FastImageInternal = _interopRequireDefault(require("./FastImageInternal"));
9
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
11
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
@@ -59,8 +60,20 @@ const Image_FastImage = _ref => {
59
60
  onLoad,
60
61
  onError,
61
62
  style,
63
+ tintColor,
64
+ disableFastImage,
62
65
  ...props
63
66
  } = _ref;
67
+ if (disableFastImage) {
68
+ return /*#__PURE__*/_react.default.createElement(_reactNative.Image, _extends({}, props, {
69
+ source: source,
70
+ style: [style, {
71
+ tintColor
72
+ }],
73
+ onError: onError && (e => onError(e.nativeEvent)),
74
+ onLoad: onLoad && (e => onLoad(e.nativeEvent.source))
75
+ }));
76
+ }
64
77
  return /*#__PURE__*/_react.default.createElement(_FastImageInternal.default, _extends({}, props, {
65
78
  onLoad: onLoad && (e => onLoad(e.nativeEvent)),
66
79
  onError: onError && (() => onError({})),
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_FastImageInternal","obj","__esModule","default","_extends","Object","assign","bind","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","convertCache","cache","convertSource","Array","isArray","uri","headers","convertDefaultSource","undefined","convertResizeMode","mode","Image_FastImage","_ref","defaultSource","resizeMode","onLoad","onError","style","props","createElement","e","nativeEvent","_default","exports"],"sources":["Image.fastimage.tsx"],"sourcesContent":["import React from 'react';\nimport type { FastImageProps, ResizeMode, Source } from 'react-native-fast-image';\n\nimport FastImageInternal from './FastImageInternal';\nimport type { SendbirdImageComponent, SendbirdImageProps } from './index';\n\nfunction convertCache(\n cache?: 'default' | 'reload' | 'force-cache' | 'only-if-cached' | undefined,\n): 'immutable' | 'web' | 'cacheOnly' {\n switch (cache) {\n case 'force-cache':\n case 'only-if-cached':\n return 'cacheOnly';\n default:\n return 'immutable';\n }\n}\n\nfunction convertSource(source: SendbirdImageProps['source']): Source | number {\n if (Array.isArray(source)) {\n return convertSource(source[0]);\n }\n\n if (typeof source === 'number') {\n return source;\n }\n\n return {\n uri: source.uri,\n headers: source.headers,\n cache: convertCache(source.cache), //'immutable' | 'web' | 'cacheOnly'\n };\n}\nfunction convertDefaultSource(source?: SendbirdImageProps['defaultSource']): number | undefined {\n if (typeof source === 'number') {\n return source;\n }\n\n return undefined;\n}\n\nfunction convertResizeMode(mode?: SendbirdImageProps['resizeMode']): ResizeMode | undefined {\n switch (mode) {\n case 'center':\n return 'center';\n case 'contain':\n return 'contain';\n case 'cover':\n return 'cover';\n case 'stretch':\n return 'stretch';\n default:\n return undefined;\n }\n}\n\nconst Image_FastImage: SendbirdImageComponent = ({\n source,\n defaultSource,\n resizeMode,\n onLoad,\n onError,\n style,\n ...props\n}) => {\n return (\n <FastImageInternal\n {...props}\n onLoad={onLoad && ((e) => onLoad(e.nativeEvent))}\n onError={onError && (() => onError({}))}\n style={style as FastImageProps['style']}\n source={convertSource(source)}\n defaultSource={convertDefaultSource(defaultSource)}\n resizeMode={convertResizeMode(resizeMode)}\n />\n );\n};\n\nexport default Image_FastImage;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,IAAAC,kBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAAoD,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,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AK,SAAS;MACZ,OAAO,SAAS;IAClB,KAAK,OAAO;MACV,OAAO,OAAO;IAChB,KAAK,SAAS;MACZ,OAAO,SAAS;IAClB;MACE,OAAOF,SAAS;EAAC;AAEvB;AAEA,MAAMG,eAAuC,GAAGC,IAAA,IAQ1C;EAAA,IAR2C;IAC/ClB,MAAM;IACNmB,aAAa;IACbC,UAAU;IACVC,MAAM;IACNC,OAAO;IACPC,KAAK;IACL,GAAGC;EACL,CAAC,GAAAN,IAAA;EACC,oBACEjC,MAAA,CAAAM,OAAA,CAAAkC,aAAA,CAACrC,kBAAA,CAAAG,OAAiB,EAAAC,QAAA,KACZgC,KAAK;IACTH,MAAM,EAAEA,MAAM,KAAMK,CAAC,IAAKL,MAAM,CAACK,CAAC,CAACC,WAAW,CAAC,CAAE;IACjDL,OAAO,EAAEA,OAAO,KAAK,MAAMA,OAAO,CAAC,CAAC,CAAC,CAAC,CAAE;IACxCC,KAAK,EAAEA,KAAiC;IACxCvB,MAAM,EAAEQ,aAAa,CAACR,MAAM,CAAE;IAC9BmB,aAAa,EAAEN,oBAAoB,CAACM,aAAa,CAAE;IACnDC,UAAU,EAAEL,iBAAiB,CAACK,UAAU;EAAE,GAC1C;AAEN,CAAC;AAAC,IAAAQ,QAAA,GAEaX,eAAe;AAAAY,OAAA,CAAAtC,OAAA,GAAAqC,QAAA"}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_FastImageInternal","obj","__esModule","default","_extends","Object","assign","bind","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","convertCache","cache","convertSource","Array","isArray","uri","headers","convertDefaultSource","undefined","convertResizeMode","mode","Image_FastImage","_ref","defaultSource","resizeMode","onLoad","onError","style","tintColor","disableFastImage","props","createElement","Image","e","nativeEvent","_default","exports"],"sources":["Image.fastimage.tsx"],"sourcesContent":["import React from 'react';\nimport { Image } from 'react-native';\nimport type { FastImageProps, ResizeMode, Source } from 'react-native-fast-image';\n\nimport FastImageInternal from './FastImageInternal';\nimport type { SendbirdImageComponent, SendbirdImageProps } from './index';\n\nfunction convertCache(\n cache?: 'default' | 'reload' | 'force-cache' | 'only-if-cached' | undefined,\n): 'immutable' | 'web' | 'cacheOnly' {\n switch (cache) {\n case 'force-cache':\n case 'only-if-cached':\n return 'cacheOnly';\n default:\n return 'immutable';\n }\n}\n\nfunction convertSource(source: SendbirdImageProps['source']): Source | number {\n if (Array.isArray(source)) {\n return convertSource(source[0]);\n }\n\n if (typeof source === 'number') {\n return source;\n }\n\n return {\n uri: source.uri,\n headers: source.headers,\n cache: convertCache(source.cache), //'immutable' | 'web' | 'cacheOnly'\n };\n}\nfunction convertDefaultSource(source?: SendbirdImageProps['defaultSource']): number | undefined {\n if (typeof source === 'number') {\n return source;\n }\n\n return undefined;\n}\n\nfunction convertResizeMode(mode?: SendbirdImageProps['resizeMode']): ResizeMode | undefined {\n switch (mode) {\n case 'center':\n return 'center';\n case 'contain':\n return 'contain';\n case 'cover':\n return 'cover';\n case 'stretch':\n return 'stretch';\n default:\n return undefined;\n }\n}\n\nconst Image_FastImage: SendbirdImageComponent = ({\n source,\n defaultSource,\n resizeMode,\n onLoad,\n onError,\n style,\n tintColor,\n disableFastImage,\n ...props\n}) => {\n if (disableFastImage) {\n return (\n <Image\n {...props}\n source={source}\n style={[style, { tintColor }]}\n onError={onError && ((e) => onError(e.nativeEvent))}\n onLoad={onLoad && ((e) => onLoad(e.nativeEvent.source))}\n />\n );\n }\n return (\n <FastImageInternal\n {...props}\n onLoad={onLoad && ((e) => onLoad(e.nativeEvent))}\n onError={onError && (() => onError({}))}\n style={style as FastImageProps['style']}\n source={convertSource(source)}\n defaultSource={convertDefaultSource(defaultSource)}\n resizeMode={convertResizeMode(resizeMode)}\n />\n );\n};\n\nexport default Image_FastImage;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAGA,IAAAE,kBAAA,GAAAH,sBAAA,CAAAC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oBAAoB,CAACM,aAAa,CAAE;IACnDC,UAAU,EAAEL,iBAAiB,CAACK,UAAU;EAAE,GAC1C;AAEN,CAAC;AAAC,IAAAW,QAAA,GAEad,eAAe;AAAAe,OAAA,CAAAzC,OAAA,GAAAwC,QAAA"}
@@ -17,6 +17,10 @@ function getImageModule() {
17
17
  return require('./Image.reactnative').default;
18
18
  }
19
19
  }
20
- var _default = getImageModule();
20
+ const Image = getImageModule();
21
+ Image.defaultProps = {
22
+ disableFastImage: false
23
+ };
24
+ var _default = Image;
21
25
  exports.default = _default;
22
26
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","getImageModule","hasFastImage","Boolean","NativeModules","FastImageView","default","e","_default","exports"],"sources":["index.ts"],"sourcesContent":["import { ReactNode } from 'react';\nimport type { ImageProps as NativeImageProps } from 'react-native';\nimport { NativeModules } from 'react-native';\n\nexport interface SendbirdImageProps extends Omit<NativeImageProps, 'onLoad' | 'onError'> {\n onLoad?: (event: { width: number; height: number }) => void;\n onError?: (event: { error?: unknown }) => void;\n tintColor?: string;\n}\n\nexport type SendbirdImageComponent = (props: SendbirdImageProps) => ReactNode;\n\nfunction getImageModule(): SendbirdImageComponent {\n const hasFastImage = Boolean(NativeModules.FastImageView);\n if (hasFastImage) {\n try {\n return require('./Image.fastimage').default;\n } catch (e) {\n return require('./Image.reactnative').default;\n }\n } else {\n return require('./Image.reactnative').default;\n }\n}\n\nexport default getImageModule();\n"],"mappings":";;;;;;AAEA,IAAAA,YAAA,GAAAC,OAAA;AAUA,SAASC,cAAcA,CAAA,EAA2B;EAChD,MAAMC,YAAY,GAAGC,OAAO,CAACC,0BAAa,CAACC,aAAa,CAAC;EACzD,IAAIH,YAAY,EAAE;IAChB,IAAI;MACF,OAAOF,OAAO,CAAC,mBAAmB,CAAC,CAACM,OAAO;IAC7C,CAAC,CAAC,OAAOC,CAAC,EAAE;MACV,OAAOP,OAAO,CAAC,qBAAqB,CAAC,CAACM,OAAO;IAC/C;EACF,CAAC,MAAM;IACL,OAAON,OAAO,CAAC,qBAAqB,CAAC,CAACM,OAAO;EAC/C;AACF;AAAC,IAAAE,QAAA,GAEcP,cAAc,EAAE;AAAAQ,OAAA,CAAAH,OAAA,GAAAE,QAAA"}
1
+ {"version":3,"names":["_reactNative","require","getImageModule","hasFastImage","Boolean","NativeModules","FastImageView","default","e","Image","defaultProps","disableFastImage","_default","exports"],"sources":["index.ts"],"sourcesContent":["import { ComponentType } from 'react';\nimport type { ImageProps as NativeImageProps } from 'react-native';\nimport { NativeModules } from 'react-native';\n\nexport interface SendbirdImageProps extends Omit<NativeImageProps, 'onLoad' | 'onError'> {\n disableFastImage?: boolean;\n onLoad?: (event: { width: number; height: number }) => void;\n onError?: (event: { error?: unknown }) => void;\n tintColor?: string;\n}\n\nexport type SendbirdImageComponent = ComponentType<SendbirdImageProps>;\nfunction getImageModule(): SendbirdImageComponent {\n const hasFastImage = Boolean(NativeModules.FastImageView);\n if (hasFastImage) {\n try {\n return require('./Image.fastimage').default;\n } catch (e) {\n return require('./Image.reactnative').default;\n }\n } else {\n return require('./Image.reactnative').default;\n }\n}\n\nconst Image = getImageModule();\n\nImage.defaultProps = {\n disableFastImage: false,\n};\n\nexport default Image;\n"],"mappings":";;;;;;AAEA,IAAAA,YAAA,GAAAC,OAAA;AAUA,SAASC,cAAcA,CAAA,EAA2B;EAChD,MAAMC,YAAY,GAAGC,OAAO,CAACC,0BAAa,CAACC,aAAa,CAAC;EACzD,IAAIH,YAAY,EAAE;IAChB,IAAI;MACF,OAAOF,OAAO,CAAC,mBAAmB,CAAC,CAACM,OAAO;IAC7C,CAAC,CAAC,OAAOC,CAAC,EAAE;MACV,OAAOP,OAAO,CAAC,qBAAqB,CAAC,CAACM,OAAO;IAC/C;EACF,CAAC,MAAM;IACL,OAAON,OAAO,CAAC,qBAAqB,CAAC,CAACM,OAAO;EAC/C;AACF;AAEA,MAAME,KAAK,GAAGP,cAAc,EAAE;AAE9BO,KAAK,CAACC,YAAY,GAAG;EACnBC,gBAAgB,EAAE;AACpB,CAAC;AAAC,IAAAC,QAAA,GAEaH,KAAK;AAAAI,OAAA,CAAAN,OAAA,GAAAK,QAAA"}
@@ -1,5 +1,6 @@
1
1
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
  import React from 'react';
3
+ import { Image } from 'react-native';
3
4
  import FastImageInternal from './FastImageInternal';
4
5
  function convertCache(cache) {
5
6
  switch (cache) {
@@ -52,8 +53,20 @@ const Image_FastImage = _ref => {
52
53
  onLoad,
53
54
  onError,
54
55
  style,
56
+ tintColor,
57
+ disableFastImage,
55
58
  ...props
56
59
  } = _ref;
60
+ if (disableFastImage) {
61
+ return /*#__PURE__*/React.createElement(Image, _extends({}, props, {
62
+ source: source,
63
+ style: [style, {
64
+ tintColor
65
+ }],
66
+ onError: onError && (e => onError(e.nativeEvent)),
67
+ onLoad: onLoad && (e => onLoad(e.nativeEvent.source))
68
+ }));
69
+ }
57
70
  return /*#__PURE__*/React.createElement(FastImageInternal, _extends({}, props, {
58
71
  onLoad: onLoad && (e => onLoad(e.nativeEvent)),
59
72
  onError: onError && (() => onError({})),
@@ -1 +1 @@
1
- {"version":3,"names":["React","FastImageInternal","convertCache","cache","convertSource","source","Array","isArray","uri","headers","convertDefaultSource","undefined","convertResizeMode","mode","Image_FastImage","_ref","defaultSource","resizeMode","onLoad","onError","style","props","createElement","_extends","e","nativeEvent"],"sources":["Image.fastimage.tsx"],"sourcesContent":["import React from 'react';\nimport type { FastImageProps, ResizeMode, Source } from 'react-native-fast-image';\n\nimport FastImageInternal from './FastImageInternal';\nimport type { SendbirdImageComponent, SendbirdImageProps } from './index';\n\nfunction convertCache(\n cache?: 'default' | 'reload' | 'force-cache' | 'only-if-cached' | undefined,\n): 'immutable' | 'web' | 'cacheOnly' {\n switch (cache) {\n case 'force-cache':\n case 'only-if-cached':\n return 'cacheOnly';\n default:\n return 'immutable';\n }\n}\n\nfunction convertSource(source: SendbirdImageProps['source']): Source | number {\n if (Array.isArray(source)) {\n return convertSource(source[0]);\n }\n\n if (typeof source === 'number') {\n return source;\n }\n\n return {\n uri: source.uri,\n headers: source.headers,\n cache: convertCache(source.cache), //'immutable' | 'web' | 'cacheOnly'\n };\n}\nfunction convertDefaultSource(source?: SendbirdImageProps['defaultSource']): number | undefined {\n if (typeof source === 'number') {\n return source;\n }\n\n return undefined;\n}\n\nfunction convertResizeMode(mode?: SendbirdImageProps['resizeMode']): ResizeMode | undefined {\n switch (mode) {\n case 'center':\n return 'center';\n case 'contain':\n return 'contain';\n case 'cover':\n return 'cover';\n case 'stretch':\n return 'stretch';\n default:\n return undefined;\n }\n}\n\nconst Image_FastImage: SendbirdImageComponent = ({\n source,\n defaultSource,\n resizeMode,\n onLoad,\n onError,\n style,\n ...props\n}) => {\n return (\n <FastImageInternal\n {...props}\n onLoad={onLoad && ((e) => onLoad(e.nativeEvent))}\n onError={onError && (() => onError({}))}\n style={style as FastImageProps['style']}\n source={convertSource(source)}\n defaultSource={convertDefaultSource(defaultSource)}\n resizeMode={convertResizeMode(resizeMode)}\n />\n );\n};\n\nexport default Image_FastImage;\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AAGzB,OAAOC,iBAAiB,MAAM,qBAAqB;AAGnD,SAASC,YAAYA,CACnBC,KAA2E,EACxC;EACnC,QAAQA,KAAK;IACX,KAAK,aAAa;IAClB,KAAK,gBAAgB;MACnB,OAAO,WAAW;IACpB;MACE,OAAO,WAAW;EAAC;AAEzB;AAEA,SAASC,aAAaA,CAACC,MAAoC,EAAmB;EAC5E,IAAIC,KAAK,CAACC,OAAO,CAACF,MAAM,CAAC,EAAE;IACzB,OAAOD,aAAa,CAACC,MAAM,CAAC,CAAC,CAAC,CAAC;EACjC;EAEA,IAAI,OAAOA,MAAM,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al","convertCache","cache","convertSource","source","Array","isArray","uri","headers","convertDefaultSource","undefined","convertResizeMode","mode","Image_FastImage","_ref","defaultSource","resizeMode","onLoad","onError","style","tintColor","disableFastImage","props","createElement","_extends","e","nativeEvent"],"sources":["Image.fastimage.tsx"],"sourcesContent":["import React from 'react';\nimport { Image } from 'react-native';\nimport type { FastImageProps, ResizeMode, Source } from 'react-native-fast-image';\n\nimport FastImageInternal from './FastImageInternal';\nimport type { SendbirdImageComponent, SendbirdImageProps } from './index';\n\nfunction convertCache(\n cache?: 'default' | 'reload' | 'force-cache' | 'only-if-cached' | undefined,\n): 'immutable' | 'web' | 'cacheOnly' {\n switch (cache) {\n case 'force-cache':\n case 'only-if-cached':\n return 'cacheOnly';\n default:\n return 'immutable';\n }\n}\n\nfunction convertSource(source: SendbirdImageProps['source']): Source | number {\n if (Array.isArray(source)) {\n return convertSource(source[0]);\n }\n\n if (typeof source === 'number') {\n return source;\n }\n\n return {\n uri: source.uri,\n headers: source.headers,\n cache: convertCache(source.cache), //'immutable' | 'web' | 'cacheOnly'\n };\n}\nfunction convertDefaultSource(source?: SendbirdImageProps['defaultSource']): number | undefined {\n if (typeof source === 'number') {\n return source;\n }\n\n return undefined;\n}\n\nfunction convertResizeMode(mode?: SendbirdImageProps['resizeMode']): ResizeMode | undefined {\n switch (mode) {\n case 'center':\n return 'center';\n case 'contain':\n return 'contain';\n case 'cover':\n return 'cover';\n case 'stretch':\n return 'stretch';\n default:\n return undefined;\n }\n}\n\nconst Image_FastImage: SendbirdImageComponent = ({\n source,\n defaultSource,\n resizeMode,\n onLoad,\n onError,\n style,\n tintColor,\n disableFastImage,\n ...props\n}) => {\n if (disableFastImage) {\n return (\n <Image\n {...props}\n source={source}\n style={[style, { tintColor }]}\n onError={onError && ((e) => onError(e.nativeEvent))}\n onLoad={onLoad && ((e) => onLoad(e.nativeEvent.source))}\n />\n );\n }\n return (\n <FastImageInternal\n {...props}\n onLoad={onLoad && ((e) => onLoad(e.nativeEvent))}\n onError={onError && (() => onError({}))}\n style={style as FastImageProps['style']}\n source={convertSource(source)}\n defaultSource={convertDefaultSource(defaultSource)}\n resizeMode={convertResizeMode(resizeMode)}\n />\n );\n};\n\nexport default Image_FastImage;\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,KAAK,QAAQ,cAAc;AAGpC,OAAOC,iBAAiB,MAAM,qBAAqB;AAGnD,SAASC,YAAYA,CACnBC,KAA2E,EACxC;EACnC,QAAQA,KAAK;IACX,KAAK,aAAa;IAClB,KAAK,gBAAgB;MACnB,OAAO,WAAW;IACpB;MACE,OAAO,WAAW;EAAC;AAEzB;AAEA,SAASC,aAAaA,CAACC,MAAoC,EAAmB;EAC5E,IAAIC,KAAK,CAACC,OAAO,CAACF,MAAM,CAAC,EAAE;IACzB,OAAOD,aAAa,CAACC,MAAM,CAAC,CAAC,CAAC,CAAC;EACjC;EAEA,IAAI,OAAOA,MAAM,KAAK,QAAQ,EAAE;IAC9B,OAAOA,MAAM;EACf;EAEA,OAAO;IACLG,GAAG,EAAEH,MAAM,CAACG,GAAG;IACfC,OAAO,EAAEJ,MAAM,CAACI,OAAO;IACvBN,KAAK,EAAED,YAAY,CAACG,MAAM,CAACF,KAAK,CAAC,CAAE;EACrC,CAAC;AACH;;AACA,SAASO,oBAAoBA,CAACL,MAA4C,EAAsB;EAC9F,IAAI,OAAOA,MAAM,KAAK,QAAQ,EAAE;IAC9B,OAAOA,MAAM;EACf;EAEA,OAAOM,SAAS;AAClB;AAEA,SAASC,iBAAiBA,CAACC,IAAuC,EAA0B;EAC1F,QAAQA,IAAI;IACV,KAAK,QAAQ;MACX,OAAO,QAAQ;IACjB,KAAK,SAAS;MACZ,OAAO,SAAS;IAClB,KAAK,OAAO;MACV,OAAO,OAAO;IAChB,KAAK,SAAS;MACZ,OAAO,SAAS;IAClB;MACE,OAAOF,SAAS;EAAC;AAEvB;AAEA,MAAMG,eAAuC,GAAGC,IAAA,IAU1C;EAAA,IAV2C;IAC/CV,MAAM;IACNW,aAAa;IACbC,UAAU;IACVC,MAAM;IACNC,OAAO;IACPC,KAAK;IACLC,SAAS;IACTC,gBAAgB;IAChB,GAAGC;EACL,CAAC,GAAAR,IAAA;EACC,IAAIO,gBAAgB,EAAE;IACpB,oBACEvB,KAAA,CAAAyB,aAAA,CAACxB,KAAK,EAAAyB,QAAA,KACAF,KAAK;MACTlB,MAAM,EAAEA,MAAO;MACfe,KAAK,EAAE,CAACA,KAAK,EAAE;QAAEC;MAAU,CAAC,CAAE;MAC9BF,OAAO,EAAEA,OAAO,KAAMO,CAAC,IAAKP,OAAO,CAACO,CAAC,CAACC,WAAW,CAAC,CAAE;MACpDT,MAAM,EAAEA,MAAM,KAAMQ,CAAC,IAAKR,MAAM,CAACQ,CAAC,CAACC,WAAW,CAACtB,MAAM,CAAC;IAAE,GACxD;EAEN;EACA,oBACEN,KAAA,CAAAyB,aAAA,CAACvB,iBAAiB,EAAAwB,QAAA,KACZF,KAAK;IACTL,MAAM,EAAEA,MAAM,KAAMQ,CAAC,IAAKR,MAAM,CAACQ,CAAC,CAACC,WAAW,CAAC,CAAE;IACjDR,OAAO,EAAEA,OAAO,KAAK,MAAMA,OAAO,CAAC,CAAC,CAAC,CAAC,CAAE;IACxCC,KAAK,EAAEA,KAAiC;IACxCf,MAAM,EAAED,aAAa,CAACC,MAAM,CAAE;IAC9BW,aAAa,EAAEN,oBAAoB,CAACM,aAAa,CAAE;IACnDC,UAAU,EAAEL,iBAAiB,CAACK,UAAU;EAAE,GAC1C;AAEN,CAAC;AAED,eAAeH,eAAe"}
@@ -11,5 +11,9 @@ function getImageModule() {
11
11
  return require('./Image.reactnative').default;
12
12
  }
13
13
  }
14
- export default getImageModule();
14
+ const Image = getImageModule();
15
+ Image.defaultProps = {
16
+ disableFastImage: false
17
+ };
18
+ export default Image;
15
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["NativeModules","getImageModule","hasFastImage","Boolean","FastImageView","require","default","e"],"sources":["index.ts"],"sourcesContent":["import { ReactNode } from 'react';\nimport type { ImageProps as NativeImageProps } from 'react-native';\nimport { NativeModules } from 'react-native';\n\nexport interface SendbirdImageProps extends Omit<NativeImageProps, 'onLoad' | 'onError'> {\n onLoad?: (event: { width: number; height: number }) => void;\n onError?: (event: { error?: unknown }) => void;\n tintColor?: string;\n}\n\nexport type SendbirdImageComponent = (props: SendbirdImageProps) => ReactNode;\n\nfunction getImageModule(): SendbirdImageComponent {\n const hasFastImage = Boolean(NativeModules.FastImageView);\n if (hasFastImage) {\n try {\n return require('./Image.fastimage').default;\n } catch (e) {\n return require('./Image.reactnative').default;\n }\n } else {\n return require('./Image.reactnative').default;\n }\n}\n\nexport default getImageModule();\n"],"mappings":"AAEA,SAASA,aAAa,QAAQ,cAAc;AAU5C,SAASC,cAAcA,CAAA,EAA2B;EAChD,MAAMC,YAAY,GAAGC,OAAO,CAACH,aAAa,CAACI,aAAa,CAAC;EACzD,IAAIF,YAAY,EAAE;IAChB,IAAI;MACF,OAAOG,OAAO,CAAC,mBAAmB,CAAC,CAACC,OAAO;IAC7C,CAAC,CAAC,OAAOC,CAAC,EAAE;MACV,OAAOF,OAAO,CAAC,qBAAqB,CAAC,CAACC,OAAO;IAC/C;EACF,CAAC,MAAM;IACL,OAAOD,OAAO,CAAC,qBAAqB,CAAC,CAACC,OAAO;EAC/C;AACF;AAEA,eAAeL,cAAc,EAAE"}
1
+ {"version":3,"names":["NativeModules","getImageModule","hasFastImage","Boolean","FastImageView","require","default","e","Image","defaultProps","disableFastImage"],"sources":["index.ts"],"sourcesContent":["import { ComponentType } from 'react';\nimport type { ImageProps as NativeImageProps } from 'react-native';\nimport { NativeModules } from 'react-native';\n\nexport interface SendbirdImageProps extends Omit<NativeImageProps, 'onLoad' | 'onError'> {\n disableFastImage?: boolean;\n onLoad?: (event: { width: number; height: number }) => void;\n onError?: (event: { error?: unknown }) => void;\n tintColor?: string;\n}\n\nexport type SendbirdImageComponent = ComponentType<SendbirdImageProps>;\nfunction getImageModule(): SendbirdImageComponent {\n const hasFastImage = Boolean(NativeModules.FastImageView);\n if (hasFastImage) {\n try {\n return require('./Image.fastimage').default;\n } catch (e) {\n return require('./Image.reactnative').default;\n }\n } else {\n return require('./Image.reactnative').default;\n }\n}\n\nconst Image = getImageModule();\n\nImage.defaultProps = {\n disableFastImage: false,\n};\n\nexport default Image;\n"],"mappings":"AAEA,SAASA,aAAa,QAAQ,cAAc;AAU5C,SAASC,cAAcA,CAAA,EAA2B;EAChD,MAAMC,YAAY,GAAGC,OAAO,CAACH,aAAa,CAACI,aAAa,CAAC;EACzD,IAAIF,YAAY,EAAE;IAChB,IAAI;MACF,OAAOG,OAAO,CAAC,mBAAmB,CAAC,CAACC,OAAO;IAC7C,CAAC,CAAC,OAAOC,CAAC,EAAE;MACV,OAAOF,OAAO,CAAC,qBAAqB,CAAC,CAACC,OAAO;IAC/C;EACF,CAAC,MAAM;IACL,OAAOD,OAAO,CAAC,qBAAqB,CAAC,CAACC,OAAO;EAC/C;AACF;AAEA,MAAME,KAAK,GAAGP,cAAc,EAAE;AAE9BO,KAAK,CAACC,YAAY,GAAG;EACnBC,gBAAgB,EAAE;AACpB,CAAC;AAED,eAAeF,KAAK"}
@@ -1,6 +1,7 @@
1
- import { ReactNode } from 'react';
1
+ import { ComponentType } from 'react';
2
2
  import type { ImageProps as NativeImageProps } from 'react-native';
3
3
  export interface SendbirdImageProps extends Omit<NativeImageProps, 'onLoad' | 'onError'> {
4
+ disableFastImage?: boolean;
4
5
  onLoad?: (event: {
5
6
  width: number;
6
7
  height: number;
@@ -10,6 +11,6 @@ export interface SendbirdImageProps extends Omit<NativeImageProps, 'onLoad' | 'o
10
11
  }) => void;
11
12
  tintColor?: string;
12
13
  }
13
- export type SendbirdImageComponent = (props: SendbirdImageProps) => ReactNode;
14
- declare const _default: SendbirdImageComponent;
15
- export default _default;
14
+ export type SendbirdImageComponent = ComponentType<SendbirdImageProps>;
15
+ declare const Image: SendbirdImageComponent;
16
+ export default Image;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sendbird/uikit-react-native-foundation",
3
- "version": "3.4.2",
3
+ "version": "3.4.3",
4
4
  "description": "A foundational UI kit for building chat-enabled React Native apps.",
5
5
  "keywords": [
6
6
  "sendbird",
@@ -48,7 +48,7 @@
48
48
  "access": "public"
49
49
  },
50
50
  "dependencies": {
51
- "@sendbird/uikit-utils": "3.4.2"
51
+ "@sendbird/uikit-utils": "3.4.3"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/react": "*",
@@ -85,5 +85,5 @@
85
85
  ]
86
86
  ]
87
87
  },
88
- "gitHead": "e38806326b5f9c7d351ab270e5b4815707c598fb"
88
+ "gitHead": "8c5b81447c874543ca857457327716375e7b4c66"
89
89
  }
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { Image } from 'react-native';
2
3
  import type { FastImageProps, ResizeMode, Source } from 'react-native-fast-image';
3
4
 
4
5
  import FastImageInternal from './FastImageInternal';
@@ -61,8 +62,21 @@ const Image_FastImage: SendbirdImageComponent = ({
61
62
  onLoad,
62
63
  onError,
63
64
  style,
65
+ tintColor,
66
+ disableFastImage,
64
67
  ...props
65
68
  }) => {
69
+ if (disableFastImage) {
70
+ return (
71
+ <Image
72
+ {...props}
73
+ source={source}
74
+ style={[style, { tintColor }]}
75
+ onError={onError && ((e) => onError(e.nativeEvent))}
76
+ onLoad={onLoad && ((e) => onLoad(e.nativeEvent.source))}
77
+ />
78
+ );
79
+ }
66
80
  return (
67
81
  <FastImageInternal
68
82
  {...props}
@@ -1,15 +1,15 @@
1
- import { ReactNode } from 'react';
1
+ import { ComponentType } from 'react';
2
2
  import type { ImageProps as NativeImageProps } from 'react-native';
3
3
  import { NativeModules } from 'react-native';
4
4
 
5
5
  export interface SendbirdImageProps extends Omit<NativeImageProps, 'onLoad' | 'onError'> {
6
+ disableFastImage?: boolean;
6
7
  onLoad?: (event: { width: number; height: number }) => void;
7
8
  onError?: (event: { error?: unknown }) => void;
8
9
  tintColor?: string;
9
10
  }
10
11
 
11
- export type SendbirdImageComponent = (props: SendbirdImageProps) => ReactNode;
12
-
12
+ export type SendbirdImageComponent = ComponentType<SendbirdImageProps>;
13
13
  function getImageModule(): SendbirdImageComponent {
14
14
  const hasFastImage = Boolean(NativeModules.FastImageView);
15
15
  if (hasFastImage) {
@@ -23,4 +23,10 @@ function getImageModule(): SendbirdImageComponent {
23
23
  }
24
24
  }
25
25
 
26
- export default getImageModule();
26
+ const Image = getImageModule();
27
+
28
+ Image.defaultProps = {
29
+ disableFastImage: false,
30
+ };
31
+
32
+ export default Image;