Fix header buttons

This commit is contained in:
Zhiyuan Zheng 2021-03-22 00:25:53 +01:00
parent 544af1936c
commit 6da2f545f6
No known key found for this signature in database
GPG Key ID: 078A93AB607D85E0
4 changed files with 34 additions and 13 deletions

View File

@ -8,6 +8,7 @@ export interface Props {
type?: 'icon' | 'text'
content?: string
native?: boolean
background?: boolean
onPress: () => void
}
@ -16,6 +17,7 @@ const HeaderLeft: React.FC<Props> = ({
type = 'icon',
content,
native = true,
background = false,
onPress
}) => {
const { theme } = useTheme()
@ -47,11 +49,19 @@ const HeaderLeft: React.FC<Props> = ({
style={[
styles.base,
{
backgroundColor: theme.backgroundOverlayDefault,
backgroundColor: background
? theme.backgroundOverlayDefault
: undefined,
minHeight: 44,
minWidth: 44,
marginLeft: native
? -StyleConstants.Spacing.S
: StyleConstants.Spacing.S,
...(type === 'icon' && {
height: 44,
width: 44,
marginLeft: native ? -9 : 9
borderRadius: 100
}),
...(type === 'text' && {
paddingHorizontal: StyleConstants.Spacing.S
})
}
]}
@ -63,8 +73,7 @@ const styles = StyleSheet.create({
base: {
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
borderRadius: 100
alignItems: 'center'
},
text: {
...StyleConstants.FontStyle.M

View File

@ -9,6 +9,7 @@ export interface Props {
type?: 'icon' | 'text'
content: string
native?: boolean
background?: boolean
loading?: boolean
disabled?: boolean
@ -20,6 +21,7 @@ const HeaderRight: React.FC<Props> = ({
type = 'icon',
content,
native = true,
background = false,
loading,
disabled,
onPress
@ -79,11 +81,19 @@ const HeaderRight: React.FC<Props> = ({
style={[
styles.base,
{
backgroundColor: theme.backgroundOverlayDefault,
backgroundColor: background
? theme.backgroundOverlayDefault
: undefined,
minHeight: 44,
minWidth: 44,
marginLeft: native
? -StyleConstants.Spacing.S
: StyleConstants.Spacing.S,
...(type === 'icon' && {
height: 44,
width: 44,
marginRight: native ? -9 : 9
borderRadius: 100
}),
...(type === 'text' && {
paddingHorizontal: StyleConstants.Spacing.S
})
}
]}
@ -95,8 +105,7 @@ const styles = StyleSheet.create({
base: {
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
borderRadius: 100
alignItems: 'center'
},
text: {
...StyleConstants.FontStyle.M

View File

@ -49,6 +49,7 @@ const TabSharedAccount: React.FC<SharedAccountProp> = ({
account
})
}}
background
/>
)
})

View File

@ -74,7 +74,9 @@ const sharedScreens = (
backgroundColor: `rgba(255, 255, 255, 0)`
},
headerCenter: () => null,
headerLeft: () => <HeaderLeft onPress={() => navigation.goBack()} />
headerLeft: () => (
<HeaderLeft onPress={() => navigation.goBack()} background />
)
}
}}
/>,