meteorrn / meteor-react-native

Meteor client for React Native matching Meteor Spec
https://guide.meteor.com/react-native.html
Other
59 stars 31 forks source link

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle. #33

Closed imhazige closed 3 years ago

imhazige commented 4 years ago

Describe the bug After create a React native app with npx react-native init, then in the App.js import Meteor from '@meteorrn/core'; then the simulator show blank screen. and show the error.

To Reproduce Steps to reproduce the behavior:

  1. Just import Meteor
  2. See error

Expected behavior App able to start

Screenshots Debugger worker loaded runtime on port 12686 Require cycle: node_modules/@meteorrn/core/src/Meteor.js -> node_modules/@meteorrn/core/src/user/User.js -> node_modules/@meteorrn/core/src/Meteor.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.

TheRealNate commented 4 years ago

Hi @imhazige, the message you are seeing is a low-severity warning. It will only appear in the bundler, and does not prevent the app from loading. We plan to fix it in a later major release when the codebase is refactored. Is it possible there is another issue preventing your app from loading?

imhazige commented 4 years ago

ok, I will create a more plain sample to test.

now when I uncomment the import Meteor ....,(no other meteor code) the problem happen, UI not shown. when comment it, the problem disappears and UI shown.

imhazige commented 4 years ago

I have reproduce the problem with a plain project and only have meteor dependencies https://github.com/imhazige/react-native-meteor-blank-screen-problem

imhazige commented 4 years ago

https://github.com/imhazige/react-native-meteor-blank-screen-problem/blob/master/App.js#L27 uncomment this line will make a blank screen @TheRealNate

and one thing I would mention is that now @react-native-community/netinfo manually after install meteor, is this a possible cause?

TheRealNate commented 4 years ago

I think I see the problem. You may be missing some of @meteorrn/core's peer dependencies. Please see the Installation section

imhazige commented 4 years ago

after install @react-native-community/async-storage which is missing and run npx pod-install ios, still blank. by the way, expo have not such problem

TheRealNate commented 4 years ago

Are you seeing any other errors in the console? The "require cycle" error is likely not the cause of your issue.

imhazige commented 4 years ago

could you try https://github.com/imhazige/react-native-meteor-blank-screen-problem/blob/master/App.js.

no other error.

TheRealNate commented 4 years ago

Hi @imhazige, a few questions to diagnose this further:

From what you have told me it sounds like something is causing the whole React tree to crash, but that would usually produce some sort of error message. If you are bundling for production however, it may not appear unless you implement try/catch or an error boundary.

TheRealNate commented 4 years ago

@lemonbusadmin are you having this issue as well?

imhazige commented 4 years ago

I am using simulator.

https://github.com/imhazige/react-native-meteor-blank-screen-problem

are you able to run?

TheRealNate commented 4 years ago

Hi @imhazige, could you try running the latest beta release and see if that fixes your issue?

imhazige commented 4 years ago

Hi, @TheRealNate

same behavior.

image

"dependencies": { "@meteorrn/core": "^2.1.0-beta1", "@react-native-community/async-storage": "^1.11.0", "@react-native-community/netinfo": "^5.9.6", "react": "16.13.1", "react-native": "0.63.2" },

github-actions[bot] commented 3 years ago

Closing this issue due to no activity. Feel free to reopen.

TheRealNate commented 3 years ago

Hi @imhazige, I'm going to correct the require cycle for the 2.1.0 release. Hopefully this should correct your issue. I will keep you posted.

TheRealNate commented 3 years ago

Hi @imhazige, the 2.1.0 release candidate has been published, and it eliminates the require cycle. If you'd like, you can try it now with npm install --save @meteorrn/core@2.1.0-rc1

imhazige commented 3 years ago

Hi @TheRealNate,

The warning disappear now. Well done, thank you.

About the blank screen problem, I found if I stop debug, it will show, if start debug, it will be blank again.

So I think it should not be related to this library.

Anyway the thank you for enhanced it. Cheers!