【问题标题】:React native calendar wix/react-native-calendars multi-dot not working反应本机日历 wix/react-native-calendars 多点不起作用
【发布时间】:2021-09-23 08:32:31
【问题描述】:

您好,我需要更新日历上的多点以了解每月的变化

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

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

【问题讨论】:

    标签: reactjs react-native react-native-calendars


    【解决方案1】:

    因为标记的日期对我不起作用。我已经使用渲染日道具来实现每天下的点

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-02-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多