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

How to bring popups into the same context as the rest of the app? #1257

Open
anchann opened this issue Feb 16, 2021 · 2 comments
Open

How to bring popups into the same context as the rest of the app? #1257

anchann opened this issue Feb 16, 2021 · 2 comments

Comments

@anchann
Copy link

anchann commented Feb 16, 2021

ReactXP seems to have this sort of top level component layout:

RootView
    MainViewContainer
        the top level component for your application goes here, e.g. <App/>
    PopupContainerView
        individual popups go here

My App has the following layout:

<BrowserRouter>
    ... actual content that depends on current route, etc ...
</BrowserRouter>

The BrowserRoute component (from react-router) internally uses react's context infrastructure to make routing/navigation primitives accessible to child components deep down the tree, without explicitly passing them around as props.

If I want to display a popup which has a link for navigating to a different route, the <Link> or any routing related component relies on being a descendent of the original <BrowserRouter> component which defines the shared context. With the ReactXP setup, however, popups are rendered outside of the <App>, and thus don't have access to the shared context established by <BrowserRouter>.

I tried to search for a way to wrap the whole RootView in a context, or somehow inject additional context into PopupContainerView, but could not find any APIs that would allow me to do this. What is the recommended way for handling this issue?

Thank you!

@anchann
Copy link
Author

anchann commented Mar 5, 2021

Is there anything I can do in order to get a response on this issue? Sorry if the issue somehow malformed...

@anchann
Copy link
Author

anchann commented Mar 17, 2021

I've implemented a way to provide a wrapper function to achieve the desired behaviour. Feel free to take a look:

#1264

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

1 participant