diff --git a/apps/mobile/src/components/Container/index.js b/apps/mobile/src/components/Container/index.js
index 49b3b3c25..2bb10ed8f 100644
--- a/apps/mobile/src/components/Container/index.js
+++ b/apps/mobile/src/components/Container/index.js
@@ -14,10 +14,10 @@ import {br, opacity, pv, SIZE, WEIGHT} from '../../common/common';
import {useTracked} from '../../provider';
import {ACTIONS} from '../../provider/actions';
import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/eventManager';
-import {eScrollEvent} from '../../services/events';
+import {eScrollEvent, eClearSearch} from '../../services/events';
import {db, getElevation, ToastEvent, DDS} from '../../utils/utils';
import {Header} from '../header';
-import {Search} from '../SearchInput';
+import {Search, inputRef} from '../SearchInput';
import SelectionHeader from '../SelectionHeader';
export const AnimatedSafeAreaView = Animatable.createAnimatableComponent(
@@ -125,6 +125,10 @@ export const Container = ({
const clearSearch = () => {
searchResult = null;
+ setText(null);
+ inputRef.current?.setNativeProps({
+ text: '',
+ });
dispatch({
type: ACTIONS.SEARCH_RESULTS,
results: {
@@ -136,6 +140,7 @@ export const Container = ({
};
useEffect(() => {
+ eSubscribeEvent(eClearSearch, clearSearch);
Keyboard.addListener('keyboardDidShow', () => {
setTimeout(() => {
if (DDS.isTab) return;
@@ -149,6 +154,7 @@ export const Container = ({
}, 0);
});
return () => {
+ eUnSubscribeEvent(eClearSearch, clearSearch);
Keyboard.removeListener('keyboardDidShow', () => {
setTimeout(() => {
if (DDS.isTab) return;
diff --git a/apps/mobile/src/components/Menu/index.js b/apps/mobile/src/components/Menu/index.js
index feeebb55e..b0732bb24 100644
--- a/apps/mobile/src/components/Menu/index.js
+++ b/apps/mobile/src/components/Menu/index.js
@@ -26,7 +26,11 @@ import {
import {useTracked} from '../../provider';
import {ACTIONS} from '../../provider/actions';
import {eSendEvent} from '../../services/eventManager';
-import {eOpenModalMenu, eSendSideMenuOverlayRef} from '../../services/events';
+import {
+ eOpenModalMenu,
+ eSendSideMenuOverlayRef,
+ eClearSearch,
+} from '../../services/events';
import NavigationService from '../../services/NavigationService';
import {timeSince, getElevation, hexToRGBA, db, DDS} from '../../utils/utils';
import {inputRef} from '../SearchInput';
@@ -202,17 +206,7 @@ export const Menu = ({
onPress={() => {
item.close === false ? null : close();
if (item.close) {
- inputRef.current?.setNativeProps({
- text: '',
- });
- dispatch({
- type: ACTIONS.SEARCH_RESULTS,
- results: {
- type: null,
- results: [],
- keyword: null,
- },
- });
+ eSendEvent(eClearSearch);
}
item.func();
}}
diff --git a/apps/mobile/src/components/NotesList/index.js b/apps/mobile/src/components/NotesList/index.js
index 07446212f..0679212ac 100644
--- a/apps/mobile/src/components/NotesList/index.js
+++ b/apps/mobile/src/components/NotesList/index.js
@@ -12,7 +12,7 @@ import {SIZE, WEIGHT} from '../../common/common';
import {useTracked} from '../../provider';
import {ACTIONS} from '../../provider/actions';
import {eSendEvent} from '../../services/eventManager';
-import {eScrollEvent} from '../../services/events';
+import {eScrollEvent, eClearSearch} from '../../services/events';
import {ToastEvent, hexToRGBA, DDS, db} from '../../utils/utils';
import {NotesPlaceHolder} from '../ListPlaceholders';
import NoteItem from '../NoteItem';
@@ -177,17 +177,7 @@ export const NotesList = ({isGrouped = false}) => {
{
- inputRef.current?.setNativeProps({
- text: '',
- });
- dispatch({
- type: ACTIONS.SEARCH_RESULTS,
- results: {
- results: [],
- type: null,
- keyword: null,
- },
- });
+ eSendEvent(eClearSearch);
}}
style={{
fontFamily: WEIGHT.regular,
diff --git a/apps/mobile/src/components/SimpleList/index.js b/apps/mobile/src/components/SimpleList/index.js
index c59bab004..76a18d2c4 100644
--- a/apps/mobile/src/components/SimpleList/index.js
+++ b/apps/mobile/src/components/SimpleList/index.js
@@ -79,17 +79,7 @@ const SimpleList = ({
{
- inputRef.current?.setNativeProps({
- text: '',
- });
- dispatch({
- type: ACTIONS.SEARCH_RESULTS,
- results: {
- results: [],
- type: null,
- keyword: null,
- },
- });
+ eSendEvent(eClearSearch);
}}
style={{
fontFamily: WEIGHT.regular,
diff --git a/apps/mobile/src/services/events.js b/apps/mobile/src/services/events.js
index 93fac4890..bb2e7956b 100644
--- a/apps/mobile/src/services/events.js
+++ b/apps/mobile/src/services/events.js
@@ -63,3 +63,5 @@ export const eOpenVaultDialog = '530';
export const eCloseVaultDialog = '531';
export const refreshNotesPage = '532';
+
+export const eClearSearch = '533';