Skip to content

Commit

Permalink
Desktop: Fixed Goto Anything scrolling for long lists
Browse files Browse the repository at this point in the history
  • Loading branch information
laurent22 committed Oct 24, 2021
1 parent 72c1235 commit 22e5c3a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/app-desktop/plugins/GotoAnything.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ class Dialog extends React.PureComponent<Props, State> {
inputHelpWrapper: { display: 'flex', flexDirection: 'row', alignItems: 'center' },
};

delete this.styles_[styleKey].dialogBox.maxHeight;

const rowTextStyle = {
fontSize: theme.fontSize,
color: theme.color,
Expand Down Expand Up @@ -559,12 +561,17 @@ class Dialog extends React.PureComponent<Props, State> {
}
}

private calculateMaxHeight(itemHeight: number) {
const maxItemCount = Math.floor((0.7 * window.innerHeight) / itemHeight);
return maxItemCount * itemHeight;
}

renderList() {
const style = this.style();

const itemListStyle = {
marginTop: 5,
height: Math.min(style.itemHeight * this.state.results.length, 10 * style.itemHeight),
height: Math.min(style.itemHeight * this.state.results.length, this.calculateMaxHeight(style.itemHeight)),
};

return (
Expand Down

0 comments on commit 22e5c3a

Please sign in to comment.