react-native-paper-dates 0.22.57 → 0.23.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 (94) hide show
  1. package/lib/commonjs/Date/Calendar.js +1 -10
  2. package/lib/commonjs/Date/Calendar.js.map +1 -1
  3. package/lib/commonjs/Date/DatePickerModal.js.map +1 -1
  4. package/lib/commonjs/Date/DatePickerModalContent.js +1 -3
  5. package/lib/commonjs/Date/DatePickerModalContent.js.map +1 -1
  6. package/lib/commonjs/Date/DatePickerModalContentHeader.js +9 -11
  7. package/lib/commonjs/Date/DatePickerModalContentHeader.js.map +1 -1
  8. package/lib/commonjs/Date/DatePickerModalHeader.js +1 -1
  9. package/lib/commonjs/Date/DatePickerModalHeader.js.map +1 -1
  10. package/lib/commonjs/Date/Day.js +12 -30
  11. package/lib/commonjs/Date/Day.js.map +1 -1
  12. package/lib/commonjs/Date/DayName.js +1 -1
  13. package/lib/commonjs/Date/DayName.js.map +1 -1
  14. package/lib/commonjs/Date/Month.js +4 -6
  15. package/lib/commonjs/Date/Month.js.map +1 -1
  16. package/lib/commonjs/Date/YearPicker.js +4 -6
  17. package/lib/commonjs/Date/YearPicker.js.map +1 -1
  18. package/lib/commonjs/Time/AmPmSwitcher.js +2 -9
  19. package/lib/commonjs/Time/AmPmSwitcher.js.map +1 -1
  20. package/lib/commonjs/Time/AnalogClock.js +1 -4
  21. package/lib/commonjs/Time/AnalogClock.js.map +1 -1
  22. package/lib/commonjs/Time/TimeInput.js +3 -3
  23. package/lib/commonjs/Time/TimeInput.js.map +1 -1
  24. package/lib/commonjs/Time/TimeInputs.js +2 -2
  25. package/lib/commonjs/Time/TimeInputs.js.map +1 -1
  26. package/lib/commonjs/Time/TimePickerModal.js +6 -17
  27. package/lib/commonjs/Time/TimePickerModal.js.map +1 -1
  28. package/lib/commonjs/Time/timeUtils.js +13 -38
  29. package/lib/commonjs/Time/timeUtils.js.map +1 -1
  30. package/lib/commonjs/shared/utils.js +5 -22
  31. package/lib/commonjs/shared/utils.js.map +1 -1
  32. package/lib/module/Date/Calendar.js +3 -12
  33. package/lib/module/Date/Calendar.js.map +1 -1
  34. package/lib/module/Date/DatePickerModal.js.map +1 -1
  35. package/lib/module/Date/DatePickerModalContent.js +1 -3
  36. package/lib/module/Date/DatePickerModalContent.js.map +1 -1
  37. package/lib/module/Date/DatePickerModalContentHeader.js +9 -11
  38. package/lib/module/Date/DatePickerModalContentHeader.js.map +1 -1
  39. package/lib/module/Date/DatePickerModalHeader.js +1 -1
  40. package/lib/module/Date/DatePickerModalHeader.js.map +1 -1
  41. package/lib/module/Date/Day.js +12 -30
  42. package/lib/module/Date/Day.js.map +1 -1
  43. package/lib/module/Date/DayName.js +1 -1
  44. package/lib/module/Date/DayName.js.map +1 -1
  45. package/lib/module/Date/Month.js +4 -6
  46. package/lib/module/Date/Month.js.map +1 -1
  47. package/lib/module/Date/YearPicker.js +4 -6
  48. package/lib/module/Date/YearPicker.js.map +1 -1
  49. package/lib/module/Time/AmPmSwitcher.js +3 -9
  50. package/lib/module/Time/AmPmSwitcher.js.map +1 -1
  51. package/lib/module/Time/AnalogClock.js +1 -4
  52. package/lib/module/Time/AnalogClock.js.map +1 -1
  53. package/lib/module/Time/TimeInput.js +3 -3
  54. package/lib/module/Time/TimeInput.js.map +1 -1
  55. package/lib/module/Time/TimeInputs.js +2 -2
  56. package/lib/module/Time/TimeInputs.js.map +1 -1
  57. package/lib/module/Time/TimePickerModal.js +7 -18
  58. package/lib/module/Time/TimePickerModal.js.map +1 -1
  59. package/lib/module/Time/timeUtils.js +13 -37
  60. package/lib/module/Time/timeUtils.js.map +1 -1
  61. package/lib/module/shared/utils.js +6 -22
  62. package/lib/module/shared/utils.js.map +1 -1
  63. package/lib/typescript/Date/Calendar.d.ts.map +1 -1
  64. package/lib/typescript/Date/DatePickerModal.d.ts.map +1 -1
  65. package/lib/typescript/Date/DatePickerModalContent.d.ts.map +1 -1
  66. package/lib/typescript/Date/DatePickerModalContentHeader.d.ts.map +1 -1
  67. package/lib/typescript/Date/Day.d.ts.map +1 -1
  68. package/lib/typescript/Date/DayName.d.ts.map +1 -1
  69. package/lib/typescript/Date/Month.d.ts.map +1 -1
  70. package/lib/typescript/Time/AmPmSwitcher.d.ts.map +1 -1
  71. package/lib/typescript/Time/AnalogClock.d.ts.map +1 -1
  72. package/lib/typescript/Time/TimeInput.d.ts.map +1 -1
  73. package/lib/typescript/Time/TimeInputs.d.ts.map +1 -1
  74. package/lib/typescript/Time/TimePickerModal.d.ts.map +1 -1
  75. package/lib/typescript/Time/timeUtils.d.ts.map +1 -1
  76. package/lib/typescript/shared/utils.d.ts +2 -51
  77. package/lib/typescript/shared/utils.d.ts.map +1 -1
  78. package/package.json +22 -22
  79. package/src/Date/Calendar.tsx +3 -12
  80. package/src/Date/DatePickerModal.tsx +3 -6
  81. package/src/Date/DatePickerModalContent.tsx +4 -12
  82. package/src/Date/DatePickerModalContentHeader.tsx +10 -22
  83. package/src/Date/DatePickerModalHeader.tsx +1 -1
  84. package/src/Date/Day.tsx +13 -34
  85. package/src/Date/DayName.tsx +2 -4
  86. package/src/Date/Month.tsx +5 -19
  87. package/src/Date/YearPicker.tsx +4 -11
  88. package/src/Time/AmPmSwitcher.tsx +4 -18
  89. package/src/Time/AnalogClock.tsx +1 -6
  90. package/src/Time/TimeInput.tsx +10 -11
  91. package/src/Time/TimeInputs.tsx +3 -7
  92. package/src/Time/TimePickerModal.tsx +9 -33
  93. package/src/Time/timeUtils.ts +14 -51
  94. package/src/shared/utils.ts +8 -36
