J'utilise le module ES6 réactif. Aucune erreur de temps de compilation et aucune erreur d'exécution. J'ai essayé d'importer un module principal, mais je n'ai aucune erreur. Voici le code ci-dessous pour le fichier Main.js:Impossible d'importer le module personnalisé natif de réaction
'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;
Voici mon premier fichier de projet. J'essaie d'importer le fichier 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);
assurez-vous que votre chemin est correct pour inculde main.js – Moorthy