Update modal wrapper to be translatable to TypeScript (#49923)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49923

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D70887822

fbshipit-source-id: 729e91245cfb750cf1de4f4532925ff7263b3d82
This commit is contained in:
Jakub Piasecki
2025-03-10 08:40:37 -07:00
committed by Facebook GitHub Bot
parent e7c44b2a26
commit c04b4a92d1
2 changed files with 8 additions and 4 deletions
+5 -1
View File
@@ -362,6 +362,10 @@ const styles = StyleSheet.create({
},
});
type ModalRefProps = $ReadOnly<{
ref?: React.RefSetter<PublicModalInstance>,
}>;
// NOTE: This wrapper component is necessary because `Modal` is a class
// component and we need to map `ref` to a differently named prop. This can be
// removed when `Modal` is a functional component.
@@ -369,7 +373,7 @@ function Wrapper({
ref,
...props
}: {
ref?: React.RefSetter<PublicModalInstance>,
...ModalRefProps,
...ModalProps,
}): React.Node {
return <Modal {...props} modalRef={ref} />;
@@ -5985,10 +5985,10 @@ export type ModalProps = {
...ModalPropsAndroid,
...ViewProps,
};
declare function Wrapper({
type ModalRefProps = $ReadOnly<{
ref?: React.RefSetter<PublicModalInstance>,
...ModalProps,
}): React.Node;
}>;
declare function Wrapper({ ...ModalRefProps, ...ModalProps }): React.Node;
declare export default typeof Wrapper;
"
`;