Skip to content

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

fix search input icon

ammarahm-edbc09c2daf30c
diff --git a/apps/mobile/src/components/Header/index.js b/apps/mobile/src/components/Header/index.js
index ccec6efa4..2cceb5c1f 100644
--- a/apps/mobile/src/components/Header/index.js
+++ b/apps/mobile/src/components/Header/index.js
@@ -1,18 +1,19 @@
-import React, { useEffect, useState } from 'react';
-import { Platform, StyleSheet, View } from 'react-native';
-import { useSafeAreaInsets } from 'react-native-safe-area-context';
-import { useTracked } from '../../provider';
-import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';
+import React, {useEffect, useState} from 'react';
+import {Platform, StyleSheet, View} from 'react-native';
+import {useSafeAreaInsets} from 'react-native-safe-area-context';
+import {useTracked} from '../../provider';
+import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/EventManager';
import Navigation from '../../services/Navigation';
-import { dWidth } from '../../utils';
-import { eScrollEvent } from '../../utils/Events';
-import { SIZE } from '../../utils/SizeUtils';
-import { ActionIcon } from '../ActionIcon';
-import { SearchInput } from '../SearchInput';
-import { HeaderLeftMenu } from './HeaderLeftMenu';
-import { HeaderRightMenu } from './HeaderRightMenu';
-import { HeaderTitle } from './HeaderTitle';
-
+import SearchService from '../../services/SearchService';
+import SettingsService from '../../services/SettingsService';
+import {dWidth} from '../../utils';
+import {eScrollEvent} from '../../utils/Events';
+import {SIZE} from '../../utils/SizeUtils';
+import {ActionIcon} from '../ActionIcon';
+import {SearchInput} from '../SearchInput';
+import {HeaderLeftMenu} from './HeaderLeftMenu';
+import {HeaderRightMenu} from './HeaderRightMenu';
+import {HeaderTitle} from './HeaderTitle';
export const Header = ({root}) => {
const [state] = useTracked();
@@ -74,12 +75,10 @@ export const Header = ({root}) => {
{currentScreen === 'search' ? (
<View style={[styles.rightBtnContainer, {right: 6}]}>
<ActionIcon
- onPress={async () => {
- Navigation.navigate('Search', {
- menu: false,
- });
+ onPress={() => {
+ SearchService.search();
}}
- name="tune"
+ name="magnify"
size={SIZE.xxxl}
color={colors.pri}
style={styles.rightBtn}
diff --git a/apps/mobile/src/components/SearchInput/index.js b/apps/mobile/src/components/SearchInput/index.js
index 2b270b5e6..06ea67697 100644
--- a/apps/mobile/src/components/SearchInput/index.js
+++ b/apps/mobile/src/components/SearchInput/index.js
@@ -5,7 +5,6 @@ import SearchService from '../../services/SearchService';
import {inputRef} from '../../utils/Refs';
import {SIZE, WEIGHT} from '../../utils/SizeUtils';
-let searchTerm;
export const SearchInput = (props) => {
const [state] = useTracked();
const {colors} = state;
@@ -17,10 +16,14 @@ export const SearchInput = (props) => {
useEffect(() => {
updateSearchState();
+
+ return () => {
+ SearchService.setTerm(null);
+ };
}, []);
const onChangeText = async (value) => {
- searchTerm = value;
+ SearchService.setTerm(value);
};
return (
@@ -54,7 +57,7 @@ export const SearchInput = (props) => {
onChangeText={onChangeText}
multiline={false}
onSubmitEditing={async () => {
- await SearchService.search(searchTerm);
+ await SearchService.search();
}}
enablesReturnKeyAutomatically
placeholder="Type a keyword"