Skip to content

Commit 3632005

Browse files
authored
Merge pull request #333 from SoyDiego/custom-properties-datepicker
feat: Add custom icon properties to DatePickerInput component
2 parents 44984b3 + 9d81097 commit 3632005

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

docusaurus/docs/date-picker/input-date-picker.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,18 @@ Callback event when the component text input changes.
6767
`Type: 'flat' | 'outlined'`
6868
See [react-native-paper text-input](https://callstack.github.io/react-native-paper/text-input.html#mode).
6969

70+
**iconSize**
71+
`Type: Number`
72+
Specifies the size of the icon in pixels.
73+
74+
**iconColor**
75+
`Type: String`
76+
Sets the color of the icon.
77+
78+
**iconStyle**
79+
`Type: React.CSSProperties`
80+
Defines the CSS styles for the icon element.
81+
7082
**validRange**
7183
`Type: {
7284
startDate: Date | undefined,

src/Date/DatePickerInput.shared.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ export type DatePickerInputProps = {
1414
hasError?: boolean
1515
onValidationError?: ((error: string | null) => void) | undefined
1616
calendarIcon?: string
17+
iconSize?: number
18+
iconStyle?: React.CSSProperties
19+
iconColor?: string
1720
saveLabel?: string
1821
saveLabelDisabled?: boolean
1922
uppercase?: boolean

src/Date/DatePickerInput.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import DatePickerModal from './DatePickerModal'
55
import { useLatest } from '../utils'
66
import type { DatePickerInputProps } from './DatePickerInput.shared'
77
import DatePickerInputWithoutModal from './DatePickerInputWithoutModal'
8+
import { StyleProp } from 'react-native'
9+
import { ViewStyle } from 'react-native'
810

911
function DatePickerInput(
1012
{
@@ -34,10 +36,12 @@ function DatePickerInput(
3436
inputButton={
3537
withModal ? (
3638
<TextInput.Icon
37-
size={24}
39+
size={rest.iconSize ?? 24}
3840
icon={calendarIcon}
41+
color={rest.iconColor ?? undefined}
3942
disabled={rest.disabled}
4043
onPress={() => setVisible(true)}
44+
style={rest.iconStyle as StyleProp<ViewStyle>}
4145
/>
4246
) : null
4347
}

0 commit comments

Comments
 (0)