내 프로젝트에서 react-native-material-calandarview를 다운로드했습니다.react calendar에서 선택한 날짜를 얻는 방법은 무엇입니까?
그들은 일정을 잡기 위해 일부 코드를 제공합니다. https://github.com/NuclleaR/react-native-material-calendarview.
방금 datesSelection={'range'}
을 선택했지만 선택한 날짜를 어디서 얻었는지 알지 못합니다. datesSelection={'single'}
경우는
onDateChange={data => {
console.log(data.date);//date selected
}}
더 코드 날짜를 반환 :
render() {
return (
<Calendar
width={(Dimensions.get('window').width)-32}
height={280}
tileHeight={35}
style={{alignSelf: 'center'}}
topbarVisible={true}
datesSelection={'range'}
firstDayOfWeek="monday"
showOtherDates="none"
currentDate={this.state.today}
selectedDates={this.state.dates}
eventsDates={[]}
eventsColor="#9C27B0"
onDateChange={data => {
//alert(sel_date);
console.log(this.state.data);
}}
onMonthChange={month => {
//alert(month)
console.log(month);
}}
/>
);
}
이것을 사용해 보셨습니까 ?? 나는 그것을 작동하게 할 수 없다 ??. 'range'로 변경하면 onDateChange는 첫 번째 날짜를 선택한 경우에만 호출되며 두 번째 선택에서는 실행되지 않습니다. –