From 1aef7e4629d6777af60c6c49f92ea1c1f2a892e6 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Thu, 18 Aug 2016 15:46:02 -0700 Subject: [PATCH] Update hook event names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: This brings RN up to date with https://github.com/facebook/react/pull/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 https://github.com/facebook/react-native/pull/9383 Differential Revision: D3738463 Pulled By: spicyj fbshipit-source-id: 791cdbc5558666a101fa403f4e7852f700038fc9 --- Libraries/Utilities/Systrace.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/Libraries/Utilities/Systrace.js b/Libraries/Utilities/Systrace.js index 0bd4536a8c69b6..01d6d446950075 100644 --- a/Libraries/Utilities/Systrace.js +++ b/Libraries/Utilities/Systrace.js @@ -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) {