反应本机日历 wix/react-native-calendars 多点不工作

React native calendar wix/react-native-calendars multi-dot not working

您好,我需要在月度变化时更新日历上的多点

它似乎只在调试模式下工作。该文档说标记的日期对象是不可变的。如何在新的 markedDates 对象上刷新日历

const [calenderDots, setCalenderDots] = useState({});

const pins = [
  { key: 'medication', color: 'green' },
  { key: 'doctorNote', color: 'red' },
];

const formatDots = (data) => {
  return data.reduce((initial, current) => {
    return Object.assign(initialValue, { [data?.date]: { dots: pins } });
  });
};

const fetchMonthlyData = async (date) => {
  const response = await fetchData(date);
  setCalenderDots(formatDots(response));
};

return <Calendar onMonthChange={fetchMonthlyData} markedDates={calenderDots} />;

关于这个问题的任何想法。我找不到更好的解决方案。请帮忙

我正面临这个issue

因为标记的日期不适合我。我已经使用渲染日道具在每一天下实现点

return <Calendar 
         onMonthChange={fetchMonthlyData} 
         //markedDates={calenderDots}
         dayComponent={({date})=><CustomDotsComponent date={date} />}
         />;

//dots <Text>&bull;</Text>