Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

refactor

ammarahm-ed7945c9cd2087
diff --git a/apps/mobile/src/components/ContextMenu/index.js b/apps/mobile/src/components/ContextMenu/index.js
deleted file mode 100644
index 0b21f672b..000000000
--- a/apps/mobile/src/components/ContextMenu/index.js
+++ /dev/null
@@ -1,63 +0,0 @@
-import React, { useEffect, useState } from 'react';
-import { View } from 'react-native';
-import { useTracked } from '../../provider';
-import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';
-import { getElevation } from '../../utils';
-import Paragraph from '../Typography/Paragraph';
-
-let contextTimeout = null;
-
-const ContextMenu = () => {
- const [state, dispatch] = useTracked();
- const {colors} = state;
- const [contextMenu, setContextMenu] = useState({
- location: {
- x: -100,
- y: -100,
- },
- title: 'World',
- });
-
- const showContextMenu = async (event) => {
- if (contextTimeout) {
- clearTimeout(contextTimeout);
- contextTimeout = null;
- }
- setContextMenu(event);
- contextTimeout = setTimeout(() => {
- setContextMenu({
- location: {
- x: -100,
- y: -100,
- },
- title: 'World',
- });
- }, 2000);
- };
-
- useEffect(() => {
- eSubscribeEvent('showContextMenu', showContextMenu);
-
- return () => {
- eUnSubscribeEvent('showContextMenu', showContextMenu);
- };
- }, []);
-
- return (
- <View
- style={{
- ...getElevation(5),
- position: 'absolute',
- left: contextMenu.location.x,
- top: contextMenu.location.y,
- backgroundColor: colors.night ? colors.nav : 'black',
- paddingVertical: 8,
- paddingHorizontal: 12,
- borderRadius: 5,
- }}>
- <Paragraph color="white">{contextMenu.title}</Paragraph>
- </View>
- );
-};
-
-export default ContextMenu;
diff --git a/apps/mobile/src/navigation/RootView.js b/apps/mobile/src/navigation/RootView.js
index 694de7500..4e7313144 100644
--- a/apps/mobile/src/navigation/RootView.js
+++ b/apps/mobile/src/navigation/RootView.js
@@ -2,38 +2,37 @@ import {
activateKeepAwake,
deactivateKeepAwake
} from '@sayem314/react-native-keep-awake';
-import React, {useEffect, useRef} from 'react';
-import {View} from 'react-native';
-import Animated, {useValue} from 'react-native-reanimated';
-import {notesnook} from '../../e2e/test.ids';
-import ContextMenu from '../components/ContextMenu';
+import React, { useEffect, useRef } from 'react';
+import { View } from 'react-native';
+import Animated, { useValue } from 'react-native-reanimated';
+import { notesnook } from '../../e2e/test.ids';
import CustomTabs from '../components/CustomTabs';
-import {DialogManager} from '../components/DialogManager';
-import {DummyText} from '../components/DummyText';
-import {Menu} from '../components/Menu';
-import {Toast} from '../components/Toast';
-import {NavigatorStack} from './NavigatorStack';
-import {useTracked} from '../provider';
-import {useEditorStore, useSettingStore} from '../provider/stores';
-import {DDS} from '../services/DeviceDetection';
+import { DialogManager } from '../components/DialogManager';
+import { DummyText } from '../components/DummyText';
+import { Menu } from '../components/Menu';
+import { Toast } from '../components/Toast';
+import { useTracked } from '../provider';
+import { useEditorStore, useSettingStore } from '../provider/stores';
+import { DDS } from '../services/DeviceDetection';
import {
eSendEvent,
eSubscribeEvent,
eUnSubscribeEvent
} from '../services/EventManager';
-import {editing, setWidthHeight} from '../utils';
-import {updateStatusBarColor} from '../utils/Colors';
+import { editing, setWidthHeight } from '../utils';
+import { updateStatusBarColor } from '../utils/Colors';
import {
eClearEditor,
eCloseFullscreenEditor,
eOnLoadNote,
eOpenFullscreenEditor
} from '../utils/Events';
-import {editorRef, tabBarRef} from '../utils/Refs';
-import {sleep} from '../utils/TimeUtils';
-import {EditorWrapper} from '../views/Editor/EditorWrapper';
-import {EditorWebView, getNote} from '../views/Editor/Functions';
+import { editorRef, tabBarRef } from '../utils/Refs';
+import { sleep } from '../utils/TimeUtils';
+import { EditorWrapper } from '../views/Editor/EditorWrapper';
+import { EditorWebView, getNote } from '../views/Editor/Functions';
import tiny from '../views/Editor/tiny/tiny';
+import { NavigatorStack } from './NavigatorStack';
let layoutTimer = null;
const onChangeTab = async obj => {
@@ -81,7 +80,6 @@ export const RootView = React.memo(
<>
<NativeStack />
<Toast />
- <ContextMenu />
<DummyText />
<DialogManager />
</>