File tree Expand file tree Collapse file tree 6 files changed +34
-13
lines changed
packages/react-native/src/modal Expand file tree Collapse file tree 6 files changed +34
-13
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @td-design/react-native ' : patch
3+ ---
4+
5+ feat: Modal的几个方法的title属性支持传入自定义组件
Original file line number Diff line number Diff line change @@ -69,9 +69,13 @@ const AlertContainer: FC<
6969 { ! ! icon && < Flex justifyContent = "center" > { icon } </ Flex > }
7070 { ! ! title && (
7171 < Flex justifyContent = "center" marginVertical = "x2" >
72- < Text variant = "h1" color = "text" >
73- { title }
74- </ Text >
72+ { typeof title === 'string' ? (
73+ < Text variant = "h1" color = "text" >
74+ { title }
75+ </ Text >
76+ ) : (
77+ title
78+ ) }
7579 </ Flex >
7680 ) }
7781 { typeof content === 'string' ? (
Original file line number Diff line number Diff line change @@ -39,9 +39,13 @@ const ConfirmContainer: FC<
3939 < Box marginBottom = "x2" >
4040 { ! ! icon && < Flex justifyContent = "center" > { icon } </ Flex > }
4141 < Flex flexDirection = "column" justifyContent = "center" marginVertical = "x2" >
42- < Text variant = "h1" color = "text" >
43- { title }
44- </ Text >
42+ { typeof title === 'string' ? (
43+ < Text variant = "h1" color = "text" >
44+ { title }
45+ </ Text >
46+ ) : (
47+ title
48+ ) }
4549 </ Flex >
4650 { typeof content === 'string' ? (
4751 < Flex justifyContent = "center" >
Original file line number Diff line number Diff line change @@ -46,9 +46,13 @@ const PromptContainer: FC<
4646 < Box marginBottom = "x2" >
4747 < Flex flexDirection = "column" justifyContent = "center" marginBottom = "x2" >
4848 < Flex justifyContent = "center" marginVertical = "x2" >
49- < Text variant = "h1" color = "text" >
50- { title }
51- </ Text >
49+ { typeof title === 'string' ? (
50+ < Text variant = "h1" color = "text" >
51+ { title }
52+ </ Text >
53+ ) : (
54+ title
55+ ) }
5256 </ Flex >
5357 { typeof content === 'string' ? (
5458 < Text variant = "p1" color = "text" >
Original file line number Diff line number Diff line change @@ -57,9 +57,13 @@ const TipContainer: FC<
5757 < Box marginBottom = "x2" >
5858 { ! ! title && (
5959 < Flex justifyContent = "center" marginVertical = "x2" >
60- < Text variant = "h1" color = "text" >
61- { title }
62- </ Text >
60+ { typeof title === 'string' ? (
61+ < Text variant = "h1" color = "text" >
62+ { title }
63+ </ Text >
64+ ) : (
65+ title
66+ ) }
6367 </ Flex >
6468 ) }
6569 { typeof content === 'string' ? (
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ export interface AlertProps {
3434 /** 警示性图标 */
3535 icon ?: ReactNode ;
3636 /** 标题 */
37- title : string ;
37+ title : ReactNode ;
3838 /** 内容 */
3939 content ?: ReactNode ;
4040 /** 按钮文本 */
You can’t perform that action at this time.
0 commit comments