|
@@ -2,13 +2,15 @@ import {
|
|
|
useEffect
|
|
useEffect
|
|
|
} from "react";
|
|
} from "react";
|
|
|
import {
|
|
import {
|
|
|
- Platform
|
|
|
|
|
|
|
+ Platform,
|
|
|
|
|
+ View
|
|
|
} from "react-native";
|
|
} from "react-native";
|
|
|
import type RootStackParamList from "./type";
|
|
import type RootStackParamList from "./type";
|
|
|
import {
|
|
import {
|
|
|
NCoreUIKitEmbeddedMenu,
|
|
NCoreUIKitEmbeddedMenu,
|
|
|
NCoreUIKitLocalize,
|
|
NCoreUIKitLocalize,
|
|
|
NCoreUIKitTheme,
|
|
NCoreUIKitTheme,
|
|
|
|
|
+ ThemeSwitcher,
|
|
|
MainHeader
|
|
MainHeader
|
|
|
} from "ncore-ui-kit";
|
|
} from "ncore-ui-kit";
|
|
|
import {
|
|
import {
|
|
@@ -23,23 +25,28 @@ import {
|
|
|
ComponentIcon,
|
|
ComponentIcon,
|
|
|
HomeIcon
|
|
HomeIcon
|
|
|
} from "lucide-react-native";
|
|
} from "lucide-react-native";
|
|
|
-import Home from "../pages/home";
|
|
|
|
|
|
|
+import ButtonPage from "../pages/button";
|
|
|
import TextPage from "../pages/text";
|
|
import TextPage from "../pages/text";
|
|
|
|
|
+import Home from "../pages/home";
|
|
|
|
|
|
|
|
const RootStack = createNativeStackNavigator();
|
|
const RootStack = createNativeStackNavigator();
|
|
|
const ComponentsStack = createNativeStackNavigator();
|
|
const ComponentsStack = createNativeStackNavigator();
|
|
|
|
|
|
|
|
const ComponentsNav = () => {
|
|
const ComponentsNav = () => {
|
|
|
return <ComponentsStack.Navigator
|
|
return <ComponentsStack.Navigator
|
|
|
- initialRouteName="TextPage"
|
|
|
|
|
|
|
+ initialRouteName="Text"
|
|
|
screenOptions={{
|
|
screenOptions={{
|
|
|
headerShown: true
|
|
headerShown: true
|
|
|
}}
|
|
}}
|
|
|
>
|
|
>
|
|
|
<ComponentsStack.Screen
|
|
<ComponentsStack.Screen
|
|
|
- name="TextPage"
|
|
|
|
|
|
|
+ name="Text"
|
|
|
component={TextPage}
|
|
component={TextPage}
|
|
|
/>
|
|
/>
|
|
|
|
|
+ <ComponentsStack.Screen
|
|
|
|
|
+ name="Button"
|
|
|
|
|
+ component={ButtonPage}
|
|
|
|
|
+ />
|
|
|
</ComponentsStack.Navigator>;
|
|
</ComponentsStack.Navigator>;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -88,8 +95,13 @@ const RootNav = () => {
|
|
|
subButtons: [
|
|
subButtons: [
|
|
|
{
|
|
{
|
|
|
redirectMain: "Components",
|
|
redirectMain: "Components",
|
|
|
- redirectSub: "TextPage",
|
|
|
|
|
|
|
+ redirectSub: "Text",
|
|
|
title: "Text"
|
|
title: "Text"
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ redirectMain: "Components",
|
|
|
|
|
+ redirectSub: "Button",
|
|
|
|
|
+ title: "Button"
|
|
|
}
|
|
}
|
|
|
]
|
|
]
|
|
|
}
|
|
}
|
|
@@ -99,16 +111,29 @@ const RootNav = () => {
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
NCoreUIKitEmbeddedMenu.addEventListener("state", updateStorage);
|
|
NCoreUIKitEmbeddedMenu.addEventListener("state", updateStorage);
|
|
|
|
|
+ NCoreUIKitTheme.addEventListener("state", updateThemeStorage);
|
|
|
}, []);
|
|
}, []);
|
|
|
|
|
|
|
|
const updateStorage = () => {
|
|
const updateStorage = () => {
|
|
|
- const data = NCoreUIKitEmbeddedMenu.state.data;
|
|
|
|
|
|
|
+ if(Platform.OS === "web") {
|
|
|
|
|
+ const data = NCoreUIKitEmbeddedMenu.state.data;
|
|
|
|
|
|
|
|
- if(Platform.OS === "web" && data && data.length) {
|
|
|
|
|
- const currentMenu = data.find(dI => dI.id === "main-menu");
|
|
|
|
|
|
|
+ if(data && data.length) {
|
|
|
|
|
+ const currentMenu = data.find(dI => dI.id === "main-menu");
|
|
|
|
|
|
|
|
- if(currentMenu) {
|
|
|
|
|
- window.localStorage.setItem("main-menu-status", String(currentMenu.isCollapse));
|
|
|
|
|
|
|
+ if(currentMenu) {
|
|
|
|
|
+ window.localStorage.setItem("main-menu-status", String(currentMenu.isCollapse));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ const updateThemeStorage = () => {
|
|
|
|
|
+ if(Platform.OS === "web") {
|
|
|
|
|
+ const themeData = NCoreUIKitTheme.state;
|
|
|
|
|
+
|
|
|
|
|
+ if(themeData) {
|
|
|
|
|
+ window.localStorage.setItem("theme", String(themeData));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
@@ -129,6 +154,17 @@ const RootNav = () => {
|
|
|
isWorkWithFlex1: true
|
|
isWorkWithFlex1: true
|
|
|
}}
|
|
}}
|
|
|
isWorkWithSticky={true}
|
|
isWorkWithSticky={true}
|
|
|
|
|
+ renderRight={() => {
|
|
|
|
|
+ return <View
|
|
|
|
|
+ style={{
|
|
|
|
|
+ justifyContent: "center",
|
|
|
|
|
+ flexDirection: "row",
|
|
|
|
|
+ alignItems: "center"
|
|
|
|
|
+ }}
|
|
|
|
|
+ >
|
|
|
|
|
+ <ThemeSwitcher/>
|
|
|
|
|
+ </View>;
|
|
|
|
|
+ }}
|
|
|
glassEffect={5}
|
|
glassEffect={5}
|
|
|
>
|
|
>
|
|
|
<NCoreUIKitEmbeddedMenu.Render
|
|
<NCoreUIKitEmbeddedMenu.Render
|
|
@@ -164,7 +200,8 @@ const Navigation = () => {
|
|
|
config: {
|
|
config: {
|
|
|
screens: {
|
|
screens: {
|
|
|
Home: "",
|
|
Home: "",
|
|
|
- TestSubPage: "text"
|
|
|
|
|
|
|
+ Text: "text",
|
|
|
|
|
+ button: "button"
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}}
|
|
}}
|