Skip to content

Commit cce6b92

Browse files
committed
Add information about requireNativeComponent
1 parent 5ae4245 commit cce6b92

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

docs/new-architecture-library-intro.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,23 @@ const RCTWebViewNativeComponent: HostComponent<mixed> =
484484
requireNativeComponent < mixed > 'RNTMyNativeView';
485485
```
486486
487+
#### Later on you can replace `requireNativeComponent`
488+
489+
When you are ready to migrate to Fabric you can replace `requireNativeComponent` with `codegenNativeComponent`:
490+
491+
```ts title="RNTMyNativeViewNativeComponent.js"
492+
export default (codegenNativeComponent<NativeProps>(
493+
'RNTMyNativeView',
494+
): HostComponent<NativeProps>);
495+
```
496+
497+
And update the main file:
498+
499+
```ts title="RNTMyNativeNativeComponent.js"
500+
export default require('./RNTMyNativeViewNativeComponent')
501+
.default;
502+
```
503+
487504
### Migrating off `dispatchViewManagerCommand`
488505
489506
Similar to one above, in an effort to avoid calling methods on the UIManager, all view manager methods are now called through an instance of `NativeCommands`. `codegenNativeCommands` is a new API to code-generate `NativeCommands` given an interface of your view manager’s commands.

0 commit comments

Comments
 (0)