Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ type NativeComponentOptions = Readonly<{
excludedPlatforms?: ReadonlyArray<'iOS' | 'android'>,
}>;

// Note that this alias is not re-exported from the `react-native` root,
// so it must not be used in public interfaces, such as the declared return type of
// `codegenNativeComponent` below: consumers that emit declaration files would be
// unable to name it portably (TS2883).
export type NativeComponentType<T extends {...}> = HostComponent<T>;

// If this function runs then that means the view configs were not
Expand All @@ -34,7 +38,7 @@ export type NativeComponentType<T extends {...}> = HostComponent<T>;
function codegenNativeComponent<Props extends {...}>(
componentName: string,
options?: NativeComponentOptions,
): NativeComponentType<Props> {
): HostComponent<Props> {
if (global.RN$Bridgeless === true && __DEV__) {
console.warn(
`Codegen didn't run for ${componentName}. This will be an error in the future. Make sure you are using @react-native/babel-preset when building your JavaScript code.`,
Expand Down
7 changes: 3 additions & 4 deletions packages/react-native/ReactNativeApi.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<<2199d280ef42e2a63ec4d6c405af893a>>
* @generated SignedSource<<8ef03fa7fcadd865b637e8483e04005b>>
*
* This file was generated by scripts/js-api/build-types/index.js.
*/
Expand Down Expand Up @@ -1739,7 +1739,7 @@ declare type codegenNativeComponent = typeof codegenNativeComponent
declare function codegenNativeComponent_default<Props extends {}>(
componentName: string,
options?: NativeComponentOptions,
): NativeComponentType<Props>
): HostComponent<Props>
declare namespace CodegenTypes {
export {
BubblingEventHandler,
Expand Down Expand Up @@ -3087,7 +3087,6 @@ declare type NativeComponentOptions = {
declare namespace NativeComponentRegistry {
export { setRuntimeConfigProvider, get, getWithFallback_DEPRECATED }
}
declare type NativeComponentType<T extends {}> = HostComponent<T>
declare class NativeEventEmitter<
TEventToArgsMap extends Readonly<
Record<string, ReadonlyArray<UnsafeNativeEventObject>>
Expand Down Expand Up @@ -6046,7 +6045,7 @@ export {
VirtualizedSectionListProps, // f42f54c4
WrapperComponentProvider, // 9ef54e61
codegenNativeCommands, // 628a7c0a
codegenNativeComponent, // 32a1bca6
codegenNativeComponent, // 520daa94
findNodeHandle, // 93f80214
processColor, // 6e877698
registerCallableModule, // 839c8cfe
Expand Down
Loading