如果未在android和iOS上进行调试,则会崩溃

时间:2019-01-20 09:53:05

标签: react-native

环境

  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

说明

当我处于调试状态时,该应用只会给我一个红色的错误屏幕

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/"
    ]
  }
}

错误(firebase崩溃报告)

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

输出(在模拟器上)

screenshot_1547894429

模拟器信息

screenshot_1547894475

电话信息

  • Nexus 5X-8.1.0(相同错误)
  • 一加一(相同错误)

    1. react-native run-ios

输出

调试未激活 simulator screen shot - iphone x - 2019-01-19 at 11 49 11

调试已激活 simulator screen shot - iphone x - 2019-01-19 at 11 49 23

感谢阅读

2 个答案:

答案 0 :(得分:1)

在代码中搜索.replace,并修复导致问题的正则表达式。

不幸的是,这些涉及负面的回溯,而javascript不支持它们。

/(?<!\.|\n)\n/g;.split(/\.|(?<!\.)\n/);

答案 1 :(得分:0)

在对我的代码进行了一些研究之后,并感谢注释(@Andrew和@Michael Ost非常感谢),我可以将问题减少到一页,尤其是减少使用正则表达式负向后查找/超前查找在javascript中受支持。

请参阅以下内容: Error using both lookahead and look behind regex

非常感谢您的帮助