mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Fix a bug where the view state is being modified during an update. (#2686)
This commit is contained in:
@@ -135,12 +135,21 @@ struct FullscreenDialog<Content: View, BottomContent: View>: View {
|
|||||||
|
|
||||||
func updateBackgroundVisibility(scrollView: UIScrollView) {
|
func updateBackgroundVisibility(scrollView: UIScrollView) {
|
||||||
guard dynamicTypeSize < .accessibility1 else {
|
guard dynamicTypeSize < .accessibility1 else {
|
||||||
showsBackground = true
|
if !showsBackground {
|
||||||
|
showsBackground = true
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let insetHeight = scrollView.adjustedContentInset.top + scrollView.adjustedContentInset.bottom
|
|
||||||
let availableHeight = scrollView.frame.height - insetHeight
|
DispatchQueue.main.async { // Don't modify the state during a view update.
|
||||||
showsBackground = scrollView.contentSize.height < availableHeight
|
let insetHeight = scrollView.adjustedContentInset.top + scrollView.adjustedContentInset.bottom
|
||||||
|
let availableHeight = scrollView.frame.height - insetHeight
|
||||||
|
let shouldShowBackground = scrollView.contentSize.height < availableHeight
|
||||||
|
|
||||||
|
if showsBackground != shouldShowBackground {
|
||||||
|
showsBackground = shouldShowBackground
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user