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

GLOBAL.Text error when upgrading to 0.16 #4862

Closed
maraujop opened this issue Dec 18, 2015 · 8 comments
Closed

GLOBAL.Text error when upgrading to 0.16 #4862

maraujop opened this issue Dec 18, 2015 · 8 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@maraujop
Copy link

Hi,

After upgrading to RN 0.16 we had some nasty red boxes like this one, in iOS and Android.

zbrhi

TypeError: undefined is not an object (evaluating 'GLOBAL.Text={get DefaultProps(){throw getInvalidGlobalUseError('Text')}}') (line 1195 in the generated bundle)

Apparently there are more people having this issue and asking for help online. We didn't know how to fix it, so we created a new app and starting moving chunks of code trying to find the culprit. However, we ended up moving all the code without issues and everything was working and compiling. This looked like a cache bug, we continued working with this new project and after downloading the JS bundle for several times, we hit this red screen again.

Then we discovered that the .babelrc file we had in the root of our project was causing at least part of the issue. We renamed this file and then we launched the packager with --reset-cache. All of a sudden everything was working again. is this an expected behavior? can this be a packager cache bug?

Thanks, cheers
Miguel

@facebook-github-bot
Copy link
Contributor

Hey maraujop, thanks for reporting this issue!

React Native, as you've probably heard, is getting really popular and truth is we're getting a bit overwhelmed by the activity surrounding it. There are just too many issues for us to manage properly.

  • If you don't know how to do something or not sure whether some behavior is expected or a bug, please ask on StackOverflow with the tag react-native or for more real time interactions, ask on Discord in the #react-native channel.
  • If this is a feature request or a bug that you would like to be fixed, please report it on Product Pains. It has a ranking feature that lets us focus on the most important issues the community is experiencing.
  • We welcome clear issues and PRs that are ready for in-depth discussion. Please provide screenshots where appropriate and always mention the version of React Native you're using. Thank you for your contributions!

@cancan101
Copy link
Contributor

Duplicate of #4811.

@cancan101
Copy link
Contributor

FWIW I am seeing this issue on 0.17 as well.

@cancan101
Copy link
Contributor

These polyfills seem to be transpiled as:

(function(GLOBAL){
function getInvalidGlobalUseError(name){
return new Error(
'You are trying to render the global '+name+' variable as a '+
'React element. You probably forgot to require '+name+'.');}

GLOBAL.Text={
get defaultProps(){
throw getInvalidGlobalUseError('Text');}};

GLOBAL.Image={
get defaultProps(){
throw getInvalidGlobalUseError('Image');}};

if(GLOBAL.document){
GLOBAL.document.createElement=null;}

GLOBAL.MutationObserver=undefined;})(undefined);

notice the undefined that is being injected for this.

@matteodem
Copy link

Experiencing the same error locally.

@rob-johansen
Copy link

I started experiencing this cryptic error today, with literally zero code changes on my part. All I did was stop the iOS simulator, which was successfully running my project as "iPad Air 2", change the simulator to "iPhone 6s Plus", then try to run it again—something I had done a dozen times in the last few hours with no problems. Now I can't run any iOS simulator—they all give me this error.

I tried the "extends" suggestion from #4811, but that didn't work. I then removed my .babelrc file, but that didn't work either. How do I clear my babel cache? Have I missed anything else?

@jeremy-hunter
Copy link

I believe this command clears the cache (#1924)
node_modules/react-native/packager/packager.sh reset-cache

@kirillplatonov
Copy link

As @jayli already mentioned in #4811 the solution is here.

@maraujop maraujop closed this as completed Mar 9, 2016
@facebook facebook locked as resolved and limited conversation to collaborators Jul 20, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 20, 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