@@ -4,58 +4,9 @@ export declare const supportedOrientations: ('portrait' | 'portrait-upside-down'
4
4
  export type PaperTheme = typeof MD3DarkTheme | typeof DefaultTheme;
5
5
  export declare function useLatest<T>(value: T): import("react").RefObject<T>;
6
6
  export declare function useHeaderBackgroundColor(): string;
7
- export declare function useHeaderColorIsLight(): boolean;
8
7
  export declare function useHeaderTextColor(): string;
9
8
  export declare function useTextColorOnPrimary(): string;
10
9
  export declare function range(start: number, end: number): number[];
11
- export declare function lightenBy(color: Color, ratio: number): Color<string | number | Color<string | number | Color<string | number | Color<string | number | Color<string | number | Color<string | number | Color<string | number | Color<string | number | Color<string | number | Color<string | number | Color<string | number | Color<string | number | /*elided*/ any | ArrayLike<number> | {
12
- [key: string]: any;
13
- }> | ArrayLike<number> | {
14
- [key: string]: any;
15
- }> | ArrayLike<number> | {
16
- [key: string]: any;
17
- }> | ArrayLike<number> | {
18
- [key: string]: any;
19
- }> | ArrayLike<number> | {
20
- [key: string]: any;
21
- }> | ArrayLike<number> | {
22
- [key: string]: any;
23
- }> | ArrayLike<number> | {
24
- [key: string]: any;
25
- }> | ArrayLike<number> | {
26
- [key: string]: any;
27
- }> | ArrayLike<number> | {
28
- [key: string]: any;
29
- }> | ArrayLike<number> | {
30
- [key: string]: any;
31
- }> | ArrayLike<number> | {
32
- [key: string]: any;
33
- }> | ArrayLike<number> | {
34
- [key: string]: any;
35
- }>;
36
- export declare function darkenBy(color: Color, ratio: number): Color<string | number | Color<string | number | Color<string | number | Color<string | number | Color<string | number | Color<string | number | Color<string | number | Color<string | number | Color<string | number | Color<string | number | Color<string | number | Color<string | number | /*elided*/ any | ArrayLike<number> | {
37
- [key: string]: any;
38
- }> | ArrayLike<number> | {
39
- [key: string]: any;
40
- }> | ArrayLike<number> | {
41
- [key: string]: any;
42
- }> | ArrayLike<number> | {
43
- [key: string]: any;
44
- }> | ArrayLike<number> | {
45
- [key: string]: any;
46
- }> | ArrayLike<number> | {
47
- [key: string]: any;
48
- }> | ArrayLike<number> | {
49
- [key: string]: any;
50
- }> | ArrayLike<number> | {
51
- [key: string]: any;
52
- }> | ArrayLike<number> | {
53
- [key: string]: any;
54
- }> | ArrayLike<number> | {
55
- [key: string]: any;
56
- }> | ArrayLike<number> | {
57
- [key: string]: any;
58
- }> | ArrayLike<number> | {
59
- [key: string]: any;
60
- }>;
10
+ export declare function lightenBy(color: InstanceType<typeof Color>, ratio: number): import("color").ColorInstance;
11
+ export declare function darkenBy(color: InstanceType<typeof Color>, ratio: number): import("color").ColorInstance;
61
12
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/shared/utils.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,EACZ,YAAY,EAGb,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,eAAO,MAAM,qBAAqB,EAAE,CAChC,UAAU,GACV,sBAAsB,GACtB,WAAW,GACX,gBAAgB,GAChB,iBAAiB,CACpB,EAMA,CAAA;AAED,MAAM,MAAM,UAAU,GAAG,OAAO,YAAY,GAAG,OAAO,YAAY,CAAA;AAElE,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,gCAIpC;AAED,wBAAgB,wBAAwB,WAQvC;AAED,wBAAgB,qBAAqB,YAOpC;AAED,wBAAgB,kBAAkB,WAOjC;AAED,wBAAgB,qBAAqB,WAapC;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,YAI/C;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;GAGpD;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;GAGnD"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/shared/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAY,MAAM,oBAAoB,CAAA;AACzE,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,eAAO,MAAM,qBAAqB,EAAE,CAChC,UAAU,GACV,sBAAsB,GACtB,WAAW,GACX,gBAAgB,GAChB,iBAAiB,CACpB,EAMA,CAAA;AAED,MAAM,MAAM,UAAU,GAAG,OAAO,YAAY,GAAG,OAAO,YAAY,CAAA;AAElE,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,gCAIpC;AAED,wBAAgB,wBAAwB,WAGvC;AAED,wBAAgB,kBAAkB,WAGjC;AAED,wBAAgB,qBAAqB,WAQpC;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,YAI/C;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,YAAY,CAAC,OAAO,KAAK,CAAC,EAAE,KAAK,EAAE,MAAM,iCAGzE;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC,OAAO,KAAK,CAAC,EAAE,KAAK,EAAE,MAAM,iCAGxE"}
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.22.57",
2
+ "version": "0.23.2",
3
3
  "author": "Richard Lindhout <info@webridge.nl> (https://github.com/web-ridge)",
