From f4d52a2fcdeffd4854338d4fab1c07919038084a Mon Sep 17 00:00:00 2001 From: Austin Wood Date: Tue, 6 Apr 2021 13:43:39 -0600 Subject: [PATCH] Update peer deps to React 16.3+ Revert commit 220e2f0 and bump peer deps to fully support React.forwardRef --- package.json | 2 +- src/withStyles.jsx | 27 ++++++--------------------- 2 files changed, 7 insertions(+), 22 deletions(-) diff --git a/package.json b/package.json index 342a6e0e..38e28af2 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,7 @@ }, "peerDependencies": { "@babel/runtime": "^7.0.0", - "react": ">=0.14", + "react": "^16.3 || ^17", "react-with-direction": "^1.3.1" }, "dependencies": { diff --git a/src/withStyles.jsx b/src/withStyles.jsx index 198a3ae4..22c4ac4d 100644 --- a/src/withStyles.jsx +++ b/src/withStyles.jsx @@ -1,9 +1,8 @@ /* eslint-disable no-param-reassign */ -import React from 'react'; +import React, { forwardRef } from 'react'; import hoistNonReactStatics from 'hoist-non-react-statics'; import getComponentName from 'airbnb-prop-types/build/helpers/getComponentName'; -import ref from 'airbnb-prop-types/build/ref'; import EMPTY_STYLES_FN from './utils/emptyStylesFn'; import withPerf from './utils/perf'; @@ -233,10 +232,8 @@ export function withStyles( return ( ( - - )); + const ForwardedWithStyles = forwardRef((props, ref) => ( + + )); // Copy the wrapped component's prop types and default props on WithStyles if (WrappedComponent.propTypes) {