From 266ae0f0e1b956c6a12ad70ed177e2bf13a805fe Mon Sep 17 00:00:00 2001 From: Cam Spiers Date: Mon, 30 Apr 2018 10:25:45 -0700 Subject: [PATCH] Fix forwardRef handling in snapshot tests Previous PR #6069 didn't actually fix the issue, as it wasn't correctly comparing the forwardRefSymbol with `element.type.$$typeof` --- packages/pretty-format/src/plugins/react_element.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/pretty-format/src/plugins/react_element.js b/packages/pretty-format/src/plugins/react_element.js index 1fd2be25b83d..25fbc6f9ac1c 100644 --- a/packages/pretty-format/src/plugins/react_element.js +++ b/packages/pretty-format/src/plugins/react_element.js @@ -43,7 +43,8 @@ const getType = element => { if (element.type === fragmentSymbol) { return 'React.Fragment'; } - if (element.type === forwardRefSymbol) { + if (typeof element.type === 'object' && element.type !== null + && element.type.$$typeof === forwardRefSymbol) { const functionName = element.type.render.displayName || element.type.render.name || '';