Skip to content

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

mobile: fix show results count in search

Ammar Ahmed246533714810
diff --git a/apps/mobile/app/components/list-items/headers/section-header.tsx b/apps/mobile/app/components/list-items/headers/section-header.tsx
index add087e23..de9b3f0cb 100644
--- a/apps/mobile/app/components/list-items/headers/section-header.tsx
+++ b/apps/mobile/app/components/list-items/headers/section-header.tsx
@@ -47,6 +47,7 @@ type SectionHeaderProps = {
groupOptions: GroupOptions;
group: GroupingKey;
onOpenJumpToDialog: () => void;
+ itemCount?: number;
};
export const SectionHeader = React.memo<
@@ -60,13 +61,16 @@ export const SectionHeader = React.memo<
screen,
groupOptions,
group,
- onOpenJumpToDialog
+ onOpenJumpToDialog,
+ itemCount
}: SectionHeaderProps) {
const { colors } = useThemeColors();
const isCompactModeEnabled = useIsCompactModeEnabled(
dataType as "note" | "notebook" | "searchResult"
);
+ console.log(item);
+
return (
<View
style={{
@@ -111,7 +115,9 @@ export const SectionHeader = React.memo<
color={color || colors.primary.accent}
>
{!item.title || item.title === ""
- ? strings.pinned().toUpperCase()
+ ? screen === "Search"
+ ? strings.results(itemCount || 0)
+ : strings.pinned().toUpperCase()
: item.title.toUpperCase()}
</Heading>
</Pressable>
@@ -202,6 +208,7 @@ export const SectionHeader = React.memo<
},
(prev, next) => {
if (prev.item.title !== next.item.title) return false;
+ if (prev.itemCount !== next.itemCount) return false;
if (prev.groupOptions?.groupBy !== next.groupOptions.groupBy) return false;
if (prev.groupOptions?.sortDirection !== next.groupOptions.sortDirection)
return false;
diff --git a/apps/mobile/app/components/list/list-item.wrapper.tsx b/apps/mobile/app/components/list/list-item.wrapper.tsx
index 7243d6f53..be5ce74e0 100644
--- a/apps/mobile/app/components/list/list-item.wrapper.tsx
+++ b/apps/mobile/app/components/list/list-item.wrapper.tsx
@@ -305,6 +305,7 @@ export function ListItemWrapper(props: ListItemWrapperProps) {
dataType={item.type}
color={props.customAccentColor}
groupOptions={groupOptions}
+ itemCount={items?.placeholders.length}
onOpenJumpToDialog={() => {
eSendEvent(eOpenJumpToDialog, {
ref: props.scrollRef,