diff --git a/src/screens/detail/SearchScreen.js b/src/screens/detail/SearchScreen.js index ada726b..f7326bd 100644 --- a/src/screens/detail/SearchScreen.js +++ b/src/screens/detail/SearchScreen.js @@ -58,12 +58,21 @@ export default function SearchScreen(props) { const {route} = props; const setSearch = route.params?.setSearch; + const searchParam = route.params?.search; const [searchText, setSearchText] = useState(''); const [recentSearch, setRecentSearch] = useState([]); const [autoCompleteData, setAutoCompleteData] = useState([]); + useEffect(() => { + if (searchParam) { + setSearchText(searchParam); + autocomplete(searchParam); + } + initRecentSearch(); + }, [searchParam]); + useEffect(() => { initRecentSearch(); }, []); diff --git a/src/screens/list/ListMainScreen.js b/src/screens/list/ListMainScreen.js index ed5127d..c55ce51 100644 --- a/src/screens/list/ListMainScreen.js +++ b/src/screens/list/ListMainScreen.js @@ -18,6 +18,7 @@ import { COLOR_TEXT_BLACK, COLOR_TEXT70GRAY, COLOR_HOME_BACKGROUND, + COLOR_BLUE, } from '../../assets/color'; import Toast from 'react-native-toast-message'; import AnimatedButton from '../../components/AnimationButton'; @@ -285,8 +286,7 @@ export default function ListMainScreen() { justifyContent: 'center', }} onPress={() => { - setSearch(''); - navigation.navigate('Search', {setSearch: setSearch}); + navigation.navigate('Search', {setSearch: setSearch, search: search}); }}>