无法导入反应原生自定义模块
问题描述:
我正在使用原生反应ES6。 没有编译时错误,也没有运行时错误。 我试图导入一个主模块,但我没有任何错误。以下是Main.js文件的代码:无法导入反应原生自定义模块
'use-strict';
import React, {Component} from 'react';
import {View, Text, StyleSheet} from 'react-native';
class Main extends Component {
render() {
return (
<View style={{justifyContent:'flex-start', marginTop: 120}}>
<Text style={{fontSize:20}}> Testing the router</Text>
<Text> Testing the router</Text>
</View>
);
}
}
module.exports = Main;
这是我的第一个项目文件。我正在尝试导入Main.js文件。
'use-strict';
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
NavigatorIOS
} from 'react-native';
import Main from './Main.js';
export default class FirstProject extends Component {
render() {
return (
<NavigatorIOS
initialRoute={{
title: 'App Title',
component: Main
}} />
);
}
}
AppRegistry.registerComponent('FirstProject',() => FirstProject);
确保您的路径是正确的inculde main.js – Moorthy