@@ -48,7 +48,6 @@ - (void)viewDidLoad
4848 messageLabel.font = [UIFont boldSystemFontOfSize: 16 ];
4949 messageLabel.textColor = [RCTUIColor blackColor ]; // [macOS]
5050 messageLabel.translatesAutoresizingMaskIntoConstraints = NO ;
51-
5251 RCTUIView *messageContainer = [[RCTUIView alloc ] init ]; // [macOS]
5352 [messageContainer addSubview: messageLabel];
5453 [NSLayoutConstraint activateConstraints: @[
@@ -81,13 +80,13 @@ - (void)viewDidLoad
8180#if !TARGET_OS_OSX // [macOS]
8281 UIStackView *stackView = [[UIStackView alloc ] initWithArrangedSubviews: @[ messageContainer, resumeButton ]];
8382 stackView.backgroundColor = [UIColor colorWithRed: 1 green: 1 blue: 0.757 alpha: 1 ];
84- stackView.axis = UILayoutConstraintAxisHorizontal;
85- stackView.distribution = UIStackViewDistributionFill;
86- stackView.alignment = UIStackViewAlignmentCenter;
8783 stackView.layer .cornerRadius = 12 ;
8884 stackView.layer .borderWidth = 2 ;
8985 stackView.layer .borderColor = [UIColor colorWithRed: 0.71 green: 0.71 blue: 0.62 alpha: 1 ].CGColor ;
9086 stackView.translatesAutoresizingMaskIntoConstraints = NO ;
87+ stackView.axis = UILayoutConstraintAxisHorizontal;
88+ stackView.distribution = UIStackViewDistributionFill;
89+ stackView.alignment = UIStackViewAlignmentCenter;
9190
9291 UITapGestureRecognizer *gestureRecognizer = [[UITapGestureRecognizer alloc ] initWithTarget: self
9392 action: @selector (handleResume: )];
@@ -97,10 +96,10 @@ - (void)viewDidLoad
9796 NSStackView *stackView = [NSStackView stackViewWithViews: @[ messageContainer, resumeButton ]];
9897 stackView.wantsLayer = YES ;
9998 stackView.layer .backgroundColor = [NSColor colorWithRed: 1 green: 1 blue: 0.757 alpha: 1 ].CGColor ;
99+ stackView.translatesAutoresizingMaskIntoConstraints = NO ;
100100 stackView.orientation = NSUserInterfaceLayoutOrientationHorizontal;
101101 stackView.distribution = NSStackViewDistributionFill;
102102 stackView.alignment = NSLayoutAttributeCenterY;
103- stackView.translatesAutoresizingMaskIntoConstraints = NO ;
104103
105104 NSClickGestureRecognizer *gestureRecognizer = [[NSClickGestureRecognizer alloc ] initWithTarget: self
106105 action: @selector (handleResume: )];
@@ -112,11 +111,7 @@ - (void)viewDidLoad
112111
113112 [NSLayoutConstraint activateConstraints: @[
114113 [stackView.topAnchor constraintEqualToAnchor: self .view.safeAreaLayoutGuide.topAnchor constant: 12 ],
115- [stackView.topAnchor constraintEqualToAnchor: self .view.topAnchor constant: 20 ],
116- [stackView.leadingAnchor constraintEqualToAnchor: self .view.leadingAnchor constant: 20 ],
117- [stackView.trailingAnchor constraintEqualToAnchor: self .view.trailingAnchor constant: -20 ],
118- [stackView.bottomAnchor constraintEqualToAnchor: self .view.bottomAnchor constant: -20 ],
119- [stackView.centerXAnchor constraintEqualToAnchor: self .view.centerXAnchor],
114+ [stackView.centerXAnchor constraintEqualToAnchor: self .view.safeAreaLayoutGuide.centerXAnchor],
120115 ]];
121116#else
122117 [self setView: stackView];
@@ -172,15 +167,17 @@ - (void)showWithMessage:(NSString *)message onResume:(void (^)(void))onResume
172167 [self hide ];
173168
174169 RCTPausedInDebuggerViewController *view = [[RCTPausedInDebuggerViewController alloc ] init ];
170+ #if !TARGET_OS_OSX // [macOS]
171+ view.modalPresentationStyle = UIModalPresentationOverFullScreen;
175172 view.message = message;
176173 view.onResume = onResume;
177174
178- #if !TARGET_OS_OSX // [macOS]
179- view.modalPresentationStyle = UIModalPresentationOverFullScreen;
180175 [self .alertWindow makeKeyAndVisible ];
181176 [self .alertWindow.rootViewController presentViewController: view animated: NO completion: nil ];
182177#else // [macOS]
183178 self.alertWindow .contentViewController = view;
179+ view.message = message;
180+ view.onResume = onResume;
184181
185182 NSWindow *parentWindow = RCTKeyWindow ();
186183 if (![[parentWindow sheets ] doesContain: self ->_alertWindow]) {
@@ -195,8 +192,8 @@ - (void)hide
195192{
196193#if !TARGET_OS_OSX // [macOS]
197194 [_alertWindow setHidden: YES ];
195+
198196 _alertWindow.windowScene = nil ;
199- _alertWindow = nil ;
200197#else // [macOS]
201198 NSWindow *parentWindow = RCTKeyWindow ();
202199 if (parentWindow) {
@@ -207,8 +204,9 @@ - (void)hide
207204 }
208205 }
209206 }
210- _alertWindow = nil ;
211207#endif // macOS]
208+
209+ _alertWindow = nil ;
212210}
213211
214212@end
0 commit comments