Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Support new pure HOC component (#1173)
Browse files Browse the repository at this point in the history
  • Loading branch information
bvaughn committed Oct 1, 2018
1 parent 69d137c commit 6284929
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions backend/attachRendererFiber.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ function getInternalReactConstants(version) {
FORWARD_REF_SYMBOL_STRING: 'Symbol(react.forward_ref)',
PROFILER_NUMBER: 0xead2,
PROFILER_SYMBOL_STRING: 'Symbol(react.profiler)',
PURE_NUMBER: 0xead3,
PURE_SYMBOL_STRING: 'Symbol(react.pure)',
STRICT_MODE_NUMBER: 0xeacc,
STRICT_MODE_SYMBOL_STRING: 'Symbol(react.strict_mode)',
PLACEHOLDER_NUMBER: 0xead1,
Expand Down Expand Up @@ -127,6 +129,8 @@ function attachRendererFiber(hook: Hook, rid: string, renderer: ReactRenderer):
CONTEXT_PROVIDER_SYMBOL_STRING,
PROFILER_NUMBER,
PROFILER_SYMBOL_STRING,
PURE_NUMBER,
PURE_SYMBOL_STRING,
STRICT_MODE_NUMBER,
STRICT_MODE_SYMBOL_STRING,
PLACEHOLDER_NUMBER,
Expand Down Expand Up @@ -258,6 +262,17 @@ function attachRendererFiber(hook: Hook, rid: string, renderer: ReactRenderer):
: symbolOrNumber;

switch (switchValue) {
case PURE_NUMBER:
case PURE_SYMBOL_STRING:
nodeType = 'Special';
if (type.displayName) {
name = type.displayName;
} else {
const displayName = type.render.displayName || type.render.name;
name = displayName ? `Pure(${displayName})` : 'Pure';
}
children = [];
break;
case CONCURRENT_MODE_NUMBER:
case CONCURRENT_MODE_SYMBOL_STRING:
case DEPRECATED_ASYNC_MODE_SYMBOL_STRING:
Expand Down

0 comments on commit 6284929

Please sign in to comment.