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:
parent
614042c3bd
commit
842c404f04
@ -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)
|
||||||
@ -289,4 +289,4 @@ struct HybridWebView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user