我只是摆弄react-native并尝试使用简单的导航来构建模拟。但是,我陷入了一个我不知道造成这种情况的原因。
index.js
import { AppRegistry } from 'react-native';
import App from './App';
AppRegistry.registerComponent('AwesomeProject', () => App);
App.js
import React, { Component } from 'react'
import { AppRegistry, View, Text, StyleSheet } from 'react-native'
import Routes from './src/config/routes';
export class App extends Component {
render() {
return (
<View>
<Routes/>
</View>
)
}
}
Routes.js
import React from "react";
import { Platform } from "react-native";
import { StackNavigator } from "react-navigation";
import Home from '../screens/Home';
import SignUp from '../screens/SignUp';
export default const Routes = StackNavigator(
{
Home: { screen: Home },
SignUp: { screen: SignUp },
},
{
initialRouteName: "Home",
headerMode: "none",
}
);
错误:
https://bugs.chromium.org/p/chromium/issues/detail?id=721138
答案 0 :(得分:0)
我不确定这是否有用。但请尝试检查如下:
import Routes from './src/config/Routes';
如上面的代码,您的文件名应该是路由,而不是路由。
export default const Routes = StackNavigator({
initialRouteName: Home,
Home: { screen: Home },
SignUp: { screen: SignUp },
},
{
headerMode: "none",
});