Skip to content

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

fix delete note from topic after multi-select

ammarahm-ed34882c9617fc
diff --git a/apps/mobile/src/components/header/title.js b/apps/mobile/src/components/header/title.js
index 79cabb864..7cbda6451 100644
--- a/apps/mobile/src/components/header/title.js
+++ b/apps/mobile/src/components/header/title.js
@@ -1,12 +1,9 @@
import React, { useEffect, useState } from 'react';
import { Platform, View } from 'react-native';
-import Animated, { Layout } from 'react-native-reanimated';
import Notebook from '../../screens/notebook';
import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/event-manager';
-import Navigation from '../../services/navigation';
import useNavigationStore from '../../stores/use-navigation-store';
import { useThemeStore } from '../../stores/use-theme-store';
-import { COLORS_NOTE } from '../../utils/color-scheme';
import { db } from '../../utils/database';
import { eScrollEvent } from '../../utils/events';
import { SIZE } from '../../utils/size';
@@ -18,8 +15,15 @@ const titleState = {};
export const Title = () => {
const colors = useThemeStore(state => state.colors);
const currentScreen = useNavigationStore(state => state.currentScreen);
+ const isNotebook = currentScreen.name === 'Notebook';
const isTopic = currentScreen?.name === 'TopicNotes';
- const [hide, setHide] = useState(isTopic ? true : false);
+ const [hide, setHide] = useState(
+ isNotebook
+ ? typeof titleState[currentScreen.id] === 'boolean'
+ ? titleState[currentScreen.id]
+ : true
+ : false
+ );
const isHidden = titleState[currentScreen.id];
console.log(currentScreen, 'header');
const notebook =
@@ -68,7 +72,6 @@ export const Title = () => {
if (!isTopic) return;
Notebook.navigate(notebook, true);
}
- console.log('color', currentScreen.color);
return (
<View
style={{
diff --git a/apps/mobile/src/components/selectionheader/index.js b/apps/mobile/src/components/selectionheader/index.js
index 34dbf84dd..3e00643e8 100644
--- a/apps/mobile/src/components/selectionheader/index.js
+++ b/apps/mobile/src/components/selectionheader/index.js
@@ -6,7 +6,7 @@ import { useSelectionStore } from '../../stores/use-selection-store';
import { eSendEvent, ToastEvent } from '../../services/event-manager';
import Navigation from '../../services/navigation';
import { db } from '../../utils/database';
-import { eOpenMoveNoteDialog, refreshNotesPage } from '../../utils/events';
+import { eOpenMoveNoteDialog } from '../../utils/events';
import { deleteItems } from '../../utils/functions';
import { tabBarRef } from '../../utils/global-refs';
import layoutmanager from '../../utils/layout-manager';
@@ -221,14 +221,11 @@ export const SelectionHeader = React.memo(() => {
<IconButton
onPress={async () => {
if (selectedItemsList.length > 0) {
- //TODO
- let extras = {};
+ const currentTopic = useNavigationStore.getState().currentScreen;
await db.notebooks
- .notebook(extras.notebook)
- .topics.topic(extras.topic)
+ .notebook(currentTopic.notebookId)
+ .topics.topic(currentTopic.id)
.delete(...selectedItemsList.map(item => item.id));
-
- eSendEvent(refreshNotesPage);
Navigation.queueRoutesForUpdate(
'Notes',
'Favorites',