@hero-design/rn 7.21.0 → 7.22.1
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/.eslintrc.js +11 -0
- package/.turbo/turbo-build.log +9 -9
- package/babel.config.js +1 -1
- package/es/index.js +377 -263
- package/lib/index.js +380 -266
- package/package.json +7 -15
- package/src/components/BottomNavigation/__tests__/index.spec.tsx +1 -1
- package/src/components/BottomNavigation/index.tsx +3 -3
- package/src/components/BottomSheet/StyledBottomSheet.tsx +10 -0
- package/src/components/BottomSheet/__tests__/__snapshots__/index.spec.tsx.snap +326 -292
- package/src/components/BottomSheet/index.tsx +46 -26
- package/src/components/Box/helpers.ts +1 -1
- package/src/components/Calendar/index.tsx +9 -9
- package/src/components/Collapse/index.tsx +1 -1
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +176 -159
- package/src/components/Drawer/DragableDrawer/helpers.ts +7 -3
- package/src/components/FAB/ActionGroup/index.tsx +1 -1
- package/src/components/Icon/HeroIcon/selection.json +7029 -1
- package/src/components/PinInput/index.tsx +1 -1
- package/src/components/RichTextEditor/EditorToolbar.tsx +3 -3
- package/src/components/RichTextEditor/RichTextEditor.tsx +5 -5
- package/src/components/RichTextEditor/__tests__/EditorToolbar.spec.tsx +2 -2
- package/src/components/RichTextEditor/__tests__/MentionList.spec.tsx +1 -1
- package/src/components/Select/MultiSelect/OptionList.tsx +1 -1
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +4691 -4606
- package/src/components/Select/MultiSelect/__tests__/index.spec.tsx +1 -1
- package/src/components/Select/MultiSelect/index.tsx +3 -3
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +4245 -4160
- package/src/components/Select/SingleSelect/index.tsx +3 -3
- package/src/components/Select/helpers.tsx +4 -4
- package/src/components/Slider/index.tsx +1 -1
- package/src/components/Switch/SelectorSwitch/Option.tsx +67 -0
- package/src/components/Switch/SelectorSwitch/StyledSelectorSwitch.tsx +25 -0
- package/src/components/Switch/SelectorSwitch/__tests__/Option.spec.tsx +61 -0
- package/src/components/Switch/SelectorSwitch/__tests__/__snapshots__/Option.spec.tsx.snap +195 -0
- package/src/components/Switch/SelectorSwitch/__tests__/__snapshots__/index.spec.tsx.snap +121 -0
- package/src/components/Switch/SelectorSwitch/__tests__/index.spec.tsx +62 -0
- package/src/components/Switch/SelectorSwitch/index.tsx +60 -0
- package/src/components/Switch/index.tsx +4 -1
- package/src/components/Tabs/ScrollableTabs.tsx +12 -5
- package/src/components/Tabs/__tests__/ScrollableTabs.spec.tsx +1 -1
- package/src/components/Tabs/__tests__/index.spec.tsx +1 -1
- package/src/components/Tabs/index.tsx +13 -6
- package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +3 -1
- package/src/components/TextInput/__tests__/index.spec.tsx +114 -112
- package/src/components/TextInput/index.tsx +29 -30
- package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +176 -159
- package/src/components/Toast/ToastContainer.tsx +6 -6
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +14 -12
- package/src/theme/components/switch.ts +14 -18
- package/testUtils/setup.tsx +1 -1
- package/tsconfig.json +1 -1
- package/types/components/BottomSheet/StyledBottomSheet.d.ts +8 -2
- package/types/components/BottomSheet/index.d.ts +6 -1
- package/types/components/Slider/index.d.ts +1 -1
- package/types/components/Switch/SelectorSwitch/Option.d.ts +10 -0
- package/types/components/Switch/SelectorSwitch/StyledSelectorSwitch.d.ts +19 -0
- package/types/components/Switch/SelectorSwitch/__tests__/Option.spec.d.ts +1 -0
- package/types/components/Switch/SelectorSwitch/__tests__/index.spec.d.ts +1 -0
- package/types/components/Switch/SelectorSwitch/index.d.ts +37 -0
- package/types/components/Switch/index.d.ts +5 -3
- package/types/components/Tabs/ScrollableTabs.d.ts +1 -1
- package/types/components/Tabs/index.d.ts +2 -2
- package/types/components/TextInput/index.d.ts +4 -4
- package/types/theme/components/switch.d.ts +14 -12
- package/.eslintrc.json +0 -62
- package/.prettierrc.json +0 -8
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Animated,
|
|
4
|
+
Dimensions,
|
|
5
|
+
Easing,
|
|
6
|
+
KeyboardAvoidingViewProps,
|
|
7
|
+
Modal,
|
|
8
|
+
Platform,
|
|
9
|
+
} from 'react-native';
|
|
3
10
|
import type { ReactElement, ReactNode } from 'react';
|
|
4
11
|
import type { StyleProp, ViewStyle } from 'react-native';
|
|
5
12
|
import Footer from './Footer';
|
|
@@ -7,6 +14,7 @@ import Header from './Header';
|
|
|
7
14
|
import {
|
|
8
15
|
StyledBackdrop,
|
|
9
16
|
StyledBottomSheet,
|
|
17
|
+
StyledKeyboardAvoidingView,
|
|
10
18
|
StyledWrapper,
|
|
11
19
|
} from './StyledBottomSheet';
|
|
12
20
|
|
|
@@ -64,6 +72,11 @@ interface BottomSheetProps {
|
|
|
64
72
|
* Testing id of the component.
|
|
65
73
|
*/
|
|
66
74
|
testID?: string;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* keyboardAvoidingView's props
|
|
78
|
+
* */
|
|
79
|
+
keyboardAvoidingViewProps?: KeyboardAvoidingViewProps;
|
|
67
80
|
}
|
|
68
81
|
|
|
69
82
|
const BottomSheet = ({
|
|
@@ -80,8 +93,9 @@ const BottomSheet = ({
|
|
|
80
93
|
showDivider = true,
|
|
81
94
|
style,
|
|
82
95
|
testID,
|
|
96
|
+
keyboardAvoidingViewProps = {},
|
|
83
97
|
}: BottomSheetProps): JSX.Element => {
|
|
84
|
-
const
|
|
98
|
+
const { height } = Dimensions.get('window');
|
|
85
99
|
|
|
86
100
|
// Internal state to control modal open/close timing with animation
|
|
87
101
|
const [visible, setVisibility] = useState<boolean>(open);
|
|
@@ -145,31 +159,37 @@ const BottomSheet = ({
|
|
|
145
159
|
style={{ opacity: interpolateOpacity }}
|
|
146
160
|
onPress={onRequestClose}
|
|
147
161
|
/>
|
|
148
|
-
<
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
style,
|
|
152
|
-
{
|
|
153
|
-
transform: [
|
|
154
|
-
{ scaleY: height > 0 ? 1 : 0 },
|
|
155
|
-
{
|
|
156
|
-
translateY: interpolateY,
|
|
157
|
-
},
|
|
158
|
-
],
|
|
159
|
-
},
|
|
160
|
-
]}
|
|
162
|
+
<StyledKeyboardAvoidingView
|
|
163
|
+
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
|
|
164
|
+
{...keyboardAvoidingViewProps}
|
|
161
165
|
>
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
166
|
+
<StyledBottomSheet
|
|
167
|
+
style={[
|
|
168
|
+
style,
|
|
169
|
+
{
|
|
170
|
+
transform: [
|
|
171
|
+
{ scaleY: height > 0 ? 1 : 0 },
|
|
172
|
+
{
|
|
173
|
+
translateY: interpolateY,
|
|
174
|
+
},
|
|
175
|
+
],
|
|
176
|
+
},
|
|
177
|
+
]}
|
|
178
|
+
>
|
|
179
|
+
{header !== undefined ? (
|
|
180
|
+
<Header
|
|
181
|
+
content={header}
|
|
182
|
+
showDivider={showDivider}
|
|
183
|
+
onRequestClose={onRequestClose}
|
|
184
|
+
showCloseButton={showCloseButton}
|
|
185
|
+
/>
|
|
186
|
+
) : null}
|
|
187
|
+
{children}
|
|
188
|
+
{footer ? (
|
|
189
|
+
<Footer showDivider={showDivider}>{footer}</Footer>
|
|
190
|
+
) : null}
|
|
191
|
+
</StyledBottomSheet>
|
|
192
|
+
</StyledKeyboardAvoidingView>
|
|
173
193
|
</StyledWrapper>
|
|
174
194
|
</Modal>
|
|
175
195
|
);
|
|
@@ -101,7 +101,7 @@ const Calendar = ({
|
|
|
101
101
|
const lastDayIndexOfCurrentMonth = lastDateOfMonth.getDate();
|
|
102
102
|
const lastDayIndexOfPreviousMonth = lastDateOfPreviousMonth.getDate();
|
|
103
103
|
|
|
104
|
-
const daysOfPreviousMonth = initArray(firstDayWeekIndexOfMonth, index => {
|
|
104
|
+
const daysOfPreviousMonth = initArray(firstDayWeekIndexOfMonth, (index) => {
|
|
105
105
|
const reversedIndex = firstDayWeekIndexOfMonth - index - 1;
|
|
106
106
|
const count = lastDayIndexOfPreviousMonth - reversedIndex;
|
|
107
107
|
return getValidDate(
|
|
@@ -111,7 +111,7 @@ const Calendar = ({
|
|
|
111
111
|
);
|
|
112
112
|
});
|
|
113
113
|
|
|
114
|
-
const daysOfCurrentMonth = initArray(lastDayIndexOfCurrentMonth, index =>
|
|
114
|
+
const daysOfCurrentMonth = initArray(lastDayIndexOfCurrentMonth, (index) =>
|
|
115
115
|
getValidDate(
|
|
116
116
|
new Date(currentYear, currentMonth, index + 1),
|
|
117
117
|
minDate,
|
|
@@ -122,7 +122,7 @@ const Calendar = ({
|
|
|
122
122
|
const daysOfNextMonth = initArray(
|
|
123
123
|
TOTAL_DATES_ITEMS -
|
|
124
124
|
(daysOfPreviousMonth.length + daysOfCurrentMonth.length),
|
|
125
|
-
index =>
|
|
125
|
+
(index) =>
|
|
126
126
|
getValidDate(
|
|
127
127
|
new Date(currentYear, currentMonth + 1, index + 1),
|
|
128
128
|
minDate,
|
|
@@ -133,13 +133,13 @@ const Calendar = ({
|
|
|
133
133
|
const disablePrevButton =
|
|
134
134
|
minDate === undefined
|
|
135
135
|
? false
|
|
136
|
-
: !daysOfPreviousMonth.some(date => date !== undefined) &&
|
|
136
|
+
: !daysOfPreviousMonth.some((date) => date !== undefined) &&
|
|
137
137
|
minDate >= firstDateOfMonth;
|
|
138
138
|
|
|
139
139
|
const disableNextButton =
|
|
140
140
|
maxDate === undefined
|
|
141
141
|
? false
|
|
142
|
-
: !daysOfNextMonth.some(date => date !== undefined) ||
|
|
142
|
+
: !daysOfNextMonth.some((date) => date !== undefined) ||
|
|
143
143
|
maxDate <= lastDateOfMonth;
|
|
144
144
|
|
|
145
145
|
return (
|
|
@@ -156,7 +156,7 @@ const Calendar = ({
|
|
|
156
156
|
/>
|
|
157
157
|
</StyledCalendarHeader>
|
|
158
158
|
<StyledCalendarRow>
|
|
159
|
-
{DAYS_OF_WEEK.map(day => (
|
|
159
|
+
{DAYS_OF_WEEK.map((day) => (
|
|
160
160
|
<StyledCalendarRowItem key={day}>
|
|
161
161
|
<StyledCalendarDayNameCell>
|
|
162
162
|
<Typography.Text>{day}</Typography.Text>
|
|
@@ -165,7 +165,7 @@ const Calendar = ({
|
|
|
165
165
|
))}
|
|
166
166
|
</StyledCalendarRow>
|
|
167
167
|
<StyledCalendarRow>
|
|
168
|
-
{daysOfPreviousMonth.map(date =>
|
|
168
|
+
{daysOfPreviousMonth.map((date) =>
|
|
169
169
|
date ? (
|
|
170
170
|
<CalendarRowItem
|
|
171
171
|
key={date.toDateString()}
|
|
@@ -180,7 +180,7 @@ const Calendar = ({
|
|
|
180
180
|
<StyledDisabledCalendarRowItem testID="calendar-disabled-cell" />
|
|
181
181
|
)
|
|
182
182
|
)}
|
|
183
|
-
{daysOfCurrentMonth.map(date =>
|
|
183
|
+
{daysOfCurrentMonth.map((date) =>
|
|
184
184
|
date ? (
|
|
185
185
|
<CalendarRowItem
|
|
186
186
|
key={date.toDateString()}
|
|
@@ -194,7 +194,7 @@ const Calendar = ({
|
|
|
194
194
|
<StyledDisabledCalendarRowItem testID="calendar-disabled-cell" />
|
|
195
195
|
)
|
|
196
196
|
)}
|
|
197
|
-
{daysOfNextMonth.map(date =>
|
|
197
|
+
{daysOfNextMonth.map((date) =>
|
|
198
198
|
date ? (
|
|
199
199
|
<CalendarRowItem
|
|
200
200
|
key={date.toDateString()}
|
|
@@ -60,7 +60,7 @@ const Collapse = ({ open = false, children, testID, style }: CollapseProps) => {
|
|
|
60
60
|
>
|
|
61
61
|
<StyledHiddenWrapper>
|
|
62
62
|
<StyledChildWrapper
|
|
63
|
-
onLayout={event => fetchMaxHeight(event.nativeEvent.layout)}
|
|
63
|
+
onLayout={(event) => fetchMaxHeight(event.nativeEvent.layout)}
|
|
64
64
|
style={style}
|
|
65
65
|
>
|
|
66
66
|
{children}
|
|
@@ -277,166 +277,146 @@ exports[`DatePickerIOS renders correctly 1`] = `
|
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
279
|
/>
|
|
280
|
-
<
|
|
281
|
-
collapsable={false}
|
|
282
|
-
emulateUnlessSupported={true}
|
|
283
|
-
nativeID="animatedComponent"
|
|
280
|
+
<View
|
|
284
281
|
onLayout={[Function]}
|
|
285
282
|
style={
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
"borderTopLeftRadius": 16,
|
|
289
|
-
"borderTopRightRadius": 16,
|
|
290
|
-
"elevation": 10,
|
|
291
|
-
"maxHeight": "94%",
|
|
292
|
-
"shadowColor": "#001f23",
|
|
293
|
-
"shadowOffset": Object {
|
|
294
|
-
"height": 3,
|
|
295
|
-
"width": 0,
|
|
296
|
-
},
|
|
297
|
-
"shadowOpacity": 0.27,
|
|
298
|
-
"shadowRadius": 4.65,
|
|
299
|
-
"transform": Array [
|
|
300
|
-
Object {
|
|
301
|
-
"scaleY": 0,
|
|
302
|
-
},
|
|
283
|
+
Array [
|
|
284
|
+
Array [
|
|
303
285
|
Object {
|
|
304
|
-
"
|
|
286
|
+
"flex": 1,
|
|
287
|
+
"flexDirection": "column-reverse",
|
|
305
288
|
},
|
|
289
|
+
undefined,
|
|
306
290
|
],
|
|
307
|
-
|
|
308
|
-
|
|
291
|
+
Object {
|
|
292
|
+
"paddingBottom": 0,
|
|
293
|
+
},
|
|
294
|
+
]
|
|
309
295
|
}
|
|
310
296
|
>
|
|
311
|
-
<
|
|
297
|
+
<RCTSafeAreaView
|
|
298
|
+
collapsable={false}
|
|
299
|
+
emulateUnlessSupported={true}
|
|
300
|
+
nativeID="animatedComponent"
|
|
312
301
|
style={
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
302
|
+
Object {
|
|
303
|
+
"backgroundColor": "#ffffff",
|
|
304
|
+
"borderTopLeftRadius": 16,
|
|
305
|
+
"borderTopRightRadius": 16,
|
|
306
|
+
"elevation": 10,
|
|
307
|
+
"maxHeight": "94%",
|
|
308
|
+
"shadowColor": "#001f23",
|
|
309
|
+
"shadowOffset": Object {
|
|
310
|
+
"height": 3,
|
|
311
|
+
"width": 0,
|
|
318
312
|
},
|
|
319
|
-
|
|
320
|
-
|
|
313
|
+
"shadowOpacity": 0.27,
|
|
314
|
+
"shadowRadius": 4.65,
|
|
315
|
+
"transform": Array [
|
|
316
|
+
Object {
|
|
317
|
+
"scaleY": 1,
|
|
318
|
+
},
|
|
319
|
+
Object {
|
|
320
|
+
"translateY": 0,
|
|
321
|
+
},
|
|
322
|
+
],
|
|
323
|
+
"width": "100%",
|
|
324
|
+
}
|
|
321
325
|
}
|
|
322
326
|
>
|
|
323
327
|
<View
|
|
324
328
|
style={
|
|
325
329
|
Array [
|
|
326
330
|
Object {
|
|
327
|
-
"
|
|
328
|
-
"
|
|
331
|
+
"flexDirection": "row",
|
|
332
|
+
"paddingHorizontal": 16,
|
|
333
|
+
"paddingVertical": 8,
|
|
329
334
|
},
|
|
330
335
|
undefined,
|
|
331
336
|
]
|
|
332
337
|
}
|
|
333
338
|
>
|
|
334
|
-
<
|
|
339
|
+
<View
|
|
335
340
|
style={
|
|
336
341
|
Array [
|
|
337
342
|
Object {
|
|
338
|
-
"
|
|
339
|
-
"
|
|
340
|
-
"fontSize": 16,
|
|
341
|
-
"letterSpacing": 0.48,
|
|
342
|
-
"lineHeight": 24,
|
|
343
|
+
"flex": 1,
|
|
344
|
+
"justifyContent": "center",
|
|
343
345
|
},
|
|
344
346
|
undefined,
|
|
345
347
|
]
|
|
346
348
|
}
|
|
347
|
-
themeFontSize="large"
|
|
348
|
-
themeFontWeight="semi-bold"
|
|
349
|
-
themeIntent="body"
|
|
350
|
-
>
|
|
351
|
-
Start date
|
|
352
|
-
</Text>
|
|
353
|
-
</View>
|
|
354
|
-
<View
|
|
355
|
-
style={
|
|
356
|
-
Array [
|
|
357
|
-
Object {
|
|
358
|
-
"alignItems": "center",
|
|
359
|
-
"height": 48,
|
|
360
|
-
"justifyContent": "center",
|
|
361
|
-
"marginLeft": 12,
|
|
362
|
-
"width": 48,
|
|
363
|
-
},
|
|
364
|
-
undefined,
|
|
365
|
-
]
|
|
366
|
-
}
|
|
367
|
-
>
|
|
368
|
-
<View
|
|
369
|
-
accessible={true}
|
|
370
|
-
collapsable={false}
|
|
371
|
-
focusable={true}
|
|
372
|
-
nativeID="animatedComponent"
|
|
373
|
-
onClick={[Function]}
|
|
374
|
-
onResponderGrant={[Function]}
|
|
375
|
-
onResponderMove={[Function]}
|
|
376
|
-
onResponderRelease={[Function]}
|
|
377
|
-
onResponderTerminate={[Function]}
|
|
378
|
-
onResponderTerminationRequest={[Function]}
|
|
379
|
-
onStartShouldSetResponder={[Function]}
|
|
380
|
-
style={
|
|
381
|
-
Object {
|
|
382
|
-
"opacity": 1,
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
testID="bottom-sheet-close-icon"
|
|
386
349
|
>
|
|
387
|
-
<
|
|
388
|
-
name="cancel"
|
|
350
|
+
<Text
|
|
389
351
|
style={
|
|
390
352
|
Array [
|
|
391
353
|
Object {
|
|
392
354
|
"color": "#001f23",
|
|
393
|
-
"
|
|
355
|
+
"fontFamily": "BeVietnamPro-SemiBold",
|
|
356
|
+
"fontSize": 16,
|
|
357
|
+
"letterSpacing": 0.48,
|
|
358
|
+
"lineHeight": 24,
|
|
394
359
|
},
|
|
395
360
|
undefined,
|
|
396
361
|
]
|
|
397
362
|
}
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
363
|
+
themeFontSize="large"
|
|
364
|
+
themeFontWeight="semi-bold"
|
|
365
|
+
themeIntent="body"
|
|
366
|
+
>
|
|
367
|
+
Start date
|
|
368
|
+
</Text>
|
|
401
369
|
</View>
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
}
|
|
415
|
-
/>
|
|
416
|
-
<View
|
|
417
|
-
style={
|
|
418
|
-
Array [
|
|
419
|
-
Object {
|
|
420
|
-
"height": 176,
|
|
421
|
-
},
|
|
422
|
-
undefined,
|
|
423
|
-
]
|
|
424
|
-
}
|
|
425
|
-
>
|
|
426
|
-
<Picker
|
|
427
|
-
display="spinner"
|
|
428
|
-
mode="date"
|
|
429
|
-
onChange={[Function]}
|
|
430
|
-
style={
|
|
431
|
-
Object {
|
|
432
|
-
"flex": 1,
|
|
370
|
+
<View
|
|
371
|
+
style={
|
|
372
|
+
Array [
|
|
373
|
+
Object {
|
|
374
|
+
"alignItems": "center",
|
|
375
|
+
"height": 48,
|
|
376
|
+
"justifyContent": "center",
|
|
377
|
+
"marginLeft": 12,
|
|
378
|
+
"width": 48,
|
|
379
|
+
},
|
|
380
|
+
undefined,
|
|
381
|
+
]
|
|
433
382
|
}
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
383
|
+
>
|
|
384
|
+
<View
|
|
385
|
+
accessible={true}
|
|
386
|
+
collapsable={false}
|
|
387
|
+
focusable={true}
|
|
388
|
+
nativeID="animatedComponent"
|
|
389
|
+
onClick={[Function]}
|
|
390
|
+
onResponderGrant={[Function]}
|
|
391
|
+
onResponderMove={[Function]}
|
|
392
|
+
onResponderRelease={[Function]}
|
|
393
|
+
onResponderTerminate={[Function]}
|
|
394
|
+
onResponderTerminationRequest={[Function]}
|
|
395
|
+
onStartShouldSetResponder={[Function]}
|
|
396
|
+
style={
|
|
397
|
+
Object {
|
|
398
|
+
"opacity": 1,
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
testID="bottom-sheet-close-icon"
|
|
402
|
+
>
|
|
403
|
+
<HeroIcon
|
|
404
|
+
name="cancel"
|
|
405
|
+
style={
|
|
406
|
+
Array [
|
|
407
|
+
Object {
|
|
408
|
+
"color": "#001f23",
|
|
409
|
+
"fontSize": 20,
|
|
410
|
+
},
|
|
411
|
+
undefined,
|
|
412
|
+
]
|
|
413
|
+
}
|
|
414
|
+
themeIntent="text"
|
|
415
|
+
themeSize="small"
|
|
416
|
+
/>
|
|
417
|
+
</View>
|
|
418
|
+
</View>
|
|
419
|
+
</View>
|
|
440
420
|
<View
|
|
441
421
|
style={
|
|
442
422
|
Array [
|
|
@@ -453,58 +433,95 @@ exports[`DatePickerIOS renders correctly 1`] = `
|
|
|
453
433
|
style={
|
|
454
434
|
Array [
|
|
455
435
|
Object {
|
|
456
|
-
"
|
|
457
|
-
"flexDirection": "row",
|
|
458
|
-
"justifyContent": "flex-end",
|
|
459
|
-
"minHeight": 64,
|
|
460
|
-
"paddingHorizontal": 12,
|
|
461
|
-
"paddingVertical": 8,
|
|
436
|
+
"height": 176,
|
|
462
437
|
},
|
|
463
438
|
undefined,
|
|
464
439
|
]
|
|
465
440
|
}
|
|
466
441
|
>
|
|
467
|
-
<
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
nativeID="animatedComponent"
|
|
472
|
-
onClick={[Function]}
|
|
473
|
-
onResponderGrant={[Function]}
|
|
474
|
-
onResponderMove={[Function]}
|
|
475
|
-
onResponderRelease={[Function]}
|
|
476
|
-
onResponderTerminate={[Function]}
|
|
477
|
-
onResponderTerminationRequest={[Function]}
|
|
478
|
-
onStartShouldSetResponder={[Function]}
|
|
442
|
+
<Picker
|
|
443
|
+
display="spinner"
|
|
444
|
+
mode="date"
|
|
445
|
+
onChange={[Function]}
|
|
479
446
|
style={
|
|
480
447
|
Object {
|
|
481
|
-
"
|
|
448
|
+
"flex": 1,
|
|
482
449
|
}
|
|
483
450
|
}
|
|
451
|
+
testID="datePickerIOS"
|
|
452
|
+
value={1995-12-21T00:00:00.000Z}
|
|
453
|
+
/>
|
|
454
|
+
</View>
|
|
455
|
+
<View>
|
|
456
|
+
<View
|
|
457
|
+
style={
|
|
458
|
+
Array [
|
|
459
|
+
Object {
|
|
460
|
+
"borderBottomColor": "#e8e9ea",
|
|
461
|
+
"borderBottomWidth": 1,
|
|
462
|
+
"maxWidth": "100%",
|
|
463
|
+
},
|
|
464
|
+
undefined,
|
|
465
|
+
]
|
|
466
|
+
}
|
|
467
|
+
/>
|
|
468
|
+
<View
|
|
469
|
+
style={
|
|
470
|
+
Array [
|
|
471
|
+
Object {
|
|
472
|
+
"alignItems": "center",
|
|
473
|
+
"flexDirection": "row",
|
|
474
|
+
"justifyContent": "flex-end",
|
|
475
|
+
"minHeight": 64,
|
|
476
|
+
"paddingHorizontal": 12,
|
|
477
|
+
"paddingVertical": 8,
|
|
478
|
+
},
|
|
479
|
+
undefined,
|
|
480
|
+
]
|
|
481
|
+
}
|
|
484
482
|
>
|
|
485
|
-
<
|
|
483
|
+
<View
|
|
484
|
+
accessible={true}
|
|
485
|
+
collapsable={false}
|
|
486
|
+
focusable={true}
|
|
487
|
+
nativeID="animatedComponent"
|
|
488
|
+
onClick={[Function]}
|
|
489
|
+
onResponderGrant={[Function]}
|
|
490
|
+
onResponderMove={[Function]}
|
|
491
|
+
onResponderRelease={[Function]}
|
|
492
|
+
onResponderTerminate={[Function]}
|
|
493
|
+
onResponderTerminationRequest={[Function]}
|
|
494
|
+
onStartShouldSetResponder={[Function]}
|
|
486
495
|
style={
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
"fontFamily": "BeVietnamPro-SemiBold",
|
|
491
|
-
"fontSize": 16,
|
|
492
|
-
"letterSpacing": 0.48,
|
|
493
|
-
"lineHeight": 24,
|
|
494
|
-
},
|
|
495
|
-
undefined,
|
|
496
|
-
]
|
|
496
|
+
Object {
|
|
497
|
+
"opacity": 1,
|
|
498
|
+
}
|
|
497
499
|
}
|
|
498
|
-
themeFontSize="large"
|
|
499
|
-
themeFontWeight="semi-bold"
|
|
500
|
-
themeIntent="primary"
|
|
501
500
|
>
|
|
502
|
-
|
|
503
|
-
|
|
501
|
+
<Text
|
|
502
|
+
style={
|
|
503
|
+
Array [
|
|
504
|
+
Object {
|
|
505
|
+
"color": "#8505a2",
|
|
506
|
+
"fontFamily": "BeVietnamPro-SemiBold",
|
|
507
|
+
"fontSize": 16,
|
|
508
|
+
"letterSpacing": 0.48,
|
|
509
|
+
"lineHeight": 24,
|
|
510
|
+
},
|
|
511
|
+
undefined,
|
|
512
|
+
]
|
|
513
|
+
}
|
|
514
|
+
themeFontSize="large"
|
|
515
|
+
themeFontWeight="semi-bold"
|
|
516
|
+
themeIntent="primary"
|
|
517
|
+
>
|
|
518
|
+
Confirm
|
|
519
|
+
</Text>
|
|
520
|
+
</View>
|
|
504
521
|
</View>
|
|
505
522
|
</View>
|
|
506
|
-
</
|
|
507
|
-
</
|
|
523
|
+
</RCTSafeAreaView>
|
|
524
|
+
</View>
|
|
508
525
|
</View>
|
|
509
526
|
</View>
|
|
510
527
|
</View>
|
|
@@ -16,9 +16,11 @@ export const calculateSnapPointsData = (
|
|
|
16
16
|
height: number,
|
|
17
17
|
snapPoints: number[]
|
|
18
18
|
): SnapPointsData => {
|
|
19
|
-
const filteredSnapPoints = snapPoints.filter(
|
|
19
|
+
const filteredSnapPoints = snapPoints.filter(
|
|
20
|
+
(value) => value >= minimumHeight
|
|
21
|
+
);
|
|
20
22
|
const snapPointsOffsetValues = [minimumHeight, ...filteredSnapPoints].map(
|
|
21
|
-
value => getOffset(height, value)
|
|
23
|
+
(value) => getOffset(height, value)
|
|
22
24
|
);
|
|
23
25
|
const uniqSnapPointOffsetValues = Array.from(
|
|
24
26
|
new Set([...snapPointsOffsetValues, 0])
|
|
@@ -35,7 +37,9 @@ export const calculateAnimatedToValue = (
|
|
|
35
37
|
position: number,
|
|
36
38
|
heightSnapPoints: number[]
|
|
37
39
|
) => {
|
|
38
|
-
const distances = heightSnapPoints.map(height =>
|
|
40
|
+
const distances = heightSnapPoints.map((height) =>
|
|
41
|
+
Math.abs(position - height)
|
|
42
|
+
);
|
|
39
43
|
|
|
40
44
|
const minIndex = distances.indexOf(Math.min(...distances));
|
|
41
45
|
return heightSnapPoints[minIndex];
|