React-native: Super expression must either be null or a function, not null

Created on 24 May 2016  ·  1Comment  ·  Source: facebook/react-native

Version

$ react-native -v

react-native-cli: 0.2.0
react-native: 0.26.1

Steps to reproduce

Build the code below of index.ios.js in xcode

'use strict';
var React = require('react-native');
var styles = React.StyleSheet.create({
text: {
color: 'black',
backgroundColor: 'white',
fontSize: 30,
margin: 80
}
});
class PropertyFinderApp extends React.Component {
render() {
return React.createElement(React.Text, {style: styles.text}, "Hello World!");
}
}
React.AppRegistry.registerComponent('PropertyFinder', function() { return PropertyFinderApp });

Expected Behavior

Hello World!

Actual Behavior

Error : Super expression must either be null or a function, not null

screen shot 2016-05-23 at 11 49 04 pm

Locked

Most helpful comment

This part is the problem: var React = require('react-native');. Instead write:

var React = require('react');
var ReactNative = require('react-native');

>All comments

This part is the problem: var React = require('react-native');. Instead write:

var React = require('react');
var ReactNative = require('react-native');
Was this page helpful?
0 / 5 - 0 ratings