React native 不变冲突:元素类型无效:应为字符串(对于内置组件)

React native 不变冲突:元素类型无效:应为字符串(对于内置组件),react-native,React Native,React native simulator给出了错误 不变冲突:元素类型无效:需要字符串(对于内置组件)或类/函数(对于复合组件),但得到:object。您可能忘记了从定义组件的文件中导出组件,或者您可能混淆了默认导入和命名导入 App.js import React, { Component } from 'react'; import { SafeAreaView, StyleSheet, ScrollView, View, NavigatorIOS, Text,

React native simulator给出了错误 不变冲突:元素类型无效:需要字符串(对于内置组件)或类/函数(对于复合组件),但得到:object。您可能忘记了从定义组件的文件中导出组件,或者您可能混淆了默认导入和命名导入

App.js

import React, { Component } from 'react';
import {
  SafeAreaView,
  StyleSheet,
  ScrollView,
  View,
  NavigatorIOS,
  Text,
  StatusBar,
} from 'react-native';
import {
  Header,
  LearnMoreLinks,
  Colors,
  DebugInstructions,
  ReloadInstructions,
} from 'react-native/Libraries/NewAppScreen';

import SearchPage from './SearchPage';

export default class App extends Component<{}> {
  render() {
    return (
      <NavigatorIOS
        style={styles.container}
        initialRoute={{
          title: 'Property Finder',
          component: SearchPage,
        }}/>
    );
}
}


const styles = StyleSheet.create({
    container: {
  flex: 1,
},
});
import React,{Component}来自'React';
进口{
安全区域视图,
样式表,
滚动视图,
看法
航海家,
文本,
状态栏,
}从“反应本机”;
进口{
标题,
学习重新链接,
颜色,
调试说明,
重新加载指令,
}来自“react native/Libraries/NewAppScreen”;
从“./SearchPage”导入SearchPage;
导出默认类应用程序扩展组件{
render(){
返回(
);
}
}
const styles=StyleSheet.create({
容器:{
弹性:1,
},
});
SearchPage.js

import React, { Component } from 'react';
import {
  StyleSheet,
  Text,
  TextInput,
  View,
  Button,
  ActivityIndicator,
  Image,
} from 'react-native';;

export default class SearchPage extends Component<{}> {
  render() {
    return (
      <View style={styles.container}>
        <Text style={styles.description}>
          Search for houses to buy!
        </Text>
        <Text style={styles.description}>
          Search by place-name or postcode.
        </Text>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  description: {
    marginBottom: 20,
    fontSize: 18,
    textAlign: 'center',
    color: '#656565'
  },
  container: {
    padding: 30,
    marginTop: 65,
    alignItems: 'center'
  },
});
import React,{Component}来自'React';
进口{
样式表,
文本,
文本输入,
看法
按钮
活动指示器,
形象,,
}从“react native”;;
导出默认类SearchPage扩展组件{
render(){
返回(
找房子买!
按地名或邮政编码搜索。
);
}
}
const styles=StyleSheet.create({
说明:{
marginBottom:20,
尺码:18,
textAlign:'中心',
颜色:“#6565”
},
容器:{
填充:30,
玛金托普:65,
对齐项目:“中心”
},
});

有人能说出里面的问题吗。
使用react native version:0.61

当您可能忘记从中定义的文件中导出组件时,经常会出现错误。我看到您的代码已经完成。
我运行了你的代码。它显示
NavigatorIOS
已从库中删除。我认为这是由
NavigatorIOS
引起的,它仅在ios上工作,已被弃用。你应该使用“react native navigation
react native router flux”,我建议你使用
react native router flux
。 如果使用
react native router flux
,您可以查看以下代码:

const App = () => (
  <Router>
    <Stack key="root">
      <Scene key="search" component={SearchParge} title="search" />
    </Stack>
  </Router>

// then, if you want to go to it
Actions.search()
);



const-App=()=>(
//那么,如果你想去的话
Actions.search()
);

请显示您的代码我已经提交了代码,请在图片上方查看。您可以在expo零食中共享整个代码,以便我们进行测试吗?这是我在@Gauravroy得到的,您运行应用程序的设备是什么?安卓还是ios