@@ -47,7 +47,7 @@ - (instancetype)initWithFrame:(CGRect)frame
4747#else
4848 self.windowLevel = UIWindowLevelStatusBar - 1 ;
4949#endif
50- self.backgroundColor = [UIColor colorWithRed: 0.8 green: 0 blue: 0 alpha: 1 ];
50+ self.backgroundColor = [UIColor colorWithRed: 0.1 green: 0.1 blue: 0.1 alpha: 1 ];
5151 self.hidden = YES ;
5252
5353 UIViewController *rootController = [UIViewController new ];
@@ -58,7 +58,7 @@ - (instancetype)initWithFrame:(CGRect)frame
5858 const CGFloat buttonHeight = 60 ;
5959
6060 CGRect detailsFrame = rootView.bounds ;
61- detailsFrame.size .height -= buttonHeight;
61+ detailsFrame.size .height -= buttonHeight + [ self bottomSafeViewHeight ] ;
6262
6363 _stackTraceTableView = [[UITableView alloc ] initWithFrame: detailsFrame style: UITableViewStylePlain];
6464 _stackTraceTableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
@@ -73,10 +73,10 @@ - (instancetype)initWithFrame:(CGRect)frame
7373 [rootView addSubview: _stackTraceTableView];
7474
7575#if TARGET_OS_SIMULATOR
76- NSString *reloadText = @" Reload JS (\u2318 R)" ;
77- NSString *dismissText = @" Dismiss (ESC)" ;
78- NSString *copyText = @" Copy (\u2325\u2318 C)" ;
79- NSString *extraText = @" Extra Info (\u2318 E)" ;
76+ NSString *reloadText = @" Reload\n (\u2318 R)" ;
77+ NSString *dismissText = @" Dismiss\n (ESC)" ;
78+ NSString *copyText = @" Copy\n (\u2325\u2318 C)" ;
79+ NSString *extraText = @" Extra Info\n (\u2318 E)" ;
8080#else
8181 NSString *reloadText = @" Reload JS" ;
8282 NSString *dismissText = @" Dismiss" ;
@@ -88,53 +88,85 @@ - (instancetype)initWithFrame:(CGRect)frame
8888 dismissButton.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleRightMargin;
8989 dismissButton.accessibilityIdentifier = @" redbox-dismiss" ;
9090 dismissButton.titleLabel .font = [UIFont systemFontOfSize: 13 ];
91+ dismissButton.titleLabel .lineBreakMode = NSLineBreakByWordWrapping;
92+ dismissButton.titleLabel .textAlignment = NSTextAlignmentCenter;
93+ dismissButton.backgroundColor = [UIColor colorWithRed: 0.1 green: 0.1 blue: 0.1 alpha: 1 ];
9194 [dismissButton setTitle: dismissText forState: UIControlStateNormal];
92- [dismissButton setTitleColor: [UIColor colorWithWhite: 1 alpha: 0.5 ] forState: UIControlStateNormal];
93- [dismissButton setTitleColor: [UIColor whiteColor ] forState: UIControlStateHighlighted];
95+ [dismissButton setTitleColor: [UIColor whiteColor ] forState: UIControlStateNormal];
96+ [dismissButton setTitleColor: [UIColor colorWithWhite: 1 alpha: 0.5 ] forState: UIControlStateHighlighted];
9497 [dismissButton addTarget: self action: @selector (dismiss ) forControlEvents: UIControlEventTouchUpInside];
9598
9699 UIButton *reloadButton = [UIButton buttonWithType: UIButtonTypeCustom];
97100 reloadButton.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleLeftMargin;
98101 reloadButton.accessibilityIdentifier = @" redbox-reload" ;
99102 reloadButton.titleLabel .font = [UIFont systemFontOfSize: 13 ];
100-
103+ reloadButton.titleLabel .lineBreakMode = NSLineBreakByWordWrapping;
104+ reloadButton.titleLabel .textAlignment = NSTextAlignmentCenter;
105+ reloadButton.backgroundColor = [UIColor colorWithRed: 0.1 green: 0.1 blue: 0.1 alpha: 1 ];
101106 [reloadButton setTitle: reloadText forState: UIControlStateNormal];
102- [reloadButton setTitleColor: [UIColor colorWithWhite: 1 alpha: 0.5 ] forState: UIControlStateNormal];
103- [reloadButton setTitleColor: [UIColor whiteColor ] forState: UIControlStateHighlighted];
107+ [reloadButton setTitleColor: [UIColor whiteColor ] forState: UIControlStateNormal];
108+ [reloadButton setTitleColor: [UIColor colorWithWhite: 1 alpha: 0.5 ] forState: UIControlStateHighlighted];
104109 [reloadButton addTarget: self action: @selector (reload ) forControlEvents: UIControlEventTouchUpInside];
105110
106111 UIButton *copyButton = [UIButton buttonWithType: UIButtonTypeCustom];
107112 copyButton.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleLeftMargin;
108113 copyButton.accessibilityIdentifier = @" redbox-copy" ;
109114 copyButton.titleLabel .font = [UIFont systemFontOfSize: 13 ];
115+ copyButton.titleLabel .lineBreakMode = NSLineBreakByWordWrapping;
116+ copyButton.titleLabel .textAlignment = NSTextAlignmentCenter;
117+ copyButton.backgroundColor = [UIColor colorWithRed: 0.1 green: 0.1 blue: 0.1 alpha: 1 ];
110118 [copyButton setTitle: copyText forState: UIControlStateNormal];
111- [copyButton setTitleColor: [UIColor colorWithWhite: 1 alpha: 0.5 ] forState: UIControlStateNormal];
112- [copyButton setTitleColor: [UIColor whiteColor ] forState: UIControlStateHighlighted];
119+ [copyButton setTitleColor: [UIColor whiteColor ] forState: UIControlStateNormal];
120+ [copyButton setTitleColor: [UIColor colorWithWhite: 1 alpha: 0.5 ] forState: UIControlStateHighlighted];
113121 [copyButton addTarget: self action: @selector (copyStack ) forControlEvents: UIControlEventTouchUpInside];
114122
115123 UIButton *extraButton = [UIButton buttonWithType: UIButtonTypeCustom];
116124 extraButton.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleLeftMargin;
117125 extraButton.accessibilityIdentifier = @" redbox-extra" ;
118126 extraButton.titleLabel .font = [UIFont systemFontOfSize: 13 ];
127+ extraButton.titleLabel .lineBreakMode = NSLineBreakByWordWrapping;
128+ extraButton.titleLabel .textAlignment = NSTextAlignmentCenter;
129+ extraButton.backgroundColor = [UIColor colorWithRed: 0.1 green: 0.1 blue: 0.1 alpha: 1 ];
119130 [extraButton setTitle: extraText forState: UIControlStateNormal];
120- [extraButton setTitleColor: [UIColor colorWithWhite: 1 alpha: 0.5 ] forState: UIControlStateNormal];
121- [extraButton setTitleColor: [UIColor whiteColor ] forState: UIControlStateHighlighted];
131+ [extraButton setTitleColor: [UIColor whiteColor ] forState: UIControlStateNormal];
132+ [extraButton setTitleColor: [UIColor colorWithWhite: 1 alpha: 0.5 ] forState: UIControlStateHighlighted];
122133 [extraButton addTarget: self action: @selector (showExtraDataViewController ) forControlEvents: UIControlEventTouchUpInside];
123134
124135 CGFloat buttonWidth = self.bounds .size .width / 4 ;
125- dismissButton.frame = CGRectMake (0 , self.bounds .size .height - buttonHeight, buttonWidth, buttonHeight);
126- reloadButton.frame = CGRectMake (buttonWidth, self.bounds .size .height - buttonHeight, buttonWidth, buttonHeight);
127- copyButton.frame = CGRectMake (buttonWidth * 2 , self.bounds .size .height - buttonHeight, buttonWidth, buttonHeight);
128- extraButton.frame = CGRectMake (buttonWidth * 3 , self.bounds .size .height - buttonHeight, buttonWidth, buttonHeight);
136+ CGFloat bottomButtonHeight = self.bounds .size .height - buttonHeight - [self bottomSafeViewHeight ];
137+
138+ dismissButton.frame = CGRectMake (0 , bottomButtonHeight, buttonWidth, buttonHeight);
139+ reloadButton.frame = CGRectMake (buttonWidth, bottomButtonHeight, buttonWidth, buttonHeight);
140+ copyButton.frame = CGRectMake (buttonWidth * 2 , bottomButtonHeight, buttonWidth, buttonHeight);
141+ extraButton.frame = CGRectMake (buttonWidth * 3 , bottomButtonHeight, buttonWidth, buttonHeight);
142+
143+ UIView *topBorder = [[UIView alloc ] initWithFrame: CGRectMake (0 , bottomButtonHeight + 1 , rootView.frame.size.width, 1 )];
144+ topBorder.backgroundColor = [UIColor colorWithRed: 0.70 green: 0.70 blue: 0.70 alpha: 1.0 ];
129145
130146 [rootView addSubview: dismissButton];
131147 [rootView addSubview: reloadButton];
132148 [rootView addSubview: copyButton];
133149 [rootView addSubview: extraButton];
150+ [rootView addSubview: topBorder];
151+
152+ UIView *bottomSafeView = [UIView new ];
153+ bottomSafeView.backgroundColor = [UIColor colorWithRed: 0.1 green: 0.1 blue: 0.1 alpha: 1 ];
154+ bottomSafeView.frame = CGRectMake (0 , self.bounds .size .height - [self bottomSafeViewHeight ], self.bounds .size .width , [self bottomSafeViewHeight ]);
155+
156+ [rootView addSubview: bottomSafeView];
134157 }
135158 return self;
136159}
137160
161+ - (NSInteger )bottomSafeViewHeight
162+ {
163+ if (@available (iOS 11.0 , *)) {
164+ return [UIApplication sharedApplication ].delegate .window .safeAreaInsets .bottom ;
165+ } else {
166+ return 0 ;
167+ }
168+ }
169+
138170RCT_NOT_IMPLEMENTED (- (instancetype )initWithCoder:(NSCoder *)aDecoder)
139171
140172- (void )dealloc
@@ -247,14 +279,14 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
247279- (UITableViewCell *)reuseCell : (UITableViewCell *)cell forErrorMessage : (NSString *)message
248280{
249281 if (!cell) {
250- cell = [[UITableViewCell alloc ] initWithStyle: UITableViewCellStyleSubtitle reuseIdentifier: @" msg-cell" ];
282+ cell = [[UITableViewCell alloc ] initWithStyle: UITableViewCellStyleDefault reuseIdentifier: @" msg-cell" ];
251283 cell.textLabel .accessibilityIdentifier = @" redbox-error" ;
252284 cell.textLabel .textColor = [UIColor whiteColor ];
253285 cell.textLabel .font = [UIFont boldSystemFontOfSize: 16 ];
254286 cell.textLabel .lineBreakMode = NSLineBreakByWordWrapping;
255287 cell.textLabel .numberOfLines = 0 ;
256288 cell.detailTextLabel .textColor = [UIColor whiteColor ];
257- cell.backgroundColor = [UIColor clearColor ];
289+ cell.backgroundColor = [UIColor colorWithRed: 0.82 green: 0.10 blue: 0.15 alpha: 1.0 ];
258290 cell.selectionStyle = UITableViewCellSelectionStyleNone;
259291 }
260292
@@ -267,11 +299,11 @@ - (UITableViewCell *)reuseCell:(UITableViewCell *)cell forStackFrame:(RCTJSStack
267299{
268300 if (!cell) {
269301 cell = [[UITableViewCell alloc ] initWithStyle: UITableViewCellStyleSubtitle reuseIdentifier: @" cell" ];
270- cell.textLabel .textColor = [UIColor colorWithWhite: 1 alpha: 0.9 ];
302+ cell.textLabel .textColor = [UIColor whiteColor ];
271303 cell.textLabel .font = [UIFont fontWithName: @" Menlo-Regular" size: 14 ];
272304 cell.textLabel .lineBreakMode = NSLineBreakByCharWrapping;
273305 cell.textLabel .numberOfLines = 2 ;
274- cell.detailTextLabel .textColor = [UIColor colorWithWhite: 1 alpha :0.7 ];
306+ cell.detailTextLabel .textColor = [UIColor colorWithRed: 0.70 green :0.70 blue: 0.70 alpha: 1.0 ];
275307 cell.detailTextLabel .font = [UIFont fontWithName: @" Menlo-Regular" size: 11 ];
276308 cell.detailTextLabel .lineBreakMode = NSLineBreakByTruncatingMiddle;
277309 cell.backgroundColor = [UIColor clearColor ];
0 commit comments