Skip to content

Commit

Permalink
[enzyme-adapter-react-16] [fix] avoid a Context.Provider deprecation …
Browse files Browse the repository at this point in the history
…warning
  • Loading branch information
ljharb committed May 6, 2019
1 parent b37fc29 commit f478970
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/enzyme-adapter-react-16/src/ReactSixteenAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -809,10 +809,10 @@ class ReactSixteenAdapter extends EnzymeAdapter {
// React stores references to the Provider on a Consumer differently across versions.
if (Consumer) {
let Provider;
if (Consumer.Provider) {
({ Provider } = Consumer);
} else if (Consumer._context) {
if (Consumer._context) { // check this first, to avoid a deprecation warning
({ Provider } = Consumer._context);
} else if (Consumer.Provider) {
({ Provider } = Consumer);
}
if (Provider) {
return Provider;
Expand Down

0 comments on commit f478970

Please sign in to comment.