@fountain-ui/lab 3.0.0-alpha.2 → 3.0.0-alpha.20
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/build/commonjs/BottomSheet/BottomSheetNative.js +39 -12
- package/build/commonjs/BottomSheet/BottomSheetNative.js.map +1 -1
- package/build/commonjs/BottomSheet/BottomSheetProps.js.map +1 -1
- package/build/commonjs/BottomSheet/BottomSheetWeb.js +15 -9
- package/build/commonjs/BottomSheet/BottomSheetWeb.js.map +1 -1
- package/build/commonjs/BottomSheet/useDynamicSnapPoints.js +1 -7
- package/build/commonjs/BottomSheet/useDynamicSnapPoints.js.map +1 -1
- package/build/commonjs/BottomSheet/useDynamicSnapPoints.native.js +22 -0
- package/build/commonjs/BottomSheet/useDynamicSnapPoints.native.js.map +1 -0
- package/build/commonjs/Carousel/Carousel.js +4 -2
- package/build/commonjs/Carousel/Carousel.js.map +1 -1
- package/build/commonjs/Carousel/CarouselProps.js.map +1 -1
- package/build/commonjs/Carousel/components/InternalContext.js +2 -1
- package/build/commonjs/Carousel/components/InternalContext.js.map +1 -1
- package/build/commonjs/Carousel/components/ItemView.js +3 -1
- package/build/commonjs/Carousel/components/ItemView.js.map +1 -1
- package/build/commonjs/ComicViewer/FastScroll.js +8 -10
- package/build/commonjs/ComicViewer/FastScroll.js.map +1 -1
- package/build/commonjs/StatusBarProvider/StatusBarProvider.js +1 -1
- package/build/commonjs/StatusBarProvider/StatusBarProvider.js.map +1 -1
- package/build/commonjs/hooks/useUnstableCollapsibleAppBar.js +1 -1
- package/build/commonjs/hooks/useUnstableCollapsibleAppBar.js.map +1 -1
- package/build/module/BottomSheet/BottomSheetNative.js +37 -13
- package/build/module/BottomSheet/BottomSheetNative.js.map +1 -1
- package/build/module/BottomSheet/BottomSheetProps.js.map +1 -1
- package/build/module/BottomSheet/BottomSheetWeb.js +14 -9
- package/build/module/BottomSheet/BottomSheetWeb.js.map +1 -1
- package/build/module/BottomSheet/useDynamicSnapPoints.js +2 -8
- package/build/module/BottomSheet/useDynamicSnapPoints.js.map +1 -1
- package/build/module/BottomSheet/useDynamicSnapPoints.native.js +14 -0
- package/build/module/BottomSheet/useDynamicSnapPoints.native.js.map +1 -0
- package/build/module/Carousel/Carousel.js +4 -2
- package/build/module/Carousel/Carousel.js.map +1 -1
- package/build/module/Carousel/CarouselProps.js.map +1 -1
- package/build/module/Carousel/components/InternalContext.js +2 -1
- package/build/module/Carousel/components/InternalContext.js.map +1 -1
- package/build/module/Carousel/components/ItemView.js +3 -1
- package/build/module/Carousel/components/ItemView.js.map +1 -1
- package/build/module/ComicViewer/FastScroll.js +5 -8
- package/build/module/ComicViewer/FastScroll.js.map +1 -1
- package/build/module/StatusBarProvider/StatusBarProvider.js +1 -1
- package/build/module/StatusBarProvider/StatusBarProvider.js.map +1 -1
- package/build/module/hooks/useUnstableCollapsibleAppBar.js +1 -1
- package/build/module/hooks/useUnstableCollapsibleAppBar.js.map +1 -1
- package/build/typescript/BottomSheet/BottomSheetProps.d.ts +9 -1
- package/build/typescript/BottomSheet/useDynamicSnapPoints.native.d.ts +21 -0
- package/build/typescript/Carousel/Carousel.d.ts +1 -1
- package/build/typescript/Carousel/CarouselProps.d.ts +7 -0
- package/build/typescript/Carousel/components/InternalContext.d.ts +1 -0
- package/package.json +5 -4
- package/src/BottomSheet/BottomSheetNative.tsx +51 -18
- package/src/BottomSheet/BottomSheetProps.ts +11 -1
- package/src/BottomSheet/BottomSheetWeb.tsx +15 -7
- package/src/BottomSheet/useDynamicSnapPoints.native.ts +15 -0
- package/src/BottomSheet/useDynamicSnapPoints.ts +2 -9
- package/src/Carousel/Carousel.tsx +3 -0
- package/src/Carousel/CarouselProps.ts +8 -0
- package/src/Carousel/components/InternalContext.ts +2 -0
- package/src/Carousel/components/ItemView.tsx +2 -0
- package/src/ComicViewer/FastScroll.tsx +6 -12
- package/src/StatusBarProvider/StatusBarProvider.tsx +2 -2
- package/src/hooks/useUnstableCollapsibleAppBar.ts +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { Animated, LayoutChangeEvent, useWindowDimensions, ViewStyle } from 'react-native';
|
|
3
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
3
4
|
import {
|
|
4
5
|
BottomSheetBackdrop,
|
|
5
6
|
BottomSheetBackdropProps,
|
|
@@ -7,16 +8,22 @@ import {
|
|
|
7
8
|
BottomSheetModalProvider,
|
|
8
9
|
BottomSheetView,
|
|
9
10
|
} from '@gorhom/bottom-sheet';
|
|
10
|
-
import { Column, ExtendedStyle, isNotAndroid12, useAnimatedValue } from '@fountain-ui/core';
|
|
11
|
+
import { Column, css, ExtendedStyle, isNotAndroid12, useAnimatedValue } from '@fountain-ui/core';
|
|
11
12
|
import { useTheme } from '@fountain-ui/styles';
|
|
12
13
|
import type BottomSheetProps from './BottomSheetProps';
|
|
13
14
|
import TransparentBackdrop from './TransparentBackdrop';
|
|
15
|
+
import useDynamicSnapPoints from './useDynamicSnapPoints.native';
|
|
14
16
|
|
|
15
17
|
const NoHandle = () => null;
|
|
16
18
|
|
|
19
|
+
const DEFAULT_PADDING_BOTTOM = 24;
|
|
20
|
+
const DEFAULT_PADDING_TOP = 22;
|
|
21
|
+
const TOP_ELEMENT_HIDDEN_OFFSET = 16;
|
|
22
|
+
|
|
17
23
|
export default function BottomSheet(props: BottomSheetProps) {
|
|
18
24
|
const {
|
|
19
25
|
backdropOpacity = 0.5,
|
|
26
|
+
backgroundStyle: backgroundStyleProp,
|
|
20
27
|
borderRadius: borderRadiusProp,
|
|
21
28
|
children,
|
|
22
29
|
enableDynamicSizing = true,
|
|
@@ -25,6 +32,7 @@ export default function BottomSheet(props: BottomSheetProps) {
|
|
|
25
32
|
maxHeightNormalizedRatio = 0.8,
|
|
26
33
|
onChange,
|
|
27
34
|
snapPoints = [],
|
|
35
|
+
style: styleProp,
|
|
28
36
|
} = props;
|
|
29
37
|
|
|
30
38
|
const indexRef = useRef<number>(-1);
|
|
@@ -33,7 +41,8 @@ export default function BottomSheet(props: BottomSheetProps) {
|
|
|
33
41
|
const { height: windowHeight } = useWindowDimensions();
|
|
34
42
|
const [topElementHeight, setTopElementHeight] = useState(0);
|
|
35
43
|
|
|
36
|
-
const
|
|
44
|
+
const topElementHeightWithoutOffset = Math.max(0, topElementHeight - TOP_ELEMENT_HIDDEN_OFFSET);
|
|
45
|
+
const maxDynamicContentSize = Math.round(windowHeight * maxHeightNormalizedRatio) - topElementHeightWithoutOffset;
|
|
37
46
|
|
|
38
47
|
const handleTopElementLayout = (event: LayoutChangeEvent) => {
|
|
39
48
|
const { height } = event.nativeEvent.layout;
|
|
@@ -70,20 +79,31 @@ export default function BottomSheet(props: BottomSheetProps) {
|
|
|
70
79
|
const theme = useTheme();
|
|
71
80
|
|
|
72
81
|
const borderRadius = borderRadiusProp ?? theme.shape.radius.xxl;
|
|
73
|
-
const backgroundStyle =
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
82
|
+
const backgroundStyle = css([
|
|
83
|
+
{
|
|
84
|
+
backgroundColor: theme.palette.surface.base,
|
|
85
|
+
borderTopLeftRadius: borderRadius,
|
|
86
|
+
borderTopRightRadius: borderRadius,
|
|
87
|
+
},
|
|
88
|
+
backgroundStyleProp,
|
|
89
|
+
]);
|
|
90
|
+
|
|
91
|
+
const { bottom: bottomSafeInset } = useSafeAreaInsets();
|
|
92
|
+
|
|
93
|
+
const contentWrapperStyle: ViewStyle = css([
|
|
94
|
+
{
|
|
95
|
+
backgroundColor: theme.palette.surface.base,
|
|
96
|
+
borderTopLeftRadius: borderRadius,
|
|
97
|
+
borderTopRightRadius: borderRadius,
|
|
98
|
+
flexShrink: 1,
|
|
99
|
+
maxHeight: maxDynamicContentSize,
|
|
100
|
+
minHeight: 325,
|
|
101
|
+
overflow: 'hidden',
|
|
102
|
+
paddingBottom: DEFAULT_PADDING_BOTTOM + bottomSafeInset,
|
|
103
|
+
paddingTop: DEFAULT_PADDING_TOP,
|
|
104
|
+
},
|
|
105
|
+
styleProp,
|
|
106
|
+
]);
|
|
87
107
|
|
|
88
108
|
const isBackdropTransparent = backdropOpacity <= 0;
|
|
89
109
|
|
|
@@ -114,23 +134,33 @@ export default function BottomSheet(props: BottomSheetProps) {
|
|
|
114
134
|
}).start();
|
|
115
135
|
};
|
|
116
136
|
|
|
137
|
+
const {
|
|
138
|
+
animatedHandleHeight,
|
|
139
|
+
animatedSnapPoints,
|
|
140
|
+
animatedContentHeight,
|
|
141
|
+
handleContentLayout,
|
|
142
|
+
} = useDynamicSnapPoints(snapPoints);
|
|
143
|
+
|
|
117
144
|
return (
|
|
118
145
|
<BottomSheetModalProvider>
|
|
119
146
|
<BottomSheetModal
|
|
120
147
|
backdropComponent={isBackdropTransparent ? TransparentBackdrop : OpacityAwareBackdrop}
|
|
121
148
|
// @ts-ignore
|
|
122
149
|
backgroundStyle={backgroundStyle}
|
|
150
|
+
enableOverDrag={false}
|
|
123
151
|
index={index}
|
|
124
152
|
handleComponent={NoHandle}
|
|
125
153
|
onChange={handleChange}
|
|
126
154
|
onDismiss={handleDismiss}
|
|
127
155
|
ref={bottomSheetRef}
|
|
128
|
-
snapPoints={snapPoints}
|
|
129
156
|
enablePanDownToClose={Boolean(onChange)}
|
|
130
157
|
enableDynamicSizing={enableDynamicSizing}
|
|
131
158
|
maxDynamicContentSize={maxDynamicContentSize}
|
|
132
159
|
detached={Boolean(topElement)}
|
|
133
160
|
onAnimate={topElement ? onAnimate : undefined}
|
|
161
|
+
snapPoints={animatedSnapPoints}
|
|
162
|
+
handleHeight={animatedHandleHeight}
|
|
163
|
+
contentHeight={animatedContentHeight}
|
|
134
164
|
>
|
|
135
165
|
{topElement ? (
|
|
136
166
|
<Animated.View style={topElementAnimationStyle}>
|
|
@@ -143,7 +173,10 @@ export default function BottomSheet(props: BottomSheetProps) {
|
|
|
143
173
|
</Animated.View>
|
|
144
174
|
) : null}
|
|
145
175
|
|
|
146
|
-
<BottomSheetView
|
|
176
|
+
<BottomSheetView
|
|
177
|
+
onLayout={handleContentLayout}
|
|
178
|
+
style={contentWrapperStyle}
|
|
179
|
+
>
|
|
147
180
|
{children}
|
|
148
181
|
</BottomSheetView>
|
|
149
182
|
</BottomSheetModal>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { ComponentProps } from '@fountain-ui/core';
|
|
2
|
+
import type { ComponentProps, ExtendedStyle } from '@fountain-ui/core';
|
|
3
3
|
|
|
4
4
|
export default interface BottomSheetProps extends ComponentProps<{
|
|
5
5
|
/**
|
|
@@ -8,6 +8,11 @@ export default interface BottomSheetProps extends ComponentProps<{
|
|
|
8
8
|
*/
|
|
9
9
|
backdropOpacity?: number;
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* View style to be applied to the background component. (only native)
|
|
13
|
+
*/
|
|
14
|
+
backgroundStyle?: ExtendedStyle | ExtendedStyle[];
|
|
15
|
+
|
|
11
16
|
/**
|
|
12
17
|
* Border radius for bottom sheet
|
|
13
18
|
*/
|
|
@@ -54,4 +59,9 @@ export default interface BottomSheetProps extends ComponentProps<{
|
|
|
54
59
|
* @default []
|
|
55
60
|
*/
|
|
56
61
|
snapPoints?: Array<number | string>;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* View style to be applied to the content area.
|
|
65
|
+
*/
|
|
66
|
+
style?: ExtendedStyle | ExtendedStyle[];
|
|
57
67
|
}> {}
|
|
@@ -26,19 +26,20 @@ const useStyles: UseStyles<BottomSheetStyles> = function (): BottomSheetStyles {
|
|
|
26
26
|
borderTopLeftRadius: theme.shape.radius.xxl,
|
|
27
27
|
borderTopRightRadius: theme.shape.radius.xxl,
|
|
28
28
|
flexGrow: 1,
|
|
29
|
-
minHeight:
|
|
29
|
+
minHeight: 325,
|
|
30
30
|
overflow: 'hidden',
|
|
31
31
|
paddingBottom: theme.spacing(6),
|
|
32
32
|
paddingTop: theme.spacing(5.5),
|
|
33
33
|
},
|
|
34
34
|
topElementLocation: {
|
|
35
35
|
position: 'absolute',
|
|
36
|
-
bottom: 0,
|
|
37
36
|
width: '100%',
|
|
38
37
|
},
|
|
39
38
|
};
|
|
40
39
|
};
|
|
41
40
|
|
|
41
|
+
const TOP_ELEMENT_HIDDEN_OFFSET = 16;
|
|
42
|
+
|
|
42
43
|
export default function BottomSheet(props: BottomSheetProps) {
|
|
43
44
|
const {
|
|
44
45
|
backdropOpacity,
|
|
@@ -50,6 +51,7 @@ export default function BottomSheet(props: BottomSheetProps) {
|
|
|
50
51
|
maxHeightNormalizedRatio = 0.8,
|
|
51
52
|
onChange,
|
|
52
53
|
snapPoints = [],
|
|
54
|
+
style: styleProp,
|
|
53
55
|
} = props;
|
|
54
56
|
|
|
55
57
|
const styles = useStyles();
|
|
@@ -58,7 +60,8 @@ export default function BottomSheet(props: BottomSheetProps) {
|
|
|
58
60
|
|
|
59
61
|
const [topElementHeight, setTopElementHeight] = useState(0);
|
|
60
62
|
|
|
61
|
-
const
|
|
63
|
+
const topElementHeightWithoutOffset = Math.max(0, topElementHeight - TOP_ELEMENT_HIDDEN_OFFSET);
|
|
64
|
+
const maxDynamicContentSize = Math.round(windowHeight * maxHeightNormalizedRatio) - topElementHeightWithoutOffset;
|
|
62
65
|
|
|
63
66
|
const handleTopElementLayout = (event: LayoutChangeEvent) => {
|
|
64
67
|
const { height } = event.nativeEvent.layout;
|
|
@@ -71,6 +74,8 @@ export default function BottomSheet(props: BottomSheetProps) {
|
|
|
71
74
|
}
|
|
72
75
|
};
|
|
73
76
|
|
|
77
|
+
const filteredSnapPoints = snapPoints.filter(point => point !== 'CONTENT_HEIGHT');
|
|
78
|
+
|
|
74
79
|
const {
|
|
75
80
|
convertedSnapPoints,
|
|
76
81
|
handleLayout,
|
|
@@ -78,18 +83,21 @@ export default function BottomSheet(props: BottomSheetProps) {
|
|
|
78
83
|
} = useDynamicSnapPoints({
|
|
79
84
|
enableDynamicSizing,
|
|
80
85
|
maxDynamicContentSize,
|
|
81
|
-
snapPoints,
|
|
86
|
+
snapPoints: filteredSnapPoints,
|
|
82
87
|
});
|
|
83
88
|
|
|
84
|
-
const translateY =
|
|
89
|
+
const translateY = convertedSnapPoints.length > 0
|
|
90
|
+
? highestSnapPoint - (convertedSnapPoints[index] ?? 0)
|
|
91
|
+
: 0;
|
|
85
92
|
|
|
86
93
|
const contentStyles = css([
|
|
87
94
|
styles.paper,
|
|
88
95
|
{
|
|
89
96
|
...(borderRadius ? { borderTopLeftRadius: borderRadius, borderTopRightRadius: borderRadius } : {}),
|
|
90
|
-
...(highestSnapPoint !== maxDynamicContentSize ? { height: highestSnapPoint } : {}),
|
|
97
|
+
...(!enableDynamicSizing && highestSnapPoint !== maxDynamicContentSize ? { height: highestSnapPoint } : {}),
|
|
91
98
|
maxHeight: maxDynamicContentSize,
|
|
92
99
|
},
|
|
100
|
+
styleProp,
|
|
93
101
|
]);
|
|
94
102
|
|
|
95
103
|
return (
|
|
@@ -103,7 +111,7 @@ export default function BottomSheet(props: BottomSheetProps) {
|
|
|
103
111
|
{topElement ? (
|
|
104
112
|
<Column
|
|
105
113
|
onLayout={handleTopElementLayout}
|
|
106
|
-
style={styles.topElementLocation}
|
|
114
|
+
style={[styles.topElementLocation, { top: -topElementHeight }]}
|
|
107
115
|
>
|
|
108
116
|
{topElement}
|
|
109
117
|
</Column>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useBottomSheetDynamicSnapPoints } from '@gorhom/bottom-sheet';
|
|
2
|
+
import type BottomSheetProps from './BottomSheetProps';
|
|
3
|
+
|
|
4
|
+
export default function useDynamicSnapPoints(snapPoints: BottomSheetProps['snapPoints']) {
|
|
5
|
+
if (snapPoints?.includes('CONTENT_HEIGHT')) {
|
|
6
|
+
return useBottomSheetDynamicSnapPoints(snapPoints);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
return {
|
|
10
|
+
animatedHandleHeight: undefined,
|
|
11
|
+
animatedSnapPoints: snapPoints,
|
|
12
|
+
animatedContentHeight: undefined,
|
|
13
|
+
handleContentLayout: undefined,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useCallback, useMemo,
|
|
1
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
2
2
|
import { LayoutChangeEvent, useWindowDimensions } from 'react-native';
|
|
3
3
|
import * as R from 'ramda';
|
|
4
4
|
|
|
@@ -41,8 +41,6 @@ export default function useDynamicSnapPoints(params: UseDynamicSnapPointsParams)
|
|
|
41
41
|
|
|
42
42
|
const [contentHeight, setContentHeight] = useState<number>(INITIAL_CONTAINER_HEIGHT);
|
|
43
43
|
|
|
44
|
-
const hasMeasureRef = useRef<boolean>(false);
|
|
45
|
-
|
|
46
44
|
const convertedSnapPoints = useMemo(() => {
|
|
47
45
|
if (contentHeight === INITIAL_CONTAINER_HEIGHT) {
|
|
48
46
|
return [];
|
|
@@ -70,13 +68,8 @@ export default function useDynamicSnapPoints(params: UseDynamicSnapPointsParams)
|
|
|
70
68
|
const highestSnapPoint = R.last(convertedSnapPoints) ?? maxDynamicContentSize;
|
|
71
69
|
|
|
72
70
|
const handleLayout = useCallback((event: LayoutChangeEvent) => {
|
|
73
|
-
if (hasMeasureRef.current) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
hasMeasureRef.current = true;
|
|
78
71
|
const { height } = event.nativeEvent.layout;
|
|
79
|
-
setContentHeight(height);
|
|
72
|
+
setContentHeight(prev => (Math.abs(prev - height) > 1 ? height : prev));
|
|
80
73
|
}, []);
|
|
81
74
|
|
|
82
75
|
return {
|
|
@@ -24,6 +24,7 @@ const Carousel = forwardRef<CarouselInstance, CarouselProps>(function Carousel(p
|
|
|
24
24
|
itemHeight,
|
|
25
25
|
itemWidth,
|
|
26
26
|
loop = false,
|
|
27
|
+
needsOffscreenAlphaCompositingOnItem = false,
|
|
27
28
|
onIndexChange,
|
|
28
29
|
renderItem,
|
|
29
30
|
scrollEnabled = true,
|
|
@@ -89,6 +90,7 @@ const Carousel = forwardRef<CarouselInstance, CarouselProps>(function Carousel(p
|
|
|
89
90
|
itemWidth,
|
|
90
91
|
itemVisibilityStore,
|
|
91
92
|
loop,
|
|
93
|
+
needsOffscreenAlphaCompositingOnItem,
|
|
92
94
|
}), [
|
|
93
95
|
createItemStyle,
|
|
94
96
|
data,
|
|
@@ -97,6 +99,7 @@ const Carousel = forwardRef<CarouselInstance, CarouselProps>(function Carousel(p
|
|
|
97
99
|
itemWidth,
|
|
98
100
|
itemVisibilityStore,
|
|
99
101
|
loop,
|
|
102
|
+
needsOffscreenAlphaCompositingOnItem,
|
|
100
103
|
]);
|
|
101
104
|
|
|
102
105
|
return (
|
|
@@ -93,4 +93,12 @@ export default interface CarouselProps<ItemT = any> extends ComponentProps<{
|
|
|
93
93
|
* @default 5
|
|
94
94
|
*/
|
|
95
95
|
windowSize?: number;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Whether item views need to be rendered offscreen and composited with an alpha
|
|
99
|
+
* in order to preserve 100% correct colors and blending behavior.
|
|
100
|
+
* Use this when items have opacity animations and multiple overlapping elements.
|
|
101
|
+
* @default false
|
|
102
|
+
*/
|
|
103
|
+
needsOffscreenAlphaCompositingOnItem?: boolean;
|
|
96
104
|
}> {}
|
|
@@ -10,6 +10,7 @@ export interface InternalContextValue<ItemT> {
|
|
|
10
10
|
itemWidth: number;
|
|
11
11
|
itemVisibilityStore: ItemVisibilityStore;
|
|
12
12
|
loop: boolean;
|
|
13
|
+
needsOffscreenAlphaCompositingOnItem: boolean;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
const mockItemVisibilityStore: ItemVisibilityStore = {
|
|
@@ -26,6 +27,7 @@ const initialValue: Readonly<InternalContextValue<any>> = {
|
|
|
26
27
|
itemWidth: 0,
|
|
27
28
|
itemVisibilityStore: mockItemVisibilityStore,
|
|
28
29
|
loop: false,
|
|
30
|
+
needsOffscreenAlphaCompositingOnItem: false,
|
|
29
31
|
};
|
|
30
32
|
|
|
31
33
|
const InternalContext = createContext<InternalContextValue<any>>(initialValue);
|
|
@@ -24,6 +24,7 @@ export default function ItemView(props: ItemViewProps) {
|
|
|
24
24
|
itemHeight,
|
|
25
25
|
itemWidth,
|
|
26
26
|
itemVisibilityStore,
|
|
27
|
+
needsOffscreenAlphaCompositingOnItem,
|
|
27
28
|
} = useContext(InternalContext);
|
|
28
29
|
|
|
29
30
|
const [visible, setVisible] = useState(false);
|
|
@@ -44,6 +45,7 @@ export default function ItemView(props: ItemViewProps) {
|
|
|
44
45
|
|
|
45
46
|
return (
|
|
46
47
|
<Animated.View
|
|
48
|
+
needsOffscreenAlphaCompositing={needsOffscreenAlphaCompositingOnItem}
|
|
47
49
|
children={visible ? children(interpolation) : null}
|
|
48
50
|
onLayout={onLayout}
|
|
49
51
|
style={[
|
|
@@ -3,8 +3,9 @@ import * as R from 'ramda';
|
|
|
3
3
|
import { NativeScrollEvent, NativeSyntheticEvent, View } from 'react-native';
|
|
4
4
|
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
|
|
5
5
|
import Animated, { runOnJS, useAnimatedStyle, useSharedValue, withDelay, withTiming } from 'react-native-reanimated';
|
|
6
|
-
import { ChevronDown, ChevronUp } from '@fountain-ui/icons';
|
|
6
|
+
import { ChevronDown, ChevronUp } from '@fountain-ui/icons/src/v2Icons';
|
|
7
7
|
import { StyleSheet } from '@fountain-ui/core';
|
|
8
|
+
import { baseColors, commonColors } from '@fountain-ui/styles';
|
|
8
9
|
import FastScrollProps from './FastScrollProps';
|
|
9
10
|
import { offsetToPercentage, percentageToOffset } from './util';
|
|
10
11
|
|
|
@@ -14,7 +15,7 @@ const styles = StyleSheet.create({
|
|
|
14
15
|
indicator: {
|
|
15
16
|
width: INDICATOR_WIDTH,
|
|
16
17
|
height: 48,
|
|
17
|
-
backgroundColor: '
|
|
18
|
+
backgroundColor: baseColors.gray['650'],
|
|
18
19
|
flexDirection: 'column',
|
|
19
20
|
alignItems: 'center',
|
|
20
21
|
justifyContent: 'center',
|
|
@@ -157,16 +158,9 @@ const FastScroll = React.forwardRef((props: FastScrollProps, ref) => {
|
|
|
157
158
|
animatedStyle,
|
|
158
159
|
styles.indicator,
|
|
159
160
|
]}>
|
|
160
|
-
<ChevronUp
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
width={20}
|
|
164
|
-
/>
|
|
165
|
-
<ChevronDown
|
|
166
|
-
fill={'#ededed'}
|
|
167
|
-
height={20}
|
|
168
|
-
width={20}
|
|
169
|
-
/>
|
|
161
|
+
<ChevronUp fill={commonColors.static.strongInverse}/>
|
|
162
|
+
|
|
163
|
+
<ChevronDown fill={commonColors.static.strongInverse}/>
|
|
170
164
|
</Animated.View>
|
|
171
165
|
</GestureDetector>
|
|
172
166
|
</View>
|
|
@@ -30,7 +30,7 @@ export default function StatusBarProvider(props: StatusBarProviderProps) {
|
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
const theme = useTheme();
|
|
33
|
-
const defaultColor = theme.palette.background.
|
|
33
|
+
const defaultColor = theme.palette.background.base;
|
|
34
34
|
|
|
35
35
|
const [visible, setVisible] = React.useState(initialVisible);
|
|
36
36
|
const [backgroundViewColor, setBackgroundViewColor] = React.useState(defaultColor);
|
|
@@ -179,4 +179,4 @@ export default function StatusBarProvider(props: StatusBarProviderProps) {
|
|
|
179
179
|
{children}
|
|
180
180
|
</Provider>
|
|
181
181
|
);
|
|
182
|
-
}
|
|
182
|
+
}
|