import React, { Component } from 'react' import { View, Text, StyleSheet, TouchableOpacity, Image, StyleProp, ViewStyle } from 'react-native'; import { px2dp, onePx, size, statusBarHeight, isIos, colors, myConfirm, useDebounce, toast } from './../../utils/base'; import { back, navigate } from './../../NavigationService'; interface Props { rightComponent?: any; title?: string; blod?: boolean; noBoder?: boolean; style?: StyleProp | undefined; mode?: 'dark' | 'light'; useCancelText?: boolean; }; export interface State { } export default class Header extends React.Component { constructor(props: Props | Readonly) { super(props); } componentDidMount() { } componentWillUnmount() { } public readonly state: Readonly = { } goBack = () => { back(); }; jumpMessage = () => { navigate('MineMessage') }; confirmBack = () => { let confirmData = { title: '确认取消编辑?系统将不会保留您的更改', confirmText: '确认', confirmFun: this.goBack() }; myConfirm(confirmData) }; render() { let { noBoder, useCancelText, mode, blod, title, rightComponent, style } = this.props; return ( { useCancelText ? 取消 : { isIos() ? : } } {title ? title : ""} {rightComponent && rightComponent()} ) } } const styles = StyleSheet.create({ headerContainer: { width: '100%', height: size.head_height, paddingHorizontal: px2dp(12.5), // paddingTop: statusBarHeight, flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', backgroundColor: '#fff', // backgroundColor: "red", zIndex: 99, // position: "absolute" }, sideContainer: { width: px2dp(100), flexDirection: 'row', height: size.head_height, alignItems: 'center', justifyContent: 'flex-start', // backgroundColor: 'red' }, backPress: { height: size.head_height, // paddingHorizontal: px2dp(12), justifyContent: 'center', alignItems: 'center' }, headerTitle: { fontSize: 17, color: '#000', fontWeight: '500', maxWidth: px2dp(150), textAlign: 'center' }, headerIcon: { width: px2dp(20), height: px2dp(20), tintColor: '#000' }, messageBox: { paddingHorizontal: px2dp(12), position: 'relative', marginTop: px2dp(-3) }, messageIcon: { width: px2dp(24), height: px2dp(24), }, messageNumBox: { position: 'absolute', top: px2dp(-2), right: px2dp(10), width: px2dp(18), height: px2dp(14), backgroundColor: colors.red, zIndex: 999, borderRadius: px2dp(8), justifyContent: 'center', alignItems: 'center' }, messageNum: { fontSize: 8, color: '#fff', opacity: 0.9 }, })