GithubHelp home page GithubHelp logo

Comments (10)

wmcmahan avatar wmcmahan commented on August 23, 2024 1

@philohelp you will also need to add RNCalendarEvents under "Link Binary With Libraries" if you haven't already.

from react-native-calendar-events.

blackPeanut avatar blackPeanut commented on August 23, 2024

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.

bondanherumurti avatar bondanherumurti commented on August 23, 2024

thank you @blackPeanut !

from react-native-calendar-events.

blackPeanut avatar blackPeanut commented on August 23, 2024

@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.

bondanherumurti avatar bondanherumurti commented on August 23, 2024

@blackPeanut

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.

wmcmahan avatar wmcmahan commented on August 23, 2024

@bondanherumurti You will need to request authorization to the calendar before being able to write/read from the calendar.

from react-native-calendar-events.

RemeJuan avatar RemeJuan commented on August 23, 2024

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.

bondanherumurti avatar bondanherumurti commented on August 23, 2024

@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.

philohelp avatar philohelp commented on August 23, 2024

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 ?

capture d ecran 2016-10-07 23 55 12

capture d ecran 2016-10-07 23 56 23

from react-native-calendar-events.

philohelp avatar philohelp commented on August 23, 2024

Thanks, it works great now.

from react-native-calendar-events.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.