Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[0.26.1] _reactNative2.default.createElement is not a function #7722

Closed
aprct opened this issue May 24, 2016 · 9 comments
Closed

[0.26.1] _reactNative2.default.createElement is not a function #7722

aprct opened this issue May 24, 2016 · 9 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@aprct
Copy link

aprct commented May 24, 2016

I also can't run the project.

I'm getting this red screen error on start:

_reactNative2.default.createElement is not a function

This is weird because it's happening in the render method of index.ios.js which looks like this:

class TheApp extends Component {
  render() {
    return (
        <Provider store={store}>
            <TheAppComponent /> // Red Screen points right here
        </Provider>
    );
  }
}

TheAppComponent is exported like so: export default connect((state) => (state))(WhasomeMobile);

I've gone through and updated my project to include Component and PropTypes from React and even went through all of the third party dependencies that haven't done so yet. I've also done react-native upgrade and rnpm upgrade and nothing helps.

The string _reactNative2.default.createElement doesn't even exist anywhere in my project.

I've spent a day and a half on this already. Any ideas?

@aprct aprct changed the title _reactNative2.default.createElement is not a function [0.26.1] _reactNative2.default.createElement is not a function May 24, 2016
@aprct aprct closed this as completed May 24, 2016
@ide
Copy link
Contributor

ide commented May 24, 2016

You probably need to fix your imports:

import React from 'react';
import ReactNative from 'react-native';

This is so you run React.createElement instead of ReactNative.createElement, which doesn't exist.

@satya164
Copy link
Contributor

@seanfuture Please don't say such things.

We've listed this in the release notes and also listed a codemod which you can use to migrate your project automatically - https://github.com/facebook/react-native/releases/tag/v0.25.1

We've valid reasons for doing so and have no intention to break anyone's code. But React Native is a moving target and breakage is unavoidable.

@seanfuture
Copy link

Fair enough - Just pointing out how incredibly impactful this breaking change was .. Please be more careful regarding the core product.

@adrienthiery
Copy link
Contributor

adrienthiery commented Jun 11, 2016

The awesome thing would be to have a bit more specific warning maybe ?

I had a really weird error talking about Babel or something when I forgot to update some of my components

@sibelius
Copy link

If u wanna upgrade you should read the release notes, there is all the breaking changes that u need to take in consideration.

The breaking changes are necessary to move faster

@satya164
Copy link
Contributor

satya164 commented Jun 11, 2016

@adrienthiery We had the warning in 0.25. It was removed completely in 0.26. But maybe we should have kept the warning for 2-3 releases before removing it completely.

@aprct
Copy link
Author

aprct commented Jun 11, 2016

Such is the nature of working with anything under heavy and active development. It'll be good for us all in the long run. Better now than much further down the line.

@satya164
Copy link
Contributor

I submitted a PR which will show a better error message. Hope it helps.

@QutGit
Copy link

QutGit commented Feb 6, 2017

my project is web-react use webpack package get a error createElement is not a function , i dont konw how to do it.

@facebook facebook locked as resolved and limited conversation to collaborators May 24, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

8 participants