react / react/react-native

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

Abierto
#56,180 1 comentario 1 reacción 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Component: WebView Needs: Triage :mag: Stale
Lenguaje dominante
C++
Estrellas
127k
Forks
25.3k
Merge medio
1 d 23 h
PR fusionados (30 d)
4

Descripción

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

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Empieza por el comportamiento de cloneHiddenInstance() en Fabric y reproduce el problema usando el Snack enlazado y el ejemplo mínimo. Verifica la corrección en las WebViews visible, oculta y de control; se considera terminado cuando la WKWebView oculta carga contenido y se ejecutan sus callbacks onLoad, onLoadStart y onLoadEnd.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
ios, react-native, typescript
Área
mobile-dev
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Activo
Claridad
Bastante claro
Aptitud para principiantes
50/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.