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

navigator.userAgent.toLowerCase() crashes for React Native #363

Closed
escwald opened this issue Dec 14, 2016 · 0 comments
Closed

navigator.userAgent.toLowerCase() crashes for React Native #363

escwald opened this issue Dec 14, 2016 · 0 comments

Comments

@escwald
Copy link
Contributor

escwald commented Dec 14, 2016

React Native depends on debug and React Native does not have navigator.userAgent, which makes function useColors() (in browser.js) crash.

More specific, it is these lines that crashes.
(navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || (navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));

Maybe do add a check for userAgent? Like this?
(navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || (navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));

cc @ralphtheninja

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

No branches or pull requests

1 participant