skip to Main Content

I have tried multiple solutions provided here in the StackOverflow community. But this error is happening in iOS Release mode only. The app is working fine in Debug mode. Also, this is not happening because of the ViewPropTypes error.

Here is the Crash Log:

    *** Terminating app due to uncaught exception 'RCTFatalException: Unhandled JS Exception: TypeError: undefined is not an object (evaluating 'o.default.Item')', reason: 'Unhandled JS Exception: TypeError: undefined is not an object (evaluating 'o.default.Item'), stack:
<unknown>@1724:1312
h@2:1707
<unknown>@1635:192
h@2:1707
<unknown>@1634:97
h@2:1707
<unknown>@1614:821
h@2:1707
<unknown>@1613:137
h@2:1707
<unknown>@599:1665
h@2:1707
<unknown>@501:603
h@2:1707
<unknown>@385:743
h@2:1707
<unknown>@6:57
h@2:1707
d@2:1080
global code@1817:3
'

Package.json

{
  "name": "***",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint .",
    "postinstall": "patch-package"
  },
  "dependencies": {
    "@react-native-async-storage/async-storage": "^1.17.11",
    "@react-native-community/cli-platform-android": "7.0.1",
    "@react-native-community/datetimepicker": "7.2.0",
    "@react-native-community/netinfo": "^9.3.7",
    "@react-native-firebase/analytics": "^16.4.6",
    "@react-native-firebase/app": "^16.4.6",
    "@react-native-firebase/auth": "^16.4.6",
    "@react-native-firebase/crashlytics": "^16.4.6",
    "@react-native-firebase/firestore": "^16.4.6",
    "@react-native-firebase/functions": "^16.4.6",
    "@react-native-firebase/messaging": "^16.4.6",
    "@react-native-firebase/perf": "^16.4.6",
    "@react-native-firebase/storage": "^16.4.6",
    "@react-native-picker/picker": "2.4.8",
    "@react-navigation/native": "6.0.16",
    "@react-navigation/stack": "6.3.7",
    "@reduxjs/toolkit": "^1.9.1",
    "axios": "^1.2.0",
    "crypto-js": "^4.1.1",
    "deprecated-react-native-prop-types": "^3.0.1",
    "moment": "^2.29.4",
    "patch-package": "^6.5.0",
    "postinstall-postinstall": "^2.1.0",
    "prop-types": "15.8.1",
    "react": "18.1.0",
    "react-native": "0.70.0",
    "react-native-a-beep": "^1.2.0",
    "react-native-autocomplete-input": "^5.2.0",
    "react-native-base64": "^0.2.1",
    "react-native-calendars": "^1.1292.0",
    "react-native-camera": "^4.2.1",
    "react-native-cardview": "^2.0.5",
    "react-native-device-info": "^10.3.0",
    "react-native-dialog": "^9.3.0",
    "react-native-dimension": "^1.0.6",
    "react-native-document-picker": "^8.1.3",
    "react-native-dropdown-autocomplete": "^1.0.18",
    "react-native-event-listeners": "^1.0.7",
    "react-native-exception-handler": "^2.10.10",
    "react-native-fs": "2.20.0",
    "react-native-gesture-handler": "2.9.0",
    "react-native-html-to-pdf": "^0.12.0",
    "react-native-image-picker": "4.8.5",
    "react-native-indicators": "^0.17.0",
    "react-native-keyboard-aware-scroll-view": "^0.9.5",
    "react-native-loading-spinner-overlay": "^3.0.1",
    "react-native-masked-text": "^1.13.0",
    "react-native-material-dropdown-v2": "^0.11.1",
    "react-native-material-menu": "^2.0.0",
    "react-native-material-textfield": "^0.16.1",
    "react-native-modal": "^13.0.1",
    "react-native-modal-dropdown": "^1.0.2",
    "react-native-paper": "4.12.5",
    "react-native-print": "0.10.0",
    "react-native-push-notification": "^8.1.1",
    "react-native-safe-area-context": "4.4.1",
    "react-native-screens": "^3.18.2",
    "react-native-signature-canvas": "^4.5.0",
    "react-native-simple-radio-button": "^2.7.4",
    "react-native-soap-request": "https://github.com/adamski/react-native-soap-request.git",
    "react-native-swipe-gestures": "^1.0.5",
    "react-native-table-component": "^1.2.2",
    "react-native-tiny-toast": "^1.0.7",
    "react-native-vector-icons": "^9.2.0",
    "react-native-version-check": "^3.4.3",
    "react-native-version-number": "^0.3.6",
    "react-native-webview": "^11.25.0",
    "react-native-xml2js": "^1.0.3",
    "react-redux": "^7.2.2",
    "redux-persist": "^6.0.0",
    "rmc-date-picker": "^6.0.10",
    "rn-fetch-blob": "^0.12.0",
    "timers": "^0.1.1",
    "xlsx": "^0.18.5",
    "xml2js": "^0.4.23",
    "xmldom": "^0.6.0"
  },
  "devDependencies": {
    "@babel/core": "^7.8.4",
    "@babel/runtime": "^7.8.4",
    "@react-native-community/eslint-config": "^1.1.0",
    "babel-jest": "^25.1.0",
    "eslint": "^6.5.1",
    "jest": "^25.1.0",
    "metro-react-native-babel-preset": "0.70.3",
    "react-test-renderer": "16.13.1"
  },
  "jest": {
    "preset": "react-native"
  },
  "resolutions": {
    "@react-native-community/cli-platform-android": "3.0.0-alpha.2"
  }
}

