From 9744ff5ba61eefd2150a7788f56e0ed62cc23ff0 Mon Sep 17 00:00:00 2001 From: 2betop <2betop.cn@gmail.com> Date: Tue, 30 Jun 2020 09:39:26 +0800 Subject: [PATCH] =?UTF-8?q?Prompt=20=E7=9A=84=20form=20=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E4=BF=9D=E6=8C=81=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Alert.tsx | 12 ++++++++---- src/theme.tsx | 7 +++++-- 2 files changed, 13 insertions(+), 6 deletions(-) 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 (