diff --git a/packages/react-native/Libraries/Modal/Modal.js b/packages/react-native/Libraries/Modal/Modal.js index 9fa343403d9..cae3aaca9df 100644 --- a/packages/react-native/Libraries/Modal/Modal.js +++ b/packages/react-native/Libraries/Modal/Modal.js @@ -362,6 +362,10 @@ const styles = StyleSheet.create({ }, }); +type ModalRefProps = $ReadOnly<{ + ref?: React.RefSetter, +}>; + // 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, + ...ModalRefProps, ...ModalProps, }): React.Node { return ; diff --git a/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap b/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap index e1aa943977b..e261a86e198 100644 --- a/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap +++ b/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap @@ -5985,10 +5985,10 @@ export type ModalProps = { ...ModalPropsAndroid, ...ViewProps, }; -declare function Wrapper({ +type ModalRefProps = $ReadOnly<{ ref?: React.RefSetter, - ...ModalProps, -}): React.Node; +}>; +declare function Wrapper({ ...ModalRefProps, ...ModalProps }): React.Node; declare export default typeof Wrapper; " `;