Set optional ref on View and split View Props (#49725)

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

Changelog:
[Internal] - Set optional ref on View and split View Props

Reviewed By: huntie

Differential Revision: D70327820

fbshipit-source-id: 2021125b0aff1497df50c2be73c2ecfc7e8f1157
This commit is contained in:
Dawid Małecki
2025-02-28 01:15:07 -08:00
committed by Facebook GitHub Bot
parent d0a101fbea
commit 8919fc3243
3 changed files with 29 additions and 23 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ export type Props = ViewProps;
* @see https://reactnative.dev/docs/view
*/
const View: component(
ref: React.RefSetter<React.ElementRef<typeof ViewNativeComponent>>,
ref?: React.RefSetter<React.ElementRef<typeof ViewNativeComponent>>,
...props: ViewProps
) = React.forwardRef(
(
@@ -356,17 +356,7 @@ export type ViewPropsIOS = $ReadOnly<{
shouldRasterizeIOS?: ?boolean,
}>;
export type ViewProps = $ReadOnly<{
...DirectEventProps,
...GestureResponderHandlers,
...MouseEventProps,
...PointerEventProps,
...FocusEventProps,
...TouchEventProps,
...ViewPropsAndroid,
...ViewPropsIOS,
...AccessibilityProps,
type ViewBaseProps = $ReadOnly<{
children?: Node,
style?: ?ViewStyleProp,
@@ -454,3 +444,16 @@ export type ViewProps = $ReadOnly<{
*/
removeClippedSubviews?: ?boolean,
}>;
export type ViewProps = $ReadOnly<{
...DirectEventProps,
...GestureResponderHandlers,
...MouseEventProps,
...PointerEventProps,
...FocusEventProps,
...TouchEventProps,
...ViewPropsAndroid,
...ViewPropsIOS,
...AccessibilityProps,
...ViewBaseProps,
}>;
@@ -3633,7 +3633,7 @@ declare export default typeof ReactNativeViewAttributes;
exports[`public API should not change unintentionally Libraries/Components/View/View.js 1`] = `
"export type Props = ViewProps;
declare const View: component(
ref: React.RefSetter<React.ElementRef<typeof ViewNativeComponent>>,
ref?: React.RefSetter<React.ElementRef<typeof ViewNativeComponent>>,
...props: ViewProps
);
declare export default typeof View;
@@ -3927,16 +3927,7 @@ export type ViewPropsAndroid = $ReadOnly<{
export type ViewPropsIOS = $ReadOnly<{
shouldRasterizeIOS?: ?boolean,
}>;
export type ViewProps = $ReadOnly<{
...DirectEventProps,
...GestureResponderHandlers,
...MouseEventProps,
...PointerEventProps,
...FocusEventProps,
...TouchEventProps,
...ViewPropsAndroid,
...ViewPropsIOS,
...AccessibilityProps,
type ViewBaseProps = $ReadOnly<{
children?: Node,
style?: ?ViewStyleProp,
collapsable?: ?boolean,
@@ -3949,6 +3940,18 @@ export type ViewProps = $ReadOnly<{
pointerEvents?: ?(\\"auto\\" | \\"box-none\\" | \\"box-only\\" | \\"none\\"),
removeClippedSubviews?: ?boolean,
}>;
export type ViewProps = $ReadOnly<{
...DirectEventProps,
...GestureResponderHandlers,
...MouseEventProps,
...PointerEventProps,
...FocusEventProps,
...TouchEventProps,
...ViewPropsAndroid,
...ViewPropsIOS,
...AccessibilityProps,
...ViewBaseProps,
}>;
"
`;