4
4
  "bugs": {
5
5
  "url": "https://github.com/web-ridge/react-native-paper-dates/issues"
@@ -10,41 +10,41 @@
10
10
  ]
11
11
  },
12
12
  "dependencies": {
13
- "color": "^4.2.3"
13
+ "color": "^5.0.3"
14
14
  },
15
15
  "description": "Performant Date Picker for React Native Paper",
16
16
  "devDependencies": {
17
- "@commitlint/config-conventional": "^19.8.0",
17
+ "@commitlint/config-conventional": "^20.3.1",
18
18
  "@react-native-community/eslint-config": "^3.2.0",
19
- "@react-native-vector-icons/material-design-icons": "^12.0.0",
20
- "@react-native/babel-preset": "^0.79.2",
21
- "@release-it/conventional-changelog": "^10.0.1",
19
+ "@react-native-vector-icons/material-design-icons": "^12.4.0",
20
+ "@react-native/babel-preset": "~0.81.5",
21
+ "@release-it/conventional-changelog": "^10.0.4",
22
22
  "@testing-library/react-native": "^13.2.0",
23
23
  "@types/color": "^4.2.0",
24
24
  "@types/jest": "^29.5.14",
25
- "@types/react": "~19.0.10",
25
+ "@types/react": "~19.1.17",
26
26
  "@types/react-native-vector-icons": "^6.4.18",
27
- "@types/react-test-renderer": "~19.0.0",
27
+ "@types/react-test-renderer": "~19.1.0",
28
28
  "babel-loader": "^10.0.0",
29
- "caniuse-lite": "^1.0.30001716",
30
- "commitlint": "^19.8.0",
29
+ "caniuse-lite": "^1.0.30001765",
30
+ "commitlint": "^20.3.1",
31
31
  "eslint": "^8.57.1",
32
- "eslint-config-prettier": "^10.1.2",
33
- "eslint-plugin-prettier": "^5.2.6",
34
- "eslint-plugin-testing-library": "^7.1.1",
32
+ "eslint-config-prettier": "^10.1.8",
33
+ "eslint-plugin-prettier": "^5.5.5",
34
+ "eslint-plugin-testing-library": "^7.15.4",
35
35
  "husky": "^9.1.7",
36
36
  "jest": "^29.7.0",
37
37
  "metro-react-native-babel-preset": "^0.77.0",
38
- "pod-install": "^0.3.9",
39
- "prettier": "^3.5.3",
40
- "react": "~19.0.0",
41
- "react-native": "^0.79.2",
42
- "react-native-builder-bob": "^0.40.0",
43
- "react-native-paper": "^5.14.0",
44
- "react-native-safe-area-context": "^5.4.0",
45
- "react-test-renderer": "~19.0.0",
38
+ "pod-install": "^1.0.9",
39
+ "prettier": "^3.8.0",
40
+ "react": "19.1.0",
41
+ "react-native": "~0.81.5",
42
+ "react-native-builder-bob": "^0.40.17",
43
+ "react-native-paper": "^5.14.5",
44
+ "react-native-safe-area-context": "^5.6.2",
45
+ "react-test-renderer": "19.1.0",
46
46
  "release-it": "^19.0.1",
47
- "typescript": "~5.8.3"
47
+ "typescript": "~5.9.3"
48
48
  },
