diff --git a/packages/react-native/Libraries/Components/View/View.js b/packages/react-native/Libraries/Components/View/View.js index a7177fccf1595a..0adb3558103cb8 100644 --- a/packages/react-native/Libraries/Components/View/View.js +++ b/packages/react-native/Libraries/Components/View/View.js @@ -23,10 +23,16 @@ import {use} from 'react'; * * @see https://reactnative.dev/docs/view */ -export default component View( +const View: component( ref?: React.RefSetter>, ...props: ViewProps -) { +) = ({ + ref, + ...props +}: { + ref?: React.RefSetter>, + ...ViewProps, +}) => { const hasTextAncestor = use(TextAncestorContext); let actualView; @@ -212,4 +218,7 @@ export default component View( ); } return actualView; -} +}; + +View.displayName = 'View'; +export default View; diff --git a/packages/react-native/ReactNativeApi.d.ts b/packages/react-native/ReactNativeApi.d.ts index eee18b46fb735a..9a60b9a16c80da 100644 --- a/packages/react-native/ReactNativeApi.d.ts +++ b/packages/react-native/ReactNativeApi.d.ts @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<> * * This file was generated by scripts/js-api/build-types/index.js. */ @@ -558,6 +558,12 @@ declare const Vibration_default: { cancel: () => void vibrate: (pattern?: Array | number, repeat?: boolean) => void } +declare const View: typeof View_default +declare const View_default: ( + props: ViewProps & { + ref?: React.Ref> + }, +) => React.ReactNode declare const ViewNativeComponent_default: HostComponent declare const VirtualizedList: typeof VirtualizedListComponent_default declare const VirtualizedListComponent_default: VirtualizedListType @@ -5621,11 +5627,7 @@ declare type ValueXYListenerCallback = (value: { y: number }) => unknown declare type Vibration = typeof Vibration -declare function View( - props: ViewProps & { - ref?: React.Ref> - }, -): React.ReactNode +declare type View = typeof View declare type ViewabilityConfig = { readonly itemVisiblePercentThreshold?: number readonly minimumViewTime?: number @@ -6165,7 +6167,7 @@ export { UIManager, // 8d2c8281 UTFSequence, // baacd11b Vibration, // 315e131d - View, // 75d9e33b + View, // 39dd4de4 ViewProps, // 0ab8ceda ViewPropsAndroid, // f3d007c3 ViewPropsIOS, // 58ee19bf