Skip to content

Commit 26e3450

Browse files
committed
Input enabled appears to work.
1 parent 34da2d4 commit 26e3450

10 files changed

+50
-38
lines changed

example/src/App.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,6 @@ function App() {
311311
<DatePickerModal
312312
locale={locale}
313313
mode="single"
314-
inputEnabled={true}
315314
visible={singleOpen}
316315
onDismiss={onDismissSingle}
317316
date={date}

src/Date/DatePickerInput.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ function DatePickerInput(
5454
uppercase,
5555
startYear,
5656
endYear,
57+
inputEnabled,
5758
}) =>
5859
withModal ? (
5960
<DatePickerModal
@@ -70,6 +71,7 @@ function DatePickerInput(
7071
uppercase={uppercase ?? true}
7172
startYear={startYear ?? 1800}
7273
endYear={endYear ?? 2200}
74+
inputEnabled={inputEnabled}
7375
/>
7476
) : null
7577
}

src/Date/DatePickerInputWithoutModal.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,16 @@ function DatePickerInputWithoutModal(
6161
onValidationError,
6262
})
6363

64+
let disabled
65+
66+
if (inputEnabled !== undefined) {
67+
disabled = !inputEnabled
68+
}
69+
70+
if (rest.disabled) {
71+
disabled = rest.disabled
72+
}
73+
6474
return (
6575
<>
6676
<View style={styles.root}>
@@ -77,7 +87,7 @@ function DatePickerInputWithoutModal(
7787
value={formattedValue}
7888
keyboardType={rest.keyboardType ?? 'number-pad'}
7989
mask={inputFormat}
80-
disabled={!inputEnabled}
90+
disabled={disabled}
8191
onChangeText={onDateInputChangeText}
8292
onChange={(e) => onChangeText && onChangeText(e.nativeEvent.text)}
8393
keyboardAppearance={theme.dark ? 'dark' : 'default'}

src/Date/DatePickerModal.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ interface DatePickerModalProps {
2222
animationType?: 'slide' | 'fade' | 'none'
2323
disableStatusBar?: boolean
2424
disableStatusBarPadding?: boolean
25-
dateInput?: boolean
25+
inputEnabled?: boolean
2626
}
2727

2828
export interface DatePickerModalSingleProps
@@ -50,7 +50,7 @@ export function DatePickerModal(
5050
animationType,
5151
disableStatusBar,
5252
disableStatusBarPadding,
53-
dateInput,
53+
inputEnabled,
5454
...rest
5555
} = props
5656
const animationTypeCalculated =
@@ -114,7 +114,7 @@ export function DatePickerModal(
114114
)}
115115
<DatePickerModalContent
116116
{...rest}
117-
inputEnabled={dateInput}
117+
inputEnabled={inputEnabled}
118118
disableSafeTop={disableStatusBar}
119119
/>
120120
</View>

src/Date/DatePickerModalContent.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ export function DatePickerModalContent(
196196
onChange={onInnerChange}
197197
validRange={validRange}
198198
locale={locale}
199+
inputEnabled={props.inputEnabled}
199200
/>
200201
}
201202
/>

src/TextInputMask.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ function TextInputWithMask(
100100
return (
101101
<TextInput
102102
ref={ref}
103-
disabled={disabled}
104103
{...rest}
104+
disabled={disabled}
105105
value={controlledValue}
106106
onChangeText={onInnerChange}
107107
onChange={(e) => {

src/__tests__/Date/__snapshots__/AnimatedCrossView.test.tsx.snap

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3506,7 +3506,7 @@ exports[`renders collapsed AnimatedCrossView 1`] = `
35063506
style={
35073507
[
35083508
{
3509-
"backgroundColor": "rgba(29, 25, 43, 0.08)",
3509+
"backgroundColor": "rgba(231, 224, 236, 1)",
35103510
"borderTopLeftRadius": 4,
35113511
"borderTopRightRadius": 4,
35123512
},
@@ -3520,7 +3520,7 @@ exports[`renders collapsed AnimatedCrossView 1`] = `
35203520
collapsable={false}
35213521
style={
35223522
{
3523-
"backgroundColor": "rgba(28, 27, 31, 0.38)",
3523+
"backgroundColor": "rgba(28, 27, 31, 1)",
35243524
"bottom": 0,
35253525
"height": 1,
35263526
"left": 0,
@@ -3576,7 +3576,7 @@ exports[`renders collapsed AnimatedCrossView 1`] = `
35763576
onLayout={[Function]}
35773577
style={
35783578
{
3579-
"color": "rgba(28, 27, 31, 0.38)",
3579+
"color": "rgba(103, 80, 164, 1)",
35803580
"fontFamily": "System",
35813581
"fontSize": 16,
35823582
"fontWeight": undefined,
@@ -3613,7 +3613,7 @@ exports[`renders collapsed AnimatedCrossView 1`] = `
36133613
numberOfLines={1}
36143614
style={
36153615
{
3616-
"color": "rgba(28, 27, 31, 0.38)",
3616+
"color": "rgba(73, 69, 79, 1)",
36173617
"fontFamily": "System",
36183618
"fontSize": 16,
36193619
"fontWeight": undefined,
@@ -3647,7 +3647,7 @@ exports[`renders collapsed AnimatedCrossView 1`] = `
36473647
</View>
36483648
<TextInput
36493649
autoComplete="off"
3650-
editable={false}
3650+
editable={true}
36513651
keyboardAppearance="default"
36523652
keyboardType="number-pad"
36533653
maxFontSizeMultiplier={1.5}
@@ -3658,8 +3658,8 @@ exports[`renders collapsed AnimatedCrossView 1`] = `
36583658
onFocus={[Function]}
36593659
onSubmitEditing={[Function]}
36603660
placeholder=" "
3661-
placeholderTextColor="rgba(28, 27, 31, 0.38)"
3662-
selectionColor="rgba(28, 27, 31, 0.38)"
3661+
placeholderTextColor="rgba(73, 69, 79, 1)"
3662+
selectionColor="rgba(103, 80, 164, 1)"
36633663
style={
36643664
[
36653665
{
@@ -3678,7 +3678,7 @@ exports[`renders collapsed AnimatedCrossView 1`] = `
36783678
"paddingTop": 24,
36793679
},
36803680
{
3681-
"color": "rgba(28, 27, 31, 0.38)",
3681+
"color": "rgba(73, 69, 79, 1)",
36823682
"fontFamily": "System",
36833683
"fontSize": 16,
36843684
"fontWeight": undefined,

src/__tests__/Date/__snapshots__/CalendarEdit.test.tsx.snap

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ exports[`renders CalendarEdit 1`] = `
2929
style={
3030
[
3131
{
32-
"backgroundColor": "rgba(29, 25, 43, 0.08)",
32+
"backgroundColor": "rgba(231, 224, 236, 1)",
3333
"borderTopLeftRadius": 4,
3434
"borderTopRightRadius": 4,
3535
},
@@ -43,7 +43,7 @@ exports[`renders CalendarEdit 1`] = `
4343
collapsable={false}
4444
style={
4545
{
46-
"backgroundColor": "rgba(28, 27, 31, 0.38)",
46+
"backgroundColor": "rgba(28, 27, 31, 1)",
4747
"bottom": 0,
4848
"height": 1,
4949
"left": 0,
@@ -99,7 +99,7 @@ exports[`renders CalendarEdit 1`] = `
9999
onLayout={[Function]}
100100
style={
101101
{
102-
"color": "rgba(28, 27, 31, 0.38)",
102+
"color": "rgba(103, 80, 164, 1)",
103103
"fontFamily": "System",
104104
"fontSize": 16,
105105
"fontWeight": undefined,
@@ -136,7 +136,7 @@ exports[`renders CalendarEdit 1`] = `
136136
numberOfLines={1}
137137
style={
138138
{
139-
"color": "rgba(28, 27, 31, 0.38)",
139+
"color": "rgba(73, 69, 79, 1)",
140140
"fontFamily": "System",
141141
"fontSize": 16,
142142
"fontWeight": undefined,
@@ -170,7 +170,7 @@ exports[`renders CalendarEdit 1`] = `
170170
</View>
171171
<TextInput
172172
autoComplete="off"
173-
editable={false}
173+
editable={true}
174174
keyboardAppearance="default"
175175
keyboardType="number-pad"
176176
maxFontSizeMultiplier={1.5}
@@ -181,8 +181,8 @@ exports[`renders CalendarEdit 1`] = `
181181
onFocus={[Function]}
182182
onSubmitEditing={[Function]}
183183
placeholder=" "
184-
placeholderTextColor="rgba(28, 27, 31, 0.38)"
185-
selectionColor="rgba(28, 27, 31, 0.38)"
184+
placeholderTextColor="rgba(73, 69, 79, 1)"
185+
selectionColor="rgba(103, 80, 164, 1)"
186186
style={
187187
[
188188
{
@@ -201,7 +201,7 @@ exports[`renders CalendarEdit 1`] = `
201201
"paddingTop": 24,
202202
},
203203
{
204-
"color": "rgba(28, 27, 31, 0.38)",
204+
"color": "rgba(73, 69, 79, 1)",
205205
"fontFamily": "System",
206206
"fontSize": 16,
207207
"fontWeight": undefined,

src/__tests__/Date/__snapshots__/DatePickerInput.test.tsx.snap

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ exports[`renders DatePickerInput 1`] = `
2323
style={
2424
[
2525
{
26-
"backgroundColor": "rgba(29, 25, 43, 0.08)",
26+
"backgroundColor": "rgba(231, 224, 236, 1)",
2727
"borderTopLeftRadius": 4,
2828
"borderTopRightRadius": 4,
2929
},
@@ -37,7 +37,7 @@ exports[`renders DatePickerInput 1`] = `
3737
collapsable={false}
3838
style={
3939
{
40-
"backgroundColor": "rgba(28, 27, 31, 0.38)",
40+
"backgroundColor": "rgba(28, 27, 31, 1)",
4141
"bottom": 0,
4242
"height": 1,
4343
"left": 0,
@@ -93,7 +93,7 @@ exports[`renders DatePickerInput 1`] = `
9393
onLayout={[Function]}
9494
style={
9595
{
96-
"color": "rgba(28, 27, 31, 0.38)",
96+
"color": "rgba(103, 80, 164, 1)",
9797
"fontFamily": "System",
9898
"fontSize": 16,
9999
"fontWeight": undefined,
@@ -130,7 +130,7 @@ exports[`renders DatePickerInput 1`] = `
130130
numberOfLines={1}
131131
style={
132132
{
133-
"color": "rgba(28, 27, 31, 0.38)",
133+
"color": "rgba(73, 69, 79, 1)",
134134
"fontFamily": "System",
135135
"fontSize": 16,
136136
"fontWeight": undefined,
@@ -164,7 +164,7 @@ exports[`renders DatePickerInput 1`] = `
164164
</View>
165165
<TextInput
166166
autoComplete="birthdate-full"
167-
editable={false}
167+
editable={true}
168168
keyboardAppearance="default"
169169
keyboardType="number-pad"
170170
maxFontSizeMultiplier={1.5}
@@ -174,8 +174,8 @@ exports[`renders DatePickerInput 1`] = `
174174
onChangeText={[Function]}
175175
onFocus={[Function]}
176176
placeholder=" "
177-
placeholderTextColor="rgba(28, 27, 31, 0.38)"
178-
selectionColor="rgba(28, 27, 31, 0.38)"
177+
placeholderTextColor="rgba(73, 69, 79, 1)"
178+
selectionColor="rgba(103, 80, 164, 1)"
179179
style={
180180
[
181181
{
@@ -194,7 +194,7 @@ exports[`renders DatePickerInput 1`] = `
194194
"paddingTop": 24,
195195
},
196196
{
197-
"color": "rgba(28, 27, 31, 0.38)",
197+
"color": "rgba(73, 69, 79, 1)",
198198
"fontFamily": "System",
199199
"fontSize": 16,
200200
"fontWeight": undefined,

src/__tests__/Date/__snapshots__/DatePickerInputWithoutModal.test.tsx.snap

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ exports[`renders DatePickerInput 1`] = `
2222
style={
2323
[
2424
{
25-
"backgroundColor": "rgba(29, 25, 43, 0.08)",
25+
"backgroundColor": "rgba(231, 224, 236, 1)",
2626
"borderTopLeftRadius": 4,
2727
"borderTopRightRadius": 4,
2828
},
@@ -36,7 +36,7 @@ exports[`renders DatePickerInput 1`] = `
3636
collapsable={false}
3737
style={
3838
{
39-
"backgroundColor": "rgba(28, 27, 31, 0.38)",
39+
"backgroundColor": "rgba(28, 27, 31, 1)",
4040
"bottom": 0,
4141
"height": 1,
4242
"left": 0,
@@ -92,7 +92,7 @@ exports[`renders DatePickerInput 1`] = `
9292
onLayout={[Function]}
9393
style={
9494
{
95-
"color": "rgba(28, 27, 31, 0.38)",
95+
"color": "rgba(103, 80, 164, 1)",
9696
"fontFamily": "System",
9797
"fontSize": 16,
9898
"fontWeight": undefined,
@@ -129,7 +129,7 @@ exports[`renders DatePickerInput 1`] = `
129129
numberOfLines={1}
130130
style={
131131
{
132-
"color": "rgba(28, 27, 31, 0.38)",
132+
"color": "rgba(73, 69, 79, 1)",
133133
"fontFamily": "System",
134134
"fontSize": 16,
135135
"fontWeight": undefined,
@@ -163,7 +163,7 @@ exports[`renders DatePickerInput 1`] = `
163163
</View>
164164
<TextInput
165165
autoComplete="birthdate-full"
166-
editable={false}
166+
editable={true}
167167
keyboardAppearance="default"
168168
keyboardType="number-pad"
169169
maxFontSizeMultiplier={1.5}
@@ -173,8 +173,8 @@ exports[`renders DatePickerInput 1`] = `
173173
onChangeText={[Function]}
174174
onFocus={[Function]}
175175
placeholder=" "
176-
placeholderTextColor="rgba(28, 27, 31, 0.38)"
177-
selectionColor="rgba(28, 27, 31, 0.38)"
176+
placeholderTextColor="rgba(73, 69, 79, 1)"
177+
selectionColor="rgba(103, 80, 164, 1)"
178178
style={
179179
[
180180
{
@@ -193,7 +193,7 @@ exports[`renders DatePickerInput 1`] = `
193193
"paddingTop": 24,
194194
},
195195
{
196-
"color": "rgba(28, 27, 31, 0.38)",
196+
"color": "rgba(73, 69, 79, 1)",
197197
"fontFamily": "System",
198198
"fontSize": 16,
199199
"fontWeight": undefined,

0 commit comments

Comments
 (0)