在React Native中找不到如何修复工具?

时间:2019-10-28 08:41:48

标签: javascript react-native react-native-android

我是本机的新手,我为在屏幕之间导航创建了一个示例应用程序,但遇到了一些问题。我已附上屏幕快照。enter image description here

我在App.js中使用的

代码

import React from 'react';
import {Text, View } from 'react-native';

import { StackNavigator } from 'react-navigation';
import  FirstScreen  from './screens/FirstScreen'
import  SecondScreen  from './screens/SecondScreen'

const Navigation = StackNavigator({
First: {screen: FirstScreen},
Second: {screen: SecondScreen}
});

export default Navigation; // Export your root navigator as the root component

第二屏幕代码:

import React from 'react';
import {Text, View, Button} from 'react-native';
const util = require('util');

export default class SecondScreen extends React.Component {
static navigationOptions = {
    title: 'Second screen',
};

render() {
    console.log("this.props.navigation.state = " + util.inspect(this.props.navigation.state, false, null));
    var {params} = this.props.navigation.state;
    return (
        <View>
            <Text>This is screen 2</Text>
            <Text>Params from screen1 : {params.name}, email = {params.email}</Text>
        </View>
    );
}
  }

这些代码来自github。

1 个答案:

答案 0 :(得分:0)

请参阅下面的链接。您必须清除缓存并再次运行。

How to clear react-native cache?

第二个屏幕代码中可能会出现路径问题或某些错误。在第二个屏幕上建立一个简单的问候世界。