Skip to content

Commit 2bf3998

Browse files
authored
FabricNativeComponents: Update codegen imports (facebook#4540)
1 parent 39d9a19 commit 2bf3998

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

docs/fabric-native-components.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,20 @@ Use this specification for our WebView Component:
6060
<TabItem value="typescript">
6161

6262
```typescript title="Demo/specs/WebViewNativeComponent.ts"
63-
import type {HostComponent, ViewProps} from 'react-native';
64-
import type {BubblingEventHandler} from 'react-native/Libraries/Types/CodegenTypes';
65-
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
63+
import type {
64+
CodegenTypes,
65+
HostComponent,
66+
ViewProps,
67+
} from 'react-native';
68+
import {codegenNativeComponent} from 'react-native';
6669

6770
type WebViewScriptLoadedEvent = {
6871
result: 'success' | 'error';
6972
};
7073

7174
export interface NativeProps extends ViewProps {
7275
sourceURL?: string;
73-
onScriptLoaded?: BubblingEventHandler<WebViewScriptLoadedEvent> | null;
76+
onScriptLoaded?: CodegenTypes.BubblingEventHandler<WebViewScriptLoadedEvent> | null;
7477
}
7578

7679
export default codegenNativeComponent<NativeProps>(
@@ -84,9 +87,8 @@ export default codegenNativeComponent<NativeProps>(
8487
```ts title="Demo/RCTWebView/js/RCTWebViewNativeComponent.js":
8588
// @flow strict-local
8689

87-
import type {HostComponent, ViewProps} from 'react-native';
88-
import type {BubblingEventHandler} from 'react-native/Libraries/Types/CodegenTypes';
89-
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
90+
import type {CodegenTypes, HostComponent, ViewProps} from 'react-native';
91+
import {codegenNativeComponent} from 'react-native';
9092

9193
type WebViewScriptLoadedEvent = $ReadOnly<{|
9294
result: "success" | "error",
@@ -95,7 +97,7 @@ type WebViewScriptLoadedEvent = $ReadOnly<{|
9597
type NativeProps = $ReadOnly<{|
9698
...ViewProps,
9799
sourceURL?: string;
98-
onScriptLoaded?: BubblingEventHandler<WebViewScriptLoadedEvent>?;
100+
onScriptLoaded?: CodegenTypes.BubblingEventHandler<WebViewScriptLoadedEvent>?;
99101
|}>;
100102

101103
export default (codegenNativeComponent<NativeProps>(

0 commit comments

Comments
 (0)