use general section as initially selected

This commit is contained in:
nklhrstv 2020-03-25 15:41:39 +02:00
parent 6110637d31
commit 28b1a56986

View file

@ -72,7 +72,7 @@ const Settings = () => {
{ ref: playerSectionRef, id: PLAYER_SECTION }, { ref: playerSectionRef, id: PLAYER_SECTION },
{ ref: streamingServerSectionRef, id: STREAMING_SECTION }, { ref: streamingServerSectionRef, id: STREAMING_SECTION },
]), []); ]), []);
const [selectedSectionId, setSelectedSectionId] = React.useState(sections[0].id); const [selectedSectionId, setSelectedSectionId] = React.useState(GENERAL_SECTION);
const updateSelectedSectionId = React.useCallback(() => { const updateSelectedSectionId = React.useCallback(() => {
if (sectionsContainerRef.current.scrollTop + sectionsContainerRef.current.clientHeight === sectionsContainerRef.current.scrollHeight) { if (sectionsContainerRef.current.scrollTop + sectionsContainerRef.current.clientHeight === sectionsContainerRef.current.scrollHeight) {
setSelectedSectionId(sections[sections.length - 1].id); setSelectedSectionId(sections[sections.length - 1].id);