I am using DatePickerIOS, here is an example of how I would do it:
import React, {
AppRegistry,
Component,
StyleSheet,
Text,
TouchableOpacity,
TextInput,
View,
DatePickerIOS
} from "react-native";
var moment = require('moment');
class AddChildVisit extends Component {
constructor(props) {
super(props);
this.state = {
date: new Date(),
showDatePicker: false
}
}
render() {
var showDatePicker = this.state.showDatePicker ?
<DatePickerIOS
style={{ height: 150 }}
date={this.state.date} onDateChange={(date)=>this.setState({date})}
mode="date"/> : <View />
return (
<View>
<Text>Visit Date</Text>
<TouchableOpacity style={{height: 40, width: 300, padding: 4, borderColor: 'gray', borderWidth: 1}}
onPress={() => this.setState({showDatePicker: !this.state.showDatePicker})}>
<Text>{moment(this.state.date).format('DD/MM/YYYY')}</Text>
</TouchableOpacity>
{showDatePicker}
</View>
);
}
}
module.exports = AddChildVisit;
TouchableOpacity, , , , , . , , .. , : npm install moment --save, var moment = require('moment') {moment(this.state.date).format('DD/MM/YYYY')}. / , , . , TextInput, , , . , :)