-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Description
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:
-
Identify the packages which depend upon
tslibby searching youryarn.lockfile fortslibunder thedependenciessection 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"
-
Ensure you're using
yarnversion 1.0 or higher. (Just runyarnand you'll see your current version.)brew update && brew upgrade yarnif you're out of date. -
Add a
resolutionssection to yourpackage.jsonfile for everytslibdependency you found earlier. The resolution key should be the package with a dependency, followed by/tslib, and the value is a specific commit on thetslibrepo that contains the fix.For the
lodash-decoratorspackage, 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.