Perform search when hashtag is pressed (#6893)
* Perform search when hashtag is pressed * PM feedback review
This commit is contained in:
parent
92ca1e3704
commit
f32b2dfeb2
2 changed files with 16 additions and 2 deletions
|
|
@ -2,8 +2,9 @@
|
|||
// See LICENSE.txt for license information.
|
||||
|
||||
import React from 'react';
|
||||
import {StyleProp, Text, TextStyle} from 'react-native';
|
||||
import {DeviceEventEmitter, StyleProp, Text, TextStyle} from 'react-native';
|
||||
|
||||
import {Navigation, Screens} from '@constants';
|
||||
import {popToRoot, dismissAllModals} from '@screens/navigation';
|
||||
|
||||
type HashtagProps = {
|
||||
|
|
@ -17,7 +18,12 @@ const Hashtag = ({hashtag, linkStyle}: HashtagProps) => {
|
|||
await dismissAllModals();
|
||||
await popToRoot();
|
||||
|
||||
// showSearchModal('#' + hashtag);
|
||||
DeviceEventEmitter.emit(Navigation.NAVIGATE_TO_TAB, {
|
||||
screen: Screens.SEARCH,
|
||||
params: {
|
||||
searchTerm: hashtag,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -109,6 +109,14 @@ const SearchScreen = ({teamId, teams}: Props) => {
|
|||
setSearchTeamId(teamId);
|
||||
}, [teamId]);
|
||||
|
||||
useEffect(() => {
|
||||
if (searchTerm) {
|
||||
resetToInitial();
|
||||
setSearchValue(searchTerm);
|
||||
handleSearch(searchTeamId, searchTerm);
|
||||
}
|
||||
}, [searchTerm]);
|
||||
|
||||
const onSnap = (offset: number, animated = true) => {
|
||||
scrollRef.current?.scrollToOffset({offset, animated});
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue