React-native:超级表达式必须为null或函数

时间:2019-03-26 16:12:31

标签: react-native

This Is the Error I received我看到了类似的问题,但似乎无法确定问题所在。我正在使用react-native-cli:2.0.1 react-native:0.58.0-rc.2我才刚刚开始学习React-Native。所以,我的代码很基础

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

class GroupPin extends Component {

    render() {
        return (
            <View style={styles.container}>
                <Text>Hello World !!</Text>
            </View>
        );
    }
}

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

export default GroupPin;

这是我的App.Js文件

import React from 'react';
import Component from 'react';
import { StyleSheet, Platform, Image, Text, View, ScrollView } from 'react-native';
import firebase from 'react-native-firebase';
import GroupPin from './Screens/GroupPin';

export default class App extends Component {

  async componentDidMount() {
    // TODO: You: Do firebase things
    // const { user } = await firebase.auth().signInAnonymously();
    // console.warn('User -> ', user.toJSON());

    // await firebase.analytics().logEvent('foo', { bar: '123'});
  }

  render() {
		return <GroupPin />;
	}
}

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

1 个答案:

答案 0 :(得分:1)

通过更改解决 [

  

导出默认类App扩展组件

]到

export default class App extends React. Component