导入另一个文件时出现本机错误

时间:2019-12-05 11:32:17

标签: react-native import

我只是将我的文件从自定义创建的文件夹组件导入App.js文件,并且导入关键是在处理React和React native上的其他导入时不处理手动创建的文件。 我正在使用Expo Cli Code Image

来应用React-Native
import React from 'react';

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

import test from './component/test';   // This line is producing error

export default function App() {

 return (
    <View style={styles.container}>
      <test/>
      <Text>Open up App.js to start working on your app!</Text>
    </View>
  );

}

const styles = StyleSheet.create({`enter code here`

container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },

});

测试组件:----

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

export default class Test extends React.Component {
  render(){
    return (
      <View style={styles.container}>
        <Text>Login js file</Text>
      </View>
    );
  }

}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});

请访问代码图像第3行导致错误

https://i.stack.imgur.com/WRYAt.png

0 个答案:

没有答案