|
@@ -1,7 +1,9 @@
|
|
|
import {
|
|
import {
|
|
|
- type ReactNode,
|
|
|
|
|
- Fragment
|
|
|
|
|
|
|
+ type ReactNode
|
|
|
} from "react";
|
|
} from "react";
|
|
|
|
|
+import {
|
|
|
|
|
+ View
|
|
|
|
|
+} from "react-native";
|
|
|
import {
|
|
import {
|
|
|
type EmbeddedMenuContextType,
|
|
type EmbeddedMenuContextType,
|
|
|
type EmbeddedMenuDataType
|
|
type EmbeddedMenuDataType
|
|
@@ -9,10 +11,10 @@ import {
|
|
|
import NCoreContext, {
|
|
import NCoreContext, {
|
|
|
type ConfigType
|
|
type ConfigType
|
|
|
} from "ncore-context";
|
|
} from "ncore-context";
|
|
|
|
|
+import EmbeddedMenu from "../components/embeddedMenu";
|
|
|
import {
|
|
import {
|
|
|
uuid
|
|
uuid
|
|
|
} from "../utils";
|
|
} from "../utils";
|
|
|
-import EmbeddedMenu from "../components/embeddedMenu";
|
|
|
|
|
|
|
|
|
|
class NCoreUIKitEmbeddedMenu extends NCoreContext<EmbeddedMenuContextType, ConfigType<EmbeddedMenuContextType>> {
|
|
class NCoreUIKitEmbeddedMenu extends NCoreContext<EmbeddedMenuContextType, ConfigType<EmbeddedMenuContextType>> {
|
|
|
constructor({
|
|
constructor({
|
|
@@ -212,6 +214,41 @@ class NCoreUIKitEmbeddedMenu extends NCoreContext<EmbeddedMenuContextType, Confi
|
|
|
data
|
|
data
|
|
|
} = this.useContext();
|
|
} = this.useContext();
|
|
|
|
|
|
|
|
|
|
+ const renderMenu = ({
|
|
|
|
|
+ currentMenu
|
|
|
|
|
+ }: {
|
|
|
|
|
+ currentMenu: EmbeddedMenuDataType;
|
|
|
|
|
+ }) => {
|
|
|
|
|
+ return <EmbeddedMenu
|
|
|
|
|
+ {...currentMenu}
|
|
|
|
|
+ key={`NCoreUIKit-Menu-${currentMenu.id}`}
|
|
|
|
|
+ id={currentMenu.id as string}
|
|
|
|
|
+ close={() => {
|
|
|
|
|
+ if(currentMenu.isAutoClosed) {
|
|
|
|
|
+ this.close({
|
|
|
|
|
+ id: currentMenu.id,
|
|
|
|
|
+ index: index
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ }}
|
|
|
|
|
+ onClosed={() => {
|
|
|
|
|
+ if(currentMenu.onClosed) {
|
|
|
|
|
+ currentMenu.onClosed({
|
|
|
|
|
+ id: currentMenu.id
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if(currentMenu.isAutoClosedOnClosed === undefined || currentMenu.isAutoClosedOnClosed === true) {
|
|
|
|
|
+ this.close({
|
|
|
|
|
+ id: currentMenu.id,
|
|
|
|
|
+ index: index
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ }}
|
|
|
|
|
+ navigation={navigation}
|
|
|
|
|
+ />;
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
if(id || index) {
|
|
if(id || index) {
|
|
|
const currentMenu = data.find((dItem, dIndex) => {
|
|
const currentMenu = data.find((dItem, dIndex) => {
|
|
|
if(id) {
|
|
if(id) {
|
|
@@ -225,38 +262,25 @@ class NCoreUIKitEmbeddedMenu extends NCoreContext<EmbeddedMenuContextType, Confi
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- return <Fragment>
|
|
|
|
|
- <EmbeddedMenu
|
|
|
|
|
- {...currentMenu}
|
|
|
|
|
- key={`NCoreUIKit-Menu-${currentMenu.id}`}
|
|
|
|
|
- id={currentMenu.id as string}
|
|
|
|
|
- close={() => {
|
|
|
|
|
- if(currentMenu.isAutoClosed) {
|
|
|
|
|
- this.close({
|
|
|
|
|
- id: currentMenu.id,
|
|
|
|
|
- index: index
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- }}
|
|
|
|
|
- onClosed={() => {
|
|
|
|
|
- if(currentMenu.onClosed) {
|
|
|
|
|
- currentMenu.onClosed({
|
|
|
|
|
- id: currentMenu.id
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ if(children) {
|
|
|
|
|
+ return <View
|
|
|
|
|
+ style={[
|
|
|
|
|
+ {
|
|
|
|
|
+ flexDirection: "row",
|
|
|
|
|
+ flex: 1
|
|
|
}
|
|
}
|
|
|
|
|
+ ]}
|
|
|
|
|
+ >
|
|
|
|
|
+ {renderMenu({
|
|
|
|
|
+ currentMenu
|
|
|
|
|
+ })}
|
|
|
|
|
+ {children}
|
|
|
|
|
+ </View>;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- if(currentMenu.isAutoClosedOnClosed === undefined || currentMenu.isAutoClosedOnClosed === true) {
|
|
|
|
|
- console.log("yok bana geldi dayı ?");
|
|
|
|
|
- this.close({
|
|
|
|
|
- id: currentMenu.id,
|
|
|
|
|
- index: index
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- }}
|
|
|
|
|
- navigation={navigation}
|
|
|
|
|
- />
|
|
|
|
|
- {children}
|
|
|
|
|
- </Fragment>;
|
|
|
|
|
|
|
+ return renderMenu({
|
|
|
|
|
+ currentMenu
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
return null;
|