@draftbit/core 50.6.2-bbb0a5.2 → 50.6.2-eac111.2

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.
@@ -1 +1 @@
1
- import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["source","resizeMode","style","placeholder","transition","contentFit","contentPosition","cachePolicy","allowDownscaling","recyclingKey"];var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/Image.tsx";import React from"react";import{StyleSheet}from"react-native";import{Image as ExpoImage}from"expo-image";import Config from"./Config";import AspectRatio from"./AspectRatio";import{jsx as _jsx}from"react/jsx-runtime";var generateDimensions=function generateDimensions(_ref){var aspectRatio=_ref.aspectRatio,width=_ref.width,height=_ref.height;if(aspectRatio&&!width&&!height){return{aspectRatio:aspectRatio,width:"100%"};}if(aspectRatio&&height){return{aspectRatio:aspectRatio,height:height,width:aspectRatio*height};}if(aspectRatio&&width){return{aspectRatio:aspectRatio,width:width,height:width/aspectRatio};}return{width:width,height:height};};var resizeModeToContentFit=function resizeModeToContentFit(resizeMode){var mapping={cover:"cover",contain:"contain",stretch:"fill",repeat:"none",center:"scale-down"};return mapping[resizeMode]||"cover";};var Image=function Image(_ref2){var source=_ref2.source,_ref2$resizeMode=_ref2.resizeMode,resizeMode=_ref2$resizeMode===void 0?"cover":_ref2$resizeMode,style=_ref2.style,placeholder=_ref2.placeholder,_ref2$transition=_ref2.transition,transition=_ref2$transition===void 0?300:_ref2$transition,_ref2$contentFit=_ref2.contentFit,contentFit=_ref2$contentFit===void 0?"cover":_ref2$contentFit,_ref2$contentPosition=_ref2.contentPosition,contentPosition=_ref2$contentPosition===void 0?"center":_ref2$contentPosition,_ref2$cachePolicy=_ref2.cachePolicy,cachePolicy=_ref2$cachePolicy===void 0?"memory-disk":_ref2$cachePolicy,_ref2$allowDownscalin=_ref2.allowDownscaling,allowDownscaling=_ref2$allowDownscalin===void 0?true:_ref2$allowDownscalin,recyclingKey=_ref2.recyclingKey,props=_objectWithoutProperties(_ref2,_excluded);var imageSource=source===null||source===undefined?Config.placeholderImageURL:source;var styles=StyleSheet.flatten(style||{});var _generateDimensions=generateDimensions(styles),aspectRatio=_generateDimensions.aspectRatio,width=_generateDimensions.width,height=_generateDimensions.height;var finalContentFit=contentFit||resizeModeToContentFit(resizeMode);if(aspectRatio){return _jsx(AspectRatio,{style:[style,{width:width,height:height,aspectRatio:aspectRatio}],children:_jsx(ExpoImage,Object.assign({},props,{source:imageSource,contentFit:finalContentFit,placeholder:placeholder,transition:transition,contentPosition:contentPosition,cachePolicy:cachePolicy,allowDownscaling:allowDownscaling,recyclingKey:recyclingKey,style:[style,{height:"100%",width:"100%"}]}))});}return _jsx(ExpoImage,Object.assign({},props,{source:source,contentFit:finalContentFit,placeholder:placeholder,transition:transition,contentPosition:contentPosition,cachePolicy:cachePolicy,allowDownscaling:allowDownscaling,recyclingKey:recyclingKey,style:style}));};export default Image;
1
+ import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["source","resizeMode","style"];var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/Image.tsx";import React from"react";import{Image as NativeImage,StyleSheet}from"react-native";import Config from"./Config";import AspectRatio from"./AspectRatio";import{jsx as _jsx}from"react/jsx-runtime";var generateDimensions=function generateDimensions(_ref){var aspectRatio=_ref.aspectRatio,width=_ref.width,height=_ref.height;if(aspectRatio&&!width&&!height){return{aspectRatio:aspectRatio,width:"100%"};}if(aspectRatio&&height){return{aspectRatio:aspectRatio,height:height,width:aspectRatio*height};}if(aspectRatio&&width){return{aspectRatio:aspectRatio,width:width,height:width/aspectRatio};}return{width:width,height:height};};var Image=function Image(_ref2){var source=_ref2.source,_ref2$resizeMode=_ref2.resizeMode,resizeMode=_ref2$resizeMode===void 0?"cover":_ref2$resizeMode,style=_ref2.style,props=_objectWithoutProperties(_ref2,_excluded);var imageSource=source===null||source===undefined?Config.placeholderImageURL:source;var styles=StyleSheet.flatten(style||{});var _generateDimensions=generateDimensions(styles),aspectRatio=_generateDimensions.aspectRatio,width=_generateDimensions.width,height=_generateDimensions.height;if(aspectRatio){return _jsx(AspectRatio,{style:[style,{width:width,height:height,aspectRatio:aspectRatio}],children:_jsx(NativeImage,Object.assign({},props,{source:imageSource,resizeMode:resizeMode,style:[style,{height:"100%",width:"100%"}]}))});}return _jsx(NativeImage,Object.assign({},props,{source:source,resizeMode:resizeMode,style:style}));};export default Image;
@@ -1,20 +1,4 @@
1
1
  import React from "react";
