Skip to content

Commit a69181a

Browse files
committed
Autoscroll to end/selected event on View list when opening View page
1 parent 375e7c2 commit a69181a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/components/view/view-page.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,15 @@ class ViewPage extends React.Component<ViewPageProps> {
207207
);
208208

209209
componentDidMount() {
210+
// After first render, scroll to the selected event (or the end of the list) by default:
211+
requestAnimationFrame(() => {
212+
if (this.props.eventId && this.selectedEvent) {
213+
this.onScrollToCenterEvent(this.selectedEvent);
214+
} else {
215+
this.onScrollToEnd();
216+
}
217+
});
218+
210219
disposeOnUnmount(this, observe(this, 'selectedEvent', ({ oldValue, newValue }) => {
211220
if (this.splitDirection !== 'horizontal') return;
212221

0 commit comments

Comments
 (0)