Skip to content

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

mobile: minor fixes

Ammar Ahmedfa5b84ec0dfa
diff --git a/apps/mobile/app/components/auth/auth-modal.js b/apps/mobile/app/components/auth/auth-modal.js
index 39c5a0e9d..bd4fecf00 100644
--- a/apps/mobile/app/components/auth/auth-modal.js
+++ b/apps/mobile/app/components/auth/auth-modal.js
@@ -95,6 +95,7 @@ const AuthModal = () => {
transparent={false}
animated={false}
centered={false}
+ enableSheetKeyboardHandler
>
<KeyboardAwareScrollView
style={{
diff --git a/apps/mobile/app/components/list-items/note/index.js b/apps/mobile/app/components/list-items/note/index.js
index 39ea9a6e1..cd65c2a71 100644
--- a/apps/mobile/app/components/list-items/note/index.js
+++ b/apps/mobile/app/components/list-items/note/index.js
@@ -99,8 +99,8 @@ const NoteItem = ({
dateBy = "dateCreated",
noOpen = false
}) => {
- const currentEditingNote = useEditorStore(
- (state) => state.currentEditingNote
+ const isEditingNote = useEditorStore(
+ (state) => state.currentEditingNote === item.id
);
const { colors } = useThemeColors();
const compactMode = useIsCompactModeEnabled(item);
@@ -112,8 +112,7 @@ const NoteItem = ({
const reminder = getUpcomingReminder(reminders);
const noteColor = ColorValues[item.color?.toLowerCase()];
const tags = getTags(item);
- const primaryColors =
- currentEditingNote === item.id ? colors.selected : colors.primary;
+ const primaryColors = isEditingNote ? colors.selected : colors.primary;
return (
<>
diff --git a/apps/mobile/app/components/list-items/selection-wrapper/back-fill.js b/apps/mobile/app/components/list-items/selection-wrapper/back-fill.js
index 1c9d01e39..aa4046aeb 100644
--- a/apps/mobile/app/components/list-items/selection-wrapper/back-fill.js
+++ b/apps/mobile/app/components/list-items/selection-wrapper/back-fill.js
@@ -25,13 +25,13 @@ import { useEditorStore } from "../../../stores/use-editor-store";
export const Filler = ({ item }) => {
const { colors } = useThemeColors();
- const currentEditingNote = useEditorStore(
- (state) => state.currentEditingNote
+ const isEditingNote = useEditorStore(
+ (state) => state.currentEditingNote === item.id
);
const [selected] = useIsSelected(item);
- return currentEditingNote === item.id || selected ? (
+ return isEditingNote || selected ? (
<View
style={{
position: "absolute",
@@ -39,12 +39,11 @@ export const Filler = ({ item }) => {
height: "150%",
backgroundColor: colors.selected.background,
borderLeftWidth: 5,
- borderLeftColor:
- currentEditingNote === item.id
- ? item.color
- ? colors.static[item.color]
- : colors.selected.accent
- : "transparent"
+ borderLeftColor: isEditingNote
+ ? item.color
+ ? colors.static[item.color]
+ : colors.selected.accent
+ : "transparent"
}}
collapsable={false}
/>
diff --git a/apps/mobile/app/hooks/use-editor-tags.ts b/apps/mobile/app/hooks/use-editor-tags.ts
deleted file mode 100644
index 61f930c9a..000000000
--- a/apps/mobile/app/hooks/use-editor-tags.ts
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
-This file is part of the Notesnook project (https://notesnook.com/)
-
-Copyright (C) 2023 Streetwriters (Private) Limited
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-import { useEffect, useState } from "react";
-import { eSubscribeEvent, eUnSubscribeEvent } from "../services/event-manager";
-import { useEditorStore } from "../stores/use-editor-store";
-import { useTagStore } from "../stores/use-tag-store";
-import { db } from "../common/database";
-import { NoteType } from "app/utils/types";
-import { useCallback } from "react";
-
-/**
- * A hook that injects/removes tags from tags bar in editor
- */
-const useEditorTags = () => {
- const currentEditingNote = useEditorStore(
- (state) => state.currentEditingNote
- );
- const tags = useTagStore((state) => state.tags);
- const [note, setNote] = useState<NoteType | null>(null);
- const [noteTags, setNoteTags] = useState<string[]>([]);
-
- const refreshNote = useCallback(() => {
- const current = useEditorStore.getState().currentEditingNote;
- if (!current) {
- setNote(null);
- setNoteTags([]);
- return;
- }
- const note = db.notes?.note(current)?.data as NoteType;
- setNote(note ? { ...note } : null);
- getTags(note);
- }, []);
-
- useEffect(() => {
- refreshNote();
- }, [currentEditingNote, refreshNote, tags]);
-
- const load = useCallback(() => {
- if (!note) return;
- // tiny.call(EditorWebView, renderTags(noteTags));
- }, [note]);
-
- useEffect(() => {
- eSubscribeEvent("updateTags", load);
- return () => {
- eUnSubscribeEvent("updateTags", load);
- };
- }, [load, noteTags]);
-
- function getTags(note: NoteType) {
- if (!note || !note.tags) return [];
- const tags = note.tags
- .map((t) => (db.tags?.tag(t) ? { ...db.tags.tag(t) } : null))
- .filter((t) => t !== null);
- setNoteTags(tags);
- }
-
- useEffect(() => {
- load();
- }, [load, noteTags]);
-
- return [];
-};
-
-export default useEditorTags;
diff --git a/apps/mobile/app/screens/editor/tiptap/use-editor-events.ts b/apps/mobile/app/screens/editor/tiptap/use-editor-events.ts
index 8f8bfde34..3604fb8ce 100644
--- a/apps/mobile/app/screens/editor/tiptap/use-editor-events.ts
+++ b/apps/mobile/app/screens/editor/tiptap/use-editor-events.ts
@@ -189,7 +189,7 @@ export const useEditorEvents = (
readonly: readonly || editorPropReadonly,
tools: tools || getDefaultPresets().default,
noHeader: noHeader,
- noToolbar: readonly || editorPropReadonly || noToolbar,
+ noToolbar: noToolbar,
doubleSpacedLines: doubleSpacedLines,
corsProxy: corsProxy,
fontSize: