mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-04-21 03:22:11 +00:00
Merge pull request #1079 from sagarchaulagai/development
Some checks failed
Build / build (push) Has been cancelled
Some checks failed
Build / build (push) Has been cancelled
Settings: Fix incorrect tab highlighting
This commit is contained in:
commit
bfb5c484fc
1 changed files with 4 additions and 8 deletions
|
|
@ -38,14 +38,10 @@ const Settings = () => {
|
||||||
|
|
||||||
const updateSelectedSectionId = useCallback(() => {
|
const updateSelectedSectionId = useCallback(() => {
|
||||||
const container = sectionsContainerRef.current;
|
const container = sectionsContainerRef.current;
|
||||||
if (container!.scrollTop + container!.clientHeight >= container!.scrollHeight - 50) {
|
for (const section of sections) {
|
||||||
setSelectedSectionId(sections[sections.length - 1].id);
|
const sectionContainer = section.ref.current;
|
||||||
} else {
|
if (sectionContainer && (sectionContainer.offsetTop + container!.offsetTop) < container!.scrollTop + 50) {
|
||||||
for (let i = sections.length - 1; i >= 0; i--) {
|
setSelectedSectionId(section.id);
|
||||||
if (sections[i].ref.current && sections[i].ref.current!.offsetTop - container!.offsetTop <= container!.scrollTop) {
|
|
||||||
setSelectedSectionId(sections[i].id);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue