How to use the react-native-calendar-events.fetchAllEvents function in react-native-calendar-events

To help you get started, we’ve selected a few react-native-calendar-events examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Vizards / uestc-react-native-ios / scene / Course / containers / Calendar.js View on Github external
{text: '继续', style: 'warning', onPress: async () => {
            // 时间跨度超过 5 年,就不能获取到了...
            const startDate = moment().subtract(4, 'years').toISOString();
            const endDate = moment().add(1, 'years').toISOString();
            const allEvents = await RNCalendarEvents.fetchAllEvents(startDate, endDate);
            await allEvents.forEach(async item => {
              console.log(item);
              if (item.notes === '由应用UESTC创建') {
                await RNCalendarEvents.removeEvent(item.id, {
                  futureEvents: true
                });
              }
            });
            await this.props.rootStore.UserStore.toast('success', '🎉 已从系统日历中删除所有课程');
            await this.props.rootStore.UserStore.clearToast();
          }
        }
github Vizards / uestc-react-native-ios / scene / Course / containers / Calendar.js View on Github external
async removeExist() {
    const startDate = moment(`${this.state.startDate}`, 'YYYY-MM-DD').toISOString();
    const endDate = moment(`${this.state.startDate}`, 'YYYY-MM-DD').add(6, 'months').toISOString();
    const allEvents = await RNCalendarEvents.fetchAllEvents(startDate, endDate);
    await allEvents.forEach(async item => {
      if (item.notes === '由应用UESTC创建') {
        await RNCalendarEvents.removeEvent(item.id, {
          futureEvents: true
        });
      }
    });
  };
github jitsi / jitsi-meet / react / features / calendar-sync / functions.native.js View on Github external
.then(accessGranted => {
            if (accessGranted) {
                const startDate = new Date();
                const endDate = new Date();

                startDate.setDate(startDate.getDate() + FETCH_START_DAYS);
                endDate.setDate(endDate.getDate() + FETCH_END_DAYS);

                RNCalendarEvents.fetchAllEvents(
                    startDate.getTime(),
                    endDate.getTime(),
                    [])
                    .then(_updateCalendarEntries.bind(store))
                    .catch(error =>
                        logger.error('Error fetching calendar.', error));
            } else {
                logger.warn('Calendar access not granted.');
            }
        })
        .catch(reason => logger.error('Error accessing calendar.', reason));