jaredpalmer / after.js

Next.js-like framework for server-rendered React apps built with React Router
https://npm.im/@jaredpalmer/after
MIT License
4.13k stars 201 forks source link

Route Transitions with Pose #172

Open MrLoh opened 6 years ago

MrLoh commented 6 years ago

Feature Request

Problem Description

I was trying to setup After.js with Custom Route transitions, using Posed, as described in this article: https://popmotion.io/pose/learn/route-transitions-react-router/

Unfortunately Pose just works properly, if the Switch component can be wrapped directly and is passed a location prop explicitly. Which is not possible by default with After.js

Suggested Solutions

I got it working by forking the implementation of the After component to allow me to wrap the Switch component directly in a transition container (see https://github.com/MrLoh/afterjs-apollo-rnw-styled-pose-example/blob/master/src/AfterWithTransition.js)

This is obviously not a great solution. Maybe it would be possible to pass a Wrapper component to the After component to prevent this issue. Since the After component is only used explicitly on the client, this introduces more complexity though.

I could imagine, that it would be easier, if the interface for customRenderer also explicitly uses the After component and requires also setting the StaticRouter manually. This would also help in setting up content for all routes like a header outside of the router switch, which currently isn't possible on the server.

I'd be happy to come up with a PR, but this should be discussed first, as it deals with the architecture of After.


jaredpalmer commented 6 years ago

Yes. Just like gatsby 2, lack of a layout component makes this impossible. Let’s fix it

MrLoh commented 6 years ago

Maybe the easiest way would be to pass a layout component to both After and to render (just like document). I think that should work for both: non switch routes and transitions.

MrLoh commented 6 years ago

@jaredpalmer I whipped up a quick PR #173 of how this could work

stale[bot] commented 5 years ago

Hola! So here's the deal, between open source and my day job and life and what not, I have a lot to manage, so I use a GitHub bot to automate a few things here and there. This particular GitHub bot is going to mark this as stale because it has not had recent activity for a while. It will be closed if no further activity occurs in a few days. Do not take this personally--seriously--this is a completely automated action. If this is a mistake, just make a comment, DM me, send a carrier pidgeon, or a smoke signal.

MrLoh commented 5 years ago

There’s a PR in flight for this, so it’s not stale.

stale[bot] commented 5 years ago

Hola! So here's the deal, between open source and my day job and life and what not, I have a lot to manage, so I use a GitHub bot to automate a few things here and there. This particular GitHub bot is going to mark this as stale because it has not had recent activity for a while. It will be closed if no further activity occurs in a few days. Do not take this personally--seriously--this is a completely automated action. If this is a mistake, just make a comment, DM me, send a carrier pidgeon, or a smoke signal.

MrLoh commented 5 years ago

PR pending

MiYogurt commented 5 years ago

God, to solve the Layout problem and routing animation problem, I need to modify most of the After. JS files.

image

React is very difficult to insert in After. JS at some level.

I thnik in customRenderer function should pass {route, data} params. let user can self replace After.tsx or After.tsx add some wrap component interface。

fa7ad commented 4 years ago

Hey people, did anybody ever figure out a simple solution to this?

MrLoh commented 4 years ago

yes, switching to next, haven't regretted it for a second

fa7ad commented 4 years ago

That doesn't sound like a solution. Specially with that horrible routing system.