我为我的应用程序创建了一个导航设置,该设置应从欢迎屏幕开始,在欢迎屏幕上,您会找到两个按钮,一个用于注册,另一个用于登录。
当用户注册或登录时,他将被发送到其他屏幕。我已经在登录和注册屏幕之间创建了一个堆栈导航器,并将它们放置在loginFlow常量中,并将其放置在welcome屏幕和loginFlow常量之间,并且在这些屏幕之间进行导航,但是由于某些原因,未显示欢迎屏幕首先,我得到了注册屏幕(注册屏幕)。
为什么会这样,如何使welcomeScreen首先显示
import React from "react";
import { View } from "react-native";
import WeclomeScreen from "./app/screens/WelcomeScreen";
import MainScreen from "./app/screens/MainScreen";
import AccountScreen from "./app/screens/AccountScreen";
import { Provider as AuthProvider } from "./app/context/AuthContext";
import { createMaterialBottomTabNavigator } from "react-navigation-material-bottom-tabs";
import SignupScreen from "./app/screens/SignupScreen";
import { createAppContainer, createSwitchNavigator } from "react-navigation";
import { createStackNavigator } from "react-navigation-stack";
import ResultShowScreen from "./app/screens/ResultShowScreen";
import ResolveAuthScreen from "./app/screens/ResolveAuthScreen";
import SigninScreen from "./app/screens/SigninScreen";
import ArticleSaveScreen from "./app/screens/ArticleSaveScreen";
import { setNavigator } from "./app/navigationRef";
const articleListFlow = createStackNavigator({
Main: MainScreen, // screen with diffrent articles categories
ResultsShow: ResultShowScreen, // article details screen
});
const loginFlow = createStackNavigator({
Signup: SignupScreen,
Signin: SigninScreen,
});
loginFlow.navigationOptions = () => {
return {
headerShown: false,
};
};
articleListFlow.navigationOptions = {
title: "News Feed",
tabBarIcon: ({ tintColor }) => (
<View>
<Icon style={[{ color: tintColor }]} size={25} name={"ios-cart"} />
</View>
),
activeColor: "#ffffff",
inactiveColor: "#ebaabd",
barStyle: { backgroundColor: "#d13560" },
};
const switchNavigator = createSwitchNavigator({
ResolveAuth: ResolveAuthScreen,
MainloginFlow: createStackNavigator({
WelcomeScreen: WeclomeScreen,
loginFlow: loginFlow,
}),
mainFlow: createMaterialBottomTabNavigator(
{
articleListFlow: articleListFlow,
ArticleSave: ArticleSaveScreen, // we dont need this one
Account: AccountScreen,
},
{
activeColor: "#ffffff",
inactiveColor: "#bda1f7",
barStyle: { backgroundColor: "#6948f4" },
}
),
});
const App = createAppContainer(switchNavigator);
export default () => {
return (
<AuthProvider>
<App
ref={(navigator) => {
setNavigator(navigator);
}}
/>
</AuthProvider>
);
};
这是ResolveAuthscreen的内容:
import React, { useEffect, useContext } from "react";
import { Context as AuthContext } from "../context/AuthContext";
const ResolveAuthScreen = () => {
const { tryLocalSignin } = useContext(AuthContext);
useEffect(() => {
tryLocalSignin();
}, []);
// not returning anything since just waiting to check the token
// will transition to signin or signup very quickly
return null;
};
export default ResolveAuthScreen;
答案 0 :(得分:0)
正如您在评论中提到的那样,您的InnoDB: using atomic writes.
2020-05-26 19:29:04 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2020-05-26 19:29:04 0 [Note] InnoDB: Uses event mutexes
2020-05-26 19:29:04 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-05-26 19:29:04 0 [Note] InnoDB: Number of pools: 1
2020-05-26 19:29:04 0 [Note] InnoDB: Using SSE2 crc32 instructions
2020-05-26 19:29:04 0 [Note] InnoDB: Initializing buffer pool, total size = 16M, instances = 1, chunk size = 16M
2020-05-26 19:29:04 0 [Note] InnoDB: Completed initialization of buffer pool
2020-05-26 19:29:04 0 [Note] InnoDB: Starting crash recovery from checkpoint LSN=323988
2020-05-26 19:29:04 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2020-05-26 19:29:04 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2020-05-26 19:29:04 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2020-05-26 19:29:04 0 [Note] InnoDB: Setting file 'C:\xampp\mysql\data\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2020-05-26 19:29:04 0 [Note] InnoDB: File 'C:\xampp\mysql\data\ibtmp1' size is now 12 MB.
2020-05-26 19:29:04 0 [Note] InnoDB: 10.4.11 started; log sequence number 323997; transaction id 328
2020-05-26 19:29:04 0 [Note] InnoDB: Loading buffer pool(s) from C:\xampp\mysql\data\ib_buffer_pool
2020-05-26 19:29:04 0 [Note] Plugin 'FEEDBACK' is disabled.
2020-05-26 19:29:04 0 [Note] Server socket created on IP: '::'.
方法中存在问题。在这种方法中,如果没有任何tryLocalSignin
,则将用户导航到token
屏幕。代替导航到Signup
屏幕,而是导航到Signup
屏幕:
WelcomeScreen