1
0
mirror of https://github.com/tooot-app/app synced 2025-04-25 15:38:42 +02:00

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

View File

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

View File

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

View File

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