@amazon-devices/expo-image 2.0.1758683737

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 (289) hide show
  1. package/.eslintrc.js +2 -0
  2. package/CHANGELOG.md +285 -0
  3. package/CMakeLists.txt +91 -0
  4. package/LICENSE +7 -0
  5. package/README.kepler.md +123 -0
  6. package/README.md +54 -0
  7. package/THIRD_PARTY_NOTICES.txt +24 -0
  8. package/android/build.gradle +124 -0
  9. package/android/proguard-rules.pro +28 -0
  10. package/android/src/main/AndroidManifest.xml +15 -0
  11. package/android/src/main/java/expo/modules/image/Exceptions.kt +9 -0
  12. package/android/src/main/java/expo/modules/image/ExpoImageAppGlideModule.kt +19 -0
  13. package/android/src/main/java/expo/modules/image/ExpoImageModule.kt +192 -0
  14. package/android/src/main/java/expo/modules/image/ExpoImageView.kt +220 -0
  15. package/android/src/main/java/expo/modules/image/ExpoImageViewWrapper.kt +652 -0
  16. package/android/src/main/java/expo/modules/image/GlideModel.kt +73 -0
  17. package/android/src/main/java/expo/modules/image/ImageUtils.kt +50 -0
  18. package/android/src/main/java/expo/modules/image/ImageViewWrapperTarget.kt +313 -0
  19. package/android/src/main/java/expo/modules/image/ResourceIdHelper.kt +47 -0
  20. package/android/src/main/java/expo/modules/image/ThumbnailRequestCoordinatorExtension.kt +21 -0
  21. package/android/src/main/java/expo/modules/image/YogaUtils.kt +20 -0
  22. package/android/src/main/java/expo/modules/image/blurhash/BlurHashFetcher.kt +32 -0
  23. package/android/src/main/java/expo/modules/image/blurhash/BlurhashDecoder.kt +189 -0
  24. package/android/src/main/java/expo/modules/image/blurhash/BlurhashModelLoader.kt +30 -0
  25. package/android/src/main/java/expo/modules/image/blurhash/BlurhashModelLoaderFactory.kt +14 -0
  26. package/android/src/main/java/expo/modules/image/blurhash/BlurhashModule.kt +17 -0
  27. package/android/src/main/java/expo/modules/image/dataurls/Base64DataFetcher.kt +27 -0
  28. package/android/src/main/java/expo/modules/image/dataurls/Base64ModelLoader.kt +24 -0
  29. package/android/src/main/java/expo/modules/image/dataurls/Base64ModelLoaderFactory.kt +12 -0
  30. package/android/src/main/java/expo/modules/image/dataurls/Base64Module.kt +16 -0
  31. package/android/src/main/java/expo/modules/image/drawing/OutlineProvider.kt +201 -0
  32. package/android/src/main/java/expo/modules/image/enums/ContentFit.kt +89 -0
  33. package/android/src/main/java/expo/modules/image/enums/ImageCacheType.kt +14 -0
  34. package/android/src/main/java/expo/modules/image/enums/Priority.kt +15 -0
  35. package/android/src/main/java/expo/modules/image/events/GlideRequestListener.kt +64 -0
  36. package/android/src/main/java/expo/modules/image/events/OkHttpProgressListener.kt +26 -0
  37. package/android/src/main/java/expo/modules/image/okhttp/ExpoImageOkHttpClientGlideModule.kt +80 -0
  38. package/android/src/main/java/expo/modules/image/okhttp/GlideUrlWrapperLoader.kt +55 -0
  39. package/android/src/main/java/expo/modules/image/records/CachePolicy.kt +10 -0
  40. package/android/src/main/java/expo/modules/image/records/ContentPosition.kt +89 -0
  41. package/android/src/main/java/expo/modules/image/records/ImageTransition.kt +8 -0
  42. package/android/src/main/java/expo/modules/image/records/SourceMap.kt +160 -0
  43. package/android/src/main/java/expo/modules/image/records/events.kt +25 -0
  44. package/android/src/main/java/expo/modules/image/svg/SVGDecoder.kt +33 -0
  45. package/android/src/main/java/expo/modules/image/svg/SVGDrawableTranscoder.kt +37 -0
  46. package/android/src/main/java/expo/modules/image/svg/SVGModule.kt +26 -0
  47. package/android/src/main/java/expo/modules/image/thumbhash/ThumbhashDecoder.kt +365 -0
  48. package/android/src/main/java/expo/modules/image/thumbhash/ThumbhashFetcher.kt +31 -0
  49. package/android/src/main/java/expo/modules/image/thumbhash/ThumbhashModelLoader.kt +26 -0
  50. package/android/src/main/java/expo/modules/image/thumbhash/ThumbhashModelLoaderFactory.kt +14 -0
  51. package/android/src/main/java/expo/modules/image/thumbhash/ThumbhashModule.kt +17 -0
  52. package/build/ExpoImage.d.ts +15 -0
  53. package/build/ExpoImage.d.ts.map +1 -0
  54. package/build/ExpoImage.js +75 -0
  55. package/build/ExpoImage.js.map +1 -0
  56. package/build/ExpoImage.kepler.d.ts +23 -0
  57. package/build/ExpoImage.kepler.d.ts.map +1 -0
  58. package/build/ExpoImage.kepler.js +71 -0
  59. package/build/ExpoImage.kepler.js.map +1 -0
  60. package/build/ExpoImage.web.d.ts +9 -0
  61. package/build/ExpoImage.web.d.ts.map +1 -0
  62. package/build/ExpoImage.web.js +90 -0
  63. package/build/ExpoImage.web.js.map +1 -0
  64. package/build/ExpoImageModules.d.ts +3 -0
  65. package/build/ExpoImageModules.d.ts.map +1 -0
  66. package/build/ExpoImageModules.js +4 -0
  67. package/build/ExpoImageModules.js.map +1 -0
  68. package/build/ExpoImageModules.kepler.d.ts +6 -0
  69. package/build/ExpoImageModules.kepler.d.ts.map +1 -0
  70. package/build/ExpoImageModules.kepler.js +5 -0
  71. package/build/ExpoImageModules.kepler.js.map +1 -0
  72. package/build/Image.d.ts +30 -0
  73. package/build/Image.d.ts.map +1 -0
  74. package/build/Image.js +49 -0
  75. package/build/Image.js.map +1 -0
  76. package/build/Image.types.d.ts +374 -0
  77. package/build/Image.types.d.ts.map +1 -0
  78. package/build/Image.types.js +2 -0
  79. package/build/Image.types.js.map +1 -0
  80. package/build/ImageBackground.d.ts +6 -0
  81. package/build/ImageBackground.d.ts.map +1 -0
  82. package/build/ImageBackground.js +13 -0
  83. package/build/ImageBackground.js.map +1 -0
  84. package/build/ImageViewNativeComponent.d.ts +20 -0
  85. package/build/ImageViewNativeComponent.d.ts.map +1 -0
  86. package/build/ImageViewNativeComponent.js +42 -0
  87. package/build/ImageViewNativeComponent.js.map +1 -0
  88. package/build/NativeImageLoaderKepler.d.ts +18 -0
  89. package/build/NativeImageLoaderKepler.d.ts.map +1 -0
  90. package/build/NativeImageLoaderKepler.js +3 -0
  91. package/build/NativeImageLoaderKepler.js.map +1 -0
  92. package/build/fabric/registerNativeComponent.d.ts +15 -0
  93. package/build/fabric/registerNativeComponent.d.ts.map +1 -0
  94. package/build/fabric/registerNativeComponent.js +47 -0
  95. package/build/fabric/registerNativeComponent.js.map +1 -0
  96. package/build/index.d.ts +4 -0
  97. package/build/index.d.ts.map +1 -0
  98. package/build/index.js +4 -0
  99. package/build/index.js.map +1 -0
  100. package/build/utils/AssetSourceResolver.web.d.ts +24 -0
  101. package/build/utils/AssetSourceResolver.web.d.ts.map +1 -0
  102. package/build/utils/AssetSourceResolver.web.js +67 -0
  103. package/build/utils/AssetSourceResolver.web.js.map +1 -0
  104. package/build/utils/blurhash/base83.d.ts +3 -0
  105. package/build/utils/blurhash/base83.d.ts.map +1 -0
  106. package/build/utils/blurhash/base83.js +103 -0
  107. package/build/utils/blurhash/base83.js.map +1 -0
  108. package/build/utils/blurhash/decode.d.ts +7 -0
  109. package/build/utils/blurhash/decode.d.ts.map +1 -0
  110. package/build/utils/blurhash/decode.js +92 -0
  111. package/build/utils/blurhash/decode.js.map +1 -0
  112. package/build/utils/blurhash/error.d.ts +4 -0
  113. package/build/utils/blurhash/error.d.ts.map +1 -0
  114. package/build/utils/blurhash/error.js +8 -0
  115. package/build/utils/blurhash/error.js.map +1 -0
  116. package/build/utils/blurhash/useBlurhash.d.ts +8 -0
  117. package/build/utils/blurhash/useBlurhash.d.ts.map +1 -0
  118. package/build/utils/blurhash/useBlurhash.js +64 -0
  119. package/build/utils/blurhash/useBlurhash.js.map +1 -0
  120. package/build/utils/blurhash/utils.d.ts +5 -0
  121. package/build/utils/blurhash/utils.d.ts.map +1 -0
  122. package/build/utils/blurhash/utils.js +21 -0
  123. package/build/utils/blurhash/utils.js.map +1 -0
  124. package/build/utils/resolveAssetSource.d.ts +3 -0
  125. package/build/utils/resolveAssetSource.d.ts.map +1 -0
  126. package/build/utils/resolveAssetSource.js +3 -0
  127. package/build/utils/resolveAssetSource.js.map +1 -0
  128. package/build/utils/resolveAssetSource.web.d.ts +9 -0
  129. package/build/utils/resolveAssetSource.web.d.ts.map +1 -0
  130. package/build/utils/resolveAssetSource.web.js +31 -0
  131. package/build/utils/resolveAssetSource.web.js.map +1 -0
  132. package/build/utils/resolveHashString.d.ts +14 -0
  133. package/build/utils/resolveHashString.d.ts.map +1 -0
  134. package/build/utils/resolveHashString.js +31 -0
  135. package/build/utils/resolveHashString.js.map +1 -0
  136. package/build/utils/resolveHashString.web.d.ts +20 -0
  137. package/build/utils/resolveHashString.web.d.ts.map +1 -0
  138. package/build/utils/resolveHashString.web.js +31 -0
  139. package/build/utils/resolveHashString.web.js.map +1 -0
  140. package/build/utils/resolveSources.d.ts +8 -0
  141. package/build/utils/resolveSources.d.ts.map +1 -0
  142. package/build/utils/resolveSources.js +45 -0
  143. package/build/utils/resolveSources.js.map +1 -0
  144. package/build/utils/thumbhash/thumbhash.d.ts +66 -0
  145. package/build/utils/thumbhash/thumbhash.d.ts.map +1 -0
  146. package/build/utils/thumbhash/thumbhash.js +338 -0
  147. package/build/utils/thumbhash/thumbhash.js.map +1 -0
  148. package/build/utils.d.ts +17 -0
  149. package/build/utils.d.ts.map +1 -0
  150. package/build/utils.js +85 -0
  151. package/build/utils.js.map +1 -0
  152. package/build/web/AnimationManager.d.ts +37 -0
  153. package/build/web/AnimationManager.d.ts.map +1 -0
  154. package/build/web/AnimationManager.js +155 -0
  155. package/build/web/AnimationManager.js.map +1 -0
  156. package/build/web/ColorTintFilter.d.ts +12 -0
  157. package/build/web/ColorTintFilter.d.ts.map +1 -0
  158. package/build/web/ColorTintFilter.js +30 -0
  159. package/build/web/ColorTintFilter.js.map +1 -0
  160. package/build/web/ImageWrapper.d.ts +5 -0
  161. package/build/web/ImageWrapper.d.ts.map +1 -0
  162. package/build/web/ImageWrapper.js +44 -0
  163. package/build/web/ImageWrapper.js.map +1 -0
  164. package/build/web/ImageWrapper.types.d.ts +29 -0
  165. package/build/web/ImageWrapper.types.d.ts.map +1 -0
  166. package/build/web/ImageWrapper.types.js +2 -0
  167. package/build/web/ImageWrapper.types.js.map +1 -0
  168. package/build/web/getImageWrapperEventHandler.d.ts +8 -0
  169. package/build/web/getImageWrapperEventHandler.d.ts.map +1 -0
  170. package/build/web/getImageWrapperEventHandler.js +25 -0
  171. package/build/web/getImageWrapperEventHandler.js.map +1 -0
  172. package/build/web/hooks.d.ts +13 -0
  173. package/build/web/hooks.d.ts.map +1 -0
  174. package/build/web/hooks.js +58 -0
  175. package/build/web/hooks.js.map +1 -0
  176. package/build/web/imageStyles.d.ts +2 -0
  177. package/build/web/imageStyles.d.ts.map +1 -0
  178. package/build/web/imageStyles.js +137 -0
  179. package/build/web/imageStyles.js.map +1 -0
  180. package/build/web/positioning.d.ts +11 -0
  181. package/build/web/positioning.d.ts.map +1 -0
  182. package/build/web/positioning.js +35 -0
  183. package/build/web/positioning.js.map +1 -0
  184. package/build/web/useSourceSelection.d.ts +14 -0
  185. package/build/web/useSourceSelection.d.ts.map +1 -0
  186. package/build/web/useSourceSelection.js +98 -0
  187. package/build/web/useSourceSelection.js.map +1 -0
  188. package/expo-module.config.json +9 -0
  189. package/ios/Blurhash.swift +326 -0
  190. package/ios/BlurhashLoader.swift +52 -0
  191. package/ios/ContentFit.swift +55 -0
  192. package/ios/ContentPosition.swift +108 -0
  193. package/ios/ExpoImage.podspec +30 -0
  194. package/ios/ImageCachePolicy.swift +24 -0
  195. package/ios/ImageCacheType.swift +21 -0
  196. package/ios/ImageModule.swift +127 -0
  197. package/ios/ImagePriority.swift +22 -0
  198. package/ios/ImageSource.swift +44 -0
  199. package/ios/ImageTransition.swift +67 -0
  200. package/ios/ImageUtils.swift +227 -0
  201. package/ios/ImageView.swift +469 -0
  202. package/ios/Loaders/PhotoLibraryAssetLoader.swift +146 -0
  203. package/ios/Thumbhash.swift +550 -0
  204. package/ios/ThumbhashLoader.swift +53 -0
  205. package/jest.config.js +3 -0
  206. package/kepler/ExpoImage.cpp +63 -0
  207. package/kepler/ExpoImage.h +29 -0
  208. package/kepler/ExpoImageCacheHandler.cpp +15 -0
  209. package/kepler/ExpoImageCacheHandler.h +28 -0
  210. package/kepler/ExpoImageComponent.cpp +579 -0
  211. package/kepler/ExpoImageComponent.h +199 -0
  212. package/kepler/ImageWrapper/BlurhashImageWrapper.cpp +37 -0
  213. package/kepler/ImageWrapper/BlurhashImageWrapper.h +23 -0
  214. package/kepler/ImageWrapper/CacheImageWrapper.cpp +80 -0
  215. package/kepler/ImageWrapper/CacheImageWrapper.h +41 -0
  216. package/kepler/ImageWrapper/HashImageWrapper.cpp +21 -0
  217. package/kepler/ImageWrapper/HashImageWrapper.h +22 -0
  218. package/kepler/ImageWrapper/ImageWrapper.cpp +24 -0
  219. package/kepler/ImageWrapper/ImageWrapper.h +33 -0
  220. package/kepler/ImageWrapper/LocalImageWrapper.cpp +61 -0
  221. package/kepler/ImageWrapper/LocalImageWrapper.h +30 -0
  222. package/kepler/ImageWrapper/ThumbhashImageWrapper.cpp +33 -0
  223. package/kepler/ImageWrapper/ThumbhashImageWrapper.h +20 -0
  224. package/kepler/KeplerImageViewComponent.h +64 -0
  225. package/kepler/KeplerInit.cpp +35 -0
  226. package/kepler/blurhash/common.h +32 -0
  227. package/kepler/blurhash/decode.cpp +187 -0
  228. package/kepler/blurhash/decode.h +58 -0
  229. package/kepler/contentposition/ImageContentPosition.cpp +86 -0
  230. package/kepler/contentposition/ImageContentPosition.h +48 -0
  231. package/kepler/enums/ImageContentFit.h +17 -0
  232. package/kepler/enums/ImagePriority.h +17 -0
  233. package/kepler/managers/ExpoImageManager.cpp +38 -0
  234. package/kepler/managers/ExpoImageManager.h +23 -0
  235. package/kepler/test/ExpoImage.cpp +73 -0
  236. package/kepler/test/ExpoImageComponent.cpp +290 -0
  237. package/kepler/test/blurhash/decode.cpp +39 -0
  238. package/kepler/test/contentposition/ImageContentPosition.cpp +100 -0
  239. package/kepler/test/managers/ExpoImageManager.cpp +39 -0
  240. package/kepler/test/thumbhash/decode.cpp +18 -0
  241. package/kepler/test/utils/LoaderDelegate.cpp +130 -0
  242. package/kepler/thumbhash/decode.cpp +166 -0
  243. package/kepler/thumbhash/decode.h +22 -0
  244. package/kepler/utils/PlaceholderImageLoaderDelegate.cpp +26 -0
  245. package/kepler/utils/PlaceholderImageLoaderDelegate.h +26 -0
  246. package/kepler/utils/PrefetchImageLoaderDelegate.cpp +55 -0
  247. package/kepler/utils/PrefetchImageLoaderDelegate.h +35 -0
  248. package/kepler/utils/SourceImageLoaderDelegate.cpp +47 -0
  249. package/kepler/utils/SourceImageLoaderDelegate.h +42 -0
  250. package/kepler/utils/SourceImageLoaderDelegateEmitter.cpp +15 -0
  251. package/kepler/utils/SourceImageLoaderDelegateEmitter.h +28 -0
  252. package/kepler-compatibility.json +8 -0
  253. package/package.json +1 -0
  254. package/react-native.config.js +22 -0
  255. package/src/ExpoImage.kepler.tsx +119 -0
  256. package/src/ExpoImage.tsx +119 -0
  257. package/src/ExpoImage.web.tsx +155 -0
  258. package/src/ExpoImageModules.kepler.ts +7 -0
  259. package/src/ExpoImageModules.ts +4 -0
  260. package/src/Image.tsx +82 -0
  261. package/src/Image.types.ts +450 -0
  262. package/src/ImageBackground.tsx +18 -0
  263. package/src/ImageViewNativeComponent.ts +59 -0
  264. package/src/NativeImageLoaderKepler.ts +22 -0
  265. package/src/fabric/registerNativeComponent.ts +70 -0
  266. package/src/index.ts +3 -0
  267. package/src/utils/AssetSourceResolver.web.ts +88 -0
  268. package/src/utils/blurhash/base83.ts +104 -0
  269. package/src/utils/blurhash/decode.ts +114 -0
  270. package/src/utils/blurhash/error.ts +7 -0
  271. package/src/utils/blurhash/useBlurhash.tsx +81 -0
  272. package/src/utils/blurhash/utils.ts +21 -0
  273. package/src/utils/resolveAssetSource.tsx +3 -0
  274. package/src/utils/resolveAssetSource.web.ts +40 -0
  275. package/src/utils/resolveHashString.tsx +36 -0
  276. package/src/utils/resolveHashString.web.tsx +33 -0
  277. package/src/utils/resolveSources.tsx +48 -0
  278. package/src/utils/thumbhash/thumbhash.ts +387 -0
  279. package/src/utils.ts +109 -0
  280. package/src/web/AnimationManager.tsx +224 -0
  281. package/src/web/ColorTintFilter.tsx +36 -0
  282. package/src/web/ImageWrapper.tsx +85 -0
  283. package/src/web/ImageWrapper.types.ts +36 -0
  284. package/src/web/getImageWrapperEventHandler.ts +29 -0
  285. package/src/web/hooks.ts +72 -0
  286. package/src/web/imageStyles.tsx +136 -0
  287. package/src/web/positioning.ts +48 -0
  288. package/src/web/useSourceSelection.ts +151 -0
  289. package/tsconfig.json +9 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoImage.kepler.js","sourceRoot":"","sources":["../src/ExpoImage.kepler.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAwB,UAAU,EAAa,YAAY,EAAE,MAAM,cAAc,CAAC;AAEzF,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAOrD,OAAO,wBAEN,MAAM,4BAA4B,CAAC;AAQpC,SAAS,yBAAyB,CAChC,KAAwC;IAExC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,WAAW,EAAE,aAAa,EAAE;QACtD,GAAG;YACD,OAAO,CAAC,IAAI,CACV,sHAAsH,CACvH,CAAC;YACF,OAAO,KAAK,CAAC,WAAW,CAAC;QAC3B,CAAC;KACF,CAAC,CAAC;IACH,OAAO,KAAK,CAAC,WAAW,CAAC;AAC3B,CAAC;AAED,MAAM,SAAU,SAAQ,KAAK,CAAC,aAA+B;IAC3D,WAAW,GAAG,GAAG,EAAE;QACjB,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;IAC7B,CAAC,CAAC;IAEF,MAAM,GAAG,CAAC,KAA+C,EAAE,EAAE;QAC3D,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,yBAAyB,CAAC,KAAK,CAAC,CAAC,CAAC;IACxD,CAAC,CAAC;IAEF,UAAU,GAAG,CAAC,KAAmD,EAAE,EAAE;QACnE,IAAI,CAAC,KAAK,CAAC,UAAU,EA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,CAAC;YAC7D,YAAY;YACZ,MAAM;YACN,UAAU;SACX,CAAC;QAEF,OAAO,CAAC,wBAAwB,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,UAAU,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,EAAG,CAAC;IAC/E,CAAC;CACF;AAED,OAAO,EAAE,eAAe,EAAE,CAAC;AAC3B,eAAe,SAAS,CAAC","sourcesContent":["/**\n * Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All rights reserved.\n *\n * PROPRIETARY/CONFIDENTIAL. USE IS SUBJECT TO LICENSE TERMS.\n *\n * @flow\n * @format\n */\n\nimport * as React from 'react';\nimport { NativeSyntheticEvent, StyleSheet, ViewProps, processColor } from 'react-native';\n\nimport { ExpoImageModule } from './ExpoImageModules';\nimport {\n ImageErrorEventData,\n ImageLoadEventData,\n ImageNativeProps,\n ImageProgressEventData,\n} from './Image.types';\nimport ImageViewNativeComponent, {\n ImageViewNativeComponentProps,\n} from './ImageViewNativeComponent';\n\ntype ImageOnlyProps = Omit<ImageViewNativeComponentProps, keyof ViewProps> & {\n accessibilityLabel?: string | undefined;\n};\n\n\n\nfunction withDeprecatedNativeEvent<NativeEvent>(\n event: NativeSyntheticEvent<NativeEvent>\n): NativeEvent {\n Object.defineProperty(event.nativeEvent, 'nativeEvent', {\n get() {\n console.warn(\n '[expo-image]: Accessing event payload through \"nativeEvent\" is deprecated, it is now part of the event object itself'\n );\n return event.nativeEvent;\n },\n });\n return event.nativeEvent;\n}\n\nclass ExpoImage extends React.PureComponent<ImageNativeProps> {\n onLoadStart = () => {\n this.props.onLoadStart?.();\n };\n\n onLoad = (event: NativeSyntheticEvent<ImageLoadEventData>) => {\n this.props.onLoad?.(withDeprecatedNativeEvent(event));\n };\n\n onProgress = (event: NativeSyntheticEvent<ImageProgressEventData>) => {\n this.props.onProgress?.(withDeprecatedNativeEvent(event));\n };\n\n onError = (event: NativeSyntheticEvent<ImageErrorEventData>) => {\n this.props.onError?.(withDeprecatedNativeEvent(event));\n };\n\n onLoadEnd = () => {\n this.props.onLoadEnd?.();\n };\n\n render() {\n const {\n style,\n allowDownscaling,\n alt,\n accessibilityLabel,\n blurRadius,\n cachePolicy,\n contentFit,\n contentPosition,\n placeholderContentFit,\n priority,\n recyclingKey,\n source,\n transition,\n placeholder,\n tintColor,\n ...props\n } = this.props;\n\n delete props.defaultSource;\n delete props.fadeDuration;\n delete props.resizeMode;\n delete props.loadingIndicatorSource;\n\n const resolvedStyle = StyleSheet.flatten(style);\n\n const imageProps: ImageOnlyProps = {\n allowDownscaling: allowDownscaling ?? true,\n alt,\n accessibilityLabel: accessibilityLabel ?? alt,\n blurRadius,\n cachePolicy,\n contentFit,\n contentPosition,\n onError: this.onError,\n onLoadStart: this.onLoadStart,\n onLoad: this.onLoad,\n onProgress: this.onProgress,\n onLoadEnd: this.onLoadEnd,\n placeholder,\n placeholderContentFit,\n priority,\n tintColor: processColor(tintColor || resolvedStyle.tintColor),\n recyclingKey,\n source,\n transition,\n };\n\n return <ImageViewNativeComponent {...props} {...imageProps} style={style} />;\n }\n}\n\nexport { ExpoImageModule };\nexport default ExpoImage;\n"]}
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { ImageNativeProps } from './Image.types';
3
+ export declare const ExpoImageModule: {
4
+ prefetch(urls: string | string[]): void;
5
+ clearMemoryCache(): Promise<boolean>;
6
+ clearDiskCache(): Promise<boolean>;
7
+ };
8
+ export default function ExpoImage({ source, placeholder, contentFit, contentPosition, placeholderContentFit, cachePolicy, onLoad, transition, onError, responsivePolicy, onLoadEnd, priority, blurRadius, recyclingKey, style, ...props }: ImageNativeProps): React.JSX.Element;
9
+ //# sourceMappingURL=ExpoImage.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoImage.web.d.ts","sourceRoot":"","sources":["../src/ExpoImage.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,gBAAgB,EAAmC,MAAM,eAAe,CAAC;AAQlF,eAAO,MAAM,eAAe;mBACX,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI;wBAQb,OAAO,CAAC,OAAO,CAAC;sBAIlB,OAAO,CAAC,OAAO,CAAC;CAGzC,CAAC;AA+BF,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAChC,MAAM,EACN,WAAW,EACX,UAAU,EACV,eAAe,EACf,qBAAqB,EACrB,WAAW,EACX,MAAM,EACN,UAAU,EACV,OAAO,EACP,gBAAgB,EAChB,SAAS,EACT,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,KAAK,EACL,GAAG,KAAK,EACT,EAAE,gBAAgB,qBA+ElB"}
@@ -0,0 +1,90 @@
1
+ import React from 'react';
2
+ import { View } from 'react-native-web';
3
+ import AnimationManager from './web/AnimationManager';
4
+ import ImageWrapper from './web/ImageWrapper';
5
+ import loadStyle from './web/imageStyles';
6
+ import useSourceSelection from './web/useSourceSelection';
7
+ loadStyle();
8
+ export const ExpoImageModule = {
9
+ prefetch(urls) {
10
+ const urlsArray = Array.isArray(urls) ? urls : [urls];
11
+ urlsArray.forEach((url) => {
12
+ const img = new Image();
13
+ img.src = url;
14
+ });
15
+ },
16
+ async clearMemoryCache() {
17
+ return false;
18
+ },
19
+ async clearDiskCache() {
20
+ return false;
21
+ },
22
+ };
23
+ function onLoadAdapter(onLoad) {
24
+ return (event) => {
25
+ const target = event.target;
26
+ onLoad?.({
27
+ source: {
28
+ url: target.currentSrc,
29
+ width: target.naturalWidth,
30
+ height: target.naturalHeight,
31
+ mediaType: null,
32
+ },
33
+ cacheType: 'none',
34
+ });
35
+ };
36
+ }
37
+ function onErrorAdapter(onError) {
38
+ return ({ source }) => {
39
+ onError?.({
40
+ error: `Failed to load image from url: ${source?.uri}`,
41
+ });
42
+ };
43
+ }
44
+ // Used for some transitions to mimic native animations
45
+ const setCssVariables = (element, size) => {
46
+ element?.style.setProperty('--expo-image-width', `${size.width}px`);
47
+ element?.style.setProperty('--expo-image-height', `${size.height}px`);
48
+ };
49
+ export default function ExpoImage({ source, placeholder, contentFit, contentPosition, placeholderContentFit, cachePolicy, onLoad, transition, onError, responsivePolicy, onLoadEnd, priority, blurRadius, recyclingKey, style, ...props }) {
50
+ const imagePlaceholderContentFit = placeholderContentFit || 'scale-down';
51
+ const imageHashStyle = {
52
+ objectFit: placeholderContentFit || contentFit,
53
+ };
54
+ const { containerRef, source: selectedSource } = useSourceSelection(source, responsivePolicy, setCssVariables);
55
+ const initialNodeAnimationKey = (recyclingKey ? `${recyclingKey}-${placeholder?.[0]?.uri}` : placeholder?.[0]?.uri) ?? '';
56
+ const initialNode = placeholder?.[0]?.uri
57
+ ? [
58
+ initialNodeAnimationKey,
59
+ ({ onAnimationFinished }) => (className, style) => (<ImageWrapper {...props} source={placeholder?.[0]} style={{
60
+ objectFit: imagePlaceholderContentFit,
61
+ ...(blurRadius ? { filter: `blur(${blurRadius}px)` } : {}),
62
+ ...style,
63
+ }} className={className} events={{
64
+ onTransitionEnd: [onAnimationFinished],
65
+ }} contentPosition={{ left: '50%', top: '50%' }} hashPlaceholderContentPosition={contentPosition} hashPlaceholderStyle={imageHashStyle}/>),
66
+ ]
67
+ : null;
68
+ const currentNodeAnimationKey = (recyclingKey
69
+ ? `${recyclingKey}-${selectedSource?.uri ?? placeholder?.[0]?.uri}`
70
+ : selectedSource?.uri ?? placeholder?.[0]?.uri) ?? '';
71
+ const currentNode = [
72
+ currentNodeAnimationKey,
73
+ ({ onAnimationFinished, onReady, onMount, onError: onErrorInner }) => (className, style) => (<ImageWrapper {...props} source={selectedSource || placeholder?.[0]} events={{
74
+ onError: [onErrorAdapter(onError), onLoadEnd, onErrorInner],
75
+ onLoad: [onLoadAdapter(onLoad), onLoadEnd, onReady],
76
+ onMount: [onMount],
77
+ onTransitionEnd: [onAnimationFinished],
78
+ }} style={{
79
+ objectFit: selectedSource ? contentFit : imagePlaceholderContentFit,
80
+ ...(blurRadius ? { filter: `blur(${blurRadius}px)` } : {}),
81
+ ...style,
82
+ }} className={className} cachePolicy={cachePolicy} priority={priority} contentPosition={selectedSource ? contentPosition : { top: '50%', left: '50%' }} hashPlaceholderContentPosition={contentPosition} hashPlaceholderStyle={imageHashStyle} accessibilityLabel={props.accessibilityLabel}/>),
83
+ ];
84
+ return (<View ref={containerRef} dataSet={{ expoimage: true }} style={[{ overflow: 'hidden' }, style]}>
85
+ <AnimationManager transition={transition} recyclingKey={recyclingKey} initial={initialNode}>
86
+ {currentNode}
87
+ </AnimationManager>
88
+ </View>);
89
+ }
90
+ //# sourceMappingURL=ExpoImage.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoImage.web.js","sourceRoot":"","sources":["../src/ExpoImage.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAGxC,OAAO,gBAA0C,MAAM,wBAAwB,CAAC;AAChF,OAAO,YAAY,MAAM,oBAAoB,CAAC;AAC9C,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAC1C,OAAO,kBAAkB,MAAM,0BAA0B,CAAC;AAE1D,SAAS,EAAE,CAAC;AAEZ,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,QAAQ,CAAC,IAAuB;QAC9B,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACtD,SAAS,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YACxB,MAAM,GAAG,GAAG,IAAI,KAAK,EAAE,CAAC;YACxB,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC;QAChB,CAAC,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,KAAK,CAAC,cAAc;QAClB,OAAO,KAAK,CAAC;IACf,C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8BAA8B,CAAC,CAAC,eAAe,CAAC,CAChD,oBAAoB,CAAC,CAAC,cAAc,CAAC,CACrC,kBAAkB,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC,EAC7C,CACH;KACJ,CAAC;IACF,OAAO,CACL,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,KAAK,CAAC,CAAC,CAC5F;MAAA,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC,UAAU,CAAC,CAAC,YAAY,CAAC,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,CACzF;QAAA,CAAC,WAAW,CACd;MAAA,EAAE,gBAAgB,CACpB;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\nimport { View } from 'react-native-web';\n\nimport { ImageNativeProps, ImageSource, ImageLoadEventData } from './Image.types';\nimport AnimationManager, { AnimationManagerNode } from './web/AnimationManager';\nimport ImageWrapper from './web/ImageWrapper';\nimport loadStyle from './web/imageStyles';\nimport useSourceSelection from './web/useSourceSelection';\n\nloadStyle();\n\nexport const ExpoImageModule = {\n prefetch(urls: string | string[]): void {\n const urlsArray = Array.isArray(urls) ? urls : [urls];\n urlsArray.forEach((url) => {\n const img = new Image();\n img.src = url;\n });\n },\n\n async clearMemoryCache(): Promise<boolean> {\n return false;\n },\n\n async clearDiskCache(): Promise<boolean> {\n return false;\n },\n};\n\nfunction onLoadAdapter(onLoad?: (event: ImageLoadEventData) => void) {\n return (event: React.SyntheticEvent<HTMLImageElement, Event>) => {\n const target = event.target as HTMLImageElement;\n onLoad?.({\n source: {\n url: target.currentSrc,\n width: target.naturalWidth,\n height: target.naturalHeight,\n mediaType: null,\n },\n cacheType: 'none',\n });\n };\n}\n\nfunction onErrorAdapter(onError?: { (event: { error: string }): void }) {\n return ({ source }: { source?: ImageSource | null }) => {\n onError?.({\n error: `Failed to load image from url: ${source?.uri}`,\n });\n };\n}\n\n// Used for some transitions to mimic native animations\nconst setCssVariables = (element: HTMLElement, size: DOMRect) => {\n element?.style.setProperty('--expo-image-width', `${size.width}px`);\n element?.style.setProperty('--expo-image-height', `${size.height}px`);\n};\n\nexport default function ExpoImage({\n source,\n placeholder,\n contentFit,\n contentPosition,\n placeholderContentFit,\n cachePolicy,\n onLoad,\n transition,\n onError,\n responsivePolicy,\n onLoadEnd,\n priority,\n blurRadius,\n recyclingKey,\n style,\n ...props\n}: ImageNativeProps) {\n const imagePlaceholderContentFit = placeholderContentFit || 'scale-down';\n const imageHashStyle = {\n objectFit: placeholderContentFit || contentFit,\n };\n const { containerRef, source: selectedSource } = useSourceSelection(\n source,\n responsivePolicy,\n setCssVariables\n );\n\n const initialNodeAnimationKey =\n (recyclingKey ? `${recyclingKey}-${placeholder?.[0]?.uri}` : placeholder?.[0]?.uri) ?? '';\n\n const initialNode: AnimationManagerNode | null = placeholder?.[0]?.uri\n ? [\n initialNodeAnimationKey,\n ({ onAnimationFinished }) =>\n (className, style) => (\n <ImageWrapper\n {...props}\n source={placeholder?.[0]}\n style={{\n objectFit: imagePlaceholderContentFit,\n ...(blurRadius ? { filter: `blur(${blurRadius}px)` } : {}),\n ...style,\n }}\n className={className}\n events={{\n onTransitionEnd: [onAnimationFinished],\n }}\n contentPosition={{ left: '50%', top: '50%' }}\n hashPlaceholderContentPosition={contentPosition}\n hashPlaceholderStyle={imageHashStyle}\n />\n ),\n ]\n : null;\n\n const currentNodeAnimationKey =\n (recyclingKey\n ? `${recyclingKey}-${selectedSource?.uri ?? placeholder?.[0]?.uri}`\n : selectedSource?.uri ?? placeholder?.[0]?.uri) ?? '';\n\n const currentNode: AnimationManagerNode = [\n currentNodeAnimationKey,\n ({ onAnimationFinished, onReady, onMount, onError: onErrorInner }) =>\n (className, style) => (\n <ImageWrapper\n {...props}\n source={selectedSource || placeholder?.[0]}\n events={{\n onError: [onErrorAdapter(onError), onLoadEnd, onErrorInner],\n onLoad: [onLoadAdapter(onLoad), onLoadEnd, onReady],\n onMount: [onMount],\n onTransitionEnd: [onAnimationFinished],\n }}\n style={{\n objectFit: selectedSource ? contentFit : imagePlaceholderContentFit,\n ...(blurRadius ? { filter: `blur(${blurRadius}px)` } : {}),\n ...style,\n }}\n className={className}\n cachePolicy={cachePolicy}\n priority={priority}\n contentPosition={selectedSource ? contentPosition : { top: '50%', left: '50%' }}\n hashPlaceholderContentPosition={contentPosition}\n hashPlaceholderStyle={imageHashStyle}\n accessibilityLabel={props.accessibilityLabel}\n />\n ),\n ];\n return (\n <View ref={containerRef} dataSet={{ expoimage: true }} style={[{ overflow: 'hidden' }, style]}>\n <AnimationManager transition={transition} recyclingKey={recyclingKey} initial={initialNode}>\n {currentNode}\n </AnimationManager>\n </View>\n );\n}\n"]}
@@ -0,0 +1,3 @@
1
+ export declare const NativeExpoImage: import("react").ComponentType<any>;
2
+ export declare const ExpoImageModule: any;
3
+ //# sourceMappingURL=ExpoImageModules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoImageModules.d.ts","sourceRoot":"","sources":["../src/ExpoImageModules.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,oCAAwC,CAAC;AACrE,eAAO,MAAM,eAAe,KAAmC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { requireNativeViewManager, requireNativeModule } from 'expo-modules-core';
2
+ export const NativeExpoImage = requireNativeViewManager('ExpoImage');
3
+ export const ExpoImageModule = requireNativeModule('ExpoImage');
4
+ //# sourceMappingURL=ExpoImageModules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoImageModules.js","sourceRoot":"","sources":["../src/ExpoImageModules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAElF,MAAM,CAAC,MAAM,eAAe,GAAG,wBAAwB,CAAC,WAAW,CAAC,CAAC;AACrE,MAAM,CAAC,MAAM,eAAe,GAAG,mBAAmB,CAAC,WAAW,CAAC,CAAC","sourcesContent":["import { requireNativeViewManager, requireNativeModule } from 'expo-modules-core';\n\nexport const NativeExpoImage = requireNativeViewManager('ExpoImage');\nexport const ExpoImageModule = requireNativeModule('ExpoImage');"]}
@@ -0,0 +1,6 @@
1
+ import { KeplerTurboModule } from '@amazon-devices/keplerscript-turbomodule-api';
2
+ type Spec = KeplerTurboModule;
3
+ export declare const NativeExpoImage: import("react-native").HostComponent<import("./ImageViewNativeComponent").ImageViewNativeComponentProps>;
4
+ export declare const ExpoImageModule: Spec;
5
+ export {};
6
+ //# sourceMappingURL=ExpoImageModules.kepler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoImageModules.kepler.d.ts","sourceRoot":"","sources":["../src/ExpoImageModules.kepler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAsB,MAAM,oCAAoC,CAAC;AAI1F,KAAK,IAAI,GAAG,iBAAiB,CAAC;AAC9B,eAAO,MAAM,eAAe,0GAAqB,CAAC;AAClD,eAAO,MAAM,eAAe,EAA0D,IAAI,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { TurboModuleRegistry } from '@amazon-devices/keplerscript-turbomodule-api';
2
+ import ExpoImageComponent from './ImageViewNativeComponent';
3
+ export const NativeExpoImage = ExpoImageComponent;
4
+ export const ExpoImageModule = TurboModuleRegistry.getEnforcing('ExpoImage');
5
+ //# sourceMappingURL=ExpoImageModules.kepler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoImageModules.kepler.js","sourceRoot":"","sources":["../src/ExpoImageModules.kepler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,mBAAmB,EAAC,MAAM,oCAAoC,CAAC;AAE1F,OAAO,kBAAkB,MAAM,4BAA4B,CAAC;AAG5D,MAAM,CAAC,MAAM,eAAe,GAAG,kBAAkB,CAAC;AAClD,MAAM,CAAC,MAAM,eAAe,GAAG,mBAAmB,CAAC,YAAY,CAAO,WAAW,CAAS,CAAC","sourcesContent":["import {KeplerTurboModule, TurboModuleRegistry} from '@amazon-devices/keplerscript-turbomodule-api';\n\nimport ExpoImageComponent from './ImageViewNativeComponent';\n\ntype Spec = KeplerTurboModule;\nexport const NativeExpoImage = ExpoImageComponent;\nexport const ExpoImageModule = TurboModuleRegistry.getEnforcing<Spec>('ExpoImage') as Spec;\n"]}
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import { ImageProps } from './Image.types';
3
+ export declare class Image extends React.PureComponent<ImageProps> {
4
+ /**
5
+ * Preloads images at the given urls that can be later used in the image view.
6
+ * Preloaded images are always cached on the disk, so make sure to use
7
+ * `disk` (default) or `memory-disk` cache policy.
8
+ */
9
+ static prefetch(urls: string | string[]): void;
10
+ /**
11
+ * Asynchronously clears all images stored in memory.
12
+ * @platform android
13
+ * @platform ios
14
+ * @return A promise resolving to `true` when the operation succeeds.
15
+ * It may resolve to `false` on Android when the activity is no longer available.
16
+ * Resolves to `false` on Web.
17
+ */
18
+ static clearMemoryCache(): Promise<boolean>;
19
+ /**
20
+ * Asynchronously clears all images from the disk cache.
21
+ * @platform android
22
+ * @platform ios
23
+ * @return A promise resolving to `true` when the operation succeeds.
24
+ * It may resolve to `false` on Android when the activity is no longer available.
25
+ * Resolves to `false` on Web.
26
+ */
27
+ static clearDiskCache(): Promise<boolean>;
28
+ render(): React.JSX.Element;
29
+ }
30
+ //# sourceMappingURL=Image.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../src/Image.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAM3C,qBAAa,KAAM,SAAQ,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC;IACxD;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI;IAI9C;;;;;;;OAOG;WACU,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC;IAIjD;;;;;;;OAOG;WACU,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC;IAI/C,MAAM;CAqCP"}
package/build/Image.js ADDED
@@ -0,0 +1,49 @@
1
+ import React from 'react';
2
+ import { StyleSheet } from 'react-native';
3
+ import ExpoImage, { ExpoImageModule } from './ExpoImage';
4
+ import { resolveContentFit, resolveContentPosition, resolveTransition } from './utils';
5
+ import { resolveSources } from './utils/resolveSources';
6
+ let loggedDefaultSourceDeprecationWarning = false;
7
+ export class Image extends React.PureComponent {
8
+ /**
9
+ * Preloads images at the given urls that can be later used in the image view.
10
+ * Preloaded images are always cached on the disk, so make sure to use
11
+ * `disk` (default) or `memory-disk` cache policy.
12
+ */
13
+ static prefetch(urls) {
14
+ return ExpoImageModule.prefetch(Array.isArray(urls) ? urls : [urls]);
15
+ }
16
+ /**
17
+ * Asynchronously clears all images stored in memory.
18
+ * @platform android
19
+ * @platform ios
20
+ * @return A promise resolving to `true` when the operation succeeds.
21
+ * It may resolve to `false` on Android when the activity is no longer available.
22
+ * Resolves to `false` on Web.
23
+ */
24
+ static async clearMemoryCache() {
25
+ return await ExpoImageModule.clearMemoryCache();
26
+ }
27
+ /**
28
+ * Asynchronously clears all images from the disk cache.
29
+ * @platform android
30
+ * @platform ios
31
+ * @return A promise resolving to `true` when the operation succeeds.
32
+ * It may resolve to `false` on Android when the activity is no longer available.
33
+ * Resolves to `false` on Web.
34
+ */
35
+ static async clearDiskCache() {
36
+ return await ExpoImageModule.clearDiskCache();
37
+ }
38
+ render() {
39
+ const { style, source, placeholder, contentFit, contentPosition, transition, fadeDuration, resizeMode: resizeModeProp, defaultSource, loadingIndicatorSource, ...restProps } = this.props;
40
+ const { resizeMode: resizeModeStyle, ...restStyle } = StyleSheet.flatten(style) || {};
41
+ const resizeMode = resizeModeProp ?? resizeModeStyle;
42
+ if ((defaultSource || loadingIndicatorSource) && !loggedDefaultSourceDeprecationWarning) {
43
+ console.warn('[expo-image]: `defaultSource` and `loadingIndicatorSource` props are deprecated, use `placeholder` instead');
44
+ loggedDefaultSourceDeprecationWarning = true;
45
+ }
46
+ return (<ExpoImage {...restProps} style={restStyle} source={resolveSources(source)} placeholder={resolveSources(placeholder ?? defaultSource ?? loadingIndicatorSource)} contentFit={resolveContentFit(contentFit, resizeMode)} contentPosition={resolveContentPosition(contentPosition)} transition={resolveTransition(transition, fadeDuration)}/>);
47
+ }
48
+ }
49
+ //# sourceMappingURL=Image.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Image.js","sourceRoot":"","sources":["../src/Image.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,SAAS,EAAE,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEzD,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACvF,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,IAAI,qCAAqC,GAAG,KAAK,CAAC;AAElD,MAAM,OAAO,KAAM,SAAQ,KAAK,CAAC,aAAyB;IACxD;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAuB;QACrC,OAAO,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IACvE,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,KAAK,CAAC,gBAAgB;QAC3B,OAAO,MAAM,eAAe,CAAC,gBAAgB,EAAE,CAAC;IAClD,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,KAAK,CAAC,cAAc;QACzB,OAAO,MAAM,eAAe,CAAC,cAAc,EAAE,CAAC;IAChD,CAAC;IAED,MAAM;QACJ,MAAM,EACJ,KAAK,EACL,MAAM,EACN,WAAW,EACX,UAAU,EACV,eAAe,EACf,UAAU,EACV,YAAY,EACZ,UAAU,EAAE,cAAc,EAC1B,aAAa,EACb,sBAAsB,EACtB,GAAG,SAAS,EACb,GAAG,IAAI,CAAC,KAAK,CAAC;QAEf,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,GAAG,SAAS,EAAE,GAAG,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QACtF,MAAM,UAAU,GAAG,cAAc,IAAI,eAAe,CAAC;QAErD,IAAI,CAAC,aAAa,IAAI,sBAAsB,CAAC,IAAI,CAAC,qCAAqC,EAAE,CAAC;YACxF,OAAO,CAAC,IAAI,CACV,4GAA4G,CAC7G,CAAC;YACF,qCAAqC,GAAG,IAAI,CAAC;QAC/C,CAAC;QAED,OAAO,CACL,CAAC,SAAS,CACR,IAAI,SAAS,CAAC,CACd,KAAK,CAAC,CAAC,SAAS,CAAC,CACjB,MAAM,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAC/B,WAAW,CAAC,CAAC,cAAc,CAAC,WAAW,IAAI,aAAa,IAAI,sBAAsB,CAAC,CAAC,CACpF,UAAU,CAAC,CAAC,iBAAiB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,CACtD,eAAe,CAAC,CAAC,sBAAsB,CAAC,eAAe,CAAC,CAAC,CACzD,UAAU,CAAC,CAAC,iBAAiB,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC,EACxD,CACH,CAAC;IACJ,CAAC;CACF","sourcesContent":["import React from 'react';\nimport { StyleSheet } from 'react-native';\n\nimport ExpoImage, { ExpoImageModule } from './ExpoImage';\nimport { ImageProps } from './Image.types';\nimport { resolveContentFit, resolveContentPosition, resolveTransition } from './utils';\nimport { resolveSources } from './utils/resolveSources';\n\nlet loggedDefaultSourceDeprecationWarning = false;\n\nexport class Image extends React.PureComponent<ImageProps> {\n /**\n * Preloads images at the given urls that can be later used in the image view.\n * Preloaded images are always cached on the disk, so make sure to use\n * `disk` (default) or `memory-disk` cache policy.\n */\n static prefetch(urls: string | string[]): void {\n return ExpoImageModule.prefetch(Array.isArray(urls) ? urls : [urls]);\n }\n\n /**\n * Asynchronously clears all images stored in memory.\n * @platform android\n * @platform ios\n * @return A promise resolving to `true` when the operation succeeds.\n * It may resolve to `false` on Android when the activity is no longer available.\n * Resolves to `false` on Web.\n */\n static async clearMemoryCache(): Promise<boolean> {\n return await ExpoImageModule.clearMemoryCache();\n }\n\n /**\n * Asynchronously clears all images from the disk cache.\n * @platform android\n * @platform ios\n * @return A promise resolving to `true` when the operation succeeds.\n * It may resolve to `false` on Android when the activity is no longer available.\n * Resolves to `false` on Web.\n */\n static async clearDiskCache(): Promise<boolean> {\n return await ExpoImageModule.clearDiskCache();\n }\n\n render() {\n const {\n style,\n source,\n placeholder,\n contentFit,\n contentPosition,\n transition,\n fadeDuration,\n resizeMode: resizeModeProp,\n defaultSource,\n loadingIndicatorSource,\n ...restProps\n } = this.props;\n\n const { resizeMode: resizeModeStyle, ...restStyle } = StyleSheet.flatten(style) || {};\n const resizeMode = resizeModeProp ?? resizeModeStyle;\n\n if ((defaultSource || loadingIndicatorSource) && !loggedDefaultSourceDeprecationWarning) {\n console.warn(\n '[expo-image]: `defaultSource` and `loadingIndicatorSource` props are deprecated, use `placeholder` instead'\n );\n loggedDefaultSourceDeprecationWarning = true;\n }\n\n return (\n <ExpoImage\n {...restProps}\n style={restStyle}\n source={resolveSources(source)}\n placeholder={resolveSources(placeholder ?? defaultSource ?? loadingIndicatorSource)}\n contentFit={resolveContentFit(contentFit, resizeMode)}\n contentPosition={resolveContentPosition(contentPosition)}\n transition={resolveTransition(transition, fadeDuration)}\n />\n );\n }\n}\n"]}