From 24286048487f40c09d76d63957fd131f89857698 Mon Sep 17 00:00:00 2001 From: Brian Vaughn Date: Mon, 26 Mar 2018 09:17:03 -0700 Subject: [PATCH] Check for polyfill suppress flag on cWU as well before warning --- packages/react-reconciler/src/ReactFiberClassComponent.js | 5 ++++- packages/react-reconciler/src/ReactStrictModeWarnings.js | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/react-reconciler/src/ReactFiberClassComponent.js b/packages/react-reconciler/src/ReactFiberClassComponent.js index f18574dccf935..4014e41e8145f 100644 --- a/packages/react-reconciler/src/ReactFiberClassComponent.js +++ b/packages/react-reconciler/src/ReactFiberClassComponent.js @@ -499,7 +499,10 @@ export default function( ) { foundWillReceivePropsName = 'UNSAFE_componentWillReceiveProps'; } - if (typeof instance.componentWillUpdate === 'function') { + if ( + typeof instance.componentWillUpdate === 'function' && + instance.componentWillUpdate.__suppressDeprecationWarning !== true + ) { foundWillUpdateName = 'componentWillUpdate'; } else if (typeof instance.UNSAFE_componentWillUpdate === 'function') { foundWillUpdateName = 'UNSAFE_componentWillUpdate'; diff --git a/packages/react-reconciler/src/ReactStrictModeWarnings.js b/packages/react-reconciler/src/ReactStrictModeWarnings.js index 0afaa74d520b4..de37ab620336c 100644 --- a/packages/react-reconciler/src/ReactStrictModeWarnings.js +++ b/packages/react-reconciler/src/ReactStrictModeWarnings.js @@ -213,7 +213,10 @@ if (__DEV__) { ) { pendingComponentWillReceivePropsWarnings.push(fiber); } - if (typeof instance.componentWillUpdate === 'function') { + if ( + typeof instance.componentWillUpdate === 'function' && + instance.componentWillUpdate.__suppressDeprecationWarning !== true + ) { pendingComponentWillUpdateWarnings.push(fiber); } };