-
Notifications
You must be signed in to change notification settings - Fork 13.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(modal): swipe modal from content #21227
feat(modal): swipe modal from content #21227
Conversation
Adds functionality to swipe the modal not just from the header but also from the content, if it's scrolled to the top.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any way we can do this without interrupting/hijacking scrolling in the modal? I understand this behavior is something native iOS does, but I am concerned that this may have undesired side effects.
@liamdebeasi What exactly do you mean with "interrupting/hijacking"? I tested it for a couple of weeks now and it seems pretty reliable. To my surprise it also works very well with the iOS over-scroll effect. |
Doing stuff like this: https://github.com/ionic-team/ionic/pull/21227/files#diff-aa4516c348b6917700ac14e788174be0R62-R65 Setting |
Ah I see. Even though it should be always possible to scroll, because overflow is set to "auto" every time the gesture ends or starts, I can understand your argument very well. May you have any suggestions on doing it otherwise? |
@julian-baumann But you can realize it like this:
Otherwise i recommend for you using https://github.com/roman-rr/cupertino-pane |
@roman-rr The modal handles components like the ion-item-options very well, just checked it. And to your other suggestions; I think that's exactly what I did there, but also the content has to be stoped from scrolling because otherwise it would behave strange with the over-scroll effect on iOS devices... That's why |
Hi there, Is there any way this can be accomplished without manually setting the overflow value on the content? This is a bit too risky of a change for me. |
This is can be accomplished without changing overflow value if modal has only two position (top and bottom). Just prevent scroll gesture on user drag event if |
Sorry, I don't really get your train of thought😁 Also checked your cupertino pane. Nice work. |
@julian-baumann Something like this: private contentScrollTop: number = 0;
function touchmoveEvent(event) {
// Element with overflow
this.overflowEl.addEventListener('scroll', (s: any) => {
this.contentScrollTop = s.target.scrollTop;
});
// Scrolled -> Prevent touchmoveEvent
if (this.contentScrollTop > 0) {
return;
}
// Continue touch move event
...
} Don't sure how to implement into ionic, need make some core investigations. |
We want to avoid doing things like: I am comfortable having a scroll listener as long as a) It is cleaned up when the component is destroyed and b) we are not doing computationally expensive operations in the callback. In other words, scrolling is really smooth in the modal currently, and I do not want that to change 😄. Thanks for all of your hard work so far! |
Sorry this feature is still not working for me and my code is something like this #21612, really simple. Is this working now or it's still being fixed? |
Hey guys, that's the plan on merging this? |
As I mentioned in #21227 (comment), I was hoping the PR author could accomplish this functionality without interrupting scrolling or in a way that is less likely to have scrolling jank. Without one of those, it is unlikely we will merge this PR. |
@julian-baumann Any updates? |
Haven't looked into this a long time. I'm open to ideas. @liamdebeasi may you have some? |
Thanks for the PR. We appreciate all the work you put into creating this. I am going to close this in favor of #25185. I will give you co-author credit when the PR is merged into our |
Pull request checklist
Please check if your PR fulfills the following requirements:
npm run build
) was run locally and any changes were pushednpm run lint
) has passed locally and any fixes were made for failuresPull request type
Please check the type of change your PR introduces:
What is the current behavior?
Modal can dragged from every component except the ion-content.
resolves #22046
What is the new behavior?
Now it can also be dragged by the ion-content.
Does this introduce a breaking change?
Other information