Skip to content

Commit aa31836

Browse files
committed
Dispatch safariViewController on main queue
The safariViewController dispatch was occuring on another thread. This sometimes caused app crashes when the view was presented, in particular if the keyboard had been presented via a TextInput or other component. The resulting crash complained about _cachedSystemAnimationFence and the main thread. This has been with other React Native apps that load a viewController. Dispatching to present the viewController on the main thread fixes this issue.
1 parent 7340c71 commit aa31836

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ios/OAuthManager/OAuthManager.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ + (BOOL)setupOAuthHandler:(UIApplication *)application
9191
dispatch_async(dispatch_get_main_queue(), ^{
9292
safariViewController = [[SFSafariViewController alloc] initWithURL:URL];
9393
UIViewController *viewController = application.keyWindow.rootViewController;
94-
[viewController presentViewController:safariViewController animated:YES completion: nil];
94+
dispatch_async(dispatch_get_main_queue(), ^{
95+
[viewController presentViewController:safariViewController animated:YES completion: nil];
96+
});
9597
});
9698
} else {
9799
[application openURL:URL];

0 commit comments

Comments
 (0)