Skip to content

Commit

Permalink
[DE mobile] Fix Bug 60831
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeyEzhin committed Feb 12, 2024
1 parent 4240212 commit 7605589
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions apps/documenteditor/mobile/src/controller/Toolbar.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useCallback, useEffect, useMemo, useState } from 'react';
import React, { useCallback, useEffect, useRef, useState } from 'react';
import { Device } from '../../../../common/mobile/utils/device';
import { inject, observer } from 'mobx-react';
import { f7 } from 'framework7-react';
Expand Down Expand Up @@ -34,6 +34,7 @@ const ToolbarController = inject('storeAppOptions', 'users', 'storeReview', 'sto
const storeDocumentInfo = props.storeDocumentInfo;
const docExt = storeDocumentInfo.dataDoc ? storeDocumentInfo.dataDoc.fileType : '';
const docTitle = storeDocumentInfo.dataDoc ? storeDocumentInfo.dataDoc.title : '';
const scrollOffsetRef = useRef(0);

const getNavbarTotalHeight = useCallback(() => {
const navbarBg = document.querySelector('.navbar-bg');
Expand Down Expand Up @@ -102,15 +103,17 @@ const ToolbarController = inject('storeAppOptions', 'users', 'storeReview', 'sto
const isSearchbarEnabled = document.querySelector('.subnavbar .searchbar')?.classList.contains('searchbar-enabled');

if(!isSearchbarEnabled && navbarHeight) {
if(offset > 0) {
if(offset > scrollOffsetRef.current) {
props.closeOptions('fab');
f7.navbar.hide('.main-navbar');
api.SetMobileTopOffset(undefined, 0);
} else if(offset <= 0) {
} else if(offset <= scrollOffsetRef.current) {
props.openOptions('fab');
f7.navbar.show('.main-navbar');
api.SetMobileTopOffset(undefined, navbarHeight);
}

scrollOffsetRef.current = offset;
}
}

Expand Down

0 comments on commit 7605589

Please sign in to comment.