Commit 7cc8c76
fix(types): expose Modal native ref prop (facebook#56952)
Summary:
- add `modalRef` to the hand-written `Modal` TypeScript declarations
- align the hand-written declaration with existing `React.RefObject` ref prop typing patterns
- add typetest coverage for passing a Modal ref through `modalRef`
This replaces facebook#56889, which GitHub auto-closed after its pull ref got stuck on a bad force-pushed commit. The branch here contains the same scoped fix plus the review feedback from facebook#56889.
`Modal` already accepts `modalRef` at runtime and the generated API snapshot already includes it. The hand-written declarations were the odd one out, so TypeScript users could not pass the supported ref prop without a local cast.
## Changelog:
[General] [Fixed] - Expose Modal native ref prop in TypeScript declarations
Pull Request resolved: facebook#56952
Test Plan:
- `npx prettier --check packages/react-native/Libraries/Modal/Modal.d.ts packages/react-native/types/__typetests__/index.tsx`
- `npm run test-typescript -- --pretty false`
- `npm run build-types`
- `npm run test-generated-typescript -- --pretty false`
Reviewed By: cipolleschi
Differential Revision: D107081018
Pulled By: huntie
fbshipit-source-id: 74a4a6db6d295543557106618b39be6007e1049d1 parent c789880 commit 7cc8c76
2 files changed
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
53 | 58 | | |
54 | 59 | | |
55 | 60 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| |||
1540 | 1541 | | |
1541 | 1542 | | |
1542 | 1543 | | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
1543 | 1548 | | |
1544 | 1549 | | |
1545 | 1550 | | |
| |||
0 commit comments