React Native DateTime
A datetime-picker for react-native support for android and ios(base on @remobile/react-native-datetime-picker)
Installation
npm install react-native-datetime-zic --save
Installation (iOS)
- not need install, on ios use js write
Installation (Android)
- In
android/settings.gradle
...include ':react-native-datetime'project(':react-native-datetime').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-datetime/android')
- In
android/app/build.gradle
...dependencies { ... compile project(':react-native-datetime')}
- register module (in MainActivity.java)
On newer versions of React Native (0.18+):
// <--- import
On older versions of React Native:
// <--- import
Screencasts
- ios
- android
Usage
use as follows:
<DateTimePicker ref={thispicker=picker}/>...thispickerthispickerthispicker
- on ios, make sure must on topest view
Example
'use strict'; var React = ;var StyleSheet TouchableOpacity View Text = React; var DateTimePicker = default;var Button = ; moduleexports = React; var styles = StyleSheet;
Methods
- showDatePicker(date, callback(date))
- showTimePicker(date, callback(date))
- showDateTimePicker(date, callback(date))
Props
- cancelText (default: Cancel)
- okText (default: Ok)