Quellcode durchsuchen

Bugfix: Switch colors fix.

lfabl vor 1 Monat
Ursprung
Commit
6221744c9a

+ 1 - 0
example/src/pages/home/index.tsx

@@ -240,6 +240,7 @@ const Home = () => {
             isActive={isSwitchActive}
             title="dsgojksdgpojk"
             subTitle="SJFAJdfa"
+            isDisabled={false}
             onPress={() => {
                 setIsSwitchActive(!isSwitchActive);
             }}

+ 8 - 7
src/components/switch/stylesheet.ts

@@ -17,7 +17,7 @@ export const SWITCH_TYPE_STYLES: Record<
     SwitchType,
     {
         containerColor: keyof NCoreUIKit.ContainerContentColors;
-        indicatorColor: keyof NCoreUIKit.ContainerContentColors;
+        indicatorColor: keyof NCoreUIKit.IconContentColors;
         subTitleColor: keyof NCoreUIKit.TextContentColors;
         titleColor: keyof NCoreUIKit.TextContentColors;
     }
@@ -104,10 +104,10 @@ const stylesheet = StyleSheet.create({
         position: "absolute",
         display: "none",
         zIndex: 999,
-        bottom: -2,
-        right: -2,
-        left: -2,
-        top: -2
+        bottom: 0,
+        right: 0,
+        left: 0,
+        top: 0
     }
 });
 
@@ -138,7 +138,7 @@ export const useStyles = ({
             padding: spaces.spacingXs
         } as Mutable<ViewStyle>,
         indicator: {
-            backgroundColor: colors.content.container[currentType.indicatorColor],
+            backgroundColor: colors.content.icon[currentType.indicatorColor],
             borderRadius: SWITCH_INDICATOR_SIZE / 2,
             height: SWITCH_INDICATOR_SIZE,
             width: SWITCH_INDICATOR_SIZE
@@ -195,7 +195,8 @@ export const useStyles = ({
 
     if(isActive) {
         if(styleType === "neutral") {
-            styles.indicatorContainer.backgroundColor = colors.content.container.primary;
+            styles.indicatorContainer.backgroundColor = colors.content.container.emphasized;
+            styles.indicator.backgroundColor = colors.content.icon.emphasized;
         }
     }
 

+ 1 - 1
src/components/switch/type.ts

@@ -21,7 +21,7 @@ export type SwitchDynamicStyleType = {
 
 export type SwitchTypes = {
     containerColor: keyof NCoreUIKit.ContainerContentColors;
-    indicatorColor: keyof NCoreUIKit.ContainerContentColors;
+    indicatorColor: keyof NCoreUIKit.IconContentColors;
     subTitleColor: keyof NCoreUIKit.TextContentColors;
     titleColor: keyof NCoreUIKit.TextContentColors;
 };