Quellcode durchsuchen

Merge branch 'release/1.5.0-pre-alpha.4'

lfabl vor 1 Woche
Ursprung
Commit
07a03fb1b3
3 geänderte Dateien mit 19 neuen und 4 gelöschten Zeilen
  1. 1 1
      package.json
  2. 14 2
      src/components/userShortcut/index.tsx
  3. 4 1
      src/components/userShortcut/type.ts

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
     "name": "ncore-ui-kit",
-    "version": "1.5.0-pre-alpha.3",
+    "version": "1.5.0-pre-alpha.4",
     "description": "NİBGAT® | NCore - UI Kit for React-Native Mobile Apps.",
     "main": "./lib/module/index.js",
     "types": "./lib/typescript/src/index.d.ts",

+ 14 - 2
src/components/userShortcut/index.tsx

@@ -32,6 +32,7 @@ import Button from "../button";
 import Text from "../text";
 
 const UserShortcut = ({
+    isCloseBottomSheetOnLogoutPress = true,
     isShowLoginButtonWhenNoSession = true,
     isShowRegisterButton = false,
     isWorkWithCoreComplex = true,
@@ -337,10 +338,19 @@ const UserShortcut = ({
                 {
                     actionButtons?.map((buttonProps, index) => {
                         return <Button
+                            {...buttonProps}
+                            onPress={() => {
+                                if(buttonProps.isCloseBottomSheetOnPress !== false) {
+                                    setIsBottomSheetOpen(false);
+                                }
+
+                                if(buttonProps.onPress) {
+                                    buttonProps.onPress();
+                                }
+                            }}
                             spreadBehaviour="stretch"
                             type="neutral"
                             key={index}
-                            {...buttonProps}
                         />;
                     })
                 }
@@ -349,7 +359,9 @@ const UserShortcut = ({
                         <Button
                             title={localize("logout" as keyof NCoreUIKit.Translation)}
                             onPress={async () => {
-                                setIsBottomSheetOpen(false);
+                                if(isCloseBottomSheetOnLogoutPress) {
+                                    setIsBottomSheetOpen(false);
+                                }
 
                                 let response;
                                 let error;

+ 4 - 1
src/components/userShortcut/type.ts

@@ -35,10 +35,13 @@ interface IUserShortcutProps {
     statusColor?: keyof NCoreUIKit.TextContentColors;
     spreadBehaviour?: UserShortcutSpreadBehaviour;
     variant?: "default" | "compact" | "drawer";
+    isCloseBottomSheetOnLogoutPress?: boolean;
     isShowLoginButtonWhenNoSession?: boolean;
+    actionButtons?: (IButtonProps & {
+        isCloseBottomSheetOnPress?: boolean;
+    })[];
     isWorkWithCoreComplex?: boolean;
     isShowRegisterButton?: boolean;
-    actionButtons?: IButtonProps[];
     isShowLogoutButton?: boolean;
     onRegisterPress?: () => void;
     isShowArrowButton?: boolean;