Skip to content

Commit

Permalink
fix: Revert didMoveToSuperview back to didMoveToWindow (#3041)
Browse files Browse the repository at this point in the history
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

1 comment on commit 836f717

@andreasbroch2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to trigger load in the background still without this?

Please sign in to comment.