truncate redbox error

Summary: If a redbox error is too long it's not shown at all:
{F24443416}
This diff truncates it to its first 10000 chars, which should be good enough:
{F24443417}

The reason is a limitation of UILabel which backs text property on the used UITableViewCell.
Ideally we would use a custom cell with UITextView, but I don't feel there is any value in displaying super long error messages in a redbox.

public

Reviewed By: jspahrsummers, nicklockwood

Differential Revision: D2690638

fb-gh-sync-id: d9b3fcecd2602e8c2618afe1bb97221c2e506605
This commit is contained in:
Martin Kralik 2015-11-24 06:28:08 -08:00 committed by facebook-github-bot-7
parent cb3c5c8447
commit c324286fb7
1 changed files with 2 additions and 1 deletions

View File

@ -107,7 +107,8 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder)
{
if ((self.hidden && shouldShow) || (!self.hidden && [_lastErrorMessage isEqualToString:message])) {
_lastStackTrace = stack;
_lastErrorMessage = message;
// message is displayed using UILabel, which is unable to render text of unlimited length, so we truncate it
_lastErrorMessage = [message substringToIndex:MIN(10000, message.length)];
[_stackTraceTableView reloadData];