1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

Fix back button

Using customized component, need to get `navigation` from props instead of hooks
This commit is contained in:
Zhiyuan Zheng
2020-12-14 22:33:19 +01:00
parent 991741488d
commit 177afe1dd1
19 changed files with 98 additions and 80 deletions

View File

@ -5,13 +5,25 @@ import { Pressable, StyleSheet, Text } from 'react-native'
import { useTheme } from '@utils/styles/ThemeManager'
import { StyleConstants } from '@utils/styles/constants'
export interface Props {
type PropsBase = {
onPress: () => void
text?: string
}
export interface PropsText extends PropsBase {
text: string
icon?: any
}
const HeaderLeft: React.FC<Props> = ({ onPress, text, icon }) => {
export interface PropsIcon extends PropsBase {
text?: string
icon: any
}
const HeaderLeft: React.FC<PropsText | PropsIcon> = ({
onPress,
text,
icon
}) => {
const { theme } = useTheme()
return (
@ -21,7 +33,7 @@ const HeaderLeft: React.FC<Props> = ({ onPress, text, icon }) => {
styles.base,
{
backgroundColor: theme.backgroundGradientStart,
...(icon && { height: 44, width: 44 })
...(icon && { height: 44, width: 44, marginLeft: -9 })
}
]}
>