GuideHeaderBar.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import React from "react";
  2. import { Layout, useTheme, Text } from "@ui-kitten/components";
  3. import { useModel } from "flooks";
  4. import { Image, StyleSheet } from "react-native";
  5. const styles = StyleSheet.create({
  6. container: {
  7. height: 70,
  8. flexDirection: "row",
  9. paddingVertical: 10,
  10. paddingHorizontal: 65,
  11. alignItems: "center",
  12. justifyContent: "center",
  13. },
  14. icon: { width: 49, height: 49, position: "absolute", left: 15, top: 10 },
  15. text: {
  16. color: "#fff",
  17. },
  18. });
  19. const img1 = require("../assets/images/logo_bai.png");
  20. export default function GuideHeaderBar() {
  21. const theme = useTheme();
  22. const { registerInfo, showName, mid } = useModel("userModel");
  23. const title = React.useMemo(() => {
  24. if (mid) {
  25. return showName;
  26. }
  27. return registerInfo ? registerInfo.showName : "";
  28. }, [showName, registerInfo]);
  29. return (
  30. <Layout
  31. style={[
  32. styles.container,
  33. { backgroundColor: theme["color-primary-500"] },
  34. ]}
  35. >
  36. <Image source={img1} style={styles.icon} />
  37. <Text style={styles.text} category="h6">
  38. {title}
  39. </Text>
  40. </Layout>
  41. );
  42. }