这是我得到的拒绝错误
这是问题开始发生"路线.js"的地方:
import React, {Component} from 'react';
import {Router, Stack, Scene} from 'react-native-router-flux';
export default class Routes extends Component<{}> {
render() {
return(
<Router>
<Stack key="root">
<Scene key="login" component={Login} title="Login"/>
<Scene key="register" component={Signup} title="Register"/>
</Stack>
</Router>
)
}
}
Then made changes in the "App.js" file to import from Routes
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
* @lint-ignore-every XPLATJSCOPYRIGHT1
*/
import React, {Component} from 'react';
import {
StyleSheet,
View,
StatusBar
} from 'react-native';
import Routes from './src/Routes';
export default class App extends Component<{}> {
render() {
return (
<View style={styles.container}>
<StatusBar
backgroundColor="#0086c3"
barStyle="light-content"
/>
<Routes/>
</View>
);
}
}
const styles = StyleSheet.create({
container : {
backgroundColor: '#29b6f6',
flex: 1,
alignItems: 'center',
justifyContent: 'center',
}
});
我不太确定发生了什么,我保存了所有文件并将其放在热重载中,但仍然显示此错误。我是 React Native 的新手,仍在学习它的基础知识。
您需要
先导入Login
路由,然后再使用它。 即:
import Login from './path-to-routes/Login';