diff --git a/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js b/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js index a23ee4f0eaf..18a675e94e0 100644 --- a/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js +++ b/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js @@ -62,7 +62,9 @@ function LogBoxInspectorCodeFrame(props: Props): React.Node { }}> {getFileName()} ({codeFrame.location.row}: - {codeFrame.location.column}) + {codeFrame.location.column + + 1 /* Code frame columns are zero indexed */} + ) diff --git a/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js b/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js index c592a3fb9e9..0c4c198cc8c 100644 --- a/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js +++ b/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js @@ -65,11 +65,12 @@ function formatFrameLocation(frame: StackFrame): string { location = location + ':' + lineNumber; - if (column == null) { + if (column == null || isNaN(parseInt(column, 10))) { return location; } - return location + ':' + column; + // Stack frame columns are zero indexed but editors start at one. + return location + ':' + (parseInt(column, 10) + 1); } const styles = StyleSheet.create({ diff --git a/Libraries/LogBox/UI/__tests__/__snapshots__/LogBoxInspectorCodeFrame-test.js.snap b/Libraries/LogBox/UI/__tests__/__snapshots__/LogBoxInspectorCodeFrame-test.js.snap index 76f4a80910b..600c95b2480 100644 --- a/Libraries/LogBox/UI/__tests__/__snapshots__/LogBoxInspectorCodeFrame-test.js.snap +++ b/Libraries/LogBox/UI/__tests__/__snapshots__/LogBoxInspectorCodeFrame-test.js.snap @@ -109,7 +109,7 @@ exports[`LogBoxInspectorCodeFrame should render a code frame 1`] = ` ( 199 : - 0 + 1 ) diff --git a/Libraries/LogBox/UI/__tests__/__snapshots__/LogBoxInspectorStackFrame-test.js.snap b/Libraries/LogBox/UI/__tests__/__snapshots__/LogBoxInspectorStackFrame-test.js.snap index 8d930471317..d1cb91e3bd6 100644 --- a/Libraries/LogBox/UI/__tests__/__snapshots__/LogBoxInspectorStackFrame-test.js.snap +++ b/Libraries/LogBox/UI/__tests__/__snapshots__/LogBoxInspectorStackFrame-test.js.snap @@ -52,7 +52,7 @@ exports[`LogBoxInspectorStackFrame should render collapsed stack frame with dimm ] } > - app.js:1:1 + app.js:1:2 `; @@ -105,7 +105,7 @@ exports[`LogBoxInspectorStackFrame should render stack frame 1`] = ` ] } > - app.js:1:1 + app.js:1:2 `;