Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 不变冲突:元素类型无效:应为字符串或类/函数,但得到:未定义_Reactjs_React Native_Mobile_Import - Fatal编程技术网

Reactjs 不变冲突:元素类型无效:应为字符串或类/函数,但得到:未定义

Reactjs 不变冲突:元素类型无效:应为字符串或类/函数,但得到:未定义,reactjs,react-native,mobile,import,Reactjs,React Native,Mobile,Import,App.js: 你的进口错了 import React from 'react'; import { View, Text } from 'react-native'; react模块中没有名为View或Text的导出。检查您的Login.js文件。有些进口商品错了 检查React Native中的组件和API 解决方案 从react中删除导入视图和文本 import React, {View, Text} from 'react'; export default class Login e

App.js:


你的进口错了

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

react模块中没有名为View或Text的导出。

检查您的Login.js文件。有些进口商品错了

检查React Native中的组件和API

解决方案

从react中删除导入视图和文本

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

export default class Login extends React.Component {

    render() {
        return (
            <View style={{ padding: 20 }}>
                <Text>Some text</Text>
            </View>
        )
    }
}
Invariant Violation: Element type is invalid: expected a string (for built in components) or a class/function (for composite components) but got: undefined. 
You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named exports.

Check the render method of 'Login'.

This error is located at:
in Login...
in App...RCTView...AppContainer...
import React from 'react';
import { View, Text } from 'react-native';
import React from 'react';
import { View, Text } from 'react-native';

export default class Login extends React.Component {

    render() {
        return (
            <View style={{ padding: 20 }}>
                <Text>Some text</Text>
            </View>
        )
    }
}