ソースを参照

Bugfix: Menu background problems fixed.

lfabl 3 週間 前
コミット
cc123af66c

+ 2 - 0
src/components/menu/index.tsx

@@ -47,6 +47,7 @@ const Menu: RefForwardingComponent<IMenuRef, IMenuProps> = ({
     renderHeader: RenderHeader,
     renderFooter: RenderFooter,
     portalName = "menu-system",
+    customBackgroundColorKey,
     isWorkWithPortal = true,
     isWorkWithModal = true,
     customBackgroundColor,
@@ -80,6 +81,7 @@ const Menu: RefForwardingComponent<IMenuRef, IMenuProps> = ({
         seperator: seperatorDynamicStyle,
         container: containerDynamicStyle
     } = useStyles({
+        customBackgroundColorKey,
         customBackgroundColor,
         glassEffect,
         colors,

+ 10 - 1
src/components/menu/stylesheet.ts

@@ -53,6 +53,7 @@ const stylesheet = StyleSheet.create({
 });
 
 export const useStyles = ({
+    customBackgroundColorKey,
     customBackgroundColor,
     glassEffect,
     colors,
@@ -60,7 +61,7 @@ export const useStyles = ({
 }: MenuDynamicStyle) => {
     const styles = {
         container: {
-            backgroundColor: customBackgroundColor ? customBackgroundColor : colors.content.container.default,
+            backgroundColor: colors.content.container.default,
             ...webStyle({
                 WebkitBackdropFilter: `blur(${glassEffect}px)`,
                 backdropFilter: `blur(${glassEffect}px)`
@@ -75,6 +76,14 @@ export const useStyles = ({
         } as Mutable<ViewStyle>
     };
 
+    if(customBackgroundColor) {
+        styles.container.backgroundColor = customBackgroundColor;
+    }
+
+    if(customBackgroundColorKey) {
+        styles.container.backgroundColor = colors.project[customBackgroundColorKey];
+    }
+
     return styles;
 };
 

+ 2 - 0
src/components/menu/type.ts

@@ -21,6 +21,7 @@ export type IMenuRef = {
 };
 
 export type MenuDynamicStyle = {
+    customBackgroundColorKey?: keyof NCoreUIKit.ProjectColorPalette;
     spaces: NCoreUIKit.ActivePalette["spaces"];
     colors: NCoreUIKit.ActivePalette["colors"];
     customBackgroundColor?: string;
@@ -47,6 +48,7 @@ export type MenuButton = {
 };
 
 interface IMenuProps {
+    customBackgroundColorKey?: keyof NCoreUIKit.ProjectColorPalette;
     style?: StyleProp<ViewStyle> | Array<StyleProp<ViewStyle>>;
     customTheme?: {
         gapPropagation?: keyof NCoreUIKit.GapPropagationKey;