fix: Add return statement to JavaScript height detection in NativeWebView

Added 'return' keyword before document.body.scrollHeight to ensure
the JavaScript expression returns a value that can be captured by
webPage.callJavaScript().
This commit is contained in:
Ilyas Hallak 2025-10-10 19:56:35 +02:00
parent 614042c3bd
commit 842c404f04

View File

@ -51,7 +51,7 @@ struct NativeWebView: View {
do { do {
// Try to get height via JavaScript - use simple document.body.scrollHeight // Try to get height via JavaScript - use simple document.body.scrollHeight
let result = try await webPage.callJavaScript("document.body.scrollHeight") let result = try await webPage.callJavaScript("return document.body.scrollHeight")
if let height = result as? Double, height > 0 { if let height = result as? Double, height > 0 {
let cgHeight = CGFloat(height) let cgHeight = CGFloat(height)