Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 Bug Report: Realtime doesn't work on React Native #29

Closed
2 tasks done
rohankm opened this issue Jul 7, 2022 · 4 comments
Closed
2 tasks done

馃悰 Bug Report: Realtime doesn't work on React Native #29

rohankm opened this issue Jul 7, 2022 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@rohankm
Copy link

rohankm commented Jul 7, 2022

馃憻 Reproduction steps

  1. create a react native expo app
  2. init the appwrite
  3. check the console log

馃憤 Expected behavior

As react native does not have window.localstorage, implementing the same with
AsyncStorage from '@react-native-async-storage/async-storage'; would be more sense.

i was checking the docs of supabase. This is how they did it

import AsyncStorage from '@react-native-async-storage/async-storage';
import { createClient } from '@supabase/supabase-js'

const supabaseUrl = YOUR_REACT_NATIVE_SUPABASE_URL
const supabaseAnonKey = YOUR_REACT_NATIVE_SUPABASE_ANON_KEY

export const supabase = createClient(supabaseUrl, supabaseAnonKey, {
  localStorage: AsyncStorage as any,
  autoRefreshToken: true,
  persistSession: true,
  detectSessionInUrl: false,
});

implementing something like this would be helpful

馃憥 Actual Behavior

Screenshot 2022-07-08 at 5 25 10 AM

馃幉 Appwrite version

Version 0.10.x

馃捇 Operating system

MacOS

馃П Your Environment

No response

馃憖 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

馃彚 Have you read the Code of Conduct?

@rohankm rohankm added the bug Something isn't working label Jul 7, 2022
@rohankm rohankm changed the title 馃悰 Bug Report: localsorage to Async Storage when using React Native 馃悰 Bug Report: localstorage to Async Storage when using React Native Jul 8, 2022
@stnguyen90
Copy link
Contributor

@rohankm could you please clarify that realtime in react native is what doesn't work?

@solita-jtn
Copy link

@stnguyen90 SDK throws the exception below, when trying to subscribe. This is due to that it uses localStorage which is not available in React Native.

TypeError: Cannot read properties of undefined (reading 'getItem')
    at WebSocket.onMessage (/xxx/node_modules/appwrite/dist/cjs/sdk.js:181:81)

@stnguyen90 stnguyen90 changed the title 馃悰 Bug Report: localstorage to Async Storage when using React Native 馃悰 Bug Report: Realtime doesn't work on React Native Nov 10, 2022
@prathamesh3707
Copy link

please assign it to me

@lohanidamodar
Copy link
Member

@rohankm We now have React Native SDK. Please check it out at https://github.com/appwrite/sdk-for-react-native

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants