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

#1331 Add information about ReactNative to runtime. #2120

Closed
wants to merge 1 commit into from

Conversation

ptmt
Copy link
Contributor

@ptmt ptmt commented Jul 25, 2015

This allows to determine what kind of react runtime used, for some purposes (#1331).

console.log(navigator.product) // ReactNative
console.log(navigator.productSub, navigator.rnVersion) // 0.8.0 0.8.0

How to inject react-native version better than concatenating one string to another on the Server.js step? On the dependency resolver side, patching prelude.js? Or there are other ways to know that react native version is?

@facebook-github-bot facebook-github-bot added GH Review: review-needed CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. labels Jul 25, 2015
@ide
Copy link
Contributor

ide commented Jul 26, 2015

Could you require package.json and read the version from there?

@ptmt
Copy link
Contributor Author

ptmt commented Jul 26, 2015

@ide, sure. Don't know how to require the other way, without the relative path or recursive searching root.

@ptmt
Copy link
Contributor Author

ptmt commented Jul 28, 2015

Rebased, squashed. Tests has failed before because #2134, now Travis should be ok.

@ptmt
Copy link
Contributor Author

ptmt commented Jul 28, 2015

Hmm, it seems TravisCI has not been triggered

@rainchen
Copy link

+1 for this feature, getting the version number is useful for debugging/logging in some cases.

@ide
Copy link
Contributor

ide commented Oct 11, 2015

So this is a good feature but we don't want to add globals. Could you try requiring package.json from InitializeJavaScriptAppEngine.js directly?

@chetstone
Copy link
Contributor

Any progress on this? I'm trying to use firebase with react-native and there are important features of firebase that are missing because of this issue.

Question: Would this fix work with the Chrome debugger that is now running in a web worker? That is, it doesn't seem to address @oveddan's comment.

@ide
Copy link
Contributor

ide commented Nov 4, 2015

Question: Would this fix work with the Chrome debugger that is now running in a web worker?

It wouldn't -- the devtools need to be made aware of workers.

@chetstone
Copy link
Contributor

@ide This fix enables app code to find out whether it's running under react-native or not. My question is, will this functionality work under both JSC and Chrome debugger?

I don't understand what it has to do with devtools. Perhaps there might be an inability to inspect the variable in the debugger? To me this is a minor issue which might be addressed in time by the devtools fix.

@ide
Copy link
Contributor

ide commented Nov 5, 2015

@chetstone sorry, I misinterpreted your question to mean whether this would fix the devtools that aren't webworker-aware. Anyway it looks like navigator in the webworker is readonly so this wouldn't fix things in the webworker environment. I think the solution forward is to move off the Chrome debugger and run the RN code in a pristine V8 context via Node FWIW.

@ptmt
Copy link
Contributor Author

ptmt commented Nov 25, 2015

There is the new related PR #4083. I'm closing mine, since it's no more relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants