Skip to content
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 17664: use googleEmptyListViewHeight variable with correct value #17832

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/components/AddressSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import * as ApiUtils from '../libs/ApiUtils';
import * as GooglePlacesUtils from '../libs/GooglePlacesUtils';
import CONST from '../CONST';
import * as StyleUtils from '../styles/StyleUtils';
import variables from '../styles/variables';

// The error that's being thrown below will be ignored until we fork the
// react-native-google-places-autocomplete repo and replace the
Expand Down Expand Up @@ -260,7 +261,7 @@ const AddressSearch = (props) => {
styles={{
textInputContainer: [styles.flexColumn],
listView: [
StyleUtils.getGoolgeListViewStyle(displayListViewBorder),
StyleUtils.getGoogleListViewStyle(displayListViewBorder),
styles.overflowAuto,
styles.borderLeft,
styles.borderRight,
Expand All @@ -278,8 +279,7 @@ const AddressSearch = (props) => {
onLayout={(event) => {
// We use the height of the element to determine if we should hide the border of the listView dropdown
// to prevent a lingering border when there are no address suggestions.
// The height of the empty element is 2px (1px height for each top and bottom borders)
setDisplayListViewBorder(event.nativeEvent.layout.height > 2);
setDisplayListViewBorder(event.nativeEvent.layout.height > variables.googleEmptyListViewHeight);
aman-atg marked this conversation as resolved.
Show resolved Hide resolved
}}
/>
</View>
Expand Down
4 changes: 2 additions & 2 deletions src/styles/StyleUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,7 @@ function getDirectionStyle(direction) {
* @param {Boolean} shouldDisplayBorder
* @returns {Object}
*/
function getGoolgeListViewStyle(shouldDisplayBorder) {
function getGoogleListViewStyle(shouldDisplayBorder) {
if (shouldDisplayBorder) {
return {
...styles.borderTopRounded,
Expand Down Expand Up @@ -1059,5 +1059,5 @@ export {
getDirectionStyle,
getFontSizeStyle,
getSignInWordmarkWidthStyle,
getGoolgeListViewStyle,
getGoogleListViewStyle,
};
4 changes: 4 additions & 0 deletions src/styles/variables.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,8 @@ export default {
signInLogoWidthPill: 132,
signInLogoWidthLargeScreenPill: 162,
modalContentMaxWidth: 360,

// The height of the empty list is 14px (2px for borders and 12px for vertical padding)
// This is calculated based on the values specified in the 'getGoogleListViewStyle' function of the 'StyleUtils' utility
googleEmptyListViewHeight: 14,
};