mirror of
https://github.com/element-hq/element-x-ios.git
synced 2025-03-10 21:39:12 +00:00
Revert "Force the timeline to stay at the bottom when first loading"
This reverts commit ef8d2303289782eb46bb960a03b04985fb1db168.
This commit is contained in:
parent
ef8d230328
commit
9f3ed6ca7b
@ -82,12 +82,20 @@ struct TimelineItemList: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.onChange(of: timelineItems) { _ in
|
.onChange(of: pinnedItem) { item in
|
||||||
// Run this multiple times on first appearance to fix offset issues
|
guard let item else {
|
||||||
updatePinnedOffset(scrollViewProxy: proxy)
|
return
|
||||||
}
|
}
|
||||||
.onChange(of: pinnedItem) { _ in
|
|
||||||
updatePinnedOffset(scrollViewProxy: proxy)
|
if item.animated {
|
||||||
|
withAnimation(Animation.elementDefault) {
|
||||||
|
proxy.scrollTo(item.id, anchor: item.anchor)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
proxy.scrollTo(item.id, anchor: item.anchor)
|
||||||
|
}
|
||||||
|
|
||||||
|
pinnedItem = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.scrollDismissesKeyboard(.immediately)
|
.scrollDismissesKeyboard(.immediately)
|
||||||
@ -140,6 +148,8 @@ struct TimelineItemList: View {
|
|||||||
let pinnedItem = PinnedItem(id: currentFirstItem.id, anchor: .top, animated: false)
|
let pinnedItem = PinnedItem(id: currentFirstItem.id, anchor: .top, animated: false)
|
||||||
timelineItems = context.viewState.items
|
timelineItems = context.viewState.items
|
||||||
self.pinnedItem = pinnedItem
|
self.pinnedItem = pinnedItem
|
||||||
|
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise just update the items
|
// Otherwise just update the items
|
||||||
@ -188,25 +198,6 @@ struct TimelineItemList: View {
|
|||||||
return selectedItemId == item.id ? 1.0 : 0.5
|
return selectedItemId == item.id ? 1.0 : 0.5
|
||||||
}
|
}
|
||||||
|
|
||||||
private func updatePinnedOffset(scrollViewProxy proxy: ScrollViewProxy) {
|
|
||||||
guard let item = pinnedItem else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if item.animated {
|
|
||||||
withAnimation(.elementDefault) {
|
|
||||||
proxy.scrollTo(item.id, anchor: item.anchor)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
proxy.scrollTo(item.id, anchor: item.anchor)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Need to delay this for a bit to fix offset problems when loading the initial page
|
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
|
||||||
pinnedItem = nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private var isRunningPreviews: Bool {
|
private var isRunningPreviews: Bool {
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
return ProcessInfo.processInfo.environment["XCODE_RUNNING_FOR_PREVIEWS"] == "1"
|
return ProcessInfo.processInfo.environment["XCODE_RUNNING_FOR_PREVIEWS"] == "1"
|
||||||
|
@ -1 +0,0 @@
|
|||||||
Fixed timelines not sticking to the bottom on first appearance and when message heights change
|
|
Loading…
x
Reference in New Issue
Block a user