代码之家  ›  专栏  ›  技术社区  ›  Clad Clad

如果未在Android和iOS上调试,则崩溃

  •  2
  • Clad Clad  · 技术社区  · 6 年前

    环境

      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
    

    描述

    当我进行调试时,应用程序只会给我一个红色的错误屏幕。

    包装袋

    {
      "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 回复  |  直到 6 年前
        1
  •  1
  •   Andrew    6 年前

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

    不幸的是,这涉及到负面的lookbehind,而javascript不支持它们。

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

        2
  •  0
  •   Clad Clad    6 年前

    在对我的代码进行了一些研究之后,由于注释(@andrew和@michael ost,非常感谢您),我可以将问题减少到一个页面,尤其是使用JavaScript不支持的regex negative lookback/lookahead。

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

    非常感谢你的帮助