Skip to content

Commit 081015e

Browse files
Update example app with button to display picker
1 parent 10feb66 commit 081015e

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

example/App.js

+27-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ import {
1313
Alert,
1414
FlatList,
1515
} from 'react-native';
16-
import DateTimePicker from '@react-native-community/datetimepicker';
16+
import DateTimePicker, {
17+
MaterialRangePicker,
18+
} from '@react-native-community/datetimepicker';
1719
import SegmentedControl from './SegmentedControl';
1820
import {Colors} from 'react-native/Libraries/NewAppScreen';
1921
import React, {useRef, useState} from 'react';
@@ -216,6 +218,22 @@ export const App = () => {
216218
setMaximumDate(minimumDate ? undefined : endOfTomorrowUTC);
217219
};
218220

221+
const handleShowRangePicker = () => {
222+
MaterialRangePicker.open({
223+
fullscreen: isFullscreen,
224+
initialInputMode: inputMode,
225+
maximumDate,
226+
minimumDate,
227+
title,
228+
timeZoneOffsetInMinutes: tzOffsetInMinutes,
229+
timeZoneName: tzName,
230+
dialogButtons: {
231+
negative: {label: 'Nope'},
232+
positive: {label: 'Yes'},
233+
},
234+
});
235+
};
236+
219237
if (Platform.OS !== 'windows') {
220238
return (
221239
<SafeAreaView
@@ -435,6 +453,14 @@ export const App = () => {
435453
title="Show and dismiss picker!"
436454
/>
437455
</View>
456+
<View style={styles.header}>
457+
<ThemedText style={styles.textLabel}>
458+
[android] show range picker
459+
</ThemedText>
460+
</View>
461+
<View style={styles.button}>
462+
<Button onPress={handleShowRangePicker} title="Show range picker" />
463+
</View>
438464
<View
439465
style={[
440466
styles.button,

0 commit comments

Comments
 (0)