-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy pathwebSpecificTypes.ts
27 lines (25 loc) · 939 Bytes
/
webSpecificTypes.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import React from 'react';
/**
* We need to augment react types because rn for web provides non-standard way of measuring components by injecting `measure` method to the ref.
*
* Reference:
* https://github.com/necolas/react-native-web/blob/c47bec7b93d6a3b7c31bbc8bb2e4acd117b79bfc/packages/react-native-web/src/modules/usePlatformMethods/index.js#L69
* https://github.com/necolas/react-native-web/blob/c47bec7b93d6a3b7c31bbc8bb2e4acd117b79bfc/packages/react-native-web/src/exports/UIManager/index.js#L63
* */
/* eslint-disable @typescript-eslint/no-namespace */
declare module 'react' {
// eslint-disable-next-line @typescript-eslint/ban-types
interface Component {
measure?(
callback: (
x: number,
y: number,
width: number,
height: number,
pageX: number,
pageY: number
) => void
): void;
}
}