react-native-paper-dates 0.22.15 → 0.22.16
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/Date/AnimatedCrossView.js +41 -42
- package/lib/commonjs/Date/AnimatedCrossView.js.map +1 -1
- package/lib/commonjs/Date/AutoSizer.js +10 -14
- package/lib/commonjs/Date/AutoSizer.js.map +1 -1
- package/lib/commonjs/Date/Calendar.js +69 -76
- package/lib/commonjs/Date/Calendar.js.map +1 -1
- package/lib/commonjs/Date/CalendarEdit.js +67 -72
- package/lib/commonjs/Date/CalendarEdit.js.map +1 -1
- package/lib/commonjs/Date/CalendarHeader.js +38 -36
- package/lib/commonjs/Date/CalendarHeader.js.map +1 -1
- package/lib/commonjs/Date/DatePickerInput.js +15 -15
- package/lib/commonjs/Date/DatePickerInput.js.map +1 -1
- package/lib/commonjs/Date/DatePickerInputWithoutModal.js +49 -43
- package/lib/commonjs/Date/DatePickerInputWithoutModal.js.map +1 -1
- package/lib/commonjs/Date/DatePickerModal.js +49 -45
- package/lib/commonjs/Date/DatePickerModal.js.map +1 -1
- package/lib/commonjs/Date/DatePickerModalContent.js +73 -68
- package/lib/commonjs/Date/DatePickerModalContent.js.map +1 -1
- package/lib/commonjs/Date/DatePickerModalContentHeader.js +86 -101
- package/lib/commonjs/Date/DatePickerModalContentHeader.js.map +1 -1
- package/lib/commonjs/Date/DatePickerModalHeader.js +32 -63
- package/lib/commonjs/Date/DatePickerModalHeader.js.map +1 -1
- package/lib/commonjs/Date/DatePickerModalHeaderBackground.js +8 -7
- package/lib/commonjs/Date/DatePickerModalHeaderBackground.js.map +1 -1
- package/lib/commonjs/Date/DatePickerModalStatusBar.js +16 -13
- package/lib/commonjs/Date/DatePickerModalStatusBar.js.map +1 -1
- package/lib/commonjs/Date/Day.js +57 -57
- package/lib/commonjs/Date/Day.js.map +1 -1
- package/lib/commonjs/Date/DayName.js +17 -14
- package/lib/commonjs/Date/DayName.js.map +1 -1
- package/lib/commonjs/Date/DayNames.js +14 -13
- package/lib/commonjs/Date/DayNames.js.map +1 -1
- package/lib/commonjs/Date/DayRange.js +25 -26
- package/lib/commonjs/Date/DayRange.js.map +1 -1
- package/lib/commonjs/Date/Month.js +74 -76
- package/lib/commonjs/Date/Month.js.map +1 -1
- package/lib/commonjs/Date/Swiper.js +67 -64
- package/lib/commonjs/Date/Swiper.js.map +1 -1
- package/lib/commonjs/Date/Swiper.native.js +67 -63
- package/lib/commonjs/Date/Swiper.native.js.map +1 -1
- package/lib/commonjs/Date/SwiperUtils.js +3 -5
- package/lib/commonjs/Date/SwiperUtils.js.map +1 -1
- package/lib/commonjs/Date/YearPicker.js +58 -58
- package/lib/commonjs/Date/YearPicker.js.map +1 -1
- package/lib/commonjs/Date/dateUtils.js +12 -10
- package/lib/commonjs/Date/dateUtils.js.map +1 -1
- package/lib/commonjs/Date/inputUtils.js +8 -10
- package/lib/commonjs/Date/inputUtils.js.map +1 -1
- package/lib/commonjs/TextInputMask.js +11 -11
- package/lib/commonjs/TextInputMask.js.map +1 -1
- package/lib/commonjs/Time/AmPmSwitcher.js +51 -49
- package/lib/commonjs/Time/AmPmSwitcher.js.map +1 -1
- package/lib/commonjs/Time/AnalogClock.js +69 -64
- package/lib/commonjs/Time/AnalogClock.js.map +1 -1
- package/lib/commonjs/Time/AnalogClockHours.js +46 -53
- package/lib/commonjs/Time/AnalogClockHours.js.map +1 -1
- package/lib/commonjs/Time/AnalogClockMinutes.js +45 -60
- package/lib/commonjs/Time/AnalogClockMinutes.js.map +1 -1
- package/lib/commonjs/Time/AnimatedClockSwitcher.js +34 -30
- package/lib/commonjs/Time/AnimatedClockSwitcher.js.map +1 -1
- package/lib/commonjs/Time/TimeInput.js +55 -54
- package/lib/commonjs/Time/TimeInput.js.map +1 -1
- package/lib/commonjs/Time/TimeInputs.js +118 -114
- package/lib/commonjs/Time/TimeInputs.js.map +1 -1
- package/lib/commonjs/Time/TimePicker.js +40 -36
- package/lib/commonjs/Time/TimePicker.js.map +1 -1
- package/lib/commonjs/Time/TimePickerModal.js +118 -114
- package/lib/commonjs/Time/TimePickerModal.js.map +1 -1
- package/lib/commonjs/Time/timeUtils.js +5 -8
- package/lib/commonjs/Time/timeUtils.js.map +1 -1
- package/lib/commonjs/contexts/DisplayModeContext.js +2 -4
- package/lib/commonjs/contexts/DisplayModeContext.js.map +1 -1
- package/lib/commonjs/shared/styles.js +25 -0
- package/lib/commonjs/shared/styles.js.map +1 -0
- package/lib/commonjs/{utils.js → shared/utils.js} +4 -4
- package/lib/commonjs/shared/utils.js.map +1 -0
- package/lib/module/Date/AnimatedCrossView.js +43 -42
- package/lib/module/Date/AnimatedCrossView.js.map +1 -1
- package/lib/module/Date/AutoSizer.js +12 -15
- package/lib/module/Date/AutoSizer.js.map +1 -1
- package/lib/module/Date/Calendar.js +71 -76
- package/lib/module/Date/Calendar.js.map +1 -1
- package/lib/module/Date/CalendarEdit.js +68 -71
- package/lib/module/Date/CalendarEdit.js.map +1 -1
- package/lib/module/Date/CalendarHeader.js +39 -36
- package/lib/module/Date/CalendarHeader.js.map +1 -1
- package/lib/module/Date/DatePickerInput.js +15 -14
- package/lib/module/Date/DatePickerInput.js.map +1 -1
- package/lib/module/Date/DatePickerInputWithoutModal.js +50 -42
- package/lib/module/Date/DatePickerInputWithoutModal.js.map +1 -1
- package/lib/module/Date/DatePickerModal.js +49 -44
- package/lib/module/Date/DatePickerModal.js.map +1 -1
- package/lib/module/Date/DatePickerModalContent.js +74 -67
- package/lib/module/Date/DatePickerModalContent.js.map +1 -1
- package/lib/module/Date/DatePickerModalContentHeader.js +87 -100
- package/lib/module/Date/DatePickerModalContentHeader.js.map +1 -1
- package/lib/module/Date/DatePickerModalHeader.js +33 -61
- package/lib/module/Date/DatePickerModalHeader.js.map +1 -1
- package/lib/module/Date/DatePickerModalHeaderBackground.js +7 -5
- package/lib/module/Date/DatePickerModalHeaderBackground.js.map +1 -1
- package/lib/module/Date/DatePickerModalStatusBar.js +18 -13
- package/lib/module/Date/DatePickerModalStatusBar.js.map +1 -1
- package/lib/module/Date/Day.js +58 -56
- package/lib/module/Date/Day.js.map +1 -1
- package/lib/module/Date/DayName.js +17 -14
- package/lib/module/Date/DayName.js.map +1 -1
- package/lib/module/Date/DayNames.js +13 -12
- package/lib/module/Date/DayNames.js.map +1 -1
- package/lib/module/Date/DayRange.js +27 -26
- package/lib/module/Date/DayRange.js.map +1 -1
- package/lib/module/Date/Month.js +76 -76
- package/lib/module/Date/Month.js.map +1 -1
- package/lib/module/Date/Swiper.js +69 -64
- package/lib/module/Date/Swiper.js.map +1 -1
- package/lib/module/Date/Swiper.native.js +69 -62
- package/lib/module/Date/Swiper.native.js.map +1 -1
- package/lib/module/Date/SwiperUtils.js +3 -3
- package/lib/module/Date/SwiperUtils.js.map +1 -1
- package/lib/module/Date/YearPicker.js +59 -58
- package/lib/module/Date/YearPicker.js.map +1 -1
- package/lib/module/Date/dateUtils.js +12 -8
- package/lib/module/Date/dateUtils.js.map +1 -1
- package/lib/module/Date/inputUtils.js +8 -8
- package/lib/module/Date/inputUtils.js.map +1 -1
- package/lib/module/TextInputMask.js +12 -11
- package/lib/module/TextInputMask.js.map +1 -1
- package/lib/module/Time/AmPmSwitcher.js +53 -49
- package/lib/module/Time/AmPmSwitcher.js.map +1 -1
- package/lib/module/Time/AnalogClock.js +71 -64
- package/lib/module/Time/AnalogClock.js.map +1 -1
- package/lib/module/Time/AnalogClockHours.js +48 -53
- package/lib/module/Time/AnalogClockHours.js.map +1 -1
- package/lib/module/Time/AnalogClockMinutes.js +46 -60
- package/lib/module/Time/AnalogClockMinutes.js.map +1 -1
- package/lib/module/Time/AnimatedClockSwitcher.js +35 -30
- package/lib/module/Time/AnimatedClockSwitcher.js.map +1 -1
- package/lib/module/Time/TimeInput.js +56 -53
- package/lib/module/Time/TimeInput.js.map +1 -1
- package/lib/module/Time/TimeInputs.js +120 -113
- package/lib/module/Time/TimeInputs.js.map +1 -1
- package/lib/module/Time/TimePicker.js +42 -36
- package/lib/module/Time/TimePicker.js.map +1 -1
- package/lib/module/Time/TimePickerModal.js +118 -112
- package/lib/module/Time/TimePickerModal.js.map +1 -1
- package/lib/module/Time/timeUtils.js +5 -6
- package/lib/module/Time/timeUtils.js.map +1 -1
- package/lib/module/contexts/DisplayModeContext.js +2 -2
- package/lib/module/contexts/DisplayModeContext.js.map +1 -1
- package/lib/module/shared/styles.js +19 -0
- package/lib/module/shared/styles.js.map +1 -0
- package/lib/module/{utils.js → shared/utils.js} +3 -2
- package/lib/module/shared/utils.js.map +1 -0
- package/lib/typescript/Date/AnimatedCrossView.d.ts +1 -1
- package/lib/typescript/Date/AnimatedCrossView.d.ts.map +1 -1
- package/lib/typescript/Date/AutoSizer.d.ts +1 -1
- package/lib/typescript/Date/AutoSizer.d.ts.map +1 -1
- package/lib/typescript/Date/Calendar.d.ts +1 -1
- package/lib/typescript/Date/Calendar.d.ts.map +1 -1
- package/lib/typescript/Date/CalendarEdit.d.ts +1 -1
- package/lib/typescript/Date/CalendarEdit.d.ts.map +1 -1
- package/lib/typescript/Date/CalendarHeader.d.ts +1 -1
- package/lib/typescript/Date/CalendarHeader.d.ts.map +1 -1
- package/lib/typescript/Date/DatePickerInput.d.ts +1 -1
- package/lib/typescript/Date/DatePickerInput.d.ts.map +1 -1
- package/lib/typescript/Date/DatePickerInput.shared.d.ts +3 -3
- package/lib/typescript/Date/DatePickerInput.shared.d.ts.map +1 -1
- package/lib/typescript/Date/DatePickerInputWithoutModal.d.ts +59 -58
- package/lib/typescript/Date/DatePickerInputWithoutModal.d.ts.map +1 -1
- package/lib/typescript/Date/DatePickerModal.d.ts +1 -1
- package/lib/typescript/Date/DatePickerModal.d.ts.map +1 -1
- package/lib/typescript/Date/DatePickerModalContent.d.ts +1 -1
- package/lib/typescript/Date/DatePickerModalContent.d.ts.map +1 -1
- package/lib/typescript/Date/DatePickerModalContentHeader.d.ts +1 -1
- package/lib/typescript/Date/DatePickerModalContentHeader.d.ts.map +1 -1
- package/lib/typescript/Date/DatePickerModalHeader.d.ts +1 -1
- package/lib/typescript/Date/DatePickerModalHeader.d.ts.map +1 -1
- package/lib/typescript/Date/DatePickerModalHeaderBackground.d.ts +1 -1
- package/lib/typescript/Date/DatePickerModalHeaderBackground.d.ts.map +1 -1
- package/lib/typescript/Date/DatePickerModalStatusBar.d.ts +1 -1
- package/lib/typescript/Date/DatePickerModalStatusBar.d.ts.map +1 -1
- package/lib/typescript/Date/Day.d.ts +2 -2
- package/lib/typescript/Date/Day.d.ts.map +1 -1
- package/lib/typescript/Date/DayName.d.ts +1 -1
- package/lib/typescript/Date/DayName.d.ts.map +1 -1
- package/lib/typescript/Date/DayNames.d.ts +1 -1
- package/lib/typescript/Date/DayNames.d.ts.map +1 -1
- package/lib/typescript/Date/DayRange.d.ts +1 -1
- package/lib/typescript/Date/DayRange.d.ts.map +1 -1
- package/lib/typescript/Date/Month.d.ts +1 -1
- package/lib/typescript/Date/Month.d.ts.map +1 -1
- package/lib/typescript/Date/Swiper.d.ts +1 -1
- package/lib/typescript/Date/Swiper.d.ts.map +1 -1
- package/lib/typescript/Date/Swiper.native.d.ts +1 -1
- package/lib/typescript/Date/Swiper.native.d.ts.map +1 -1
- package/lib/typescript/Date/SwiperUtils.d.ts +1 -1
- package/lib/typescript/Date/SwiperUtils.d.ts.map +1 -1
- package/lib/typescript/Date/YearPicker.d.ts +1 -1
- package/lib/typescript/Date/YearPicker.d.ts.map +1 -1
- package/lib/typescript/Date/dateUtils.d.ts.map +1 -1
- package/lib/typescript/Date/inputUtils.d.ts.map +1 -1
- package/lib/typescript/TextInputMask.d.ts +24 -24
- package/lib/typescript/TextInputMask.d.ts.map +1 -1
- package/lib/typescript/Time/AmPmSwitcher.d.ts +1 -1
- package/lib/typescript/Time/AmPmSwitcher.d.ts.map +1 -1
- package/lib/typescript/Time/AnalogClock.d.ts +1 -1
- package/lib/typescript/Time/AnalogClock.d.ts.map +1 -1
- package/lib/typescript/Time/AnalogClockHours.d.ts +1 -1
- package/lib/typescript/Time/AnalogClockHours.d.ts.map +1 -1
- package/lib/typescript/Time/AnalogClockMinutes.d.ts +1 -1
- package/lib/typescript/Time/AnalogClockMinutes.d.ts.map +1 -1
- package/lib/typescript/Time/AnimatedClockSwitcher.d.ts +5 -3
- package/lib/typescript/Time/AnimatedClockSwitcher.d.ts.map +1 -1
- package/lib/typescript/Time/TimeInput.d.ts +1 -1
- package/lib/typescript/Time/TimeInput.d.ts.map +1 -1
- package/lib/typescript/Time/TimeInputs.d.ts +1 -1
- package/lib/typescript/Time/TimeInputs.d.ts.map +1 -1
- package/lib/typescript/Time/TimePicker.d.ts +1 -1
- package/lib/typescript/Time/TimePicker.d.ts.map +1 -1
- package/lib/typescript/Time/TimePickerModal.d.ts +1 -1
- package/lib/typescript/Time/TimePickerModal.d.ts.map +1 -1
- package/lib/typescript/Time/timeUtils.d.ts.map +1 -1
- package/lib/typescript/contexts/DisplayModeContext.d.ts +4 -4
- package/lib/typescript/contexts/DisplayModeContext.d.ts.map +1 -1
- package/lib/typescript/shared/styles.d.ts +18 -0
- package/lib/typescript/shared/styles.d.ts.map +1 -0
- package/lib/typescript/{utils.d.ts → shared/utils.d.ts} +2 -2
- package/lib/typescript/shared/utils.d.ts.map +1 -0
- package/package.json +17 -17
- package/src/Date/AnimatedCrossView.tsx +9 -10
- package/src/Date/AutoSizer.tsx +12 -13
- package/src/Date/Calendar.tsx +29 -35
- package/src/Date/CalendarEdit.tsx +18 -15
- package/src/Date/CalendarHeader.tsx +9 -18
- package/src/Date/DatePickerInput.shared.tsx +3 -3
- package/src/Date/DatePickerInput.tsx +11 -8
- package/src/Date/DatePickerInputWithoutModal.tsx +3 -4
- package/src/Date/DatePickerModal.tsx +14 -23
- package/src/Date/DatePickerModalContent.tsx +10 -13
- package/src/Date/DatePickerModalContentHeader.tsx +31 -43
- package/src/Date/DatePickerModalHeader.tsx +4 -23
- package/src/Date/DatePickerModalHeaderBackground.tsx +3 -2
- package/src/Date/DatePickerModalStatusBar.tsx +4 -4
- package/src/Date/Day.tsx +22 -24
- package/src/Date/DayName.tsx +12 -4
- package/src/Date/DayNames.tsx +7 -6
- package/src/Date/DayRange.tsx +6 -11
- package/src/Date/Month.tsx +24 -21
- package/src/Date/Swiper.native.tsx +19 -20
- package/src/Date/Swiper.tsx +32 -29
- package/src/Date/SwiperUtils.ts +3 -4
- package/src/Date/YearPicker.tsx +11 -16
- package/src/Date/dateUtils.tsx +15 -8
- package/src/Date/inputUtils.ts +7 -5
- package/src/TextInputMask.tsx +10 -11
- package/src/Time/AmPmSwitcher.tsx +9 -7
- package/src/Time/AnalogClock.tsx +38 -24
- package/src/Time/AnalogClockHours.tsx +10 -20
- package/src/Time/AnalogClockMinutes.tsx +19 -32
- package/src/Time/AnimatedClockSwitcher.tsx +9 -5
- package/src/Time/TimeInput.tsx +22 -19
- package/src/Time/TimeInputs.tsx +28 -34
- package/src/Time/TimePicker.tsx +15 -10
- package/src/Time/TimePickerModal.tsx +48 -72
- package/src/Time/timeUtils.ts +5 -6
- package/src/contexts/DisplayModeContext.tsx +3 -3
- package/src/shared/styles.tsx +19 -0
- package/src/{utils.ts → shared/utils.ts} +16 -2
- package/lib/commonjs/Date/Week.js +0 -10
- package/lib/commonjs/Date/Week.js.map +0 -1
- package/lib/commonjs/utils.js.map +0 -1
- package/lib/module/Date/Week.js +0 -4
- package/lib/module/Date/Week.js.map +0 -1
- package/lib/module/utils.js.map +0 -1
- package/lib/typescript/Date/Week.d.ts +0 -2
- package/lib/typescript/Date/Week.d.ts.map +0 -1
- package/lib/typescript/utils.d.ts.map +0 -1
- package/src/Date/Week.tsx +0 -3
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as React from 'react'
|
|
2
1
|
import {
|
|
3
2
|
Modal,
|
|
4
3
|
StyleSheet,
|
|
@@ -13,6 +12,9 @@ import DatePickerModalContent, {
|
|
|
13
12
|
DatePickerModalContentRangeProps,
|
|
14
13
|
DatePickerModalContentSingleProps,
|
|
15
14
|
} from './DatePickerModalContent'
|
|
15
|
+
import React, { memo } from 'react'
|
|
16
|
+
import { sharedStyles } from '../shared/styles'
|
|
17
|
+
import { supportedOrientations } from '../shared/utils'
|
|
16
18
|
|
|
17
19
|
interface DatePickerModalProps {
|
|
18
20
|
visible: boolean
|
|
@@ -41,8 +43,6 @@ export function DatePickerModal(
|
|
|
41
43
|
| DatePickerModalSingleProps
|
|
42
44
|
| DatePickerModalMultiProps
|
|
43
45
|
) {
|
|
44
|
-
const theme = useTheme()
|
|
45
|
-
const dimensions = useWindowDimensions()
|
|
46
46
|
const {
|
|
47
47
|
visible,
|
|
48
48
|
animationType,
|
|
@@ -59,11 +59,13 @@ export function DatePickerModal(
|
|
|
59
59
|
web: 'none',
|
|
60
60
|
default: 'slide',
|
|
61
61
|
})
|
|
62
|
-
|
|
63
62
|
const isPageSheet = presentationStyle === 'pageSheet' && Platform.OS === 'ios'
|
|
64
63
|
|
|
64
|
+
const theme = useTheme()
|
|
65
|
+
const dimensions = useWindowDimensions()
|
|
66
|
+
|
|
65
67
|
return (
|
|
66
|
-
<View style={
|
|
68
|
+
<View style={StyleSheet.absoluteFill} pointerEvents="box-none">
|
|
67
69
|
<Modal
|
|
68
70
|
animationType={animationTypeCalculated}
|
|
69
71
|
transparent={!isPageSheet}
|
|
@@ -77,7 +79,7 @@ export function DatePickerModal(
|
|
|
77
79
|
<View
|
|
78
80
|
style={[
|
|
79
81
|
StyleSheet.absoluteFill,
|
|
80
|
-
|
|
82
|
+
sharedStyles.root,
|
|
81
83
|
{ backgroundColor: theme.colors.backdrop },
|
|
82
84
|
]}
|
|
83
85
|
/>
|
|
@@ -107,23 +109,7 @@ export function DatePickerModal(
|
|
|
107
109
|
)
|
|
108
110
|
}
|
|
109
111
|
|
|
110
|
-
const supportedOrientations: any = [
|
|
111
|
-
'portrait',
|
|
112
|
-
'portrait-upside-down',
|
|
113
|
-
'landscape',
|
|
114
|
-
'landscape-left',
|
|
115
|
-
'landscape-right',
|
|
116
|
-
]
|
|
117
|
-
|
|
118
112
|
const styles = StyleSheet.create({
|
|
119
|
-
modalRoot: {
|
|
120
|
-
justifyContent: 'center',
|
|
121
|
-
alignItems: 'center',
|
|
122
|
-
flex: 1,
|
|
123
|
-
},
|
|
124
|
-
modalBackground: {
|
|
125
|
-
flex: 1,
|
|
126
|
-
},
|
|
127
113
|
modalContent: {
|
|
128
114
|
flex: 1,
|
|
129
115
|
width: '100%',
|
|
@@ -135,6 +121,11 @@ const styles = StyleSheet.create({
|
|
|
135
121
|
width: '100%',
|
|
136
122
|
overflow: 'hidden',
|
|
137
123
|
},
|
|
124
|
+
modalRoot: {
|
|
125
|
+
justifyContent: 'center',
|
|
126
|
+
alignItems: 'center',
|
|
127
|
+
flex: 1,
|
|
128
|
+
},
|
|
138
129
|
})
|
|
139
130
|
|
|
140
|
-
export default
|
|
131
|
+
export default memo(DatePickerModal)
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import * as React from 'react'
|
|
2
|
-
|
|
3
1
|
import Calendar, {
|
|
4
2
|
BaseCalendarProps,
|
|
5
3
|
CalendarDate,
|
|
@@ -19,6 +17,7 @@ import CalendarEdit from './CalendarEdit'
|
|
|
19
17
|
import DatePickerModalHeaderBackground from './DatePickerModalHeaderBackground'
|
|
20
18
|
import { useTheme } from 'react-native-paper'
|
|
21
19
|
import DatePickerModalStatusBar from './DatePickerModalStatusBar'
|
|
20
|
+
import React, { memo, useCallback, useEffect, useState } from 'react'
|
|
22
21
|
|
|
23
22
|
export type LocalState = {
|
|
24
23
|
startDate: CalendarDate
|
|
@@ -95,18 +94,21 @@ export function DatePickerModalContent(
|
|
|
95
94
|
statusBarOnTopOfBackdrop,
|
|
96
95
|
startWeekOnMonday,
|
|
97
96
|
} = props
|
|
97
|
+
const theme = useTheme()
|
|
98
98
|
const anyProps = props as any
|
|
99
|
+
const defaultUppercase = !theme.isV3
|
|
99
100
|
|
|
100
101
|
// use local state to add only onConfirm state changes
|
|
101
|
-
const [state, setState] =
|
|
102
|
+
const [state, setState] = useState<LocalState>({
|
|
102
103
|
date: anyProps.date,
|
|
103
104
|
startDate: anyProps.startDate,
|
|
104
105
|
endDate: anyProps.endDate,
|
|
105
106
|
dates: anyProps.dates,
|
|
106
107
|
})
|
|
108
|
+
const [collapsed, setCollapsed] = useState(true)
|
|
107
109
|
|
|
108
110
|
// update local state if changed from outside or if modal is opened
|
|
109
|
-
|
|
111
|
+
useEffect(() => {
|
|
110
112
|
setState({
|
|
111
113
|
date: anyProps.date,
|
|
112
114
|
startDate: anyProps.startDate,
|
|
@@ -115,9 +117,7 @@ export function DatePickerModalContent(
|
|
|
115
117
|
})
|
|
116
118
|
}, [anyProps.date, anyProps.startDate, anyProps.endDate, anyProps.dates])
|
|
117
119
|
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
const onInnerChange = React.useCallback(
|
|
120
|
+
const onInnerChange = useCallback(
|
|
121
121
|
(params: any) => {
|
|
122
122
|
onChange && onChange(params)
|
|
123
123
|
setState((prev) => ({ ...prev, ...params }))
|
|
@@ -125,7 +125,7 @@ export function DatePickerModalContent(
|
|
|
125
125
|
[onChange, setState]
|
|
126
126
|
)
|
|
127
127
|
|
|
128
|
-
const onInnerConfirm =
|
|
128
|
+
const onInnerConfirm = useCallback(() => {
|
|
129
129
|
if (mode === 'single') {
|
|
130
130
|
;(onConfirm as DatePickerModalContentSingleProps['onConfirm'])({
|
|
131
131
|
date: state.date,
|
|
@@ -142,13 +142,10 @@ export function DatePickerModalContent(
|
|
|
142
142
|
}
|
|
143
143
|
}, [state, mode, onConfirm])
|
|
144
144
|
|
|
145
|
-
const onToggleCollapse =
|
|
145
|
+
const onToggleCollapse = useCallback(() => {
|
|
146
146
|
setCollapsed((prev) => !prev)
|
|
147
147
|
}, [setCollapsed])
|
|
148
148
|
|
|
149
|
-
const theme = useTheme()
|
|
150
|
-
const defaultUppercase = !theme.isV3
|
|
151
|
-
|
|
152
149
|
return (
|
|
153
150
|
<>
|
|
154
151
|
<DatePickerModalHeaderBackground>
|
|
@@ -222,4 +219,4 @@ export function DatePickerModalContent(
|
|
|
222
219
|
)
|
|
223
220
|
}
|
|
224
221
|
|
|
225
|
-
export default
|
|
222
|
+
export default memo(DatePickerModalContent)
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import * as React from 'react'
|
|
2
1
|
import { View, StyleSheet } from 'react-native'
|
|
3
2
|
import { IconButton, MD2Theme, Text, useTheme } from 'react-native-paper'
|
|
4
3
|
import type { ModeType } from './Calendar'
|
|
5
4
|
import type { LocalState } from './DatePickerModalContent'
|
|
6
|
-
import { useHeaderTextColor } from '../utils'
|
|
5
|
+
import { useHeaderTextColor } from '../shared/utils'
|
|
7
6
|
import Color from 'color'
|
|
8
7
|
import { getTranslation } from '../translations/utils'
|
|
8
|
+
import React, { useMemo } from 'react'
|
|
9
|
+
import { sharedStyles } from '../shared/styles'
|
|
9
10
|
|
|
10
11
|
export interface HeaderPickProps {
|
|
11
12
|
moreLabel?: string
|
|
@@ -65,21 +66,17 @@ export default function DatePickerModalContentHeader(
|
|
|
65
66
|
} = props
|
|
66
67
|
const theme = useTheme()
|
|
67
68
|
const label = getLabel(props.locale, props.mode, props.label)
|
|
68
|
-
|
|
69
69
|
const color = useHeaderTextColor()
|
|
70
|
-
|
|
71
70
|
const isEditingEnabled = allowEditing && mode !== 'multiple'
|
|
72
|
-
|
|
73
71
|
const supportingTextColor = theme.isV3 ? theme.colors.onSurfaceVariant : color
|
|
74
|
-
|
|
75
72
|
const textFont = theme?.isV3
|
|
76
73
|
? theme.fonts.labelMedium
|
|
77
74
|
: (theme as any as MD2Theme).fonts.medium
|
|
78
|
-
|
|
79
75
|
const collapsedIcon = theme.isV3 ? 'pencil-outline' : 'pencil'
|
|
80
76
|
const expandedIcon = theme.isV3 ? 'calendar-blank' : 'calendar'
|
|
81
77
|
const finalCollapsedIcon = editIcon ?? collapsedIcon
|
|
82
78
|
const finalExpandedIcon = calendarIcon ?? expandedIcon
|
|
79
|
+
|
|
83
80
|
return (
|
|
84
81
|
<View style={styles.header}>
|
|
85
82
|
<View>
|
|
@@ -105,7 +102,7 @@ export default function DatePickerModalContentHeader(
|
|
|
105
102
|
) : null}
|
|
106
103
|
</View>
|
|
107
104
|
</View>
|
|
108
|
-
<View style={
|
|
105
|
+
<View style={sharedStyles.root} />
|
|
109
106
|
{isEditingEnabled ? (
|
|
110
107
|
<IconButton
|
|
111
108
|
icon={collapsed ? finalCollapsedIcon : finalExpandedIcon}
|
|
@@ -129,6 +126,7 @@ export function HeaderContentSingle({
|
|
|
129
126
|
locale,
|
|
130
127
|
}: HeaderContentProps & { color: string }) {
|
|
131
128
|
const theme = useTheme()
|
|
129
|
+
|
|
132
130
|
const lighterColor = Color(color).fade(0.5).rgb().toString()
|
|
133
131
|
const dateColor = state.date
|
|
134
132
|
? theme.isV3
|
|
@@ -136,7 +134,7 @@ export function HeaderContentSingle({
|
|
|
136
134
|
: color
|
|
137
135
|
: lighterColor
|
|
138
136
|
|
|
139
|
-
const formatter =
|
|
137
|
+
const formatter = useMemo(() => {
|
|
140
138
|
return new Intl.DateTimeFormat(locale, {
|
|
141
139
|
month: 'short',
|
|
142
140
|
day: 'numeric',
|
|
@@ -146,7 +144,7 @@ export function HeaderContentSingle({
|
|
|
146
144
|
return (
|
|
147
145
|
<Text
|
|
148
146
|
maxFontSizeMultiplier={1.5}
|
|
149
|
-
style={[styles.
|
|
147
|
+
style={[styles.text, { color: dateColor }]}
|
|
150
148
|
>
|
|
151
149
|
{state.date ? formatter.format(state.date) : emptyLabel}
|
|
152
150
|
</Text>
|
|
@@ -161,6 +159,7 @@ export function HeaderContentMulti({
|
|
|
161
159
|
locale,
|
|
162
160
|
}: HeaderContentProps & { color: string; moreLabel: string | undefined }) {
|
|
163
161
|
const theme = useTheme()
|
|
162
|
+
|
|
164
163
|
const dateCount = state.dates?.length || 0
|
|
165
164
|
const lighterColor = Color(color).fade(0.5).rgb().toString()
|
|
166
165
|
const dateColor = dateCount
|
|
@@ -169,7 +168,7 @@ export function HeaderContentMulti({
|
|
|
169
168
|
: color
|
|
170
169
|
: lighterColor
|
|
171
170
|
|
|
172
|
-
const formatter =
|
|
171
|
+
const formatter = useMemo(() => {
|
|
173
172
|
return new Intl.DateTimeFormat(locale, {
|
|
174
173
|
month: 'short',
|
|
175
174
|
day: 'numeric',
|
|
@@ -189,7 +188,7 @@ export function HeaderContentMulti({
|
|
|
189
188
|
return (
|
|
190
189
|
<Text
|
|
191
190
|
maxFontSizeMultiplier={1.5}
|
|
192
|
-
style={[styles.
|
|
191
|
+
style={[styles.text, { color: dateColor }]}
|
|
193
192
|
>
|
|
194
193
|
{label}
|
|
195
194
|
</Text>
|
|
@@ -205,12 +204,6 @@ export function HeaderContentRange({
|
|
|
205
204
|
color,
|
|
206
205
|
}: HeaderContentProps & { color: string }) {
|
|
207
206
|
const theme = useTheme()
|
|
208
|
-
const formatter = React.useMemo(() => {
|
|
209
|
-
return new Intl.DateTimeFormat(locale, {
|
|
210
|
-
month: 'short',
|
|
211
|
-
day: 'numeric',
|
|
212
|
-
})
|
|
213
|
-
}, [locale])
|
|
214
207
|
|
|
215
208
|
const lighterColor = Color(color).fade(0.5).rgb().toString()
|
|
216
209
|
const startColorFilled = theme.isV3 ? theme.colors.onSurface : color
|
|
@@ -218,11 +211,18 @@ export function HeaderContentRange({
|
|
|
218
211
|
const startColor = state.startDate ? startColorFilled : lighterColor
|
|
219
212
|
const endColor = state.endDate ? endColorFilled : lighterColor
|
|
220
213
|
|
|
214
|
+
const formatter = useMemo(() => {
|
|
215
|
+
return new Intl.DateTimeFormat(locale, {
|
|
216
|
+
month: 'short',
|
|
217
|
+
day: 'numeric',
|
|
218
|
+
})
|
|
219
|
+
}, [locale])
|
|
220
|
+
|
|
221
221
|
return (
|
|
222
222
|
<>
|
|
223
223
|
<Text
|
|
224
224
|
maxFontSizeMultiplier={1.5}
|
|
225
|
-
style={[styles.
|
|
225
|
+
style={[styles.text, { color: startColor }]}
|
|
226
226
|
>
|
|
227
227
|
{state.startDate ? formatter.format(state.startDate) : startLabel}
|
|
228
228
|
</Text>
|
|
@@ -234,7 +234,7 @@ export function HeaderContentRange({
|
|
|
234
234
|
</Text>
|
|
235
235
|
<Text
|
|
236
236
|
maxFontSizeMultiplier={1.5}
|
|
237
|
-
style={[styles.
|
|
237
|
+
style={[styles.text, { color: endColor }]}
|
|
238
238
|
>
|
|
239
239
|
{state.endDate ? formatter.format(state.endDate) : endLabel}
|
|
240
240
|
</Text>
|
|
@@ -243,16 +243,6 @@ export function HeaderContentRange({
|
|
|
243
243
|
}
|
|
244
244
|
|
|
245
245
|
const styles = StyleSheet.create({
|
|
246
|
-
fill: {
|
|
247
|
-
flex: 1,
|
|
248
|
-
},
|
|
249
|
-
animated: {
|
|
250
|
-
paddingBottom: 0,
|
|
251
|
-
elevation: 4,
|
|
252
|
-
},
|
|
253
|
-
safeContent: {
|
|
254
|
-
paddingBottom: 0,
|
|
255
|
-
},
|
|
256
246
|
header: {
|
|
257
247
|
height: 75,
|
|
258
248
|
alignItems: 'center',
|
|
@@ -260,15 +250,9 @@ const styles = StyleSheet.create({
|
|
|
260
250
|
paddingLeft: 24,
|
|
261
251
|
paddingRight: 12,
|
|
262
252
|
},
|
|
263
|
-
headerContentContainer: {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
rangeHeaderText: { color: '#fff', fontSize: 25 },
|
|
267
|
-
excludeInRangeHeaderText: { fontSize: 25 },
|
|
268
|
-
excludeInRangeHeaderTextSmall: {
|
|
269
|
-
fontSize: 14,
|
|
270
|
-
marginTop: -3,
|
|
271
|
-
marginLeft: 3,
|
|
253
|
+
headerContentContainer: {
|
|
254
|
+
flexDirection: 'row',
|
|
255
|
+
marginTop: 5,
|
|
272
256
|
},
|
|
273
257
|
headerSeparator: {
|
|
274
258
|
color: 'rgba(255,255,255,1)',
|
|
@@ -276,9 +260,13 @@ const styles = StyleSheet.create({
|
|
|
276
260
|
paddingLeft: 6,
|
|
277
261
|
paddingRight: 6,
|
|
278
262
|
},
|
|
279
|
-
|
|
280
|
-
|
|
263
|
+
label: {
|
|
264
|
+
color: '#fff',
|
|
265
|
+
fontSize: 13,
|
|
266
|
+
letterSpacing: 1,
|
|
267
|
+
},
|
|
268
|
+
text: {
|
|
269
|
+
color: '#fff',
|
|
270
|
+
fontSize: 25,
|
|
281
271
|
},
|
|
282
|
-
column: { flexDirection: 'column' },
|
|
283
|
-
row: { flexDirection: 'row' },
|
|
284
272
|
})
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react'
|
|
2
2
|
import { Animated, StyleSheet } from 'react-native'
|
|
3
3
|
import { Appbar, Button, useTheme } from 'react-native-paper'
|
|
4
|
-
|
|
5
|
-
import { useHeaderTextColor } from '../utils'
|
|
4
|
+
import { useHeaderTextColor } from '../shared/utils'
|
|
6
5
|
import { getTranslation } from '../translations/utils'
|
|
7
6
|
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
8
7
|
|
|
@@ -19,12 +18,13 @@ export interface DatePickerModalHeaderProps {
|
|
|
19
18
|
export default function DatePickerModalHeader(
|
|
20
19
|
props: DatePickerModalHeaderProps
|
|
21
20
|
) {
|
|
22
|
-
const theme = useTheme()
|
|
23
21
|
const { locale, closeIcon = 'close' } = props
|
|
24
22
|
const saveLabel = props.saveLabel || getTranslation(locale, 'save')
|
|
25
23
|
const color = useHeaderTextColor()
|
|
26
24
|
const insets = useSafeAreaInsets()
|
|
27
25
|
|
|
26
|
+
const theme = useTheme()
|
|
27
|
+
|
|
28
28
|
return (
|
|
29
29
|
<>
|
|
30
30
|
<Animated.View
|
|
@@ -64,25 +64,6 @@ const styles = StyleSheet.create({
|
|
|
64
64
|
animated: {
|
|
65
65
|
elevation: 4,
|
|
66
66
|
},
|
|
67
|
-
header: {
|
|
68
|
-
height: 75,
|
|
69
|
-
alignItems: 'center',
|
|
70
|
-
flexDirection: 'row',
|
|
71
|
-
paddingLeft: 24,
|
|
72
|
-
paddingRight: 12,
|
|
73
|
-
},
|
|
74
|
-
headerContentContainer: { marginTop: 5, flexDirection: 'row' },
|
|
75
|
-
label: { color: '#fff', letterSpacing: 1, fontSize: 13 },
|
|
76
|
-
singleHeaderText: { color: '#fff', fontSize: 25 },
|
|
77
|
-
rangeHeaderText: { color: '#fff', fontSize: 25 },
|
|
78
|
-
headerTextFilled: { color: 'rgba(255,255,255,1)' },
|
|
79
|
-
headerTextEmpty: { color: 'rgba(255,255,255,0.5)' },
|
|
80
|
-
headerSeparator: {
|
|
81
|
-
color: 'rgba(255,255,255,1)',
|
|
82
|
-
fontSize: 25,
|
|
83
|
-
paddingLeft: 6,
|
|
84
|
-
paddingRight: 6,
|
|
85
|
-
},
|
|
86
67
|
appbarHeader: {
|
|
87
68
|
elevation: 0,
|
|
88
69
|
backgroundColor: 'transparent',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import React from 'react'
|
|
1
2
|
import { Animated, StyleSheet } from 'react-native'
|
|
2
|
-
import
|
|
3
|
-
import { useHeaderBackgroundColor } from '../utils'
|
|
3
|
+
import { useHeaderBackgroundColor } from '../shared/utils'
|
|
4
4
|
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
5
5
|
|
|
6
6
|
export default function DatePickerModalHeaderBackground({
|
|
@@ -10,6 +10,7 @@ export default function DatePickerModalHeaderBackground({
|
|
|
10
10
|
}) {
|
|
11
11
|
const backgroundColor = useHeaderBackgroundColor()
|
|
12
12
|
const insets = useSafeAreaInsets()
|
|
13
|
+
|
|
13
14
|
return (
|
|
14
15
|
<Animated.View
|
|
15
16
|
style={[
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React, { memo } from 'react'
|
|
2
2
|
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
3
|
-
import { useHeaderBackgroundColor } from '../utils'
|
|
3
|
+
import { useHeaderBackgroundColor } from '../shared/utils'
|
|
4
4
|
import Color from 'color'
|
|
5
5
|
import { Animated, StatusBar, StatusBarStyle } from 'react-native'
|
|
6
6
|
|
|
@@ -15,9 +15,9 @@ function DatePickerModalStatusBar({
|
|
|
15
15
|
}) {
|
|
16
16
|
const insets = useSafeAreaInsets()
|
|
17
17
|
const headerBackgroundColor = useHeaderBackgroundColor()
|
|
18
|
+
|
|
18
19
|
const onDarkBackground =
|
|
19
20
|
Color(headerBackgroundColor).isDark() || statusBarOnTopOfBackdrop
|
|
20
|
-
|
|
21
21
|
const statusBarTheme: StatusBarStyle = onDarkBackground
|
|
22
22
|
? 'light-content'
|
|
23
23
|
: 'dark-content'
|
|
@@ -48,4 +48,4 @@ function DatePickerModalStatusBar({
|
|
|
48
48
|
)
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
export default
|
|
51
|
+
export default memo(DatePickerModalStatusBar)
|
package/src/Date/Day.tsx
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import * as React from 'react'
|
|
2
1
|
import { MD2Theme, Text, TouchableRipple } from 'react-native-paper'
|
|
3
2
|
import { StyleSheet, View } from 'react-native'
|
|
4
3
|
import DayRange from './DayRange'
|
|
5
4
|
import { daySize } from './dateUtils'
|
|
6
5
|
|
|
7
|
-
import type { PaperTheme } from '../utils'
|
|
6
|
+
import type { PaperTheme } from '../shared/utils'
|
|
7
|
+
import { memo, useCallback } from 'react'
|
|
8
|
+
import React from 'react'
|
|
8
9
|
|
|
9
10
|
function EmptyDayPure() {
|
|
10
11
|
return <View style={styles.empty} />
|
|
11
12
|
}
|
|
12
|
-
|
|
13
|
+
|
|
14
|
+
export const EmptyDay = memo(EmptyDayPure)
|
|
13
15
|
|
|
14
16
|
function Day(props: {
|
|
15
17
|
theme: PaperTheme
|
|
@@ -43,11 +45,6 @@ function Day(props: {
|
|
|
43
45
|
textColorOnPrimary,
|
|
44
46
|
theme,
|
|
45
47
|
} = props
|
|
46
|
-
const onPress = React.useCallback(() => {
|
|
47
|
-
onPressDate(new Date(year, month, day))
|
|
48
|
-
}, [onPressDate, year, month, day])
|
|
49
|
-
|
|
50
|
-
// const borderColorV3 =
|
|
51
48
|
const borderColorFallback = theme.dark ? '#fff' : '#000'
|
|
52
49
|
const selectedOrInRangeDarkMode = selected || (inRange && theme.dark)
|
|
53
50
|
const v2BorderColor = selectedOrInRangeDarkMode
|
|
@@ -55,6 +52,10 @@ function Day(props: {
|
|
|
55
52
|
: borderColorFallback
|
|
56
53
|
const borderColor = theme.isV3 ? theme.colors.primary : v2BorderColor
|
|
57
54
|
|
|
55
|
+
const onPress = useCallback(() => {
|
|
56
|
+
onPressDate(new Date(year, month, day))
|
|
57
|
+
}, [onPressDate, year, month, day])
|
|
58
|
+
|
|
58
59
|
// TODO: check if this can be simplified
|
|
59
60
|
// converted with Chat-GPT for now from enormous conditional to if-else
|
|
60
61
|
let baseTextColor
|
|
@@ -137,20 +138,6 @@ function Day(props: {
|
|
|
137
138
|
}
|
|
138
139
|
|
|
139
140
|
const styles = StyleSheet.create({
|
|
140
|
-
empty: {
|
|
141
|
-
flex: 1,
|
|
142
|
-
flexBasis: 0,
|
|
143
|
-
},
|
|
144
|
-
disabled: {
|
|
145
|
-
opacity: 0.3,
|
|
146
|
-
},
|
|
147
|
-
root: {
|
|
148
|
-
flexBasis: 0,
|
|
149
|
-
flex: 1,
|
|
150
|
-
justifyContent: 'center',
|
|
151
|
-
alignItems: 'center',
|
|
152
|
-
position: 'relative',
|
|
153
|
-
},
|
|
154
141
|
button: {
|
|
155
142
|
width: daySize,
|
|
156
143
|
height: daySize,
|
|
@@ -168,9 +155,20 @@ const styles = StyleSheet.create({
|
|
|
168
155
|
borderWidth: 1,
|
|
169
156
|
borderColor: 'transparent',
|
|
170
157
|
},
|
|
171
|
-
|
|
158
|
+
disabled: {
|
|
159
|
+
opacity: 0.3,
|
|
160
|
+
},
|
|
161
|
+
empty: {
|
|
162
|
+
flex: 1,
|
|
163
|
+
flexBasis: 0,
|
|
164
|
+
},
|
|
165
|
+
root: {
|
|
166
|
+
flexBasis: 0,
|
|
172
167
|
flex: 1,
|
|
168
|
+
justifyContent: 'center',
|
|
169
|
+
alignItems: 'center',
|
|
170
|
+
position: 'relative',
|
|
173
171
|
},
|
|
174
172
|
})
|
|
175
173
|
|
|
176
|
-
export default
|
|
174
|
+
export default memo(Day)
|
package/src/Date/DayName.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React, { memo } from 'react'
|
|
2
2
|
import { StyleSheet, View } from 'react-native'
|
|
3
3
|
import { MD2Theme, Text, useTheme } from 'react-native-paper'
|
|
4
4
|
|
|
@@ -24,8 +24,16 @@ function DayName({ label }: { label: string }) {
|
|
|
24
24
|
</View>
|
|
25
25
|
)
|
|
26
26
|
}
|
|
27
|
+
|
|
27
28
|
const styles = StyleSheet.create({
|
|
28
|
-
dayName: {
|
|
29
|
-
|
|
29
|
+
dayName: {
|
|
30
|
+
alignItems: 'center',
|
|
31
|
+
flex: 1,
|
|
32
|
+
},
|
|
33
|
+
dayNameLabel: {
|
|
34
|
+
fontSize: 14,
|
|
35
|
+
opacity: 0.7,
|
|
36
|
+
},
|
|
30
37
|
})
|
|
31
|
-
|
|
38
|
+
|
|
39
|
+
export default memo(DayName)
|
package/src/Date/DayNames.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as React from 'react'
|
|
2
1
|
import { StyleSheet, View } from 'react-native'
|
|
3
2
|
import DayName from './DayName'
|
|
4
3
|
import { useTheme } from 'react-native-paper'
|
|
5
4
|
import { DisableWeekDaysType, showWeekDay } from './dateUtils'
|
|
5
|
+
import React, { memo, useMemo } from 'react'
|
|
6
6
|
|
|
7
7
|
export const dayNamesHeight = 44
|
|
8
8
|
|
|
@@ -16,7 +16,8 @@ function DayNames({
|
|
|
16
16
|
startWeekOnMonday: boolean
|
|
17
17
|
}) {
|
|
18
18
|
const theme = useTheme()
|
|
19
|
-
|
|
19
|
+
|
|
20
|
+
const shortDayNames = useMemo<string[]>(() => {
|
|
20
21
|
// TODO: wait for a better Intl api ;-)
|
|
21
22
|
const weekdays = [
|
|
22
23
|
new Date(2020, 7, 2),
|
|
@@ -39,7 +40,7 @@ function DayNames({
|
|
|
39
40
|
return (
|
|
40
41
|
<View
|
|
41
42
|
style={[styles.dayNames, { backgroundColor: theme.colors.surface }]}
|
|
42
|
-
pointerEvents=
|
|
43
|
+
pointerEvents="none"
|
|
43
44
|
>
|
|
44
45
|
{shortDayNames
|
|
45
46
|
.filter((_, dayIndex) => showWeekDay(dayIndex, disableWeekDays))
|
|
@@ -51,10 +52,10 @@ function DayNames({
|
|
|
51
52
|
}
|
|
52
53
|
const styles = StyleSheet.create({
|
|
53
54
|
dayNames: {
|
|
54
|
-
height: dayNamesHeight,
|
|
55
|
-
flexDirection: 'row',
|
|
56
55
|
alignItems: 'center',
|
|
57
56
|
backgroundColor: '#fff',
|
|
57
|
+
flexDirection: 'row',
|
|
58
|
+
height: dayNamesHeight,
|
|
58
59
|
},
|
|
59
60
|
})
|
|
60
|
-
export default
|
|
61
|
+
export default memo(DayNames)
|
package/src/Date/DayRange.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import * as React from 'react'
|
|
2
1
|
import { StyleSheet, View } from 'react-native'
|
|
3
2
|
import { daySize } from './dateUtils'
|
|
3
|
+
import React, { memo } from 'react'
|
|
4
|
+
import { sharedStyles } from '../shared/styles'
|
|
4
5
|
|
|
5
6
|
function DayRange({
|
|
6
7
|
leftCrop,
|
|
@@ -22,7 +23,7 @@ function DayRange({
|
|
|
22
23
|
pointerEvents="none"
|
|
23
24
|
style={[
|
|
24
25
|
StyleSheet.absoluteFill,
|
|
25
|
-
|
|
26
|
+
sharedStyles.flexDirectionRow,
|
|
26
27
|
bothWays && styles.rangeRootBoth,
|
|
27
28
|
inRange && !isCrop
|
|
28
29
|
? {
|
|
@@ -35,7 +36,7 @@ function DayRange({
|
|
|
35
36
|
<>
|
|
36
37
|
<View
|
|
37
38
|
style={[
|
|
38
|
-
|
|
39
|
+
sharedStyles.root,
|
|
39
40
|
rightCrop
|
|
40
41
|
? {
|
|
41
42
|
backgroundColor: selectColor,
|
|
@@ -56,7 +57,7 @@ function DayRange({
|
|
|
56
57
|
/>
|
|
57
58
|
<View
|
|
58
59
|
style={[
|
|
59
|
-
|
|
60
|
+
sharedStyles.root,
|
|
60
61
|
leftCrop
|
|
61
62
|
? {
|
|
62
63
|
backgroundColor: selectColor,
|
|
@@ -84,12 +85,6 @@ const styles = StyleSheet.create({
|
|
|
84
85
|
rangeRootBoth: {
|
|
85
86
|
borderRadius: daySize / 2,
|
|
86
87
|
},
|
|
87
|
-
flex1: {
|
|
88
|
-
flex: 1,
|
|
89
|
-
},
|
|
90
|
-
rangeRoot: {
|
|
91
|
-
flexDirection: 'row',
|
|
92
|
-
},
|
|
93
88
|
})
|
|
94
89
|
|
|
95
|
-
export default
|
|
90
|
+
export default memo(DayRange)
|