-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: show large suggestion menu only if there is space #28927
Changes from 1 commit
4d5e108
54fa3c9
342c592
c1e5a56
477a03e
d14442a
af47c4c
32d8147
410ae8c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,4 +26,18 @@ function trimLeadingSpace(str) { | |
return str.slice(0, 1) === ' ' ? str.slice(1) : str; | ||
} | ||
|
||
export {getMaxArrowIndex, trimLeadingSpace}; | ||
/** | ||
* Checks if space is available to render large suggestion menu | ||
* @param {Number} listHeight | ||
* @param {Number} composerHeight | ||
* @returns {Boolean} | ||
*/ | ||
function spaceAvailableForLargeSuggestionMenu(listHeight, composerHeight) { | ||
return ( | ||
listHeight - composerHeight - (CONST.CHAT_FOOTER_SECONDARY_ROW_HEIGHT + 2 * CONST.CHAT_FOOTER_SECONDARY_ROW_PADDING) > | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What I meant is that this expression spans across three lines, it's really really wide. So I was thinking if extracting both left and right sides of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and maybe also some other components, like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Handled! |
||
CONST.AUTO_COMPLETE_SUGGESTER.MAX_AMOUNT_OF_VISIBLE_SUGGESTIONS_IN_CONTAINER * CONST.AUTO_COMPLETE_SUGGESTER.SUGGESTION_ROW_HEIGHT + | ||
CONST.AUTO_COMPLETE_SUGGESTER.SUGGESTER_INNER_PADDING * 2 | ||
); | ||
} | ||
|
||
export {getMaxArrowIndex, trimLeadingSpace, spaceAvailableForLargeSuggestionMenu}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This util won't hurt! But I meant something else, I wasn't clear enough
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, the name sounds like it returned some calculated space; maybe it could be named
hasEnoughSpaceForLargeSuggestionMenu
or somethingThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handled!