OrderScreen.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. import { Ionicons } from "@expo/vector-icons";
  2. import * as WebBrowser from "expo-web-browser";
  3. import * as React from "react";
  4. import { Dimensions } from "react-native";
  5. import { StyleSheet } from "react-native";
  6. import { useModel } from "flooks";
  7. import NavHeaderBar from "../components/NavHeaderBar";
  8. import OrderListScreen from "./OrderListScreen";
  9. import { Layout, Text } from "@ui-kitten/components";
  10. import LoadingNode from "../components/LoadingNode";
  11. import { createMaterialTopTabNavigator } from "@react-navigation/material-top-tabs";
  12. const Tab = createMaterialTopTabNavigator();
  13. const labelText = (focused, title) => (
  14. <Text category='s1' status={focused ? "primary" : ""}>
  15. {title}
  16. </Text>
  17. );
  18. export default function OrderScreen() {
  19. const { NOTRECEIVED, RECEIVED, REJECTED, COMPLETED, tab2 } = useModel(
  20. "wordsModel"
  21. );
  22. return (
  23. <>
  24. <NavHeaderBar title={tab2} />
  25. <Tab.Navigator
  26. initialRouteName='NOTRECEIVED'
  27. lazy={true}
  28. tabBarOptions={{
  29. activeTintColor: "#FFC21C",
  30. inactiveTintColor: "#000",
  31. style: styles.tabBack,
  32. indicatorStyle: styles.indicatorStyle,
  33. labelStyle: {
  34. zIndex: 2,
  35. },
  36. }}
  37. lazyPlaceholder={LoadingNode}
  38. >
  39. <Tab.Screen
  40. name='NOTRECEIVED'
  41. component={OrderListScreen}
  42. options={{
  43. tabBarLabel: ({ focused }) =>
  44. labelText(focused, NOTRECEIVED),
  45. }}
  46. />
  47. <Tab.Screen
  48. name='RECEIVED'
  49. component={OrderListScreen}
  50. options={{
  51. tabBarLabel: ({ focused }) =>
  52. labelText(focused, RECEIVED),
  53. }}
  54. />
  55. <Tab.Screen
  56. name='COMPLETED'
  57. component={OrderListScreen}
  58. options={{
  59. tabBarLabel: ({ focused }) =>
  60. labelText(focused, COMPLETED),
  61. }}
  62. />
  63. <Tab.Screen
  64. name='REJECTED'
  65. component={OrderListScreen}
  66. options={{
  67. tabBarLabel: ({ focused }) =>
  68. labelText(focused, REJECTED),
  69. }}
  70. />
  71. </Tab.Navigator>
  72. </>
  73. );
  74. }
  75. const styles = StyleSheet.create({
  76. tabBack: {
  77. backgroundColor: "#eee",
  78. },
  79. indicatorStyle: {
  80. backgroundColor: "#FFC21C",
  81. },
  82. });