Skip to content
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
11 changes: 0 additions & 11 deletions src/libs/getClickedTargetLocation/index.js

This file was deleted.

18 changes: 0 additions & 18 deletions src/libs/getClickedTargetLocation/index.native.js

This file was deleted.

8 changes: 8 additions & 0 deletions src/libs/getClickedTargetLocation/index.native.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import GetClickedTargetLocation from './types';

/**
* We don't need to get the position of the element on native platforms because the popover will be bottom mounted
*/
const getClickedTargetLocation: GetClickedTargetLocation = () => ({top: 0, bottom: 0, left: 0, right: 0, height: 0, x: 0, y: 0});

export default getClickedTargetLocation;
8 changes: 8 additions & 0 deletions src/libs/getClickedTargetLocation/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import GetClickedTargetLocation from './types';

/**
* Returns the Bounding Rectangle for the passed native event's target.
*/
const getClickedTargetLocation: GetClickedTargetLocation = (target) => target.getBoundingClientRect();

export default getClickedTargetLocation;
5 changes: 5 additions & 0 deletions src/libs/getClickedTargetLocation/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type DOMRectProperties = 'top' | 'bottom' | 'left' | 'right' | 'height' | 'x' | 'y';

type GetClickedTargetLocation = (target: Element) => Pick<DOMRect, DOMRectProperties>;

export default GetClickedTargetLocation;