【发布时间】:2020-05-21 03:51:27
【问题描述】:
我正在尝试在App.js 文件中导出我的主要组件,但在该行中“导出默认值”
"导出默认类App扩展组件"
未使用。这是项目中唯一的导出默认语句。当我尝试运行该项目时,它崩溃了。我已将源代码发布到下面的 app.js 中
更多信息:我正在使用 WebStorm 构建此应用程序,它告诉我“导出默认”语句未使用。当我运行该应用程序时,我没有收到任何错误,但它一打开就崩溃了。
谁能告诉我这里出了什么问题或如何解决这个问题?
import React, {Component} from 'react';
import { StyleSheet, Text, View, ScrollView } from 'react-native';
import {LogCell} from './LogCell.js';
import {Header} from 'react-native-elements';
export default class App extends Component {
render() {
return (
<View style={styles.container}>
<Header
placement="left"
leftComponent={{ icon: 'date-range', color: 'white', size: 30}}
centerComponent={{ text: 'Feb 2', style: { color: 'white', fontSize: 20} }}
rightComponent={{ icon: 'edit', color: 'white', size: 30}}
backgroundColor={"rgb(0, 100, 250)"}
/>
<ScrollView style={{width: '100%', paddingLeft: '5%', paddingRight: '5%', paddingBottom: '5%'}}>
<LogCell></LogCell>
<LogCell></LogCell>
<LogCell></LogCell>
</ScrollView>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
// justifyContent: 'center',,
},
});
【问题讨论】:
-
崩溃时看到的错误是什么?
标签: javascript reactjs react-native expo