fix(iOS): correct sidebar insets on iPad and resolve occasional stale safe area inset on iOS (#3395)

This commit is contained in:
Huang Xin 2026-02-27 12:43:45 +08:00 committed by GitHub
parent 67249370c9
commit 6ad549d13c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 41 additions and 24 deletions

View file

@ -889,6 +889,28 @@ class NativeBridgePlugin: Plugin {
}
}
}
@objc public func get_safe_area_insets(_ invoke: Invoke) {
DispatchQueue.main.async {
if let window = UIApplication.shared.windows.first {
let insets = window.safeAreaInsets
invoke.resolve([
"top": insets.top,
"left": insets.left,
"bottom": insets.bottom,
"right": insets.right
])
} else {
invoke.resolve([
"error": "No window found",
"top": 0,
"left": 0,
"bottom": 0,
"right": 0
])
}
}
}
}
@_cdecl("init_plugin_native_bridge")