mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +00:00
Delay rendering bottom timeline items when scrolled up and avoid content shifts
- builds on top of langleyd/timeline_defer_new_items - improve animations
This commit is contained in:
committed by
Stefan Ceriu
parent
beaf9a8dbf
commit
3c8daebfe1
@@ -80,6 +80,11 @@ struct RoomScreen: View {
|
||||
context.send(viewAction: .cancelSend(itemID: info.itemID))
|
||||
}
|
||||
}
|
||||
.onChange(of: context.isScrolledToBottom) { isScrolledToBottom in
|
||||
if isScrolledToBottom {
|
||||
context.send(viewAction: .scrolledToBottom)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var timeline: some View {
|
||||
@@ -94,7 +99,7 @@ struct RoomScreen: View {
|
||||
private var timelineSwitch: some View {
|
||||
if context.viewState.swiftUITimelineEnabled {
|
||||
TimelineView(viewState: context.viewState.timelineViewState,
|
||||
scrollToBottomButtonVisible: $context.scrollToBottomButtonVisible) {
|
||||
isScrolledToBottom: $context.isScrolledToBottom) {
|
||||
context.send(viewAction: .paginateBackwards)
|
||||
}
|
||||
} else {
|
||||
@@ -121,9 +126,9 @@ struct RoomScreen: View {
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
.opacity(context.scrollToBottomButtonVisible ? 1.0 : 0.0)
|
||||
.accessibilityHidden(!context.scrollToBottomButtonVisible)
|
||||
.animation(.elementDefault, value: context.scrollToBottomButtonVisible)
|
||||
.opacity(context.isScrolledToBottom ? 0.0 : 1.0)
|
||||
.accessibilityHidden(context.isScrolledToBottom)
|
||||
.animation(.elementDefault, value: context.isScrolledToBottom)
|
||||
}
|
||||
|
||||
private var messageComposer: some View {
|
||||
|
||||
Reference in New Issue
Block a user