Skip to content

Commit 8cb9e6a

Browse files
committed
Update package.json version to 8.2.1 [buildkite skip]
1 parent d8873f8 commit 8cb9e6a

File tree

106 files changed

+8852
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+8852
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-navigation",
3-
"version": "8.2.0",
3+
"version": "8.2.1",
44
"description": "React Native Navigation - truly native navigation for iOS and Android",
55
"license": "MIT",
66
"nativePackage": true,
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
---
2+
id: component
3+
title: Component
4+
sidebar_label: Component
5+
---
6+
7+
import Tabs from '@theme/Tabs';
8+
import TabItem from '@theme/TabItem';
9+
10+
## `registerComponent`
11+
Every screen component in your app must be registered with a unique name. The component itself is a traditional React component extending `React.Component` or `React.PureComponent`. It can also be a HOC to provide context (or a Redux store) or a functional component. Similar to React Native's `AppRegistry.registerComponent`.
12+
13+
#### Parameters
14+
| Name | Required | Type | Description |
15+
| ------ | -------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------- |
16+
| componentName | Yes | string | Unique component name - not to be confused with **componentId** |
17+
| componentProvider | Yes | Function | Anonymous function that returns the React component to register, **OR** the component wrapped with Providers|
18+
| concreteComponentProvider | No | Function | Anonymous function that returns the concrete React component. If your component is wrapped with Providers, this must be an instance of the concrete component.|
19+
20+
#### Examples
21+
##### Registering a component
22+
```js
23+
Navigation.registerComponent(`navigation.playground.WelcomeScreen`, () => WelcomeScreen);
24+
```
25+
26+
##### Registering a component wrapped with Providers
27+
```js
28+
import { Provider } from 'react-redux';
29+
const store = createStore();
30+
31+
Navigation.registerComponent(`navigation.playground.MyScreen`, () => (props) =>
32+
<Provider store={store}>
33+
<MyScreen {...props} />
34+
</Provider>,
35+
() => MyScreen)
36+
);
37+
```
38+
39+
## `setLazyComponentRegistrator`
40+
Pass a function that will allow you to register a component lazily. When encountering an unknown component name, this function will be called, giving you a chance to register the component before an error is thrown.
41+
42+
#### Parameters
43+
| Name | Required | Type | Description |
44+
| ------ | -------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------- |
45+
| lazyRegistratorFn | Yes | (lazyComponentRequest: string | number) => void | A function that takes a componentName, will be called when encountering an unknown componentName |
46+
47+
#### Example
48+
```js
49+
Navigation.setLazyComponentRegistrator((componentName) => {
50+
if (componentName === 'navigation.playground.LazyScreen') {
51+
Navigation.registerComponent(Screens.LazilyRegisteredScreen, () => LazyScreen);
52+
}
53+
});
54+
```
55+
56+
## `updateProps`
57+
Update props of a component registered with [registerComponent](#registercomponent). Updating props triggers the component lifecycle methods related to [updating](https://reactjs.org/docs/react-component.html#updating).
58+
59+
#### Parameters
60+
| Name | Required | Type | Description |
61+
| ----------- | -------- | -------- | ---------------------------------------------------------------------------------------------------------------------- |
62+
| componentId | Yes | string | Unique component id |
63+
| options | Yes | object | Props object to pass to the component |
64+
| callback | No | Function | Function that will be executed once inner `setState` is completed |
65+
66+
#### Example
67+
```js
68+
Navigation.updateProps('MY_COMPONENT', {
69+
// props to pass to the component
70+
};
71+
```
72+
73+
:::important
74+
`updateProps` is called with a componentId. This is the same unique id components have in props. Don't confuse it with the `componentName` we use when registering components with [Navigation.registerComponent](#registerComponent).
75+
:::

0 commit comments

Comments
 (0)