Debugging 调试react native时,如何获得有用的调用堆栈信息?
当我尝试调试react native时,通常是这样的Debugging 调试react native时,如何获得有用的调用堆栈信息?,debugging,reactjs,react-native,Debugging,Reactjs,React Native,当我尝试调试react native时,通常是这样的 at ReactCompositeComponentWrapper._renderValidatedComponentWithoutOwnerOrContext (ReactCompositeComponent.js:785) at ReactCompositeComponentWrapper._renderValidatedComponent (ReactCompositeComponent.js:811) at ReactComposit
at ReactCompositeComponentWrapper._renderValidatedComponentWithoutOwnerOrContext (ReactCompositeComponent.js:785)
at ReactCompositeComponentWrapper._renderValidatedComponent (ReactCompositeComponent.js:811)
at ReactCompositeComponentWrapper._updateRenderedComponent (ReactCompositeComponent.js:735)
at ReactCompositeComponentWrapper._performComponentUpdate (ReactCompositeComponent.js:715)
at ReactCompositeComponentWrapper.updateComponent (ReactCompositeComponent.js:634)
at ReactCompositeComponentWrapper.receiveComponent (ReactCompositeComponent.js:534)
at Object.receiveComponent (ReactReconciler.js:131)
at ReactCompositeComponentWrapper._updateRenderedComponent (ReactCompositeComponent.js:737)
没有有用的信息,如果我使用debugger
命令查看是什么启动了50深度调用堆栈,那么它几乎总是归结为'debuggerWorker.js'中的onmessage
方法,几乎没有任何用处。
如何真正调试react本机应用程序
onmessage = function(message) {
var object = message.data;
var sendReply = function(result) {
postMessage({replyID: object.id, result: result});
};
var handler = messageHandlers[object.method];
if (handler) {
// Special cased handlers
handler(object, sendReply);
} else {
// Other methods get called on the bridge
var returnValue = [[], [], [], 0];
try {
if (typeof __fbBatchedBridge === 'object') {
returnValue = __fbBatchedBridge[object.method].apply(null, object.arguments);
}
} finally {
sendReply(JSON.stringify(returnValue));
}
}
};
我倾向于使用堆栈跟踪来找出错误发生的一般区域,然后使用web调试器来实际找出错误所在 它实际上相当不错,您可以在chrome开发工具的sources选项卡中打开所有js文件,然后放入调试点,只需逐步浏览文件并查看变量