Stacktrace rows now wrap into other line as it made difficult to read it with scroll bars

Summary:
When the stack trace is too long its difficult to read the stack trace as the scroll bar shows up. This diff makes the stack trace text to wrap onto the next line, inorder to avoid scrolling. Look at the attached image, to understand the bug.

{F162756039}

Reviewed By: passy

Differential Revision: D15921226

fbshipit-source-id: f7320951ccdcf531f4276088e3f3ee0f552ab2fc
This commit is contained in:
Pritesh Nandgaonkar
2019-06-21 03:40:18 -07:00
committed by Facebook Github Bot
parent 375e313736
commit c86a6809cb

View File

@@ -21,7 +21,6 @@ import {
getPersistedState, getPersistedState,
BaseDevice, BaseDevice,
shouldParseAndroidLog, shouldParseAndroidLog,
StackTrace,
Text, Text,
colors, colors,
Toolbar, Toolbar,
@@ -115,6 +114,9 @@ const Value = styled(Text)({
maxHeight: 200, maxHeight: 200,
flexGrow: 1, flexGrow: 1,
textOverflow: 'ellipsis', textOverflow: 'ellipsis',
whiteSpace: 'normal',
wordWrap: 'break-word',
lineHeight: 2,
marginLeft: 8, marginLeft: 8,
marginRight: 8, marginRight: 8,
overflow: 'hidden', overflow: 'hidden',
@@ -167,6 +169,11 @@ const StyledSelect = styled(Select)({
maxWidth: 200, maxWidth: 200,
}); });
const StackTraceContainer = styled(FlexColumn)({
backgroundColor: colors.greyStackTraceTint,
flexShrink: 0,
});
export function getNewPersisitedStateFromCrashLog( export function getNewPersisitedStateFromCrashLog(
persistedState: ?PersistedState, persistedState: ?PersistedState,
persistingPlugin: Class<FlipperDevicePlugin<> | FlipperPlugin<>>, persistingPlugin: Class<FlipperDevicePlugin<> | FlipperPlugin<>>,
@@ -483,6 +490,24 @@ class HeaderRow extends Component<HeaderRowProps> {
} }
} }
type StackTraceComponentProps = {
stacktrace: string,
};
class StackTraceComponent extends Component<StackTraceComponentProps> {
render() {
const {stacktrace} = this.props;
return (
<StackTraceContainer>
<Padder paddingTop={8} paddingBottom={2} paddingLeft={8}>
<Value code={true}>{stacktrace}</Value>
</Padder>
<Line />
</StackTraceContainer>
);
}
}
export default class CrashReporterPlugin extends FlipperDevicePlugin< export default class CrashReporterPlugin extends FlipperDevicePlugin<
State, State,
void, void,
@@ -722,12 +747,9 @@ export default class CrashReporterPlugin extends FlipperDevicePlugin<
}, },
]}> ]}>
<Line /> <Line />
<StackTrace {children.map(child => {
children={children} return <StackTraceComponent stacktrace={child.message} />;
isCrash={false} })}
padded={false}
backgroundColor={colors.greyStackTraceTint}
/>
</ContextMenu> </ContextMenu>
</ScrollableColumn> </ScrollableColumn>
</FlexColumn> </FlexColumn>