diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 048e34b872..ce80ac64bd 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -8970,11 +8970,13 @@ export interface ComponentInterface

{ * Common types are lined up with the appropriate prop differs with * `TypeToDifferMap`. Non-scalar types not in the map default to `deepDiffer`. */ -export function requireNativeComponent

( +export function requireNativeComponent( viewName: string, componentInterface?: ComponentInterface

, - extraConfig?: { nativeOnly?: any } -): React.ComponentClass>>; + extraConfig?: { nativeOnly?: NP } +): React.ComponentClass< + Partial>> & { [K in keyof NP]?: any} +>; export function findNodeHandle( componentOrHandle: null | number | React.Component | React.ComponentClass diff --git a/types/react-native/test/index.tsx b/types/react-native/test/index.tsx index a16d6f3e4d..c9696e53d0 100644 --- a/types/react-native/test/index.tsx +++ b/types/react-native/test/index.tsx @@ -11,6 +11,7 @@ The content of index.io.js could be something like For a list of complete Typescript examples: check https://github.com/bgrieder/RNTSExplorer */ +import * as PropTypes from "prop-types"; import * as React from "react"; import { Alert, @@ -75,6 +76,7 @@ import { Modal, TimePickerAndroid, ViewPropTypes, + requireNativeComponent, } from "react-native"; declare module "react-native" { @@ -762,3 +764,20 @@ const TimePickerAndroidTest = () => ( mode: 'spinner' }) ) + +class BridgedComponentTest extends React.Component { + static propTypes = { + jsProp: PropTypes.string.isRequired, + ...ViewPropTypes, + } + + render() { + return ; + } +} + +const NativeBridgedComponent = requireNativeComponent("NativeBridgedComponent", BridgedComponentTest, { + nativeOnly: { + nativeProp: true, + } +});