Skip to content

<Activity mode="hidden"> prevents WKWebView from loading content (onLoad never fires) #56180

@markwitt1

Description

@markwitt1

Description

A WKWebView (via react-native-webview) inside never loads its content. onLoad/onLoadStart/onLoadEnd never fire. This makes Activity unusable for pre-rendering/pooling WebViews offscreen.

Activity mode="hidden" applies display: none via cloneHiddenInstance() in Fabric, which maps to UIView.hidden = YES + Yoga zeroing the frame. WKWebView requires a non-zero frame and visible state to initialize its Web Content process and load content.

Also produces this warning as the web content process gets jetsammed:
[BrowserEngineKit] Failed to terminate process: Error Domain=com.apple.extensionKit.errorDomain Code=18 NSUnderlyingError: RBSRequestErrorDomain Code=3 "No such process found"

WebView pooling — pre-render WebViews in Activity mode="hidden", then flip to mode="visible" for instant display. Currently impossible because content never loads while hidden.

Versions

  • react-native: 0.83.2
  • react: 19.2.0
  • react-native-webview: 13.16.0

Steps to reproduce

Minimal Reproducible Example:

  import { useState, useCallback, Activity } from "react";
  import { View, Text, StyleSheet } from "react-native";
  import { WebView } from "react-native-webview";

  const HTML = `<!DOCTYPE html><html><body><h1>Hello</h1></body></html>`;

  export default function Test() {
    const [logs, setLogs] = useState<string[]>([]);
    const log = useCallback((msg: string) => {
      console.log(msg);
      setLogs((p) => [msg, ...p]);
    }, []);

    return (
      <View style={{ flex: 1, padding: 20 }}>
        {/* ✅ This fires onLoad */}
        <Activity mode="visible">
          <View style={{ width: 1, height: 1, overflow: "hidden" }}>
            <WebView source={{ html: HTML }} onLoad={() => log("VISIBLE: onLoad ✅")} />
          </View>
        </Activity>

        {/* ❌ This never fires onLoad */}
        <Activity mode="hidden">
          <View style={{ width: 1, height: 1, overflow: "hidden" }}>
            <WebView source={{ html: HTML }} onLoad={() => log("HIDDEN: onLoad ❌")} />
          </View>
        </Activity>

        {/* ✅ Control without Activity */}
        <View style={{ width: 1, height: 1, overflow: "hidden" }}>
          <WebView source={{ html: HTML }} onLoad={() => log("CONTROL: onLoad ✅")} />
        </View>

        {logs.map((l, i) => <Text key={i}>{l}</Text>)}
      </View>
    );
  }

Only VISIBLE and CONTROL log. HIDDEN never fires any load events.

React Native Version

0.83.2

Affected Platforms

Runtime - iOS

Output of npx @react-native-community/cli info

info Fetching system and libraries information...
System:
  OS: macOS 15.6.1
  CPU: (10) arm64 Apple M1 Pro
  Memory: 128.64 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 23.2.0
    path: /Users/mark/.nvm/versions/node/v23.2.0/bin/node
  Yarn:
    version: 1.22.22
    path: /Users/mark/.nvm/versions/node/v23.2.0/bin/yarn
  npm:
    version: 10.9.0
    path: /Users/mark/.nvm/versions/node/v23.2.0/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.16.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 25.2
      - iOS 26.2
      - macOS 26.2
      - tvOS 26.2
      - visionOS 26.2
      - watchOS 26.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2025.2 AI-252.27397.103.2522.14617522
  Xcode:
    version: 26.2/17C52
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 23.0.2
    path: /opt/homebrew/opt/openjdk/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 19.2.0
    wanted: 19.2.0
  react-native:
    installed: 0.83.2
    wanted: 0.83.2
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

info React Native v0.84.1 is now available (your project is running on v0.83.2).
info Changelog: https://github.com/facebook/react-native/releases/tag/v0.84.1
info Diff: https://react-native-community.github.io/upgrade-helper/?from=0.83.2&to=0.84.1
info For mor

Stacktrace or Logs

[BrowserEngineKit] Failed to terminate process: Error Domain=com.apple.extensionKit.errorDomain Code=18 NSUnderlyingError: RBSRequestErrorDomain Code=3 "No such process found"

MANDATORY Reproducer

https://snack.expo.dev/@markwitt/ab3289

Screenshots and Videos

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions