panhui 5 лет назад
Родитель
Сommit
c2629b7ac2

+ 12 - 12
App.js

@@ -16,7 +16,10 @@ import { SplashScreen } from "expo";
 import * as Font from "expo-font";
 import { Ionicons } from "@expo/vector-icons";
 import { NavigationContainer } from "@react-navigation/native";
-import { createStackNavigator } from "@react-navigation/stack";
+import {
+    createStackNavigator,
+    CardStyleInterpolators,
+} from "@react-navigation/stack";
 import Dialog from "./components/Dialog";
 
 import { useModel } from "flooks";
@@ -30,11 +33,6 @@ import { navigationRef } from "./navigation/RootNavigation";
 
 import * as ApplyStatus from "./config/ApplyStatus";
 
-import {
-    createStackNavigator,
-    CardStyleInterpolators,
-} from "@react-navigation/stack";
-
 const Stack = createStackNavigator();
 
 const config = {
@@ -78,18 +76,20 @@ export default function App(props) {
         loadResourcesAndDataAsync();
     }, [props.skipLoadingScreen]);
 
-    const initialRouteName = React.useMemo(() => {
-        console.log(isLogin);
+    const [initialRouteName, setInitialRouteName] = React.useState("");
+    React.useEffect(() => {
         if (isLogin) {
             if (status !== "PASS") {
-                return "Guide";
+                setInitialRouteName("Guide");
             } else {
-                return "Root";
+                setInitialRouteName("Root");
             }
         } else {
-            return "Login";
+            setInitialRouteName("Login");
         }
-    }, [isLogin, status]);
+    }, [isLogin, guideStep]);
+
+   
 
     if (!isLoadingComplete && !props.skipLoadingScreen) {
         return null;

+ 4 - 1
components/GoodsCard.js

@@ -21,7 +21,10 @@ export default function GoodsCard(props) {
                 <Avatar
                     style={styles.avatar}
                     shape='rounded'
-                    source='https://t7.baidu.com/it/u=3616242789,1098670747&fm=79&app=86&size=h300&n=0&g=4n&f=jpeg'
+                    source={{
+                        uri:
+                            "https://t7.baidu.com/it/u=3616242789,1098670747&fm=79&app=86&size=h300&n=0&g=4n&f=jpeg",
+                    }}
                 />
 
                 <Layout style={styles.main}>

+ 4 - 1
components/GoodsCardVertical.js

@@ -19,7 +19,10 @@ export default function GoodsCard(props) {
                 <Avatar
                     style={styles.avatar}
                     shape='square'
-                    source='https://t7.baidu.com/it/u=3616242789,1098670747&fm=79&app=86&size=h300&n=0&g=4n&f=jpeg'
+                    source={{
+                        uri:
+                            "https://t7.baidu.com/it/u=3616242789,1098670747&fm=79&app=86&size=h300&n=0&g=4n&f=jpeg",
+                    }}
                 />
 
                 <Layout style={styles.main}>

+ 1 - 1
components/NavHeaderBar.js

@@ -19,7 +19,7 @@ export default function NavHeaderBar(props) {
     const renderBackAction = () => (
         <TopNavigationAction
             icon={BackIcon}
-            onPress={RootNavigation.goBack()}
+            onPress={()=>RootNavigation.goBack()}
         />
     );
     return (

+ 1 - 1
components/UpLoadImage.js

@@ -33,7 +33,7 @@ export default function UpLoadImage(props) {
                                     width: "100%",
                                     height: "100%",
                                 }}
-                                source={props.value}
+                                source={{ uri: props.value }}
                             />
                         );
                     } else {

+ 2 - 0
models/httpModel.js

@@ -33,6 +33,7 @@ export default {
         async setConfig(config) {
             config.headers = config.headers || {};
             let token = await AsyncStorage.getItem("token");
+            console.log(token);
             if (token) {
                 config.headers["Authorization"] = "Bearer " + token;
             }
@@ -42,6 +43,7 @@ export default {
             return Promise.reject(error);
         },
         successEvent(response) {
+            console.log(response);
             return response;
         },
         errorEvent(error) {

+ 0 - 1
models/userModel.js

@@ -35,7 +35,6 @@ export default {
                         if (status == "PASS") {
                             guideStep = 4;
                         }
-                        console.log(guideStep);
                         if (guideStep) {
                             setState({ guideStep: guideStep, isLogin: true });
                         } else {

+ 7 - 3
navigation/RootNavigation.js

@@ -1,11 +1,15 @@
 // RootNavigation.js
 
-import * as React from 'react';
+import * as React from "react";
 
 export const navigationRef = React.createRef();
 
 export function navigate(name, params) {
-  navigationRef.current?.navigate(name, params);
+    navigationRef.current?.navigate(name, params);
 }
 
-// add other navigation functions that you need and export them
+export function goBack() {
+    navigationRef.current?.goBack();
+}
+
+// add other navigation functions that you need and export them

+ 1 - 1
screens/EditBannerScreen.js

@@ -61,7 +61,7 @@ export default function EditBannerScreen({ navigation, route }) {
                 <Layout style={styles.container}>
                     <Layout style={styles.top}>
                         <Image
-                            source={type == "banner" ? banner : logo}
+                            source={{ uri: type == "banner" ? banner : logo }}
                             style={[
                                 type == "banner" ? styles.banner : styles.logo,
                             ]}

+ 5 - 2
screens/HomeScreen.js

@@ -124,7 +124,10 @@ export default function HomeScreen() {
             />
             <ScrollPage>
                 <Layout style={styles.container}>
-                    <ImageBackground source={banner} style={styles.banner}>
+                    <ImageBackground
+                        source={{ uri: banner }}
+                        style={styles.banner}
+                    >
                         <Button
                             appearance='bannerButton'
                             onPress={() =>
@@ -152,7 +155,7 @@ export default function HomeScreen() {
                                 })
                             }
                         >
-                            <Image source={logo} style={styles.icon} />
+                            <Image source={{ uri: logo }} style={styles.icon} />
                         </TouchableOpacity>
 
                         <Layout style={styles.cardMain}>