Skip to content

Workaround for _globalWindow2['default'] / __reactComponentProxies error #16858

Closed
@jamesreggio

Description

@jamesreggio

There's a bug in the TypeScript runtime support library (tslib) that will cause one of the following cryptic errors in a React Native app:

undefined is not an object (evaluating '_globalWindow2['default'].__reactComponentProxies')

Cannot read property '__reactComponentProxies' of undefined

tslib is utilized by a variety of different popular React Native libraries; for example: lodash-decorators.

The tslib maintainers have fixed the issue (in microsoft/tslib#42) but they haven't published a release yet.

The easiest way to work around this issue at present is the following:

  1. Identify the packages which depend upon tslib by searching your yarn.lock file for tslib under the dependencies section of a dependency.

    For example, here's how that looks for lodash-decorators:

lodash-decorators@^4.5.0:
  version "4.5.0"
  resolved "https://registry.yarnpkg.com/lodash-decorators/-/lodash-decorators-4.5.0.tgz#a4bb63dfbb512f0dd9409f7af452e4e2edcb80f4"
  dependencies:
    tslib "^1.7.1"
  1. Ensure you're using yarn version 1.0 or higher. (Just run yarn and you'll see your current version.) brew update && brew upgrade yarn if you're out of date.

  2. Add a resolutions section to your package.json file for every tslib dependency you found earlier. The resolution key should be the package with a dependency, followed by /tslib, and the value is a specific commit on the tslib repo that contains the fix.

    For the lodash-decorators package, it looks like this:

"resolutions": {
  "lodash-decorators/tslib": "Microsoft/tslib#375b3f6"
},

I realize this is not an issue on React Native, so you're welcome to close it. I just wanted to share a workaround in a place where I expect most people will begin searching for this problem after a React Native upgrade.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Ran CommandsOne of our bots successfully processed a command.Resolution: LockedThis issue was locked by the bot.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions