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.
Files changed (44) hide show
  1. package/lib/commonjs/Date/DatePickerInput.js +2 -2
  2. package/lib/commonjs/Date/DatePickerInput.js.map +1 -1
  3. package/lib/commonjs/Date/DatePickerModal.js +11 -19
  4. package/lib/commonjs/Date/DatePickerModal.js.map +1 -1
  5. package/lib/commonjs/Date/DatePickerModalContent.js +9 -3
  6. package/lib/commonjs/Date/DatePickerModalContent.js.map +1 -1
  7. package/lib/commonjs/Date/DatePickerModalHeader.js +3 -7
  8. package/lib/commonjs/Date/DatePickerModalHeader.js.map +1 -1
  9. package/lib/commonjs/Date/DatePickerModalStatusBar.js +43 -0
  10. package/lib/commonjs/Date/DatePickerModalStatusBar.js.map +1 -0
  11. package/lib/commonjs/Date/Month.js +1 -0
  12. package/lib/commonjs/Date/Month.js.map +1 -1
  13. package/lib/module/Date/DatePickerInput.js +2 -2
  14. package/lib/module/Date/DatePickerInput.js.map +1 -1
  15. package/lib/module/Date/DatePickerModal.js +11 -19
  16. package/lib/module/Date/DatePickerModal.js.map +1 -1
  17. package/lib/module/Date/DatePickerModalContent.js +9 -3
  18. package/lib/module/Date/DatePickerModalContent.js.map +1 -1
  19. package/lib/module/Date/DatePickerModalHeader.js +3 -7
  20. package/lib/module/Date/DatePickerModalHeader.js.map +1 -1
  21. package/lib/module/Date/DatePickerModalStatusBar.js +33 -0
  22. package/lib/module/Date/DatePickerModalStatusBar.js.map +1 -0
  23. package/lib/module/Date/Month.js +1 -0
  24. package/lib/module/Date/Month.js.map +1 -1
  25. package/lib/typescript/Date/DatePickerInput.shared.d.ts +1 -1
  26. package/lib/typescript/Date/DatePickerInput.shared.d.ts.map +1 -1
  27. package/lib/typescript/Date/DatePickerInputWithoutModal.d.ts +1 -1
  28. package/lib/typescript/Date/DatePickerModal.d.ts +1 -1
  29. package/lib/typescript/Date/DatePickerModal.d.ts.map +1 -1
  30. package/lib/typescript/Date/DatePickerModalContent.d.ts +3 -1
  31. package/lib/typescript/Date/DatePickerModalContent.d.ts.map +1 -1
  32. package/lib/typescript/Date/DatePickerModalHeader.d.ts +0 -1
  33. package/lib/typescript/Date/DatePickerModalHeader.d.ts.map +1 -1
  34. package/lib/typescript/Date/DatePickerModalStatusBar.d.ts +9 -0
  35. package/lib/typescript/Date/DatePickerModalStatusBar.d.ts.map +1 -0
  36. package/lib/typescript/Date/Month.d.ts.map +1 -1
  37. package/package.json +1 -1
  38. package/src/Date/DatePickerInput.shared.tsx +1 -5
  39. package/src/Date/DatePickerInput.tsx +2 -2
  40. package/src/Date/DatePickerModal.tsx +31 -52
  41. package/src/Date/DatePickerModalContent.tsx +14 -2
  42. package/src/Date/DatePickerModalHeader.tsx +32 -33
  43. package/src/Date/DatePickerModalStatusBar.tsx +54 -0
  44. 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 { disableSafeTop, locale, closeIcon = 'close' } = props
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
- <Animated.View
31
- style={[
32
- styles.animated,
33
- // eslint-disable-next-line react-native/no-inline-styles
34
- {
35
- paddingTop: disableSafeTop ? 0 : insets.top,
36
- paddingLeft: insets.left,
37
- paddingRight: insets.right,
38
- },
39
- ]}
40
- >
41
- <Appbar style={styles.appbarHeader}>
42
- <Appbar.Action
43
- icon={closeIcon}
44
- accessibilityLabel={getTranslation(locale, 'close')}
45
- onPress={props.onDismiss}
46
- color={color}
47
- testID="react-native-paper-dates-close"
48
- />
49
- <Appbar.Content title={''} />
50
- <Button
51
- textColor={theme.isV3 ? theme.colors.primary : color}
52
- onPress={props.onSave}
53
- disabled={props.saveLabelDisabled ?? false}
54
- uppercase={props.uppercase ?? true}
55
- testID="react-native-paper-dates-save"
56
- >
57
- {saveLabel}
58
- </Button>
59
- </Appbar>
60
- </Animated.View>
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)
@@ -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