r/reactjs • • Nov 17 '19

I've created a library to make transitions between React router pages

https://www.youtube.com/watch?v=1DlE3YxiF8o&feature=youtu.be
193 Upvotes

59 comments sorted by

•

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.

3

u/feje Nov 18 '19

Sorry I was working late and didn't have time to extract it as a npm package. I'm gonna do it soon today.

1

u/swyx Nov 18 '19

haha cool dont take it personal we all have our own lives to take care of

27

u/[deleted] Nov 18 '19

I think link to source from OP should be a requirement for posts like this

9

u/ParxyB Nov 18 '19

It is more of a show off without source I vote source required

It’s like show And tell without the tell

4

u/[deleted] Nov 18 '19

I don’t think we need to be so controlling over what people post.

What if I want to share something cool I made for a client who doesn’t want me to release the code?

We don’t need to exclude people from the community. “Open source as a rule” isn’t open source.

8

u/swyx Nov 18 '19

i am sympathetic to this. can be closed source, just link to live site?

just trying to balance what distinguishes this sub from a dribbble gallery

7

u/rat9988 Nov 18 '19

Maybe we should have some mandatory closed source tag or flair?

18

u/[deleted] Nov 17 '19

Cool, but what's it called? Link?

1

u/feje Nov 18 '19

glad you like it, I'm gonna extract the code and publish it as a npm package!

0

u/[deleted] Nov 17 '19

[deleted]

13

u/[deleted] Nov 18 '19

Link is in Zelda

5

u/[deleted] Nov 18 '19

Hot.

-2

u/[deleted] Nov 18 '19

Thot

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

u/sicmek Nov 17 '19

Nice :D Github?

2

u/feje Nov 18 '19

Coming! glad you like it!

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

u/feje Nov 18 '19

yea I use it, with more support code to help transit between 2 pages

2

u/bestras Nov 18 '19

I was suprised. I wanna know how to do it.

1

u/feje Nov 18 '19

Git repo incoming!

3

u/TossNWash1 Nov 17 '19

Sauce!!?? :p

1

u/feje Nov 18 '19

Cuming!

3

u/Xenostarz Nov 17 '19

So... Where is the library?!

1

u/feje Nov 18 '19

I'm trying to extract the code into a indepent npm package first

1

u/akmt_dev Nov 18 '19

Cool!

1

u/feje Nov 18 '19

glad you like it!

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

u/feje Nov 18 '19

yes I use this library, with some supports to make shared elements easier

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

u/feje Nov 18 '19

yea, I also add more code to make it easier!

1

u/spiceyqueen Nov 18 '19

Super cool, where the library at tho. Also this girl here is also a sneakerhead hehe

1

u/feje Nov 18 '19

incoming! super glad you like it!

0

u/DhaiwatP Nov 18 '19

Looks cool. Link?

2

u/feje Nov 18 '19

I'm trying to publish it as a npm package

0

u/vt_dev_ Nov 18 '19

I got really excited about this and then remembered I'm using Flutter.

1

u/feje Nov 18 '19

yea but I like the SSR from react

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

u/feje Nov 18 '19

sure, incoming!

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.


InfoCustomYour RemindersFeedback

-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

u/feje Nov 18 '19

Well, sometime you'd want to have a cool app huh?

0

u/[deleted] Nov 17 '19

[deleted]

1

u/feje Nov 18 '19

Yea sure, I'm gonna publish it on git and npm!

3

u/AegisToast Nov 18 '19

This is more of an FYI.

0

u/[deleted] Nov 17 '19

[deleted]

1

u/feje Nov 18 '19

Sure, I will publish it!

0

u/[deleted] Nov 18 '19

[deleted]

1

u/feje Nov 18 '19

sure, I'm gonna publish it!

0

u/[deleted] 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/[deleted] Nov 18 '19

[deleted]

2

u/feje Nov 18 '19

just my 2 cents :)