Nativebase: React Native 0.50.1 - Release Crash

Created on 7 Nov 2017  路  18Comments  路  Source: GeekyAnts/NativeBase

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

Most helpful comment

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

All 18 comments

We are having the same issue spent at least half the day debugging, which wasn鈥檛 really debugging since the error description was so terrible. We need a fix ASAP for this.

0.50 has many changes, including index.android.js and index.ios.js merge. If you upgrade, you need to do a lot of work

@stephenheron @PvanHengel @whevether Can you check through this on Forum
http://discuss.nativebase.io/t/native-base-is-not-setup-with-0-50-version-of-react-native/582

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

I had the same issue but the issue has been resolved for me by adding below to package.json and doing yarn install.

"resolutions": {
        "metro-bundler": "0.20.1"
}

The issue is with metro-bundler and the uglify process. I tried unmangling the minified bundle and the issue was coming from color-convert dependency that NativeBase pulls in as part of the color dependency. But the fix should be in metro-bundler itself and eventually react-native.

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

And neither 0.20.2

Im trying 20.2 now as well... I assume will get the same result as you, fingers crossed though, this is a major blocker.

Agreed 0.20.2 doesn't work either...

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

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

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"
},

Yes! Thanks @naviocean

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 this error, tried adding uglify js not working any other solution?
It works fine in debug mode.

  • React-Native 0.50.4
  • React 16.0.0

Fixed with NativeBase 2.3.5

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"
  },

I'm still getting an error too. I am not 100% certain that nativeBase is the issue but here is the error I'm getting from Android Studio and what versions I am using.

"native-base": "2.8.1",
"native-base-shoutem-theme": "0.2.2",
"prop-types": "^15.6.2",
"react": "16.4.1",
"react-native": "0.56.1",
2018-12-05 12:46:58.940 23769-23822/? E/AndroidRuntime: FATAL EXCEPTION: mqt_native_modules
    Process: com.unrollme, PID: 23769
    com.facebook.react.common.JavascriptException: undefined is not an object (evaluating 'Sn[e]'), stack:
    extractEvents@118:27186
    extractEvents@118:23685
    handleTopLevel@118:27393
    <unknown>@118:28878
    qn@118:28103
    z@118:6018
    perform@119:3484
    batchedUpdates@119:18574
    Ce@118:10516
    Q@118:6049
    K@118:6111
    _receiveRootNodeIDEvent@118:28849
    receiveEvent@118:28961
    value@32:2975
    <unknown>@32:280
    value@32:2426
    callFunctionReturnFlushedQueue@32:252

        at com.facebook.react.modules.core.ExceptionsManagerModule.showOrThrowError(ExceptionsManagerModule.java:54)
        at com.facebook.react.modules.core.ExceptionsManagerModule.reportFatalException(ExceptionsManagerModule.java:38)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
        at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:160)
        at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
        at android.os.Looper.loop(Looper.java:193)
        at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:192)
        at java.lang.Thread.run(Thread.java:764)
Was this page helpful?
0 / 5 - 0 ratings

Related issues

eggybot picture eggybot  路  3Comments

muthuraman007 picture muthuraman007  路  3Comments

aloifolia picture aloifolia  路  3Comments

natashache picture natashache  路  3Comments

kitsune7 picture kitsune7  路  3Comments