shuding / next-view-transitions

Use CSS View Transitions API in Next.js App Router.
https://next-view-transitions.vercel.app
MIT License
1.84k stars 55 forks source link

Conditionally apply `viewTransitionName` styles to element based on the transition state #36

Open piotrkulpinski opened 1 month ago

piotrkulpinski commented 1 month ago

Hi,

I'm trying to implement custom view transitions similar to the one I've implemented on OpenAlternative website.

I was using Remix at that site, and they have a nice helper hook to check the state of the transitions and only apply transition styles if it's active: https://remix.run/docs/en/main/hooks/use-view-transition-state

Is it also possible in next-view-transitions package?

Without this, all of the transitions get triggered simultaneously at the page which creates weird effects: https://share.cleanshot.com/C0mPB6m1

Thanks!

shuding commented 1 month ago

Sounds like something nice to have 👍 open to accept PRs for this one.