about summary refs log tree commit diff
path: root/src/view/screens/Search.web.tsx
diff options
context:
space:
mode:
authorJohn Fawcett <jrf0110@gmail.com>2023-04-12 20:27:55 -0500
committerGitHub <noreply@github.com>2023-04-12 18:27:55 -0700
commitf6769b283fe83d7abbc0545077b3dca978184eed (patch)
treefab3973591fd0514d290de18f37280baca5563f9 /src/view/screens/Search.web.tsx
parent2fed6c402159c6084dd481ab87c5e8b034e910ac (diff)
downloadvoidsky-f6769b283fe83d7abbc0545077b3dca978184eed.tar.zst
Mobile Web (#427)
* WIP

* WIP

* Fix header offset on web

* Remove debug

* Fix web mobile feed and FAB layout

* Fix modals on mobile web

* Remove dead code

* Remove ios config that shouldnt be committed now

* Move bottom bar into its own folder

* Fix web drawer navigation and state behaviors

* Remove dark mode toggle from web drawer for now

* Fix search on mobile web

* Fix the logged out splash screen on mobile web

* Fixes to detox simulator

---------

Co-authored-by: Paul Frazee <pfrazee@gmail.com>
Diffstat (limited to 'src/view/screens/Search.web.tsx')
-rw-r--r--src/view/screens/Search.web.tsx21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/view/screens/Search.web.tsx b/src/view/screens/Search.web.tsx
index d12cbc1be..92df1d920 100644
--- a/src/view/screens/Search.web.tsx
+++ b/src/view/screens/Search.web.tsx
@@ -15,12 +15,15 @@ import {
 import {useStores} from 'state/index'
 import {s} from 'lib/styles'
 import {usePalette} from 'lib/hooks/usePalette'
+import * as Mobile from './SearchMobile'
+import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries'
 
 type Props = NativeStackScreenProps<SearchTabNavigatorParams, 'Search'>
 export const SearchScreen = withAuthRequired(
-  observer(({route}: Props) => {
+  observer(({navigation, route}: Props) => {
     const pal = usePalette('default')
     const store = useStores()
+    const params = route.params || {}
     const foafs = React.useMemo<FoafsModel>(
       () => new FoafsModel(store),
       [store],
@@ -30,13 +33,13 @@ export const SearchScreen = withAuthRequired(
       [store],
     )
     const searchUIModel = React.useMemo<SearchUIModel | undefined>(
-      () => (route.params.q ? new SearchUIModel(store) : undefined),
-      [route.params.q, store],
+      () => (params.q ? new SearchUIModel(store) : undefined),
+      [params.q, store],
     )
 
     React.useEffect(() => {
-      if (route.params.q && searchUIModel) {
-        searchUIModel.fetch(route.params.q)
+      if (params.q && searchUIModel) {
+        searchUIModel.fetch(params.q)
       }
       if (!foafs.hasData) {
         foafs.fetch()
@@ -44,12 +47,18 @@ export const SearchScreen = withAuthRequired(
       if (!suggestedActors.hasLoaded) {
         suggestedActors.loadMore(true)
       }
-    }, [foafs, suggestedActors, searchUIModel, route.params.q])
+    }, [foafs, suggestedActors, searchUIModel, params.q])
 
     if (searchUIModel) {
       return <SearchResults model={searchUIModel} />
     }
 
+    const {isDesktop} = useWebMediaQueries()
+
+    if (!isDesktop) {
+      return <Mobile.SearchScreen navigation={navigation} route={route} />
+    }
+
     return (
       <ScrollView
         testID="searchScrollView"