DetailHeader.jsx 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /* eslint-disable react/style-prop-object */
  2. import * as React from 'react';
  3. import { StyleSheet, View } from 'react-native';
  4. import { StatusBar } from 'expo-status-bar';
  5. import { Appbar } from 'react-native-paper';
  6. import { Div, Button } from 'react-native-magnus';
  7. import { goBack, navigate, replace } from '../../navigation/RootNavigation';
  8. export default function DetailHeader({ noRight, type, noTab }) {
  9. return (
  10. <>
  11. <StatusBar style="light" backgroundColor="transparent" translucent />
  12. <View style={[noTab && styles.view]}>
  13. <Appbar.Header
  14. dark
  15. style={styles.header}
  16. theme={{
  17. colors: { primary: noTab ? 'transparent' : 'rgba(255,194,28,1)' },
  18. }}
  19. >
  20. <Appbar.BackAction onPress={goBack} />
  21. <Appbar.Content />
  22. {!noRight && <Appbar.Action icon="magnify" />}
  23. {!noRight && <Appbar.Action icon="share-variant" />}
  24. </Appbar.Header>
  25. </View>
  26. {!noTab && (
  27. <Div row bg="gray200">
  28. <Button
  29. flex={1}
  30. bg="hide"
  31. color="gray600"
  32. h={60}
  33. onPress={() => navigate('MerchantDetail')}
  34. >
  35. 订单
  36. </Button>
  37. <Button
  38. flex={1}
  39. bg="hide"
  40. color={type === 'comment' ? 'brand500' : 'gray600'}
  41. h={60}
  42. onPress={() => replace('MerchantDetailComment')}
  43. >
  44. 评论
  45. </Button>
  46. <Button
  47. flex={1}
  48. bg="hide"
  49. color={type === 'merchat' ? 'brand500' : 'gray600'}
  50. h={60}
  51. onPress={() => replace('MerchantDetailMerchant')}
  52. >
  53. 商家
  54. </Button>
  55. </Div>
  56. )}
  57. </>
  58. );
  59. }
  60. const styles = StyleSheet.create({
  61. header: {
  62. elevation: 0,
  63. shadowOffset: {
  64. width: 0,
  65. height: 0,
  66. },
  67. shadowOpacity: 0,
  68. },
  69. view: {
  70. // backgroundColor: 'rgb(242, 242, 242)',
  71. position: 'absolute',
  72. top: 0,
  73. left: 0,
  74. right: 0,
  75. zIndex: 2,
  76. },
  77. });