Skip to content

Commit

Permalink
fix: Revert didMoveToSuperview back to didMoveToWindow (react-native-…
Browse files Browse the repository at this point in the history
…webview#3041)

Fixes multiple issues with the iOS new architecture (WebViews not rendering, javascript on pages not working, possibly more) and occasional crash with the iOS old architecture.
  • Loading branch information
TheAlmightyBob committed Jul 18, 2023
1 parent 7ccf8ad commit 836f717
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions apple/RNCWebViewImpl.m
Original file line number Diff line number Diff line change
Expand Up @@ -436,16 +436,9 @@ - (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 836f717

Please sign in to comment.