Created
September 26, 2017 13:01
-
-
Save chuyihuang/da7badeab22f4fe580734d47d59534a9 to your computer and use it in GitHub Desktop.
week_7_demo7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react' | |
import { View, Text } from 'react-native'; | |
import DatePicker from 'react-native-datepicker' | |
export default class DatePickerExample extends Component { | |
constructor(props){ | |
super(props) | |
this.state = {date:"2016-05-15"} | |
} | |
render(){ | |
return ( | |
<View style={{marginTop: 100, alignItems: 'center'}}> | |
<DatePicker | |
style={{width: 200}} | |
date={this.state.date} | |
mode="date" | |
placeholder="select date" | |
format="YYYY-MM-DD" | |
maxDate="2017-10-01" | |
confirmBtnText="Confirm" | |
cancelBtnText="Cancel" | |
customStyles={{ | |
dateIcon: { | |
position: 'absolute', | |
left: 0, | |
top: 4, | |
marginLeft: 0 | |
}, | |
dateInput: { | |
marginLeft: 36 | |
} | |
}} | |
onDateChange={(date) => {this.setState({date: date})}} | |
/> | |
<Text>選擇日期{this.state.date}</Text> | |
</View> | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment