diff --git a/src/components/Alert.tsx b/src/components/Alert.tsx index fe657319..96ab750e 100644 --- a/src/components/Alert.tsx +++ b/src/components/Alert.tsx @@ -201,7 +201,8 @@ export class Alert extends React.Component { title, confirmBtnLevel, alertBtnLevel, - classnames: cx + classnames: cx, + theme } = this.props; const __ = this.props.translate; const finalTitle = __(this.state.title ?? title); @@ -226,7 +227,8 @@ export class Alert extends React.Component { this.state.controls, this.state.value, this.handleFormSubmit, - this.scopeRef + this.scopeRef, + theme ) ) : ( @@ -258,7 +260,8 @@ function renderForm( controls: Array, value: PlainObject = {}, callback?: (values: PlainObject) => void, - scopeRef?: (value: any) => void + scopeRef?: (value: any) => void, + theme?: string ) { return renderSchema( { @@ -271,7 +274,8 @@ function renderForm( { data: value, onFinished: callback, - scopeRef + scopeRef, + theme }, { session: 'prompt' diff --git a/src/theme.tsx b/src/theme.tsx index 12f29468..8d2964b8 100644 --- a/src/theme.tsx +++ b/src/theme.tsx @@ -120,10 +120,11 @@ export interface ThemeProps { className?: string; classPrefix: string; classnames: ClassNamesFn; + theme?: string; } -export const ThemeContext = React.createContext('theme'); export let defaultTheme: string = 'default'; +export const ThemeContext = React.createContext(undefined); export function themeable< T extends React.ComponentType & ThemeProps> & { @@ -156,9 +157,11 @@ export function themeable< const injectedProps: { classPrefix: string; classnames: ClassNamesFn; + theme: string; } = { classPrefix: config.classPrefix as string, - classnames: config.classnames + classnames: config.classnames, + theme }; return (