reoverlay icon indicating copy to clipboard operation
reoverlay copied to clipboard

Change properties of Modal

Open InsOpDe opened this issue 5 years ago • 2 comments

Consider following scenario:

const SomeComponent: FC = () => {
	const {
		dispatchFileAction,
		files
	} = useFile()
	return (
	    <button
		    onClick={ (): void => {
			    Reoverlay.showModal(FileBrowserModal, {
				    files,
				    onFolderOpen: (file): void => {
					    void dispatchFileAction({
						    payload: file.key,
						    type: EFileAction.openDirectory
					    })
				    }
			    })
		    } }
		    type="button"
	    >
		    Toggle File Browser
	    </button>
	)
}

How would I correctly update properties of the used modal FileBrowserModal?

Would be a static method like Reoverlay.updateProps feasable?

InsOpDe avatar Feb 22 '21 08:02 InsOpDe

@InsOpDe That sounds like a good idea, but you can actually access files in FileBrowserModal component itself. You don't need to pass it as props I'm saying...

hiradary avatar Feb 22 '21 11:02 hiradary

Thanks for your reply.

That might work for this particular scenario, but it is no solution you can apply to all problems

InsOpDe avatar Feb 22 '21 11:02 InsOpDe