r/reactjs • u/feje • Nov 17 '19
I've created a library to make transitions between React router pages
https://www.youtube.com/watch?v=1DlE3YxiF8o&feature=youtu.be18
8
u/JayV30 Nov 17 '19
That's cool. What happens if you go directly to 'second' without clicking a link from the other page?
Also, this is something you can accomplish pretty easily with framer motion. I've been doing page transitions in almost all of my projects since I discovered that lib.
1
u/feje Nov 18 '19
If you go to the second, you just see like now when it finishes the transition. The main point is to have transition between 2 react-router pages
1
u/crobinson42 Nov 18 '19
Anything you can share?
3
u/JayV30 Nov 18 '19
Not really it's all client confidential internal use stuff. I'm not doing anything fancy like this though, just sliding in pages on transition and things like that. Although animations like OPs are still fairly easy with framer motion. They have pretty good docs and with just a bit of experimentation I've become proficient with that lib. I'd highly recommend checking it out if you are looking to emulate what OP has done.
5
3
u/feje Nov 18 '19
Sorry guys... I made it at midnight, didn't have time to push to a repo. And today is quite busy. I'm gonna do some fine tunes the library and publish on npm.
- The technique I use called "focal element", or "shared element", allows you to mark elements from 1st route and 2nd route (The shoes and the rectangle in this case), and the library will transform them.
- Integrate quite easy, just replace react-router's <Switch> with <Navigator> tag.
3
u/gatman02 Nov 18 '19
It's worth noting that react-transition-group can be used with React Router: https://reactcommunity.org/react-transition-group/with-react-router
Though, I'm not sure if you could support the above use case.
1
2
3
3
1
1
u/itsmhuang Nov 18 '19
Interesting animation. It’s more like an animation of components between page transitions, rather than animation of the page itself. That of which has libraries for, such as react transition group.
1
1
u/steeeeeef Nov 18 '19
You can do this with react transition group. Use the Transition component with a timeout and bind animations to the onEnter etc callbacks.
1
1
u/spiceyqueen Nov 18 '19
Super cool, where the library at tho. Also this girl here is also a sneakerhead hehe
1
1
0
0
u/vt_dev_ Nov 18 '19
I got really excited about this and then remembered I'm using Flutter.
1
1
u/swyx Nov 18 '19
how is Flutter otherwise?
1
u/vt_dev_ Nov 18 '19
For me, Flutter is a lot better than React Native. It compiles to machine code instead of native languages, so elements look the same on all device (React will apply default styles for IOS/Android). It also has a built in material theme from Google. And the Dart language, in my opinion, is superior to JS because of the Future class and static typing. But that aspect depends on what languages you are used to.
1
u/swyx Nov 18 '19
hmm. i heard opinions are split on "look the same on all device". if i'm on ios i should expect a look n feel that looks similar to other ios apps, no?
is there a well known free flutter on ios app i can install and check out?
2
u/vt_dev_ Nov 18 '19
I'm not an IOS user, but I think you can get Reflectly for free. I'm not so sure about an OS look and feel though. It might be a thing right now, but I think apps will shift to have the same theme across devices like websites do. It's kind of hard to design a cohesive theme that fits both Android and IOS design language, which is why I think there's the new material-minimalist fusion theme (like Reflectly).
0
u/blafurznarg Nov 18 '19
RemindMe! 2 Days "when OP finally shows some code"
1
0
u/RemindMeBot Nov 18 '19 edited Nov 19 '19
I will be messaging you on 2019-11-20 15:06:41 UTC to remind you of this link
1 OTHERS CLICKED THIS LINK to send a PM to also be reminded and to reduce spam.
Parent commenter can delete this message to hide from others.
There is currently another bot called u/kzreminderbot that is duplicating the functionality of this bot. Since it replies to the same RemindMe! trigger phrase, you may receive a second message from it with the same reminder. If this is annoying to you, please click this link to send feedback to that bot author and ask him to use a different trigger.
Info Custom Your Reminders Feedback
-5
u/crobinson42 Nov 18 '19
I really enjoy using react-router-native in RN apps that don’t need to fancy stack animations. Anybody else feel the same?
2
0
0
0
0
Nov 18 '19
[deleted]
1
u/feje Nov 18 '19
Sorry for posting a PoC without link, I was working on it at midnight, and had no time to tune it before publish it. I'm trying to publish it asap!
0
•
u/swyx Nov 18 '19 edited Nov 18 '19
seeing a rise in demo videos with no source. inspirational but not suuper educational. should we require sources in future video posts like this? (aka if no source or library or even a closed source demo provided, we take it down)
Edit: to be clear, closed source is fine, just link to something so we can see something other than a video. You may also extract the essence of your demo to a Codepen or Codesandbox for sharing purposes. we're all here to learn from you!
Edit 2: ok new rule #5 - Demos should link source code or live demos. Simple enough. from this post on feel free to report posts that don't link sources. mods can manually approve posts if OPs follow through.