From 24fe2d53b12ee31862d0bf14bcf3fbd4079cb538 Mon Sep 17 00:00:00 2001 From: Aman Ansari Date: Thu, 13 Apr 2023 23:20:54 +0530 Subject: [PATCH 1/2] add vertical spacing to avoid outline getting cut off --- src/components/AddressSearch.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/AddressSearch.js b/src/components/AddressSearch.js index 527bba51e8b2..ec19abc00a18 100644 --- a/src/components/AddressSearch.js +++ b/src/components/AddressSearch.js @@ -263,6 +263,7 @@ const AddressSearch = (props) => { displayListViewBorder && styles.borderTopRounded, displayListViewBorder && styles.borderBottomRounded, displayListViewBorder && styles.mt1, + displayListViewBorder && styles.pv1, styles.overflowAuto, styles.borderLeft, styles.borderRight, From a722c9f1035f6340c219d08c6caa68707c7de423 Mon Sep 17 00:00:00 2001 From: Aman Ansari Date: Fri, 14 Apr 2023 14:31:12 +0530 Subject: [PATCH 2/2] define and use getGoogleListViewStyle --- src/components/AddressSearch.js | 7 ++----- src/styles/StyleUtils.js | 20 ++++++++++++++++++++ src/styles/styles.js | 4 ---- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/components/AddressSearch.js b/src/components/AddressSearch.js index ec19abc00a18..8feb32ea3a90 100644 --- a/src/components/AddressSearch.js +++ b/src/components/AddressSearch.js @@ -11,6 +11,7 @@ import TextInput from './TextInput'; import * as ApiUtils from '../libs/ApiUtils'; import * as GooglePlacesUtils from '../libs/GooglePlacesUtils'; import CONST from '../CONST'; +import * as StyleUtils from '../styles/StyleUtils'; // The error that's being thrown below will be ignored until we fork the // react-native-google-places-autocomplete repo and replace the @@ -259,11 +260,7 @@ const AddressSearch = (props) => { styles={{ textInputContainer: [styles.flexColumn], listView: [ - !displayListViewBorder && styles.googleListView, - displayListViewBorder && styles.borderTopRounded, - displayListViewBorder && styles.borderBottomRounded, - displayListViewBorder && styles.mt1, - displayListViewBorder && styles.pv1, + StyleUtils.getGoolgeListViewStyle(displayListViewBorder), styles.overflowAuto, styles.borderLeft, styles.borderRight, diff --git a/src/styles/StyleUtils.js b/src/styles/StyleUtils.js index 775ebeed563b..cb34e7a72ff2 100644 --- a/src/styles/StyleUtils.js +++ b/src/styles/StyleUtils.js @@ -936,6 +936,25 @@ function getDirectionStyle(direction) { return {}; } +/** + * @param {Boolean} shouldDisplayBorder + * @returns {Object} + */ +function getGoolgeListViewStyle(shouldDisplayBorder) { + if (shouldDisplayBorder) { + return { + ...styles.borderTopRounded, + ...styles.borderBottomRounded, + marginTop: 4, + paddingVertical: 6, + }; + } + + return { + transform: [{scale: 0}], + }; +} + export { getAvatarSize, getAvatarStyle, @@ -986,4 +1005,5 @@ export { getEmojiReactionBubbleTextStyle, getEmojiReactionCounterTextStyle, getDirectionStyle, + getGoolgeListViewStyle, }; diff --git a/src/styles/styles.js b/src/styles/styles.js index be6b06736960..107782ad050f 100644 --- a/src/styles/styles.js +++ b/src/styles/styles.js @@ -2746,10 +2746,6 @@ const styles = { right: 60, }, - googleListView: { - transform: [{scale: 0}], - }, - invert: { // It's important to invert the Y AND X axis to prevent a react native issue that can lead to ANRs on android 13 transform: [{scaleX: -1}, {scaleY: -1}],