mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Add codeFrame to each warning and error in LogBox
Summary: This diff changes the LogBox to show the code frame for the first non-collapsed stack frame. Let me know what you think about this change! Changelog: [Internal] LogBox changes Reviewed By: rickhanlonii Differential Revision: D18372456 fbshipit-source-id: ddf6d6c53ab28d11d8355f4cb1cb071a00a7366e
This commit is contained in:
committed by
Facebook Github Bot
parent
5eddf1d79a
commit
fa4f23e4e8
@@ -13,6 +13,7 @@
|
||||
const symbolicateStackTrace = require('../../Core/Devtools/symbolicateStackTrace');
|
||||
|
||||
import type {StackFrame} from '../../Core/NativeExceptionsManager';
|
||||
import type {SymbolicatedStackTrace} from '../../Core/Devtools/symbolicateStackTrace';
|
||||
|
||||
type CacheKey = string;
|
||||
|
||||
@@ -45,7 +46,8 @@ const getCacheKey = (stack: Stack): CacheKey => {
|
||||
/**
|
||||
* Sanitize because sometimes, `symbolicateStackTrace` gives us invalid values.
|
||||
*/
|
||||
const sanitize = (maybeStack: mixed): Stack => {
|
||||
const sanitize = (data: SymbolicatedStackTrace): Stack => {
|
||||
const maybeStack = data?.stack;
|
||||
if (!Array.isArray(maybeStack)) {
|
||||
throw new Error('Expected stack to be an array.');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user