diff --git a/src/libs/getClickedTargetLocation/index.js b/src/libs/getClickedTargetLocation/index.js deleted file mode 100644 index fac03005fa02..000000000000 --- a/src/libs/getClickedTargetLocation/index.js +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Returns the Bounding Rectangle for the passed native event's target. - * - * @param {Object} target - * @returns {Object} - */ -function getClickedTargetLocation(target) { - return target.getBoundingClientRect(); -} - -export default getClickedTargetLocation; diff --git a/src/libs/getClickedTargetLocation/index.native.js b/src/libs/getClickedTargetLocation/index.native.js deleted file mode 100644 index b973ec6ed897..000000000000 --- a/src/libs/getClickedTargetLocation/index.native.js +++ /dev/null @@ -1,18 +0,0 @@ -/** - * We don't need to get the position of the element on native platforms because the popover will be bottom mounted - * - * @returns {Object} - */ -function getClickedTargetLocation() { - return { - top: 0, - bottom: 0, - left: 0, - right: 0, - height: 0, - x: 0, - y: 0, - }; -} - -export default getClickedTargetLocation; diff --git a/src/libs/getClickedTargetLocation/index.native.ts b/src/libs/getClickedTargetLocation/index.native.ts new file mode 100644 index 000000000000..1755d4e4ac99 --- /dev/null +++ b/src/libs/getClickedTargetLocation/index.native.ts @@ -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; diff --git a/src/libs/getClickedTargetLocation/index.ts b/src/libs/getClickedTargetLocation/index.ts new file mode 100644 index 000000000000..e218700c3355 --- /dev/null +++ b/src/libs/getClickedTargetLocation/index.ts @@ -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; diff --git a/src/libs/getClickedTargetLocation/types.ts b/src/libs/getClickedTargetLocation/types.ts new file mode 100644 index 000000000000..7b1e85e63b17 --- /dev/null +++ b/src/libs/getClickedTargetLocation/types.ts @@ -0,0 +1,5 @@ +type DOMRectProperties = 'top' | 'bottom' | 'left' | 'right' | 'height' | 'x' | 'y'; + +type GetClickedTargetLocation = (target: Element) => Pick; + +export default GetClickedTargetLocation;