fix performance bottleneck

This commit is contained in:
ammarahm-ed
2020-05-09 00:32:10 +05:00
parent a60eb83806
commit 05ff7a832b
3 changed files with 38 additions and 26 deletions

View File

@@ -120,19 +120,25 @@ export const Container = ({
};
const clearSearch = () => {
searchResult = null;
setText(null);
inputRef.current?.setNativeProps({
text: '',
});
dispatch({
type: ACTIONS.SEARCH_RESULTS,
results: {
results: [],
type: null,
keyword: null,
},
});
if (searchResults.results && searchResults.results.length > 0) {
searchResult = null;
if (text) {
setText(null);
}
inputRef.current?.setNativeProps({
text: '',
});
dispatch({
type: ACTIONS.SEARCH_RESULTS,
results: {
results: [],
type: null,
keyword: null,
},
});
}
};
useEffect(() => {
@@ -167,6 +173,7 @@ export const Container = ({
}, []);
useEffect(() => {
selection.data = data;
selection.type = type;
eSubscribeEvent(eScrollEvent, onScroll);