question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Undefined is not an object

See original GitHub issue

Hi, I have been trying for a while to get this module to work in React Native and every time I run RNCalendarEvents.authorizationStatus() .then(status => { // handle status }) .catch(error => { // handle error });

I get the error that ‘undefined is not an object’

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:18 (10 by maintainers)

github_iconTop GitHub Comments

3reactions
jatsrtcommented, Nov 18, 2016

Come to think of it, this change is easier:

'use strict';

import { NativeModules } from 'react-native';

var RNCalendarEvents = NativeModules.RNCalendarEvents;

export default RNCalendarEvents;
2reactions
jatsrtcommented, Nov 18, 2016

OK, figured it out. Using commonJS or other package systems may cause this.

It’s the difference on how you define the package in index.android and index.ios

Example to make it work in index.ios.js

'use strict';

import { NativeModules } from 'react-native';

var RNCalendarEvents = NativeModules.RNCalendarEvents;

export default {
    authorizationStatus() {
        return RNCalendarEvents.authorizationStatus()
    },

    async authorizeEventStore() {
        return RNCalendarEvents.authorizeEventStore()
    },

    async saveEvent(title, details) {
        return RNCalendarEvents.saveEvent(title, details)
    },
}

Just need to make it consistent between the two either export default or module.exports

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: 'undefined' is not an object - Stack Overflow
What I'm trying to do, as you can probably guess, is check the length of a certain " from " array in the...
Read more >
TypeError: 'undefined' is not an object in JavaScript
The “TypeError: 'undefined' is not an object” error occurs when a property is accessed or a method is called on an undefined object....
Read more >
27/3 - TypeError: undefined is not an object (evaluating 'family ...
Here's the message: TypeError: undefined is not an object (evaluating 'family[i].name') The code outputs the right values to the console, ...
Read more >
ERROR TypeError: undefined is not an object (evaluating ...
The solution… Ever encountered this error → ERROR TypeError: undefined is not an object (evaluating '_this. props. navigation.
Read more >
undefined is not an object (evaluating 'ReactCurrentActQueue ...
ERROR TypeError: undefined is not an object (evaluating 'ReactCurrentActQueue$1.isBatchingLegacy') `. My app has a blank page.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found