Skip to content

Commit

Permalink
Update hook event names
Browse files Browse the repository at this point in the history
Summary:
This brings RN up to date with facebook/react#7472 (scheduled for React 15.3.1).
If you use React 15.3.1 with RN without this patch, Systrace output will lack the reconciler events.

(Since it’s a niche feature it didn’t seem to me that full backward compat is necessary so I just removed old hooks. This won’t cause crashes—it’s just you won’t get events in Systrace if you use new React but old RN.)
Closes #9383

Differential Revision: D3738463

Pulled By: spicyj

fbshipit-source-id: 791cdbc5558666a101fa403f4e7852f700038fc9
  • Loading branch information
gaearon authored and Facebook Github Bot 5 committed Aug 18, 2016
1 parent aacfc37 commit 1aef7e4
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions Libraries/Utilities/Systrace.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,25 @@ let _enabled = false;
let _asyncCookie = 0;

const ReactSystraceDevtool = __DEV__ ? {
onBeginReconcilerTimer(debugID, timerType) {
onBeforeMountComponent(debugID) {
const displayName = require('react/lib/ReactComponentTreeDevtool').getDisplayName(debugID);
Systrace.beginEvent(`ReactReconciler.${timerType}(${displayName})`);
Systrace.beginEvent(`ReactReconciler.mountComponent(${displayName})`);
},
onEndReconcilerTimer(debugID, timerType) {
onMountComponent(debugID) {
Systrace.endEvent();
},
onBeforeUpdateComponent(debugID) {
const displayName = require('react/lib/ReactComponentTreeDevtool').getDisplayName(debugID);
Systrace.beginEvent(`ReactReconciler.updateComponent(${displayName})`);
},
onUpdateComponent(debugID) {
Systrace.endEvent();
},
onBeforeUnmountComponent(debugID) {
const displayName = require('react/lib/ReactComponentTreeDevtool').getDisplayName(debugID);
Systrace.beginEvent(`ReactReconciler.unmountComponent(${displayName})`);
},
onUnmountComponent(debugID) {
Systrace.endEvent();
},
onBeginLifeCycleTimer(debugID, timerType) {
Expand Down

0 comments on commit 1aef7e4

Please sign in to comment.