2
- import { ImageContentPosition, ImageProps as ExpoImageProps } from "expo-image";
3
- interface ExtendedImageProps extends ExpoImageProps {
4
- placeholder?: {
5
- blurhash?: string;
6
- thumbhash?: string;
7
- };
8
- transition?: number | {
9
- duration?: number;
10
- effect?: "cross-dissolve" | "flip-from-top" | "flip-from-right" | "flip-from-bottom" | "flip-from-left" | "curl-up" | "curl-down";
11
- timing?: "ease-in-out" | "ease-in" | "ease-out" | "linear";
12
- };
13
- contentFit?: "cover" | "contain" | "fill" | "none" | "scale-down";
14
- contentPosition?: ImageContentPosition;
15
- cachePolicy?: "none" | "disk" | "memory" | "memory-disk";
16
- allowDownscaling?: boolean;
17
- recyclingKey?: string;
18
- }
19
- declare const Image: React.FC<ExtendedImageProps>;
2
+ import { ImageProps } from "react-native";
3
+ declare const Image: React.FC<ImageProps>;
20
4
  export default Image;
@@ -1,7 +1,6 @@
1
1
  /* README: Internal Image component used for stuff like Card. DO NOT EXPORT! */
2
2
  import React from "react";
3
- import { StyleSheet } from "react-native";
4
- import { Image as ExpoImage, } from "expo-image";
3
+ import { Image as NativeImage, StyleSheet, } from "react-native";
5
4
  import Config from "./Config";
6
5
  import AspectRatio from "./AspectRatio";
7
6
  const generateDimensions = ({ aspectRatio, width, height, }) => {
@@ -27,29 +26,15 @@ const generateDimensions = ({ aspectRatio, width, height, }) => {
27
26
  }
28
27
  return { width, height };
29
28
  };
30
- const resizeModeToContentFit = (resizeMode) => {
31
- // Convert deprecated resizeMode prop to contentFit prop used in expo-image
32
- // Maps RN Image resizeMode values to their equivalent expo-image contentFit values
33
- const mapping = {
34
- cover: "cover",
35
- contain: "contain",
36
- stretch: "fill",
37
- repeat: "none",
38
- center: "scale-down",
39
- };
40
- return mapping[resizeMode] || "cover";
41
- };
42
- const Image = ({ source, resizeMode = "cover", style, placeholder, transition = 300, contentFit = "cover", contentPosition = "center", cachePolicy = "memory-disk", allowDownscaling = true, recyclingKey, ...props }) => {
29
+ const Image = ({ source, resizeMode = "cover", style, ...props }) => {
43
30
  let imageSource = source === null || source === undefined
44
31
  ? Config.placeholderImageURL
45
32
  : source;
46
33
  const styles = StyleSheet.flatten(style || {});
47
34
  const { aspectRatio, width, height } = generateDimensions(styles);
48
- // Use contentFit if provided, otherwise fall back to resizeMode
49
- const finalContentFit = contentFit || resizeModeToContentFit(resizeMode);
50
35
  if (aspectRatio) {
51
36
  return (React.createElement(AspectRatio, { style: [style, { width, height, aspectRatio }] },
52
- React.createElement(ExpoImage, { ...props, source: imageSource, contentFit: finalContentFit, placeholder: placeholder, transition: transition, contentPosition: contentPosition, cachePolicy: cachePolicy, allowDownscaling: allowDownscaling, recyclingKey: recyclingKey, style: [
37
+ React.createElement(NativeImage, { ...props, source: imageSource, resizeMode: resizeMode, style: [
53
38
  style,
54
39
  {
55
40
  height: "100%",
@@ -57,7 +42,7 @@ const Image = ({ source, resizeMode = "cover", style, placeholder, transition =
57
42
  },
58
43
  ] })));
59
44
  }
60
- return (React.createElement(ExpoImage, { ...props, source: source, contentFit: finalContentFit, placeholder: placeholder, transition: transition, contentPosition: contentPosition, cachePolicy: cachePolicy, allowDownscaling: allowDownscaling, recyclingKey: recyclingKey, style: style }));
45
+ return (React.createElement(NativeImage, { ...props, source: source, resizeMode: resizeMode, style: style }));
61
46
  };
62
47
  export default Image;
63
48
  //# sourceMappingURL=Image.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Image.js","sourceRoot":"","s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