AdvancedReactNative icon indicating copy to clipboard operation
AdvancedReactNative copied to clipboard

Super expression must either be null or a function, not undefined

Open ghost opened this issue 6 years ago • 4 comments

Hey, I am getting the following error

Super expression must either be null or a function, not undefined

App.js

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

import Ball from './src/Ball';

export default class App extends Component { render() { return ( <View style={styles.container}> <Ball />

  </View>
);

} }

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

Ball.js

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

export default class Ball extends Component{ render(){ return( <View style={styles.ball} /> ); } }

const styles = { ball: { height: 60, width: 60, borderRadius: 30, borderWidth: 30, borderColor: 'black' } };

ghost avatar Aug 27 '17 21:08 ghost

when i had those it was due to spelling issue, make sure component and text are camel cased (Component, Text etc)

shaksi avatar Sep 17 '17 00:09 shaksi

@DavidAames It is clearly because of your declaration on Ball.js

import React from 'react'; and not import React from 'react-native';

Ernoff avatar Oct 21 '17 08:10 Ernoff

Could be caused by a circular dependency. Similar error and response from @ljharb on this issue

That usually happens when you're extending something that's a circular dependency. I'd recommend updating enzyme first, before upgrading React - that way you'll know for sure which thing caused the breakage.

creatorrr avatar Oct 08 '18 04:10 creatorrr

when i had those it was due to spelling issue, make sure component and text are camel cased (Component, Text etc)

Saved me an hour!!, Thanks.

BhVemula avatar Jun 13 '19 13:06 BhVemula