新的反应本地0.43.3项目元素类型中的误差无效



如果我创建了一个新的文件夹应用程序,并且在内部创建index.js文件,这是一个简单的react组件,呈现文本hello hello hello world,

export default class Test extends Component {
  render() {
    return (
      <View style={styles.container}>
        <Text style={styles.welcome}>
          Hello WOrld
        </Text>
      </View>
    );
  }
}

,然后在index.ios.js中致电:

import React, { Component } from 'react';
import { AppRegistry } from 'react-native'
import Test from './app'
AppRegistry.registerComponent('Test', () => Test)

我发现元素类型无效的错误:

期望字符串(用于内置组件(或类/功能 有对象。

但是,如果我在index.ios.js中创建组件,则该组件可以很好地呈现。

我的应用程序文件夹结构:

Test
 app
  index.js
 index.ios.js

有效的是 import Test from './app/index';

相关内容

最新更新