rgommezz/react-native-offline

React native expo example app doesn't seem to work

Kulgar opened this issue · 11 comments

Current Behavior

I Tried to run the example app in different ways:

  • using the QRCode in my expo client on my device
  • using Appetize.io
  • downloading the code and running yarn install & expo start to open the app in a simulator

None of these worked... The JS gets bundled within expo, but then I either get a black screen, or a white one and, after a couple of seconds, the device closes expo.

I'm a bit puzzled because I get no errors at all, I don't see anything in the logs nor in expo...

Expected Behavior

  • Well, the example app should work, shouldn't it?

How to reproduce

  • Trying to launch the example app using one of the ways I described above.

Your Environment

Only relevant regarding the third way I tried (running on a simulator).

software version
yarn 1.22.4
expo-cli 3.24.1

Let me know if I can help :-)

I had the same issue with recent releases written in typescript. In my case, (after hours of investigation ;), I found that the root cause of the crashes is because react-native-offline ships a compiled JS version of the lib (dist/react-native-offline.js), which references in some way react-native 0.62.2. However, expo SDK embed different versions (even a 0.61.x for SDK 36), which leads to incompatibilities with react-native-netinfo (in fact this is also the issue described here #252 )

When I set the main entry in package.json to src/index.ts instead of dist/react-native-offline.js, it doesn't crash anymore. However it wouldn't work for non-typescript users.

@colinux Unfortunately I wasn't able to launch the app... What package.json did you change (where)?
Could you share what you did exactly to launch the app?

Thanks a lot :-)

@Kulgar I'm talking about the package.json of this library.

- "main": "dist/react-native-offline.js",
+ "main": "src/index.ts",

I'm running a fork with this patch if you want to try it :

- "react-native-offline": "5.7.0",
+ "react-native-offline": "https://github.com/Imparato/react-native-offline#v5.7.0-compat-expo36-1",

However this fork contains a few more changes for my app, notably I removed the redux-saga dependency.

Hello!
I have the same problem. All @colinux recommendations did not help.

@Kulgar Did you manage to run the example?

@nikolaytsigvintsev : not yet I'll retry tomorrow normally. I'll let you know.

@nikolaytsigvintsev : not yet I'll retry tomorrow normally. I'll let you know.

Thanks!

@nikolaytsigvintsev : No luck here... I'm completely stuck...
I did a fork, changed the package.json as colinux did... I had to add react-community/netinfo package.
The project is building but when it reaches 100%, nothing happens, expo is stuck and no pages are ever rendered...

I'm giving up. I hope the maintainer of this package and example app will be able to help us.

@Kulgar : I also tried different installation options, but it didn't help, figured it out without an example.

thank you for answering!

So, it works guys, if you change version of react-native-offline to 5.0.0 in package.json and use npm

stale commented

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.

stale commented

Closing this issue after a prolonged period of inactivity. If this is still present in the latest release, please feel free to create a new issue with up-to-date information.