Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

react native expo is there a custom date time picker work on iOS and android

I found a bunch of date time picker project on github, none of the work with expo. Or have to react-link which I can't because I'm in expo 100% js. Could be there a usable project somewhere?

like image 288
angry kiwi Avatar asked Jun 03 '19 16:06

angry kiwi


People also ask

How do I add a Date and time picker in react-native?

import React, {useState} from 'react'; import {View, Button, Platform, SafeAreaView , StyleSheet} from 'reactnative'; import DateTimePicker from '@react-native-community/datetimepicker'; export default function App() { const [mydate, setDate] = useState(new Date()); const [displaymode, setMode] = useState('time'); ...


2 Answers

react-native-modal-datetime-picker https://github.com/mmazzarolo/react-native-modal-datetime-picker

You can also find other expo compatible components at https://www.native.directory/

like image 55
roel Avatar answered Oct 10 '22 16:10

roel


Right now they recommend using reaact-native-community/react-native-datetimepicker It works quite well.

installation with

expo install @react-native-community/datetimepicker

Expo themselves don't have a lot in their documentation but you can find it here: expo datetimepicker docs

A very basic usage looks like this:

<DateTimePicker value={date}
                mode={mode}
                is24Hour={true}
                display="default"
                onChange={this.setDate} />

You can read a bunch more on this component in the readme file of the official component docs.

like image 40
Manuel Bichler Avatar answered Oct 10 '22 14:10

Manuel Bichler