2

Answers


  1. Chosen as BEST ANSWER

    Kudos to @Mark Tolmacs for directing me to the right path. A bounty reward is given to him. I have finally found the solution by generating the SourceMaps. For anyone who is facing issues in the iOS or Android release build. Please perform the following steps:

    These steps are for iOS. You can modify the command for Android

    Step 1:

    Generate the map file

    yarn react-native bundle --platform ios --entry-file index.js --dev false --reset-cache --bundle-output /tmp/bundle.ios.js --assets-dest /tmp/ --sourcemap-output index.ios.js.map

    Step 2:

    Install the Stack Beautifier library

    npm install -g stack-beautifier

    Step 3

    Run the terminal command

    stack-beautifier index.ios.js.map -t stacktrace.txt

    Make sure you copy the error in the stacktrace.txt file at the route. In my case I copied the following error

    RCTFatalException: Unhandled JS Exception: TypeError: undefined is not an object (evaluating 'o.default.Item')', reason: 'Unhandled JS Exception: TypeError: undefined is not an object (evaluating 'o.default.Item'), stack:
    <unknown>@1724:1312
    h@2:1707
    <unknown>@1635:192
    h@2:1707
    <unknown>@1634:97
    h@2:1707
    <unknown>@1614:821
    h@2:1707
    <unknown>@1613:137
    h@2:1707
    <unknown>@599:1665
    h@2:1707
    <unknown>@501:603
    h@2:1707
    <unknown>@385:743
    h@2:1707
    <unknown>@6:57
    h@2:1707
    d@2:1080
    global code@1817:3
    

    and the command returned me error in human-readable text

    JS Exception: TypeError: undefined is not an object (evaluating 'o.default.Item'), stack:
      at ./node_modules/rmc-picker/lib/Picker.native.js:32:34
      at factory (./node_modules/metro-runtime/src/polyfills/require.js:339:4)
      at require (./node_modules/rmc-date-picker/lib/DatePicker.js:35:14)
      at factory (./node_modules/metro-runtime/src/polyfills/require.js:339:4)
      at require (./node_modules/rmc-date-picker/lib/index.js:7:18)
      at factory (./node_modules/metro-runtime/src/polyfills/require.js:339:4)
      at _r (./app/routes/InboundConfirmation/InboundConfirmation.js:20:0)
      at factory (./node_modules/metro-runtime/src/polyfills/require.js:339:4)
      at r (./app/routes/InboundConfirmation/index.js:3:0)
      at factory (./node_modules/metro-runtime/src/polyfills/require.js:339:4)
      at _r (./app/config/routes.js:92:0)
      at factory (./node_modules/metro-runtime/src/polyfills/require.js:339:4)
      at _r (./app/config/Layout.js:12:0)
      at factory (./node_modules/metro-runtime/src/polyfills/require.js:339:4)
      at _r (./App.js:21:0)
      at factory (./node_modules/metro-runtime/src/polyfills/require.js:339:4)
      at r (./index.js:6:0)
      at factory (./node_modules/metro-runtime/src/polyfills/require.js:339:4)
      at loadModuleImplementation (./node_modules/metro-runtime/src/polyfills/require.js:200:20)
      at <unknown>
    

    EDIT

    You can also try the official way to generate the SourceMaps given here


  2. The exception is much too vague, so you’d need to enable sourcemaps to diagnose the issue. In your project root folder open up the ios/.xcode.env file and add the SOURCEMAP_FILE environment variable to the end of it:

    export SOURCEMAP_FILE="$(pwd)/../main.jsbundle.map"

    Build your release project and verify that in the root folder you have the main.jsbundle.map file. Run the app and grab the crash log and run symbolication on it:

    npx metro-symbolicate main.jsbundle.map < crashlog.txt

    This way you can identify the exact file and line where the crash originates from. Then you can start debugging the file to understand why the object is empty in release mode.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search