mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-23 18:12:44 +02:00
Fix infinite layout loops on timeline (#6942)
* Remove `forceZeroSageAreaInsets` from `VectorHostingController` * Fix layout issues when adding hosting views into the content view * Use the new api when adding views into the content * Add changelog
This commit is contained in:
@@ -25,8 +25,7 @@ import Combine
|
||||
class VectorHostingController: UIHostingController<AnyView> {
|
||||
|
||||
// MARK: Private
|
||||
|
||||
private let forceZeroSafeAreaInsets: Bool
|
||||
|
||||
private var theme: Theme
|
||||
private var heightSubject = CurrentValueSubject<CGFloat, Never>(0)
|
||||
|
||||
@@ -55,11 +54,8 @@ class VectorHostingController: UIHostingController<AnyView> {
|
||||
}
|
||||
/// Initializer
|
||||
/// - Parameter rootView: Root view for the controller.
|
||||
/// - Parameter forceZeroSafeAreaInsets: Whether to force-set the hosting view's safe area insets to zero. Useful when the view is used as part of a table view.
|
||||
init<Content>(rootView: Content,
|
||||
forceZeroSafeAreaInsets: Bool = false) where Content: View {
|
||||
init<Content>(rootView: Content) where Content: View {
|
||||
self.theme = ThemeService.shared().theme
|
||||
self.forceZeroSafeAreaInsets = forceZeroSafeAreaInsets
|
||||
super.init(rootView: AnyView(rootView.vectorContent()))
|
||||
}
|
||||
|
||||
@@ -116,22 +112,6 @@ class VectorHostingController: UIHostingController<AnyView> {
|
||||
heightSubject.send(height)
|
||||
}
|
||||
}
|
||||
|
||||
override func viewSafeAreaInsetsDidChange() {
|
||||
super.viewSafeAreaInsetsDidChange()
|
||||
|
||||
guard forceZeroSafeAreaInsets else {
|
||||
return
|
||||
}
|
||||
|
||||
let counterSafeAreaInsets = UIEdgeInsets(top: -view.safeAreaInsets.top,
|
||||
left: -view.safeAreaInsets.left,
|
||||
bottom: -view.safeAreaInsets.bottom,
|
||||
right: -view.safeAreaInsets.right)
|
||||
if additionalSafeAreaInsets != counterSafeAreaInsets, counterSafeAreaInsets != .zero {
|
||||
additionalSafeAreaInsets = counterSafeAreaInsets
|
||||
}
|
||||
}
|
||||
|
||||
private func registerThemeServiceDidChangeThemeNotification() {
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(themeDidChange), name: .themeServiceDidChangeTheme, object: nil)
|
||||
|
||||
Reference in New Issue
Block a user