react-native DatePicker --- 'react-native-datepicker' 小坑


經常需要二級聯動的日期上面, DatePicker在模擬器和真機上面有一點小差別,
我們經常需要 截止時間不小於開始時間,在模擬器上,
開始時間

結束時間,但是結束時間可以比開始時間提前一天!

在真機上測試時,就是正常的。
<DatePicker
style={{width: pTd(130)}}
date={this.state.createTimeStart}
mode="date"
placeholder="生產日期"
format="YYYY-MM-DD"
minDate="2016-05-01"
maxDate="2040-06-01"
confirmBtnText="Confirm"
cancelBtnText="Cancel"
customStyles={{
dateIcon: {
display: 'none'
},
dateInput: {
height: pTd(32),
// marginLeft: 36
}
// ... You can check the source to find the other keys.
}}
onDateChange={(date) => {
this.setState({
createTimeStart: date,
createTimeEnd: date
})
}}
/>

<DatePicker
style={{width: pTd(130)}}
date={this.state.createTimeEnd}
mode="date"
placeholder="生產日期"
format="YYYY-MM-DD"
minDate={this.state.createTimeStart == "" ? "2016-05-01" : this.state.createTimeStart}
maxDate="2040-06-01"
confirmBtnText="Confirm"
cancelBtnText="Cancel"
customStyles={{
dateIcon: {
display: 'none'
},
dateInput: {
height: pTd(32),
// marginLeft: 36
}
// ... You can check the source to find the other keys.
}}
onDateChange={(date) => {
this.setState({
createTimeEnd: date,
createTimeStart: this.state.createTimeStart == "" ? date : this.state.createTimeStart
})
}}
/>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM