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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic React Native Support #174

Closed
wants to merge 2 commits into from
Closed

Conversation

karlsander
Copy link

@karlsander karlsander commented Feb 23, 2019

This PR is related to issue #164 but it's just one small bit of the work needed.

With these two variable existence checks, the library can successfully run in a react native app with amplitude-react. Even pretty decently if userId, deviceId, language, platform, etc are provided manually in the setup.

Though support for localStorage / cookies would be way better of course. I think the best approach there would be to provide the ability to pass in a localStorage compatible storage (like react-native-sync-localstorage) with the init options. This can then also cover node.js without bloating the library.

only do the IE localStorage polyfill if document is defined and safely access window.location.hostname in cookiestorage
@blazzy
Copy link
Contributor

blazzy commented Mar 5, 2019

Thanks for tackling this! We'll be working on a version that also leverages AsyncStorage a bit more to make sure sent events are retried and to replace the cookie storage as it looks like that con be flaky on some devices.

@ahanriat
Copy link

@blazzy Thanks for that 🙏 For the AsyncStorage please use https://github.com/react-native-community/async-storage and not the one from React-native as it's deprecated 😉

@kevinpagtakhan
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants