From 236c88a3407aee0534f7527b55057d4aa7673ed2 Mon Sep 17 00:00:00 2001 From: Ashley Wilson Date: Wed, 18 Dec 2019 14:13:23 +0000 Subject: [PATCH 1/2] feat: Support ref objects Ala createRef --- lib/components/themr.js | 2 +- src/components/themr.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/components/themr.js b/lib/components/themr.js index 78d04c5..c907d51 100644 --- a/lib/components/themr.js +++ b/lib/components/themr.js @@ -196,7 +196,7 @@ var _default = function _default(componentName, localTheme) { _defineProperty(Themed, "propTypes", _objectSpread({}, ThemedComponent.propTypes, { composeTheme: _propTypes["default"].oneOf([COMPOSE_DEEPLY, COMPOSE_SOFTLY, DONT_COMPOSE]), - innerRef: _propTypes["default"].func, + innerRef: _propTypes["default"].oneOfType([_propTypes["default"].func, _propTypes["default"].object]), theme: _propTypes["default"].object, themeNamespace: _propTypes["default"].string, mapThemrProps: _propTypes["default"].func diff --git a/src/components/themr.js b/src/components/themr.js index c76c6f9..6cf57a7 100644 --- a/src/components/themr.js +++ b/src/components/themr.js @@ -70,7 +70,7 @@ export default (componentName, localTheme, options = {}) => ThemedComponent => { COMPOSE_SOFTLY, DONT_COMPOSE ]), - innerRef: PropTypes.func, + innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]), theme: PropTypes.object, themeNamespace: PropTypes.string, mapThemrProps: PropTypes.func From dff97fa24ec609269d46d1ca25e89de7fdd91645 Mon Sep 17 00:00:00 2001 From: Ashley Wilson Date: Wed, 18 Dec 2019 14:13:58 +0000 Subject: [PATCH 2/2] feat: Move innerRef to the themr component --- index.d.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/index.d.ts b/index.d.ts index ee355ae..8d187ae 100644 --- a/index.d.ts +++ b/index.d.ts @@ -17,7 +17,6 @@ declare module "@friendsofreactjs/react-css-themr" { } export interface ThemeProviderProps { - innerRef?: Function, theme: TReactCSSThemrTheme } @@ -35,6 +34,6 @@ declare module "@friendsofreactjs/react-css-themr" { identifier: string | number | symbol, defaultTheme?: {}, options?: IThemrOptions - ): (component: (new(props: P, context?: any) => React.Component) | React.SFC

) => - ThemedComponentClass

}, S>; + ): (component: (new(props: P, context?: any) => React.Component) | React.SFC

) => + ThemedComponentClass

, innerRef?: React.Ref }, S>; }