Эх сурвалжийг харах

Feature: Header component completed.

lfabl 3 өдөр өмнө
parent
commit
76ef0d9670

+ 25 - 21
example/src/pages/home/index.tsx

@@ -1,12 +1,14 @@
 import {
     useLayoutEffect
 } from "react";
+import {
+    Image
+} from "react-native";
 import stylesheet from "./stylesheet";
 import {
-    Header,
-    NCoreUIKitLocalize,
     NCoreUIKitTheme,
-    PageContainer
+    PageContainer,
+    Text
 } from "ncore-ui-kit";
 import {
     useNavigation
@@ -21,28 +23,11 @@ const Home = () => {
         colors
     } = NCoreUIKitTheme.useContext();
 
-    const {
-        localize
-    } = NCoreUIKitLocalize.useContext();
-
     const navigation = useNavigation<NativeStackNavigationProp<RootStackParamList>>();
 
     useLayoutEffect(() => {
         navigation.setOptions({
-            header: () => <Header
-                title={localize("home") + " dsgpıojsdf ıogjsdoıgjsdg lkjslkgjdskl gjsdklgjsdg asfkasf aslfk aslfşk aslşfkasfaslşkf asfasflşk"}
-                navigation={navigation}
-                isGoBackEnable={true}
-                actions={[
-                    {
-                        onPress: () => {
-
-                        },
-                        size: "medium",
-                        title: "Tamam"
-                    }
-                ]}
-            />
+            headerShown: false
         });
     }, []);
 
@@ -58,6 +43,25 @@ const Home = () => {
             }
         }}
     >
+        <Image
+            source={{
+                uri: "https://ncore.nibgat.space/assets/images/ncorelogo.png"
+            }}
+            style={{
+                height: 300,
+                width: 300
+            }}
+        />
+        <Text
+            variant="displayMediumSize"
+        >
+            NCore | Design System
+        </Text>
+        <Text
+            variant="headlineLargeSize"
+        >
+            UI Kit - Library
+        </Text>
     </PageContainer>;
 };
 export default Home;

+ 35 - 0
example/src/pages/text/index.tsx

@@ -1,10 +1,45 @@
+import {
+    useLayoutEffect
+} from "react";
 import stylesheet from "./stylesheet";
 import {
+    NCoreUIKitLocalize,
     PageContainer,
+    Header,
     Text
 } from "ncore-ui-kit";
+import {
+    useNavigation
+} from "@react-navigation/native";
+import type RootStackParamList from "../../navigation/type";
+import type {
+    NativeStackNavigationProp
+} from "@react-navigation/native-stack";
 
 const TextPage = () => {
+    const {
+        localize
+    } = NCoreUIKitLocalize.useContext();
+
+    const navigation = useNavigation<NativeStackNavigationProp<RootStackParamList>>();
+
+    useLayoutEffect(() => {
+        navigation.setOptions({
+            header: () => <Header
+                title={localize("home") + " dsgpıojsdf ıogjsdoıgjsdg lkjslkgjdskl gjsdklgjsdg asfkasf aslfk aslfşk aslşfkasfaslşkf asfasflşk"}
+                navigation={navigation}
+                actions={[
+                    {
+                        onPress: () => {
+                        },
+                        size: "medium",
+                        title: "Tamam"
+                    }
+                ]}
+            />
+        });
+    }, []);
+
     return <PageContainer
         style={[
             stylesheet.container

+ 2 - 2
src/components/header/index.tsx

@@ -102,7 +102,7 @@ const Header = <T extends NavigationType>({
 
         if(!isGoBackEnable || !navigation) {
             if(leftContainerWidth === null) setLeftContainerWidth(0);
-            return null;
+            return <View/>;
         }
 
         return <View
@@ -158,7 +158,7 @@ const Header = <T extends NavigationType>({
 
         if(!actions || !actions.length) {
             if(rightContainerWidth === null) setRightContainerWidth(0);
-            return null;
+            return <View/>;
         }
 
         return <View