@artsy/palette-mobile 14.0.30 → 14.0.32
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.
|
@@ -16,4 +16,7 @@ storiesOf("Screen", module)
|
|
|
16
16
|
.add("FlatList With AnimatedHeader and StickySubHeader", () => (_jsxs(Screen, { children: [_jsx(Screen.AnimatedHeader, { title: "Title" }), _jsx(Screen.StickySubHeader, { title: "Title", children: _jsx(Flex, { width: "100%", height: 60, backgroundColor: "red10" }) }), _jsx(Screen.Body, { children: _jsx(Screen.FlatList, { data: Array.from({ length: 50 }).map((_, i) => "Item " + i), renderItem: ({ item, index }) => {
|
|
17
17
|
return (_jsx(Text, { my: 1, children: item }, index));
|
|
18
18
|
} }) })] })))
|
|
19
|
+
.add("FlatList With AnimatedHeader and large StickySubHeader", () => (_jsxs(Screen, { children: [_jsx(Screen.AnimatedHeader, { title: "Title" }), _jsx(Screen.StickySubHeader, { title: "Title", largeTitle: true, children: _jsx(Flex, { width: "100%", height: 60, backgroundColor: "red10" }) }), _jsx(Screen.Body, { children: _jsx(Screen.FlatList, { data: Array.from({ length: 50 }).map((_, i) => "Item " + i), renderItem: ({ item, index }) => {
|
|
20
|
+
return (_jsx(Text, { my: 1, children: item }, index));
|
|
21
|
+
} }) })] })))
|
|
19
22
|
.add("Fullwidth", () => (_jsxs(Screen, { children: [_jsx(Screen.Header, { title: "Title" }), _jsx(Screen.Body, { fullwidth: true, children: _jsx(Text, { children: "\"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\"" }) })] })));
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export interface StickySubHeaderProps extends React.PropsWithChildren<{}> {
|
|
3
3
|
title: string;
|
|
4
|
+
/**
|
|
5
|
+
* largeTitle will make the title use the `xl` variant;
|
|
6
|
+
*/
|
|
7
|
+
largeTitle?: boolean;
|
|
4
8
|
separatorComponent?: React.ReactNode;
|
|
5
9
|
subTitle?: string;
|
|
6
10
|
Component?: React.ReactNode;
|
|
@@ -9,7 +9,7 @@ import { Separator } from "../Separator";
|
|
|
9
9
|
import { Text } from "../Text";
|
|
10
10
|
const STICKY_BAR_HEIGHT = 42;
|
|
11
11
|
const DEFAULT_SEPARATOR_COMPONENT = _jsx(Separator, { borderColor: "black5" });
|
|
12
|
-
export const StickySubHeader = ({ title, separatorComponent = DEFAULT_SEPARATOR_COMPONENT, subTitle, children, Component, }) => {
|
|
12
|
+
export const StickySubHeader = ({ title, largeTitle = false, separatorComponent = DEFAULT_SEPARATOR_COMPONENT, subTitle, children, Component, }) => {
|
|
13
13
|
const { currentScrollY, scrollYOffset = 0 } = useScreenScrollContext();
|
|
14
14
|
const space = useSpace();
|
|
15
15
|
const [stickyBarHeight, setStickyHeaderHeight] = useState(null);
|
|
@@ -40,5 +40,5 @@ export const StickySubHeader = ({ title, separatorComponent = DEFAULT_SEPARATOR_
|
|
|
40
40
|
],
|
|
41
41
|
};
|
|
42
42
|
});
|
|
43
|
-
return (_jsxs(Flex, { children: [stickyBarHeight === null && (_jsx(Flex, { onLayout: (event) => handleLayout(event), position: "absolute", backgroundColor: "white100", zIndex: -1000, style: sharedStyles, children: _jsxs(Flex, { mb: 1, children: [_jsx(Text, { variant: "lg-display", color: "white100", children: title }), !!subTitle && (_jsx(Text, { variant: "xs", mt: 0.5, color: "white100", children: subTitle })), Component] }) })), _jsx(Animated.View, { style: [sharedStyles, animatedStyles], children: _jsxs(Flex, { style: { height: stickyBarHeight }, mb: 1, children: [_jsx(Text, { variant: "lg-display", children: title }), subTitle && (_jsx(Text, { variant: "xs", mt: 0.5, children: subTitle })), Component] }) }), children, children !== undefined && separatorComponent] }));
|
|
43
|
+
return (_jsxs(Flex, { children: [stickyBarHeight === null && (_jsx(Flex, { onLayout: (event) => handleLayout(event), position: "absolute", backgroundColor: "white100", zIndex: -1000, style: sharedStyles, children: _jsxs(Flex, { mb: 1, children: [_jsx(Text, { variant: largeTitle ? "xl" : "lg-display", color: "white100", children: title }), !!subTitle && (_jsx(Text, { variant: "xs", mt: 0.5, color: "white100", children: subTitle })), Component] }) })), _jsx(Animated.View, { style: [sharedStyles, animatedStyles], children: _jsxs(Flex, { style: { height: stickyBarHeight }, mb: 1, children: [_jsx(Text, { variant: largeTitle ? "xl" : "lg-display", children: title }), subTitle && (_jsx(Text, { variant: "xs", mt: 0.5, children: subTitle })), Component] }) }), children, children !== undefined && separatorComponent] }));
|
|
44
44
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { TouchableOpacity, TouchableWithoutFeedback, } from "react-native";
|
|
4
4
|
import Haptic from "react-native-haptic-feedback";
|
|
5
5
|
import { DEFAULT_ACTIVE_OPACITY } from "../../constants";
|
|
6
6
|
import { useColor } from "../../utils/hooks/useColor";
|
|
@@ -23,5 +23,5 @@ export const Touchable = ({ children, flex, haptic, noFeedback, onPress, underla
|
|
|
23
23
|
}
|
|
24
24
|
onPress(evt);
|
|
25
25
|
};
|
|
26
|
-
return noFeedback ? (_jsx(TouchableWithoutFeedback, { ...props, onPress: onPressWrapped, children: inner })) : (_jsx(
|
|
26
|
+
return noFeedback ? (_jsx(TouchableWithoutFeedback, { ...props, onPress: onPressWrapped, children: inner })) : (_jsx(TouchableOpacity, { activeOpacity: DEFAULT_ACTIVE_OPACITY, ...props, onPress: onPressWrapped, children: inner }));
|
|
27
27
|
};
|
package/package.json
CHANGED