Skip to content

Commit

Permalink
Start updating to _next_ release of react-reconciler for devtools hook
Browse files Browse the repository at this point in the history
  • Loading branch information
iamdustan committed Nov 6, 2017
1 parent 01b7a23 commit 63112d5
Show file tree
Hide file tree
Showing 5 changed files with 388 additions and 39 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"dependencies": {
"invariant": "^2.2.0",
"lodash": "^3.x.x",
"react-devtools": "^2.0.12",
"react-devtools": "^2.5.2",
"react-motion": "^0.5.2",
"react-reconciler": "^0.2.0",
"ws": "^1.1.0",
Expand Down
7 changes: 3 additions & 4 deletions src/fiber/devtools.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@ defineProperty(global, 'window', {
value: global
});

const {connectToDevTools} = require('react-devtools-core');

connectToDevTools({
const devtoolsInjection = {
isAppActive() {
// Don't steal the DevTools from currently active app.
return true;
},
host: 'localhost',
// default port? port: ,
resolveRNStyle: null, // TODO maybe: require('flattenStyle')
});
};

module.exports = devtoolsInjection;
13 changes: 3 additions & 10 deletions src/fiber/fiber.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const ReactFiberReconciler : (
hostConfig: HostConfig<*, *, *, *, *, *, *, *>
) => Reconciler<*, *, *> = require('react-reconciler');

const injectIntoDevToolsConfig = require('./devtools');
const eventListener = require('./events');
const update = require('../shared/update').default;
const solveClass = require('../shared/solveClass').default;
Expand Down Expand Up @@ -211,6 +212,8 @@ const BlessedReconciler = ReactFiberReconciler({
useSyncScheduling: true,
});

BlessedReconciler.injectIntoDevTools(injectIntoDevToolsConfig);

module.exports = {
render(element, screen, callback) {
let root = roots.get(screen);
Expand All @@ -229,13 +232,3 @@ module.exports = {
};

const roots = new Map();

/*
if (typeof injectInternals === 'function') {
injectInternals({
findFiberByHostInstance: () => null,// BlessedReconciler.getClosestInstanceFromNode,
findHostInstanceByFiber: BlessedReconciler.findHostInstance,
});
}
*/
1 change: 0 additions & 1 deletion src/fiber/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
require('./devtools');
module.exports = require('./fiber');

Loading

0 comments on commit 63112d5

Please sign in to comment.