Skip to content

Commit

Permalink
Update package.json version to 7.11.4 [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
mobile1-internal committed Mar 25, 2021
1 parent e17a868 commit a7b7172
Show file tree
Hide file tree
Showing 107 changed files with 14,129 additions and 2,710 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-navigation",
"version": "7.11.2",
"version": "7.11.4",
"description": "React Native Navigation - truly native navigation for iOS and Android",
"license": "MIT",
"nativePackage": true,
Expand Down
8,230 changes: 5,522 additions & 2,708 deletions website/package-lock.json

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"@docusaurus/plugin-pwa": "2.0.0-alpha.71",
"@docusaurus/preset-classic": "2.0.0-alpha.71",
"@docusaurus/theme-live-codeblock": "2.0.0-alpha.71",
"@docusaurus/plugin-ideal-image": "2.0.0-alpha.71",
"react": "^16.8.4",
"react-dom": "^16.8.4",
"remark-code-import": "^0.2.0"
Expand Down
74 changes: 74 additions & 0 deletions website/versioned_docs/version-7.11.4/api/api-component.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
id: component
title: Component
sidebar_label: Component
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

## `registerComponent`
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`.

#### Parameters
| Name | Required | Type | Description |
| ------ | -------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| componentName | Yes | string | Unique component name - not to be confused with **componentId** |
| componentProvider | Yes | Function | Anonymous function that returns the React component to register, **OR** the component wrapped with Providers|
| 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.|

#### Examples
##### Registering a component
```js
Navigation.registerComponent(`navigation.playground.WelcomeScreen`, () => WelcomeScreen);
```

##### Registering a component wrapped with Providers
```js
import { Provider } from 'react-redux';
const store = createStore();

Navigation.registerComponent(`navigation.playground.MyScreen`, () => (props) =>
<Provider store={store}>
<MyScreen {...props} />
</Provider>,
() => MyScreen)
);
```

## `setLazyComponentRegistrator`
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.

#### Parameters
| Name | Required | Type | Description |
| ------ | -------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| lazyRegistratorFn | Yes | (lazyComponentRequest: string | number) => void | A function that takes a componentName, will be called when encountering an unknown componentName |

#### Example
```js
Navigation.setLazyComponentRegistrator((componentName) => {
if (componentName === 'navigation.playground.LazyScreen') {
Navigation.registerComponent(Screens.LazilyRegisteredScreen, () => LazyScreen);
}
});
```

## `updateProps`
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).

#### Parameters
| Name | Required | Type | Description |
| ------ | -------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| componentId | Yes | string | Unique component id |
| options | Yes | object | props object to pass to the component |

#### Example
```js
Navigation.updateProps('MY_COMPONENT', {
// props to pass to the component
};
```
:::important
`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).
:::
Loading

0 comments on commit a7b7172

Please sign in to comment.