React Native(0.39.2) - 未知的命名模块错误

时间:2016-12-25 13:50:25

标签: javascript android reactjs import react-native

React-Native "^0.39.2"
React "15.4.1"

我正在尝试import我的自定义组件 Main.jsx

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

export default class Main extends Component {
    render() {
        return(
            <View>
              <Text>
                Imported
              </Text>
            </View>
        )
    }
}

index.android.js

import React, { Component } from 'react';
import { AppRegistry, View, Text, StyleSheet } from 'react-native';
import Main from './app/components/Main'

export default class AppTest extends Component {
  render() {
    return (
        <View>
          <Main />
        </View>
    );
  }
}

AppRegistry.registerComponent('AppTest', () => AppTest);

我不明白为什么我收到错误unknown named module './app/components/Main',我的项目结构是正确的:

AppTest
  |
  app
    |
    components
      |
      Main.jsx

也许我错了或忘记了一些非常基本但却无法找出原因的事情

0 个答案:

没有答案