Skip to content

Commit adeef99

Browse files
authored
Apply ThemeManager ThemeContext in asBaseComponent (#2152)
1 parent 3360d8b commit adeef99

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/commons/asBaseComponent.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import hoistStatics from 'hoist-non-react-statics';
33
import * as Modifiers from './modifiers';
4-
import {Scheme} from '../style';
4+
import {Scheme, ThemeManager} from '../style';
55
import forwardRef from './forwardRef';
66
import UIComponent from './UIComponent';
77

@@ -76,6 +76,10 @@ function asBaseComponent<PROPS, STATICS = {}>(WrappedComponent: React.ComponentT
7676
BaseComponent.displayName = WrappedComponent.displayName;
7777
BaseComponent.propTypes = WrappedComponent.propTypes;
7878
BaseComponent.defaultProps = WrappedComponent.defaultProps;
79+
const ThemeContext = ThemeManager.getThemeContext();
80+
if (ThemeContext) {
81+
BaseComponent.contextType = ThemeContext;
82+
}
7983

8084
return forwardRef(BaseComponent) as any;
8185
}

0 commit comments

Comments
 (0)