From 135628baf27bc3517b47e1f976a0851a1fc99d98 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Tue, 13 Dec 2022 15:35:45 -0600 Subject: [PATCH] Use avatar in viewheader when cant go back --- src/view/com/util/ViewHeader.tsx | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/src/view/com/util/ViewHeader.tsx b/src/view/com/util/ViewHeader.tsx index 2f0e5043..76fac8b9 100644 --- a/src/view/com/util/ViewHeader.tsx +++ b/src/view/com/util/ViewHeader.tsx @@ -8,6 +8,7 @@ import { View, } from 'react-native' import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' +import {UserAvatar} from './UserAvatar' import {s, colors} from '../../lib/styles' import {MagnifyingGlassIcon} from '../../lib/icons' import {useStores} from '../../../state' @@ -18,10 +19,12 @@ const BACK_HITSLOP = {left: 10, top: 10, right: 30, bottom: 10} export const ViewHeader = observer(function ViewHeader({ title, subtitle, + canGoBack, onPost, }: { title: string subtitle?: string + canGoBack?: boolean onPost?: () => void }) { const store = useStores() @@ -43,19 +46,28 @@ export const ViewHeader = observer(function ViewHeader({ console.log(e) }) } - const canGoBack = store.nav.tab.canGoBack + canGoBack ??= store.nav.tab.canGoBack return ( <> - + style={canGoBack ? styles.backIcon : styles.backIconWide}> + {canGoBack ? ( + + ) : ( + + )} {title} @@ -151,6 +163,7 @@ const styles = StyleSheet.create({ }, backIcon: {width: 30, height: 30}, + backIconWide: {width: 40, height: 30}, btn: { flexDirection: 'row', alignItems: 'center',