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:
Christoph Nakazawa
2019-11-08 08:31:01 -08:00
committed by Facebook Github Bot
parent 5eddf1d79a
commit fa4f23e4e8
7 changed files with 67 additions and 24 deletions
@@ -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.');
}