Various fixes

This commit is contained in:
Ilya Laktyushin
2023-08-01 14:27:45 +02:00
parent 6dce0c9c12
commit 9e18b91f57
6 changed files with 63 additions and 29 deletions

View File

@@ -186,10 +186,10 @@ final class ContextResultPanelComponent: Component {
let visibleBounds = self.scrollView.bounds.insetBy(dx: 0.0, dy: -200.0)
var synchronousLoad = false
if let hint = transition.userData(PeerListItemComponent.TransitionHint.self) {
synchronousLoad = hint.synchronousLoad
}
// var synchronousLoad = false
// if let hint = transition.userData(PeerListItemComponent.TransitionHint.self) {
// synchronousLoad = hint.synchronousLoad
// }
var validIds: [AnyHashable] = []
if let range = itemLayout.visibleItems(for: visibleBounds), case let .mentions(peers) = component.results {
@@ -241,16 +241,16 @@ final class ContextResultPanelComponent: Component {
containerSize: itemFrame.size
)
if let itemView = visibleItem.view {
var animateIn = false
// var animateIn = false
if itemView.superview == nil {
animateIn = true
// animateIn = true
self.scrollView.addSubview(itemView)
}
itemTransition.setFrame(view: itemView, frame: itemFrame)
if animateIn, synchronousLoad {
itemView.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
}
// if animateIn {
// itemView.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
// }
}
}
}
@@ -274,8 +274,8 @@ final class ContextResultPanelComponent: Component {
}
func update(component: ContextResultPanelComponent, availableSize: CGSize, state: EmptyComponentState, environment: Environment<Empty>, transition: Transition) -> CGSize {
//let itemUpdated = self.component?.results != component.results
var transition = transition
let previousComponent = self.component
self.component = component
self.state = state
@@ -306,6 +306,10 @@ final class ContextResultPanelComponent: Component {
containerSize: CGSize(width: availableSize.width, height: 1000.0)
)
if previousComponent?.results != component.results {
transition = transition.withUserData(PeerListItemComponent.TransitionHint(synchronousLoad: true))
}
let itemLayout = ItemLayout(
containerSize: CGSize(width: availableSize.width, height: minimizedHeight),
bottomInset: 0.0,