mobile: fix tab bugs

This commit is contained in:
Ammar Ahmed
2023-12-29 10:47:23 +05:00
committed by Abdullah Atta
parent d9521b5058
commit 2ce31fc81c
2 changed files with 10 additions and 2 deletions

View File

@@ -33,6 +33,7 @@ import Paragraph from "../../ui/typography/paragraph";
type TabItem = {
id: number;
noteId?: string;
previewTab?: boolean;
};
const TabItemComponent = (props: {
@@ -59,6 +60,11 @@ const TabItemComponent = (props: {
props.close?.();
}
}}
onLongPress={() => {
useTabStore.getState().updateTab(props.tab.id, {
previewTab: false
});
}}
>
<View
style={{
@@ -73,6 +79,9 @@ const TabItemComponent = (props: {
? colors.selected.paragraph
: colors.primary.paragraph
}
style={{
fontStyle: props.tab.previewTab ? "italic" : "normal"
}}
size={SIZE.md}
>
{item?.title || "New note"}

View File

@@ -278,7 +278,7 @@ export const useEditor = (
}
if (!locked) {
id = await db.notes?.add(noteData);
id = await db.notes?.add({ ...noteData });
if (!note && id) {
editorSessionHistory.newSession(id);
if (id) {
@@ -300,7 +300,6 @@ export const useEditor = (
}
if (!noteData.title) {
console.log("posting title to tab", tabId);
postMessage(
EditorEvents.title,
currentNotes.current[id]?.title,