Temzasse / react-modal-sheet

Flexible bottom sheet component built with Framer Motion to provide buttery smooth UX while keeping accessibility in mind 🪐
https://temzasse.github.io/react-modal-sheet/
MIT License
791 stars 75 forks source link

LazyMotion Support/Integration #36

Closed do-wa closed 1 year ago

do-wa commented 3 years ago

Hi!

first of all: Great work and thank you for this lib.

I was wondering if you see any way to support LazyMotion (https://www.framer.com/api/motion/guide-reduce-bundle-size/) inside your package.

I tested an initial implementation (really just replacing the motion import with m) and published it for my personal project. https://www.npmjs.com/package/react-lazy-modal-sheet

The caveat is of course the requirement to use LazyMotion in a root component which needs to be handled in user space (afaik).

Do you think there is any way to support both lazy and non-lazy users? Or is this a bad idea? Maybe the solution would be to have a build step which replaces the import and publish two separated packages?

If you don't care about this, I would try to regularly fetch the upstream changes and update my published package.

Greetings

do-wa

Temzasse commented 2 years ago

Sorry for not responding earlier. I would love to support LazyMotion but I'm not quite sure how to do it 🤔

Maybe it would be possible to to export a lazy version like so:

import LazySheet from 'react-modal-sheet/lazy';

I'll try to investigate this when I have some free time 🕵🏻‍♂️

Temzasse commented 1 year ago

Not planning on supporting this for now. Feel free to open a PR if this is still needed 🙂