index.tsx 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. import {
  2. useEffect
  3. } from "react";
  4. import {
  5. View
  6. } from "react-native";
  7. import type RootStackParamList from "./type";
  8. import stylesheet from "./stylesheet";
  9. import {
  10. NCoreUIKitEmbeddedMenu,
  11. NCoreUIKitTheme
  12. } from "ncore-ui-kit";
  13. import {
  14. NavigationContainer,
  15. useNavigation
  16. } from "@react-navigation/native";
  17. import {
  18. type NativeStackNavigationProp,
  19. createNativeStackNavigator
  20. } from "@react-navigation/native-stack";
  21. import {
  22. HomeIcon
  23. } from "lucide-react-native";
  24. import Home from "../pages/home";
  25. import TextPage from "../pages/text";
  26. const RootStack = createNativeStackNavigator();
  27. const RootNav = () => {
  28. const {
  29. colors
  30. } = NCoreUIKitTheme.useContext();
  31. const navigation = useNavigation<NativeStackNavigationProp<RootStackParamList>>();
  32. useEffect(() => {
  33. NCoreUIKitEmbeddedMenu.load({
  34. siteLogoProps: {
  35. imageUrl: "https://www.nibgat.com/assets/images/logo.png",
  36. onPress: () => {
  37. navigation.navigate("Home");
  38. },
  39. imageProps: {
  40. resizeMode: "stretch"
  41. },
  42. imageSpace: "spacingLg",
  43. isWorkWithAction: true,
  44. subTitle: "Core Tech",
  45. title: "NİBGAT® Deneme Anonim Ticaret Limited Şti."
  46. },
  47. buttons: [
  48. {
  49. redirectMain: "Home",
  50. title: "Ana Sayfa",
  51. icon: ({
  52. color
  53. }) => <HomeIcon
  54. color={colors.content.icon[color]}
  55. />
  56. },
  57. {
  58. redirectMain: "Home",
  59. isCollapsible: true,
  60. title: "Ana Sayfa",
  61. icon: ({
  62. color
  63. }) => <HomeIcon
  64. color={colors.content.icon[color]}
  65. />,
  66. subButtons: [
  67. {
  68. title: "Text",
  69. redirectMain: "TextPage"
  70. }
  71. ]
  72. },
  73. {
  74. redirectMain: "Text",
  75. isCollapsible: true,
  76. title: "Deneme",
  77. icon: ({
  78. color
  79. }) => <HomeIcon
  80. color={colors.content.icon[color]}
  81. />,
  82. subButtons: [
  83. {
  84. title: "Noliii",
  85. redirectMain: "Home"
  86. }
  87. ]
  88. },
  89. {
  90. title: "Text",
  91. redirectMain: "TextPage"
  92. }
  93. ],
  94. id: "main-menu"
  95. });
  96. }, []);
  97. return <View
  98. style={[
  99. stylesheet.container
  100. ]}
  101. >
  102. <NCoreUIKitEmbeddedMenu.Render
  103. navigation={navigation as unknown as NCoreUIKit.Navigation}
  104. id="main-menu"
  105. />
  106. <RootStack.Navigator
  107. initialRouteName="Home"
  108. >
  109. <RootStack.Screen
  110. name="Home"
  111. component={Home}
  112. />
  113. <RootStack.Screen
  114. name="TextPage"
  115. component={TextPage}
  116. />
  117. </RootStack.Navigator>
  118. </View>;
  119. };
  120. const Navigation = () => {
  121. return <NavigationContainer
  122. linking={{
  123. prefixes: [
  124. "http://localhost:3000",
  125. "https://ncore.nibgat.space"
  126. ],
  127. config: {
  128. screens: {
  129. Home: "",
  130. TestSubPage: "text"
  131. }
  132. }
  133. }}
  134. >
  135. <RootNav/>
  136. </NavigationContainer>;
  137. };
  138. export default Navigation;