Skip to content

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

mobile: finalize topic sheet ui

ammarahm-ed7773ba080433
diff --git a/apps/mobile/app/components/sheets/topic-sheet/index.tsx b/apps/mobile/app/components/sheets/topic-sheet/index.tsx
index 12707f6ab..284ce0aca 100644
--- a/apps/mobile/app/components/sheets/topic-sheet/index.tsx
+++ b/apps/mobile/app/components/sheets/topic-sheet/index.tsx
@@ -43,7 +43,11 @@ import useNavigationStore, {
NotebookScreenParams
} from "../../../stores/use-navigation-store";
import { useThemeStore } from "../../../stores/use-theme-store";
-import { eOnNewTopicAdded, eOpenAddTopicDialog } from "../../../utils/events";
+import {
+ eOnNewTopicAdded,
+ eOnTopicSheetUpdate,
+ eOpenAddTopicDialog
+} from "../../../utils/events";
import { normalize, SIZE } from "../../../utils/size";
import { NotebookType, TopicType } from "../../../utils/types";
@@ -92,9 +96,14 @@ export const TopicsSheet = () => {
);
useEffect(() => {
+ const onTopicUpdate = () => {
+ onRequestUpdate();
+ };
+ eSubscribeEvent(eOnTopicSheetUpdate, onTopicUpdate);
eSubscribeEvent(eOnNewTopicAdded, onRequestUpdate);
return () => {
- eUnSubscribeEvent(eOnNewTopicAdded, onRequestUpdate);
+ eUnSubscribeEvent(eOnTopicSheetUpdate, onRequestUpdate);
+ eUnSubscribeEvent(eOnNewTopicAdded, onTopicUpdate);
};
}, [onRequestUpdate]);
@@ -167,7 +176,7 @@ export const TopicsSheet = () => {
ref={ref}
isModal={false}
containerStyle={{
- maxHeight: 600,
+ maxHeight: 400,
borderTopRightRadius: 15,
borderTopLeftRadius: 15,
backgroundColor: colors.bg,
@@ -186,7 +195,7 @@ export const TopicsSheet = () => {
initialSnapIndex={0}
backgroundInteractionEnabled
onChange={(position, height) => {
- animations.translate.setValue(position);
+ animations.translate.setValue(position - 60);
const h = Dimensions.get("window").height;
const minPos = h - height;
if (position - 100 < minPos || !canShow) {
@@ -221,8 +230,7 @@ export const TopicsSheet = () => {
accentText="light"
onPress={openEditor}
customStyle={{
- borderRadius: 100,
- bottom: 50
+ borderRadius: 100
}}
>
<View
@@ -241,8 +249,8 @@ export const TopicsSheet = () => {
>
<View
style={{
- maxHeight: 600,
- height: 600,
+ maxHeight: 400,
+ height: 400,
width: "100%"
}}
>
diff --git a/apps/mobile/app/package.json b/apps/mobile/app/package.json
index 3be77b97d..57c390923 100644
--- a/apps/mobile/app/package.json
+++ b/apps/mobile/app/package.json
@@ -15,7 +15,7 @@
"html-to-text": "8.1.0",
"phone": "^3.1.14",
"qclone": "^1.2.0",
- "react-native-actions-sheet": "^0.9.0-alpha.9",
+ "react-native-actions-sheet": "^0.9.0-alpha.11",
"react-native-check-version": "https://github.com/flexible-agency/react-native-check-version",
"react-native-drax": "^0.10.2",
"react-native-image-zoom-viewer": "^3.0.1",
diff --git a/apps/mobile/app/screens/editor/source.ts b/apps/mobile/app/screens/editor/source.ts
index c47ac529c..3f343edf2 100644
--- a/apps/mobile/app/screens/editor/source.ts
+++ b/apps/mobile/app/screens/editor/source.ts
@@ -28,5 +28,5 @@ const EditorMobileSourceUrl =
* The url should be something like this: http://192.168.100.126:3000/index.html
*/
export const EDITOR_URI = __DEV__
- ? "http://192.168.8.103:3000/index.html"
+ ? EditorMobileSourceUrl
: EditorMobileSourceUrl;
diff --git a/apps/mobile/app/screens/editor/tiptap/picker.js b/apps/mobile/app/screens/editor/tiptap/picker.js
index 444c81764..1f1563231 100644
--- a/apps/mobile/app/screens/editor/tiptap/picker.js
+++ b/apps/mobile/app/screens/editor/tiptap/picker.js
@@ -248,7 +248,6 @@ const handleImageResponse = async (response, options) => {
const isPng = /(png)/g.test(image.type);
const isJpeg = /(jpeg|jpg)/g.test(image.type);
if (isPng || isJpeg) {
- console.log(image.uri);
b64 =
`data:${image.type};base64, ` +
(await compressToBase64(
diff --git a/apps/mobile/app/screens/editor/tiptap/use-editor.ts b/apps/mobile/app/screens/editor/tiptap/use-editor.ts
index 620fd2ea6..733fa20f2 100644
--- a/apps/mobile/app/screens/editor/tiptap/use-editor.ts
+++ b/apps/mobile/app/screens/editor/tiptap/use-editor.ts
@@ -230,7 +230,6 @@ export const useEditor = (
id = await db.notes?.add(noteData);
if (!note && id) {
currentNote.current = db.notes?.note(id).data as NoteType;
- console.log("on Note Created", state.current?.onNoteCreated);
state.current?.onNoteCreated && state.current.onNoteCreated(id);
if (!noteData.title) {
postMessage(
diff --git a/apps/mobile/app/screens/notes/common.ts b/apps/mobile/app/screens/notes/common.ts
index 79497d197..2a6f99981 100644
--- a/apps/mobile/app/screens/notes/common.ts
+++ b/apps/mobile/app/screens/notes/common.ts
@@ -24,7 +24,7 @@ import Navigation from "../../services/navigation";
import { useMenuStore } from "../../stores/use-menu-store";
import { NotesScreenParams } from "../../stores/use-navigation-store";
import { useTagStore } from "../../stores/use-tag-store";
-import { eOnLoadNote } from "../../utils/events";
+import { eOnLoadNote, eOnTopicSheetUpdate } from "../../utils/events";
import { openLinkInBrowser } from "../../utils/functions";
import { tabBarRef } from "../../utils/global-refs";
import { TopicType } from "../../utils/types";
@@ -125,6 +125,7 @@ async function onNoteCreated(id: string, params: FirstSaveData) {
"Notebook",
"Notebooks"
);
+ eSendEvent(eOnTopicSheetUpdate);
break;
}
case "tag": {
diff --git a/apps/mobile/app/utils/events.js b/apps/mobile/app/utils/events.js
index 18e210426..216a46522 100644
--- a/apps/mobile/app/utils/events.js
+++ b/apps/mobile/app/utils/events.js
@@ -158,3 +158,5 @@ export const eCloseAnnouncementDialog = "604";
export const eOpenLoading = "605";
export const eCloseLoading = "606";
+
+export const eOnTopicSheetUpdate = "607";
diff --git a/apps/mobile/package-lock.json b/apps/mobile/package-lock.json
index 151a6f729..0b577b9ae 100644
--- a/apps/mobile/package-lock.json
+++ b/apps/mobile/package-lock.json
@@ -42,7 +42,7 @@
"qclone": "^1.2.0",
"react": "18.0.0",
"react-native": "0.69.7",
- "react-native-actions-sheet": "^0.9.0-alpha.9",
+ "react-native-actions-sheet": "^0.9.0-alpha.11",
"react-native-check-version": "https://github.com/flexible-agency/react-native-check-version",
"react-native-drax": "^0.10.2",
"react-native-image-zoom-viewer": "^3.0.1",
@@ -17957,9 +17957,9 @@
}
},
"node_modules/react-native-actions-sheet": {
- "version": "0.9.0-alpha.10",
- "resolved": "https://registry.npmjs.org/react-native-actions-sheet/-/react-native-actions-sheet-0.9.0-alpha.10.tgz",
- "integrity": "sha512-R1WcRPwtgaVwMOvDhVnYD+dxTWSSF84Qgco3UT71U8o3F59nx3J4IJBamt5e8RDBinLXPxgPvXEYYw9UO9VtpA==",
+ "version": "0.9.0-alpha.11",
+ "resolved": "https://registry.npmjs.org/react-native-actions-sheet/-/react-native-actions-sheet-0.9.0-alpha.11.tgz",
+ "integrity": "sha512-bYOQVpB3lHcBh+wYa+6IEXfQC3xrlDJh+yhdIhVMjSRybvgcHGSIali8cPrGuwRF7luF0fqZIS+xsEDQs5eahA==",
"peerDependencies": {
"react-native": "*",
"react-native-gesture-handler": "*"
@@ -24312,7 +24312,7 @@
"qclone": "^1.2.0",
"react": "18.0.0",
"react-native": "0.69.7",
- "react-native-actions-sheet": "^0.9.0-alpha.9",
+ "react-native-actions-sheet": "^0.9.0-alpha.11",
"react-native-check-version": "https://github.com/flexible-agency/react-native-check-version",
"react-native-drax": "^0.10.2",
"react-native-image-zoom-viewer": "^3.0.1",
@@ -34856,9 +34856,9 @@
}
},
"react-native-actions-sheet": {
- "version": "0.9.0-alpha.10",
- "resolved": "https://registry.npmjs.org/react-native-actions-sheet/-/react-native-actions-sheet-0.9.0-alpha.10.tgz",
- "integrity": "sha512-R1WcRPwtgaVwMOvDhVnYD+dxTWSSF84Qgco3UT71U8o3F59nx3J4IJBamt5e8RDBinLXPxgPvXEYYw9UO9VtpA=="
+ "version": "0.9.0-alpha.11",
+ "resolved": "https://registry.npmjs.org/react-native-actions-sheet/-/react-native-actions-sheet-0.9.0-alpha.11.tgz",
+ "integrity": "sha512-bYOQVpB3lHcBh+wYa+6IEXfQC3xrlDJh+yhdIhVMjSRybvgcHGSIali8cPrGuwRF7luF0fqZIS+xsEDQs5eahA=="
},
"react-native-actions-shortcuts": {
"version": "1.0.1",