scrollintoview animation

In most modern browsers (Chrome and Firefox, but not Safari, UC, or IE) you can pass options in an object to .scrollIntoView(). Try this: elm.scrollIntoView({ behavior: ‘smooth’, block: ‘center’ }) Other values are behavior: ‘instant’ or block: ‘start’ or block: ‘end’. See

How do I correctly pass a “cell item” to a .sheet from a SwiftUI LazyVGrid?

In such use-case it is more appropriate to use variant of sheet constructed with item, because sheet must be moved out of dynamic content (otherwise you create as many sheets as items in ForEach). Here is possible solution. Tested with Xcode 12 / iOS 14. // helper extension because .sheet(item:…) requires item to be Identifiable … Read more

Angular 2 Scroll to bottom (Chat style)

I had the same problem, I’m using a AfterViewChecked and @ViewChild combination (Angular2 beta.3). The Component: import {…, AfterViewChecked, ElementRef, ViewChild, OnInit} from ‘angular2/core’ @Component({ … }) export class ChannelComponent implements OnInit, AfterViewChecked { @ViewChild(‘scrollMe’) private myScrollContainer: ElementRef; ngOnInit() { this.scrollToBottom(); } ngAfterViewChecked() { this.scrollToBottom(); } scrollToBottom(): void { try { this.myScrollContainer.nativeElement.scrollTop = this.myScrollContainer.nativeElement.scrollHeight; } … Read more