-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent while using with 'NetInfo' from '@react-native-community/netinfo' #121
Comments
Hmm very strange, it seems like the only difference between the two calls is the Snackbar title. In order to help I'd need to see a demo app so I can debug myself. Are you able to create and share a working demo @kamlesh1000? |
@cooperka This is the demo : |
Ah, Snackbar is a native module so Expo doesn't support it. You can't use Snackbar with Expo. Thanks for the question and demo. |
I am not using the Expo CLI. I have a different question. Did you just closed this issue refering the issue in the comment? |
Apologies @kamlesh1000, I saw your demo at https://snack.expo.io and assumed that expo was the issue without looking further. I can't seem to reproduce the issue in your demo because of the same error @bytewiz posted. Is the demo working for you? I don't think https://snack.expo.io supports this module so the demo could be a github repository, for example. |
Yaa, demo is working well on mobile. But, that inconsistency is still a issue to be solved. |
Sorry, I just missunderstood.. Demo was in expo. Just try with the IDE. Just removing the third import. And its a demo for the IDE. |
If you could provide me with a working github repo I can clone and run in an IDE that would be really helpful. I maintain this in my spare time and it's hard to debug issues unless they're super quick to reproduce. Thanks for your patience. |
I have the same issue. I think it's caused by not being on the app when you try to do Snackbar.show(). For instance if you are testing on a physical device and you slide the Android menu to disconnect the phone, that alone seems to be enough to cause the issue. On the other hand if you add a setTimeout() so the .show() call is delayed and you have enough time to go back to your app after disconnecting the phone (ie, close the sliding Android menu fast enough), then it works as expected. Not sure how or why, but there's definitely a bug with this. I just confirmed it. |
Exactly @emmx, thanks for weighing in. The snackbar attaches to whatever view is on top of your screen when the snackbar is shown. If that view happens to be the menu or some temporary modal that goes away, you'll never see the snackbar. I'll add a section in the readme to further clarify this. |
@cooperka Perhaps it's valuable to put this in the readme? |
Good call @madhums, I've added a note to the readme that to use with Expo you need to eject to ExpoKit. |
I have a simple method for detecting the change in internet connection. Every change in connection must give a snackbar pops up. When internet connection changes from OFF state to ON, it works perfect. But, when changes from ON to OFF, no any snackbar pops up. I checked with log which is perfectly working. Also, checked replaing snackbar with Alertbox which worked perfectly.
I used following code:
React native environment:
The text was updated successfully, but these errors were encountered: