|
|
@@ -1,10 +1,15 @@
|
|
|
import {
|
|
|
useEffect
|
|
|
} from "react";
|
|
|
+import {
|
|
|
+ Platform
|
|
|
+} from "react-native";
|
|
|
import type RootStackParamList from "./type";
|
|
|
import {
|
|
|
NCoreUIKitEmbeddedMenu,
|
|
|
- NCoreUIKitTheme
|
|
|
+ NCoreUIKitTheme,
|
|
|
+ MainHeader,
|
|
|
+ NCoreUIKitLocalize
|
|
|
} from "ncore-ui-kit";
|
|
|
import {
|
|
|
NavigationContainer,
|
|
|
@@ -18,8 +23,8 @@ import {
|
|
|
ComponentIcon,
|
|
|
HomeIcon
|
|
|
} from "lucide-react-native";
|
|
|
-import TextPage from "../pages/text";
|
|
|
import Home from "../pages/home";
|
|
|
+import TextPage from "../pages/text";
|
|
|
|
|
|
const RootStack = createNativeStackNavigator();
|
|
|
const ComponentsStack = createNativeStackNavigator();
|
|
|
@@ -40,22 +45,21 @@ const RootNav = () => {
|
|
|
colors
|
|
|
} = NCoreUIKitTheme.useContext();
|
|
|
|
|
|
+ const {
|
|
|
+ localize
|
|
|
+ } = NCoreUIKitLocalize.useContext();
|
|
|
+
|
|
|
const navigation = useNavigation<NativeStackNavigationProp<RootStackParamList>>();
|
|
|
|
|
|
useEffect(() => {
|
|
|
+ const currentMenuStatus = Platform.OS === "web" ? window.localStorage.getItem("main-menu-status") : "false";
|
|
|
+
|
|
|
NCoreUIKitEmbeddedMenu.load({
|
|
|
+ isCollapse: currentMenuStatus === "true" ? true : false,
|
|
|
+ isWorkWithSafeAreaView: false,
|
|
|
siteLogoProps: {
|
|
|
- imageUrl: "https://www.nibgat.com/assets/images/logo.png",
|
|
|
- onPress: () => {
|
|
|
- navigation.navigate("Home");
|
|
|
- },
|
|
|
- imageProps: {
|
|
|
- resizeMode: "stretch"
|
|
|
- },
|
|
|
- imageSpace: "spacingLg",
|
|
|
- isWorkWithAction: true,
|
|
|
- subTitle: "Core Tech",
|
|
|
- title: "NİBGAT® Deneme Anonim Ticaret Limited Şti."
|
|
|
+ isShowIcon: false,
|
|
|
+ title: localize("menu")
|
|
|
},
|
|
|
buttons: [
|
|
|
{
|
|
|
@@ -90,28 +94,59 @@ const RootNav = () => {
|
|
|
isAutoClosed: true,
|
|
|
id: "main-menu"
|
|
|
});
|
|
|
+
|
|
|
+ NCoreUIKitEmbeddedMenu.addEventListener("state", updateStorage);
|
|
|
}, []);
|
|
|
|
|
|
- return <NCoreUIKitEmbeddedMenu.Render
|
|
|
- navigation={navigation as unknown as NCoreUIKit.Navigation}
|
|
|
- id="main-menu"
|
|
|
+ const updateStorage = () => {
|
|
|
+ const data = NCoreUIKitEmbeddedMenu.state.data;
|
|
|
+
|
|
|
+ if(Platform.OS === "web" && data && data.length) {
|
|
|
+ const currentMenu = data.find(dI => dI.id === "main-menu");
|
|
|
+
|
|
|
+ if(currentMenu) {
|
|
|
+ window.localStorage.setItem("main-menu-status", String(currentMenu.isCollapse));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ return <MainHeader
|
|
|
+ isWorkWithSeperator={true}
|
|
|
+ siteLogoProps={{
|
|
|
+ imageUrl: "http://ncore.nibgat.space/assets/images/ncorelogo.png",
|
|
|
+ onPress: () => {
|
|
|
+ navigation.navigate("Home");
|
|
|
+ },
|
|
|
+ imageProps: {
|
|
|
+ resizeMode: "stretch"
|
|
|
+ },
|
|
|
+ subTitle: "Design System - UI Kit",
|
|
|
+ title: "NİBGAT® | NCore",
|
|
|
+ isWorkWithAction: true,
|
|
|
+ isWorkWithFlex1: true
|
|
|
+ }}
|
|
|
>
|
|
|
- <RootStack.Navigator
|
|
|
- initialRouteName="Home"
|
|
|
- screenOptions={{
|
|
|
- headerShown: false
|
|
|
- }}
|
|
|
+ <NCoreUIKitEmbeddedMenu.Render
|
|
|
+ navigation={navigation as unknown as NCoreUIKit.Navigation}
|
|
|
+ id="main-menu"
|
|
|
>
|
|
|
- <RootStack.Screen
|
|
|
- name="Home"
|
|
|
- component={Home}
|
|
|
- />
|
|
|
- <RootStack.Screen
|
|
|
- name="Components"
|
|
|
- component={ComponentsNav}
|
|
|
- />
|
|
|
- </RootStack.Navigator>
|
|
|
- </NCoreUIKitEmbeddedMenu.Render>;
|
|
|
+ <RootStack.Navigator
|
|
|
+ initialRouteName="Home"
|
|
|
+ screenOptions={{
|
|
|
+ headerShown: false
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <RootStack.Screen
|
|
|
+ name="Home"
|
|
|
+ component={Home}
|
|
|
+ />
|
|
|
+ <RootStack.Screen
|
|
|
+ name="Components"
|
|
|
+ component={ComponentsNav}
|
|
|
+ />
|
|
|
+ </RootStack.Navigator>
|
|
|
+ </NCoreUIKitEmbeddedMenu.Render>
|
|
|
+ </MainHeader>;
|
|
|
};
|
|
|
|
|
|
const Navigation = () => {
|