react-native-add-calendar-event
react-native-add-calendar-event copied to clipboard
Cannot read property 'requestCalendarPermission' of undefined
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?
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.
Thank you vonovak, i'll compare which difference between projects and write about it
i've got an error in a example project
@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.
I am still facing this issue. has anyone find any solution to this?
hey, I am facing the same issue and would really appreciate if someone can give a solution to this please