From 2410f7052f3673b761f5a95e98d9c130a75d2172 Mon Sep 17 00:00:00 2001 From: Marc Rousavy Date: Wed, 15 Jan 2025 22:53:56 +0100 Subject: [PATCH] feat: Add types to `getHostComponent` --- .../src/views/getHostComponent.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/react-native-nitro-modules/src/views/getHostComponent.ts b/packages/react-native-nitro-modules/src/views/getHostComponent.ts index 27a6ccf15..80aa702c3 100644 --- a/packages/react-native-nitro-modules/src/views/getHostComponent.ts +++ b/packages/react-native-nitro-modules/src/views/getHostComponent.ts @@ -2,12 +2,20 @@ import type { HostComponent } from 'react-native' // @ts-expect-error this unfortunately isn't typed or default-exported. import * as NativeComponentRegistry from 'react-native/Libraries/NativeComponent/NativeComponentRegistry' +interface ViewConfig { + uiViewClassName: string + supportsRawText?: boolean + bubblingEventTypes: Record + directEventTypes: Record + validAttributes: Record +} + /** * Finds and returns a native view (aka {@linkcode HostComponent}) via the given {@linkcode name}. */ export function getHostComponent( name: string, - getViewConfig: () => object + getViewConfig: () => ViewConfig ): HostComponent { return NativeComponentRegistry.get(name, getViewConfig) }