<Activity mode="hidden"> prevents WKWebView from loading content (onLoad never fires)
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- C++
- Star
- 127k
- Fork
- 25.3k
- Merge trung bình
- 1 ngày 23 giờ
- Pull request đã merge (30 ngày)
- 4
Mô tả
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
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với hành vi của cloneHiddenInstance() trong Fabric và tái hiện vấn đề bằng Snack được liên kết cùng ví dụ tối thiểu. Xác minh bản sửa lỗi trên các WebViews hiển thị, ẩn và control; hoàn tất có nghĩa là WKWebView ẩn tải nội dung và các callback onLoad, onLoadStart và onLoadEnd của nó được gọi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- ios, react-native, typescript
- Lĩnh vực
- mobile-dev
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Sôi nổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 50/100