File tree Expand file tree Collapse file tree 3 files changed +24
-2
lines changed
apps/kitchen-sink/src/ensemble/screens
packages/runtime/src/runtime/modal Expand file tree Collapse file tree 3 files changed +24
-2
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @ensembleui/react-kitchen-sink " : patch
3+ " @ensembleui/react-runtime " : patch
4+ ---
5+
6+ ensure navigateModalScreen supports custom widget title
Original file line number Diff line number Diff line change 4242 inputs :
4343 storVar : ${ensemble.storage.get('inputVal')}
4444 userVar : ${ensemble.user}
45+ title :
46+ Column :
47+ children :
48+ - Text :
49+ text : Modal title
50+ - Text :
51+ text : Modal subtitle
52+ styles :
53+ fontSize : ${typography.fontSize['14']}
54+ fontWeight : ${typography.fontWeight.light}
4555 - Button :
4656 label : show dialog
4757 onTap :
Original file line number Diff line number Diff line change @@ -83,6 +83,7 @@ export const ModalWrapper: React.FC<PropsWithChildren> = ({ children }) => {
8383 isDialog : boolean ;
8484 key : string ;
8585 context ?: { [ key : string ] : unknown } ;
86+ title ?: React . ReactNode ;
8687 } > ( ) ;
8788 const evaluatedOptions = useEvaluate (
8889 nextModal
@@ -125,7 +126,10 @@ export const ModalWrapper: React.FC<PropsWithChildren> = ({ children }) => {
125126 const nextModalState = {
126127 visible : true ,
127128 content : nextModal . content ,
128- options : evaluatedOptions . options ,
129+ options : {
130+ ...evaluatedOptions . options ,
131+ ...( nextModal . title ? { title : nextModal . title } : { } ) ,
132+ } ,
129133 key : nextModal . key ,
130134 isDialog : Boolean ( nextModal . isDialog ) ,
131135 } ;
@@ -154,12 +158,14 @@ export const ModalWrapper: React.FC<PropsWithChildren> = ({ children }) => {
154158 isDialog = false ,
155159 modalContext ?: { [ key : string ] : unknown } ,
156160 ) : void => {
161+ const hasStringTitle = isString ( options . title ) ;
157162 setNextModal ( {
158163 content,
159- options : omit ( options , [ ! isString ( options . title ) ? "title" : "" ] ) ,
164+ options : hasStringTitle ? options : omit ( options , "title" ) ,
160165 isDialog,
161166 context : modalContext ,
162167 key : generateRandomString ( 10 ) ,
168+ title : hasStringTitle ? undefined : options . title ,
163169 } ) ;
164170 } ,
165171 [ ] ,
You can’t perform that action at this time.
0 commit comments