Header.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /* eslint-disable react/style-prop-object */
  2. import * as React from 'react';
  3. import { View } from 'react-native';
  4. import { StatusBar } from 'expo-status-bar';
  5. import { Appbar } from 'react-native-paper';
  6. import { goBack } from '../../navigation/RootNavigation';
  7. export default function Header({ title, noBack, bg }) {
  8. return (
  9. <>
  10. <StatusBar backgroundColor={bg || '#FFC21C'} style="light" translucent />
  11. <Appbar.Header
  12. dark
  13. style={{
  14. zIndex: 3,
  15. elevation: 0,
  16. shadowOffset: {
  17. width: 0,
  18. height: 0,
  19. },
  20. shadowOpacity: 0,
  21. }}
  22. theme={{ colors: { primary: bg || '#FFC21C' } }}
  23. >
  24. {!noBack && <Appbar.BackAction onPress={goBack} />}
  25. <Appbar.Content
  26. title={title || '我的订单'}
  27. titleStyle={{ textAlign: 'center', fontSize: 16 }}
  28. />
  29. {!noBack && (
  30. <Appbar.Action
  31. icon={() => <View style={{ width: 24, height: 24 }} />}
  32. />
  33. )}
  34. </Appbar.Header>
  35. </>
  36. );
  37. }