Skip to content

Commit dc3e01c

Browse files
committed
move browse button to the right navigation header
1 parent 63e2892 commit dc3e01c

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

source/views/sis/course-search/search.tsx

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as c from '@frogpond/colors'
22
import {LoadingView, NoticeView} from '@frogpond/notice'
3+
import {SearchButton} from '@frogpond/navigation-buttons'
34
import {useNavigation} from '@react-navigation/native'
45
import {NativeStackNavigationOptions} from '@react-navigation/native-stack'
56
import {debounce, fromPairs} from 'lodash'
@@ -35,12 +36,15 @@ export const CourseSearchView = (): JSX.Element => {
3536
let [typedQuery, setTypedQuery] = React.useState('')
3637

3738
React.useLayoutEffect(() => {
38-
// TODO: refactor the SIS tabview to not be tabview in order to support search.
39-
// search will not be injected properly embedded inside of a tab navigator and
40-
// calling navigation.getParent() is not a solution because the parent is a tab
41-
// navigator so all top-level tabs here would receive a searchbar. For now we
42-
// can at least rely on the "browse all" button to let us view search.
4339
navigation.setOptions({
40+
headerRight: () => (
41+
<SearchButton
42+
onPress={() =>
43+
navigation.navigate('CourseSearchResults', {initialQuery: ''})
44+
}
45+
title="Browse"
46+
/>
47+
),
4448
headerSearchBarOptions: {
4549
barTintColor: c.quaternarySystemFill,
4650
onChangeText: (event: ChangeTextEvent) => {
@@ -63,10 +67,6 @@ export const CourseSearchView = (): JSX.Element => {
6367
})
6468
}, [showSearchResult, typedQuery])
6569

66-
let browseAll = () => {
67-
navigation.navigate('CourseSearchResults', {initialQuery: ''})
68-
}
69-
7070
let onRecentFilterPress = React.useCallback(
7171
(text: string) => {
7272
let selectedFilterCombo = recentFilters.find(
@@ -120,11 +120,9 @@ export const CourseSearchView = (): JSX.Element => {
120120
title="Recent"
121121
/>
122122
<RecentItemsList
123-
actionLabel="Browse All"
124123
emptyHeader="No recent filter combinations"
125124
emptyText="Your recent filter combinations will appear here."
126125
items={recentFilterDescriptions}
127-
onAction={browseAll}
128126
onItemPress={onRecentFilterPress}
129127
title="Browse"
130128
/>

0 commit comments

Comments
 (0)