Skip to content

Commit 93d8137

Browse files
authored
[Electron] Make 2.0 backwards compatible with old RN (facebook#500)
* [Electron] Make 2.0 backwards compatible with old RN * Clarify event
1 parent 9eded55 commit 93d8137

File tree

3 files changed

+1727
-0
lines changed

3 files changed

+1727
-0
lines changed

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# node_modules ignored by default
22

33
**/build/**
4+
**/vendor/**
45
**/node_modules/**
56
flow/*

packages/react-devtools-core/src/standalone.js

+11
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,19 @@ function onError(e) {
5757

5858
function initialize(socket) {
5959
var listeners = [];
60+
var isLegacyRN = false;
6061
socket.onmessage = (evt) => {
6162
if (evt.data === 'attach:agent') {
63+
// <hack>
64+
// TODO: This branch (and vendor/backend-1.0.6.js) can be removed when we're comfortable dropping
65+
// support for RN <= 0.42 in Nuclide RN inspector. We used to send backend to RN to `eval`
66+
// but in newer RN versions we just import the backend from npm package.
67+
// We use `attach:agent` to detect old RN versions because we don't send it anymore.
68+
if (!isLegacyRN) {
69+
isLegacyRN = true;
70+
socket.send('eval:' + fs.readFileSync(path.join(__dirname, '../vendor/backend-1.0.6.js')));
71+
}
72+
// </hack>
6273
return;
6374
}
6475
var data = JSON.parse(evt.data);

0 commit comments

Comments
 (0)