Skip to content

Commit e0f580f

Browse files
Merge pull request #120 from iM-GeeKy/uppercase-prop
Introduce uppercase prop.
2 parents 33b8073 + f152a67 commit e0f580f

File tree

9 files changed

+22
-4
lines changed

9 files changed

+22
-4
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ export default function ReadMeExampleSingle() {
137137
// }}
138138
// onChange={} // same props as onConfirm but triggered without confirmed by user
139139
// saveLabel="Save" // optional
140+
// uppercase={false} // optional, default is true
140141
// label="Select date" // optional
141142
// animationType="slide" // optional, default is 'slide' on ios/android and 'none' on web
142143
/>
@@ -192,6 +193,7 @@ export default function ReadMeExampleRange() {
192193
// }}
193194
// onChange={} // same props as onConfirm but triggered without confirmed by user
194195
// saveLabel="Save" // optional
196+
// uppercase={false} // optional, default is true
195197
// label="Select period" // optional
196198
// startLabel="From" // optional
197199
// endLabel="To" // optional
@@ -245,6 +247,7 @@ export default function ReadMeExampleMultiple() {
245247
// disabledDates: [new Date()] // optional
246248
// }}
247249
// saveLabel="Save" // optional
250+
// uppercase={false} // optional, default is true
248251
// label="Select period" // optional
249252
// startLabel="From" // optional
250253
// endLabel="To" // optional
@@ -307,6 +310,7 @@ export default function TimePickerPage() {
307310
hours={12} // default: current hours
308311
minutes={14} // default: current minutes
309312
label="Select time" // optional, default 'Select time'
313+
uppercase={false} // optional, default is true
310314
cancelLabel="Cancel" // optional, default: 'Cancel'
311315
confirmLabel="Ok" // optional, default: 'Ok'
312316
animationType="fade" // optional, default is 'none'

example/src/App.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ function App() {
315315
onConfirm={onChangeRange}
316316
// locale={'nl'} // optional
317317
// saveLabel="Save" // optional
318+
// uppercase={false} // optional, default is true
318319
// label="Select period" // optional
319320
// startLabel="From" // optional
320321
// endLabel="To" // optional
@@ -335,6 +336,7 @@ function App() {
335336
// endDate: new Date(), // optional
336337
}}
337338
// saveLabel="Save" // optional
339+
// uppercase={false} // optional, default is true
338340
// label="Select date" // optional
339341
// animationType="slide" // optional, default is 'slide' on ios/android and 'none' on web
340342
/>
@@ -352,6 +354,7 @@ function App() {
352354
// moreLabel="more" // optional, if multiple are selected this will show if we can't show all dates
353355
// onChange={onChangeMulti}
354356
// saveLabel="Save" // optional
357+
// uppercase={false} // optional, default is true
355358
// label="Select date" // optional
356359
// animationType="slide" // optional, default is 'slide' on ios/android and 'none' on web
357360
/>

example/src/ReadMeExampleMultiple.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export default function ReadMeExampleMultiple() {
3737
// }}
3838
// locale={'nl'} // optional
3939
// saveLabel="Save" // optional
40+
// uppercase={false} // optional, default is true
4041
// label="Select period" // optional
4142
// startLabel="From" // optional
4243
// endLabel="To" // optional

example/src/ReadMeExampleRange.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export default function ReadMeExampleRange() {
4444
// onChange={} // same props as onConfirm but triggered without confirmed by user
4545
// locale={'nl'} // optional
4646
// saveLabel="Save" // optional
47+
// uppercase={false} // optional, default is true
4748
// label="Select period" // optional
4849
// startLabel="From" // optional
4950
// endLabel="To" // optional

example/src/ReadMeExampleSingle.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export default function ReadMeExampleSingle() {
3737
// }}
3838
// onChange={} // same props as onConfirm but triggered without confirmed by user
3939
// saveLabel="Save" // optional
40+
// uppercase={false} // optional, default is true
4041
// label="Select date" // optional
4142
// animationType="slide" // optional, default is 'slide' on ios/android and 'none' on web
4243
/>

src/Date/DatePickerModalContent.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ export function DatePickerModalContent(
142142
onSave={onInnerConfirm}
143143
onDismiss={onDismiss}
144144
saveLabel={props.saveLabel}
145+
uppercase={props.uppercase ?? true}
145146
disableSafeTop={disableSafeTop}
146147
/>
147148
<DatePickerModalContentHeader
@@ -155,6 +156,7 @@ export function DatePickerModalContent(
155156
moreLabel={props.moreLabel}
156157
startLabel={props.startLabel}
157158
endLabel={props.endLabel}
159+
uppercase={props.uppercase ?? true}
158160
locale={locale}
159161
/>
160162
</DatePickerModalHeaderBackground>

src/Date/DatePickerModalContentHeader.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export interface HeaderPickProps {
1212
label?: string
1313
emptyLabel?: string
1414
saveLabel?: string
15+
uppercase?: boolean
1516
headerSeparator?: string
1617
startLabel?: string
1718
endLabel?: string
@@ -48,7 +49,7 @@ function getLabel(
4849
export default function DatePickerModalContentHeader(
4950
props: HeaderContentProps
5051
) {
51-
const { onToggle, collapsed, mode, moreLabel } = props
52+
const { onToggle, collapsed, mode, moreLabel, uppercase } = props
5253

5354
const label = getLabel(props.locale, props.mode, props.label)
5455

@@ -57,7 +58,7 @@ export default function DatePickerModalContentHeader(
5758
return (
5859
<View style={[styles.header]}>
5960
<View>
60-
<Text style={[styles.label, { color }]}>{label.toUpperCase()}</Text>
61+
<Text style={[styles.label, { color }]}>{uppercase ? label.toUpperCase() : label}</Text>
6162

6263
<View style={styles.headerContentContainer}>
6364
{mode === 'range' ? (

src/Date/DatePickerModalHeader.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { getTranslation } from '../translations/utils'
88
export interface DatePickerModalHeaderProps {
99
disableSafeTop?: boolean
1010
saveLabel?: string
11+
uppercase?: boolean
1112
onDismiss: () => void
1213
onSave: () => void
1314
locale: string | undefined
@@ -43,6 +44,7 @@ export default function DatePickerModalHeader(
4344
<Button
4445
color={color}
4546
onPress={props.onSave}
47+
uppercase={props.uppercase ?? true}
4648
testID="react-native-paper-dates-save"
4749
>
4850
{saveLabel}

src/Time/TimePickerModal.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,15 @@ export function TimePickerModal({
3535
hours,
3636
minutes,
3737
label = 'Select time',
38+
uppercase = true,
3839
cancelLabel = 'Cancel',
3940
confirmLabel = 'Ok',
4041
animationType = 'none',
4142
locale,
4243
}: {
4344
locale?: undefined | string
4445
label?: string
46+
uppercase?: boolean
4547
cancelLabel?: string
4648
confirmLabel?: string
4749
hours?: number | undefined
@@ -134,7 +136,7 @@ export function TimePickerModal({
134136
>
135137
<View style={styles.labelContainer}>
136138
<Text style={[styles.label, { color: theme.colors.text }]}>
137-
{label.toUpperCase()}
139+
{uppercase ? label.toUpperCase() : label}
138140
</Text>
139141
</View>
140142
<View style={styles.timePickerContainer}>
@@ -160,11 +162,12 @@ export function TimePickerModal({
160162
tvParallaxProperties={undefined}
161163
/>
162164
<View style={styles.fill} />
163-
<Button onPress={onDismiss}>{cancelLabel}</Button>
165+
<Button onPress={onDismiss} uppercase={uppercase}>{cancelLabel}</Button>
164166
<Button
165167
onPress={() =>
166168
onConfirm({ hours: localHours, minutes: localMinutes })
167169
}
170+
uppercase={uppercase}
168171
>
169172
{confirmLabel}
170173
</Button>

0 commit comments

Comments
 (0)