@webority-technologies/mobile 0.0.14 → 0.0.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/lib/commonjs/components/Accordion/Accordion.js +60 -19
- package/lib/commonjs/components/AppBar/AppBar.js +29 -20
- package/lib/commonjs/components/Avatar/Avatar.js +38 -8
- package/lib/commonjs/components/Badge/Badge.js +66 -4
- package/lib/commonjs/components/Banner/Banner.js +146 -66
- package/lib/commonjs/components/BottomNavigation/BottomNavigation.js +37 -15
- package/lib/commonjs/components/BottomSheet/BottomSheet.js +85 -50
- package/lib/commonjs/components/Button/Button.js +12 -5
- package/lib/commonjs/components/Card/Card.js +106 -16
- package/lib/commonjs/components/Carousel/Carousel.js +66 -12
- package/lib/commonjs/components/Checkbox/Checkbox.js +11 -7
- package/lib/commonjs/components/Chip/Chip.js +44 -12
- package/lib/commonjs/components/DatePicker/DatePicker.js +185 -76
- package/lib/commonjs/components/DateRangePicker/DateRangePicker.js +133 -59
- package/lib/commonjs/components/Dialog/Dialog.js +16 -10
- package/lib/commonjs/components/Drawer/Drawer.js +13 -10
- package/lib/commonjs/components/FieldBase/FieldBase.js +306 -0
- package/lib/commonjs/components/FieldBase/index.js +32 -0
- package/lib/commonjs/components/FloatingActionButton/FloatingActionButton.js +69 -44
- package/lib/commonjs/components/ForceUpdateDialog/ForceUpdateDialog.js +8 -2
- package/lib/commonjs/components/FormField/FormField.js +3 -2
- package/lib/commonjs/components/ImageGallery/ImageGallery.js +132 -44
- package/lib/commonjs/components/Input/Input.js +144 -181
- package/lib/commonjs/components/ListItem/ListItem.js +90 -11
- package/lib/commonjs/components/Modal/Modal.js +55 -27
- package/lib/commonjs/components/NumberInput/NumberInput.js +60 -106
- package/lib/commonjs/components/OTPInput/OTPInput.js +65 -58
- package/lib/commonjs/components/PickerTrigger/PickerTrigger.js +185 -0
- package/lib/commonjs/components/{AppIcon → PickerTrigger}/index.js +4 -4
- package/lib/commonjs/components/ProgressBar/ProgressBar.js +19 -11
- package/lib/commonjs/components/Radio/Radio.js +11 -6
- package/lib/commonjs/components/Rating/Rating.js +85 -19
- package/lib/commonjs/components/SearchBar/SearchBar.js +84 -107
- package/lib/commonjs/components/SegmentedControl/SegmentedControl.js +22 -11
- package/lib/commonjs/components/Select/Select.js +62 -91
- package/lib/commonjs/components/Skeleton/Skeleton.js +131 -174
- package/lib/commonjs/components/Skeleton/SkeletonClock.js +117 -0
- package/lib/commonjs/components/Skeleton/SkeletonContent.js +164 -81
- package/lib/commonjs/components/Skeleton/SkeletonProvider.js +72 -10
- package/lib/commonjs/components/Skeleton/index.js +17 -16
- package/lib/commonjs/components/Slider/Slider.js +44 -25
- package/lib/commonjs/components/Stepper/Stepper.js +199 -29
- package/lib/commonjs/components/Swipeable/Swipeable.js +36 -19
- package/lib/commonjs/components/Switch/Switch.js +9 -2
- package/lib/commonjs/components/Tabs/Tabs.js +84 -21
- package/lib/commonjs/components/TimePicker/TimePicker.js +123 -45
- package/lib/commonjs/components/Toast/Toast.js +27 -16
- package/lib/commonjs/components/Tooltip/Tooltip.js +56 -32
- package/lib/commonjs/components/index.js +37 -37
- package/lib/commonjs/theme/tokens.js +55 -7
- package/lib/module/components/Accordion/Accordion.js +61 -20
- package/lib/module/components/AppBar/AppBar.js +29 -20
- package/lib/module/components/Avatar/Avatar.js +39 -9
- package/lib/module/components/Badge/Badge.js +67 -5
- package/lib/module/components/Banner/Banner.js +147 -67
- package/lib/module/components/BottomNavigation/BottomNavigation.js +37 -15
- package/lib/module/components/BottomSheet/BottomSheet.js +87 -52
- package/lib/module/components/Button/Button.js +12 -5
- package/lib/module/components/Card/Card.js +107 -17
- package/lib/module/components/Carousel/Carousel.js +67 -13
- package/lib/module/components/Checkbox/Checkbox.js +11 -7
- package/lib/module/components/Chip/Chip.js +45 -13
- package/lib/module/components/DatePicker/DatePicker.js +185 -76
- package/lib/module/components/DateRangePicker/DateRangePicker.js +134 -60
- package/lib/module/components/Dialog/Dialog.js +16 -10
- package/lib/module/components/Drawer/Drawer.js +13 -10
- package/lib/module/components/FieldBase/FieldBase.js +297 -0
- package/lib/module/components/FieldBase/index.js +4 -0
- package/lib/module/components/FloatingActionButton/FloatingActionButton.js +69 -44
- package/lib/module/components/ForceUpdateDialog/ForceUpdateDialog.js +8 -2
- package/lib/module/components/FormField/FormField.js +3 -2
- package/lib/module/components/ImageGallery/ImageGallery.js +128 -40
- package/lib/module/components/Input/Input.js +144 -179
- package/lib/module/components/ListItem/ListItem.js +91 -12
- package/lib/module/components/Modal/Modal.js +55 -27
- package/lib/module/components/NumberInput/NumberInput.js +60 -106
- package/lib/module/components/OTPInput/OTPInput.js +65 -58
- package/lib/module/components/PickerTrigger/PickerTrigger.js +181 -0
- package/lib/module/components/PickerTrigger/index.js +4 -0
- package/lib/module/components/ProgressBar/ProgressBar.js +19 -11
- package/lib/module/components/Radio/Radio.js +11 -6
- package/lib/module/components/Rating/Rating.js +86 -20
- package/lib/module/components/SearchBar/SearchBar.js +84 -107
- package/lib/module/components/SegmentedControl/SegmentedControl.js +22 -11
- package/lib/module/components/Select/Select.js +62 -91
- package/lib/module/components/Skeleton/Skeleton.js +135 -175
- package/lib/module/components/Skeleton/SkeletonClock.js +110 -0
- package/lib/module/components/Skeleton/SkeletonContent.js +167 -84
- package/lib/module/components/Skeleton/SkeletonProvider.js +71 -10
- package/lib/module/components/Skeleton/index.js +3 -2
- package/lib/module/components/Slider/Slider.js +44 -25
- package/lib/module/components/Stepper/Stepper.js +201 -31
- package/lib/module/components/Swipeable/Swipeable.js +36 -19
- package/lib/module/components/Switch/Switch.js +9 -2
- package/lib/module/components/Tabs/Tabs.js +84 -21
- package/lib/module/components/TimePicker/TimePicker.js +123 -45
- package/lib/module/components/Toast/Toast.js +27 -16
- package/lib/module/components/Tooltip/Tooltip.js +56 -32
- package/lib/module/components/index.js +2 -2
- package/lib/module/theme/tokens.js +55 -7
- package/lib/typescript/commonjs/components/Accordion/Accordion.d.ts +10 -5
- package/lib/typescript/commonjs/components/AppBar/AppBar.d.ts +8 -0
- package/lib/typescript/commonjs/components/Avatar/Avatar.d.ts +12 -6
- package/lib/typescript/commonjs/components/Badge/Badge.d.ts +7 -6
- package/lib/typescript/commonjs/components/Banner/Banner.d.ts +17 -6
- package/lib/typescript/commonjs/components/BottomSheet/BottomSheet.d.ts +7 -0
- package/lib/typescript/commonjs/components/Card/Card.d.ts +17 -6
- package/lib/typescript/commonjs/components/Carousel/Carousel.d.ts +7 -6
- package/lib/typescript/commonjs/components/Checkbox/Checkbox.d.ts +9 -1
- package/lib/typescript/commonjs/components/Chip/Chip.d.ts +13 -6
- package/lib/typescript/commonjs/components/DatePicker/DatePicker.d.ts +38 -3
- package/lib/typescript/commonjs/components/DateRangePicker/DateRangePicker.d.ts +36 -3
- package/lib/typescript/commonjs/components/Dialog/Dialog.d.ts +13 -1
- package/lib/typescript/commonjs/components/FieldBase/FieldBase.d.ts +141 -0
- package/lib/typescript/commonjs/components/FieldBase/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/FloatingActionButton/FloatingActionButton.d.ts +8 -6
- package/lib/typescript/commonjs/components/FloatingActionButton/index.d.ts +1 -1
- package/lib/typescript/commonjs/components/ForceUpdateDialog/ForceUpdateDialog.d.ts +7 -0
- package/lib/typescript/commonjs/components/FormField/FormField.d.ts +7 -0
- package/lib/typescript/commonjs/components/ImageGallery/ImageGallery.d.ts +6 -4
- package/lib/typescript/commonjs/components/Input/Input.d.ts +6 -0
- package/lib/typescript/commonjs/components/ListItem/ListItem.d.ts +13 -6
- package/lib/typescript/commonjs/components/NumberInput/NumberInput.d.ts +3 -0
- package/lib/typescript/commonjs/components/PickerTrigger/PickerTrigger.d.ts +57 -0
- package/lib/typescript/commonjs/components/PickerTrigger/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/ProgressBar/ProgressBar.d.ts +2 -0
- package/lib/typescript/commonjs/components/Radio/Radio.d.ts +3 -0
- package/lib/typescript/commonjs/components/Rating/Rating.d.ts +9 -6
- package/lib/typescript/commonjs/components/SegmentedControl/SegmentedControl.d.ts +3 -0
- package/lib/typescript/commonjs/components/Skeleton/Skeleton.d.ts +49 -20
- package/lib/typescript/commonjs/components/Skeleton/SkeletonClock.d.ts +60 -0
- package/lib/typescript/commonjs/components/Skeleton/SkeletonContent.d.ts +80 -19
- package/lib/typescript/commonjs/components/Skeleton/SkeletonProvider.d.ts +39 -5
- package/lib/typescript/commonjs/components/Skeleton/index.d.ts +6 -4
- package/lib/typescript/commonjs/components/Slider/Slider.d.ts +12 -1
- package/lib/typescript/commonjs/components/Stepper/Stepper.d.ts +18 -6
- package/lib/typescript/commonjs/components/Swipeable/Swipeable.d.ts +2 -0
- package/lib/typescript/commonjs/components/Switch/Switch.d.ts +1 -0
- package/lib/typescript/commonjs/components/Tabs/Tabs.d.ts +26 -2
- package/lib/typescript/commonjs/components/TimePicker/TimePicker.d.ts +36 -3
- package/lib/typescript/commonjs/components/Toast/Toast.d.ts +8 -0
- package/lib/typescript/commonjs/components/Tooltip/Tooltip.d.ts +7 -1
- package/lib/typescript/commonjs/components/index.d.ts +5 -5
- package/lib/typescript/commonjs/index.d.ts +1 -1
- package/lib/typescript/commonjs/theme/index.d.ts +1 -1
- package/lib/typescript/commonjs/theme/types.d.ts +553 -11
- package/lib/typescript/module/components/Accordion/Accordion.d.ts +10 -5
- package/lib/typescript/module/components/AppBar/AppBar.d.ts +8 -0
- package/lib/typescript/module/components/Avatar/Avatar.d.ts +12 -6
- package/lib/typescript/module/components/Badge/Badge.d.ts +7 -6
- package/lib/typescript/module/components/Banner/Banner.d.ts +17 -6
- package/lib/typescript/module/components/BottomSheet/BottomSheet.d.ts +7 -0
- package/lib/typescript/module/components/Card/Card.d.ts +17 -6
- package/lib/typescript/module/components/Carousel/Carousel.d.ts +7 -6
- package/lib/typescript/module/components/Checkbox/Checkbox.d.ts +9 -1
- package/lib/typescript/module/components/Chip/Chip.d.ts +13 -6
- package/lib/typescript/module/components/DatePicker/DatePicker.d.ts +38 -3
- package/lib/typescript/module/components/DateRangePicker/DateRangePicker.d.ts +36 -3
- package/lib/typescript/module/components/Dialog/Dialog.d.ts +13 -1
- package/lib/typescript/module/components/FieldBase/FieldBase.d.ts +141 -0
- package/lib/typescript/module/components/FieldBase/index.d.ts +3 -0
- package/lib/typescript/module/components/FloatingActionButton/FloatingActionButton.d.ts +8 -6
- package/lib/typescript/module/components/FloatingActionButton/index.d.ts +1 -1
- package/lib/typescript/module/components/ForceUpdateDialog/ForceUpdateDialog.d.ts +7 -0
- package/lib/typescript/module/components/FormField/FormField.d.ts +7 -0
- package/lib/typescript/module/components/ImageGallery/ImageGallery.d.ts +6 -4
- package/lib/typescript/module/components/Input/Input.d.ts +6 -0
- package/lib/typescript/module/components/ListItem/ListItem.d.ts +13 -6
- package/lib/typescript/module/components/NumberInput/NumberInput.d.ts +3 -0
- package/lib/typescript/module/components/PickerTrigger/PickerTrigger.d.ts +57 -0
- package/lib/typescript/module/components/PickerTrigger/index.d.ts +3 -0
- package/lib/typescript/module/components/ProgressBar/ProgressBar.d.ts +2 -0
- package/lib/typescript/module/components/Radio/Radio.d.ts +3 -0
- package/lib/typescript/module/components/Rating/Rating.d.ts +9 -6
- package/lib/typescript/module/components/SegmentedControl/SegmentedControl.d.ts +3 -0
- package/lib/typescript/module/components/Skeleton/Skeleton.d.ts +49 -20
- package/lib/typescript/module/components/Skeleton/SkeletonClock.d.ts +60 -0
- package/lib/typescript/module/components/Skeleton/SkeletonContent.d.ts +80 -19
- package/lib/typescript/module/components/Skeleton/SkeletonProvider.d.ts +39 -5
- package/lib/typescript/module/components/Skeleton/index.d.ts +6 -4
- package/lib/typescript/module/components/Slider/Slider.d.ts +12 -1
- package/lib/typescript/module/components/Stepper/Stepper.d.ts +18 -6
- package/lib/typescript/module/components/Swipeable/Swipeable.d.ts +2 -0
- package/lib/typescript/module/components/Switch/Switch.d.ts +1 -0
- package/lib/typescript/module/components/Tabs/Tabs.d.ts +26 -2
- package/lib/typescript/module/components/TimePicker/TimePicker.d.ts +36 -3
- package/lib/typescript/module/components/Toast/Toast.d.ts +8 -0
- package/lib/typescript/module/components/Tooltip/Tooltip.d.ts +7 -1
- package/lib/typescript/module/components/index.d.ts +5 -5
- package/lib/typescript/module/index.d.ts +1 -1
- package/lib/typescript/module/theme/index.d.ts +1 -1
- package/lib/typescript/module/theme/types.d.ts +553 -11
- package/package.json +2 -6
- package/lib/commonjs/components/AppIcon/AppIcon.js +0 -120
- package/lib/commonjs/types/vector-icons.d.js +0 -2
- package/lib/module/components/AppIcon/AppIcon.js +0 -111
- package/lib/module/components/AppIcon/index.js +0 -4
- package/lib/module/types/vector-icons.d.js +0 -2
- package/lib/typescript/commonjs/components/AppIcon/AppIcon.d.ts +0 -20
- package/lib/typescript/commonjs/components/AppIcon/index.d.ts +0 -3
- package/lib/typescript/module/components/AppIcon/AppIcon.d.ts +0 -20
- package/lib/typescript/module/components/AppIcon/index.d.ts +0 -3
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import React, { forwardRef, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import { Animated, Pressable, StyleSheet, Text, View } from 'react-native';
|
|
5
5
|
import { useTheme, createAnimatedValue } from "../../theme/index.js";
|
|
6
|
-
import {
|
|
6
|
+
import { Skeleton, SkeletonText } from "../Skeleton/index.js";
|
|
7
7
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
8
|
const Banner = /*#__PURE__*/forwardRef((props, ref) => {
|
|
9
9
|
const {
|
|
@@ -19,6 +19,11 @@ const Banner = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
19
19
|
loading = false,
|
|
20
20
|
accessibilityLabel,
|
|
21
21
|
style,
|
|
22
|
+
containerStyle,
|
|
23
|
+
iconCircleStyle,
|
|
24
|
+
tintBarStyle,
|
|
25
|
+
closeButtonStyle,
|
|
26
|
+
actionButtonStyle,
|
|
22
27
|
testID
|
|
23
28
|
} = props;
|
|
24
29
|
const theme = useTheme();
|
|
@@ -72,7 +77,7 @@ const Banner = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
72
77
|
return /*#__PURE__*/_jsx(View, {
|
|
73
78
|
style: [styles.iconCircle, {
|
|
74
79
|
backgroundColor: tint.bar + '22'
|
|
75
|
-
}],
|
|
80
|
+
}, iconCircleStyle],
|
|
76
81
|
children: /*#__PURE__*/_jsx(Text, {
|
|
77
82
|
style: [styles.iconGlyph, {
|
|
78
83
|
color: tint.glyphColor
|
|
@@ -99,11 +104,11 @@ const Banner = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
99
104
|
transform: [{
|
|
100
105
|
translateY
|
|
101
106
|
}]
|
|
102
|
-
}, style],
|
|
107
|
+
}, style, containerStyle],
|
|
103
108
|
children: [/*#__PURE__*/_jsx(View, {
|
|
104
109
|
style: [styles.tintBar, {
|
|
105
110
|
backgroundColor: tint.bar
|
|
106
|
-
}]
|
|
111
|
+
}, tintBarStyle]
|
|
107
112
|
}), /*#__PURE__*/_jsxs(View, {
|
|
108
113
|
style: styles.row,
|
|
109
114
|
children: [renderIcon(), /*#__PURE__*/_jsxs(View, {
|
|
@@ -140,11 +145,11 @@ const Banner = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
140
145
|
pressed
|
|
141
146
|
}) => [styles.closeBtn, {
|
|
142
147
|
backgroundColor: pressed ? theme.colors.surface.pressed : 'transparent'
|
|
143
|
-
}],
|
|
148
|
+
}, closeButtonStyle],
|
|
144
149
|
children: /*#__PURE__*/_jsx(Text, {
|
|
145
150
|
style: {
|
|
146
151
|
color: theme.colors.text.secondary,
|
|
147
|
-
fontSize: 18,
|
|
152
|
+
fontSize: theme.components.banner?.closeGlyphFontSize ?? 18,
|
|
148
153
|
fontWeight: theme.typography.fontWeight.bold,
|
|
149
154
|
lineHeight: 18
|
|
150
155
|
},
|
|
@@ -164,7 +169,7 @@ const Banner = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
164
169
|
pressed
|
|
165
170
|
}) => [styles.actionBtn, {
|
|
166
171
|
backgroundColor: pressed ? theme.colors.surface.pressed : 'transparent'
|
|
167
|
-
}],
|
|
172
|
+
}, actionButtonStyle],
|
|
168
173
|
children: /*#__PURE__*/_jsx(Text, {
|
|
169
174
|
style: {
|
|
170
175
|
color: isPrimary ? tint.glyphColor : theme.colors.text.secondary,
|
|
@@ -179,15 +184,86 @@ const Banner = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
179
184
|
}) : null]
|
|
180
185
|
});
|
|
181
186
|
if (loading) {
|
|
182
|
-
return /*#__PURE__*/_jsx(
|
|
183
|
-
|
|
184
|
-
mode: "auto",
|
|
185
|
-
children: rendered
|
|
187
|
+
return /*#__PURE__*/_jsx(BannerSkeleton, {
|
|
188
|
+
...props
|
|
186
189
|
});
|
|
187
190
|
}
|
|
188
191
|
return rendered;
|
|
189
192
|
});
|
|
190
193
|
Banner.displayName = 'Banner';
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Placeholder shape for `<Banner>`. Keeps the icon circle on the left and
|
|
197
|
+
* shows title + 1-2 message lines + optional action button row. Outer
|
|
198
|
+
* container retains the elevated background so the banner footprint
|
|
199
|
+
* doesn't shift when it loads.
|
|
200
|
+
*/
|
|
201
|
+
const BannerSkeleton = ({
|
|
202
|
+
title,
|
|
203
|
+
actions,
|
|
204
|
+
icon,
|
|
205
|
+
containerStyle,
|
|
206
|
+
style
|
|
207
|
+
}) => {
|
|
208
|
+
const theme = useTheme();
|
|
209
|
+
const showIcon = icon !== false;
|
|
210
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
211
|
+
style: [{
|
|
212
|
+
flexDirection: 'row',
|
|
213
|
+
alignItems: 'flex-start',
|
|
214
|
+
backgroundColor: theme.colors.background.elevated,
|
|
215
|
+
borderRadius: theme.radius.md,
|
|
216
|
+
padding: theme.spacing.md,
|
|
217
|
+
borderWidth: 1,
|
|
218
|
+
borderColor: theme.colors.border.primary
|
|
219
|
+
}, containerStyle, style],
|
|
220
|
+
accessibilityRole: "progressbar",
|
|
221
|
+
accessibilityState: {
|
|
222
|
+
busy: true
|
|
223
|
+
},
|
|
224
|
+
children: [showIcon ? /*#__PURE__*/_jsx(View, {
|
|
225
|
+
style: {
|
|
226
|
+
marginRight: theme.spacing.sm
|
|
227
|
+
},
|
|
228
|
+
children: /*#__PURE__*/_jsx(Skeleton, {
|
|
229
|
+
shape: "circle",
|
|
230
|
+
width: 32,
|
|
231
|
+
height: 32
|
|
232
|
+
})
|
|
233
|
+
}) : null, /*#__PURE__*/_jsxs(View, {
|
|
234
|
+
style: {
|
|
235
|
+
flex: 1
|
|
236
|
+
},
|
|
237
|
+
children: [title !== undefined ? /*#__PURE__*/_jsx(Skeleton, {
|
|
238
|
+
shape: "text",
|
|
239
|
+
width: "55%",
|
|
240
|
+
height: 16,
|
|
241
|
+
style: {
|
|
242
|
+
marginBottom: theme.spacing.xs
|
|
243
|
+
}
|
|
244
|
+
}) : null, /*#__PURE__*/_jsx(SkeletonText, {
|
|
245
|
+
lines: 2,
|
|
246
|
+
fontSize: 13,
|
|
247
|
+
lastLineWidth: "70%"
|
|
248
|
+
}), actions && actions.length > 0 ? /*#__PURE__*/_jsx(View, {
|
|
249
|
+
style: {
|
|
250
|
+
flexDirection: 'row',
|
|
251
|
+
marginTop: theme.spacing.sm
|
|
252
|
+
},
|
|
253
|
+
children: actions.map((_, i) => /*#__PURE__*/_jsx(Skeleton, {
|
|
254
|
+
width: 72,
|
|
255
|
+
height: 28,
|
|
256
|
+
shape: "rounded",
|
|
257
|
+
style: {
|
|
258
|
+
marginRight: theme.spacing.sm
|
|
259
|
+
}
|
|
260
|
+
}, `sk-banner-action-${i}`))
|
|
261
|
+
}) : null]
|
|
262
|
+
})]
|
|
263
|
+
});
|
|
264
|
+
};
|
|
265
|
+
BannerSkeleton.displayName = 'BannerSkeleton';
|
|
266
|
+
Banner.Skeleton = BannerSkeleton;
|
|
191
267
|
const tintFor = (theme, variant) => {
|
|
192
268
|
switch (variant) {
|
|
193
269
|
case 'success':
|
|
@@ -223,62 +299,66 @@ const tintFor = (theme, variant) => {
|
|
|
223
299
|
};
|
|
224
300
|
}
|
|
225
301
|
};
|
|
226
|
-
const buildStyles =
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
302
|
+
const buildStyles = theme => {
|
|
303
|
+
const iconCircleSize = theme.components.banner?.iconCircleSize ?? 28;
|
|
304
|
+
const closeButtonSize = theme.components.banner?.closeButtonSize ?? 28;
|
|
305
|
+
return StyleSheet.create({
|
|
306
|
+
container: {
|
|
307
|
+
overflow: 'hidden',
|
|
308
|
+
paddingLeft: theme.components.banner?.containerPaddingLeft ?? theme.spacing.md
|
|
309
|
+
},
|
|
310
|
+
tintBar: {
|
|
311
|
+
position: 'absolute',
|
|
312
|
+
left: 0,
|
|
313
|
+
top: 0,
|
|
314
|
+
bottom: 0,
|
|
315
|
+
width: theme.components.banner?.tintBarWidth ?? 4
|
|
316
|
+
},
|
|
317
|
+
row: {
|
|
318
|
+
flexDirection: 'row',
|
|
319
|
+
alignItems: 'flex-start'
|
|
320
|
+
},
|
|
321
|
+
iconWrap: {
|
|
322
|
+
marginRight: theme.components.banner?.iconGap ?? theme.spacing.sm
|
|
323
|
+
},
|
|
324
|
+
iconCircle: {
|
|
325
|
+
width: iconCircleSize,
|
|
326
|
+
height: iconCircleSize,
|
|
327
|
+
borderRadius: theme.components.banner?.iconCircleRadius ?? iconCircleSize / 2,
|
|
328
|
+
alignItems: 'center',
|
|
329
|
+
justifyContent: 'center',
|
|
330
|
+
marginRight: theme.components.banner?.iconGap ?? theme.spacing.sm
|
|
331
|
+
},
|
|
332
|
+
iconGlyph: {
|
|
333
|
+
fontSize: theme.components.banner?.iconGlyphFontSize ?? 15,
|
|
334
|
+
fontWeight: '700',
|
|
335
|
+
lineHeight: theme.components.banner?.iconGlyphLineHeight ?? 17
|
|
336
|
+
},
|
|
337
|
+
textBlock: {
|
|
338
|
+
flex: 1,
|
|
339
|
+
paddingRight: theme.components.banner?.textBlockPaddingRight ?? theme.spacing.xs
|
|
340
|
+
},
|
|
341
|
+
closeBtn: {
|
|
342
|
+
width: closeButtonSize,
|
|
343
|
+
height: closeButtonSize,
|
|
344
|
+
borderRadius: theme.components.banner?.closeButtonRadius ?? closeButtonSize / 2,
|
|
345
|
+
alignItems: 'center',
|
|
346
|
+
justifyContent: 'center',
|
|
347
|
+
marginLeft: theme.components.banner?.closeButtonMarginLeft ?? theme.spacing.xxs ?? 4
|
|
348
|
+
},
|
|
349
|
+
actionsRow: {
|
|
350
|
+
flexDirection: 'row',
|
|
351
|
+
justifyContent: 'flex-end',
|
|
352
|
+
marginTop: theme.components.banner?.actionsRowMarginTop ?? theme.spacing.xs,
|
|
353
|
+
gap: theme.components.banner?.actionsRowGap ?? 4
|
|
354
|
+
},
|
|
355
|
+
actionBtn: {
|
|
356
|
+
paddingHorizontal: theme.components.banner?.actionButtonPaddingHorizontal ?? theme.spacing.sm,
|
|
357
|
+
paddingVertical: theme.components.banner?.actionButtonPaddingVertical ?? 6,
|
|
358
|
+
borderRadius: theme.components.banner?.actionButtonRadius ?? theme.radius.sm
|
|
359
|
+
}
|
|
360
|
+
});
|
|
361
|
+
};
|
|
282
362
|
export { Banner };
|
|
283
363
|
export default Banner;
|
|
284
364
|
//# sourceMappingURL=Banner.js.map
|
|
@@ -6,9 +6,11 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
|
6
6
|
import { useTheme, createAnimatedValue } from "../../theme/index.js";
|
|
7
7
|
import { triggerHaptic } from "../../utils/index.js";
|
|
8
8
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
9
|
+
const DEFAULT_ICON_SIZE = 24;
|
|
10
|
+
const DEFAULT_PILL_HEIGHT = 36;
|
|
11
|
+
const DEFAULT_PILL_MAX_WIDTH = 120;
|
|
12
|
+
const DEFAULT_PILL_INSET = 16;
|
|
13
|
+
const DEFAULT_UNDERLINE_HEIGHT = 3;
|
|
12
14
|
const formatBadge = value => {
|
|
13
15
|
if (value === null || value === undefined || value === false) return null;
|
|
14
16
|
if (value === true || value === '·') return {
|
|
@@ -57,8 +59,19 @@ const BottomNavigation = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
57
59
|
const theme = useTheme();
|
|
58
60
|
const insets = useSafeAreaInsets();
|
|
59
61
|
const styles = useMemo(() => buildStyles(theme), [theme]);
|
|
62
|
+
const tokens = theme.components.bottomNavigation;
|
|
63
|
+
const iconSize = tokens?.iconSize ?? DEFAULT_ICON_SIZE;
|
|
64
|
+
const pillHeight = tokens?.pillHeight ?? DEFAULT_PILL_HEIGHT;
|
|
65
|
+
const pillMaxWidth = tokens?.pillMaxWidth ?? DEFAULT_PILL_MAX_WIDTH;
|
|
66
|
+
const pillInset = tokens?.pillInset ?? DEFAULT_PILL_INSET;
|
|
60
67
|
const activeIndex = Math.max(0, tabs.findIndex(tab => tab.key === activeTab));
|
|
61
68
|
const [tabWidth, setTabWidth] = React.useState(0);
|
|
69
|
+
|
|
70
|
+
// Single Animated.Value holds the pill's absolute pixel offset (active index
|
|
71
|
+
// × tab width + half the gap between tab edge and pill edge). Folding the
|
|
72
|
+
// offset into the same value avoids creating a fresh Animated.Value +
|
|
73
|
+
// Animated.add node on every render — earlier code did that and slowly
|
|
74
|
+
// leaked addition nodes as the user pressed tabs.
|
|
62
75
|
const indicatorTranslateX = useRef(createAnimatedValue(0)).current;
|
|
63
76
|
const iconScales = useRef({});
|
|
64
77
|
|
|
@@ -69,7 +82,17 @@ const BottomNavigation = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
69
82
|
}
|
|
70
83
|
});
|
|
71
84
|
|
|
72
|
-
//
|
|
85
|
+
// Pill width is intrinsic; we compute its rendered offset to keep it
|
|
86
|
+
// centered within each tab cell. The offset is applied to the pill itself
|
|
87
|
+
// (NOT folded into the shared indicatorTranslateX) so the underline indicator
|
|
88
|
+
// — which spans the full tab cell — stays aligned with the tab boundary
|
|
89
|
+
// instead of being shifted by the pill-centering math.
|
|
90
|
+
const pillWidth = tabWidth > 0 ? Math.min(tabWidth - pillInset, pillMaxWidth) : 0;
|
|
91
|
+
const pillOffset = tabWidth > 0 ? (tabWidth - pillWidth) / 2 : 0;
|
|
92
|
+
|
|
93
|
+
// Animate indicator to the active tab's cell edge. Pill mode applies the
|
|
94
|
+
// centering offset via a static `left` style below; underline mode uses
|
|
95
|
+
// this value directly.
|
|
73
96
|
useEffect(() => {
|
|
74
97
|
if (tabWidth <= 0) return;
|
|
75
98
|
Animated.spring(indicatorTranslateX, {
|
|
@@ -105,11 +128,6 @@ const BottomNavigation = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
105
128
|
onTabPress(tab.key);
|
|
106
129
|
};
|
|
107
130
|
const paddingBottom = Math.max(8, insets.bottom);
|
|
108
|
-
|
|
109
|
-
// Pill width is intrinsic; we compute its rendered offset to keep it centered
|
|
110
|
-
// within each tab cell when it animates.
|
|
111
|
-
const pillWidth = tabWidth > 0 ? Math.min(tabWidth - 16, 120) : 0;
|
|
112
|
-
const pillOffset = tabWidth > 0 ? (tabWidth - pillWidth) / 2 : 0;
|
|
113
131
|
return /*#__PURE__*/_jsx(View, {
|
|
114
132
|
ref: ref,
|
|
115
133
|
testID: testID,
|
|
@@ -126,11 +144,12 @@ const BottomNavigation = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
126
144
|
pointerEvents: "none",
|
|
127
145
|
style: [styles.pill, {
|
|
128
146
|
width: pillWidth,
|
|
129
|
-
height:
|
|
147
|
+
height: pillHeight,
|
|
148
|
+
left: pillOffset,
|
|
130
149
|
backgroundColor: theme.colors.primaryMuted,
|
|
131
150
|
borderRadius: theme.radius.full,
|
|
132
151
|
transform: [{
|
|
133
|
-
translateX:
|
|
152
|
+
translateX: indicatorTranslateX
|
|
134
153
|
}]
|
|
135
154
|
}, indicatorStyle]
|
|
136
155
|
}) : null, tabs.map((tab, index) => {
|
|
@@ -162,13 +181,15 @@ const BottomNavigation = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
162
181
|
testID: testID ? `${testID}-tab-${tab.key}` : undefined,
|
|
163
182
|
children: [/*#__PURE__*/_jsxs(Animated.View, {
|
|
164
183
|
style: [styles.iconWrap, {
|
|
184
|
+
width: iconSize + 8,
|
|
185
|
+
height: iconSize + 8,
|
|
165
186
|
transform: [{
|
|
166
187
|
scale
|
|
167
188
|
}]
|
|
168
189
|
}],
|
|
169
190
|
children: [renderIcon({
|
|
170
191
|
color,
|
|
171
|
-
size:
|
|
192
|
+
size: iconSize,
|
|
172
193
|
focused: isActive
|
|
173
194
|
}), badge ? /*#__PURE__*/_jsx(View, {
|
|
174
195
|
style: [badge.isDot ? styles.badgeDot : styles.badgePill, {
|
|
@@ -196,6 +217,7 @@ const BottomNavigation = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
196
217
|
pointerEvents: "none",
|
|
197
218
|
style: [styles.underline, indicatorPosition === 'top' ? styles.underlineTop : styles.underlineBottom, {
|
|
198
219
|
width: tabWidth,
|
|
220
|
+
height: tokens?.underlineHeight ?? DEFAULT_UNDERLINE_HEIGHT,
|
|
199
221
|
backgroundColor: theme.colors.primary,
|
|
200
222
|
transform: [{
|
|
201
223
|
translateX: indicatorTranslateX
|
|
@@ -226,8 +248,8 @@ const buildStyles = theme => StyleSheet.create({
|
|
|
226
248
|
gap: 2
|
|
227
249
|
},
|
|
228
250
|
iconWrap: {
|
|
229
|
-
width:
|
|
230
|
-
height:
|
|
251
|
+
width: DEFAULT_ICON_SIZE + 8,
|
|
252
|
+
height: DEFAULT_ICON_SIZE + 8,
|
|
231
253
|
alignItems: 'center',
|
|
232
254
|
justifyContent: 'center',
|
|
233
255
|
position: 'relative'
|
|
@@ -245,7 +267,7 @@ const buildStyles = theme => StyleSheet.create({
|
|
|
245
267
|
underline: {
|
|
246
268
|
position: 'absolute',
|
|
247
269
|
left: 0,
|
|
248
|
-
height:
|
|
270
|
+
height: DEFAULT_UNDERLINE_HEIGHT
|
|
249
271
|
},
|
|
250
272
|
underlineBottom: {
|
|
251
273
|
bottom: -6,
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
22
|
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
23
|
-
import { Dimensions, Keyboard, Modal, Platform,
|
|
23
|
+
import { Dimensions, Keyboard, Modal, Platform, StyleSheet, View } from 'react-native';
|
|
24
24
|
import { Gesture, GestureDetector, GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
25
|
-
import Animated, {
|
|
25
|
+
import Animated, { runOnJS, useAnimatedStyle, useSharedValue, withSpring, withTiming } from 'react-native-reanimated';
|
|
26
26
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
27
27
|
import { useTheme } from "../../theme/index.js";
|
|
28
28
|
import { triggerHaptic } from "../../utils/index.js";
|
|
@@ -42,7 +42,6 @@ const BottomSheet = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
42
42
|
onAnimate,
|
|
43
43
|
enablePanDownToClose = true,
|
|
44
44
|
enableBackdropPress = true,
|
|
45
|
-
backdropOpacity = 0.5,
|
|
46
45
|
keyboardBehavior = 'none',
|
|
47
46
|
mode = 'modal',
|
|
48
47
|
handleIndicatorStyle,
|
|
@@ -84,6 +83,11 @@ const BottomSheet = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
84
83
|
// synchronously on open and unmount only after the close animation finishes
|
|
85
84
|
// so the slide-down stays visible.
|
|
86
85
|
const [modalVisible, setModalVisible] = useState(false);
|
|
86
|
+
// Inline-mode mirror of modalVisible: gates the absoluteFill backdrop +
|
|
87
|
+
// sheet tree so a closed inline sheet doesn't sit over the parent dimming
|
|
88
|
+
// it and swallowing touches. Set true on expand, cleared in
|
|
89
|
+
// markAnimationDone once the close animation completes.
|
|
90
|
+
const [inlineMounted, setInlineMounted] = useState(false);
|
|
87
91
|
|
|
88
92
|
// Convert a snap-point index → translateY position. -1 = closed.
|
|
89
93
|
const yForIndex = useCallback(idx => {
|
|
@@ -111,18 +115,20 @@ const BottomSheet = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
111
115
|
}, [onAnimate, translateY]);
|
|
112
116
|
const markAnimationDone = useCallback(() => {
|
|
113
117
|
isAnimatingRef.current = false;
|
|
114
|
-
// If we just finished a close animation, unmount the
|
|
115
|
-
if (
|
|
116
|
-
setModalVisible(false);
|
|
118
|
+
// If we just finished a close animation, unmount the sheet wrapper.
|
|
119
|
+
if (currentIndexShared.value < 0) {
|
|
120
|
+
if (mode === 'modal') setModalVisible(false);else setInlineMounted(false);
|
|
117
121
|
}
|
|
118
122
|
}, [mode, currentIndexShared]);
|
|
119
123
|
const expand = useCallback(idx => {
|
|
120
124
|
const target = typeof idx === 'number' ? clamp(idx, 0, resolvedSnapPoints.length - 1) : currentIndex >= 0 ? currentIndex : 0;
|
|
121
125
|
const fromIndex = currentIndexShared.value;
|
|
122
126
|
const to = yForIndex(target);
|
|
123
|
-
// Mount the Modal
|
|
124
|
-
//
|
|
125
|
-
|
|
127
|
+
// Mount the host (Modal in modal mode, inline overlay in inline mode)
|
|
128
|
+
// before kicking off the spring so the sheet has somewhere to animate
|
|
129
|
+
// into. Inline mode also gates the backdrop on this so a closed sheet
|
|
130
|
+
// doesn't dim the parent.
|
|
131
|
+
if (mode === 'modal') setModalVisible(true);else setInlineMounted(true);
|
|
126
132
|
// Reset translateY to the closed position so the first open animates
|
|
127
133
|
// up from off-screen rather than snapping in place.
|
|
128
134
|
if (fromIndex < 0) {
|
|
@@ -282,27 +288,31 @@ const BottomSheet = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
282
288
|
}, [keyboardBehavior, keyboardOffset]);
|
|
283
289
|
|
|
284
290
|
// ───────── Animated styles ─────────
|
|
291
|
+
const safeAreaTop = insets.top;
|
|
285
292
|
const sheetStyle = useAnimatedStyle(() => {
|
|
286
|
-
// Don't push past the screen top — keyboard offset is clamped to minTopY.
|
|
287
293
|
const yWithKb = translateY.value + keyboardOffset.value;
|
|
288
|
-
|
|
294
|
+
// When the keyboard is up, allow the sheet to slide above its natural
|
|
295
|
+
// max-snap-point top (`minTopY`) so the input area stays visible. We still
|
|
296
|
+
// clamp to the safe-area top so the sheet doesn't disappear under the
|
|
297
|
+
// status bar / notch.
|
|
298
|
+
const lowerBound = keyboardOffset.value < 0 ? safeAreaTop : minTopY;
|
|
299
|
+
const clamped = yWithKb < lowerBound ? lowerBound : yWithKb;
|
|
300
|
+
// Animate `top` (layout prop) instead of `transform: translateY`
|
|
301
|
+
// (visual only). Layout-prop animation under Reanimated still runs on
|
|
302
|
+
// the UI thread, but crucially the sheet's *hit-test box* moves with
|
|
303
|
+
// its visual position. With translateY the layout box stayed parked
|
|
304
|
+
// at top:0..maxSnap regardless of visual offset, so:
|
|
305
|
+
// (a) the empty top half intercepted backdrop taps (worked around
|
|
306
|
+
// previously via pointerEvents="box-none"), and
|
|
307
|
+
// (b) drag gestures on the handle could be claimed by sibling
|
|
308
|
+
// gesture handlers because the actual sheet view was effectively
|
|
309
|
+
// hidden from the responder chain.
|
|
310
|
+
// Animating `top` collapses both problems into nothing — visible area
|
|
311
|
+
// == hit area — so we can drop the box-none hack too.
|
|
289
312
|
return {
|
|
290
|
-
|
|
291
|
-
translateY: clamped
|
|
292
|
-
}]
|
|
313
|
+
top: clamped
|
|
293
314
|
};
|
|
294
315
|
});
|
|
295
|
-
const backdropStyle = useAnimatedStyle(() => {
|
|
296
|
-
// 0 opacity when sheet is closed, full backdropOpacity at minSnap height (and above).
|
|
297
|
-
const closedAt = screenHeight;
|
|
298
|
-
const openAt = screenHeight - minSnapPoint;
|
|
299
|
-
const opacity = interpolate(translateY.value, [closedAt, openAt], [0, backdropOpacity], Extrapolation.CLAMP);
|
|
300
|
-
return {
|
|
301
|
-
opacity,
|
|
302
|
-
// Disable hit-test entirely when fully closed so it doesn't swallow taps.
|
|
303
|
-
pointerEvents: translateY.value >= closedAt - 0.5 ? 'none' : 'auto'
|
|
304
|
-
};
|
|
305
|
-
}, [backdropOpacity, minSnapPoint, screenHeight]);
|
|
306
316
|
const isExpanded = currentIndex >= 0;
|
|
307
317
|
const styles = useMemo(() => buildStyles(theme), [theme]);
|
|
308
318
|
const handleBackdropPress = useCallback(() => {
|
|
@@ -311,41 +321,51 @@ const BottomSheet = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
311
321
|
close();
|
|
312
322
|
}, [enableBackdropPress, close]);
|
|
313
323
|
|
|
314
|
-
//
|
|
315
|
-
//
|
|
316
|
-
//
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
324
|
+
// RNGH Tap gesture for the backdrop. Plain RN Pressable on a sibling of a
|
|
325
|
+
// gesture-handler/reanimated sheet doesn't fire reliably on RN 0.85 / Fabric
|
|
326
|
+
// (the gesture system swallows the touch sequence). gorhom/bottom-sheet uses
|
|
327
|
+
// the same Gesture.Tap() pattern for the same reason.
|
|
328
|
+
const backdropTapGesture = useMemo(() => Gesture.Tap().maxDuration(250).onEnd((_e, success) => {
|
|
329
|
+
'worklet';
|
|
330
|
+
|
|
331
|
+
if (!success) return;
|
|
332
|
+
runOnJS(handleBackdropPress)();
|
|
333
|
+
}), [handleBackdropPress]);
|
|
334
|
+
|
|
335
|
+
// Don't render the backdrop / sheet tree when the sheet is fully closed.
|
|
336
|
+
// Inline: gated by `inlineMounted` (set in expand, cleared in
|
|
337
|
+
// markAnimationDone after close animation) — keeps an idle inline sheet
|
|
338
|
+
// from sitting over the parent and swallowing touches.
|
|
339
|
+
// Modal: gated by `modalVisible` for the same reason.
|
|
340
|
+
if (mode === 'inline' && !inlineMounted) {
|
|
322
341
|
return null;
|
|
323
342
|
}
|
|
324
343
|
if (mode === 'modal' && !modalVisible) {
|
|
325
344
|
return null;
|
|
326
345
|
}
|
|
327
346
|
const sheetTree = /*#__PURE__*/_jsxs(View, {
|
|
328
|
-
|
|
329
|
-
|
|
347
|
+
collapsable: false
|
|
348
|
+
// Modal mode: the backdrop is the modal's root, so it fills via flex.
|
|
349
|
+
// Inline mode: the backdrop overlays the parent, so it positions absolute.
|
|
350
|
+
,
|
|
351
|
+
style: [mode === 'modal' ? styles.backdropModal : styles.backdropInline, {
|
|
352
|
+
backgroundColor: theme.colors.background.overlay
|
|
353
|
+
}],
|
|
330
354
|
testID: testID,
|
|
331
355
|
accessibilityViewIsModal: accessibilityViewIsModal ?? isExpanded,
|
|
332
|
-
children: [/*#__PURE__*/_jsx(
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
children: /*#__PURE__*/_jsx(Pressable, {
|
|
337
|
-
style: StyleSheet.absoluteFill,
|
|
338
|
-
onPress: handleBackdropPress,
|
|
356
|
+
children: [/*#__PURE__*/_jsx(GestureDetector, {
|
|
357
|
+
gesture: backdropTapGesture,
|
|
358
|
+
children: /*#__PURE__*/_jsx(Animated.View, {
|
|
359
|
+
style: StyleSheet.absoluteFillObject,
|
|
339
360
|
accessibilityRole: "button",
|
|
340
|
-
accessibilityLabel: "Close bottom sheet"
|
|
341
|
-
disabled: !enableBackdropPress || !isExpanded
|
|
361
|
+
accessibilityLabel: "Close bottom sheet"
|
|
342
362
|
})
|
|
343
363
|
}), /*#__PURE__*/_jsx(GestureDetector, {
|
|
344
364
|
gesture: panGesture,
|
|
345
365
|
children: /*#__PURE__*/_jsxs(Animated.View, {
|
|
346
366
|
// 'dialog' is a valid platform role on web/iOS; RN's typings list it as a string union
|
|
347
367
|
// that varies by platform — cast keeps strict-mode happy.
|
|
348
|
-
accessibilityRole:
|
|
368
|
+
accessibilityRole: "alert",
|
|
349
369
|
accessibilityLabel: accessibilityLabel,
|
|
350
370
|
accessibilityViewIsModal: accessibilityViewIsModal ?? isExpanded,
|
|
351
371
|
style: [styles.sheet, {
|
|
@@ -361,7 +381,7 @@ const BottomSheet = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
361
381
|
pointerEvents: "box-none",
|
|
362
382
|
children: /*#__PURE__*/_jsx(View, {
|
|
363
383
|
style: [styles.handle, {
|
|
364
|
-
backgroundColor: theme.colors.border.primary
|
|
384
|
+
backgroundColor: theme.components.bottomSheet?.handleColor ?? theme.colors.border.primary
|
|
365
385
|
}, handleIndicatorStyle]
|
|
366
386
|
})
|
|
367
387
|
}), /*#__PURE__*/_jsx(View, {
|
|
@@ -376,14 +396,17 @@ const BottomSheet = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
376
396
|
transparent: true,
|
|
377
397
|
visible: modalVisible,
|
|
378
398
|
onRequestClose: close,
|
|
379
|
-
statusBarTranslucent: true
|
|
380
|
-
|
|
399
|
+
statusBarTranslucent: true
|
|
400
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
401
|
+
// @ts-ignore — typed in RN 0.73+, the runtime prop exists on 0.71+
|
|
402
|
+
,
|
|
403
|
+
navigationBarTranslucent: true,
|
|
381
404
|
animationType: "none",
|
|
382
405
|
supportedOrientations: ['portrait', 'landscape'],
|
|
383
|
-
children: /*#__PURE__*/_jsx(GestureHandlerRootView, {
|
|
406
|
+
children: Platform.OS === 'android' ? /*#__PURE__*/_jsx(GestureHandlerRootView, {
|
|
384
407
|
style: styles.modalRoot,
|
|
385
408
|
children: sheetTree
|
|
386
|
-
})
|
|
409
|
+
}) : sheetTree
|
|
387
410
|
});
|
|
388
411
|
}
|
|
389
412
|
return sheetTree;
|
|
@@ -403,14 +426,26 @@ const resolveSnapPoints = (points, screenH) => {
|
|
|
403
426
|
};
|
|
404
427
|
const clamp = (value, min, max) => Math.min(Math.max(value, min), max);
|
|
405
428
|
const buildStyles = _theme => StyleSheet.create({
|
|
406
|
-
|
|
429
|
+
backdropModal: {
|
|
430
|
+
// The backdrop is the modal's root View. On Fabric, an absolute-
|
|
431
|
+
// positioned root inside RNModal has no positioned ancestor and
|
|
432
|
+
// collapses to zero size, taking the scrim with it. `flex: 1` fills
|
|
433
|
+
// the modal content area reliably.
|
|
434
|
+
flex: 1
|
|
435
|
+
},
|
|
436
|
+
backdropInline: {
|
|
437
|
+
// Inline mode: overlay the parent. Parent must be positioned for this
|
|
438
|
+
// to take effect (the consumer is expected to render BottomSheet inside
|
|
439
|
+
// a relatively-positioned container).
|
|
407
440
|
...StyleSheet.absoluteFillObject
|
|
408
441
|
},
|
|
409
442
|
sheet: {
|
|
410
443
|
position: 'absolute',
|
|
411
444
|
left: 0,
|
|
412
445
|
right: 0,
|
|
413
|
-
top
|
|
446
|
+
// `top` is driven by the animated style (see sheetStyle). Omitted
|
|
447
|
+
// here so the static `0` doesn't fight the animated value during
|
|
448
|
+
// initial paint.
|
|
414
449
|
overflow: 'hidden'
|
|
415
450
|
},
|
|
416
451
|
handleRow: {
|