react-native-molecules 0.5.0-beta.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.
- package/components/Accordion/Accordion.tsx +89 -0
- package/components/Accordion/AccordionItem.tsx +94 -0
- package/components/Accordion/AccordionItemContent.tsx +17 -0
- package/components/Accordion/AccordionItemHeader.tsx +122 -0
- package/components/Accordion/index.tsx +36 -0
- package/components/Accordion/utils.ts +62 -0
- package/components/ActivityIndicator/ActivityIndicator.ios.tsx +1 -0
- package/components/ActivityIndicator/ActivityIndicator.tsx +200 -0
- package/components/ActivityIndicator/AnimatedSpinner.tsx +121 -0
- package/components/ActivityIndicator/index.tsx +17 -0
- package/components/Appbar/AppbarActions.tsx +13 -0
- package/components/Appbar/AppbarBase.tsx +60 -0
- package/components/Appbar/AppbarCenterAligned.tsx +13 -0
- package/components/Appbar/AppbarLarge.tsx +13 -0
- package/components/Appbar/AppbarLeft.tsx +26 -0
- package/components/Appbar/AppbarMedium.tsx +13 -0
- package/components/Appbar/AppbarRight.tsx +40 -0
- package/components/Appbar/AppbarSmall.tsx +13 -0
- package/components/Appbar/AppbarTitle.tsx +49 -0
- package/components/Appbar/index.tsx +46 -0
- package/components/Appbar/types.ts +19 -0
- package/components/Appbar/utils.ts +127 -0
- package/components/Avatar/Avatar.tsx +189 -0
- package/components/Avatar/index.tsx +11 -0
- package/components/Avatar/utils.ts +35 -0
- package/components/Backdrop/Backdrop.tsx +18 -0
- package/components/Backdrop/index.tsx +11 -0
- package/components/Backdrop/types.ts +3 -0
- package/components/Backdrop/utils.ts +21 -0
- package/components/Badge/Badge.tsx +29 -0
- package/components/Badge/index.tsx +11 -0
- package/components/Badge/utils.ts +38 -0
- package/components/Button/Button.tsx +349 -0
- package/components/Button/index.tsx +11 -0
- package/components/Button/types.ts +5 -0
- package/components/Button/utils.ts +416 -0
- package/components/Card/Card.tsx +160 -0
- package/components/Card/CardActions.tsx +18 -0
- package/components/Card/CardContent.tsx +29 -0
- package/components/Card/CardHeader.tsx +31 -0
- package/components/Card/CardHeadline.tsx +15 -0
- package/components/Card/CardMedia.tsx +36 -0
- package/components/Card/CardSubhead.tsx +15 -0
- package/components/Card/CardText.tsx +13 -0
- package/components/Card/CardTypography.tsx +113 -0
- package/components/Card/index.tsx +38 -0
- package/components/Card/types.ts +1 -0
- package/components/Card/utils.ts +23 -0
- package/components/Checkbox/Checkbox.tsx +123 -0
- package/components/Checkbox/CheckboxBase.ios.tsx +86 -0
- package/components/Checkbox/CheckboxBase.tsx +216 -0
- package/components/Checkbox/index.tsx +11 -0
- package/components/Checkbox/types.ts +72 -0
- package/components/Checkbox/utils.ts +210 -0
- package/components/Chip/Chip.tsx +416 -0
- package/components/Chip/index.tsx +51 -0
- package/components/Chip/utils.ts +100 -0
- package/components/DatePickerDocked/DatePickerDocked.tsx +30 -0
- package/components/DatePickerDocked/DatePickerDockedHeader.tsx +129 -0
- package/components/DatePickerDocked/index.tsx +21 -0
- package/components/DatePickerDocked/types.ts +11 -0
- package/components/DatePickerDocked/utils.ts +155 -0
- package/components/DatePickerInline/AutoSizer.tsx +46 -0
- package/components/DatePickerInline/DatePickerContext.tsx +21 -0
- package/components/DatePickerInline/DatePickerInline.tsx +82 -0
- package/components/DatePickerInline/DatePickerInlineBase.tsx +181 -0
- package/components/DatePickerInline/DatePickerInlineHeader.tsx +108 -0
- package/components/DatePickerInline/Day.tsx +88 -0
- package/components/DatePickerInline/DayName.tsx +17 -0
- package/components/DatePickerInline/DayNames.tsx +32 -0
- package/components/DatePickerInline/DayRange.tsx +48 -0
- package/components/DatePickerInline/HeaderItem.tsx +111 -0
- package/components/DatePickerInline/Month.tsx +233 -0
- package/components/DatePickerInline/MonthPicker.tsx +174 -0
- package/components/DatePickerInline/Swiper.native.tsx +172 -0
- package/components/DatePickerInline/Swiper.tsx +172 -0
- package/components/DatePickerInline/SwiperUtils.ts +40 -0
- package/components/DatePickerInline/Week.tsx +67 -0
- package/components/DatePickerInline/YearPicker.tsx +139 -0
- package/components/DatePickerInline/dateUtils.tsx +334 -0
- package/components/DatePickerInline/index.tsx +41 -0
- package/components/DatePickerInline/types.ts +104 -0
- package/components/DatePickerInline/utils.ts +367 -0
- package/components/DatePickerInput/DatePickerInput.tsx +139 -0
- package/components/DatePickerInput/DatePickerInputModal.tsx +48 -0
- package/components/DatePickerInput/DatePickerInputWithoutModal.tsx +77 -0
- package/components/DatePickerInput/DateRangeInput.tsx +88 -0
- package/components/DatePickerInput/index.tsx +14 -0
- package/components/DatePickerInput/inputUtils.ts +138 -0
- package/components/DatePickerInput/types.ts +28 -0
- package/components/DatePickerInput/utils.ts +16 -0
- package/components/DatePickerModal/AnimatedCrossView.tsx +94 -0
- package/components/DatePickerModal/CalendarEdit.tsx +139 -0
- package/components/DatePickerModal/DatePickerModal.tsx +85 -0
- package/components/DatePickerModal/DatePickerModalContent.tsx +155 -0
- package/components/DatePickerModal/DatePickerModalContentHeader.tsx +213 -0
- package/components/DatePickerModal/DatePickerModalHeader.tsx +74 -0
- package/components/DatePickerModal/DatePickerModalHeaderBackground.tsx +13 -0
- package/components/DatePickerModal/index.tsx +20 -0
- package/components/DatePickerModal/types.ts +92 -0
- package/components/DatePickerModal/utils.ts +121 -0
- package/components/DateTimePicker/DateTimePicker.tsx +172 -0
- package/components/DateTimePicker/index.tsx +14 -0
- package/components/DateTimePicker/utils.ts +13 -0
- package/components/Dialog/Dialog.tsx +66 -0
- package/components/Dialog/DialogActions.tsx +89 -0
- package/components/Dialog/DialogContent.tsx +37 -0
- package/components/Dialog/DialogIcon.tsx +69 -0
- package/components/Dialog/DialogTitle.tsx +68 -0
- package/components/Dialog/index.tsx +37 -0
- package/components/Dialog/utils.ts +80 -0
- package/components/Drawer/Collapsible/DrawerCollapsible.tsx +22 -0
- package/components/Drawer/Collapsible/DrawerCollapsibleItem.tsx +38 -0
- package/components/Drawer/Collapsible/DrawerCollapsibleItemContent.tsx +16 -0
- package/components/Drawer/Collapsible/DrawerCollapsibleItemHeader.tsx +48 -0
- package/components/Drawer/Collapsible/index.tsx +23 -0
- package/components/Drawer/Collapsible/utils.ts +49 -0
- package/components/Drawer/Drawer.tsx +43 -0
- package/components/Drawer/DrawerContent.tsx +35 -0
- package/components/Drawer/DrawerFooter.tsx +27 -0
- package/components/Drawer/DrawerHeader.tsx +27 -0
- package/components/Drawer/DrawerItem.tsx +206 -0
- package/components/Drawer/DrawerItemGroup.tsx +82 -0
- package/components/Drawer/index.tsx +47 -0
- package/components/Drawer/types.ts +3 -0
- package/components/Drawer/utils.ts +8 -0
- package/components/ElementGroup/ElementGroup.tsx +139 -0
- package/components/ElementGroup/index.tsx +11 -0
- package/components/ElementGroup/utils.ts +25 -0
- package/components/FAB/FAB.tsx +176 -0
- package/components/FAB/index.tsx +12 -0
- package/components/FAB/types.ts +1 -0
- package/components/FAB/utils.ts +221 -0
- package/components/FilePicker/FilePicker.tsx +133 -0
- package/components/FilePicker/index.tsx +11 -0
- package/components/FilePicker/utils.ts +13 -0
- package/components/HelperText/HelperText.tsx +139 -0
- package/components/HelperText/index.tsx +11 -0
- package/components/HelperText/utils.ts +29 -0
- package/components/HorizontalDivider/HorizontalDivider.tsx +101 -0
- package/components/HorizontalDivider/index.tsx +13 -0
- package/components/Icon/CrossFadeIcon.tsx +116 -0
- package/components/Icon/Icon.tsx +41 -0
- package/components/Icon/iconFactory.tsx +23 -0
- package/components/Icon/index.tsx +11 -0
- package/components/Icon/types.ts +35 -0
- package/components/IconButton/IconButton.tsx +218 -0
- package/components/IconButton/index.tsx +11 -0
- package/components/IconButton/types.ts +1 -0
- package/components/IconButton/utils.ts +325 -0
- package/components/If/index.tsx +13 -0
- package/components/InputAddon/InputAddon.tsx +27 -0
- package/components/InputAddon/index.tsx +11 -0
- package/components/InputAddon/utils.ts +33 -0
- package/components/Link/Link.tsx +48 -0
- package/components/Link/index.tsx +11 -0
- package/components/Link/utils.ts +37 -0
- package/components/ListItem/ListItem.tsx +136 -0
- package/components/ListItem/ListItemDescription.tsx +25 -0
- package/components/ListItem/ListItemTitle.tsx +25 -0
- package/components/ListItem/index.tsx +18 -0
- package/components/ListItem/utils.ts +113 -0
- package/components/Menu/Menu.tsx +69 -0
- package/components/Menu/MenuDivider.tsx +13 -0
- package/components/Menu/MenuItem.tsx +128 -0
- package/components/Menu/index.tsx +19 -0
- package/components/Menu/utils.ts +92 -0
- package/components/Modal/Modal.tsx +261 -0
- package/components/Modal/index.tsx +11 -0
- package/components/Modal/utils.ts +45 -0
- package/components/NavigationRail/NavigationRail.tsx +32 -0
- package/components/NavigationRail/NavigationRailContent.tsx +25 -0
- package/components/NavigationRail/NavigationRailFooter.tsx +18 -0
- package/components/NavigationRail/NavigationRailHeader.tsx +18 -0
- package/components/NavigationRail/NavigationRailItem.tsx +226 -0
- package/components/NavigationRail/index.tsx +35 -0
- package/components/NavigationRail/utils.ts +170 -0
- package/components/NavigationStack/NavigationStack.tsx +85 -0
- package/components/NavigationStack/NavigationStackItem.tsx +60 -0
- package/components/NavigationStack/index.tsx +20 -0
- package/components/NavigationStack/utils.tsx +16 -0
- package/components/Popover/Popover.native.tsx +185 -0
- package/components/Popover/Popover.tsx +198 -0
- package/components/Popover/common.ts +459 -0
- package/components/Popover/index.ts +2 -0
- package/components/Portal/Portal.tsx +13 -0
- package/components/Portal/index.tsx +12 -0
- package/components/RadioButton/RadioButton.tsx +138 -0
- package/components/RadioButton/RadioButtonAndroid.tsx +188 -0
- package/components/RadioButton/RadioButtonGroup.tsx +98 -0
- package/components/RadioButton/RadioButtonIOS.tsx +106 -0
- package/components/RadioButton/RadioButtonItem.tsx +232 -0
- package/components/RadioButton/index.ts +27 -0
- package/components/RadioButton/utils.ts +164 -0
- package/components/Rating/Rating.tsx +149 -0
- package/components/Rating/RatingItem.tsx +125 -0
- package/components/Rating/index.tsx +13 -0
- package/components/Rating/utils.ts +38 -0
- package/components/Select/Select.tsx +1038 -0
- package/components/Select/index.ts +14 -0
- package/components/Select/types.ts +115 -0
- package/components/StateLayer/StateLayer.tsx +12 -0
- package/components/StateLayer/index.tsx +11 -0
- package/components/StateLayer/utils.ts +17 -0
- package/components/Surface/BackgroundContextWrapper.tsx +27 -0
- package/components/Surface/Surface.android.tsx +62 -0
- package/components/Surface/Surface.ios.tsx +123 -0
- package/components/Surface/Surface.tsx +48 -0
- package/components/Surface/index.tsx +12 -0
- package/components/Surface/utils.ts +106 -0
- package/components/Switch/Switch.ios.tsx +67 -0
- package/components/Switch/Switch.tsx +278 -0
- package/components/Switch/index.tsx +11 -0
- package/components/Switch/utils.ts +283 -0
- package/components/Tabs/TabItem.tsx +150 -0
- package/components/Tabs/TabLabel.tsx +84 -0
- package/components/Tabs/Tabs.tsx +398 -0
- package/components/Tabs/index.tsx +21 -0
- package/components/Tabs/utils.ts +126 -0
- package/components/Text/Text.tsx +23 -0
- package/components/Text/index.tsx +2 -0
- package/components/Text/textFactory.tsx +33 -0
- package/components/TextInput/InputLabel.tsx +181 -0
- package/components/TextInput/TextInput.tsx +693 -0
- package/components/TextInput/index.tsx +16 -0
- package/components/TextInput/types.ts +96 -0
- package/components/TextInput/utils.ts +544 -0
- package/components/TextInputWithMask/TextInputMask.tsx +57 -0
- package/components/TextInputWithMask/index.tsx +11 -0
- package/components/TextInputWithMask/utils.ts +56 -0
- package/components/TimePicker/AmPmSwitcher.tsx +99 -0
- package/components/TimePicker/AnalogClock.tsx +165 -0
- package/components/TimePicker/AnalogClockHours.tsx +163 -0
- package/components/TimePicker/AnalogClockMinutes.tsx +68 -0
- package/components/TimePicker/AnimatedClockSwitcher.tsx +72 -0
- package/components/TimePicker/DisplayModeContext.tsx +6 -0
- package/components/TimePicker/TimeInput.tsx +112 -0
- package/components/TimePicker/TimeInputs.tsx +148 -0
- package/components/TimePicker/TimePicker.tsx +130 -0
- package/components/TimePicker/index.tsx +19 -0
- package/components/TimePicker/timeUtils.ts +159 -0
- package/components/TimePicker/utils.ts +285 -0
- package/components/TimePickerField/TimePickerField.tsx +152 -0
- package/components/TimePickerField/index.tsx +14 -0
- package/components/TimePickerField/sanitizeTime.ts +85 -0
- package/components/TimePickerField/utils.ts +95 -0
- package/components/TimePickerModal/TimePickerModal.tsx +115 -0
- package/components/TimePickerModal/index.tsx +14 -0
- package/components/TimePickerModal/utils.ts +48 -0
- package/components/Tooltip/Tooltip.tsx +137 -0
- package/components/Tooltip/TooltipContent.tsx +12 -0
- package/components/Tooltip/TooltipTrigger.tsx +94 -0
- package/components/Tooltip/index.tsx +20 -0
- package/components/Tooltip/utils.ts +21 -0
- package/components/TouchableRipple/TouchableRipple.native.tsx +105 -0
- package/components/TouchableRipple/TouchableRipple.tsx +286 -0
- package/components/TouchableRipple/index.tsx +14 -0
- package/components/TouchableRipple/utils.ts +15 -0
- package/components/VerticalDivider/VerticalDivider.tsx +99 -0
- package/components/VerticalDivider/index.tsx +13 -0
- package/context-bridge/index.tsx +87 -0
- package/core/componentsRegistry.ts +164 -0
- package/core/index.tsx +2 -0
- package/fast-context/index.tsx +190 -0
- package/hocs/index.tsx +5 -0
- package/hocs/typedMemo.tsx +5 -0
- package/hocs/withKeyboardAccessibility.tsx +231 -0
- package/hocs/withPortal.tsx +16 -0
- package/hooks/createPsuedoHook.tsx +50 -0
- package/hooks/index.tsx +29 -0
- package/hooks/useActionState.native.tsx +22 -0
- package/hooks/useActionState.tsx +34 -0
- package/hooks/useActive.tsx +5 -0
- package/hooks/useBreakpoints.tsx +7 -0
- package/hooks/useColorMode.tsx +17 -0
- package/hooks/useContrastColor.ts +15 -0
- package/hooks/useControlledValue.tsx +68 -0
- package/hooks/useFilePicker.tsx +48 -0
- package/hooks/useFocus.tsx +5 -0
- package/hooks/useHandleNumberFormat.tsx +106 -0
- package/hooks/useHover.tsx +5 -0
- package/hooks/useKeyboardDismissable.ts +66 -0
- package/hooks/useLatest.tsx +9 -0
- package/hooks/useMediaQuery.tsx +64 -0
- package/hooks/useMergedRefs.ts +14 -0
- package/hooks/usePrevious.ts +13 -0
- package/hooks/useQueryFilter.tsx +35 -0
- package/hooks/useSearchable.tsx +74 -0
- package/hooks/useSubcomponents.tsx +59 -0
- package/hooks/useTheme.ts +3 -0
- package/hooks/useToggle.tsx +24 -0
- package/package.json +114 -0
- package/shortcuts-manager/EventsManager.tsx +121 -0
- package/shortcuts-manager/ShortcutsManager/ShortcutsManager.native.tsx +9 -0
- package/shortcuts-manager/ShortcutsManager/ShortcutsManager.tsx +58 -0
- package/shortcuts-manager/ShortcutsManager/index.tsx +2 -0
- package/shortcuts-manager/ShortcutsManager/utils.tsx +30 -0
- package/shortcuts-manager/index.tsx +6 -0
- package/shortcuts-manager/types.ts +24 -0
- package/shortcuts-manager/useIsKeyPressed/index.tsx +1 -0
- package/shortcuts-manager/useIsKeyPressed/useIsKeyPress.tsx +9 -0
- package/shortcuts-manager/useSetScopes/index.tsx +1 -0
- package/shortcuts-manager/useSetScopes/useSetScopes.native.tsx +9 -0
- package/shortcuts-manager/useSetScopes/useSetScopes.tsx +25 -0
- package/shortcuts-manager/useShortcut/index.tsx +2 -0
- package/shortcuts-manager/useShortcut/types.ts +3 -0
- package/shortcuts-manager/useShortcut/useShortcut.native.tsx +9 -0
- package/shortcuts-manager/useShortcut/useShortcut.tsx +61 -0
- package/shortcuts-manager/utils.ts +105 -0
- package/styles/index.ts +4 -0
- package/styles/overlay.ts +69 -0
- package/styles/shadow.ts +21 -0
- package/styles/themes/DarkTheme.tsx +98 -0
- package/styles/themes/LightTheme.tsx +212 -0
- package/styles/themes/tokens.ts +248 -0
- package/styles/utils.ts +11 -0
- package/types/index.ts +129 -0
- package/types/theme.ts +159 -0
- package/utils/DocumentPicker/documentPicker.native.ts +10 -0
- package/utils/DocumentPicker/documentPicker.ts +76 -0
- package/utils/DocumentPicker/index.ts +2 -0
- package/utils/DocumentPicker/types.ts +28 -0
- package/utils/addEventListener.tsx +51 -0
- package/utils/backgroundContext.ts +9 -0
- package/utils/color.ts +22 -0
- package/utils/compare/index.ts +54 -0
- package/utils/composeEventHandlers.ts +9 -0
- package/utils/createNumberMask/createNumberMask.ts +98 -0
- package/utils/createNumberMask/index.ts +5 -0
- package/utils/createSyntheticEvent.ts +31 -0
- package/utils/date-fns.ts +7 -0
- package/utils/dateTimePicker.ts +5 -0
- package/utils/escapeRegex.ts +9 -0
- package/utils/extractTextStyles.ts +52 -0
- package/utils/formatNumberWithMask/formatNumberWithMask.ts +26 -0
- package/utils/formatNumberWithMask/formatWithMask.ts +119 -0
- package/utils/formatNumberWithMask/index.ts +6 -0
- package/utils/getCursorStyle/getCursorStyle.native.ts +1 -0
- package/utils/getCursorStyle/getCursorStyle.ts +1 -0
- package/utils/getCursorStyle/index.ts +1 -0
- package/utils/getOS/getOS.native.ts +7 -0
- package/utils/getOS/getOS.ts +24 -0
- package/utils/getOS/index.ts +1 -0
- package/utils/getyearRange.ts +5 -0
- package/utils/index.ts +20 -0
- package/utils/lodash.ts +50 -0
- package/utils/mergeRefs.ts +13 -0
- package/utils/normalizeBorderRadiuses.ts +24 -0
- package/utils/normalizeSpacings.ts +110 -0
- package/utils/normalizeToNumberString/index.ts +4 -0
- package/utils/normalizeToNumberString/normalizeToNumberString.ts +48 -0
- package/utils/repository.ts +103 -0
- package/utils/resolveColorMode.ts +9 -0
- package/utils/resolveStateVariant.ts +26 -0
- package/utils/tokenStylesParser.ts +7 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { useCallback, useState } from 'react';
|
|
2
|
+
import { StyleSheet, View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import DatePickerModal from '../DatePickerModal/DatePickerModal';
|
|
5
|
+
import { IconButton } from '../IconButton';
|
|
6
|
+
import { Text } from '../Text';
|
|
7
|
+
|
|
8
|
+
// WORK IN PROGRESS
|
|
9
|
+
// PLEASE IGNORE THIS FILE
|
|
10
|
+
export default function DateRangeInput({
|
|
11
|
+
locale,
|
|
12
|
+
calendarIcon = 'calendar',
|
|
13
|
+
}: {
|
|
14
|
+
locale: string;
|
|
15
|
+
calendarIcon?: string;
|
|
16
|
+
}) {
|
|
17
|
+
const [visible, setVisible] = useState<boolean>(false);
|
|
18
|
+
const onDismiss = useCallback(() => {
|
|
19
|
+
setVisible(false);
|
|
20
|
+
}, [setVisible]);
|
|
21
|
+
const onConfirm = useCallback(
|
|
22
|
+
({ startDate, endDate }: { startDate: any; endDate: any }) => {
|
|
23
|
+
setVisible(false);
|
|
24
|
+
// eslint-disable-next-line no-console
|
|
25
|
+
console.log({ startDate, endDate });
|
|
26
|
+
},
|
|
27
|
+
[setVisible],
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<View style={styles.container}>
|
|
32
|
+
<View style={styles.textContainer}>
|
|
33
|
+
{/*<DatePickerInput*/}
|
|
34
|
+
{/* value={''}*/}
|
|
35
|
+
{/* keyboardType={'numeric'}*/}
|
|
36
|
+
{/* placeholder={'DD-MM-YYY'}*/}
|
|
37
|
+
{/* mask={'DD-MM-YYY'}*/}
|
|
38
|
+
{/* onChangeText={() => {}}*/}
|
|
39
|
+
{/*/>*/}
|
|
40
|
+
<Text>Van</Text>
|
|
41
|
+
</View>
|
|
42
|
+
<View>
|
|
43
|
+
<Text style={styles.text1}>to</Text>
|
|
44
|
+
<Text style={styles.text2} accessible={false}>
|
|
45
|
+
tot
|
|
46
|
+
</Text>
|
|
47
|
+
</View>
|
|
48
|
+
<View style={styles.textContainer}>
|
|
49
|
+
{/*<DatePickerInput*/}
|
|
50
|
+
{/* // value={''}*/}
|
|
51
|
+
{/* // keyboardType={'numeric'}*/}
|
|
52
|
+
{/* // placeholder={'DD-MM-YYY'}*/}
|
|
53
|
+
{/* // mask={'DD-MM-YYY'}*/}
|
|
54
|
+
{/* // onChangeText={() => {}}*/}
|
|
55
|
+
{/*/>*/}
|
|
56
|
+
<Text>Tot</Text>
|
|
57
|
+
</View>
|
|
58
|
+
<View>
|
|
59
|
+
<IconButton name={calendarIcon} onPress={() => setVisible(true)} />
|
|
60
|
+
<Text style={styles.text2} accessible={false}>
|
|
61
|
+
tot
|
|
62
|
+
</Text>
|
|
63
|
+
</View>
|
|
64
|
+
<DatePickerModal
|
|
65
|
+
locale={locale}
|
|
66
|
+
mode="range"
|
|
67
|
+
isOpen={visible}
|
|
68
|
+
onClose={onDismiss}
|
|
69
|
+
onConfirm={onConfirm}
|
|
70
|
+
startDate={undefined}
|
|
71
|
+
endDate={undefined}
|
|
72
|
+
/>
|
|
73
|
+
</View>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const styles = StyleSheet.create({
|
|
78
|
+
container: { flexDirection: 'row', alignItems: 'center' },
|
|
79
|
+
textContainer: { flex: 1 },
|
|
80
|
+
text1: {
|
|
81
|
+
fontSize: 16,
|
|
82
|
+
marginLeft: 12,
|
|
83
|
+
marginRight: 12,
|
|
84
|
+
},
|
|
85
|
+
text2: {
|
|
86
|
+
opacity: 0,
|
|
87
|
+
},
|
|
88
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { getRegisteredComponentWithFallback, registerMoleculesComponents } from '../../core';
|
|
2
|
+
import DatePickerInputDefault from './DatePickerInput';
|
|
3
|
+
|
|
4
|
+
registerMoleculesComponents({
|
|
5
|
+
DatePickerInput: DatePickerInputDefault,
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export const DatePickerInput = getRegisteredComponentWithFallback(
|
|
9
|
+
'DatePickerInput',
|
|
10
|
+
DatePickerInputDefault,
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
export { DatePickerInputProps } from './types';
|
|
14
|
+
export { datePickerInputStyles } from './utils';
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { type RefObject, useCallback, useEffect, useState } from 'react';
|
|
2
|
+
import type { BlurEvent, FocusEvent } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { useLatest } from '../../hooks';
|
|
5
|
+
import { endOfDay, format, isValid, parse } from '../../utils/date-fns';
|
|
6
|
+
import { isNil } from '../../utils/lodash';
|
|
7
|
+
import type { ValidRangeType } from '../DatePickerInline';
|
|
8
|
+
import { useRangeChecker } from '../DatePickerInline/dateUtils';
|
|
9
|
+
|
|
10
|
+
const formatValue = (value: Date | null | undefined, dateFormat: string) =>
|
|
11
|
+
!isNil(value) ? format(value, dateFormat) || '' : '';
|
|
12
|
+
|
|
13
|
+
export default function useDateInput({
|
|
14
|
+
// locale,
|
|
15
|
+
value,
|
|
16
|
+
validRange,
|
|
17
|
+
inputMode = 'start',
|
|
18
|
+
onChange,
|
|
19
|
+
dateFormat,
|
|
20
|
+
onBlur: onBlurProp,
|
|
21
|
+
onFocus: onFocusProp,
|
|
22
|
+
isBlurredRef,
|
|
23
|
+
}: {
|
|
24
|
+
onChange?: (d: Date | null) => void;
|
|
25
|
+
onBlur?: (e: BlurEvent) => void;
|
|
26
|
+
onFocus?: (e: FocusEvent) => void;
|
|
27
|
+
// locale: undefined | string;
|
|
28
|
+
value?: Date | null;
|
|
29
|
+
validRange?: ValidRangeType;
|
|
30
|
+
inputMode: 'start' | 'end';
|
|
31
|
+
dateFormat: string;
|
|
32
|
+
isBlurredRef: RefObject<boolean>;
|
|
33
|
+
}) {
|
|
34
|
+
const { isDisabled, isWithinValidRange } = useRangeChecker(validRange);
|
|
35
|
+
|
|
36
|
+
const [formattedValue, setFormattedValue] = useState(() => formatValue(value, dateFormat));
|
|
37
|
+
const formattedValueRef = useLatest(formattedValue);
|
|
38
|
+
|
|
39
|
+
// const [error, setError] = useState<null | string>(null);
|
|
40
|
+
|
|
41
|
+
const onChangeText = useCallback(
|
|
42
|
+
(date: string) => {
|
|
43
|
+
const parsedDate = parse(date, dateFormat, new Date());
|
|
44
|
+
|
|
45
|
+
setFormattedValue(
|
|
46
|
+
isBlurredRef.current
|
|
47
|
+
? isValid(parsedDate)
|
|
48
|
+
? date
|
|
49
|
+
: formattedValueRef.current
|
|
50
|
+
: date,
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
if (!isValid(parsedDate)) {
|
|
54
|
+
// TODO: Translate
|
|
55
|
+
// setError(`Date format must be ${dateFormat}`);
|
|
56
|
+
onChange?.(date ? value ?? null : null);
|
|
57
|
+
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const finalDate = inputMode === 'end' ? endOfDay(parsedDate) : parsedDate;
|
|
62
|
+
|
|
63
|
+
if (isDisabled(finalDate)) {
|
|
64
|
+
// TODO: Translate
|
|
65
|
+
// setError('Day is not allowed');
|
|
66
|
+
onChange?.(null);
|
|
67
|
+
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (!isWithinValidRange(finalDate)) {
|
|
71
|
+
// TODO: Translate
|
|
72
|
+
// const errors =
|
|
73
|
+
// validStart && validEnd
|
|
74
|
+
// ? [
|
|
75
|
+
// `${`Must be between ${format(validStart, dateFormat)} - ${format(
|
|
76
|
+
// validEnd,
|
|
77
|
+
// dateFormat,
|
|
78
|
+
// )})`}`,
|
|
79
|
+
// ]
|
|
80
|
+
// : [
|
|
81
|
+
// validStart ? `Must be later then ${validStart}` : '',
|
|
82
|
+
// validEnd ? `Must be earlier then ${validEnd}` : '',
|
|
83
|
+
// ];
|
|
84
|
+
|
|
85
|
+
// setError(errors.filter(n => n).join(' '));
|
|
86
|
+
onChange?.(null);
|
|
87
|
+
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
onChange?.(finalDate);
|
|
92
|
+
// setError(null);
|
|
93
|
+
},
|
|
94
|
+
[
|
|
95
|
+
dateFormat,
|
|
96
|
+
formattedValueRef,
|
|
97
|
+
inputMode,
|
|
98
|
+
isBlurredRef,
|
|
99
|
+
isDisabled,
|
|
100
|
+
isWithinValidRange,
|
|
101
|
+
onChange,
|
|
102
|
+
value,
|
|
103
|
+
],
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
const onBlur = useCallback(
|
|
107
|
+
(e: BlurEvent) => {
|
|
108
|
+
isBlurredRef.current = true;
|
|
109
|
+
onBlurProp?.(e);
|
|
110
|
+
formattedValueRef.current = formatValue(value, dateFormat);
|
|
111
|
+
setFormattedValue(formattedValueRef.current);
|
|
112
|
+
},
|
|
113
|
+
[dateFormat, formattedValueRef, isBlurredRef, onBlurProp, value],
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
const onFocus = useCallback(
|
|
117
|
+
(e: FocusEvent) => {
|
|
118
|
+
isBlurredRef.current = false;
|
|
119
|
+
onFocusProp?.(e);
|
|
120
|
+
},
|
|
121
|
+
[isBlurredRef, onFocusProp],
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
useEffect(() => {
|
|
125
|
+
if (!isBlurredRef.current) return;
|
|
126
|
+
|
|
127
|
+
setFormattedValue(formatValue(value, dateFormat));
|
|
128
|
+
}, [value, dateFormat, isBlurredRef]);
|
|
129
|
+
|
|
130
|
+
return {
|
|
131
|
+
onChange,
|
|
132
|
+
// error,
|
|
133
|
+
formattedValue,
|
|
134
|
+
onChangeText,
|
|
135
|
+
onBlur,
|
|
136
|
+
onFocus,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ViewProps } from 'react-native';
|
|
2
|
+
|
|
3
|
+
import type { ValidRangeType } from '../DatePickerInline';
|
|
4
|
+
import type { TextInputProps } from '../TextInput';
|
|
5
|
+
|
|
6
|
+
export interface DatePickerInputProps
|
|
7
|
+
extends Omit<TextInputProps, 'value' | 'onChange' | 'onChangeText' | 'inputMode'> {
|
|
8
|
+
inputMode: 'start' | 'end';
|
|
9
|
+
locale?: string;
|
|
10
|
+
onChange?: (date: Date | null) => void;
|
|
11
|
+
value?: Date | null;
|
|
12
|
+
validRange?: ValidRangeType | undefined;
|
|
13
|
+
withModal?: boolean;
|
|
14
|
+
calendarIcon?: string;
|
|
15
|
+
/**
|
|
16
|
+
* date format of the input
|
|
17
|
+
* should be date-fns accepted format
|
|
18
|
+
* We currently only accept the variations of dd MM yyyy
|
|
19
|
+
* */
|
|
20
|
+
dateFormat?: string;
|
|
21
|
+
pickerMode?: 'docked' | 'modal';
|
|
22
|
+
startYear?: number;
|
|
23
|
+
endYear?: number;
|
|
24
|
+
dockedPopoverContentProps?: ViewProps;
|
|
25
|
+
}
|
|
26
|
+
export interface DatePickerInputWithoutModalProps extends Omit<DatePickerInputProps, 'withModal'> {
|
|
27
|
+
inputButtons?: any;
|
|
28
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
+
|
|
3
|
+
import { getRegisteredMoleculesComponentStyles, registerComponentsStyles } from '../../core';
|
|
4
|
+
|
|
5
|
+
const datePickerInputStylesDefault = StyleSheet.create({
|
|
6
|
+
root: {
|
|
7
|
+
minWidth: 150,
|
|
8
|
+
justifyContent: 'center',
|
|
9
|
+
},
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
registerComponentsStyles({
|
|
13
|
+
DatePickerInput: datePickerInputStylesDefault,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const datePickerInputStyles = getRegisteredMoleculesComponentStyles('DatePickerInput');
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { useEffect, useMemo, useRef } from 'react';
|
|
2
|
+
import { Animated, View } from 'react-native';
|
|
3
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
4
|
+
|
|
5
|
+
export default function AnimatedCrossView({
|
|
6
|
+
// visible,
|
|
7
|
+
collapsed,
|
|
8
|
+
calendar,
|
|
9
|
+
calendarEdit,
|
|
10
|
+
}: {
|
|
11
|
+
calendar: any;
|
|
12
|
+
calendarEdit: any;
|
|
13
|
+
// visible: boolean
|
|
14
|
+
collapsed: boolean;
|
|
15
|
+
}) {
|
|
16
|
+
const calendarOpacity = useRef<Animated.Value>(new Animated.Value(collapsed ? 1 : 0));
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
// if (visible) {
|
|
19
|
+
Animated.timing(calendarOpacity.current, {
|
|
20
|
+
toValue: collapsed ? 1 : 0,
|
|
21
|
+
duration: 250,
|
|
22
|
+
useNativeDriver: true,
|
|
23
|
+
}).start();
|
|
24
|
+
// }
|
|
25
|
+
}, [collapsed]);
|
|
26
|
+
|
|
27
|
+
const { calendarStyle, calendarEditStyle } = useMemo(() => {
|
|
28
|
+
return {
|
|
29
|
+
calendarStyle: [
|
|
30
|
+
styles.calendar,
|
|
31
|
+
{
|
|
32
|
+
opacity: calendarOpacity.current,
|
|
33
|
+
transform: [
|
|
34
|
+
{
|
|
35
|
+
scaleY: calendarOpacity.current.interpolate({
|
|
36
|
+
inputRange: [0, 1],
|
|
37
|
+
outputRange: [0.85, 1],
|
|
38
|
+
}),
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
scaleX: calendarOpacity.current.interpolate({
|
|
42
|
+
inputRange: [0, 1],
|
|
43
|
+
outputRange: [0.95, 1],
|
|
44
|
+
}),
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
calendarEditStyle: [
|
|
50
|
+
styles.calendarEdit,
|
|
51
|
+
{
|
|
52
|
+
opacity: calendarOpacity.current.interpolate({
|
|
53
|
+
inputRange: [0, 1],
|
|
54
|
+
outputRange: [1, 0],
|
|
55
|
+
}),
|
|
56
|
+
transform: [
|
|
57
|
+
{
|
|
58
|
+
scale: calendarOpacity.current.interpolate({
|
|
59
|
+
inputRange: [0, 1],
|
|
60
|
+
outputRange: [1, 0.95],
|
|
61
|
+
}),
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
};
|
|
67
|
+
}, []);
|
|
68
|
+
|
|
69
|
+
// TODO Create AnimatedCrossView Component
|
|
70
|
+
return (
|
|
71
|
+
<View style={styles.root}>
|
|
72
|
+
<Animated.View pointerEvents={collapsed ? 'auto' : 'none'} style={calendarStyle}>
|
|
73
|
+
{calendar}
|
|
74
|
+
</Animated.View>
|
|
75
|
+
<Animated.View pointerEvents={collapsed ? 'none' : 'auto'} style={calendarEditStyle}>
|
|
76
|
+
{calendarEdit}
|
|
77
|
+
</Animated.View>
|
|
78
|
+
</View>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const styles = StyleSheet.create(theme => ({
|
|
83
|
+
root: { flex: 1 },
|
|
84
|
+
calendarEdit: {
|
|
85
|
+
position: 'absolute',
|
|
86
|
+
|
|
87
|
+
left: 0,
|
|
88
|
+
right: 0,
|
|
89
|
+
backgroundColor: theme.colors.surface,
|
|
90
|
+
},
|
|
91
|
+
calendar: {
|
|
92
|
+
flex: 1,
|
|
93
|
+
},
|
|
94
|
+
}));
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { memo, useCallback, useEffect, useRef } from 'react';
|
|
2
|
+
import { Keyboard, TextInput as TextInputNative, View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import type { ModeType, ValidRangeType } from '../DatePickerInline';
|
|
5
|
+
import DatePickerInputWithoutModal from '../DatePickerInput/DatePickerInputWithoutModal';
|
|
6
|
+
import type { LocalState, LocalStateRange, LocalStateSingle } from './types';
|
|
7
|
+
import { datePickerModalEditStyles } from './utils';
|
|
8
|
+
|
|
9
|
+
type Props = {
|
|
10
|
+
mode: ModeType;
|
|
11
|
+
label?: string;
|
|
12
|
+
startLabel?: string;
|
|
13
|
+
endLabel?: string;
|
|
14
|
+
state: LocalState;
|
|
15
|
+
collapsed: boolean;
|
|
16
|
+
onChange: (s: LocalState) => any;
|
|
17
|
+
validRange: ValidRangeType | undefined;
|
|
18
|
+
// locale: string;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
function CalendarEdit({
|
|
22
|
+
mode,
|
|
23
|
+
state,
|
|
24
|
+
label = '',
|
|
25
|
+
startLabel = 'Start',
|
|
26
|
+
endLabel = 'End',
|
|
27
|
+
collapsed,
|
|
28
|
+
onChange,
|
|
29
|
+
validRange,
|
|
30
|
+
}: // locale,
|
|
31
|
+
Props) {
|
|
32
|
+
const dateInput = useRef<TextInputNative | null>(null);
|
|
33
|
+
const startInput = useRef<TextInputNative | null>(null);
|
|
34
|
+
const endInput = useRef<TextInputNative | null>(null);
|
|
35
|
+
|
|
36
|
+
// when switching views focus, or un-focus text input
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
// hide open keyboard
|
|
39
|
+
if (collapsed) {
|
|
40
|
+
Keyboard.dismiss();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const inputsToFocus = [dateInput.current, startInput.current].filter(
|
|
44
|
+
n => n,
|
|
45
|
+
) as TextInputNative[];
|
|
46
|
+
|
|
47
|
+
const inputsToBlur = [dateInput.current, startInput.current, endInput.current].filter(
|
|
48
|
+
n => n,
|
|
49
|
+
) as TextInputNative[];
|
|
50
|
+
|
|
51
|
+
if (collapsed) {
|
|
52
|
+
inputsToBlur.forEach(ip => ip.blur());
|
|
53
|
+
} else {
|
|
54
|
+
inputsToFocus.forEach(ip => ip.focus());
|
|
55
|
+
}
|
|
56
|
+
}, [mode, startInput, endInput, dateInput, collapsed]);
|
|
57
|
+
|
|
58
|
+
const onSubmitStartInput = useCallback(() => {
|
|
59
|
+
if (endInput.current) {
|
|
60
|
+
endInput.current.focus();
|
|
61
|
+
}
|
|
62
|
+
}, [endInput]);
|
|
63
|
+
|
|
64
|
+
const onSubmitEndInput = useCallback(() => {
|
|
65
|
+
// TODO: close modal and persist range
|
|
66
|
+
}, []);
|
|
67
|
+
|
|
68
|
+
const onSubmitInput = useCallback(() => {
|
|
69
|
+
// TODO: close modal and persist range
|
|
70
|
+
}, []);
|
|
71
|
+
|
|
72
|
+
const onSingleInputChange = useCallback(
|
|
73
|
+
(date: Date | null) => onChange({ ...state, date }),
|
|
74
|
+
[onChange, state],
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
const onStartDateChange = useCallback(
|
|
78
|
+
(startDate: Date | null) => onChange({ ...state, startDate }),
|
|
79
|
+
[onChange, state],
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
const onEndDateChange = useCallback(
|
|
83
|
+
(endDate: Date | null) => onChange({ ...state, endDate }),
|
|
84
|
+
[onChange, state],
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<View style={datePickerModalEditStyles.container}>
|
|
89
|
+
<>
|
|
90
|
+
{mode === 'single' ? (
|
|
91
|
+
<DatePickerInputWithoutModal
|
|
92
|
+
inputMode="start"
|
|
93
|
+
ref={dateInput}
|
|
94
|
+
label={label}
|
|
95
|
+
value={(state as LocalStateSingle).date}
|
|
96
|
+
onChange={onSingleInputChange}
|
|
97
|
+
onSubmitEditing={onSubmitInput}
|
|
98
|
+
validRange={validRange}
|
|
99
|
+
// locale={locale}
|
|
100
|
+
autoComplete={'off'}
|
|
101
|
+
/>
|
|
102
|
+
) : null}
|
|
103
|
+
</>
|
|
104
|
+
|
|
105
|
+
<>
|
|
106
|
+
{mode === 'range' ? (
|
|
107
|
+
<View style={datePickerModalEditStyles.inner}>
|
|
108
|
+
<DatePickerInputWithoutModal
|
|
109
|
+
inputMode="start"
|
|
110
|
+
ref={startInput}
|
|
111
|
+
label={startLabel}
|
|
112
|
+
value={(state as LocalStateRange).startDate}
|
|
113
|
+
onChange={onStartDateChange}
|
|
114
|
+
returnKeyType={'next'}
|
|
115
|
+
onSubmitEditing={onSubmitStartInput}
|
|
116
|
+
validRange={validRange}
|
|
117
|
+
// locale={locale}
|
|
118
|
+
autoComplete={'off'}
|
|
119
|
+
/>
|
|
120
|
+
<View style={datePickerModalEditStyles.separator} />
|
|
121
|
+
<DatePickerInputWithoutModal
|
|
122
|
+
inputMode="end"
|
|
123
|
+
ref={endInput}
|
|
124
|
+
label={endLabel}
|
|
125
|
+
value={(state as LocalStateRange).endDate}
|
|
126
|
+
onChange={onEndDateChange}
|
|
127
|
+
onSubmitEditing={onSubmitEndInput}
|
|
128
|
+
validRange={validRange}
|
|
129
|
+
// locale={locale}
|
|
130
|
+
autoComplete="off"
|
|
131
|
+
/>
|
|
132
|
+
</View>
|
|
133
|
+
) : null}
|
|
134
|
+
</>
|
|
135
|
+
</View>
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export default memo(CalendarEdit);
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import color from 'color';
|
|
2
|
+
import { memo, useMemo } from 'react';
|
|
3
|
+
import {
|
|
4
|
+
Platform,
|
|
5
|
+
StatusBar,
|
|
6
|
+
type StatusBarStyle,
|
|
7
|
+
StyleSheet,
|
|
8
|
+
useWindowDimensions,
|
|
9
|
+
View,
|
|
10
|
+
} from 'react-native';
|
|
11
|
+
|
|
12
|
+
import { Modal } from '../Modal';
|
|
13
|
+
import { Portal } from '../Portal';
|
|
14
|
+
import { DatePickerModalContent } from './DatePickerModalContent';
|
|
15
|
+
import type { DatePickerModalProps } from './types';
|
|
16
|
+
import { datePickerModalStyles } from './utils';
|
|
17
|
+
|
|
18
|
+
export function DatePickerModal(props: DatePickerModalProps) {
|
|
19
|
+
const dimensions = useWindowDimensions();
|
|
20
|
+
|
|
21
|
+
const {
|
|
22
|
+
isOpen,
|
|
23
|
+
disableStatusBar,
|
|
24
|
+
disableStatusBarPadding,
|
|
25
|
+
mode = 'single',
|
|
26
|
+
style: styleProp,
|
|
27
|
+
...rest
|
|
28
|
+
} = props;
|
|
29
|
+
|
|
30
|
+
const { containerStyle, headerStyle, barStyle, modalContentStyle } = useMemo(() => {
|
|
31
|
+
let isHeaderBackgroundLight = true;
|
|
32
|
+
try {
|
|
33
|
+
isHeaderBackgroundLight = color(
|
|
34
|
+
datePickerModalStyles.header?.backgroundColor,
|
|
35
|
+
).isLight();
|
|
36
|
+
} catch (e) {}
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
containerStyle: [StyleSheet.absoluteFill, styleProp],
|
|
40
|
+
headerStyle: [
|
|
41
|
+
datePickerModalStyles.header,
|
|
42
|
+
{
|
|
43
|
+
height: Platform.OS === 'android' ? StatusBar.currentHeight : 0, // on IOS StatusBar.currentHeight isn't available
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
barStyle: (isHeaderBackgroundLight
|
|
47
|
+
? 'dark-content'
|
|
48
|
+
: 'light-content') as StatusBarStyle,
|
|
49
|
+
modalContentStyle:
|
|
50
|
+
dimensions.width > 650
|
|
51
|
+
? { flex: 1, maxHeight: 600 }
|
|
52
|
+
: { flex: 1, maxWidth: undefined, borderRadius: 0 },
|
|
53
|
+
};
|
|
54
|
+
}, [dimensions.width, styleProp]);
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<View style={containerStyle} pointerEvents="box-none">
|
|
58
|
+
<Portal>
|
|
59
|
+
<Modal
|
|
60
|
+
isOpen={isOpen}
|
|
61
|
+
onClose={rest.onClose}
|
|
62
|
+
style={modalContentStyle}
|
|
63
|
+
elevation={0}>
|
|
64
|
+
<>
|
|
65
|
+
<>
|
|
66
|
+
{disableStatusBar ? null : (
|
|
67
|
+
<StatusBar translucent={true} barStyle={barStyle} />
|
|
68
|
+
)}
|
|
69
|
+
</>
|
|
70
|
+
|
|
71
|
+
<>{disableStatusBarPadding ? null : <View style={headerStyle} />}</>
|
|
72
|
+
|
|
73
|
+
<DatePickerModalContent
|
|
74
|
+
{...rest}
|
|
75
|
+
mode={mode as any}
|
|
76
|
+
disableSafeTop={disableStatusBar}
|
|
77
|
+
/>
|
|
78
|
+
</>
|
|
79
|
+
</Modal>
|
|
80
|
+
</Portal>
|
|
81
|
+
</View>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export default memo(DatePickerModal);
|