@artsy/palette-mobile 21.0.1 → 22.0.0

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.
@@ -13,3 +13,4 @@ export declare const DEFAULT_ICON_SIZE: number;
13
13
  */
14
14
  export declare let DEFAULT_ACTIVE_OPACITY: number;
15
15
  export declare const setGlobalActiveOpacity: (opacity: number) => void;
16
+ export declare const DEFAULT_ANIMATION_DURATION = 200;
package/dist/constants.js CHANGED
@@ -12,3 +12,4 @@ export let DEFAULT_ACTIVE_OPACITY = 0.8;
12
12
  export const setGlobalActiveOpacity = (opacity) => {
13
13
  DEFAULT_ACTIVE_OPACITY = opacity;
14
14
  };
15
+ export const DEFAULT_ANIMATION_DURATION = 200;
@@ -1,24 +1,34 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import FastImage from "@d11/react-native-fast-image";
3
3
  import { memo, useState } from "react";
4
- import { View } from "react-native";
4
+ // @ts-expect-error
5
5
  import { Blurhash } from "react-native-blurhash";
6
+ import Animated, { runOnJS, useAnimatedStyle, useSharedValue, withSpring, } from "react-native-reanimated";
6
7
  import { getImageURL } from "./helpers/getImageURL";
8
+ import { DEFAULT_ANIMATION_DURATION } from "../../constants";
7
9
  import { useColor } from "../../utils/hooks";
8
10
  import { useScreenDimensions } from "../../utils/hooks/useScreenDimensions";
9
11
  import { Flex } from "../Flex";
10
12
  import { Skeleton, SkeletonBox } from "../Skeleton";
