|
@@ -143,7 +143,7 @@ RCT_EXPORT_MODULE(RCCManager);
|
143
|
143
|
-(void)dismissAllModalPresenters:(NSMutableArray*)allPresentedViewControllers resolver:(RCTPromiseResolveBlock)resolve
|
144
|
144
|
{
|
145
|
145
|
UIViewController *rootViewController = [UIApplication sharedApplication].delegate.window.rootViewController;
|
146
|
|
-
|
|
146
|
+
|
147
|
147
|
if (allPresentedViewControllers.count > 0)
|
148
|
148
|
{
|
149
|
149
|
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0),^
|
|
@@ -205,25 +205,26 @@ RCT_EXPORT_MODULE(RCCManager);
|
205
|
205
|
#pragma mark - RCT exported methods
|
206
|
206
|
|
207
|
207
|
RCT_EXPORT_METHOD(
|
208
|
|
- setRootController:(NSDictionary*)layout animationType:(NSString*)animationType globalProps:(NSDictionary*)globalProps)
|
|
208
|
+ setRootController:(NSDictionary*)layout animationType:(NSString*)animationType globalProps:(NSDictionary*)globalProps resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
|
209
|
209
|
{
|
210
|
210
|
if ([[RCCManager sharedInstance] getBridge].loading) {
|
211
|
|
- [self deferSetRootControllerWhileBridgeLoading:layout animationType:animationType globalProps:globalProps];
|
|
211
|
+ [self deferSetRootControllerWhileBridgeLoading:layout animationType:animationType globalProps:globalProps resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject];
|
212
|
212
|
return;
|
213
|
213
|
}
|
214
|
214
|
|
215
|
215
|
dispatch_async(dispatch_get_main_queue(), ^{
|
216
|
216
|
[self performSetRootController:layout animationType:animationType globalProps:globalProps];
|
|
217
|
+ resolve(nil);
|
217
|
218
|
});
|
218
|
219
|
}
|
219
|
220
|
|
220
|
221
|
/**
|
221
|
222
|
* on RN31 there's a timing issue, we must wait for the bridge to finish loading
|
222
|
223
|
*/
|
223
|
|
--(void)deferSetRootControllerWhileBridgeLoading:(NSDictionary*)layout animationType:(NSString*)animationType globalProps:(NSDictionary*)globalProps
|
|
224
|
+-(void)deferSetRootControllerWhileBridgeLoading:(NSDictionary*)layout animationType:(NSString*)animationType globalProps:(NSDictionary*)globalProps resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject
|
224
|
225
|
{
|
225
|
226
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.0001 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
226
|
|
- [self setRootController:layout animationType:animationType globalProps:globalProps];
|
|
227
|
+ [self setRootController:layout animationType:animationType globalProps:globalProps resolver:resolve rejecter:reject];
|
227
|
228
|
});
|
228
|
229
|
}
|
229
|
230
|
|
|
@@ -421,7 +422,7 @@ RCT_EXPORT_METHOD(
|
421
|
422
|
}
|
422
|
423
|
else
|
423
|
424
|
{
|
424
|
|
- resolve(nil);
|
|
425
|
+ resolve(nil);
|
425
|
426
|
}
|
426
|
427
|
}
|
427
|
428
|
|