@artsy/palette-mobile 22.1.0--canary.425.5095.0 → 22.1.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.
@@ -3,8 +3,7 @@ import FastImage from "@d11/react-native-fast-image";
3
3
  import { memo, useState } from "react";
4
4
  // @ts-expect-error
5
5
  import { Blurhash } from "react-native-blurhash";
6
- import Animated, { useAnimatedStyle, useSharedValue, withSpring } from "react-native-reanimated";
7
- import { scheduleOnRN } from "react-native-worklets";
6
+ import Animated, { runOnJS, useAnimatedStyle, useSharedValue, withSpring, } from "react-native-reanimated";
8
7
  import { getImageURL } from "./helpers/getImageURL";
9
8
  import { DEFAULT_ANIMATION_DURATION } from "../../constants";
10
9
  import { useColor } from "../../utils/hooks";
@@ -18,7 +17,7 @@ export const Image = memo(({ aspectRatio, width, height, performResize = true, s
18
17
  const color = useColor();
19
18
  const onLoadEnd = () => {
20
19
  opacity.value = withSpring(0, { duration: DEFAULT_ANIMATION_DURATION }, () => {
21
- scheduleOnRN(setIsLoading, false);
20
+ runOnJS(setIsLoading)(false);
22
21
  });
23
22
  };
24
23
  const skeletonStyle = useAnimatedStyle(() => {
@@ -27,8 +26,7 @@ export const Image = memo(({ aspectRatio, width, height, performResize = true, s
27
26
  };
28
27
  });
29
28
  if (showLoadingState) {
30
- // Keep logic as small as possible here to save on performance
31
- return _jsx(Flex, { backgroundColor: "mono10", ...dimensions, style: { position: "absolute" } });
29
+ return (_jsx(ImageSkeleton, { dimensions: dimensions, blurhash: blurhash, style: { position: "absolute" } }));
32
30
  }
33
31
  return (_jsxs(Flex, { position: "relative", ...flexProps, style: { ...dimensions }, children: [_jsx(FastImage, { style: [
34
32
  dimensions,
@@ -13,7 +13,6 @@ export interface HeaderProps {
13
13
  title?: string | JSX.Element;
14
14
  titleProps?: FlexProps;
15
15
  titleShown?: boolean;
16
- zIndex?: number;
17
16
  }
18
17
  export declare const AnimatedHeader: React.FC<HeaderProps>;
19
18
  export declare const Header: React.FC<HeaderProps>;
@@ -11,13 +11,13 @@ import { Touchable } from "../Touchable";
11
11
  export const AnimatedHeader = (props) => {
12
12
  return _jsx(Header, { animated: true, ...props });
13
13
  };
14
- export const Header = ({ animated = false, hideLeftElements, hideRightElements, hideTitle, leftElements, onBack, rightElements, title, titleProps = {}, zIndex = ZINDEX.header, }) => {
14
+ export const Header = ({ animated = false, hideLeftElements, hideRightElements, hideTitle, leftElements, onBack, rightElements, title, titleProps = {}, }) => {
15
15
  const { width } = useScreenDimensions();
16
16
  const space = useSpace();
17
17
  // Assumes small left and right elements, it protects from overflowing
18
18
  // but doesn't cover edge cases where right or left are bigger
19
19
  const centerMaxWidth = width - space(4) - DEFAULT_ICON_SIZE * 2;
20
- return (_jsxs(Flex, { height: NAVBAR_HEIGHT, flexDirection: "row", px: 2, zIndex: zIndex, backgroundColor: "background", alignItems: "center", children: [_jsx(Flex, { flex: 1, children: _jsx(Left, { leftElements: leftElements, onBack: onBack, hideLeftElements: hideLeftElements }) }), _jsx(Flex, { maxWidth: centerMaxWidth, ...titleProps, children: _jsx(Center, { animated: animated, title: title, hideTitle: hideTitle }) }), _jsx(Flex, { flex: 1, alignItems: "flex-end", children: _jsx(Right, { rightElements: rightElements, hideRightElements: hideRightElements }) })] }));
20
+ return (_jsxs(Flex, { height: NAVBAR_HEIGHT, flexDirection: "row", px: 2, zIndex: ZINDEX.header, backgroundColor: "background", alignItems: "center", children: [_jsx(Flex, { flex: 1, children: _jsx(Left, { leftElements: leftElements, onBack: onBack, hideLeftElements: hideLeftElements }) }), _jsx(Flex, { maxWidth: centerMaxWidth, ...titleProps, children: _jsx(Center, { animated: animated, title: title, hideTitle: hideTitle }) }), _jsx(Flex, { flex: 1, alignItems: "flex-end", children: _jsx(Right, { rightElements: rightElements, hideRightElements: hideRightElements }) })] }));
21
21
  };
22
22
  const Right = ({ hideRightElements, rightElements }) => {
23
23
  return _jsx(_Fragment, { children: !hideRightElements && rightElements });
@@ -1,5 +1,5 @@
1
- import { FlashListProps, FlashListRef } from "@shopify/flash-list";
1
+ import { MasonryFlashListProps, MasonryFlashListRef } from "@shopify/flash-list";
2
2
  import { Ref } from "react";
3
- export declare function TabMasonry<T>(props: FlashListProps<T> & {
4
- innerRef?: Ref<FlashListRef<T>> | null;
3
+ export declare function TabMasonry<T>(props: MasonryFlashListProps<T> & {
4
+ innerRef?: Ref<MasonryFlashListRef<T>> | null;
5
5
  }): import("react/jsx-runtime").JSX.Element;
@@ -6,7 +6,7 @@ export function TabMasonry(props) {
6
6
  useListenForTabContentScroll();
7
7
  const space = useSpace();
8
8
  const contentContainerStyle = (props.contentContainerStyle ?? {});
9
- return (_jsx(Tabs.FlashList, { masonry: true, contentContainerStyle: {
9
+ return (_jsx(Tabs.MasonryFlashList, { contentContainerStyle: {
10
10
  paddingHorizontal: space(2),
11
11
  ...contentContainerStyle,
12
12
  }, ...props, ref: props.innerRef }));
@@ -15,13 +15,7 @@ export declare const TabsWithAnimatedHeader: {
15
15
  name: string;
16
16
  };
17
17
  };
18
- export declare const TabsWithHeader: {
19
- (): import("react/jsx-runtime").JSX.Element;
20
- story: {
21
- name: string;
22
- };
23
- };
24
- export declare const MasonryTabsWithHeader: {
18
+ export declare const _TabsWithHeader: {
25
19
  (): import("react/jsx-runtime").JSX.Element;
26
20
  story: {
27
21
  name: string;
@@ -15,22 +15,7 @@ export const TabsWithAnimatedHeader = () => (_jsxs(Screen, { children: [_jsx(Scr
15
15
  TabsWithAnimatedHeader.story = {
16
16
  name: "Tabs with AnimatedHeader",
17
17
  };
18
- export const TabsWithHeader = () => {
19
- return (_jsxs(Tabs.TabsWithHeader, { title: "Artist Header", showLargeHeaderText: false, BelowTitleHeaderComponent: () => (_jsxs(Flex, { pointerEvents: "none", p: 2, children: [_jsx(Text, { children: "Info" }), _jsx(Text, { children: "More Info" })] })), children: [_jsx(Tabs.Tab, { name: "tab1", label: "Tab 1", children: _jsx(Tabs.ScrollView, { children: _jsx(Text, { children: "Some long text ".repeat(150) }) }) }), _jsx(Tabs.Tab, { name: "tab2", label: "Tab 2", children: _jsx(Text, { children: "Some long text ".repeat(150) }) })] }));
20
- };
21
- TabsWithHeader.story = {
18
+ export const _TabsWithHeader = () => (_jsxs(Tabs.TabsWithHeader, { title: "Artist Header", showLargeHeaderText: false, BelowTitleHeaderComponent: () => (_jsxs(Flex, { pointerEvents: "none", p: 2, children: [_jsx(Text, { children: "Info" }), _jsx(Text, { children: "More Info" })] })), children: [_jsx(Tabs.Tab, { name: "tab1", label: "Tab 1", children: _jsx(Tabs.ScrollView, { children: _jsx(Text, { children: "Some long text ".repeat(150) }) }) }), _jsx(Tabs.Tab, { name: "tab2", label: "Tab 2", children: _jsx(Text, { children: "Some long text ".repeat(150) }) })] }));
19
+ _TabsWithHeader.story = {
22
20
  name: "Tabs with header",
23
21
  };
24
- export const MasonryTabsWithHeader = () => {
25
- return (_jsxs(Tabs.TabsWithHeader, { title: "Tabs with Masonry", children: [_jsx(Tabs.Tab, { name: "tab1", label: "Tab 1", children: _jsx(Tabs.FlatList, { data: Array.from({ length: 20 }), contentContainerStyle: {
26
- paddingHorizontal: 0,
27
- }, renderItem: () => _jsx(Flex, { backgroundColor: randomHexColor(), height: 80, width: "100%" }) }) }), _jsx(Tabs.Tab, { name: "tab2", label: "Tab 2", children: _jsx(Tabs.FlatList, { contentContainerStyle: {
28
- paddingHorizontal: 0,
29
- }, data: Array.from({ length: 20 }), renderItem: () => _jsx(Flex, { backgroundColor: randomHexColor(), height: 80, width: "100%" }) }) })] }));
30
- };
31
- const randomHexColor = () => {
32
- return `#${Math.floor(Math.random() * 16777215).toString(16)}`;
33
- };
34
- MasonryTabsWithHeader.story = {
35
- name: "Masonry Tabs with header",
36
- };
@@ -41,5 +41,5 @@ export const useDarkModeSwitcher = (story) => {
41
41
  // We are keeping the status bar white on darkmode on ios because background isn't a supported prop on iOS
42
42
  , {
43
43
  // We are keeping the status bar white on darkmode on ios because background isn't a supported prop on iOS
44
- barStyle: isDarkMode && Platform.OS === "android" ? "light-content" : "dark-content", backgroundColor: isDarkMode && Platform.OS === "android" ? "black" : "white", translucent: true }), _jsxs(Flex, { flex: 1, backgroundColor: "background", children: [_jsxs(Flex, { flexDirection: "row", justifyContent: "space-around", py: 1, backgroundColor: "mono5", children: [_jsx(Text, { color: "mono100", children: "Dark mode" }), _jsxs(Flex, { flexDirection: "row", gap: 1, children: [_jsx(Pill, { variant: "default", selected: mode === "light", onPress: () => setMode("light"), children: "Light" }), _jsx(Pill, { variant: "default", selected: mode === "dark", onPress: () => setMode("dark"), children: "Dark" }), _jsx(Pill, { variant: "default", selected: mode === "system", onPress: () => setMode("system"), children: "System" })] })] }), _jsx(Flex, { flex: 1, justifyContent: "center", alignItems: "center", children: story() })] })] }) }) }));
44
+ barStyle: isDarkMode && Platform.OS === "android" ? "light-content" : "dark-content", backgroundColor: isDarkMode && Platform.OS === "android" ? "black" : "white", translucent: true }), _jsxs(Flex, { flex: 1, backgroundColor: "background", children: [_jsxs(Flex, { flexDirection: "row", justifyContent: "space-around", py: 1, backgroundColor: "mono5", children: [_jsx(Text, { color: "mono100", children: "Dark mode" }), _jsxs(Flex, { flexDirection: "row", gap: 1, children: [_jsx(Pill, { variant: "default", selected: mode === "light", onPress: () => setMode("light"), children: "Light" }), _jsx(Pill, { variant: "default", selected: mode === "dark", onPress: () => setMode("dark"), children: "Dark" }), _jsx(Pill, { variant: "default", selected: mode === "system", onPress: () => setMode("system"), children: "System" })] })] }), _jsx(Flex, { p: 2, children: story() })] })] }) }) }));
45
45
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artsy/palette-mobile",
3
- "version": "22.1.0--canary.425.5095.0",
3
+ "version": "22.1.0",
4
4
  "description": "Artsy's design system for React Native",
5
5
  "workspaces": [
6
6
  "Example"
@@ -45,11 +45,11 @@
45
45
  "@artsy/palette-tokens": "7.0.0",
46
46
  "@d11/react-native-fast-image": "8.12.0",
47
47
  "@react-spring/native": "^10.0.3",
48
- "@shopify/flash-list": "2.2.0",
48
+ "@shopify/flash-list": "^1.8.3",
49
49
  "@styled-system/theme-get": "^5.1.2",
50
50
  "events": "^3.3.0",
51
51
  "lodash": "^4.17.21",
52
- "moti": "^0.25.3",
52
+ "moti": "0.30.0",
53
53
  "react-nanny": "^2.15.0",
54
54
  "react-native-blurhash": "2.1.2",
55
55
  "react-native-collapsible-tab-view": "^8.0.1",
@@ -124,10 +124,9 @@
124
124
  "react-native": "0.81.5",
125
125
  "react-native-haptic-feedback": "1.14.0",
126
126
  "react-native-linear-gradient": "2.6.2",
127
- "react-native-reanimated": "4.1.5",
127
+ "react-native-reanimated": "3.19.4",
128
128
  "react-native-safe-area-context": "5.6.0",
129
129
  "react-native-svg": "15.12.1",
130
- "react-native-worklets": "0.6.1",
131
130
  "react-test-renderer": "19.1.0",
132
131
  "rimraf": "4.1.2",
133
132
  "styled-components": "6.1.19",