Skip to content

Basic React Native Support - #174

Closed
karlsander wants to merge 2 commits into
amplitude:mainfrom
karlsander:master
Closed

karlsander wants to merge 2 commits into
amplitude:mainfrom
karlsander:master

Conversation

@karlsander

@karlsander karlsander commented Feb 23, 2019 •

Copy link
Copy Markdown

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

blazzy commented Mar 5, 2019

Copy link
Copy Markdown
Contributor

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
Copy Markdown

@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 😉

@jooohhn
jooohhn changed the base branch from master to main January 13, 2021 20:14
@kevinpagtakhan

Copy link
Copy Markdown
Contributor

Closing this in favor of https://github.com/amplitude/Amplitude-ReactNative

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