Comments (10)
@philohelp you will also need to add RNCalendarEvents under "Link Binary With Libraries" if you haven't already.
from react-native-calendar-events.
Just type react-native link react native-calendar-events
in terminal and for better understanding what's going on read about libraries linking in React-Native documentation.
from react-native-calendar-events.
thank you @blackPeanut !
from react-native-calendar-events.
@bondanherumurti btw, if you will stuck with searching for eventKit & coreFoundation just add them in build phases tab, there is no need and actually possibility to add them to the project files as you will do with react-native-calendar-events in first step.
from react-native-calendar-events.
i tried to test the plugin using this code
import React, { Component } from 'react';
import RNCalendarEvents from 'react-native-calendar-events';
import {
AppRegistry,
StyleSheet,
Text,
View,
TouchableOpacity
} from 'react-native';
const {NativeAppEventEmitter} = React;
class rncalendar extends Component {
_putOnCalendar(){
console.log("put on calendar ya")
RNCalendarEvents.saveEvent('title', {
location: 'location',
notes: 'notes',
startDate: '2016-10-01T09:45:00.000UTC',
endDate: '2016-10-02T09:45:00.000UTC'
});
}
render() {
return (
<View style={styles.container}>
<TouchableOpacity onPress={this._putOnCalendar}>
<Text>Put On Calendar</Text>
</TouchableOpacity>
</View>
);
}
}
}
....
//styles go here
but nothing happened when i hit the button, did i miss something? or wrong implementation?
from react-native-calendar-events.
@bondanherumurti You will need to request authorization to the calendar before being able to write/read from the calendar.
from react-native-calendar-events.
I am also experiencing the same lack of anything happening and I am requesting/checking for permission.
function checkPermissions(event, reminder) {
RNCalendarEvents.authorizeEventStore(({status}) => {
if(status.toLowerCase() === 'authorized') {
return _addToCalendar(event, reminder);
}
return AlertIOS.alert(
'Unable to create event',
'We need permissiont o access your calendar in order to create an event.'
);
});
}
function _addToCalendar(event, reminder) {
const calDate = reminder ? moment(event.sortDate).subtract(1, 'month') : event.sortDate;
const reminderDate = moment(calDate).hour(8).minute(0).toISOString();
const eventDate = moment(calDate).hour(0).minute(0).toISOString();
if(reminder) {
RNCalendarEvents.saveEvent(`Reminder: enter ${event.title}`, {
location: 'location',
notes: 'notes',
startDate: reminderDate,
endDate: reminderDate,
});
} else {
RNCalendarEvents.saveEvent('title', {
location: event.location,
notes: 'notes',
startDate: eventDate,
endDate: eventDate,
alarms: [{
date: -60
}]
});
}
}
from react-native-calendar-events.
@wmcmahan thank you for your answer
RNCalendarEvents.authorizeEventStore(({status}) => {
if(status === 'authorized'){
RNCalendarEvents.saveEvent(this.props.data.post_title, {
location: `PVJ ${this.props.data.custom_fields.tenant.post_title}`,
notes: 'notes',
startDate: date.format("YYYY-MM-DDTHH:mm:ss.sssZ"),
endDate: date.format("YYYY-MM-DDTHH:mm:ss.sssZ")
});
}
})
this is working now
from react-native-calendar-events.
I get a "cannot read property 'authorizeEventStore' of undefined' too, although I think I've linked the libraries properly. Is there anything else that could provoke that ?
from react-native-calendar-events.
Thanks, it works great now.
from react-native-calendar-events.
Related Issues (20)
- Unable to save calendar event in Android. HOT 3
- Unable to use API on Android - "TypeError: null is not an object" for every API call HOT 2
- Ios Event Date Time wrong and confused HOT 1
- The application will crash when I set some items of the Recurrence rule
- Add event status property
- How to remove default 30mins reminder for event entry?
- when the next version will be released? the (long) addEvent is needed
- Error: you don't have permissions to add an event to the users calendar
- Events overlap not coming in horizontal direction
- Not able to save events to calendar in Android 13 HOT 3
- iOS 17 issues: unable to request permissions HOT 26
- Type error when updating event without startDate
- Events Saved on Wrong Calendar with No Alarm - Android HOT 1
- Ar you having write issues on Android, read this? HOT 2
- Patch for recurring events in Android HOT 1
- Problems with iOS 17 HOT 2
- Any alternatives or update plan? HOT 4
- Attendees are adding to the event
- saveCalendar doesnt appear in google calendar HOT 3
- ld: library 'RNCalendarEvents' not found
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-calendar-events.