Skip to content

Commit

Permalink
fix(macOS): address regression due to didMoveToSuperview (react-nativ…
Browse files Browse the repository at this point in the history
…e-webview#3006)

Co-authored-by: Vahagn Nikoghosyan <vahagnn@meta.com>
  • Loading branch information
vahagnni and Vahagn Nikoghosyan committed Jun 14, 2023
1 parent 4a7e7cd commit 41576ca
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions apple/RNCWebViewImpl.m
Original file line number Diff line number Diff line change
Expand Up @@ -436,9 +436,16 @@ - (WKWebViewConfiguration *)setUpWkWebViewConfig
return wkWebViewConfig;
}

// react-native-mac os does not support didMoveToSuperView https://github.com/microsoft/react-native-macos/blob/main/React/Base/RCTUIKit.h#L388
#if !TARGET_OS_OSX
- (void)didMoveToSuperview
{
if (_webView == nil) {
#else
- (void)didMoveToWindow
{
if (self.window != nil && _webView == nil) {
#endif // !TARGET_OS_OSX
WKWebViewConfiguration *wkWebViewConfig = [self setUpWkWebViewConfig];
_webView = [[RNCWKWebView alloc] initWithFrame:self.bounds configuration: wkWebViewConfig];
[self setBackgroundColor: _savedBackgroundColor];
Expand Down

0 comments on commit 41576ca

Please sign in to comment.