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 authored and Facebook Github Bot committed 2019-11-08 08:31:01 -08:00
1 parent 5eddf1d79a
commit fa4f23e4e8
7 files changed
+67 -24

No files matched your search

@@ -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.');
}