@@ -48,7 +48,6 @@ - (void)viewDidLoad
48
48
messageLabel.font = [UIFont boldSystemFontOfSize: 16 ];
49
49
messageLabel.textColor = [RCTUIColor blackColor ]; // [macOS]
50
50
messageLabel.translatesAutoresizingMaskIntoConstraints = NO ;
51
-
52
51
RCTUIView *messageContainer = [[RCTUIView alloc ] init ]; // [macOS]
53
52
[messageContainer addSubview: messageLabel];
54
53
[NSLayoutConstraint activateConstraints: @[
@@ -85,13 +84,13 @@ - (void)viewDidLoad
85
84
#if !TARGET_OS_OSX // [macOS]
86
85
UIStackView *stackView = [[UIStackView alloc ] initWithArrangedSubviews: @[ messageContainer, resumeButton ]];
87
86
stackView.backgroundColor = [UIColor colorWithRed: 1 green: 1 blue: 0.757 alpha: 1 ];
88
- stackView.axis = UILayoutConstraintAxisHorizontal;
89
- stackView.distribution = UIStackViewDistributionFill;
90
- stackView.alignment = UIStackViewAlignmentCenter;
91
87
stackView.layer .cornerRadius = 12 ;
92
88
stackView.layer .borderWidth = 2 ;
93
89
stackView.layer .borderColor = [UIColor colorWithRed: 0.71 green: 0.71 blue: 0.62 alpha: 1 ].CGColor ;
94
90
stackView.translatesAutoresizingMaskIntoConstraints = NO ;
91
+ stackView.axis = UILayoutConstraintAxisHorizontal;
92
+ stackView.distribution = UIStackViewDistributionFill;
93
+ stackView.alignment = UIStackViewAlignmentCenter;
95
94
96
95
UITapGestureRecognizer *gestureRecognizer = [[UITapGestureRecognizer alloc ] initWithTarget: self
97
96
action: @selector (handleResume: )];
@@ -101,10 +100,10 @@ - (void)viewDidLoad
101
100
NSStackView *stackView = [NSStackView stackViewWithViews: @[ messageContainer, resumeButton ]];
102
101
stackView.wantsLayer = YES ;
103
102
stackView.layer .backgroundColor = [NSColor colorWithRed: 1 green: 1 blue: 0.757 alpha: 1 ].CGColor ;
103
+ stackView.translatesAutoresizingMaskIntoConstraints = NO ;
104
104
stackView.orientation = NSUserInterfaceLayoutOrientationHorizontal;
105
105
stackView.distribution = NSStackViewDistributionFill;
106
106
stackView.alignment = NSLayoutAttributeCenterY;
107
- stackView.translatesAutoresizingMaskIntoConstraints = NO ;
108
107
109
108
NSClickGestureRecognizer *gestureRecognizer = [[NSClickGestureRecognizer alloc ] initWithTarget: self
110
109
action: @selector (handleResume: )];
@@ -116,11 +115,7 @@ - (void)viewDidLoad
116
115
117
116
[NSLayoutConstraint activateConstraints: @[
118
117
[stackView.topAnchor constraintEqualToAnchor: self .view.safeAreaLayoutGuide.topAnchor constant: 12 ],
119
- [stackView.topAnchor constraintEqualToAnchor: self .view.topAnchor constant: 20 ],
120
- [stackView.leadingAnchor constraintEqualToAnchor: self .view.leadingAnchor constant: 20 ],
121
- [stackView.trailingAnchor constraintEqualToAnchor: self .view.trailingAnchor constant: -20 ],
122
- [stackView.bottomAnchor constraintEqualToAnchor: self .view.bottomAnchor constant: -20 ],
123
- [stackView.centerXAnchor constraintEqualToAnchor: self .view.centerXAnchor],
118
+ [stackView.centerXAnchor constraintEqualToAnchor: self .view.safeAreaLayoutGuide.centerXAnchor],
124
119
]];
125
120
#else
126
121
[self setView: stackView];
@@ -176,15 +171,17 @@ - (void)showWithMessage:(NSString *)message onResume:(void (^)(void))onResume
176
171
[self hide ];
177
172
178
173
RCTPausedInDebuggerViewController *view = [[RCTPausedInDebuggerViewController alloc ] init ];
174
+ #if !TARGET_OS_OSX // [macOS]
175
+ view.modalPresentationStyle = UIModalPresentationOverFullScreen;
179
176
view.message = message;
180
177
view.onResume = onResume;
181
178
182
- #if !TARGET_OS_OSX // [macOS]
183
- view.modalPresentationStyle = UIModalPresentationOverFullScreen;
184
179
[self .alertWindow makeKeyAndVisible ];
185
180
[self .alertWindow.rootViewController presentViewController: view animated: NO completion: nil ];
186
181
#else // [macOS]
187
182
self.alertWindow .contentViewController = view;
183
+ view.message = message;
184
+ view.onResume = onResume;
188
185
189
186
NSWindow *parentWindow = RCTKeyWindow ();
190
187
if (![[parentWindow sheets ] doesContain: self ->_alertWindow]) {
@@ -199,8 +196,8 @@ - (void)hide
199
196
{
200
197
#if !TARGET_OS_OSX // [macOS]
201
198
[_alertWindow setHidden: YES ];
199
+
202
200
_alertWindow.windowScene = nil ;
203
- _alertWindow = nil ;
204
201
#else // [macOS]
205
202
NSWindow *parentWindow = RCTKeyWindow ();
206
203
if (parentWindow) {
@@ -211,8 +208,9 @@ - (void)hide
211
208
}
212
209
}
213
210
}
214
- _alertWindow = nil ;
215
211
#endif // macOS]
212
+
213
+ _alertWindow = nil ;
216
214
}
217
215
218
216
@end
0 commit comments