Skip to content
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

Rebuild mobile navigator without Onsen, and add smooth swipe behaviour #3898

Merged
merged 14 commits into from
Jan 21, 2025

Conversation

TomTirapani
Copy link
Member

Tested against Toolbox in Chrome and Safari on iOS

Hoist P/R Checklist

Pull request authors: Review and check off the below. Items that do not apply can also be
checked off to indicate they have been considered. If unclear if a step is relevant, please leave
unchecked and note in comments.

  • Caught up with develop branch as of last change.
  • Added CHANGELOG entry, or determined not required.
  • Reviewed for breaking changes, added breaking-change label + CHANGELOG if so.
  • Updated doc comments / prop-types, or determined not required.
  • Reviewed and tested on Mobile, or determined not required.
  • Created Toolbox branch / PR, or determined not required.

If your change is still a WIP, please use the "Create draft pull request" option in the split
button below to indicate it is not ready yet for a final review.

Pull request reviewers: when merging this P/R, please consider using a squash commit to
collapse multiple intermediate commits into a single commit representing the overall feature
change. This helps keep the commit log clean and easy to scan across releases. PRs containing a
single commit should be rebased when possible.

@lbwexler
Copy link
Member

Tested on my Pixel -- looking generally good, although backswipe from a horizontally scrolling grid looks like it does not work.

@lbwexler lbwexler closed this Jan 13, 2025
@lbwexler lbwexler reopened this Jan 13, 2025
direction = distance > 0 ? 'right' : 'left';

const scrollableParent = findScrollableParent(event, 'horizontal');
if (scrollableParent) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do I dare ask about nested scrollable parents? Seems uncommon, but....

Copy link
Member Author

@TomTirapani TomTirapani Jan 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean a scrollable within a scrollable within a swiper... 🤯

Currently, the one you are touching will scroll until the left edge and then the swiper will come into play, skipping the middle scrollable. I suppose we could make it recursive until we are at the top of the DOM...

Do we have a specific need for it? If not I'd vote with live with it until it comes up, especially given that we should try to avoid horizontal scrolling on mobile generally outside of this context


stack.push(page);
// Re-use existing PageModels where possible
const existingPageModel = i < this.stack.length ? this.stack[i] : null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could "simplify" to just this.stack[i], with out-of-bound behavior for javascript arrays

swiper.progress < 1 || !isDraggableEl(scrollableParent, 'right');

// During the swiper transition, undo the scrollable parent's internal scroll
// to keep it static.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch!

renderMode = 'lazy',
refreshMode = 'onShowLazy'
}: NavigatorConfig) {
super();
makeObservable(this);
warnIf(
throwIf(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could probably be removed now that we have this throwIf on the page itself.

return true;
}

// Ignore Onsen "swiper" elements created by tab container (even without swiping enabled)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the onsen swiper elements are now obsolete, no?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No... these are installed by the Onsen tab container (which supports swiping between tabs, but we have that disabled). Once that goes we can get rid of this.

@lbwexler lbwexler merged commit 89c9a44 into develop Jan 21, 2025
2 checks passed
@lbwexler lbwexler deleted the mobileNavigator branch January 21, 2025 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants