简体   繁体   English

如何仅使用 Calendar Strip React Native npm package 创建和显示事件?

[英]How to create and display an event only with Calendar Strip React Native npm package?

I am a newbie in React Native and Expo world, and I have read the documentation of Calendars in React Native and Expo.我是 React Native 和 Expo 世界的新手,我已经阅读了 React Native 和 Expo 中的日历文档。 I also saw a great npm package called Calendar Strip, which is what I want for my application.我还看到了一个很棒的 npm package,叫做 Calendar Strip,这是我想要的应用程序。 But I am confused on one thing, onDateSelected() props for this package, how can create an event or just display a based on a specific date.但我对一件事感到困惑,这个 package 的 onDateSelected() 道具,如何创建一个事件或只显示一个基于特定日期的事件。

For example, July, 10th, 2022 should show a specific view container but other dates should not show that view as a component can be called on that particular date only.例如,2022 年 7 月 10 日应显示特定的视图容器,但其他日期不应显示该视图作为组件只能在该特定日期调用。 Hope I am clear on this.希望我对此很清楚。 Appreciate your help.感谢你的帮助。

Or if the same can be done with any well-known package or library, that would be appreciated.或者,如果可以对任何知名的 package 或库进行同样的操作,那将不胜感激。

Link for the npm package: https://www.npmjs.com/package/react-native-calendar-strip npm package 的链接: https://www.npmjs.com/package/react-native-calendar-strip

the answer is "coding new app"!答案是“编写新应用程序”! :)))) Any way, you should know that "Calendar Strip" is just an appearance for your code. :)))) 无论如何,您应该知道“日历条”只是您的代码的外观。 to add or delete event you can use expo calendar .要添加或删除事件,您可以使用expo calendar

I have figured out what was wrong with my code.我已经弄清楚我的代码出了什么问题。 I was using the useEffect hook in the wrong way, I just had to put currentDate in the array to check if the componentDidUpdate based on my events, before it was empty [] and it was just working on componentDidMount, now I am passing [currentDate] to check if there was an event on this date.我以错误的方式使用了useEffect挂钩,我只需要将currentDate放入数组中以检查componentDidUpdate是否基于我的事件,在它为空之前[]并且它只是在componentDidMount上工作,现在我正在传递[currentDate ] 检查该日期是否有事件。 No fault with the Calendar-Strip package for React Native.用于 React Native 的 Calendar-Strip package 没有故障。 It works absolutely fine.它工作得很好。 That's answers my question.那就是回答我的问题。 If anyone needs any help with any future references, please bring the issue.如果有人在未来的参考资料方面需要任何帮助,请提出问题。 Cheers.干杯。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM