Skip to content

Commit c04b4a9

Browse files
j-piaseckifacebook-github-bot
authored andcommitted
Update modal wrapper to be translatable to TypeScript (#49923)
Summary: Pull Request resolved: #49923 Changelog: [Internal] Reviewed By: huntie Differential Revision: D70887822 fbshipit-source-id: 729e91245cfb750cf1de4f4532925ff7263b3d82
1 parent e7c44b2 commit c04b4a9

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

packages/react-native/Libraries/Modal/Modal.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -362,14 +362,18 @@ const styles = StyleSheet.create({
362362
},
363363
});
364364

365+
type ModalRefProps = $ReadOnly<{
366+
ref?: React.RefSetter<PublicModalInstance>,
367+
}>;
368+
365369
// NOTE: This wrapper component is necessary because `Modal` is a class
366370
// component and we need to map `ref` to a differently named prop. This can be
367371
// removed when `Modal` is a functional component.
368372
function Wrapper({
369373
ref,
370374
...props
371375
}: {
372-
ref?: React.RefSetter<PublicModalInstance>,
376+
...ModalRefProps,
373377
...ModalProps,
374378
}): React.Node {
375379
return <Modal {...props} modalRef={ref} />;

packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap

+3-3
Original file line numberDiff line numberDiff line change
@@ -5985,10 +5985,10 @@ export type ModalProps = {
59855985
...ModalPropsAndroid,
59865986
...ViewProps,
59875987
};
5988-
declare function Wrapper({
5988+
type ModalRefProps = $ReadOnly<{
59895989
ref?: React.RefSetter<PublicModalInstance>,
5990-
...ModalProps,
5991-
}): React.Node;
5990+
}>;
5991+
declare function Wrapper({ ...ModalRefProps, ...ModalProps }): React.Node;
59925992
declare export default typeof Wrapper;
59935993
"
59945994
`;

0 commit comments

Comments
 (0)