49
49
  "eslintConfig": {
50
50
  "root": true,
@@ -10,11 +10,10 @@ import {
10
10
  } from './dateUtils'
11
11
 
12
12
  import CalendarHeader from './CalendarHeader'
13
- import { memo, useCallback, useMemo, useState } from 'react'
13
+ import { memo, useCallback, useState } from 'react'
14
14
  import YearPicker from './YearPicker'
15
- import Color from 'color'
16
15
  import { useTheme } from 'react-native-paper'
17
- import { darkenBy, lightenBy, useLatest } from '../shared/utils'
16
+ import { useLatest } from '../shared/utils'
18
17
  import { sharedStyles } from '../shared/styles'
19
18
  import { defaultStartYear, defaultEndYear } from './dateUtils'
20
19
 
@@ -162,15 +161,7 @@ function Calendar(
162
161
  [mode, dateMode, onChangeRef, startDateRef, endDateRef, datesRef]
163
162
  )
164
163
 
165
- const selectColor = useMemo<string>(() => {
166
- if (theme.isV3) {
167
- return theme.colors.primaryContainer
168
- }
169
- if (theme.dark) {
170
- return darkenBy(Color(theme.colors.primary), 0.1).hex()
171
- }
172
- return lightenBy(Color(theme.colors.primary), 0.9).hex()
173
- }, [theme])
164
+ const selectColor = theme.colors.primaryContainer
174
165
 
175
166
  return (
176
167
  <View style={sharedStyles.root}>
@@ -26,16 +26,13 @@ interface DatePickerModalProps {
26
26
  }
27
27
 
28
28
  export interface DatePickerModalSingleProps
29
- extends DatePickerModalContentSingleProps,
30
- DatePickerModalProps {}
29
+ extends DatePickerModalContentSingleProps, DatePickerModalProps {}
31
30
 
32
31
  export interface DatePickerModalMultiProps
33
- extends DatePickerModalContentMultiProps,
34
- DatePickerModalProps {}
32
+ extends DatePickerModalContentMultiProps, DatePickerModalProps {}
35
33
 
36
34
  export interface DatePickerModalRangeProps
37
- extends DatePickerModalContentRangeProps,
38
- DatePickerModalProps {}
35
+ extends DatePickerModalContentRangeProps, DatePickerModalProps {}
39
36
 
40
37
  export function DatePickerModal(
41
38
  props:
@@ -15,7 +15,6 @@ import DatePickerModalContentHeader, {
15
15
  } from './DatePickerModalContentHeader'
16
16
  import CalendarEdit from './CalendarEdit'
17
17
  import DatePickerModalHeaderBackground from './DatePickerModalHeaderBackground'
18
- import { useTheme } from 'react-native-paper'
19
18
  import DatePickerModalStatusBar from './DatePickerModalStatusBar'
20
19
  import { memo, useCallback, useEffect, useState } from 'react'
21
20
 
@@ -41,9 +40,7 @@ interface DatePickerModalContentBaseProps {
41
40
  }
42
41
 
43
42
  export interface DatePickerModalContentRangeProps
44
- extends HeaderPickProps,
45
- BaseCalendarProps,
46
- DatePickerModalContentBaseProps {
43
+ extends HeaderPickProps, BaseCalendarProps, DatePickerModalContentBaseProps {
47
44
  mode: 'range'
48
45
  startDate: CalendarDate
49
46
  endDate: CalendarDate
@@ -52,9 +49,7 @@ export interface DatePickerModalContentRangeProps
52
49
  }
53
50
 
54
51
  export interface DatePickerModalContentSingleProps
55
- extends HeaderPickProps,
56
- BaseCalendarProps,
57
- DatePickerModalContentBaseProps {
52
+ extends HeaderPickProps, BaseCalendarProps, DatePickerModalContentBaseProps {
58
53
  mode: 'single'
59
54
  date?: CalendarDate
60
55
  onChange?: SingleChange
@@ -63,9 +58,7 @@ export interface DatePickerModalContentSingleProps
63
58
  }
64
59
 
65
60
  export interface DatePickerModalContentMultiProps
66
- extends HeaderPickProps,
67
- BaseCalendarProps,
68
- DatePickerModalContentBaseProps {
61
+ extends HeaderPickProps, BaseCalendarProps, DatePickerModalContentBaseProps {
69
62
  mode: 'multiple'
70
63
  dates?: CalendarDates
71
64
  onChange?: MultiChange
@@ -94,9 +87,8 @@ export function DatePickerModalContent(
94
87
  statusBarOnTopOfBackdrop,
95
88
  startWeekOnMonday,
96
89
  } = props
97
- const theme = useTheme()
98
90
  const anyProps = props as any
99
- const defaultUppercase = !theme.isV3
91
+ const defaultUppercase = false
100
92
 
101
93
  // use local state to add only onConfirm state changes
102
94
  const [state, setState] = useState<LocalState>({
@@ -1,5 +1,5 @@
1
1
  import { StyleSheet, View } from 'react-native'
2
- import { IconButton, MD2Theme, Text, useTheme } from 'react-native-paper'
2
+ import { IconButton, Text, useTheme } from 'react-native-paper'
3
3
  import type { ModeType } from './Calendar'
4
4
  import type { LocalState } from './DatePickerModalContent'
5
5
  import { useHeaderTextColor } from '../shared/utils'
@@ -70,14 +70,10 @@ export default function DatePickerModalContentHeader(
70
70
  const label = getLabel(props.locale, props.mode, props.label)
71
71
  const color = useHeaderTextColor()
72
72
  const isEditingEnabled = allowEditing && mode !== 'multiple'
73
- const supportingTextColor = theme.isV3 ? theme.colors.onSurfaceVariant : color
74
- const textFont = theme?.isV3
75
- ? theme.fonts.labelMedium
76
- : (theme as any as MD2Theme).fonts.medium
77
- const collapsedIcon = theme.isV3 ? 'pencil-outline' : 'pencil'
78
- const expandedIcon = theme.isV3 ? 'calendar-blank' : 'calendar'
79
- const finalCollapsedIcon = editIcon ?? collapsedIcon
80
- const finalExpandedIcon = calendarIcon ?? expandedIcon
73
+ const supportingTextColor = theme.colors.onSurfaceVariant
74
+ const textFont = theme.fonts.labelMedium
75
+ const finalCollapsedIcon = editIcon ?? 'pencil-outline'
76
+ const finalExpandedIcon = calendarIcon ?? 'calendar-blank'
81
77
 
82
78
  return (
83
79
  <View style={styles.header}>
@@ -113,7 +109,7 @@ export default function DatePickerModalContentHeader(
113
109
  ? getTranslation(props.locale, 'typeInDate')
114
110
  : getTranslation(props.locale, 'pickDateFromCalendar')
115
111
  }
116
- iconColor={theme.isV3 ? theme.colors.onSurface : color}
112
+ iconColor={theme.colors.onSurface}
117
113
  onPress={onToggle}
118
114
  />
119
115
  ) : null}
@@ -130,11 +126,7 @@ export function HeaderContentSingle({
130
126
  const theme = useTheme()
131
127
 
132
128
  const lighterColor = Color(color).fade(0.5).rgb().toString()
133
- const dateColor = state.date
134
- ? theme.isV3
135
- ? theme.colors.onSurface
136
- : color
137
- : lighterColor
129
+ const dateColor = state.date ? theme.colors.onSurface : lighterColor
138
130
 
139
131
  const formatter = useMemo(() => {
140
132
  return new Intl.DateTimeFormat(locale, {
@@ -164,11 +156,7 @@ export function HeaderContentMulti({
164
156
 
165
157
  const dateCount = state.dates?.length || 0
166
158
  const lighterColor = Color(color).fade(0.5).rgb().toString()
167
- const dateColor = dateCount
168
- ? theme.isV3
169
- ? theme.colors.onSurface
170
- : color
171
- : lighterColor
159
+ const dateColor = dateCount ? theme.colors.onSurface : lighterColor
172
160
 
173
161
  const formatter = useMemo(() => {
174
162
  return new Intl.DateTimeFormat(locale, {
@@ -208,8 +196,8 @@ export function HeaderContentRange({
208
196
  const theme = useTheme()
209
197
 
210
198
  const lighterColor = Color(color).fade(0.5).rgb().toString()
211
- const startColorFilled = theme.isV3 ? theme.colors.onSurface : color
212
- const endColorFilled = theme.isV3 ? theme.colors.onSurface : color
199
+ const startColorFilled = theme.colors.onSurface
200
+ const endColorFilled = theme.colors.onSurface
213
201
  const startColor = state.startDate ? startColorFilled : lighterColor
214
202
  const endColor = state.endDate ? endColorFilled : lighterColor
215
203
 
@@ -44,7 +44,7 @@ export default function DatePickerModalHeader(
44
44
  testID="react-native-paper-dates-close"
45
45
  />
46
46
  <Button
47
- textColor={theme.isV3 ? theme.colors.primary : color}
47
+ textColor={theme.colors.primary}
48
48
  onPress={props.onSave}
49
49
  disabled={props.saveLabelDisabled ?? false}
50
50
  uppercase={props.uppercase ?? true}
package/src/Date/Day.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import { MD2Theme, Text, TouchableRipple } from 'react-native-paper'
1
+ import { Text, TouchableRipple } from 'react-native-paper'
2
2
  import { StyleSheet, View } from 'react-native'
3
3
  import DayRange from './DayRange'
4
4
  import { daySize } from './dateUtils'
@@ -41,54 +41,33 @@ function Day(props: {
41
41
  selectColor,
42
42
  isToday,
43
43
  disabled,
44
- textColorOnPrimary,
45
44
  theme,
46
45
  } = props
47
- const borderColorFallback = theme.dark ? '#fff' : '#000'
48
- const selectedOrInRangeDarkMode = selected || (inRange && theme.dark)
49
- const v2BorderColor = selectedOrInRangeDarkMode
50
- ? textColorOnPrimary
51
- : borderColorFallback
52
- const borderColor = theme.isV3 ? theme.colors.primary : v2BorderColor
46
+ const borderColor = theme.colors.primary
53
47
 
54
48
  const onPress = useCallback(() => {
55
49
  onPressDate(new Date(year, month, day))
56
50
  }, [onPressDate, year, month, day])
57
51
 
58
- // TODO: check if this can be simplified
59
- // converted with Chat-GPT for now from enormous conditional to if-else
52
+ // Determine text colors for M3
60
53
  let baseTextColor
61
54
  let finalTextColor
62
55
 
63
- if (theme.isV3) {
64
- // Theme V3 specific logic for base text color
65
- if (selected) {
66
- baseTextColor = theme.colors.onPrimary
67
- } else if (inRange && theme.dark) {
68
- baseTextColor = theme.colors.onPrimaryContainer
69
- } else {
70
- baseTextColor = theme.colors.onSurface
71
- }
56
+ if (selected) {
57
+ baseTextColor = theme.colors.onPrimary
58
+ } else if (inRange && theme.dark) {
59
+ baseTextColor = theme.colors.onPrimaryContainer
60
+ } else {
61
+ baseTextColor = theme.colors.onSurface
62
+ }
72
63
 
73
- // Theme V3 specific logic for final text color
74
- if (isToday) {
75
- finalTextColor = selected ? baseTextColor : theme.colors.primary
76
- } else {
77
- finalTextColor = baseTextColor
78
- }
64
+ if (isToday) {
65
+ finalTextColor = selected ? baseTextColor : theme.colors.primary
79
66
  } else {
80
- // Logic for themes other than V3
81
- if (selected || (inRange && theme.dark)) {
82
- baseTextColor = textColorOnPrimary
83
- }
84
- // Since there's no additional logic provided for non-V3 themes in the step 2,
85
- // the final text color for non-V3 themes will simply be the base text color.
86
67
  finalTextColor = baseTextColor
87
68
  }
88
69
 
89
- let textFont = theme?.isV3
90
- ? theme.fonts.bodySmall
91
- : (theme as any as MD2Theme).fonts.medium
70
+ const textFont = theme.fonts.bodySmall
92
71
 
93
72
  return (
94
73
  <View style={[styles.root, disabled && styles.disabled]}>
@@ -1,13 +1,11 @@
1
1
  import { memo } from 'react'
2
2
  import { StyleSheet, View } from 'react-native'
3
- import { MD2Theme, Text, useTheme } from 'react-native-paper'
3
+ import { Text, useTheme } from 'react-native-paper'
4
4
 
5
5
  function DayName({ label }: { label: string }) {
6
6
  const theme = useTheme()
7
7
 
8
- let textFont = theme?.isV3
9
- ? theme.fonts.bodySmall
10
- : (theme as any as MD2Theme).fonts.medium
8
+ const textFont = theme.fonts.bodySmall
11
9
 
12
10
  return (
13
11
  <View style={styles.dayName}>
@@ -1,11 +1,5 @@
1
1
  import { StyleSheet, View } from 'react-native'
2
- import {
3
- Icon,
4
- MD2Theme,
5
- Text,
6
- TouchableRipple,
7
- useTheme,
8
- } from 'react-native-paper'
2
+ import { Icon, Text, TouchableRipple, useTheme } from 'react-native-paper'
9
3
  import Day, { EmptyDay } from './Day'
10
4
 
11
5
  import {
@@ -263,17 +257,11 @@ function Month(props: MonthSingleProps | MonthRangeProps | MonthMultiProps) {
263
257
  endYear,
264
258
  ])
265
259
 
266
- let textFont = theme?.isV3
267
- ? theme.fonts.titleSmall
268
- : (theme as any as MD2Theme).fonts.medium
260
+ const textFont = theme.fonts.titleSmall
269
261
 
270
- const iconColor = theme.isV3
271
- ? theme.colors.onSurfaceVariant
272
- : theme.colors.onSurface
262
+ const iconColor = theme.colors.onSurfaceVariant
273
263
 
274
- const iconSourceV3 = selectingYear ? 'menu-up' : 'menu-down'
275
- const iconSourceV2 = selectingYear ? 'chevron-up' : 'chevron-down'
276
- const iconSource = theme.isV3 ? iconSourceV3 : iconSourceV2
264
+ const iconSource = selectingYear ? 'menu-up' : 'menu-down'
277
265
 
278
266
  return (
279
267
  <View
@@ -324,9 +312,7 @@ function Month(props: MonthSingleProps | MonthRangeProps | MonthMultiProps) {
324
312
  styles.monthLabel,
325
313
  {
326
314
  ...textFont,
327
- color: theme.isV3
328
- ? theme.colors.onSurfaceVariant
329
- : theme.colors.onSurface,
315
+ color: theme.colors.onSurfaceVariant,
330
316
  },
331
317
  ]}
332
318
  selectable={false}
@@ -1,5 +1,5 @@
1
1
  import { FlatList, ScrollView, StyleSheet, View } from 'react-native'
2
- import { MD2Theme, Text, TouchableRipple, useTheme } from 'react-native-paper'
2
+ import { Text, TouchableRipple, useTheme } from 'react-native-paper'
3
3
  import { range } from '../shared/utils'
4
4
  import { memo, useEffect, useRef } from 'react'
5
5
  import { sharedStyles } from '../shared/styles'
@@ -81,9 +81,7 @@ function YearPure({
81
81
  }) {
82
82
  const theme = useTheme()
83
83
 
84
- let textFont = theme?.isV3
85
- ? theme.fonts.bodyLarge
86
- : (theme as any as MD2Theme).fonts.medium
84
+ const textFont = theme.fonts.bodyLarge
87
85
 
88
86
  return (
89
87
  <View style={styles.year}>
@@ -104,13 +102,8 @@ function YearPure({
104
102
  style={[
105
103
  styles.yearLabel,
106
104
  selected
107
- ? // eslint-disable-next-line react-native/no-inline-styles
108
- { color: theme.isV3 ? theme.colors.onPrimary : '#fff' }
109
- : {
110
- color: theme.isV3
111
- ? theme.colors.onSurfaceVariant
112
- : theme.colors.onSurface,
113
- },
105
+ ? { color: theme.colors.onPrimary }
106
+ : { color: theme.colors.onSurfaceVariant },
114
107
  { ...textFont },
115
108
  ]}
116
109
  selectable={false}
@@ -1,7 +1,6 @@
1
1
  import { StyleSheet, View } from 'react-native'
2
- import { MD2Theme, Text, TouchableRipple, useTheme } from 'react-native-paper'
3
- import { useContext, useMemo } from 'react'
4
- import Color from 'color'
2
+ import { Text, TouchableRipple, useTheme } from 'react-native-paper'
3
+ import { useContext } from 'react'
5
4
  import { inputTypes, PossibleInputTypes, useSwitchColors } from './timeUtils'
6
5
  import { DisplayModeContext } from '../contexts/DisplayModeContext'
7
6
  import { sharedStyles } from '../shared/styles'
@@ -19,18 +18,7 @@ export default function AmPmSwitcher({
19
18
 
20
19
  const { setMode, mode } = useContext(DisplayModeContext)
21
20
 
22
- const backgroundColor = useMemo<string>(() => {
23
- if (theme.isV3) {
24
- return theme.colors.outline
25
- }
26
- return Color(
27
- theme.dark
28
- ? Color(theme.colors.surface).lighten(1.2).hex()
29
- : theme.colors.surface
30
- )
31
- .darken(0.1)
32
- .hex()
33
- }, [theme])
21
+ const backgroundColor = theme.colors.outline
34
22
 
35
23
  const isAM = mode === 'AM'
36
24
 
@@ -89,9 +77,7 @@ function SwitchButton({
89
77
 
90
78
  const { backgroundColor, color } = useSwitchColors(selected)
91
79
 
92
- let textFont = theme?.isV3
93
- ? theme.fonts.titleMedium
94
- : (theme as any as MD2Theme).fonts.medium
80
+ const textFont = theme.fonts.titleMedium
95
81
 
96
82
  return (
97
83
  <TouchableRipple
@@ -1,4 +1,3 @@
1
- import Color from 'color'
2
1
  import {
3
2
  GestureResponderEvent,
4
3
  PanResponder,
@@ -133,10 +132,6 @@ function AnalogClock({
133
132
  const pointerNumber = focused === clockTypes.hours ? hours : minutes
134
133
  const degreesPerNumber = focused === clockTypes.hours ? 30 : 6
135
134
 
136
- const v3Color = theme.colors.surfaceVariant
137
- const v2Color = theme.dark
138
- ? Color(theme.colors.surface).lighten(1.4).hex()
139
- : Color(theme.colors.surface).darken(0.1).hex()
140
135
  return (
141
136
  <View
142
137
  ref={clockRef}
@@ -144,7 +139,7 @@ function AnalogClock({
144
139
  style={[
145
140
  styles.clock,
146
141
  {
147
- backgroundColor: theme.isV3 ? v3Color : v2Color,
142
+ backgroundColor: theme.colors.surfaceVariant,
148
143
  },
149
144
  ]}
150
145
  // @ts-ignore -> https://github.com/necolas/react-native-web/issues/506
@@ -5,7 +5,7 @@ import {
5
5
  TextInputProps,
6
6
  View,
7
7
  } from 'react-native'
8
- import { MD2Theme, TouchableRipple, useTheme } from 'react-native-paper'
8
+ import { TouchableRipple, useTheme } from 'react-native-paper'
9
9
 
10
10
  import Color from 'color'
11
11
  import {
@@ -17,8 +17,10 @@ import {
17
17
  import { forwardRef, useEffect, useState } from 'react'
18
18
  import { sharedStyles } from '../shared/styles'
19
19
 
20
- interface TimeInputProps
21
- extends Omit<Omit<Omit<TextInputProps, 'value'>, 'onFocus'>, 'onPress'> {
20
+ interface TimeInputProps extends Omit<
21
+ Omit<Omit<TextInputProps, 'value'>, 'onFocus'>,
22
+ 'onPress'
23
+ > {
22
24
  value: number
23
25
  clockType: PossibleClockTypes
24
26
  onPress?: (type: PossibleClockTypes) => any
@@ -77,11 +79,10 @@ function TimeInput(
77
79
  {
78
80
  backgroundColor,
79
81
  borderRadius: theme.roundness * 2,
80
- borderColor:
81
- theme.isV3 && highlighted
82
- ? theme.colors.onPrimaryContainer
83
- : undefined,
84
- borderWidth: theme.isV3 && highlighted ? 2 : 0,
82
+ borderColor: highlighted
83
+ ? theme.colors.onPrimaryContainer
84
+ : undefined,
85
+ borderWidth: highlighted ? 2 : 0,
85
86
  height: inputType === inputTypes.keyboard ? 72 : 80,
86
87
  },
87
88
  ]}
@@ -94,9 +95,7 @@ function TimeInput(
94
95
  // eslint-disable-next-line react-native/no-inline-styles
95
96
  {
96
97
  color,
97
- fontFamily: theme?.isV3
98
- ? theme.fonts.titleMedium.fontFamily
99
- : (theme as any as MD2Theme).fonts.medium.fontFamily,
98
+ fontFamily: theme.fonts.titleMedium.fontFamily,
100
99
  fontSize: inputFontSize,
101
100
  lineHeight:
102
101
  Platform.OS === 'android'
@@ -4,7 +4,7 @@ import {
4
4
  useWindowDimensions,
5
5
  View,
6
6
  } from 'react-native'
7
- import { MD2Theme, Text, useTheme } from 'react-native-paper'
7
+ import { Text, useTheme } from 'react-native-paper'
8
8
 
9
9
  import {
10
10
  clockTypes,
@@ -129,9 +129,7 @@ function TimeInputs({
129
129
  style={[
130
130
  styles.dot,
131
131
  {
132
- backgroundColor: theme?.isV3
133
- ? theme.colors.onSurface
134
- : (theme as any as MD2Theme).colors.text,
132
+ backgroundColor: theme.colors.onSurface,
135
133
  },
136
134
  ]}
137
135
  />
@@ -140,9 +138,7 @@ function TimeInputs({
140
138
  style={[
141
139
  styles.dot,
142
140
  {
143
- backgroundColor: theme?.isV3
144
- ? theme.colors.onSurface
145
- : (theme as any as MD2Theme).colors.text,
141
+ backgroundColor: theme.colors.onSurface,
146
142
  },
147
143
  ]}
148
144
  />