mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-22 22:49:45 +01:00
disable sidemenu opening when scrolling
This commit is contained in:
@@ -1,44 +1,42 @@
|
||||
import {
|
||||
activateKeepAwake,
|
||||
deactivateKeepAwake,
|
||||
deactivateKeepAwake
|
||||
} from '@sayem314/react-native-keep-awake';
|
||||
import React, {useEffect, useState} from 'react';
|
||||
import {Dimensions, View} from 'react-native';
|
||||
import React, { useCallback, useEffect, useState } from 'react';
|
||||
import { Dimensions, View } from 'react-native';
|
||||
import ScrollableTabView from 'react-native-scrollable-tab-view';
|
||||
import SplashScreen from 'react-native-splash-screen';
|
||||
import {notesnook} from './e2e/test.ids';
|
||||
import { notesnook } from './e2e/test.ids';
|
||||
import ContextMenu from './src/components/ContextMenu';
|
||||
import {DialogManager} from './src/components/DialogManager';
|
||||
import {DummyText} from './src/components/DummyText';
|
||||
import {Menu} from './src/components/Menu';
|
||||
import {Toast} from './src/components/Toast';
|
||||
import {NavigationStack} from './src/navigation/Drawer';
|
||||
import {NavigatorStack} from './src/navigation/NavigatorStack';
|
||||
import {useTracked} from './src/provider';
|
||||
import {Actions} from './src/provider/Actions';
|
||||
import {DDS} from './src/services/DeviceDetection';
|
||||
import { DialogManager } from './src/components/DialogManager';
|
||||
import { DummyText } from './src/components/DummyText';
|
||||
import { Menu } from './src/components/Menu';
|
||||
import { Toast } from './src/components/Toast';
|
||||
import { NavigationStack } from './src/navigation/Drawer';
|
||||
import { NavigatorStack } from './src/navigation/NavigatorStack';
|
||||
import { useTracked } from './src/provider';
|
||||
import { Actions } from './src/provider/Actions';
|
||||
import { DDS } from './src/services/DeviceDetection';
|
||||
import {
|
||||
eSendEvent,
|
||||
eSubscribeEvent,
|
||||
eUnSubscribeEvent,
|
||||
eUnSubscribeEvent
|
||||
} from './src/services/EventManager';
|
||||
import {editing, setWidthHeight} from './src/utils';
|
||||
import { editing, setWidthHeight } from './src/utils';
|
||||
import {
|
||||
eClearEditor,
|
||||
eCloseFullscreenEditor,
|
||||
eCloseSideMenu,
|
||||
eOnLoadNote,
|
||||
eOpenFullscreenEditor,
|
||||
eOpenSideMenu,
|
||||
eOpenSideMenu
|
||||
} from './src/utils/Events';
|
||||
import {editorRef, tabBarRef} from './src/utils/Refs';
|
||||
import {EditorWrapper} from './src/views/Editor/EditorWrapper';
|
||||
import {getIntent, getNote, post} from './src/views/Editor/Functions';
|
||||
import { editorRef, tabBarRef } from './src/utils/Refs';
|
||||
import { EditorWrapper } from './src/views/Editor/EditorWrapper';
|
||||
import { getNote, post } from './src/views/Editor/Functions';
|
||||
let {width, height} = Dimensions.get('window');
|
||||
let layoutTimer = null;
|
||||
let currentTab = 0;
|
||||
|
||||
|
||||
const onChangeTab = async (obj) => {
|
||||
if (obj.i === 1) {
|
||||
eSendEvent(eCloseSideMenu);
|
||||
@@ -184,9 +182,9 @@ const AppStack = React.memo(
|
||||
updatedDimensions = size;
|
||||
if (!size || (size.width === dimensions.width && mode !== null)) {
|
||||
DDS.setSize(size);
|
||||
console.log(mode,"MODE__")
|
||||
console.log(mode, 'MODE__');
|
||||
dispatch({type: Actions.DEVICE_MODE, state: mode});
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
updatedDimensions = size;
|
||||
@@ -231,6 +229,17 @@ const AppStack = React.memo(
|
||||
}
|
||||
}
|
||||
|
||||
const onScroll = (scroll) => {
|
||||
currentScroll = scroll;
|
||||
if (scroll === 0) {
|
||||
eSendEvent(eOpenSideMenu);
|
||||
} else {
|
||||
eSendEvent(eCloseSideMenu);
|
||||
}
|
||||
};
|
||||
|
||||
const renderTabBar = useCallback(() => <></>,[])
|
||||
|
||||
return (
|
||||
<View
|
||||
onLayout={_onLayout}
|
||||
@@ -249,11 +258,11 @@ const AppStack = React.memo(
|
||||
style={{
|
||||
zIndex: 1,
|
||||
}}
|
||||
onScroll={(event) => (currentScroll = event)}
|
||||
onScroll={onScroll}
|
||||
initialPage={0}
|
||||
prerenderingSiblingsNumber={Infinity}
|
||||
onChangeTab={onChangeTab}
|
||||
renderTabBar={() => <></>}>
|
||||
renderTabBar={renderTabBar}>
|
||||
{mode !== 'tablet' && (
|
||||
<View
|
||||
style={{
|
||||
|
||||
Reference in New Issue
Block a user