【发布时间】:2017-05-29 09:06:22
【问题描述】:
当我尝试导入我的组件时出现错误。 这是错误文本: “元素类型无效,应为字符串(用于内置组件)或类/函数”。
主文件 index.android.js
从 'react' 导入 React, { Component };从 'react-native' 导入 {
AppRegistry,
StyleSheet,
Text,
View
};
从 './components/Text2' 导入 {Text2};
类 p001_lesson 扩展组件 {
render() {
return (
);
}
}
AppRegistry.registerComponent('p001_lesson', () => p001_lesson);
second file Text2.js
<pre>
import React, {Component} from 'react';
import {
Text,
} from 'react-native';
class Text2 extends Component {
render() {
return <Text>some text here</Text>
}
}
如何修复我的导入?对不起我的英语:D
【问题讨论】:
标签: javascript android ios reactjs react-native