Skip to content

Commit

Permalink
Merge pull request #6431 from Expensify/revert-6345-fix-tabpressing-a…
Browse files Browse the repository at this point in the history
…ddressinput

[NO QA] Revert "Fix : Pressing Tab button in AddressSearch inputs"
  • Loading branch information
stitesExpensify authored Nov 23, 2021
2 parents 10d8613 + 968e631 commit 606cacb
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions src/components/AddressSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ const defaultProps = {
const AddressSearch = (props) => {
const googlePlacesRef = useRef();
const [displayListViewBorder, setDisplayListViewBorder] = useState(false);
const [isSelected, setIsSelected] = useState(true);
useEffect(() => {
if (!googlePlacesRef.current) {
return;
Expand Down Expand Up @@ -87,17 +86,10 @@ const AddressSearch = (props) => {
<GooglePlacesAutocomplete
ref={googlePlacesRef}
fetchDetails
onBlur={() => {
if (isSelected) {
return;
}
googlePlacesRef.current.setAddressText('');
}}
suppressDefaultStyles
enablePoweredByContainer={false}
onPress={(data, details) => {
saveLocationDetails(details);
setIsSelected(true);

// After we select an option, we set displayListViewBorder to false to prevent UI flickering
setDisplayListViewBorder(false);
Expand All @@ -117,15 +109,8 @@ const AddressSearch = (props) => {
label: props.label,
containerStyles: props.containerStyles,
errorText: props.errorText,
onKeyPress: (event) => {
if (event.key !== 'Tab' || isSelected) {
return;
}
googlePlacesRef.current.setAddressText('');
},
onChangeText: (text) => {
const isTextValid = !_.isEmpty(text) && _.isEqual(text, props.value);
setIsSelected(false);

// Ensure whether an address is selected already or has address value initialized.
if (!_.isEmpty(googlePlacesRef.current.getAddressText()) && !isTextValid) {
Expand Down

0 comments on commit 606cacb

Please sign in to comment.