| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- /* eslint-disable react/style-prop-object */
- import * as React from 'react';
- import { View } from 'react-native';
- import { StatusBar } from 'expo-status-bar';
- import { Appbar, Menu } from 'react-native-paper';
- import { useTranslation } from 'react-i18next';
- import { useBoolean, useCreation } from '@umijs/hooks';
- import { goBack, navigate } from '../../navigation/RootNavigation';
- export default function Header({ title, noBack, bg, hasRight, orderId }) {
- const { t } = useTranslation();
- const { state, setTrue, setFalse } = useBoolean(false);
- return (
- <>
- <StatusBar
- backgroundColor={bg || '#FFC21C'}
- style={!bg || bg === '#FFC21C' ? 'light' : 'dark'}
- translucent
- />
- <Appbar.Header
- dark={!bg || bg === '#FFC21C'}
- style={{
- zIndex: 3,
- elevation: 0,
- shadowOffset: {
- width: 0,
- height: 0,
- },
- shadowOpacity: 0,
- }}
- theme={{ colors: { primary: bg || '#FFC21C' } }}
- >
- {!noBack && <Appbar.BackAction onPress={goBack} />}
- <Appbar.Content
- title={title || t('wo-de-ding-dan')}
- titleStyle={{ textAlign: 'center', fontSize: 16 }}
- />
- {!noBack && !hasRight && (
- <Appbar.Action
- icon={() => <View style={{ width: 24, height: 24 }} />}
- />
- )}
- {hasRight && (
- <Menu
- visible={state}
- onDismiss={setFalse}
- anchor={<Appbar.Action icon="dots-vertical" onPress={setTrue} />}
- >
- <Menu.Item
- onPress={() => {
- setFalse();
- navigate('ApplayCancel', {
- orderId,
- });
- }}
- title={t('qu-xiao-ding-dan')}
- />
- </Menu>
- )}
- </Appbar.Header>
- </>
- );
- }
|