NativeBase: React Native 0.50.1 - Release Crash

Hi,

I just upgraded from RN 0.49 to 0.50.1 and have ran into problem when building and running the release version. I trimmed my app back to the simplest version it could be and I narrowed it down to NativeBase.

react-native, react and native-base version

“native-base”: “^2.3.3”, “react”: “^16.0.0”, “react-native”: “^0.50.1”,

Expected behaviour

App does not crash when built for release and ran.

Actual behaviour

App crashes when built and ran in release mode. The following output is shown in the Xcode output:

Terminating app due to uncaught exception 'RCTFatalException: Unhandled JS Exception: undefined is not an object (evaluating 'e.length')', reason: 'Unhandled JS Exception: undefined is not an object (evaluating 'e.length'), stack:
<unknown>@340:132
<unknown>@340:196
exports@340:395
<unknown>@338:218
<unknown>@338:72
t@2:620
<unknown>@333:1740
t@2:620
<unknown>@332:131
t@2:620
<unknown>@331:131
t@2:620
<unknown>@330:308
t@2:620
<unknown>@329:216
t@2:620
<unknown>@308:742
t@2:620
<unknown>@13:152
t@2:620
<unknown>@12:30
t@2:620
<unknown>@2:154
global code@631:9
'
*** First throw call stack:
(0x182a27d38 0x181f3c528 0x182a27c80 0x100fd5398 0x100fd305c 0x182a2f6a0 0x18290e820 0x18291322c 0x100fe6058 0x101025d74 0x101025ad4 0x103ffd49c 0x103ffd45c 0x10400c110 0x1040009a4 0x10400d104 0x104014100 0x182652fe0 0x182652c30)

Steps to reproduce (code snippet or screenshot)

This code causes the issue to appear:

import React from 'react';

import {
  AppRegistry,
  //Text
} from 'react-native';
import {
  Text
} from 'native-base';

export default class App extends React.Component {
  render() {
    return (
      <Text>Hello World</Text>
    );
  }
}

AppRegistry.registerComponent('whereverly_app', () => App);

However if I remove the reference to NativeBase it all seems to work. Working code:

import React from 'react';

import {
  AppRegistry,
  Text
} from 'react-native';

export default class App extends React.Component {
  render() {
    return (
      <Text>Hello World</Text>
    );
  }
}

AppRegistry.registerComponent('whereverly_app', () => App);

Screenshot of emulator/device

N/A

Is the bug present in both ios and android or in any one of them?

I am only developing on iOS currently.

Any other additional info which would help us debug the issue quicker.

Sorry I can’t be of more help but the issue only appears in production which makes it tricky to track down. I thought it might be something todo with this: https://github.com/facebook/react-native/issues/16567

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 15
  • Comments: 18 (2 by maintainers)

Commits related to this issue

Most upvoted comments

Same here, doing this to be sure:

  • react-native updated from 0.50.0 (working build published on App Store) to 0.50.3
  • rm -rf node_modules/
  • npm i
  • react-native run-ios --configuration=release
  • app crashes after splash screen is shown

this happens again! my package is:

  "dependencies": {
    "@babel/runtime": "^7.1.2",
    "native-base": "^2.8.0",
    "react": "16.5.0",
    "react-native": "0.57.1",
    "react-native-charts-wrapper": "^0.4.8",
    "react-navigation": "^2.17.0"
  },

Uglify-js tag a version 3.1.9 that fix the issue, i can build a with the release flag now, so you can add resolutions like this :

"metro-bundler": "0.20.2",
"color-convert": "1.9.1",
"uglify-js": "3.1.9"

I got the same issue, but it works fine in debug mode

Unfortunately 20.1 didn’t work for us… We are still digging, hope someone finds a fix soon!

I found the solution, just add this code into package.json

"resolutions": {
		"metro-bundler": "0.20.2",
		"color-convert": "1.9.1",
		"uglify-js": "github:alexlamsl/UglifyJS2#issue-2449"
},

And neither 0.20.2

I have the same crash on release but I dont use NativeBase. Created this issue on official repository: https://github.com/facebook/react-native/issues/16745