@artsy/palette-mobile 13.0.6 → 13.0.8

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/CHANGELOG.md CHANGED
@@ -1,3 +1,31 @@
1
+ # v13.0.8 (Thu Sep 14 2023)
2
+
3
+ :tada: This release contains work from a new contributor! :tada:
4
+
5
+ Thank you, Anandaroop Roy ([@anandaroop](https://github.com/anandaroop)), for all your work!
6
+
7
+ #### 🐛 Bug Fix
8
+
9
+ - fix(image): set default Gemini resize mode to `fill` [#149](https://github.com/artsy/palette-mobile/pull/149) ([@anandaroop](https://github.com/anandaroop))
10
+
11
+ #### Authors: 1
12
+
13
+ - Anandaroop Roy ([@anandaroop](https://github.com/anandaroop))
14
+
15
+ ---
16
+
17
+ # v13.0.7 (Tue Sep 12 2023)
18
+
19
+ #### 🐛 Bug Fix
20
+
21
+ - feat(Image): expose gemini resize mode from Image [#148](https://github.com/artsy/palette-mobile/pull/148) ([@araujobarret](https://github.com/araujobarret))
22
+
23
+ #### Authors: 1
24
+
25
+ - Carlos Alberto de Araujo Barreto ([@araujobarret](https://github.com/araujobarret))
26
+
27
+ ---
28
+
1
29
  # v13.0.6 (Mon Sep 11 2023)
2
30
 
3
31
  #### 🐛 Bug Fix
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { FastImageProps } from "react-native-fast-image";
3
+ import { GeminiResizeMode } from "../../utils/createGeminiUrl";
3
4
  type CustomFastImageProps = Omit<FastImageProps, "onLoadStart" | "onLoadEnd" | "source">;
4
5
  export interface ImageProps extends CustomFastImageProps {
5
6
  /** Supplied aspect ratio of image. If none provided, defaults to 1 */
@@ -12,6 +13,8 @@ export interface ImageProps extends CustomFastImageProps {
12
13
  performResize?: boolean;
13
14
  /** Source url to the image */
14
15
  src: string;
16
+ /** Gemini resize_to param */
17
+ geminiResizeMode?: GeminiResizeMode;
15
18
  }
16
19
  export declare const Image: React.FC<ImageProps>;
17
20
  export {};
@@ -15,7 +15,7 @@ const hooks_1 = require("../../utils/hooks");
15
15
  const useScreenDimensions_1 = require("../../utils/hooks/useScreenDimensions");
16
16
  const Flex_1 = require("../Flex");
17
17
  const Skeleton_1 = require("../Skeleton");
18
- const Image = ({ aspectRatio, width, height, performResize = true, src, style, resizeMode, ...flexProps }) => {
18
+ const Image = ({ aspectRatio, width, height, performResize = true, src, style, resizeMode, geminiResizeMode, ...flexProps }) => {
19
19
  const [loading, setLoading] = (0, react_1.useState)(true);
20
20
  const dimensions = useImageDimensions({ aspectRatio, width, height });
21
21
  const color = (0, hooks_1.useColor)();
@@ -25,6 +25,7 @@ const Image = ({ aspectRatio, width, height, performResize = true, src, style, r
25
25
  imageURL: src,
26
26
  width: react_native_1.PixelRatio.getPixelSizeForLayoutSize(dimensions.width),
27
27
  height: react_native_1.PixelRatio.getPixelSizeForLayoutSize(dimensions.height),
28
+ resizeMode: geminiResizeMode,
28
29
  });
29
30
  }
30
31
  return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { position: "relative", ...flexProps, children: [!!loading && ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { position: "absolute", zIndex: 1, children: (0, jsx_runtime_1.jsx)(Skeleton_1.Skeleton, { children: (0, jsx_runtime_1.jsx)(Skeleton_1.SkeletonBox, { ...dimensions }) }) })), (0, jsx_runtime_1.jsx)(moti_1.MotiView, { animate: { opacity: loading ? 0 : 1 }, transition: { type: "timing", duration: 400, easing: react_native_reanimated_1.Easing.sin }, children: (0, jsx_runtime_1.jsx)(react_native_fast_image_1.default, { style: [dimensions, style, { backgroundColor: color("black30") }], resizeMode: resizeMode, onLoadStart: () => setLoading(true), onLoadEnd: () => setLoading(false), source: {
@@ -1,8 +1,9 @@
1
+ export type GeminiResizeMode = "fit" | "fill";
1
2
  export declare function createGeminiUrl({ imageURL, width, height, geminiHost, imageQuality, resizeMode, }: {
2
3
  imageURL: string;
3
4
  width: number;
4
5
  height: number;
5
6
  geminiHost?: string;
6
7
  imageQuality?: number;
7
- resizeMode?: "fit" | "fill";
8
+ resizeMode?: GeminiResizeMode;
8
9
  }): string;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createGeminiUrl = void 0;
4
4
  const react_native_1 = require("react-native");
5
- function createGeminiUrl({ imageURL, width, height, geminiHost = "d7hftxdivxxvm.cloudfront.net", imageQuality = 80, resizeMode = "fit", }) {
5
+ function createGeminiUrl({ imageURL, width, height, geminiHost = "d7hftxdivxxvm.cloudfront.net", imageQuality = 80, resizeMode = "fill", }) {
6
6
  const src = encodeURIComponent(imageURL);
7
7
  const roundedHeight = Math.round(height);
8
8
  const roundedWidth = Math.round(width);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artsy/palette-mobile",
3
- "version": "13.0.6",
3
+ "version": "13.0.8",
4
4
  "description": "Artsy's design system for React Native",
5
5
  "scripts": {
6
6
  "android": "react-native run-android",