ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

feat: sheet/card modal emit drag

Open EinfachHans opened this issue 4 years ago • 17 comments

Prequisites

Describe the Feature Request

If a FR like this already exist, please close, but i didn't found one.

It would be great to be able to "dig" into Animations and Gestures that are used in the Ionic Framework.

Describe the Use Case

It would allow us to show, hide or transform & animate stuff in the app while the user performs something. For example with the new sheet style modal we could fade content in or out if the modal is dragged up or dragged down.

Also this can be used for navigation animations.

Describe Preferred Solution

I guess this is kinda tricky, as this can be either defined globally or per component.

For example if i want to implement this for a Modal it must be possible for me to add this in the Component that the Modal uses like

this.modal.animation.subscribe()

Describe Alternatives

Currently i think something like this is possible if we copy/paste all the animations/gestures from ionic into our app and modify to call a handler, but this is not very good, as it doesn't update the animations if you update it internally 🤔

Related Code

No response

Additional Information

No response

EinfachHans avatar Sep 20 '21 16:09 EinfachHans

Can you please clarify what it means to "dig into an animation" in Ionic? It sounds like you are looking to get drag events emitted from the modal with the sheet gesture?

liamdebeasi avatar Sep 20 '21 16:09 liamdebeasi

Yes exactly. But not only the Drag Gesture and not only the Sheet Modal. If for example (when possible in the future) the sheet modal is changed via a function it should also executy my listener to perform my animations.

Or if we talk about Page Transistions this should work on the first navigate, as well on the navigate back or swipe to go back.

EinfachHans avatar Sep 20 '21 16:09 EinfachHans

Some of these animations/transitions are not meant to be extended/customized, so I would prefer not to add this feature to every animation unless we have use cases for each one.

The sheet modal use case makes sense (we have also had people ask about this internally), so I think we can add that one.

liamdebeasi avatar Sep 20 '21 17:09 liamdebeasi

Yeah maybe every animation was too much 😃 But i wouldn't limit this on sheet modals, we could start with modals in generall?

EinfachHans avatar Sep 20 '21 17:09 EinfachHans

How would regular modals benefit from the drag event?

liamdebeasi avatar Sep 20 '21 17:09 liamdebeasi

I think of the Card style modal which is also swipable, so here it wouldn't be showing or hiding more or less content, it would be more having the posibility to do cool animations when draging the modal away

EinfachHans avatar Sep 20 '21 17:09 EinfachHans

Thanks -- makes sense to have this work for card modal too.

liamdebeasi avatar Sep 20 '21 17:09 liamdebeasi

Hello, Any news about this issue? Would be amazing to get a way to subscribe to the drag event... Any workaround possible?

JulesLagadic avatar Apr 06 '22 13:04 JulesLagadic

Added additional thoughts here: https://github.com/ionic-team/ionic-framework/issues/25127#issuecomment-1104375899

Summary: We should add a dragEvents property to ion-modal, to allow developers to subscribe to the drag events for both card and sheet modals. Sheet modals should likely include information related to the breakpoint as well.

sean-perkins avatar Apr 20 '22 19:04 sean-perkins

Found an example of where this feature could be leveraged in Instagram's app:

https://user-images.githubusercontent.com/13732623/173140650-5acfce46-72c9-4743-b1a9-059fd4a27193.mp4

They center the active location in the middle of the content behind the sheet modal, when the sheet modal begins to drag.

sean-perkins avatar Jun 10 '22 19:06 sean-perkins

I also needs that to be able to hide dynamically some content when a modal is dragged 👍🏻

JulienLecoq avatar Apr 01 '23 04:04 JulienLecoq

Airbnb has UI that would require this feature, where the tab bar is moved off screen as the sheet modal is dragged.

https://github.com/ionic-team/ionic-framework/assets/13732623/9dd29c11-36a5-4381-904c-eec283ab606c

sean-perkins avatar Jul 06 '23 18:07 sean-perkins

In 2 years it was not implemented yet. :(

greg-md avatar Jul 06 '23 19:07 greg-md

Another use case: I would like to have a dragStart and dragEnd events on card modal to open and close the keyboard.

aeharding avatar Nov 21 '23 17:11 aeharding

2024 still waiting for dragStart/dragEnd events

Sovai avatar Jan 16 '24 08:01 Sovai