UNPKG

833 BTypeScriptView Raw
1/**
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 *
7 * @format
8 */
9
10import {HostComponent} from '../../types/public/ReactNativeTypes';
11
12/**
13 * Creates values that can be used like React components which represent native
14 * view managers. You should create JavaScript modules that wrap these values so
15 * that the results are memoized. Example:
16 *
17 * const View = requireNativeComponent('RCTView');
18 *
19 * The concrete return type of `requireNativeComponent` is a string, but the declared type is
20 * `HostComponent` because TypeScript assumes anonymous JSX intrinsics (e.g. a `string`) not
21 * to have any props.
22 */
23export function requireNativeComponent<T>(viewName: string): HostComponent<T>;