-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16875 from tienifr/fix/16448
Fix/16448: Reset displayListViewBorder if user don't select option
- Loading branch information
Showing
5 changed files
with
45 additions
and
20 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/components/AddressSearch/resetDisplayListViewBorderOnBlur.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
function resetDisplayListViewBorderOnBlur(setDisplayListViewBorder, event, containerRef) { | ||
// The related target check is required here | ||
// because without it when we select an option, the onBlur will still trigger setting displayListViewBorder to false | ||
// it will make the auto complete component re-render before onPress is called making selecting an option not working. | ||
if (containerRef.current && event.target && containerRef.current.contains(event.relatedTarget)) { | ||
return; | ||
} | ||
setDisplayListViewBorder(false); | ||
} | ||
|
||
export default resetDisplayListViewBorderOnBlur; | ||
|
8 changes: 8 additions & 0 deletions
8
src/components/AddressSearch/resetDisplayListViewBorderOnBlur.native.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
function resetDisplayListViewBorderOnBlur(setDisplayListViewBorder) { | ||
// The related target check is not required here because in native there is no race condition rendering like on the web | ||
// onPress still called when cliking the option | ||
setDisplayListViewBorder(false); | ||
} | ||
|
||
export default resetDisplayListViewBorderOnBlur; | ||
|