Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change properties of Modal #10

Open
InsOpDe opened this issue Feb 22, 2021 · 2 comments
Open

Change properties of Modal #10

InsOpDe opened this issue Feb 22, 2021 · 2 comments

Comments

@InsOpDe
Copy link

InsOpDe commented Feb 22, 2021

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?

@hiradary
Copy link
Owner

@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...

@InsOpDe
Copy link
Author

InsOpDe commented Feb 22, 2021

Thanks for your reply.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants