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.

Require cycle and CalendarProvider import gives undefined

See original GitHub issue

Description

Can’t use CalendarProvider because of an error

Expected Behavior

I expect normal working but got the error

Observed Behavior

Got the error on the app start

WARN:  Require cycle: 
index.js -> 
App.tsx -> 
node_modules/react-native-calendars/src/index.js -> 
node_modules/react-native-calendars/src/expandableCalendar/Context/Provider.js -> 
index.js

 ERROR  Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Check your code at Provider.js:147.
    in CalendarProvider (at App.tsx:96)
    in RCTView (at View.js:34)
    in View (at App.tsx:95)
    in App (at renderApplication.js:47)
    in RCTView (at View.js:34)
    in View (at AppContainer.js:107)
    in RCTView (at View.js:34)
    in View (at AppContainer.js:134)
    in AppContainer (at renderApplication.js:40)

 ERROR  Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Check the render method of `CalendarProvider`.
This error is located at:
    in CalendarProvider (at App.tsx:96)
    in RCTView (at View.js:34)
    in View (at App.tsx:95)
    in App (at renderApplication.js:47)
    in RCTView (at View.js:34)
    in View (at AppContainer.js:107)
    in RCTView (at View.js:34)
    in View (at AppContainer.js:134)
    in AppContainer (at renderApplication.js:40), js engine: hermes

Environment

  • npm ls react-native-calendars: react-native-calendars@1.1264.0
  • npm ls react-native: react-native@0.64.0

Also specify:

  1. Device/emulator/simulator & OS version: Android 9 real device

Reproducible Demo

import React from 'react';
import { View} from 'react-native';
import { CalendarProvider, ExpandableCalendar } from 'react-native-calendars';

export function App({}: Props) {
  return (
    <View>
      <CalendarProvider>
        <ExpandableCalendar />
      </CalendarProvider>
    </View>
  );
}

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:6
  • Comments:11

github_iconTop GitHub Comments

1reaction
dpoltoratskycommented, Feb 24, 2022

Same error on version 1.1278.0 (latest at the moment)

0reactions
stale[bot]commented, Jun 3, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Require cycles are allowed, but can result in uninitialized ...
All imported stuff from B is undefined. ... to solve: In your case the warning also gives a detailed explanation, where the cycle...
Read more >
Calendars API - Fitbit SDK
Type: CalendarProvider. The Calendar API allows developers to retrieve events from user's calendars. import calendars from "calendars"; let start = new ...
Read more >
Best way to avoid this require cycle? [Redux] : r/reactjs - Reddit
I can't think of a way to get rid of the require cycle without creating a new one. ... Don't have the Axios...
Read more >
react-native-calendars | Yarn - Package Manager
This module includes various customizable React-Native calendar components. The package is both Android and iOS compatible. See our new Docs site. Try it...
Read more >
NG3003: Import cycles would need to be created to compile ...
A component, directive, or pipe that is referenced by this component would require the compiler to add an import that would lead to...
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