config.tsx 1.33 KB
import React from 'react'
import { StyleSheet, Platform } from 'react-native'
import { Colors } from 'react-native/Libraries/NewAppScreen'
import { CardStyleInterpolators } from '@react-navigation/stack'
import { setUnit } from '../libs/utils'
import { Icons } from '../assets/icons'


const headerStyle = {
    headerTitleAlign: 'center', // 文字居中
    headerStyle: {
        borderBottomColor: '#eee',
        borderBottomWidth: StyleSheet.hairlineWidth,
        backgroundColor: Colors.white,
        elevation: 0
    }, // 标题栏样式
    headerTintColor: '#262626', // 标题栏字体颜色
    headerTitleStyle: {
        fontSize: setUnit(38)
    },
    headerShown: false,
    headerBackImage: Platform.OS === 'ios' ? undefined : () => <Icons name="fanhui" size={setUnit(33)} color="#262626" />, // 标题栏返回图标
    headerBackTitleVisible: false,
    cardStyleInterpolator: CardStyleInterpolators.forHorizontalIOS, // 设置左右滑动
    gestureDirection: 'horizontal', // 初始化右滑手势配置
    gestureEnabled: true, // 启用右滑返回
    gestureResponseDistance: { horizontal: 20 }
}

const headerRightButton = StyleSheet.create({
    text: {
        fontWeight: '400',
        fontSize: setUnit(29),
        color: '#6c6c6c',
        paddingRight: setUnit(25)
    }
})

export { headerStyle, headerRightButton }