Skip to content

Commit

Permalink
[KAN-146] 검색 페이지로 넘어갈때 검색 키워드를 그대로 가져가도록 한다. (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
sinkyoungdeok authored Jun 1, 2024
1 parent 668919d commit 415c608
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
9 changes: 9 additions & 0 deletions src/screens/detail/SearchScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}, []);
Expand Down
8 changes: 4 additions & 4 deletions src/screens/list/ListMainScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -285,8 +286,7 @@ export default function ListMainScreen() {
justifyContent: 'center',
}}
onPress={() => {
setSearch('');
navigation.navigate('Search', {setSearch: setSearch});
navigation.navigate('Search', {setSearch: setSearch, search: search});
}}>
<View
style={{
Expand Down Expand Up @@ -799,9 +799,9 @@ const styles = StyleSheet.create({
marginLeft: 10,
flex: 1,
fontSize: 13,
color: '#888888',
color: COLOR_TEXT_BLACK,
padding: 0,
fontFamily: 'NanumSquareRoundB',
fontFamily: 'NanumSquareRoundEB',
},
filterButton: {
flexDirection: 'row',
Expand Down

0 comments on commit 415c608

Please sign in to comment.