Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
rn-add-calevent
Advanced tools
creating events in react native using the standard iOS / Android dialogs
This package alows you to start an activity (Android) or show a modal window (iOS) for adding or editing events in device's calendar. Through a promise, you can find out if a new event was added and get its id. See the usage section for more information. The functionality is provided through native modules and won't therefore work with Expo.
npm install react-native-add-calendar-event --save
or
yarn add react-native-add-calendar-event
react-native link react-native-add-calendar-event
add NSCalendarsUsageDescription
and NSContactsUsageDescription
keys to your Info.plist
file. The string value associated with the key will be used when asking user for calendar permission.
rebuild your project
IOS note: If you use pods, react-native link
will probably add the podspec to your podfile, in which case you need to run pod install. If not, please verify that the library is under link binary with libraries
in the build settings in Xcode (see manual installation notes).
See the example folder for a demo app.
import * as AddCalendarEvent from 'react-native-add-calendar-event';
const eventConfig = {
title,
// and other options
};
AddCalendarEvent.presentEventDialog(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 false is returned, the dialog was dismissed
if (eventInfo) {
console.warn(JSON.stringify(eventInfo));
} else {
console.warn('dismissed');
}
})
.catch((error: string) => {
// handle error such as when user rejected permissions
console.warn(error);
});
Property | Value | Note |
---|---|---|
eventId | String | Id of edited event. Do not pass if you want to add a new event. |
title | String | |
startDate | String | format: 'YYYY-MM-DDTHH:mm:ss.SSSZ' |
endDate | String | format: 'YYYY-MM-DDTHH:mm:ss.SSSZ' |
location | String | |
allDay | boolean | |
url | String | iOS only |
notes | String | The notes (iOS) or description (Android) associated with the event. |
useEditIntent | boolean | Android only, and only when editing an event. See description below. |
ACTION_EDIT
should work for editing events, according to android docs but this doesn't always seem to be the case as reported in the bug tracker. This option leaves the choice up to you. By default, the module will use ACTION_VIEW
which will only show the event, but from there it is easy for the user to tap the edit button and make changes.The dates passed to this module are strings. If you use moment, you may get the right format via momentInUTC.format('YYYY-MM-DDTHH:mm:ss.SSS[Z]')
the string may look eg. like this: '2017-09-25T08:00:00.000Z'
.
More options can be easily added, PRs are welcome!
It is recommended to not rely on the standard Date
object and instead use some third party library for dealing with dates, such as moment.js because JavaScriptCore (which is used to run react-native on devices) handles dates differently from V8 (which is used when debugging, when the code runs on your computer).
Libraries
➜ Add Files to [your project's name]
node_modules
➜ react-native-add-calendar-event
and add libRNAddCalendarEvent.xcodeproj
libRNAddCalendarEvent.a
to your project's Build Phases
➜ Link Binary With Libraries
Cmd+R
)<android/app/src/main/java/[...]/MainActivity.java
import com.vonovak.AddCalendarEventPackage;
to the imports at the top of the filenew AddCalendarEventPackage()
to the list returned by the getPackages()
methodandroid/settings.gradle
:
include ':react-native-add-calendar-event'
project(':react-native-add-calendar-event').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-add-calendar-event/android')
android/app/build.gradle
:
compile project(':react-native-add-calendar-event')
FAQs
creating events in react native using the standard iOS / Android dialogs
The npm package rn-add-calevent receives a total of 4 weekly downloads. As such, rn-add-calevent popularity was classified as not popular.
We found that rn-add-calevent demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.