diff --git a/apps/mobile/app/screens/search/search-bar.tsx b/apps/mobile/app/screens/search/search-bar.tsx
index 6bed797a6..adb63db29 100644
--- a/apps/mobile/app/screens/search/search-bar.tsx
+++ b/apps/mobile/app/screens/search/search-bar.tsx
@@ -19,7 +19,7 @@ along with this program. If not, see .
import { strings } from "@notesnook/intl";
import { useThemeColors } from "@notesnook/theme";
-import React, { useRef } from "react";
+import React, { useRef, useState } from "react";
import { View } from "react-native";
import { TextInput } from "react-native-gesture-handler";
import { IconButton } from "../../components/ui/icon-button";
@@ -36,6 +36,7 @@ export const SearchBar = ({
onChangeText: (value: string) => void;
loading?: boolean;
}) => {
+ const [clearButton, setClearButton] = useState(false);
const selectionMode = useSelectionStore((state) => state.selectionMode);
const isFocused = useNavigationStore(
(state) => state.focusedRouteId === "Search"
@@ -45,6 +46,7 @@ export const SearchBar = ({
const inputRef = useRef(null);
const _onChangeText = (value: string) => {
onChangeText(value);
+ setClearButton(!!value);
};
return selectionMode && isFocused ? null : (
@@ -100,6 +102,23 @@ export const SearchBar = ({
autoCorrect={false}
placeholderTextColor={colors.primary.placeholder}
/>
+
+ {clearButton ? (
+ {
+ inputRef.current?.clear();
+ onChangeText("");
+ setClearButton(false);
+ }}
+ color={colors.primary.paragraph}
+ type="plain"
+ />
+ ) : null}
);
diff --git a/apps/mobile/e2e/globalSetup.ts b/apps/mobile/e2e/globalSetup.ts
index d66b68254..bc92efa4b 100644
--- a/apps/mobile/e2e/globalSetup.ts
+++ b/apps/mobile/e2e/globalSetup.ts
@@ -1,5 +1,5 @@
import { execSync } from "child_process";
-
+//@ts-ignore
import { pathExists, ensureDir } from "fs-extra";
import { resolveConfig } from "detox/internals";
diff --git a/apps/mobile/e2e/tests/search.e2e.ts b/apps/mobile/e2e/tests/search.e2e.ts
index f55f739d4..df04d214b 100644
--- a/apps/mobile/e2e/tests/search.e2e.ts
+++ b/apps/mobile/e2e/tests/search.e2e.ts
@@ -28,6 +28,9 @@ describe("Search", () => {
.typeTextById("search-input", "Test")
.wait(1000)
.isVisibleByText("1")
+ .waitAndTapById("clear-search")
+ .wait(2000)
+ .isNotVisibleByText("1")
.run();
});
});
diff --git a/apps/mobile/e2e/tests/utils.ts b/apps/mobile/e2e/tests/utils.ts
index d7c549261..5955af2af 100644
--- a/apps/mobile/e2e/tests/utils.ts
+++ b/apps/mobile/e2e/tests/utils.ts
@@ -20,6 +20,7 @@ along with this program. If not, see .
import { expect as jestExpect } from "@jest/globals";
import { device as _device, expect } from "detox";
import { readFileSync } from "fs";
+//@ts-ignore
import { toMatchImageSnapshot } from "jest-image-snapshot";
import type { RouteName } from "../../app/stores/use-navigation-store";
import { notesnook } from "../test.ids";
diff --git a/package.json b/package.json
index b4ae7467b..89ee5dec2 100644
--- a/package.json
+++ b/package.json
@@ -104,6 +104,10 @@
"run-ios",
"build-ios",
"build-android",
+ "build-android-debug",
+ "e2e-android-debug",
+ "e2e-android",
+ "e2e-ios",
"release-android",
"release-android-bundle",
"release-ios",