React-native-paper: Warning after importing react-native-paper : Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.

Created on 16 Mar 2019  路  21Comments  路  Source: callstack/react-native-paper

Most helpful comment

Still getting this issue.

All 21 comments

Same problem...

Duplicate of #639

I`m still getting the warnings, what could it be?

Still getting this issue.

@harveyconnor

Import each Item separate , for example you need a List Section with an accordion and a list item so go like :

import ListSection from 'react-native-paper/lib/commonjs/components/List/ListSection';
import ListAccordion from 'react-native-paper/lib/commonjs/components/List/ListAccordion';
import ListItem from 'react-native-paper/lib/commonjs/components/List/ListItem';

And then instead of (like in the docs) you use < ListSection > . That should be enough

I solved this issue by doing this.
Place the import 'react-native-paper' at the very top of the Code.

A PR to fix this issue is open here https://github.com/callstack/react-native-paper/pull/1851. Please be patient it will be merged soon.

it solved this issue by doing this.
Place the import 'react-native-paper' at the very top of the Code. in the Index.js

i am still facing the issue. RN - version 62.2 "react-native-paper": "^3.10.1", please help. i am able to see blank screen on my emulator.

Place import { Provider as PaperProvider } from 'react-native-paper'; directly after import React from 'react';, otherwise you'll get those warnings.

Place import { Provider as PaperProvider } from 'react-native-paper'; directly after import React from 'react';, otherwise you'll get those warnings.

This worked, totally forgot to wrap the entire app in this

any update on this issue?

Still happening here as well. I'm hiding those warnings but it's not ideal.

LogBox.ignoreLogs(["Require cycle:"]);

still getting this issue

why is this closed? still getting same error on "react-native-paper": "^4.4.1" and "react-native": "0.63.3". Any workaround yet?

@harveyconnor

Import each Item separate , for example you need a List Section with an accordion and a list item so go like :

import ListSection from 'react-native-paper/lib/commonjs/components/List/ListSection';
import ListAccordion from 'react-native-paper/lib/commonjs/components/List/ListAccordion';
import ListItem from 'react-native-paper/lib/commonjs/components/List/ListItem';

And then instead of (like in the docs) you use < ListSection > . That should be enough

For people wondering ... This Fixed my problem...

@harveyconnor

@BatDroid's suggestion worked well for me. In my index.js file I imported directly from the modules' directory.

instead of

import {Provider as PaperProvider} from 'react-native-paper';

try importing like:

import PageProvider from 'react-native-paper/lib/commonjs/core/Provider';

It works well for me!

still looking for a solution

add module:react-native-paper/babel to your babel.config.js.

My babel.config.js:

module.exports = {
  presets: ['module:metro-react-native-babel-preset'],
  plugins: [
    ["module:react-native-dotenv"],
    ["module:babel-plugin-module-resolver", {
      "alias": {
        "src": "./src"
      }
    }],
    ["module:react-native-paper/babel"]
  ]
};

Don't forget clear cache before rebuilding:

rm -rf /tmp/metro-*
npm start --reset-cache
Was this page helpful?
0 / 5 - 0 ratings

Related issues

ButuzGOL picture ButuzGOL  路  4Comments

satya164 picture satya164  路  4Comments

alikazemkhanloo picture alikazemkhanloo  路  4Comments

ZhengYuTay picture ZhengYuTay  路  3Comments

sritharanpalani picture sritharanpalani  路  4Comments