Hi, I want to create custom renderer for showDialog with React and most importantly the state on react component should be returned on promise result as well. how can i achieve that?
Did you try using ReactWidget
(see React — JupyterLab 4.1.0a3 documentation) with getValue()
method which would expose the state and passing it to the body
of showDialog
(this is documented in IOptions | @jupyterlab)?
I did use ReactWidget, but didn’t know about this getValue() thing. Thank you very much, @krassowski
One more thing, could you please also tell me how can I programmatically close dialog from React? I’ve tried passing one of dialog button’s to react as prop and calling button.accept() method within React. Although this resolved dialog’s promise, dialog screen was still visible on screen
I do not think there is a clean way to do so, but maybe something like document.querySelector('#my-dialog-body').parentElement.querySelector('#my-button').click()
could work.