Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b450e36

Browse files
nicklockwoodfacebook-github-bot-4
authored and
facebook-github-bot-4
committed
Fixed chrome debug persistence + crash
Reviewed By: @tadeuzagallo Differential Revision: D2443181
1 parent 07e6039 commit b450e36

File tree

2 files changed

+13
-19
lines changed

2 files changed

+13
-19
lines changed

React/Modules/RCTDevMenu.m

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,6 @@ - (instancetype)init
176176
name:RCTJavaScriptDidLoadNotification
177177
object:nil];
178178

179-
[notificationCenter addObserver:self
180-
selector:@selector(jsLoaded:)
181-
name:RCTJavaScriptDidFailToLoadNotification
182-
object:nil];
183-
184179
_defaults = [NSUserDefaults standardUserDefaults];
185180
_settings = [[NSMutableDictionary alloc] initWithDictionary:[_defaults objectForKey:RCTDevMenuSettingsKey]];
186181
_extraMenuItems = [NSMutableArray new];
@@ -271,6 +266,8 @@ - (void)settingsDidChange
271266
*/
272267
- (void)updateSettings:(NSDictionary *)settings
273268
{
269+
[_settings setDictionary:settings];
270+
274271
// Fire handlers for items whose values have changed
275272
for (RCTDevMenuItem *item in _extraMenuItems) {
276273
if (item.key) {
@@ -282,11 +279,6 @@ - (void)updateSettings:(NSDictionary *)settings
282279
}
283280
}
284281

285-
if ([settings isEqualToDictionary:_settings]) {
286-
return;
287-
}
288-
289-
[_settings setDictionary:settings];
290282
self.shakeToShow = [_settings[@"shakeToShow"] ?: @YES boolValue];
291283
self.profilingEnabled = [_settings[@"profilingEnabled"] ?: @NO boolValue];
292284
self.liveReloadEnabled = [_settings[@"liveReloadEnabled"] ?: @NO boolValue];

React/Modules/RCTRedBox.m

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#if RCT_DEBUG
1818

1919
@interface RCTRedBoxWindow : UIWindow <UITableViewDelegate, UITableViewDataSource>
20-
2120
@end
2221

2322
@implementation RCTRedBoxWindow
@@ -77,13 +76,6 @@ - (instancetype)initWithFrame:(CGRect)frame
7776
reloadButton.frame = CGRectMake(buttonWidth, self.bounds.size.height - buttonHeight, buttonWidth, buttonHeight);
7877
[rootView addSubview:dismissButton];
7978
[rootView addSubview:reloadButton];
80-
81-
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
82-
83-
[notificationCenter addObserver:self
84-
selector:@selector(dismiss)
85-
name:RCTReloadNotification
86-
object:nil];
8779
}
8880
return self;
8981
}
@@ -261,6 +253,9 @@ - (BOOL)canBecomeFirstResponder
261253

262254
@end
263255

256+
@interface RCTRedBox () <RCTInvalidating>
257+
@end
258+
264259
@implementation RCTRedBox
265260
{
266261
RCTRedBoxWindow *_window;
@@ -309,7 +304,14 @@ - (void)showErrorMessage:(NSString *)message withStack:(NSArray *)stack showIfHi
309304

310305
- (void)dismiss
311306
{
312-
[_window dismiss];
307+
dispatch_async(dispatch_get_main_queue(), ^{
308+
[_window dismiss];
309+
});
310+
}
311+
312+
- (void)invalidate
313+
{
314+
[self dismiss];
313315
}
314316

315317
@end

0 commit comments

Comments
 (0)