[ReactNative] Ensure WebViewExecutor's webview is created on the main thread
Summary: Fixes #2464 After the bridge parallelisation of the bridge initialisation the executors were being `setUp` in a background thread, and the `RCTWebViewExecutor` was crashing when creating a `UIWebView` out of the main thread. Wrap the `UIWebView` creation in a call to the main thread.
This commit is contained in:
parent
5b2d8000ae
commit
c6240c7441
|
@ -66,13 +66,15 @@ RCT_EXPORT_MODULE()
|
||||||
- (void)setUp
|
- (void)setUp
|
||||||
{
|
{
|
||||||
if (!_webView) {
|
if (!_webView) {
|
||||||
|
[self executeBlockOnJavaScriptQueue:^{
|
||||||
_webView = [UIWebView new];
|
_webView = [UIWebView new];
|
||||||
|
_webView.delegate = self;
|
||||||
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
_objectsToInject = [NSMutableDictionary new];
|
_objectsToInject = [NSMutableDictionary new];
|
||||||
_commentsRegex = [NSRegularExpression regularExpressionWithPattern:@"(^ *?\\/\\/.*?$|\\/\\*\\*[\\s\\S]*?\\*\\/)" options:NSRegularExpressionAnchorsMatchLines error:NULL],
|
_commentsRegex = [NSRegularExpression regularExpressionWithPattern:@"(^ *?\\/\\/.*?$|\\/\\*\\*[\\s\\S]*?\\*\\/)" options:NSRegularExpressionAnchorsMatchLines error:NULL];
|
||||||
_scriptTagsRegex = [NSRegularExpression regularExpressionWithPattern:@"<(\\/?script[^>]*?)>" options:0 error:NULL],
|
_scriptTagsRegex = [NSRegularExpression regularExpressionWithPattern:@"<(\\/?script[^>]*?)>" options:0 error:NULL];
|
||||||
_webView.delegate = self;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)invalidate
|
- (void)invalidate
|
||||||
|
|
Loading…
Reference in New Issue