-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Modal base on route #1172
Comments
I want to know too! Can anyone help? Thanks! |
Just do everything normal and create the modal (with Rough Example:
|
The problem is, when you get to the render() function through url routing, the 'previous page' is already gone, no way to pull it back and make it 'sit on the background'. Anyway, after a couple days effort I believe this kind of routing is not in favour of the library's philosophy, where (I think) it is believed that url should mean a solid state of the app, so whenever a user hits a url, exact same content should be shown. So if you believe otherwise, you might need to look somewhere else for solution. |
I've been wanting to support this for a while and we do now in 1.0! Check out the pinterest example on master. |
Nice |
I still see it as incomplete. Although its nearly perfect, it seems that on refresh, even if you arrive on the same URL with the modal, the modal will not trigger. Which kind of makes sense based on the architecture. But maybe you guys have an idea? Example:
|
Probably worth noting here that when looking at the source for the pinterest example be sure to check the code for the exact version of react-router you are using. The example in master currently passes through the Link state as follows:
Is 1.0.3
|
+1 on @andreigabreanu comment |
What kind of modals libraries is everyone dealing with? I'm finding the react-overlays library from the react-bootstrap folks works when I navigate to a route: https://github.com/react-bootstrap/react-overlays |
I'm using react-modal and so far it has done the job well.
|
Don't mean to resurrect an old issue but I think this got closed a bit prematurely. I'm trying to implement this now based on the Pinterest example outlined by @ryanflorence and I'm running up against the same issue that @andreigabreanu describes. On refresh, this completely breaks down and the modal content is rendered into the page instead. Has there been any headway on this at all in the current version of react-router? For what it's worth, I'm using my own Modal component but it works in much the same way other React modal components work, really. |
The Pinterest example seems to have two flaws: 1. there is no "back" support (i.e. |
There is no modal route. That's the point – it's one route that depends on how you get there. Note that on Pinterest itself, refreshing when you've popped up the modal for a pin will also drop the modal, just as in the bundled example. |
That's exactly the issue were talking about. While some things are just fine showing in their own page, that's not always desireable. (For example, some sites link directly to It would be great if there were a simple way to say "render this route WITHOUT removing the last route", and a way to specify a default route if there is no previous route. |
@mbrevda could you just handle that yourself in your root route component? If you want to render both the current route and the previous route, store the root component's Perhaps not the best solution but we do something similar w/ our use of react-router on www.treesnetwork.com and it solves our problem. |
Pretty sure I could. I was hoping, based on my needs and the many other requests here, that there could be an official solution. |
For anyone who stumbles across this issue trying to achieve parity with Twitter/Pinterest modals, here are a few things to note. The examples (v2 and v4) don't cover everything needed to achieve parity:
|
So basically what I am trying to achieve is the Pinterest style modal page for their pins. Whichever page you are on, when you click on a pin a modal with the pin details pops up, and the page where you are from still sit in the background. The url in the address bar changes so you can link to the pin from other sites or share it to your friends. And when you close the pin modal you go back to previous page.
Is react-router supporting this kind of routing?
The text was updated successfully, but these errors were encountered: