我正在尝试ErrorUtils.setGlobalHandler
按照这个 github 问题中的描述使用:https : //github.com/facebook/react-native/issues/1194
但是,问题中不清楚的是如何导入ErrorUtils。它不在反应文档中:https : //facebook.github.io/react-native/docs/0.50/getting-started.html
以前,在 RN 0.41 中,我可以使用以下命令导入 ErrorUtils,import ErrorUtils from "ErrorUtils";
但是,在 0.50 中,当我尝试像这样导入 ErrorUtils 时,会收到一个带有以下消息的红色反应弹出窗口:
com.facebook.react.common.JavascriptException: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at 'http://localhost:8081/index.bundle?platform=android&dev=true&minify=false' failed to load.
Run Code Online (Sandbox Code Playgroud)
我也试过,import { ErrorUtils } from 'react-native';
但它似乎不存在那里。错误是:
Cannot read property 'setGlobalHandler' of undefined
Run Code Online (Sandbox Code Playgroud)
如何在 RN 0.50 中正确导入 ErrorUtils?
归档时间: |
|
查看次数: |
4034 次 |
最近记录: |