question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to saveEvent() after upgrading version to 1.7.3 from 1.6.1

See original GitHub issue

I used to have a working react-native-calendar-events library at version 1.6.1, but since I upgraded to React Native 60.4 and react-native-calendar-events to version 1.7.3 users cannot add events to calendar.

On Android, they get an error message, on iOS it just crashes the app.

The error message on Android is coming from this asynchronous component helper function:

async function addToCalendar(event) {
  try {
    const startDate =
      Platform.OS === "ios"
        ? format(parse(event.StartDateLocal))
        : parse(event.StartDateLocal);
    const endDate =
      Platform.OS === "ios"
        ? format(parse(event.EndDateLocal))
        : parse(event.EndDateLocal);
    const allEvents = await RNCalendarEvents.fetchAllEvents(startDate, endDate);

    const calendarEvent = allEvents.find(e => e.title === event.Title);
    if (calendarEvent) {
      alert("You have already added this event to your calendar.");
    } else {
      const title = event.Title;

      const {
        Location: {
          AddressLine1: address,
          City: city,
          StateAbbreviation: state,
          PostalCode: zip
        }
      } = event;

      const location = `${address}, ${city}, ${state}, ${zip}`;

      const settings = {
        location,
        startDate,
        endDate
      };
      RNCalendarEvents.saveEvent(title, settings)
        .then(() => {
          alert("Event Saved");
        })
        .catch(() => {
          alert("Error");
        });
    }
  } catch (e) {
    alert("Error");
  }
}

react-native-calendar-events

Environment

System:
    OS: macOS High Sierra 10.13.6
    CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
    Memory: 417.23 MB / 16.00 GB
    Shell: 5.3 - /bin/zsh
  Binaries:
    Node: 10.16.3 - /usr/local/bin/node
    Yarn: 1.10.1 - /usr/local/bin/yarn
    npm: 6.9.0 - /usr/local/bin/npm
    Watchman: 4.7.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
    Android SDK:
      API Levels: 23, 25, 26, 27, 28
      Build Tools: 23.0.1, 26.0.2, 27.0.3, 28.0.3
      System Images: android-28 | Google Play Intel x86 Atom
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.5900203
    Xcode: 10.1/10B61 - /usr/bin/xcodebuild
  npmPackages:
    @react-native-community/cli: 2.9.0 => 2.9.0
    react: 16.8.6 => 16.8.6
    react-native: 0.60.4 => 0.60.4
  npmGlobalPackages:
    react-native-cli: 2.0.1
    react-native-git-upgrade: 0.2.7

I went back to react-native-calendar-events 1.6.1 and I am still getting the same issue.

This library looks like it still uses index.ios.js and index.android.js even though React Native 60+ versions are now on index.js as root. Could this be the problem?

Steps to Reproduce

Please clone: https://github.com/ldco2016/RNapp

What would be a cause of receiving undetermined as a Promise?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:18

github_iconTop GitHub Comments

2reactions
mbruchercommented, Jan 20, 2020

I have the code working in debug, but not in release, even if I removed all the hacks 😕 Any update on a version compatible with react native 0.61?

1reaction
voslartomascommented, Jan 26, 2020

Same here, everything works as expected in debug, but when you release version, Promise returns error Unable to save event.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Update 1.6.1 to 1.7.3 error - OctoPrint Community Forum
I insert the log files. I am a layman and therefore excuse the ignorance. Thank you. plugin_softwareupdate_console.log (55.6 KB) ...
Read more >
Failing to update to 1.7.3. Not sure where to go from here.
I've downloaded the logs and viewed them. As someone who does not have a background in software/coding how do I use these logs...
Read more >
Unable to save event on Windows 10 (20H2) calendar
Hello, I am using MSOffice (O365) with Windows 10 (20H2) Enterprise. After I applied 20H2 from 1909, my Windows calendar that is located...
Read more >
FortiSIEM 4.7.1 Product Documentation - Amazon S3
After you upgrade to 4.6.3, the system reboots itself and will automatically perform OS upgrades as described in detail here ...
Read more >
Netavis Observer Release Notes
Show status menu fails after JDK RPM update (OBS-6414) ... ARH version change does not work after 5.0.0 -> 5.0.1 small upgrade (T#6877)....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found