@vvedantb/native-ui 0.22.0 → 0.23.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.
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { ModalBottomSheet } from "@swmansion/react-native-bottom-sheet";
|
|
3
|
+
import { IconX } from "@tabler/icons-react-native";
|
|
4
|
+
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
5
|
+
import { StyleSheet, Text, TouchableOpacity, View } from "react-native";
|
|
6
|
+
import { Colors } from "./colors";
|
|
7
|
+
import { textStyle, typeStyle } from "./controlStyles";
|
|
8
|
+
import { floatingSolidFill } from "./floating";
|
|
9
|
+
import { withAlpha } from "./palette";
|
|
10
|
+
import { useLargerText } from "./theme";
|
|
11
|
+
import { tokens } from "./tokens";
|
|
12
|
+
import { useScheme } from "./useScheme";
|
|
13
|
+
const SHEET_RADIUS = 20;
|
|
14
|
+
|
|
15
|
+
// A single open detent at 40%, so the default matches the gorhom container's one
|
|
16
|
+
// snap point. A caller can pass several detents to try the library's multi-detent
|
|
17
|
+
// sizing. The closed detent (0) is added by the component.
|
|
18
|
+
const DEFAULT_DETENTS = ["40%"];
|
|
19
|
+
|
|
20
|
+
// A dimming scrim like the gorhom backdrop's `opacity={0.5}`. The library scales
|
|
21
|
+
// this alpha to 0 at the closed detent and to full at an open one.
|
|
22
|
+
const SCRIM_COLOR = "rgba(0, 0, 0, 0.5)";
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* EXPERIMENTAL. A trial of Software Mansion's native `@swmansion/react-native-bottom-sheet`,
|
|
26
|
+
* next to the gorhom-based {@link BottomSheetContainer}. It mirrors that container's role
|
|
27
|
+
* and props: a controlled sheet over the screen, driven by `visible`/`onClose`, with a
|
|
28
|
+
* title and a close button in the same chrome.
|
|
29
|
+
*
|
|
30
|
+
* It is built on `ModalBottomSheet` in `windowOverlay` mode, so it needs no root
|
|
31
|
+
* `BottomSheetProvider` and nothing else in the app changes. The library is New
|
|
32
|
+
* Architecture only and ships native code, so it needs a native build (no Expo Go).
|
|
33
|
+
*
|
|
34
|
+
* Extra over the gorhom container: `detents`, the library's multi-detent sizing. Pass
|
|
35
|
+
* the open detents, shortest first; the default is a single 40% detent.
|
|
36
|
+
*/
|
|
37
|
+
export function NativeBottomSheetContainer(t0) {
|
|
38
|
+
const $ = _c(54);
|
|
39
|
+
const {
|
|
40
|
+
visible,
|
|
41
|
+
onClose,
|
|
42
|
+
title,
|
|
43
|
+
children,
|
|
44
|
+
closeTestID,
|
|
45
|
+
detents: t1
|
|
46
|
+
} = t0;
|
|
47
|
+
const detents = t1 === undefined ? DEFAULT_DETENTS : t1;
|
|
48
|
+
const largerText = useLargerText();
|
|
49
|
+
const scheme = useScheme();
|
|
50
|
+
const isDark = scheme === "dark";
|
|
51
|
+
let t2;
|
|
52
|
+
if ($[0] !== detents) {
|
|
53
|
+
t2 = [0, ...detents];
|
|
54
|
+
$[0] = detents;
|
|
55
|
+
$[1] = t2;
|
|
56
|
+
} else {
|
|
57
|
+
t2 = $[1];
|
|
58
|
+
}
|
|
59
|
+
const detentList = t2;
|
|
60
|
+
const [index, setIndex] = useState(0);
|
|
61
|
+
let t3;
|
|
62
|
+
let t4;
|
|
63
|
+
if ($[2] !== visible) {
|
|
64
|
+
t3 = () => {
|
|
65
|
+
setIndex(current => visible ? current === 0 ? 1 : current : 0);
|
|
66
|
+
};
|
|
67
|
+
t4 = [visible];
|
|
68
|
+
$[2] = visible;
|
|
69
|
+
$[3] = t3;
|
|
70
|
+
$[4] = t4;
|
|
71
|
+
} else {
|
|
72
|
+
t3 = $[3];
|
|
73
|
+
t4 = $[4];
|
|
74
|
+
}
|
|
75
|
+
useEffect(t3, t4);
|
|
76
|
+
let t5;
|
|
77
|
+
if ($[5] !== onClose) {
|
|
78
|
+
t5 = next => {
|
|
79
|
+
setIndex(next);
|
|
80
|
+
if (next === 0) {
|
|
81
|
+
onClose();
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
$[5] = onClose;
|
|
85
|
+
$[6] = t5;
|
|
86
|
+
} else {
|
|
87
|
+
t5 = $[6];
|
|
88
|
+
}
|
|
89
|
+
const handleIndexChange = t5;
|
|
90
|
+
let t6;
|
|
91
|
+
if ($[7] !== onClose) {
|
|
92
|
+
t6 = () => {
|
|
93
|
+
setIndex(0);
|
|
94
|
+
onClose();
|
|
95
|
+
};
|
|
96
|
+
$[7] = onClose;
|
|
97
|
+
$[8] = t6;
|
|
98
|
+
} else {
|
|
99
|
+
t6 = $[8];
|
|
100
|
+
}
|
|
101
|
+
const handleCloseRequest = t6;
|
|
102
|
+
const t7 = floatingSolidFill[scheme];
|
|
103
|
+
let t8;
|
|
104
|
+
if ($[9] !== t7) {
|
|
105
|
+
t8 = <View style={[StyleSheet.absoluteFill, {
|
|
106
|
+
backgroundColor: t7
|
|
107
|
+
}]} />;
|
|
108
|
+
$[9] = t7;
|
|
109
|
+
$[10] = t8;
|
|
110
|
+
} else {
|
|
111
|
+
t8 = $[10];
|
|
112
|
+
}
|
|
113
|
+
const surface = t8;
|
|
114
|
+
let t9;
|
|
115
|
+
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
|
|
116
|
+
t9 = {
|
|
117
|
+
borderTopLeftRadius: SHEET_RADIUS,
|
|
118
|
+
borderTopRightRadius: SHEET_RADIUS
|
|
119
|
+
};
|
|
120
|
+
$[11] = t9;
|
|
121
|
+
} else {
|
|
122
|
+
t9 = $[11];
|
|
123
|
+
}
|
|
124
|
+
let t10;
|
|
125
|
+
if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
|
|
126
|
+
t10 = {
|
|
127
|
+
flex: 1,
|
|
128
|
+
paddingTop: 12
|
|
129
|
+
};
|
|
130
|
+
$[12] = t10;
|
|
131
|
+
} else {
|
|
132
|
+
t10 = $[12];
|
|
133
|
+
}
|
|
134
|
+
const t11 = tokens.color.muted[scheme];
|
|
135
|
+
let t12;
|
|
136
|
+
if ($[13] !== t11) {
|
|
137
|
+
t12 = withAlpha(t11, 0.4);
|
|
138
|
+
$[13] = t11;
|
|
139
|
+
$[14] = t12;
|
|
140
|
+
} else {
|
|
141
|
+
t12 = $[14];
|
|
142
|
+
}
|
|
143
|
+
let t13;
|
|
144
|
+
if ($[15] !== t12) {
|
|
145
|
+
t13 = <View accessibilityElementsHidden={true} importantForAccessibility="no-hide-descendants" style={{
|
|
146
|
+
alignSelf: "center",
|
|
147
|
+
height: 6,
|
|
148
|
+
width: 40,
|
|
149
|
+
borderRadius: 999,
|
|
150
|
+
backgroundColor: t12
|
|
151
|
+
}} />;
|
|
152
|
+
$[15] = t12;
|
|
153
|
+
$[16] = t13;
|
|
154
|
+
} else {
|
|
155
|
+
t13 = $[16];
|
|
156
|
+
}
|
|
157
|
+
let t14;
|
|
158
|
+
if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
|
|
159
|
+
t14 = {
|
|
160
|
+
flexDirection: "row",
|
|
161
|
+
alignItems: "center",
|
|
162
|
+
justifyContent: "space-between",
|
|
163
|
+
gap: 12,
|
|
164
|
+
paddingHorizontal: 20,
|
|
165
|
+
marginTop: 16,
|
|
166
|
+
marginBottom: 16
|
|
167
|
+
};
|
|
168
|
+
$[17] = t14;
|
|
169
|
+
} else {
|
|
170
|
+
t14 = $[17];
|
|
171
|
+
}
|
|
172
|
+
const t15 = largerText ? 24 : 20;
|
|
173
|
+
let t16;
|
|
174
|
+
if ($[18] !== t15) {
|
|
175
|
+
t16 = {
|
|
176
|
+
flex: 1,
|
|
177
|
+
fontSize: t15
|
|
178
|
+
};
|
|
179
|
+
$[18] = t15;
|
|
180
|
+
$[19] = t16;
|
|
181
|
+
} else {
|
|
182
|
+
t16 = $[19];
|
|
183
|
+
}
|
|
184
|
+
let t17;
|
|
185
|
+
if ($[20] !== scheme) {
|
|
186
|
+
t17 = textStyle("foreground", scheme);
|
|
187
|
+
$[20] = scheme;
|
|
188
|
+
$[21] = t17;
|
|
189
|
+
} else {
|
|
190
|
+
t17 = $[21];
|
|
191
|
+
}
|
|
192
|
+
let t18;
|
|
193
|
+
if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
|
|
194
|
+
t18 = typeStyle("semibold");
|
|
195
|
+
$[22] = t18;
|
|
196
|
+
} else {
|
|
197
|
+
t18 = $[22];
|
|
198
|
+
}
|
|
199
|
+
let t19;
|
|
200
|
+
if ($[23] !== t16 || $[24] !== t17) {
|
|
201
|
+
t19 = [t16, t17, t18];
|
|
202
|
+
$[23] = t16;
|
|
203
|
+
$[24] = t17;
|
|
204
|
+
$[25] = t19;
|
|
205
|
+
} else {
|
|
206
|
+
t19 = $[25];
|
|
207
|
+
}
|
|
208
|
+
let t20;
|
|
209
|
+
if ($[26] !== t19 || $[27] !== title) {
|
|
210
|
+
t20 = <Text accessibilityRole="header" style={t19}>{title}</Text>;
|
|
211
|
+
$[26] = t19;
|
|
212
|
+
$[27] = title;
|
|
213
|
+
$[28] = t20;
|
|
214
|
+
} else {
|
|
215
|
+
t20 = $[28];
|
|
216
|
+
}
|
|
217
|
+
let t21;
|
|
218
|
+
if ($[29] === Symbol.for("react.memo_cache_sentinel")) {
|
|
219
|
+
t21 = {
|
|
220
|
+
marginRight: -8,
|
|
221
|
+
height: 48,
|
|
222
|
+
width: 48,
|
|
223
|
+
alignItems: "center",
|
|
224
|
+
justifyContent: "center"
|
|
225
|
+
};
|
|
226
|
+
$[29] = t21;
|
|
227
|
+
} else {
|
|
228
|
+
t21 = $[29];
|
|
229
|
+
}
|
|
230
|
+
const t22 = largerText ? 32 : 28;
|
|
231
|
+
const t23 = isDark ? Colors.white : Colors.black;
|
|
232
|
+
let t24;
|
|
233
|
+
if ($[30] !== t22 || $[31] !== t23) {
|
|
234
|
+
t24 = <IconX size={t22} color={t23} />;
|
|
235
|
+
$[30] = t22;
|
|
236
|
+
$[31] = t23;
|
|
237
|
+
$[32] = t24;
|
|
238
|
+
} else {
|
|
239
|
+
t24 = $[32];
|
|
240
|
+
}
|
|
241
|
+
let t25;
|
|
242
|
+
if ($[33] !== closeTestID || $[34] !== handleCloseRequest || $[35] !== t24) {
|
|
243
|
+
t25 = <TouchableOpacity testID={closeTestID} accessibilityRole="button" accessibilityLabel="Close" onPress={handleCloseRequest} style={t21} hitSlop={8} activeOpacity={0.7}>{t24}</TouchableOpacity>;
|
|
244
|
+
$[33] = closeTestID;
|
|
245
|
+
$[34] = handleCloseRequest;
|
|
246
|
+
$[35] = t24;
|
|
247
|
+
$[36] = t25;
|
|
248
|
+
} else {
|
|
249
|
+
t25 = $[36];
|
|
250
|
+
}
|
|
251
|
+
let t26;
|
|
252
|
+
if ($[37] !== t20 || $[38] !== t25) {
|
|
253
|
+
t26 = <View style={t14}>{t20}{t25}</View>;
|
|
254
|
+
$[37] = t20;
|
|
255
|
+
$[38] = t25;
|
|
256
|
+
$[39] = t26;
|
|
257
|
+
} else {
|
|
258
|
+
t26 = $[39];
|
|
259
|
+
}
|
|
260
|
+
let t27;
|
|
261
|
+
if ($[40] === Symbol.for("react.memo_cache_sentinel")) {
|
|
262
|
+
t27 = {
|
|
263
|
+
flex: 1,
|
|
264
|
+
paddingHorizontal: 20,
|
|
265
|
+
paddingBottom: 48
|
|
266
|
+
};
|
|
267
|
+
$[40] = t27;
|
|
268
|
+
} else {
|
|
269
|
+
t27 = $[40];
|
|
270
|
+
}
|
|
271
|
+
let t28;
|
|
272
|
+
if ($[41] !== children) {
|
|
273
|
+
t28 = <View style={t27}>{children}</View>;
|
|
274
|
+
$[41] = children;
|
|
275
|
+
$[42] = t28;
|
|
276
|
+
} else {
|
|
277
|
+
t28 = $[42];
|
|
278
|
+
}
|
|
279
|
+
let t29;
|
|
280
|
+
if ($[43] !== t13 || $[44] !== t26 || $[45] !== t28) {
|
|
281
|
+
t29 = <View style={t10}>{t13}{t26}{t28}</View>;
|
|
282
|
+
$[43] = t13;
|
|
283
|
+
$[44] = t26;
|
|
284
|
+
$[45] = t28;
|
|
285
|
+
$[46] = t29;
|
|
286
|
+
} else {
|
|
287
|
+
t29 = $[46];
|
|
288
|
+
}
|
|
289
|
+
let t30;
|
|
290
|
+
if ($[47] !== detentList || $[48] !== handleCloseRequest || $[49] !== handleIndexChange || $[50] !== index || $[51] !== surface || $[52] !== t29) {
|
|
291
|
+
t30 = <ModalBottomSheet index={index} detents={detentList} lazy={true} windowOverlay={true} scrimColor={SCRIM_COLOR} scrimAccessibilityLabel="Close" surface={surface} surfaceStyle={t9} onIndexChange={handleIndexChange} onCloseRequest={handleCloseRequest}>{t29}</ModalBottomSheet>;
|
|
292
|
+
$[47] = detentList;
|
|
293
|
+
$[48] = handleCloseRequest;
|
|
294
|
+
$[49] = handleIndexChange;
|
|
295
|
+
$[50] = index;
|
|
296
|
+
$[51] = surface;
|
|
297
|
+
$[52] = t29;
|
|
298
|
+
$[53] = t30;
|
|
299
|
+
} else {
|
|
300
|
+
t30 = $[53];
|
|
301
|
+
}
|
|
302
|
+
return t30;
|
|
303
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// `@vvedantb/native-ui/native-bottom-sheet`. Experimental: imports Software Mansion's
|
|
2
|
+
// native `@swmansion/react-native-bottom-sheet` (an optional peer). Kept separate from
|
|
3
|
+
// the gorhom `./bottom-sheet` entry so neither affects the other.
|
|
4
|
+
export { NativeBottomSheetContainer } from "../NativeBottomSheetContainer";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vvedantb/native-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Shared React Native / Expo UI primitives. Floating surfaces, forms, overlays, toasts, settings chrome, tab bar, AI chat parts, the family app marks, a NativeWind preset, the Expo web root and Clerk + Convex auth screens.",
|
|
6
6
|
"type": "module",
|
|
@@ -89,6 +89,11 @@
|
|
|
89
89
|
"source": "./src/entries/bottom-sheet.ts",
|
|
90
90
|
"default": "./dist/entries/bottom-sheet.js"
|
|
91
91
|
},
|
|
92
|
+
"./native-bottom-sheet": {
|
|
93
|
+
"types": "./src/entries/native-bottom-sheet.ts",
|
|
94
|
+
"source": "./src/entries/native-bottom-sheet.ts",
|
|
95
|
+
"default": "./dist/entries/native-bottom-sheet.js"
|
|
96
|
+
},
|
|
92
97
|
"./gesture-handler": {
|
|
93
98
|
"types": "./src/entries/gesture-handler.ts",
|
|
94
99
|
"source": "./src/entries/gesture-handler.ts",
|
|
@@ -193,6 +198,7 @@
|
|
|
193
198
|
"@rn-primitives/select": "*",
|
|
194
199
|
"@rn-primitives/slot": "*",
|
|
195
200
|
"@rn-primitives/switch": "*",
|
|
201
|
+
"@swmansion/react-native-bottom-sheet": ">=1.1.0",
|
|
196
202
|
"@tabler/icons-react-native": "*",
|
|
197
203
|
"@vvedantb/server": ">=0.17.1",
|
|
198
204
|
"class-variance-authority": ">=0.7.0",
|
|
@@ -231,6 +237,9 @@
|
|
|
231
237
|
"@gorhom/bottom-sheet": {
|
|
232
238
|
"optional": true
|
|
233
239
|
},
|
|
240
|
+
"@swmansion/react-native-bottom-sheet": {
|
|
241
|
+
"optional": true
|
|
242
|
+
},
|
|
234
243
|
"@json-render/core": {
|
|
235
244
|
"optional": true
|
|
236
245
|
},
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { ModalBottomSheet } from "@swmansion/react-native-bottom-sheet";
|
|
2
|
+
import type { ModalDetent } from "@swmansion/react-native-bottom-sheet";
|
|
3
|
+
import { IconX } from "@tabler/icons-react-native";
|
|
4
|
+
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
5
|
+
import { StyleSheet, Text, TouchableOpacity, View } from "react-native";
|
|
6
|
+
import { Colors } from "./colors";
|
|
7
|
+
import { textStyle, typeStyle } from "./controlStyles";
|
|
8
|
+
import { floatingSolidFill } from "./floating";
|
|
9
|
+
import { withAlpha } from "./palette";
|
|
10
|
+
import { useLargerText } from "./theme";
|
|
11
|
+
import { tokens } from "./tokens";
|
|
12
|
+
import { useScheme } from "./useScheme";
|
|
13
|
+
|
|
14
|
+
const SHEET_RADIUS = 20;
|
|
15
|
+
|
|
16
|
+
// A single open detent at 40%, so the default matches the gorhom container's one
|
|
17
|
+
// snap point. A caller can pass several detents to try the library's multi-detent
|
|
18
|
+
// sizing. The closed detent (0) is added by the component.
|
|
19
|
+
const DEFAULT_DETENTS: readonly ModalDetent[] = ["40%"];
|
|
20
|
+
|
|
21
|
+
// A dimming scrim like the gorhom backdrop's `opacity={0.5}`. The library scales
|
|
22
|
+
// this alpha to 0 at the closed detent and to full at an open one.
|
|
23
|
+
const SCRIM_COLOR = "rgba(0, 0, 0, 0.5)";
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* EXPERIMENTAL. A trial of Software Mansion's native `@swmansion/react-native-bottom-sheet`,
|
|
27
|
+
* next to the gorhom-based {@link BottomSheetContainer}. It mirrors that container's role
|
|
28
|
+
* and props: a controlled sheet over the screen, driven by `visible`/`onClose`, with a
|
|
29
|
+
* title and a close button in the same chrome.
|
|
30
|
+
*
|
|
31
|
+
* It is built on `ModalBottomSheet` in `windowOverlay` mode, so it needs no root
|
|
32
|
+
* `BottomSheetProvider` and nothing else in the app changes. The library is New
|
|
33
|
+
* Architecture only and ships native code, so it needs a native build (no Expo Go).
|
|
34
|
+
*
|
|
35
|
+
* Extra over the gorhom container: `detents`, the library's multi-detent sizing. Pass
|
|
36
|
+
* the open detents, shortest first; the default is a single 40% detent.
|
|
37
|
+
*/
|
|
38
|
+
export function NativeBottomSheetContainer({
|
|
39
|
+
visible,
|
|
40
|
+
onClose,
|
|
41
|
+
title,
|
|
42
|
+
children,
|
|
43
|
+
closeTestID,
|
|
44
|
+
detents = DEFAULT_DETENTS,
|
|
45
|
+
}: {
|
|
46
|
+
visible: boolean;
|
|
47
|
+
onClose: () => void;
|
|
48
|
+
title: string;
|
|
49
|
+
children: React.ReactNode;
|
|
50
|
+
closeTestID?: string;
|
|
51
|
+
/** Open detents, shortest first. The closed detent is added automatically. */
|
|
52
|
+
detents?: readonly ModalDetent[];
|
|
53
|
+
}) {
|
|
54
|
+
const largerText = useLargerText();
|
|
55
|
+
const scheme = useScheme();
|
|
56
|
+
const isDark = scheme === "dark";
|
|
57
|
+
|
|
58
|
+
// The library sheet is controlled by a detent index. The first detent is the
|
|
59
|
+
// closed state (0); the open detents follow.
|
|
60
|
+
const detentList = useMemo<ModalDetent[]>(() => [0, ...detents], [detents]);
|
|
61
|
+
const [index, setIndex] = useState(0);
|
|
62
|
+
|
|
63
|
+
// Keep the index in step with `visible`: open to the first detent, close to 0.
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
setIndex((current) => (visible ? (current === 0 ? 1 : current) : 0));
|
|
66
|
+
}, [visible]);
|
|
67
|
+
|
|
68
|
+
// A user-driven drag to the closed detent reports here; tell the parent.
|
|
69
|
+
const handleIndexChange = useCallback(
|
|
70
|
+
(next: number) => {
|
|
71
|
+
setIndex(next);
|
|
72
|
+
if (next === 0) onClose();
|
|
73
|
+
},
|
|
74
|
+
[onClose],
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
// A scrim tap or system Back asks the sheet to close; close it and tell the parent.
|
|
78
|
+
const handleCloseRequest = useCallback(() => {
|
|
79
|
+
setIndex(0);
|
|
80
|
+
onClose();
|
|
81
|
+
}, [onClose]);
|
|
82
|
+
|
|
83
|
+
const surface = (
|
|
84
|
+
<View
|
|
85
|
+
style={[StyleSheet.absoluteFill, { backgroundColor: floatingSolidFill[scheme] }]}
|
|
86
|
+
/>
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<ModalBottomSheet
|
|
91
|
+
index={index}
|
|
92
|
+
detents={detentList}
|
|
93
|
+
// Unmount the content once the sheet settles closed, as the gorhom container does.
|
|
94
|
+
lazy
|
|
95
|
+
windowOverlay
|
|
96
|
+
scrimColor={SCRIM_COLOR}
|
|
97
|
+
scrimAccessibilityLabel="Close"
|
|
98
|
+
surface={surface}
|
|
99
|
+
surfaceStyle={{
|
|
100
|
+
borderTopLeftRadius: SHEET_RADIUS,
|
|
101
|
+
borderTopRightRadius: SHEET_RADIUS,
|
|
102
|
+
}}
|
|
103
|
+
onIndexChange={handleIndexChange}
|
|
104
|
+
onCloseRequest={handleCloseRequest}
|
|
105
|
+
>
|
|
106
|
+
<View style={{ flex: 1, paddingTop: 12 }}>
|
|
107
|
+
<View
|
|
108
|
+
accessibilityElementsHidden
|
|
109
|
+
importantForAccessibility="no-hide-descendants"
|
|
110
|
+
style={{
|
|
111
|
+
alignSelf: "center",
|
|
112
|
+
height: 6,
|
|
113
|
+
width: 40,
|
|
114
|
+
borderRadius: 999,
|
|
115
|
+
backgroundColor: withAlpha(tokens.color.muted[scheme], 0.4),
|
|
116
|
+
}}
|
|
117
|
+
/>
|
|
118
|
+
<View
|
|
119
|
+
style={{
|
|
120
|
+
flexDirection: "row",
|
|
121
|
+
alignItems: "center",
|
|
122
|
+
justifyContent: "space-between",
|
|
123
|
+
gap: 12,
|
|
124
|
+
paddingHorizontal: 20,
|
|
125
|
+
marginTop: 16,
|
|
126
|
+
marginBottom: 16,
|
|
127
|
+
}}
|
|
128
|
+
>
|
|
129
|
+
<Text
|
|
130
|
+
accessibilityRole="header"
|
|
131
|
+
style={[
|
|
132
|
+
{ flex: 1, fontSize: largerText ? 24 : 20 },
|
|
133
|
+
textStyle("foreground", scheme),
|
|
134
|
+
typeStyle("semibold"),
|
|
135
|
+
]}
|
|
136
|
+
>
|
|
137
|
+
{title}
|
|
138
|
+
</Text>
|
|
139
|
+
<TouchableOpacity
|
|
140
|
+
testID={closeTestID}
|
|
141
|
+
accessibilityRole="button"
|
|
142
|
+
accessibilityLabel="Close"
|
|
143
|
+
onPress={handleCloseRequest}
|
|
144
|
+
style={{ marginRight: -8, height: 48, width: 48, alignItems: "center", justifyContent: "center" }}
|
|
145
|
+
hitSlop={8}
|
|
146
|
+
activeOpacity={0.7}
|
|
147
|
+
>
|
|
148
|
+
<IconX size={largerText ? 32 : 28} color={isDark ? Colors.white : Colors.black} />
|
|
149
|
+
</TouchableOpacity>
|
|
150
|
+
</View>
|
|
151
|
+
<View style={{ flex: 1, paddingHorizontal: 20, paddingBottom: 48 }}>
|
|
152
|
+
{children}
|
|
153
|
+
</View>
|
|
154
|
+
</View>
|
|
155
|
+
</ModalBottomSheet>
|
|
156
|
+
);
|
|
157
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// `@vvedantb/native-ui/native-bottom-sheet`. Experimental: imports Software Mansion's
|
|
2
|
+
// native `@swmansion/react-native-bottom-sheet` (an optional peer). Kept separate from
|
|
3
|
+
// the gorhom `./bottom-sheet` entry so neither affects the other.
|
|
4
|
+
export { NativeBottomSheetContainer } from "../NativeBottomSheetContainer";
|