diff --git a/apps/mobile/app/components/container/floating-button.tsx b/apps/mobile/app/components/container/floating-button.tsx
index a0d3ad52d..65a357caf 100644
--- a/apps/mobile/app/components/container/floating-button.tsx
+++ b/apps/mobile/app/components/container/floating-button.tsx
@@ -36,6 +36,7 @@ import { getElevationStyle } from "../../utils/elevation";
import { AppFontSize, normalize } from "../../utils/size";
import { DefaultAppStyles } from "../../utils/styles";
import { hexToRGBA, RGB_Linear_Shade } from "../../utils/colors";
+import useKeyboard from "../../hooks/use-keyboard";
interface FloatingButtonProps {
onPress: () => void;
diff --git a/apps/mobile/app/components/dialog/dialog-header.tsx b/apps/mobile/app/components/dialog/dialog-header.tsx
index 509e31686..311da4630 100644
--- a/apps/mobile/app/components/dialog/dialog-header.tsx
+++ b/apps/mobile/app/components/dialog/dialog-header.tsx
@@ -21,7 +21,7 @@ import React from "react";
import { Text, View, ViewStyle } from "react-native";
import { useThemeColors } from "@notesnook/theme";
import { AppFontSize } from "../../utils/size";
-import { Button } from "../ui/button";
+import { Button, ButtonProps } from "../ui/button";
import { PressableProps } from "../ui/pressable";
import Heading from "../ui/typography/heading";
import Paragraph from "../ui/typography/paragraph";
@@ -31,13 +31,7 @@ type DialogHeaderProps = {
icon?: string;
title?: string;
paragraph?: string;
- button?: {
- onPress?: () => void;
- loading?: boolean;
- title?: string;
- type?: PressableProps["type"];
- icon?: string;
- };
+ button?: ButtonProps;
paragraphColor?: string;
padding?: number;
centered?: boolean;
@@ -95,17 +89,14 @@ const DialogHeader = ({
{button ? (
) : null}
diff --git a/apps/mobile/app/components/list-items/reminder/index.tsx b/apps/mobile/app/components/list-items/reminder/index.tsx
index 8b283502c..d52617ec6 100644
--- a/apps/mobile/app/components/list-items/reminder/index.tsx
+++ b/apps/mobile/app/components/list-items/reminder/index.tsx
@@ -17,24 +17,26 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
import { Reminder } from "@notesnook/core";
+import { strings } from "@notesnook/intl";
import { useThemeColors } from "@notesnook/theme";
import React from "react";
import { View } from "react-native";
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import { notesnook } from "../../../../e2e/test.ids";
-import { defaultBorderRadius, AppFontSize } from "../../../utils/size";
+import useIsSelected from "../../../hooks/use-selected";
+import AddReminder from "../../../screens/add-reminder";
+import { eSendEvent } from "../../../services/event-manager";
+import { useSelectionStore } from "../../../stores/use-selection-store";
+import { eCloseSheet } from "../../../utils/events";
+import { AppFontSize, defaultBorderRadius } from "../../../utils/size";
+import { DefaultAppStyles } from "../../../utils/styles";
import { Properties } from "../../properties";
-import ReminderSheet from "../../sheets/reminder";
+import AppIcon from "../../ui/AppIcon";
import { IconButton } from "../../ui/icon-button";
import { ReminderTime } from "../../ui/reminder-time";
import Heading from "../../ui/typography/heading";
import Paragraph from "../../ui/typography/paragraph";
import SelectionWrapper, { selectItem } from "../selection-wrapper";
-import { strings } from "@notesnook/intl";
-import { useSelectionStore } from "../../../stores/use-selection-store";
-import useIsSelected from "../../../hooks/use-selected";
-import AppIcon from "../../ui/AppIcon";
-import { DefaultAppStyles } from "../../../utils/styles";
const ReminderItem = React.memo(
({
@@ -49,8 +51,10 @@ const ReminderItem = React.memo(
const { colors } = useThemeColors();
const openReminder = () => {
if (selectItem(item)) return;
-
- ReminderSheet.present(item, undefined, isSheet);
+ AddReminder.present(item, undefined);
+ if (isSheet) {
+ eSendEvent(eCloseSheet);
+ }
};
const selectionMode = useSelectionStore((state) => state.selectionMode);
const [selected] = useIsSelected(item);
diff --git a/apps/mobile/app/components/sheets/relations-list/index.tsx b/apps/mobile/app/components/sheets/relations-list/index.tsx
index 3b6be11b3..e3fbeb1c2 100644
--- a/apps/mobile/app/components/sheets/relations-list/index.tsx
+++ b/apps/mobile/app/components/sheets/relations-list/index.tsx
@@ -34,7 +34,7 @@ import { AppFontSize } from "../../../utils/size";
import DialogHeader from "../../dialog/dialog-header";
import List from "../../list";
import SheetProvider from "../../sheet-provider";
-import { Button } from "../../ui/button";
+import { Button, ButtonProps } from "../../ui/button";
import { PressableProps } from "../../ui/pressable";
import Paragraph from "../../ui/typography/paragraph";
import { DefaultAppStyles } from "../../../utils/styles";
@@ -47,18 +47,10 @@ type RelationsListProps = {
referenceType: string;
relationType: "to" | "from";
title: string;
- button?: Button;
+ button?: ButtonProps;
onAdd: () => void;
};
-type Button = {
- onPress?: (() => void) | undefined;
- loading?: boolean | undefined;
- title?: string | undefined;
- type?: PressableProps["type"];
- icon?: string;
-};
-
const IconsByType = {
reminder: "bell"
};
@@ -154,7 +146,7 @@ RelationsList.present = ({
referenceType: string;
relationType: "to" | "from";
title: string;
- button?: Button;
+ button?: ButtonProps;
onAdd: () => void;
}) => {
presentSheet({
diff --git a/apps/mobile/app/hooks/use-actions.tsx b/apps/mobile/app/hooks/use-actions.tsx
index defd937a4..650fb8793 100644
--- a/apps/mobile/app/hooks/use-actions.tsx
+++ b/apps/mobile/app/hooks/use-actions.tsx
@@ -41,7 +41,6 @@ import ExportNotesSheet from "../components/sheets/export-notes";
import PublishNoteSheet from "../components/sheets/publish-note";
import { ReferencesList } from "../components/sheets/references";
import { RelationsList } from "../components/sheets/relations-list/index";
-import ReminderSheet from "../components/sheets/reminder";
import { useSideBarDraggingStore } from "../components/side-menu/dragging-store";
import { ButtonProps } from "../components/ui/button";
import { useTabStore } from "../screens/editor/tiptap/use-tab-store";
@@ -54,19 +53,20 @@ import {
} from "../services/event-manager";
import Navigation from "../services/navigation";
import Notifications from "../services/notifications";
+import SettingsService from "../services/settings";
+import { useArchivedStore } from "../stores/use-archived-store";
import { useMenuStore } from "../stores/use-menu-store";
import useNavigationStore from "../stores/use-navigation-store";
import { useRelationStore } from "../stores/use-relation-store";
import { useSelectionStore } from "../stores/use-selection-store";
+import { useSettingStore } from "../stores/use-setting-store";
import { useTagStore } from "../stores/use-tag-store";
import { useUserStore } from "../stores/use-user-store";
import { eUpdateNoteInEditor } from "../utils/events";
import { deleteItems } from "../utils/functions";
import { convertNoteToText } from "../utils/note-to-text";
import { sleep } from "../utils/time";
-import SettingsService from "../services/settings";
-import { useSettingStore } from "../stores/use-setting-store";
-import { useArchivedStore } from "../stores/use-archived-store";
+import AddReminder from "../screens/add-reminder";
export type ActionId =
| "select"
@@ -448,7 +448,8 @@ export const useActions = ({
title: strings.editReminder(),
icon: "pencil",
onPress: async () => {
- ReminderSheet.present(item);
+ AddReminder.present(item);
+ close();
}
}
);
@@ -908,12 +909,18 @@ export const useActions = ({
referenceType: "reminder",
relationType: "from",
title: strings.dataTypesPluralCamelCase.reminder(),
- onAdd: () => ReminderSheet.present(undefined, item, true),
+ onAdd: () => {
+ AddReminder.present(undefined, item);
+ close();
+ },
button: {
- title: strings.add(),
- type: "accent",
- onPress: () => ReminderSheet.present(undefined, item, true),
- icon: "plus"
+ type: "plain",
+ onPress: () => {
+ AddReminder.present(undefined, item);
+ close();
+ },
+ icon: "plus",
+ iconSize: 20
}
});
}
@@ -957,7 +964,8 @@ export const useActions = ({
title: strings.remindMe(),
icon: "clock-plus-outline",
onPress: () => {
- ReminderSheet.present(undefined, item);
+ close();
+ AddReminder.present(undefined, item);
}
},
{
diff --git a/apps/mobile/app/hooks/use-app-events.tsx b/apps/mobile/app/hooks/use-app-events.tsx
index 1b01a074e..4738b7f1f 100644
--- a/apps/mobile/app/hooks/use-app-events.tsx
+++ b/apps/mobile/app/hooks/use-app-events.tsx
@@ -49,7 +49,6 @@ import { MMKV } from "../common/database/mmkv";
import { endProgress, startProgress } from "../components/dialogs/progress";
import Migrate from "../components/sheets/migrate";
import NewFeature from "../components/sheets/new-feature";
-import ReminderSheet from "../components/sheets/reminder";
import { Walkthrough } from "../components/walkthroughs";
import {
resetTabStore,
@@ -103,6 +102,7 @@ import { getGithubVersion } from "../utils/github-version";
import { fluidTabsRef } from "../utils/global-refs";
import { NotesnookModule } from "../utils/notesnook-module";
import { sleep } from "../utils/time";
+import AddReminder from "../screens/add-reminder";
const onCheckSyncStatus = async (type: SyncStatusEvent) => {
const { disableSync, disableAutoSync } = SettingsService.get();
@@ -182,10 +182,10 @@ const onAppOpenedFromURL = async (event: { url: string }) => {
const id = new URL(url).searchParams.get("id");
if (id) {
const reminder = await db.reminders.reminder(id);
- if (reminder) ReminderSheet.present(reminder);
+ if (reminder) AddReminder.present(reminder);
}
} else if (url.startsWith("https://notesnook.com/new_reminder")) {
- ReminderSheet.present();
+ AddReminder.present();
}
} catch (e) {
console.error(e);
diff --git a/apps/mobile/app/navigation/navigation-stack.tsx b/apps/mobile/app/navigation/navigation-stack.tsx
index efe14356d..ceec1f058 100644
--- a/apps/mobile/app/navigation/navigation-stack.tsx
+++ b/apps/mobile/app/navigation/navigation-stack.tsx
@@ -21,6 +21,7 @@ import { useThemeColors } from "@notesnook/theme";
import { NavigationContainer } from "@react-navigation/native";
import { createNativeStackNavigator } from "@react-navigation/native-stack";
import * as React from "react";
+import { db } from "../common/database";
import { hideAllTooltips } from "../hooks/use-tooltip";
import SettingsService from "../services/settings";
import useNavigationStore, {
@@ -29,7 +30,6 @@ import useNavigationStore, {
import { useSelectionStore } from "../stores/use-selection-store";
import { useSettingStore } from "../stores/use-setting-store";
import { rootNavigatorRef } from "../utils/global-refs";
-import { db } from "../common/database";
const RootStack = createNativeStackNavigator();
const AppStack = createNativeStackNavigator();
@@ -248,6 +248,7 @@ let MoveNotebook: any = null;
let MoveNotes: any = null;
let Settings: any = null;
let ManageTags: any = null;
+let AddReminder: any = null;
export const RootNavigation = () => {
const introCompleted = useSettingStore(
@@ -336,6 +337,15 @@ export const RootNavigation = () => {
return ManageTags;
}}
/>
+
+ {
+ AddReminder =
+ AddReminder || require("../screens/add-reminder").default;
+ return AddReminder;
+ }}
+ />
);
diff --git a/apps/mobile/app/components/sheets/reminder/index.tsx b/apps/mobile/app/screens/add-reminder/index.tsx
similarity index 86%
rename from apps/mobile/app/components/sheets/reminder/index.tsx
rename to apps/mobile/app/screens/add-reminder/index.tsx
index 85e4dc56e..9b7c8a809 100644
--- a/apps/mobile/app/components/sheets/reminder/index.tsx
+++ b/apps/mobile/app/screens/add-reminder/index.tsx
@@ -16,49 +16,31 @@ 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 .
*/
-import { useThemeColors } from "@notesnook/theme";
-import React, { RefObject, useRef, useState } from "react";
-import {
- Platform,
- TextInput,
- View,
- ScrollView as RNScrollView
-} from "react-native";
-import { ActionSheetRef, ScrollView } from "react-native-actions-sheet";
-import DateTimePickerModal from "react-native-modal-datetime-picker";
-import {
- PresentSheetOptions,
- ToastManager,
- presentSheet
-} from "../../../services/event-manager";
-import { defaultBorderRadius, AppFontSize } from "../../../utils/size";
-import { Button } from "../../ui/button";
-import Input from "../../ui/input";
-
-import dayjs from "dayjs";
-import DatePicker from "react-native-date-picker";
-import { db } from "../../../common/database";
-import { DDS } from "../../../services/device-detection";
-import Navigation from "../../../services/navigation";
-import Notifications from "../../../services/notifications";
-import PremiumService from "../../../services/premium";
-import SettingsService from "../../../services/settings";
-import { useRelationStore } from "../../../stores/use-relation-store";
-import { Dialog } from "../../dialog";
-import { ReminderTime } from "../../ui/reminder-time";
-import Heading from "../../ui/typography/heading";
-import Paragraph from "../../ui/typography/paragraph";
import { Note, Reminder } from "@notesnook/core";
import { strings } from "@notesnook/intl";
-import { DefaultAppStyles } from "../../../utils/styles";
-
-type ReminderSheetProps = {
- actionSheetRef: RefObject;
- close?: (ctx?: string) => void;
- update?: (options: PresentSheetOptions) => void;
- reminder?: Reminder;
- reference?: Note;
-};
+import { useThemeColors } from "@notesnook/theme";
+import dayjs from "dayjs";
+import React, { useRef, useState } from "react";
+import { Platform, ScrollView, TextInput, View } from "react-native";
+import DatePicker from "react-native-date-picker";
+import DateTimePickerModal from "react-native-modal-datetime-picker";
+import { SafeAreaView } from "react-native-safe-area-context";
+import { db } from "../../common/database";
+import { Dialog } from "../../components/dialog";
+import { Header } from "../../components/header";
+import { Button } from "../../components/ui/button";
+import Input from "../../components/ui/input";
+import { ReminderTime } from "../../components/ui/reminder-time";
+import Paragraph from "../../components/ui/typography/paragraph";
+import { DDS } from "../../services/device-detection";
+import { ToastManager } from "../../services/event-manager";
+import Navigation, { NavigationProps } from "../../services/navigation";
+import Notifications from "../../services/notifications";
+import PremiumService from "../../services/premium";
+import SettingsService from "../../services/settings";
+import { useRelationStore } from "../../stores/use-relation-store";
+import { AppFontSize, defaultBorderRadius } from "../../utils/size";
+import { DefaultAppStyles } from "../../utils/styles";
const ReminderModes =
Platform.OS === "ios"
@@ -97,13 +79,8 @@ const ReminderNotificationModes = {
Urgent: "urgent"
};
-export default function ReminderSheet({
- actionSheetRef,
- close,
- update,
- reminder,
- reference
-}: ReminderSheetProps) {
+export default function AddReminder(props: NavigationProps<"AddReminder">) {
+ const { reminder, reference } = props.route.params;
const { colors, isDark } = useThemeColors();
const [reminderMode, setReminderMode] = useState(
reminder?.mode || "once"
@@ -216,28 +193,33 @@ export default function ReminderSheet({
Notifications.scheduleNotification(_reminder as Reminder);
Navigation.queueRoutesForUpdate();
useRelationStore.getState().update();
- close?.();
+ Navigation.goBack();
} catch (e) {
- ToastManager.error(e as Error, undefined, "local");
+ ToastManager.error(e as Error, undefined);
}
}
return (
-
-
- {reminder ? strings.editReminder() : strings.newReminder()}
-
-
+
@@ -286,10 +267,8 @@ export default function ReminderSheet({
ReminderModes[mode as keyof typeof ReminderModes] as string
)}
style={{
- marginRight: 12,
- borderRadius: 100,
- minWidth: 70,
- paddingVertical: DefaultAppStyles.GAP_VERTICAL_SMALL
+ paddingVertical: DefaultAppStyles.GAP_VERTICAL_SMALL,
+ marginRight: DefaultAppStyles.GAP_SMALL
}}
proTag={mode === "Repeat"}
height={35}
@@ -368,7 +347,7 @@ export default function ReminderSheet({
))}
-
+
{recurringMode === RecurringModes.Daily ||
recurringMode === RecurringModes.Year
? null
@@ -429,7 +408,7 @@ export default function ReminderSheet({
}}
/>
))}
-
+
) : null}
@@ -546,7 +525,7 @@ export default function ReminderSheet({
/>
{reminderMode === ReminderModes.Permanent ? null : (
-
))}
-
+
)}
-
-
-
+
);
}
-ReminderSheet.present = (
- reminder?: Reminder,
- reference?: Note,
- isSheet?: boolean
-) => {
- presentSheet({
- context: isSheet ? "local" : undefined,
- component: (ref, close, update) => (
-
- )
+AddReminder.present = (reminder?: Reminder, reference?: Note) => {
+ Navigation.navigate("AddReminder", {
+ reminder,
+ reference
});
};
diff --git a/apps/mobile/app/screens/editor/tiptap/use-editor-events.tsx b/apps/mobile/app/screens/editor/tiptap/use-editor-events.tsx
index 33d66ae8c..f008efcf6 100644
--- a/apps/mobile/app/screens/editor/tiptap/use-editor-events.tsx
+++ b/apps/mobile/app/screens/editor/tiptap/use-editor-events.tsx
@@ -38,11 +38,11 @@ import { WebViewMessageEvent } from "react-native-webview";
import { DatabaseLogger, db } from "../../../common/database";
import downloadAttachment from "../../../common/filesystem/download-attachment";
import { AuthMode } from "../../../components/auth/common";
+import { Properties } from "../../../components/properties";
import EditorTabs from "../../../components/sheets/editor-tabs";
import { Issue } from "../../../components/sheets/github/issue";
import LinkNote from "../../../components/sheets/link-note";
import { RelationsList } from "../../../components/sheets/relations-list";
-import ReminderSheet from "../../../components/sheets/reminder";
import TableOfContents from "../../../components/sheets/toc";
import { DDS } from "../../../services/device-detection";
import {
@@ -73,13 +73,13 @@ import {
} from "../../../utils/events";
import { openLinkInBrowser } from "../../../utils/functions";
import { fluidTabsRef } from "../../../utils/global-refs";
+import { sleep } from "../../../utils/time";
+import ManageTags from "../../manage-tags";
import { useDragState } from "../../settings/editor/state";
import { EditorMessage, EditorProps, useEditorType } from "./types";
import { useTabStore } from "./use-tab-store";
import { editorState, openInternalLink } from "./utils";
-import { Properties } from "../../../components/properties";
-import { sleep } from "../../../utils/time";
-import ManageTags from "../../manage-tags";
+import AddReminder from "../../add-reminder";
const publishNote = async () => {
const user = useUserStore.getState().user;
@@ -438,7 +438,7 @@ export const useEditorEvents = (
referenceType: "reminder",
relationType: "from",
title: strings.dataTypesPluralCamelCase.reminder(),
- onAdd: () => ReminderSheet.present(undefined, note, true)
+ onAdd: () => AddReminder.present(undefined, note)
});
break;
case EditorEvents.newtag:
diff --git a/apps/mobile/app/screens/reminders/index.tsx b/apps/mobile/app/screens/reminders/index.tsx
index 2fd375ab8..f8d115c81 100644
--- a/apps/mobile/app/screens/reminders/index.tsx
+++ b/apps/mobile/app/screens/reminders/index.tsx
@@ -17,19 +17,19 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
+import { strings } from "@notesnook/intl";
import React from "react";
import { FloatingButton } from "../../components/container/floating-button";
import DelayLayout from "../../components/delay-layout";
import { Header } from "../../components/header";
import List from "../../components/list";
import SelectionHeader from "../../components/selection-header";
-import ReminderSheet from "../../components/sheets/reminder";
import { useNavigationFocus } from "../../hooks/use-navigation-focus";
import Navigation, { NavigationProps } from "../../services/navigation";
import SettingsService from "../../services/settings";
import useNavigationStore from "../../stores/use-navigation-store";
import { useReminders } from "../../stores/use-reminder-store";
-import { strings } from "@notesnook/intl";
+import AddReminder from "../add-reminder";
export const Reminders = ({
navigation,
@@ -68,7 +68,7 @@ export const Reminders = ({
}}
id={route.name}
onPressDefaultRightButton={() => {
- ReminderSheet.present();
+ AddReminder.present();
}}
/>
@@ -84,7 +84,7 @@ export const Reminders = ({
paragraph: strings.remindersEmpty(),
button: strings.setReminder(),
action: () => {
- ReminderSheet.present();
+ AddReminder.present();
},
loading: strings.loadingReminders()
}}
@@ -92,7 +92,7 @@ export const Reminders = ({
{
- ReminderSheet.present();
+ AddReminder.present();
}}
alwaysVisible
/>
diff --git a/apps/mobile/app/services/intent.ts b/apps/mobile/app/services/intent.ts
index a6ae701ec..f001d7bc8 100644
--- a/apps/mobile/app/services/intent.ts
+++ b/apps/mobile/app/services/intent.ts
@@ -18,12 +18,12 @@ along with this program. If not, see .
*/
import { Platform } from "react-native";
import { db } from "../common/database";
-import ReminderSheet from "../components/sheets/reminder";
import { setAppState } from "../screens/editor/tiptap/utils";
import { eOnLoadNote } from "../utils/events";
import { NotesnookModule } from "../utils/notesnook-module";
import { eSendEvent } from "./event-manager";
import { fluidTabsRef } from "../utils/global-refs";
+import AddReminder from "../screens/add-reminder";
const launchIntent = Platform.OS === "ios" ? {} : NotesnookModule.getIntent();
let used = false;
@@ -65,9 +65,9 @@ export const IntentService = {
const reminder = await db.reminders.reminder(
intent["com.streetwriters.notesnook.OpenReminderId"]
);
- if (reminder) ReminderSheet.present(reminder);
+ if (reminder) AddReminder.present(reminder);
} else if (intent["com.streetwriters.notesnook.NewReminder"]) {
- ReminderSheet.present();
+ AddReminder.present();
}
} catch (e) {
/* empty */
diff --git a/apps/mobile/app/services/navigation.ts b/apps/mobile/app/services/navigation.ts
index d740030be..2303f02ca 100755
--- a/apps/mobile/app/services/navigation.ts
+++ b/apps/mobile/app/services/navigation.ts
@@ -69,7 +69,8 @@ const routeNames = {
LinkNotebooks: "LinkNotebooks",
MoveNotes: "MoveNotes",
Archive: "Archive",
- ManageTags: "ManageTags"
+ ManageTags: "ManageTags",
+ AddReminder: "AddReminder"
};
export type NavigationProps = NativeStackScreenProps<
diff --git a/apps/mobile/app/stores/use-navigation-store.ts b/apps/mobile/app/stores/use-navigation-store.ts
index 3cb39312d..0130250d2 100644
--- a/apps/mobile/app/stores/use-navigation-store.ts
+++ b/apps/mobile/app/stores/use-navigation-store.ts
@@ -94,6 +94,10 @@ export interface RouteParams extends ParamListBase {
ManageTags: {
ids?: string[];
};
+ AddReminder: {
+ reminder?: Reminder;
+ reference?: Note;
+ };
}
export type RouteName = keyof RouteParams;