Q:

Crash if not in debug on android and iOS

Environment
  React Native Environment Info:
    System:
      OS: macOS High Sierra 10.13.6
      CPU: (4) x64 Intel(R) Core(TM) i5-7267U CPU @ 3.10GHz
      Memory: 133.91 MB / 16.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 8.11.2 - ~/.nvm/versions/node/v8.11.2/bin/node
      Yarn: 1.9.4 - /usr/local/bin/yarn
      npm: 5.6.0 - ~/.nvm/versions/node/v8.11.2/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
      Android SDK:
        API Levels: 17, 21, 23, 25, 26, 27
        Build Tools: 23.0.1, 23.0.3, 24.0.1, 25.0.0, 25.0.2, 25.0.3, 26.0.1, 26.0.2, 26.0.3, 27.0.1, 27.0.3, 28.0.2, 28.0.3
        System Images: android-25 | Google APIs Intel x86 Atom_64
    IDEs:
      Android Studio: 3.2 AI-181.5540.7.32.5056338
      Xcode: 10.1/10B61 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.6.3 => 16.6.3
      react-native: 0.57.8 => 0.57.8

Description
When I am in debug, the app just gives me a red screen of error
package.json
{
  "name": "xxx",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "lodash": "^4.17.11",
    "react": "16.6.3",
    "react-native": "0.57.8",
    "react-native-file-selector": "^0.0.6",
    "react-native-firebase": "^5.2.0",
    "react-native-fs": "^2.13.3",
    "react-native-languages": "^3.0.2",
    "react-native-tts": "^2.0.0",
    "react-native-vector-icons": "^6.1.0",
    "react-navigation": "2.18.2"
  },
  "devDependencies": {
    "babel-jest": "23.6.0",
    "jest": "23.6.0",
    "metro-react-native-babel-preset": "0.51.1",
    "react-test-renderer": "16.6.3"
  },
  "jest": {
    "preset": "react-native"
  },
  "rnpm": {
    "assets": [
      "./resources/fonts/"
    ]
  }
}

Error (firebase crash report)
Caused by com.facebook.jni.CppException
Invalid regular expression: unrecognized character after (? (index.android.bundle:462)
com.facebook.react.bridge.queue.NativeRunnable.run

Output (on simulator)

Simulator info

Phone info

Nexus 5X - 8.1.0 (same error)
One Plus One (same error)

react-native run-ios

Output
Debug not activated

Debug activated

Thanks for reading  

A:

Search your code for .replace and fix the regular expression that is causing you the issue.
Unfortunately these involve negative lookbehinds and javascript  does not support them
/(?<!\.|\n)\n/g; and .split(/\.|(?<!\.)\n/);

