Closed kohchihao closed 8 months ago
A workaround that i made is request permissions by react-native-calendar-events like this:
import ReactNativeCalendarEvents from "react-native-calendar-events";
import { presentEventCreatingDialog } from "react-native-add-calendar-event";
ReactNativeCalendarEvents.requestPermissions().then((response) => {
if (response === "authorized")
try {
presentEventCreatingDialog({ title: "" })
.then((eventInfo) => {
console.log(JSON.stringify(eventInfo));
})
.catch((error) => {
console.log(error);
});
} catch (error) {
console.log("calendar error:", error);
}
});
But first you need to make this change in your RNCalendarEvents.m file from react-native-calendar-events https://github.com/agent8/react-native-calendar-events/commit/368206ca3228cea97d8dfb913107bb61012062a2
A workaround that i made is request permissions by react-native-calendar-events like this:
import ReactNativeCalendarEvents from "react-native-calendar-events";
import { presentEventCreatingDialog } from "react-native-add-calendar-event";
ReactNativeCalendarEvents.requestPermissions().then((response) => { if (response === "authorized") try { presentEventCreatingDialog({ title: "" }) .then((eventInfo) => { console.log(JSON.stringify(eventInfo)); }) .catch((error) => { console.log(error); }); } catch (error) { console.log("calendar error:", error); } });
But first you need to make this change in your RNCalendarEvents.m file from react-native-calendar-events agent8/react-native-calendar-events@368206c
Would it be simpler by just calling Permissions.request()
from react-native-permissions
so that we don't have to modify react-native-calendar-events
?
@phatlaunchdeck we also have problems in react-native-permissions https://github.com/zoontek/react-native-permissions/issues/804
I made it work this way: https://github.com/vonovak/react-native-add-calendar-event/compare/master...remipou:react-native-add-calendar-event:master
Don't forget to add a NSCalendarsWriteOnlyAccessUsageDescription
key in your info.plist
(https://github.com/vonovak/react-native-add-calendar-event/pull/182)
I made it work this way: master...remipou:react-native-add-calendar-event:master Don't forget to add a
NSCalendarsWriteOnlyAccessUsageDescription
key in your info.plist (#182)
Thank you, Remipou. This worked great for me!
NSCalendarsUsageDescription has been deprecated. If your app needs read and write access to a person’s calendar data, use NSCalendarsFullAccessUsageDescription instead. If your app needs to create events in a person’s default calendar, use NSCalendarsWriteOnlyAccessUsageDescription instead.
I made it work this way: master...remipou:react-native-add-calendar-event:master Don't forget to add a
NSCalendarsWriteOnlyAccessUsageDescription
key in your info.plist (#182)Thank you, Remipou. This worked great for me!
Is there any way to mergen this PR??
Any updates? Can @remipou ‘s fix be merged? @vonovak ? Or how can I use it in the mean time? Thanks!
Any updates on this PR??
Thus library no longer deals with permissions. Please use rn-permissions or similar, as documented in the Readme.
There are new changes to the iOS17 Calendar permission where 2 new permissions are introduced
full access
andwrite only
.This will cause the
presentEventCreatingDialog
to be broken on iOS17 because when checking the permission and requesting viarequestAccessToEntityType
will cause the app to throw an error. Specifically therequestAccessToEntityType
is deprecated on iOS17 and 2 new methods are introduced.Ref:
I think other libraries are facing the same issues as well https://github.com/wmcmahan/react-native-calendar-events/issues/440