11
13
  export const Image = memo(({ aspectRatio, width, height, performResize = true, src, style, resizeMode, geminiResizeMode, showLoadingState = false, blurhash, ...flexProps }) => {
12
- const [isLoading, setIsLoading] = useState(false);
14
+ const [isLoading, setIsLoading] = useState(true);
13
15
  const dimensions = useImageDimensions({ aspectRatio, width, height });
16
+ const opacity = useSharedValue(1);
14
17
  const color = useColor();
15
18
  const onLoadEnd = () => {
16
- setIsLoading(false);
19
+ opacity.value = withSpring(0, { duration: DEFAULT_ANIMATION_DURATION }, () => {
20
+ runOnJS(setIsLoading)(false);
21
+ });
17
22
  };
23
+ const skeletonStyle = useAnimatedStyle(() => {
24
+ return {
25
+ opacity: opacity.value,
26
+ };
27
+ });
18
28
  if (showLoadingState) {
19
29
  return (_jsx(ImageSkeleton, { dimensions: dimensions, blurhash: blurhash, style: { position: "absolute" } }));
20
30
  }
21
- return (_jsxs(Flex, { position: "relative", ...flexProps, style: { ...dimensions }, children: [isLoading && (_jsx(View, { style: [dimensions, { position: "absolute" }], children: _jsx(ImageSkeleton, { dimensions: dimensions, blurhash: blurhash, style: { position: "absolute" } }) })), _jsx(FastImage, { style: [
31
+ return (_jsxs(Flex, { position: "relative", ...flexProps, style: { ...dimensions }, children: [_jsx(FastImage, { style: [
22
32
  dimensions,
23
33
  style,
24
34
  // If we have a blurhash, we don't want to show a background color
@@ -27,7 +37,7 @@ export const Image = memo(({ aspectRatio, width, height, performResize = true, s
27
37
  ], resizeMode: resizeMode, onLoadEnd: onLoadEnd, source: {
28
38
  priority: FastImage.priority.normal,
29
39
  uri: getImageURL({ src, dimensions, geminiResizeMode, performResize }),
30
- } })] }));
40
+ } }), isLoading && (_jsx(Animated.View, { style: [dimensions, { position: "absolute" }, skeletonStyle], children: _jsx(ImageSkeleton, { dimensions: dimensions, blurhash: blurhash, style: { position: "absolute" } }) }))] }));
31
41
  });
32
42
  const useImageDimensions = (props) => {
33
43
  const screenDimensions = useScreenDimensions();
@@ -3,8 +3,7 @@ import { EventEmitter } from "events";
3
3
  import { CloseFillIcon, HideIcon, ShowIcon, TriangleDownIcon } from "@artsy/icons/native";
4
4
  import { THEME } from "@artsy/palette-tokens";
5
5
  import themeGet from "@styled-system/theme-get";
6
- import isArray from "lodash/isArray";
7
- import isString from "lodash/isString";
6
+ import { isArray, isString } from "lodash";
8
7
  import { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState, } from "react";
9
8
  import { LayoutAnimation, Platform, TextInput, TouchableOpacity, } from "react-native";
10
9
  import Animated, { useAnimatedStyle, useSharedValue, withTiming } from "react-native-reanimated";
@@ -1,13 +1,13 @@
1
- import React, { JSX } from "react";
1
+ import { JSX, ReactNode } from "react";
2
2
  import { FlexProps } from "../Flex";
3
3
  export interface HeaderProps {
4
4
  animated?: boolean;
5
5
  hideLeftElements?: boolean;
6
6
  hideRightElements?: boolean;
7
7
  hideTitle?: boolean;
8
- leftElements?: React.ReactNode;
8
+ leftElements?: ReactNode;
9
9
  onBack?: () => void;
10
- rightElements?: React.ReactNode;
10
+ rightElements?: ReactNode;
11
11
  scrollY?: number;
12
12
  scrollYOffset?: number;
13
13
  title?: string | JSX.Element;
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@artsy/palette-mobile",
3
- "version": "21.0.1",
3
+ "version": "22.0.0",
4
4
  "description": "Artsy's design system for React Native",
5
5
  "workspaces": [
6
6
  "Example"
7
7
  ],
8
8
  "scripts": {
9
9
  "android": "yarn workspace palette-mobile-example android",
10
+ "android:clean": "yarn workspace palette-mobile-example android:prebuild --clean",
10
11
  "android:prebuild": "yarn workspace palette-mobile-example android:prebuild",
11
12
  "beta:ios": "bundle e fastlane ios beta",
12
13
  "bundle-install": "bundle install",
@@ -14,6 +15,7 @@
14
15
  "compile": "tsc",
15
16
  "install:all": "yarn install && yarn postinstall && yarn bundle-install",
16
17
  "ios": "yarn workspace palette-mobile-example ios",
18
+ "ios:clean": "yarn workspace palette-mobile-example ios:prebuild --clean",
17
19
  "ios:prebuild": "yarn workspace palette-mobile-example ios:prebuild",
18
20
  "lint:all": "yarn lint .",
19
21
  "lint": "eslint --cache --cache-location '.cache/eslint/' --ext .ts,.tsx --fix",
@@ -49,7 +51,7 @@
49
51
  "lodash": "^4.17.21",
50
52
  "moti": "^0.25.3",
51
53
  "react-nanny": "^2.15.0",
52
- "react-native-blurhash": "2.1.1",
54
+ "react-native-blurhash": "2.1.2",
53
55
  "react-native-collapsible-tab-view": "^8.0.1",
54
56
  "react-native-pager-view": "6.7.1",
55
57
  "react-native-popover-view": "^6.1.0",
@@ -81,13 +83,14 @@
81
83
  "@babel/preset-react": "7.18.6",
82
84
  "@babel/preset-typescript": "7.18.6",
83
85
  "@babel/runtime": "^7.25.0",
86
+ "@react-native-async-storage/async-storage": "^2.2.0",
84
87
  "@react-native/eslint-config": "0.76.9",
85
88
  "@testing-library/react-native": "13.2.0",
86
89
  "@types/events": "^3.0.0",
87
90
  "@types/jest": "29.4.0",
88
91
  "@types/lodash": "4.14.191",
89
- "@types/react": "~19.0.10",
90
- "@types/react-test-renderer": "19.0.0",
92
+ "@types/react": "~19.1.10",
93
+ "@types/react-test-renderer": "19.1.0",
91
94
  "@types/styled-system": "^5.1.16",
92
95
  "@types/styled-system__theme-get": "^5.0.2",
93
96
  "@typescript-eslint/eslint-plugin": "5.51.0",
@@ -117,20 +120,28 @@
117
120
  "postinstall-prepare": "^2.0.0",
118
121
  "prettier": "^2.8.8",
119
122
  "pull-lock": "1.0.0",
120
- "react": "19.0.0",
121
- "react-native": "0.79.6",
123
+ "react": "19.1.0",
124
+ "react-native": "0.81.5",
122
125
  "react-native-haptic-feedback": "1.14.0",
123
126
  "react-native-linear-gradient": "2.6.2",
124
- "react-native-reanimated": "3.17.5",
125
- "react-native-safe-area-context": "5.4.1",
126
- "react-native-svg": "15.12.0",
127
- "react-test-renderer": "19.0.0",
127
+ "react-native-reanimated": "3.19.4",
128
+ "react-native-safe-area-context": "5.6.0",
129
+ "react-native-svg": "15.12.1",
130
+ "react-test-renderer": "19.1.0",
128
131
  "rimraf": "4.1.2",
129
132
  "styled-components": "6.1.19",
130
133
  "typescript": "5.8.3"
131
134
  },
135
+ "resolutions": {
136
+ "@types/react": "~19.1.10",
137
+ "react": "19.1.0",
138
+ "react-test-renderer": "19.1.0",
139
+ "react-native-svg": "15.12.1",
140
+ "react-native-safe-area-context": "5.6.0"
141
+ },
132
142
  "engines": {
133
- "yarn": "4.x"
143
+ "yarn": "4.x",
144
+ "node": "24.x"
134
145
  },
135
146
  "files": [
136
147
  "dist"