@artsy/palette-mobile 11.0.24 → 11.0.26
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 +24 -0
- package/dist/elements/ButtonNew/Button.js +1 -0
- package/dist/elements/LegacyScreen/LegacyScreen.d.ts +21 -20
- package/dist/elements/LegacyScreen/LegacyScreen.js +15 -25
- package/dist/elements/ProgressBar/ProgressBar.js +1 -0
- package/dist/elements/Skeleton/Skeleton.js +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
# v11.0.26 (Fri May 05 2023)
|
|
2
|
+
|
|
3
|
+
#### 🐛 Bug Fix
|
|
4
|
+
|
|
5
|
+
- fix: mark all reanimated hooks functions as worklets explicitly [#100](https://github.com/artsy/palette-mobile/pull/100) ([@brainbicycle](https://github.com/brainbicycle))
|
|
6
|
+
|
|
7
|
+
#### Authors: 1
|
|
8
|
+
|
|
9
|
+
- Brian Beckerle ([@brainbicycle](https://github.com/brainbicycle))
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# v11.0.25 (Thu May 04 2023)
|
|
14
|
+
|
|
15
|
+
#### 🐛 Bug Fix
|
|
16
|
+
|
|
17
|
+
- fix(legacy-screen): use legacy screen code from Eigen [#99](https://github.com/artsy/palette-mobile/pull/99) ([@damassi](https://github.com/damassi))
|
|
18
|
+
|
|
19
|
+
#### Authors: 1
|
|
20
|
+
|
|
21
|
+
- Christopher Pappas ([@damassi](https://github.com/damassi))
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
1
25
|
# v11.0.24 (Thu May 04 2023)
|
|
2
26
|
|
|
3
27
|
#### 🐛 Bug Fix
|
|
@@ -80,6 +80,7 @@ const Button = ({ children, disabled: disabledProp, haptic, icon, iconPosition =
|
|
|
80
80
|
};
|
|
81
81
|
const colorsForVariantAndState = (0, colors_1.useColorsForVariantAndState)();
|
|
82
82
|
const containerColorsAnim = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
|
|
83
|
+
"worklet";
|
|
83
84
|
const colors = colorsForVariantAndState[variant];
|
|
84
85
|
if (disabled) {
|
|
85
86
|
return {
|
|
@@ -1,34 +1,35 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { FlexProps } from "../Flex";
|
|
3
3
|
interface HeaderProps {
|
|
4
4
|
onBack?: () => void;
|
|
5
|
+
title?: string;
|
|
6
|
+
onSkip?: () => void;
|
|
5
7
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
export declare const Header: React.FC<HeaderProps>;
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated Use `Screen.Header` instead.
|
|
11
|
+
*/
|
|
12
|
+
export declare const FloatingHeader: React.FC<HeaderProps>;
|
|
13
|
+
interface BodyProps extends Pick<FlexProps, "backgroundColor"> {
|
|
14
|
+
children?: React.ReactNode;
|
|
12
15
|
scroll?: boolean;
|
|
13
|
-
nosafe?: boolean;
|
|
14
16
|
noTopSafe?: boolean;
|
|
15
17
|
noBottomSafe?: boolean;
|
|
16
18
|
fullwidth?: boolean;
|
|
17
19
|
}
|
|
18
20
|
export declare const LegacyScreen: (({ children }: {
|
|
19
|
-
children?: ReactNode;
|
|
21
|
+
children?: React.ReactNode;
|
|
20
22
|
}) => JSX.Element) & {
|
|
21
|
-
Body: ({ scroll,
|
|
22
|
-
Header: (
|
|
23
|
-
FloatingHeader: FC<HeaderProps>;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
BodyXPadding: FC<import("..").BoxProps>;
|
|
23
|
+
Body: ({ scroll, noTopSafe, noBottomSafe, fullwidth, children, ...restFlexProps }: BodyProps) => JSX.Element;
|
|
24
|
+
Header: import("react").FC<HeaderProps>;
|
|
25
|
+
FloatingHeader: import("react").FC<HeaderProps>;
|
|
26
|
+
Background: import("react").FC<{
|
|
27
|
+
children?: import("react").ReactNode;
|
|
28
|
+
}>;
|
|
29
|
+
BottomView: import("react").FC<{
|
|
30
|
+
children?: import("react").ReactNode;
|
|
31
|
+
}>;
|
|
32
|
+
BodyXPadding: import("react").FC<import("..").BoxProps>;
|
|
32
33
|
SafeBottomPadding: () => JSX.Element | null;
|
|
33
34
|
};
|
|
34
35
|
export {};
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.LegacyScreen = void 0;
|
|
6
|
+
exports.LegacyScreen = exports.FloatingHeader = exports.Header = void 0;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const react_1 = require("react");
|
|
9
9
|
const react_nanny_1 = require("react-nanny");
|
|
@@ -15,11 +15,11 @@ const ArtsyKeyboardAvoidingView_1 = require("../ArtsyKeyboardAvoidingView");
|
|
|
15
15
|
const BackButton_1 = require("../BackButton");
|
|
16
16
|
const Flex_1 = require("../Flex");
|
|
17
17
|
const Spacer_1 = require("../Spacer");
|
|
18
|
-
|
|
18
|
+
const Text_1 = require("../Text");
|
|
19
|
+
const Touchable_1 = require("../Touchable");
|
|
19
20
|
const ScreenContext = (0, react_1.createContext)(null);
|
|
20
21
|
function useScreenContext() {
|
|
21
22
|
const context = (0, react_1.useContext)(ScreenContext);
|
|
22
|
-
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
23
23
|
if (!context) {
|
|
24
24
|
throw new Error("useScreenContext must be used within a Screen");
|
|
25
25
|
}
|
|
@@ -38,25 +38,23 @@ const ScreenWrapper = ({ children }) => {
|
|
|
38
38
|
const ScreenRoot = ({ children }) => {
|
|
39
39
|
const header = (0, react_nanny_1.getChildByType)(children, exports.LegacyScreen.Header);
|
|
40
40
|
const headerFloating = (0, react_nanny_1.getChildByType)(children, exports.LegacyScreen.FloatingHeader);
|
|
41
|
-
const rawHeader = (0, react_nanny_1.getChildByType)(children, exports.LegacyScreen.RawHeader);
|
|
42
41
|
const background = (0, react_nanny_1.getChildByType)(children, exports.LegacyScreen.Background);
|
|
43
42
|
const bodyChildren = (0, react_nanny_1.getChildrenByTypeDeep)(children, exports.LegacyScreen.Body);
|
|
44
|
-
return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flex: 1, backgroundColor: "
|
|
43
|
+
return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flex: 1, backgroundColor: "white100", children: [background /* fullscreen */, header, bodyChildren, headerFloating /* floating, so keep close to the bottom */] }));
|
|
45
44
|
};
|
|
46
|
-
const useUpdateScreenContext = ({ header
|
|
45
|
+
const useUpdateScreenContext = ({ header }) => {
|
|
47
46
|
const { setOptions } = useScreenContext();
|
|
48
|
-
(0, react_1.useEffect)(() => void setOptions({
|
|
49
|
-
handleTopSafeArea: header === "none" || header === "floating" || header === "raw-safe",
|
|
50
|
-
}),
|
|
47
|
+
(0, react_1.useEffect)(() => void setOptions({ handleTopSafeArea: header === "none" || header === "floating" }),
|
|
51
48
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
52
49
|
[header]);
|
|
53
50
|
};
|
|
54
51
|
const NAVBAR_HEIGHT = 44;
|
|
55
|
-
const Header = ({ onBack }) => {
|
|
52
|
+
const Header = ({ onBack, title, onSkip }) => {
|
|
56
53
|
useUpdateScreenContext({ header: "regular" });
|
|
57
54
|
const insets = (0, react_native_safe_area_context_1.useSafeAreaInsets)();
|
|
58
|
-
return ((0, jsx_runtime_1.
|
|
55
|
+
return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { mt: `${insets.top}px`, height: NAVBAR_HEIGHT, flexDirection: "row", alignItems: "center", justifyContent: "space-between", px: SCREEN_HORIZONTAL_PADDING, children: [(0, jsx_runtime_1.jsx)(Flex_1.Flex, { children: !!onBack && ((0, jsx_runtime_1.jsx)(BackButton_1.BackButton, { onPress: onBack, style: { flex: 1, justifyContent: "center" }, hitSlop: { left: 20, right: 20 } })) }), !!title && (0, jsx_runtime_1.jsx)(Text_1.Text, { children: title }), !!onSkip && ((0, jsx_runtime_1.jsx)(Touchable_1.Touchable, { haptic: "impactLight", onPress: onSkip, children: (0, jsx_runtime_1.jsx)(Flex_1.Flex, { height: "100%", justifyContent: "center", children: (0, jsx_runtime_1.jsx)(Text_1.Text, { textAlign: "right", variant: "xs", children: "Skip" }) }) }))] }));
|
|
59
56
|
};
|
|
57
|
+
exports.Header = Header;
|
|
60
58
|
/**
|
|
61
59
|
* @deprecated Use `Screen.Header` instead.
|
|
62
60
|
*/
|
|
@@ -68,23 +66,16 @@ const FloatingHeader = ({ onBack }) => {
|
|
|
68
66
|
}
|
|
69
67
|
return null;
|
|
70
68
|
};
|
|
71
|
-
|
|
72
|
-
* Use `RawHeader` when you need to make a custom header that we have no support for yet.
|
|
73
|
-
*/
|
|
74
|
-
const RawHeader = ({ children, nosafe = false }) => {
|
|
75
|
-
useUpdateScreenContext({ header: nosafe ? "raw-nosafe" : "raw-safe" });
|
|
76
|
-
const saInsets = (0, react_native_safe_area_context_1.useSafeAreaInsets)();
|
|
77
|
-
return ((0, jsx_runtime_1.jsx)(Wrap_1.Wrap, { if: !nosafe, children: (0, jsx_runtime_1.jsx)(Flex_1.Flex, { top: saInsets.top, children: (0, jsx_runtime_1.jsx)(Wrap_1.Wrap.Content, { children: children }) }) }));
|
|
78
|
-
};
|
|
69
|
+
exports.FloatingHeader = FloatingHeader;
|
|
79
70
|
const SCREEN_HORIZONTAL_PADDING = 2;
|
|
80
|
-
const Body = ({ scroll = false,
|
|
71
|
+
const Body = ({ scroll = false, noTopSafe = false, noBottomSafe = false, fullwidth = false, children, ...restFlexProps }) => {
|
|
81
72
|
const childrenExceptBottomView = (0, react_nanny_1.removeChildrenByType)(children, exports.LegacyScreen.BottomView);
|
|
82
73
|
const bottomView = (0, react_nanny_1.getChildrenByType)(children, exports.LegacyScreen.BottomView);
|
|
83
74
|
const { options } = useScreenContext();
|
|
84
75
|
const insets = (0, react_native_safe_area_context_1.useSafeAreaInsets)();
|
|
85
76
|
const withTopSafeArea = options.handleTopSafeArea && !noTopSafe;
|
|
86
77
|
const withBottomSafeArea = !noBottomSafe;
|
|
87
|
-
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(Flex_1.Flex, { flex: 1, mt:
|
|
78
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(Flex_1.Flex, { flex: 1, mt: withTopSafeArea ? `${insets.top}px` : undefined, mb: withBottomSafeArea ? `${insets.bottom}px` : undefined, ...restFlexProps, children: (0, jsx_runtime_1.jsx)(Wrap_1.Wrap, { if: scroll, children: (0, jsx_runtime_1.jsxs)(ArtsyKeyboardAvoidingView_1.ArtsyKeyboardAvoidingView, { children: [(0, jsx_runtime_1.jsx)(react_native_1.ScrollView, { keyboardShouldPersistTaps: "handled", contentInset: { bottom: options.bottomViewHeight - insets.bottom }, children: (0, jsx_runtime_1.jsx)(Wrap_1.Wrap.Content, { children: (0, jsx_runtime_1.jsx)(Flex_1.Flex, { flex: 1, px: fullwidth ? undefined : SCREEN_HORIZONTAL_PADDING, children: childrenExceptBottomView }) }) }), bottomView] }) }) }) }));
|
|
88
79
|
};
|
|
89
80
|
const Background = ({ children }) => ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { position: "absolute", top: 0, bottom: 0, left: 0, right: 0, children: children }));
|
|
90
81
|
const BottomView = ({ children }) => {
|
|
@@ -123,7 +114,7 @@ const BottomView = ({ children }) => {
|
|
|
123
114
|
* One use case might be if you need to put an image background or something in the body,
|
|
124
115
|
* but you also need some content with the right padding.
|
|
125
116
|
*/
|
|
126
|
-
const BodyXPadding = (props) => (0, jsx_runtime_1.jsx)(Flex_1.Flex, { px: SCREEN_HORIZONTAL_PADDING, ...props });
|
|
117
|
+
const BodyXPadding = (props) => ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { px: SCREEN_HORIZONTAL_PADDING, ...props }));
|
|
127
118
|
/**
|
|
128
119
|
* If there is a bottom safe area, this will render nothing.
|
|
129
120
|
* If there is no bottom safe area, this will render a small padding.
|
|
@@ -140,9 +131,8 @@ const SafeBottomPadding = () => {
|
|
|
140
131
|
};
|
|
141
132
|
exports.LegacyScreen = Object.assign(ScreenWrapper, {
|
|
142
133
|
Body,
|
|
143
|
-
Header,
|
|
144
|
-
FloatingHeader,
|
|
145
|
-
RawHeader,
|
|
134
|
+
Header: exports.Header,
|
|
135
|
+
FloatingHeader: exports.FloatingHeader,
|
|
146
136
|
Background,
|
|
147
137
|
BottomView,
|
|
148
138
|
BodyXPadding,
|
|
@@ -35,6 +35,7 @@ const ProgressBar = ({ animationDuration = 200, backgroundColor = "black30", hei
|
|
|
35
35
|
const width = (0, react_native_reanimated_1.useSharedValue)("0%");
|
|
36
36
|
const progress = clamp(unclampedProgress, 0, 100);
|
|
37
37
|
const progressAnim = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
|
|
38
|
+
"worklet";
|
|
38
39
|
return { width: width.value };
|
|
39
40
|
});
|
|
40
41
|
const [onCompletionCalled, setOnCompletionCalled] = (0, react_1.useState)(false);
|
|
@@ -43,6 +43,7 @@ const Skeleton = ({ children }) => {
|
|
|
43
43
|
const opacity = (0, react_native_reanimated_1.useSharedValue)(0.5);
|
|
44
44
|
opacity.value = (0, react_native_reanimated_1.withRepeat)((0, react_native_reanimated_1.withTiming)(1, { duration: 1000, easing: react_native_reanimated_1.Easing.ease }), -1, true);
|
|
45
45
|
const fadeLoopAnim = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
|
|
46
|
+
"worklet";
|
|
46
47
|
return { opacity: opacity.value };
|
|
47
48
|
}, []);
|
|
48
49
|
return (0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { style: fadeLoopAnim, children: children });
|