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

feat(CustomScrollView): add horizontal scroll support #7130

Merged
merged 31 commits into from
Aug 1, 2024

Conversation

EldarMuhamethanov
Copy link
Contributor

@EldarMuhamethanov EldarMuhamethanov commented Jul 5, 2024


  • Документация фичи

Описание

Необходимо добавить поддержку кастомного горизонтального скролла в CustomScrollView.

Изменения

  • Добавил отображение и логику для горизонтального скролла
  • Вынес логику обработкуи вертикального и горизонтального скролла в хуки
  • Добавил хук для определения измерения в котором идет скролл
  • Добил пропс для включения отображения горизонтального скролла
  • Добавил страницу компонента CustomScrollView в styleguide и в storybook

UPD

Debug в Firefox <= 63

before.mov

before

after.mov

after

Добавил предупреждение об использовании флага в Firefox ниже 64 версии

Доработал компонент customScrollView, добавил поддержку горизонтального скролла
@EldarMuhamethanov EldarMuhamethanov requested a review from a team as a code owner July 5, 2024 09:44
Copy link
Contributor

github-actions bot commented Jul 5, 2024

size-limit report 📦

Path Size
JS 380.95 KB (+0.84% 🔺)
JS (gzip) 116.15 KB (+0.55% 🔺)
JS (brotli) 95.6 KB (+0.51% 🔺)
JS import Div (tree shaking) 1.39 KB (0%)
CSS 304.38 KB (+0.24% 🔺)
CSS (gzip) 38.9 KB (+0.25% 🔺)
CSS (brotli) 31.3 KB (+0.23% 🔺)

Copy link

codesandbox-ci bot commented Jul 5, 2024

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.

Copy link
Contributor

github-actions bot commented Jul 5, 2024

e2e tests

Playwright Report

Copy link
Contributor

github-actions bot commented Jul 5, 2024

👀 Docs deployed

Commit 4d4abda

Copy link

codecov bot commented Jul 5, 2024

Codecov Report

Attention: Patch coverage is 47.52066% with 127 lines in your changes missing coverage. Please review.

Project coverage is 83.45%. Comparing base (0d94b24) to head (4d4abda).

Files Patch % Lines
...CustomScrollView/useHorizontalScrollController.tsx 4.83% 59 Missing ⚠️
...src/components/CustomScrollView/useDragAndDrop.tsx 36.66% 19 Missing ⚠️
...s/CustomScrollView/useVerticalScrollController.tsx 69.35% 19 Missing ⚠️
...nents/CustomScrollView/useDetectScrollDirection.ts 36.84% 12 Missing ⚠️
...c/components/CustomScrollView/CustomScrollView.tsx 62.50% 9 Missing ⚠️
...s/vkui/src/components/CustomScrollView/ScrollX.tsx 42.85% 8 Missing ⚠️
...ents/CustomScrollView/useCustomScrollViewResize.ts 93.33% 1 Missing ⚠️
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     
Flag Coverage Δ
unittests 83.45% <47.52%> (-0.64%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

…ll-view

# Conflicts:
#	packages/vkui/src/components/CustomScrollView/CustomScrollView.module.css
#	packages/vkui/src/components/CustomScrollView/CustomScrollView.tsx
@MrZillaGold
Copy link
Contributor

а давай еще, пожалуйста, опишем этот компонент в доке, сейчас для него вообще странички нет, многие не знают что такое вообще существует(

@MrZillaGold
Copy link
Contributor

в нативном скролле если есть полоса и по x и по y, то по этим осям можно смещаться одновременно, скролля по диагонали на тачпаде, в текущем решении одновременно можно скроллить только одну ось, мб получится и здесь так сделать

@EldarMuhamethanov
Copy link
Contributor Author

в нативном скролле если есть полоса и по x и по y, то по этим осям можно смещаться одновременно, скролля по диагонали на тачпаде, в текущем решении одновременно можно скроллить только одну ось, мб получится и здесь так сделать

Не совсем понял как скролить по диагонали. Проверил на маке в других примерах - Не скролится. И по идее в реализации используется нативный скролл для отслеживания скролла, так что если бы он работал при скролле по диагонали, то и CustomScrollView тоже бы работал

@MrZillaGold
Copy link
Contributor

Проверил на маке в других примерах - Не скролится

Действительно такой логики нет у нативного скролла, я напутал, казалось что есть(

Copy link
Contributor

@mendrew mendrew left a comment

Choose a reason for hiding this comment

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

Отличная работа! 👍 🔥

mendrew
mendrew previously approved these changes Jul 17, 2024
Copy link
Contributor

@mendrew mendrew left a comment

Choose a reason for hiding this comment

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

💅 🔥

mendrew
mendrew previously approved these changes Jul 30, 2024
Copy link
Contributor

@mendrew mendrew left a comment

Choose a reason for hiding this comment

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

💅

- Вынес рендеринг горизонтальный и вертикальный скроллы в отдельные компоненты. Для этого сделал рефакторинг хуков
- Вынес хук useDragAndDrop для избавления от дублирования
Copy link
Contributor

@inomdzhon inomdzhon left a comment

Choose a reason for hiding this comment

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

🙏

Copy link
Contributor

@mendrew mendrew left a comment

Choose a reason for hiding this comment

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

👏 👏 👏

@inomdzhon inomdzhon merged commit 16e705c into master Aug 1, 2024
24 of 26 checks passed
@inomdzhon inomdzhon deleted the e.muhamethanov/6056/custom-horizontal-scroll-view branch August 1, 2024 07:34
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.

[Feature][CustomSctollView]: Поддержка горизонтального скролла
4 participants