react-native-add-calendar-event icon indicating copy to clipboard operation
react-native-add-calendar-event copied to clipboard

Cannot read property 'requestCalendarPermission' of undefined

Open valin0k opened this issue 5 years ago • 6 comments

Hey guys, i installed react-native-add-calendar-event to project following instructions. version: "react-native": "^0.61.4", OS: mac os 10.15.1 I tried run with and without manual linking and got the same result. I also added NSCalendarsUsageDescription and NSContactsUsageDescription to info.plist. I used code from quick example section

import React, {useEffect} from 'react'
import { View } from 'react-native'
import * as AddEvent from 'react-native-add-calendar-event'

export default function AddCalendarEvent ({ title = 'config' }) {
  useEffect(() => {
    const eventConfig = {
      title,
      // and other options
    };
    AddEvent.presentEventCreatingDialog(eventConfig)
      .then((eventInfo: { calendarItemIdentifier: string, eventIdentifier: string }) => {
        // handle success - receives an object with `calendarItemIdentifier` and `eventIdentifier` keys, both of type string.
        // These are two different identifiers on iOS.
        // On Android, where they are both equal and represent the event id, also strings.
        // when { action: 'CANCELED' } is returned, the dialog was dismissed
        console.warn(JSON.stringify(eventInfo));
      })
      .catch((error: string) => {
        // handle error such as when user rejected permissions
        console.warn(error);
      });

  }, [])

  return <View></View>
}

Every time i run pod install and restart ios emulator after changing something. Any suggestions? Снимок экрана 2019-12-23 в 17 20 53

valin0k avatar Dec 23 '19 10:12 valin0k

hi! This means that the native module is not correctly linked. It's hard to help without having your runnable code at hand. Try comparing your project with the example project.

vonovak avatar Dec 23 '19 11:12 vonovak

Thank you vonovak, i'll compare which difference between projects and write about it

valin0k avatar Dec 23 '19 11:12 valin0k

i've got an error in a example project Снимок экрана 2019-12-24 в 22 33 32

valin0k avatar Dec 24 '19 15:12 valin0k

@valin0k I just tested It out and got the same results. Without manual linking, this library works out of the box on Android for RN 0.60 >, but on ios It throws me the same error

Cannot read property 'requestCalendarPermission' of undefined

If we run on terminal react-native link react-native-add-calendar-event at the root of our project It works just fine.

Gustavo-Kuze avatar May 21 '20 10:05 Gustavo-Kuze

I am still facing this issue. has anyone find any solution to this?

gaurigarg97 avatar Mar 01 '22 14:03 gaurigarg97

hey, I am facing the same issue and would really appreciate if someone can give a solution to this please

gaurigarg97 avatar Jul 12 '22 09:07 gaurigarg97