fix(types): expose Modal native ref prop#56889
Conversation
|
@ya-nsh thanks for the contribution, but why is it needed? This increases our API surface, so unless there is a concrete reason why we need it, we would rather not have a new piece of API that we need to maintain. Can you update the summary with the reason why we need the ref prop? |
|
Thanks, that makes sense. I updated the summary with the reason now. The short version is that |
|
Friendly review ping: this PR is ready for maintainer review when you get a chance. Known status: 11 check(s) currently failing; I can follow up if review points to needed changes. Happy to adjust quickly if you want a different shape or narrower scope. |
Summary
modalRefto the hand-writtenModalTypeScript declarationsPublicModalInstancefromModal.d.tsto match the generated API snapshotHostInstanceref throughmodalRefModalalready acceptsmodalRefat 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
Test Plan
npx prettier --check packages/react-native/Libraries/Modal/Modal.d.ts packages/react-native/types/__typetests__/index.tsxnpm run test-typescript -- --pretty falsenpm run build-typesnpm run test-generated-typescript -- --pretty false