-
-
Notifications
You must be signed in to change notification settings - Fork 182
Not working with React Native #11
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
Comments
Possible alternative approach by Yuyi: https://github.com/yuya-fujimoto/supabase-js/commit/986d6f09c99df371c01beb50bd84bdb81de6f3f5 |
I got it to work on react-native app (#14 ) but only after digging through the code it seems like |
Hey @izqalan I merged your changes as they are a great start. I'll leave this open until we have a chance to fix the bug on |
Hey @kiwicopple hmm that's strange. |
@kiwicopple I've tried looking into this, but it appears your problem was fixed already with #24. The example in your PR builds fine now. |
thanks for testing @tjg1 - I saw your comment in the PR 🙏 Could I get a small favour, could you confirm the PR in our main repo works for you? supabase/supabase#315 If it is, can you let me know if you're on Android or iOS? (I only have iOS and I'm still getting the error: |
hi @kiwicopple, I have just tried this out. Indeed that error gets returned by the server. It works in a browser and in React Native with a debugger attached. But it seems that while debugging, the RN code is actually running in a web worker in my browser. I will dig deeper into this. I have a jailbroken iOS device setup with https://github.com/nabla-c0d3/ssl-kill-switch2, so I can get the actual HTTP request made by RN and compare it to the one made by the browser. |
I've done that and reproduced it with cURL. React Native on iOS sends Changing the header to There is still a type warning for AsyncStorageStatic, so it may need a wrapper. |
🎉 This issue has been resolved in version 1.7.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
UPDATE: For anyone looking, this is what worked for me:
Hi! This issue persists on the latest version of supabase-js (^1.17.0):
react-native: Happens with and without |
it's work! react-native: 0.64.23,
|
This is a Hacktoberfest task!
You can read more about Hacktoberfest on our blog and see all tasks on our Hacktoberfest Project Board.
Summary
This library isn't working with React native because it tries to access
localstorage
.Details
In ReactNative, there is no
localstorage
, it is insteadAsyncStorage
. We need to rewrite any calls to localstorage to guard against this. It might be better to split out all storage calls to a helper file so that we can extend it in the future.The text was updated successfully, but these errors were encountered: