Skip to content

fix(types): expose Modal native ref prop#56889

Open
ya-nsh wants to merge 1 commit into
facebook:mainfrom
ya-nsh:fix/modal-ref-types
Open

fix(types): expose Modal native ref prop#56889
ya-nsh wants to merge 1 commit into
facebook:mainfrom
ya-nsh:fix/modal-ref-types

Conversation

@ya-nsh
Copy link
Copy Markdown
Contributor

@ya-nsh ya-nsh commented May 19, 2026

Summary

  • add modalRef to the hand-written Modal TypeScript declarations
  • export PublicModalInstance from Modal.d.ts to match the generated API snapshot
  • add a typetest for passing a HostInstance ref through modalRef

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

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

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 19, 2026
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label May 19, 2026
@cipolleschi
Copy link
Copy Markdown
Contributor

@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?

@ya-nsh
Copy link
Copy Markdown
Contributor Author

ya-nsh commented May 19, 2026

Thanks, that makes sense. I updated the summary with the reason now.

The short version is that Modal already accepts modalRef at runtime, and the generated API snapshot already exposes it. This change just brings the hand-written TypeScript declaration in line with that, so TS users do not need a local cast to use the existing prop.

@ya-nsh
Copy link
Copy Markdown
Contributor Author

ya-nsh commented May 20, 2026

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants