Skip to content

Commit

Permalink
Apply patch from enzymejs/enzyme#2189 (comment): support .contextType…
Browse files Browse the repository at this point in the history
… on components
  • Loading branch information
unverbraucht committed Mar 14, 2021
1 parent 8ebe478 commit fc16611
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-shallow-renderer",
"version": "16.14.1",
"version": "16.14.2",
"description": "React package for shallow rendering.",
"main": "index.js",
"repository": "https://github.com/NMinhNguyen/react-shallow-renderer.git",
Expand Down
4 changes: 3 additions & 1 deletion src/ReactShallowRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,9 @@ See https://fb.me/react-invalid-hook-call for tips about how to debug and fix th

this._rendering = true;
this._element = element;
this._context = getMaskedContext(elementType.contextTypes, context);
this._context = element.contextType
? context
: getMaskedContext(elementType.contextTypes, context);

// Inner memo component props aren't currently validated in createElement.
let prevGetStack;
Expand Down

0 comments on commit fc16611

Please sign in to comment.