- 
                Notifications
    You must be signed in to change notification settings 
- Fork 24.9k
Closed
Labels
Good first issueInterested in collaborating? Take a stab at fixing one of these issues.Interested in collaborating? Take a stab at fixing one of these issues.Resolution: LockedThis issue was locked by the bot.This issue was locked by the bot.
Description
Motivation
I have a 3rd-party library that needs to work in react-native (as well as node.js, web, etc.). I want to detect when it's used in react-native, for analytics purposes. I can't use require('react-native') or similar because if somebody uses my library with a tool like browserify, it will try to statically satisfy all require() statements and fail on react-native.
Suggestion
- Set navigator.product to 'ReactNative' (it is currently 'Gecko')
- Set navigator.platform to 'iPhone', 'iPad', or 'Android' as appropriate (it is currently 'MacIntel', at least in the iOS emulator).
Implementing
Code in question is here:
react-native/Libraries/JavaScriptAppEngine/Initialization/InitializeJavaScriptAppEngine.js
Line 114 in 0fbe091
| GLOBAL.navigator = GLOBAL.navigator || {}; | 
Related IRC Conversation: https://gist.github.com/mikelehen/822a82a37bf30431a104
Metadata
Metadata
Assignees
Labels
Good first issueInterested in collaborating? Take a stab at fixing one of these issues.Interested in collaborating? Take a stab at fixing one of these issues.Resolution: LockedThis issue was locked by the bot.This issue was locked by the bot.