react-native-paper-dates 0.21.0 → 0.21.2
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/DatePickerInput.js +2 -2
- package/lib/commonjs/Date/DatePickerInput.js.map +1 -1
- package/lib/commonjs/Date/DatePickerModal.js +11 -19
- package/lib/commonjs/Date/DatePickerModal.js.map +1 -1
- package/lib/commonjs/Date/DatePickerModalContent.js +9 -3
- package/lib/commonjs/Date/DatePickerModalContent.js.map +1 -1
- package/lib/commonjs/Date/DatePickerModalHeader.js +3 -7
- package/lib/commonjs/Date/DatePickerModalHeader.js.map +1 -1
- package/lib/commonjs/Date/DatePickerModalStatusBar.js +43 -0
- package/lib/commonjs/Date/DatePickerModalStatusBar.js.map +1 -0
- package/lib/commonjs/Date/Month.js +1 -0
- package/lib/commonjs/Date/Month.js.map +1 -1
- package/lib/module/Date/DatePickerInput.js +2 -2
- package/lib/module/Date/DatePickerInput.js.map +1 -1
- package/lib/module/Date/DatePickerModal.js +11 -19
- package/lib/module/Date/DatePickerModal.js.map +1 -1
- package/lib/module/Date/DatePickerModalContent.js +9 -3
- package/lib/module/Date/DatePickerModalContent.js.map +1 -1
- package/lib/module/Date/DatePickerModalHeader.js +3 -7
- package/lib/module/Date/DatePickerModalHeader.js.map +1 -1
- package/lib/module/Date/DatePickerModalStatusBar.js +33 -0
- package/lib/module/Date/DatePickerModalStatusBar.js.map +1 -0
- package/lib/module/Date/Month.js +1 -0
- package/lib/module/Date/Month.js.map +1 -1
- package/lib/typescript/Date/DatePickerInput.shared.d.ts +1 -1
- package/lib/typescript/Date/DatePickerInput.shared.d.ts.map +1 -1
- package/lib/typescript/Date/DatePickerInputWithoutModal.d.ts +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 +3 -1
- package/lib/typescript/Date/DatePickerModalContent.d.ts.map +1 -1
- package/lib/typescript/Date/DatePickerModalHeader.d.ts +0 -1
- package/lib/typescript/Date/DatePickerModalHeader.d.ts.map +1 -1
- package/lib/typescript/Date/DatePickerModalStatusBar.d.ts +9 -0
- package/lib/typescript/Date/DatePickerModalStatusBar.d.ts.map +1 -0
- package/lib/typescript/Date/Month.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/Date/DatePickerInput.shared.tsx +1 -5
- package/src/Date/DatePickerInput.tsx +2 -2
- package/src/Date/DatePickerModal.tsx +31 -52
- package/src/Date/DatePickerModalContent.tsx +14 -2
- package/src/Date/DatePickerModalHeader.tsx +32 -33
- package/src/Date/DatePickerModalStatusBar.tsx +54 -0
- package/src/Date/Month.tsx +1 -0
|
@@ -7,7 +7,6 @@ import { getTranslation } from '../translations/utils'
|
|
|
7
7
|
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
8
8
|
|
|
9
9
|
export interface DatePickerModalHeaderProps {
|
|
10
|
-
disableSafeTop?: boolean
|
|
11
10
|
saveLabel?: string
|
|
12
11
|
saveLabelDisabled?: boolean
|
|
13
12
|
uppercase?: boolean
|
|
@@ -21,43 +20,43 @@ export default function DatePickerModalHeader(
|
|
|
21
20
|
props: DatePickerModalHeaderProps
|
|
22
21
|
) {
|
|
23
22
|
const theme = useTheme()
|
|
24
|
-
const {
|
|
23
|
+
const { locale, closeIcon = 'close' } = props
|
|
25
24
|
const saveLabel = props.saveLabel || getTranslation(locale, 'save')
|
|
26
25
|
const color = useHeaderTextColor()
|
|
27
26
|
const insets = useSafeAreaInsets()
|
|
28
27
|
|
|
29
28
|
return (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
</
|
|
59
|
-
</
|
|
60
|
-
|
|
29
|
+
<>
|
|
30
|
+
<Animated.View
|
|
31
|
+
style={[
|
|
32
|
+
styles.animated,
|
|
33
|
+
{
|
|
34
|
+
paddingLeft: insets.left,
|
|
35
|
+
paddingRight: insets.right,
|
|
36
|
+
},
|
|
37
|
+
]}
|
|
38
|
+
>
|
|
39
|
+
<Appbar style={styles.appbarHeader}>
|
|
40
|
+
<Appbar.Action
|
|
41
|
+
icon={closeIcon}
|
|
42
|
+
accessibilityLabel={getTranslation(locale, 'close')}
|
|
43
|
+
onPress={props.onDismiss}
|
|
44
|
+
color={color}
|
|
45
|
+
testID="react-native-paper-dates-close"
|
|
46
|
+
/>
|
|
47
|
+
<Appbar.Content title={''} />
|
|
48
|
+
<Button
|
|
49
|
+
textColor={theme.isV3 ? theme.colors.primary : color}
|
|
50
|
+
onPress={props.onSave}
|
|
51
|
+
disabled={props.saveLabelDisabled ?? false}
|
|
52
|
+
uppercase={props.uppercase ?? true}
|
|
53
|
+
testID="react-native-paper-dates-save"
|
|
54
|
+
>
|
|
55
|
+
{saveLabel}
|
|
56
|
+
</Button>
|
|
57
|
+
</Appbar>
|
|
58
|
+
</Animated.View>
|
|
59
|
+
</>
|
|
61
60
|
)
|
|
62
61
|
}
|
|
63
62
|
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
3
|
+
import { useHeaderBackgroundColor } from '../utils'
|
|
4
|
+
import Color from 'color'
|
|
5
|
+
import { Platform, Animated, StatusBar, StatusBarStyle } from 'react-native'
|
|
6
|
+
|
|
7
|
+
function DatePickerModalStatusBar({
|
|
8
|
+
disableSafeTop,
|
|
9
|
+
disableStatusBar,
|
|
10
|
+
statusBarOnTopOfBackdrop,
|
|
11
|
+
}: {
|
|
12
|
+
disableSafeTop: boolean
|
|
13
|
+
disableStatusBar: boolean
|
|
14
|
+
statusBarOnTopOfBackdrop: boolean
|
|
15
|
+
}) {
|
|
16
|
+
const insets = useSafeAreaInsets()
|
|
17
|
+
const headerBackgroundColor = useHeaderBackgroundColor()
|
|
18
|
+
const onDarkBackground =
|
|
19
|
+
Color(headerBackgroundColor).isDark() || statusBarOnTopOfBackdrop
|
|
20
|
+
const statusBarTheme: StatusBarStyle = onDarkBackground
|
|
21
|
+
? 'light-content'
|
|
22
|
+
: 'dark-content'
|
|
23
|
+
const statusBarBackground = statusBarOnTopOfBackdrop
|
|
24
|
+
? 'transparent'
|
|
25
|
+
: Platform.select({
|
|
26
|
+
android: headerBackgroundColor,
|
|
27
|
+
ios: headerBackgroundColor,
|
|
28
|
+
web: headerBackgroundColor,
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<>
|
|
33
|
+
{!disableStatusBar && (
|
|
34
|
+
<StatusBar
|
|
35
|
+
barStyle={statusBarTheme}
|
|
36
|
+
backgroundColor={statusBarBackground}
|
|
37
|
+
translucent={true}
|
|
38
|
+
/>
|
|
39
|
+
)}
|
|
40
|
+
{!disableSafeTop && !statusBarOnTopOfBackdrop && (
|
|
41
|
+
<Animated.View
|
|
42
|
+
style={[
|
|
43
|
+
{
|
|
44
|
+
backgroundColor: statusBarBackground,
|
|
45
|
+
height: insets.top || StatusBar.currentHeight,
|
|
46
|
+
},
|
|
47
|
+
]}
|
|
48
|
+
/>
|
|
49
|
+
)}
|
|
50
|
+
</>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export default React.memo(DatePickerModalStatusBar)
|
package/src/Date/Month.tsx
CHANGED
|
@@ -305,6 +305,7 @@ function Month(props: MonthSingleProps | MonthRangeProps | MonthMultiProps) {
|
|
|
305
305
|
<View style={isHorizontal ? styles.opacity1 : styles.opacity0}>
|
|
306
306
|
<IconButton
|
|
307
307
|
onPress={isHorizontal ? () => onPressYear(year) : undefined}
|
|
308
|
+
disabled
|
|
308
309
|
icon={
|
|
309
310
|
selectingYear
|
|
310
311
|
? theme.isV3
|