如何禁用 react-native-datetime-picker 中的特定日期?
How to disable specific dates in react-native-datetime-picker?
可以在 react-day-picker 中禁用日期,但我找不到在 react-native-datetime-picker 中禁用特定日期的方法。可以禁用某个日期范围但不能禁用特定日期。
是否可以在 react-native-datetime-picker 中禁用某些日期?
你不能为此使用 react-native-date-picker。但是有可用的库。它是 react-native-calendars
。下面的代码片段会给你如何去做的想法。
const vacation = {key:'vacation', color: 'red', selectedDotColor: 'blue'};
const massage = {key:'massage', color: 'blue', selectedDotColor: 'blue'};
const workout = {key:'workout', color: 'green'};
<Calendar
markedDates={{
'2017-10-25': {dots: [vacation, massage, workout], selected: true, selectedColor: 'red'},
'2017-10-26': {dots: [massage, workout], disabled: true}
}}
markingType={'multi-dot'}
/>
了解更多信息react-native-calendars
可以在 react-day-picker 中禁用日期,但我找不到在 react-native-datetime-picker 中禁用特定日期的方法。可以禁用某个日期范围但不能禁用特定日期。 是否可以在 react-native-datetime-picker 中禁用某些日期?
你不能为此使用 react-native-date-picker。但是有可用的库。它是 react-native-calendars
。下面的代码片段会给你如何去做的想法。
const vacation = {key:'vacation', color: 'red', selectedDotColor: 'blue'};
const massage = {key:'massage', color: 'blue', selectedDotColor: 'blue'};
const workout = {key:'workout', color: 'green'};
<Calendar
markedDates={{
'2017-10-25': {dots: [vacation, massage, workout], selected: true, selectedColor: 'red'},
'2017-10-26': {dots: [massage, workout], disabled: true}
}}
markingType={'multi-dot'}
/>
了解更多信息react-native-calendars