@ledgerhq/lumen-ui-rnative 0.1.52 → 0.1.53
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/dist/module/index.js +1 -1
- package/dist/module/index.js.map +1 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheet.js +4 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheet.js.map +1 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheet.mdx +133 -2
- package/dist/module/lib/Components/BottomSheet/BottomSheet.stories.js +114 -7
- package/dist/module/lib/Components/BottomSheet/BottomSheet.stories.js.map +1 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheet.test.js +150 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheet.test.js.map +1 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheetContent.js +35 -0
- package/dist/module/lib/Components/BottomSheet/BottomSheetContent.js.map +1 -0
- package/dist/module/lib/Components/BottomSheet/BottomSheetFooter.js +43 -0
- package/dist/module/lib/Components/BottomSheet/BottomSheetFooter.js.map +1 -0
- package/dist/module/lib/Components/BottomSheet/Scrollables.js +18 -3
- package/dist/module/lib/Components/BottomSheet/Scrollables.js.map +1 -1
- package/dist/module/lib/Components/BottomSheet/index.js +2 -0
- package/dist/module/lib/Components/BottomSheet/index.js.map +1 -1
- package/dist/typescript/src/index.d.ts +1 -1
- package/dist/typescript/src/index.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/BottomSheet/BottomSheet.d.ts +8 -1
- package/dist/typescript/src/lib/Components/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/BottomSheet/BottomSheetContent.d.ts +3 -0
- package/dist/typescript/src/lib/Components/BottomSheet/BottomSheetContent.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/BottomSheet/BottomSheetFooter.d.ts +3 -0
- package/dist/typescript/src/lib/Components/BottomSheet/BottomSheetFooter.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/BottomSheet/Scrollables.d.ts +1 -0
- package/dist/typescript/src/lib/Components/BottomSheet/Scrollables.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/BottomSheet/index.d.ts +2 -0
- package/dist/typescript/src/lib/Components/BottomSheet/index.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/BottomSheet/types.d.ts +2 -0
- package/dist/typescript/src/lib/Components/BottomSheet/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -1
- package/src/lib/Components/BottomSheet/BottomSheet.mdx +133 -2
- package/src/lib/Components/BottomSheet/BottomSheet.stories.tsx +111 -5
- package/src/lib/Components/BottomSheet/BottomSheet.test.tsx +140 -0
- package/src/lib/Components/BottomSheet/BottomSheet.tsx +25 -9
- package/src/lib/Components/BottomSheet/BottomSheetContent.tsx +44 -0
- package/src/lib/Components/BottomSheet/BottomSheetFooter.tsx +47 -0
- package/src/lib/Components/BottomSheet/Scrollables.tsx +25 -12
- package/src/lib/Components/BottomSheet/index.ts +2 -0
- package/src/lib/Components/BottomSheet/types.ts +2 -1
|
@@ -5,8 +5,9 @@ import {
|
|
|
5
5
|
BottomSheetScrollView as GorhomBottomSheetScrollView,
|
|
6
6
|
BottomSheetVirtualizedList as GorhomBottomSheetVirtualizedList,
|
|
7
7
|
} from '@gorhom/bottom-sheet';
|
|
8
|
-
import
|
|
8
|
+
import { createContext, useContext } from 'react';
|
|
9
9
|
import { useStyleSheet } from '../../../styles';
|
|
10
|
+
import { useBottomSheetContext } from './BottomSheet';
|
|
10
11
|
import type {
|
|
11
12
|
BottomSheetViewProps,
|
|
12
13
|
BottomSheetFlatListProps,
|
|
@@ -15,16 +16,29 @@ import type {
|
|
|
15
16
|
BottomSheetVirtualizedListProps,
|
|
16
17
|
} from './types';
|
|
17
18
|
|
|
19
|
+
const BottomSheetScrollableViewContext = createContext(false);
|
|
20
|
+
export const useIsInsideScrollableView = () =>
|
|
21
|
+
useContext(BottomSheetScrollableViewContext);
|
|
22
|
+
|
|
23
|
+
const useHasFooter = () => {
|
|
24
|
+
const ctx = useBottomSheetContext({
|
|
25
|
+
consumerName: 'BottomSheetScrollable',
|
|
26
|
+
contextRequired: false,
|
|
27
|
+
});
|
|
28
|
+
return ctx?.hasFooter ?? false;
|
|
29
|
+
};
|
|
30
|
+
|
|
18
31
|
const useScrollableStyles = () => {
|
|
32
|
+
const hasFooter = useHasFooter();
|
|
19
33
|
return useStyleSheet(
|
|
20
34
|
(t) => ({
|
|
21
35
|
container: {
|
|
22
36
|
flex: 1,
|
|
23
37
|
paddingHorizontal: t.spacings.s16,
|
|
24
|
-
paddingBottom: t.spacings.s16,
|
|
38
|
+
paddingBottom: hasFooter ? 0 : t.spacings.s16,
|
|
25
39
|
},
|
|
26
40
|
}),
|
|
27
|
-
[],
|
|
41
|
+
[hasFooter],
|
|
28
42
|
);
|
|
29
43
|
};
|
|
30
44
|
|
|
@@ -36,11 +50,10 @@ export const BottomSheetView = ({
|
|
|
36
50
|
const styles = useScrollableStyles();
|
|
37
51
|
|
|
38
52
|
return (
|
|
39
|
-
<GorhomBottomSheetView
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
{children}
|
|
53
|
+
<GorhomBottomSheetView style={[styles.container, style]} {...props}>
|
|
54
|
+
<BottomSheetScrollableViewContext.Provider value={true}>
|
|
55
|
+
{children}
|
|
56
|
+
</BottomSheetScrollableViewContext.Provider>
|
|
44
57
|
</GorhomBottomSheetView>
|
|
45
58
|
);
|
|
46
59
|
};
|
|
@@ -56,7 +69,7 @@ export const BottomSheetFlatList = ({
|
|
|
56
69
|
return (
|
|
57
70
|
<GorhomBottomSheetFlatList
|
|
58
71
|
ref={ref}
|
|
59
|
-
style={[styles.container
|
|
72
|
+
style={[styles.container, style]}
|
|
60
73
|
{...props}
|
|
61
74
|
>
|
|
62
75
|
{children}
|
|
@@ -75,7 +88,7 @@ export const BottomSheetSectionList = ({
|
|
|
75
88
|
return (
|
|
76
89
|
<GorhomBottomSheetSectionList
|
|
77
90
|
ref={ref}
|
|
78
|
-
style={[styles.container
|
|
91
|
+
style={[styles.container, style]}
|
|
79
92
|
{...props}
|
|
80
93
|
>
|
|
81
94
|
{children}
|
|
@@ -94,7 +107,7 @@ export const BottomSheetScrollView = ({
|
|
|
94
107
|
return (
|
|
95
108
|
<GorhomBottomSheetScrollView
|
|
96
109
|
ref={ref}
|
|
97
|
-
style={[styles.container
|
|
110
|
+
style={[styles.container, style]}
|
|
98
111
|
{...props}
|
|
99
112
|
>
|
|
100
113
|
{children}
|
|
@@ -113,7 +126,7 @@ export const BottomSheetVirtualizedList = ({
|
|
|
113
126
|
return (
|
|
114
127
|
<GorhomBottomSheetVirtualizedList
|
|
115
128
|
ref={ref}
|
|
116
|
-
style={[styles.container
|
|
129
|
+
style={[styles.container, style]}
|
|
117
130
|
{...props}
|
|
118
131
|
>
|
|
119
132
|
{children}
|
|
@@ -2,5 +2,7 @@ export { BottomSheet } from './BottomSheet';
|
|
|
2
2
|
export * from './Scrollables';
|
|
3
3
|
export * from './useBottomSheetRef';
|
|
4
4
|
export * from './BottomSheetHeader';
|
|
5
|
+
export * from './BottomSheetFooter';
|
|
6
|
+
export * from './BottomSheetContent';
|
|
5
7
|
export * from './types';
|
|
6
8
|
export { BottomSheetModalProvider } from '@gorhom/bottom-sheet';
|
|
@@ -184,7 +184,7 @@ export type BottomSheetHeaderProps = {
|
|
|
184
184
|
*/
|
|
185
185
|
spacing?: boolean;
|
|
186
186
|
} & Omit<StyledViewProps, 'children'>;
|
|
187
|
-
|
|
187
|
+
export type BottomSheetContentProps = StyledViewProps;
|
|
188
188
|
export type BottomSheetViewProps = Parameters<typeof GorhomBottomSheetView>[0];
|
|
189
189
|
export type BottomSheetFlatListProps = Parameters<
|
|
190
190
|
typeof GorhomBottomSheetFlatList
|
|
@@ -198,3 +198,4 @@ export type BottomSheetScrollViewProps = Parameters<
|
|
|
198
198
|
export type BottomSheetVirtualizedListProps = Parameters<
|
|
199
199
|
typeof GorhomBottomSheetVirtualizedList
|
|
200
200
|
>[0];
|
|
201
|
+
export type BottomSheetFooterProps = StyledViewProps;
|