Resat-n​​ative-在安装路由模块期间出错

时间:2020-04-24 08:44:41

标签: react-native react-native-android

我是React Native的新手,我想安装路由模块。

下面是我的代码段:

import React, { Component } from 'react';  
import { AppRegistry, Text, TextInput, View,Alert } from 'react-native';
import {
  SafeAreaView,
  StyleSheet,
  ScrollView,
  StatusBar,
  Button,
  ImageBackground,
  Router,
  Stack,
  Scene,
} from 'react-native';
import {
  Header,
  LearnMoreLinks,
  Colors,
  DebugInstructions,
  ReloadInstructions,
} from 'react-native/Libraries/NewAppScreen';
import Home from './component/Home'
import About from './component/About'
export default class App extends Component {  
    render() {  
        return (  
          <View >
          <Router>
            <Stack key="root">
              <Scene key="login" component={Home} title="home" />
              <Scene key="register" component={About} title="about" />
            </Stack>
          </Router>
        </View>
        );  
    }  
}

下面显示的安装错误提示可以帮助我解决问题。

1 个答案:

答案 0 :(得分:0)

您可能忘记了安装过程中的步骤。如果您不需要react-native-screens,请执行npm install react-native-screens,因为它是react-native-router-flux的依赖项。