-
Notifications
You must be signed in to change notification settings - Fork 185
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(CustomScrollView): add horizontal scroll support #7130
feat(CustomScrollView): add horizontal scroll support #7130
Conversation
Доработал компонент customScrollView, добавил поддержку горизонтального скролла
size-limit report 📦
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
e2e tests |
👀 Docs deployed
Commit 4d4abda |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7130 +/- ##
==========================================
- Coverage 84.08% 83.45% -0.64%
==========================================
Files 363 370 +7
Lines 11028 11176 +148
Branches 3635 3659 +24
==========================================
+ Hits 9273 9327 +54
- Misses 1755 1849 +94
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
…ll-view # Conflicts: # packages/vkui/src/components/CustomScrollView/CustomScrollView.module.css # packages/vkui/src/components/CustomScrollView/CustomScrollView.tsx
а давай еще, пожалуйста, опишем этот компонент в доке, сейчас для него вообще странички нет, многие не знают что такое вообще существует( |
в нативном скролле если есть полоса и по x и по y, то по этим осям можно смещаться одновременно, скролля по диагонали на тачпаде, в текущем решении одновременно можно скроллить только одну ось, мб получится и здесь так сделать |
Не совсем понял как скролить по диагонали. Проверил на маке в других примерах - Не скролится. И по идее в реализации используется нативный скролл для отслеживания скролла, так что если бы он работал при скролле по диагонали, то и CustomScrollView тоже бы работал |
…ll-view # Conflicts: # packages/vkui/src/components/CustomScrollView/CustomScrollView.module.css
Действительно такой логики нет у нативного скролла, я напутал, казалось что есть( |
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.
Отличная работа! 👍 🔥
packages/vkui/src/components/CustomScrollView/useCustomScrollViewResize.ts
Outdated
Show resolved
Hide resolved
packages/vkui/src/components/CustomScrollView/useDetectScrollDirection.ts
Outdated
Show resolved
Hide resolved
packages/vkui/src/components/CustomScrollView/useHorizontalScrollController.tsx
Outdated
Show resolved
Hide resolved
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.
💅 🔥
…ll-view # Conflicts: # styleguide/config.js
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.
💅
packages/vkui/src/components/CustomScrollView/useTransformProp.ts
Outdated
Show resolved
Hide resolved
packages/vkui/src/components/CustomScrollView/CustomScrollView.tsx
Outdated
Show resolved
Hide resolved
packages/vkui/src/components/CustomScrollView/CustomScrollBarController.ts
Outdated
Show resolved
Hide resolved
- Вынес рендеринг горизонтальный и вертикальный скроллы в отдельные компоненты. Для этого сделал рефакторинг хуков - Вынес хук useDragAndDrop для избавления от дублирования
packages/vkui/src/components/CustomScrollView/useVerticalScrollController.tsx
Outdated
Show resolved
Hide resolved
packages/vkui/src/components/CustomScrollView/useHorizontalScrollController.tsx
Outdated
Show resolved
Hide resolved
packages/vkui/src/components/CustomScrollView/CustomScrollView.tsx
Outdated
Show resolved
Hide resolved
packages/vkui/src/components/CustomScrollView/CustomScrollView.tsx
Outdated
Show resolved
Hide resolved
packages/vkui/src/components/CustomScrollView/useDetectScrollDirection.ts
Outdated
Show resolved
Hide resolved
packages/vkui/src/components/CustomScrollView/CustomScrollView.tsx
Outdated
Show resolved
Hide resolved
Co-authored-by: Inomdzhon Mirdzhamolov <i.mirdzhamolov@vk.team>
Co-authored-by: Inomdzhon Mirdzhamolov <i.mirdzhamolov@vk.team>
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.
🙏
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.
👏 👏 👏
Описание
Необходимо добавить поддержку кастомного горизонтального скролла в CustomScrollView.
Изменения
UPD
Debug в Firefox <= 63
before.mov
before
after.mov
after
Добавил предупреждение об использовании флага в Firefox ниже 64 версии