Skip to content

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

mobile: fix crash in reminder notify sheet

Ammar Ahmed32c4e987dc64
diff --git a/apps/mobile/app/components/container/floating-button.tsx b/apps/mobile/app/components/container/floating-button.tsx
index 2f0402594..a0d3ad52d 100644
--- a/apps/mobile/app/components/container/floating-button.tsx
+++ b/apps/mobile/app/components/container/floating-button.tsx
@@ -35,6 +35,7 @@ import { useSettingStore } from "../../stores/use-setting-store";
import { getElevationStyle } from "../../utils/elevation";
import { AppFontSize, normalize } from "../../utils/size";
import { DefaultAppStyles } from "../../utils/styles";
+import { hexToRGBA, RGB_Linear_Shade } from "../../utils/colors";
interface FloatingButtonProps {
onPress: () => void;
@@ -147,7 +148,9 @@ const FloatingButton = ({
justifyContent: "center",
height: normalize(size === "small" ? 40 : 60),
width: normalize(size === "small" ? 40 : 60),
- backgroundColor: colors.primary.shade,
+ backgroundColor: color
+ ? RGB_Linear_Shade(0.87, hexToRGBA(color))
+ : colors.primary.shade,
borderRadius: size === "small" ? 15 : 20
}}
>
@@ -161,7 +164,7 @@ const FloatingButton = ({
? "delete"
: "plus"
}
- color={colors.primary.accent}
+ color={color || colors.primary.accent}
size={size === "small" ? AppFontSize.xl : AppFontSize.xxxl}
/>
</View>
diff --git a/apps/mobile/app/components/list-items/note/index.tsx b/apps/mobile/app/components/list-items/note/index.tsx
index 637e99e54..91bd179cd 100644
--- a/apps/mobile/app/components/list-items/note/index.tsx
+++ b/apps/mobile/app/components/list-items/note/index.tsx
@@ -30,7 +30,9 @@ import React from "react";
import { View } from "react-native";
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import { useIsCompactModeEnabled } from "../../../hooks/use-is-compact-mode-enabled";
-import useNavigationStore from "../../../stores/use-navigation-store";
+import useNavigationStore, {
+ RouteParams
+} from "../../../stores/use-navigation-store";
import { useRelationStore } from "../../../stores/use-relation-store";
import { AppFontSize } from "../../../utils/size";
@@ -53,7 +55,6 @@ import { TimeSince } from "../../ui/time-since";
import Heading from "../../ui/typography/heading";
import Paragraph from "../../ui/typography/paragraph";
import dayjs from "dayjs";
-import { useRoute } from "@react-navigation/native";
type NoteItemProps = {
item: Note | BaseTrashItem<Note>;
@@ -67,6 +68,7 @@ type NoteItemProps = {
isTrash?: boolean;
noOpen?: boolean;
locked?: boolean;
+ renderedInRoute?: keyof RouteParams;
};
const NoteItem = ({
@@ -79,9 +81,9 @@ const NoteItem = ({
tags,
attachmentsCount,
locked,
- noOpen = false
+ noOpen = false,
+ renderedInRoute
}: NoteItemProps) => {
- const route = useRoute();
const isEditingNote = useTabStore(
(state) =>
state.tabs.find((t) => t.id === state.currentTab)?.session?.noteId ===
@@ -265,7 +267,7 @@ const NoteItem = ({
{notebooks?.items
?.filter(
(item) =>
- route.name !== "Notebook" ||
+ renderedInRoute !== "Notebook" ||
item.id !== useNavigationStore.getState().focusedRouteId
)
.map((item) => (
diff --git a/apps/mobile/app/components/list-items/note/wrapper.tsx b/apps/mobile/app/components/list-items/note/wrapper.tsx
index 28be0a843..3a01dfad4 100644
--- a/apps/mobile/app/components/list-items/note/wrapper.tsx
+++ b/apps/mobile/app/components/list-items/note/wrapper.tsx
@@ -34,6 +34,7 @@ import { fluidTabsRef } from "../../../utils/global-refs";
import { NotebooksWithDateEdited, TagsWithDateEdited } from "@notesnook/common";
import NotePreview from "../../note-history/preview";
import SelectionWrapper, { selectItem } from "../selection-wrapper";
+import { RouteParams } from "../../../stores/use-navigation-store";
export const openNote = async (
item: Note,
@@ -82,6 +83,7 @@ type NoteWrapperProps = {
date: number;
isRenderedInActionSheet: boolean;
locked?: boolean;
+ renderedInRoute?: keyof RouteParams;
};
export const NoteWrapper = React.memo<
diff --git a/apps/mobile/app/components/list/list-item.wrapper.tsx b/apps/mobile/app/components/list/list-item.wrapper.tsx
index 08f719f76..9a816d4ca 100644
--- a/apps/mobile/app/components/list/list-item.wrapper.tsx
+++ b/apps/mobile/app/components/list/list-item.wrapper.tsx
@@ -200,6 +200,7 @@ export function ListItemWrapper(props: ListItemWrapperProps) {
isRenderedInActionSheet={isSheet}
index={index}
locked={locked.current}
+ renderedInRoute={props.renderedInRoute}
/>
</>
);