[APP-674] Fix search results tab bar (#822)
* fix search results tab bar * Fix spacing on web --------- Co-authored-by: Paul Frazee <pfrazee@gmail.com>zio/stable
parent
49840f3a27
commit
54e5e30945
|
@ -14,6 +14,7 @@ import {
|
||||||
import {Text} from 'view/com/util/text/Text'
|
import {Text} from 'view/com/util/text/Text'
|
||||||
import {usePalette} from 'lib/hooks/usePalette'
|
import {usePalette} from 'lib/hooks/usePalette'
|
||||||
import {s} from 'lib/styles'
|
import {s} from 'lib/styles'
|
||||||
|
import {isDesktopWeb} from 'platform/detection'
|
||||||
|
|
||||||
const SECTIONS = ['Posts', 'Users']
|
const SECTIONS = ['Posts', 'Users']
|
||||||
|
|
||||||
|
@ -24,7 +25,12 @@ export const SearchResults = observer(({model}: {model: SearchUIModel}) => {
|
||||||
(props: RenderTabBarFnProps) => {
|
(props: RenderTabBarFnProps) => {
|
||||||
return (
|
return (
|
||||||
<CenteredView style={[pal.border, styles.tabBar]}>
|
<CenteredView style={[pal.border, styles.tabBar]}>
|
||||||
<TabBar {...props} items={SECTIONS} />
|
<TabBar
|
||||||
|
items={SECTIONS}
|
||||||
|
{...props}
|
||||||
|
key={SECTIONS.join()}
|
||||||
|
indicatorColor={pal.colors.link}
|
||||||
|
/>
|
||||||
</CenteredView>
|
</CenteredView>
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
@ -33,8 +39,12 @@ export const SearchResults = observer(({model}: {model: SearchUIModel}) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Pager renderTabBar={renderTabBar} tabBarPosition="top" initialPage={0}>
|
<Pager renderTabBar={renderTabBar} tabBarPosition="top" initialPage={0}>
|
||||||
<PostResults key="0" model={model} />
|
<View style={[styles.results]}>
|
||||||
<Profiles key="1" model={model} />
|
<PostResults key="0" model={model} />
|
||||||
|
</View>
|
||||||
|
<View style={[styles.results]}>
|
||||||
|
<Profiles key="1" model={model} />
|
||||||
|
</View>
|
||||||
</Pager>
|
</Pager>
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -60,7 +70,7 @@ const PostResults = observer(({model}: {model: SearchUIModel}) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ScrollView style={pal.view}>
|
<ScrollView style={[pal.view]}>
|
||||||
{model.posts.map(post => (
|
{model.posts.map(post => (
|
||||||
<Post
|
<Post
|
||||||
key={post.resolvedUri}
|
key={post.resolvedUri}
|
||||||
|
@ -111,9 +121,20 @@ const Profiles = observer(({model}: {model: SearchUIModel}) => {
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
tabBar: {
|
tabBar: {
|
||||||
borderBottomWidth: 1,
|
borderBottomWidth: 1,
|
||||||
|
position: 'absolute',
|
||||||
|
zIndex: 1,
|
||||||
|
left: 0,
|
||||||
|
right: 0,
|
||||||
|
top: 0,
|
||||||
|
flexDirection: 'column',
|
||||||
|
alignItems: 'center',
|
||||||
|
backgroundColor: 'white',
|
||||||
},
|
},
|
||||||
empty: {
|
empty: {
|
||||||
paddingHorizontal: 14,
|
paddingHorizontal: 14,
|
||||||
paddingVertical: 16,
|
paddingVertical: 16,
|
||||||
},
|
},
|
||||||
|
results: {
|
||||||
|
paddingTop: isDesktopWeb ? 50 : 42,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue