-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b76d47b
commit b83915e
Showing
8 changed files
with
42 additions
and
27 deletions.
There are no files selected for viewing
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
8 changes: 4 additions & 4 deletions
8
src/components/AddressSearch/isCurrentTargetInsideContainer.native.ts
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
function isCurrentTargetInsideContainer() { | ||
// The related target check is not required here because in native there is no race condition rendering like on the web | ||
return false; | ||
} | ||
import type {IsCurrentTargetInsideContainerType} from './types'; | ||
|
||
// The related target check is not required here because in native there is no race condition rendering like on the web | ||
const isCurrentTargetInsideContainer: IsCurrentTargetInsideContainerType = () => false; | ||
|
||
export default isCurrentTargetInsideContainer; |
10 changes: 6 additions & 4 deletions
10
src/components/AddressSearch/isCurrentTargetInsideContainer.ts
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 |
---|---|---|
@@ -1,12 +1,14 @@ | ||
import type {RefObject} from 'react'; | ||
import type {NativeSyntheticEvent, TextInputFocusEventData, View} from 'react-native'; | ||
import type {IsCurrentTargetInsideContainerType} from './types'; | ||
|
||
function isCurrentTargetInsideContainer(event: FocusEvent | NativeSyntheticEvent<TextInputFocusEventData>, containerRef: RefObject<View | HTMLElement>): boolean { | ||
const isCurrentTargetInsideContainer: IsCurrentTargetInsideContainerType = (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 || !('relatedTarget' in event) || !('contains' in containerRef.current)) { | ||
return false; | ||
} | ||
|
||
return !!containerRef.current.contains(event.relatedTarget as Node); | ||
} | ||
}; | ||
|
||
export default isCurrentTargetInsideContainer; |
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
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
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