react-native-navigation的迁移库

layout-component.mdx 3.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. ---
  2. id: layout-component
  3. title: Component
  4. sidebar_label: Component
  5. ---
  6. ```js
  7. {
  8. name: "MyRegisteredComponent";
  9. }
  10. ```
  11. ## `name`
  12. | Type | Required | Description |
  13. | ------ | -------- | -------------------------------------------------------------------------------- |
  14. | string | Yes | Key used when registering the component with `Navigation.registerComponent`. |
  15. ## `id`
  16. | Type | Required | Description |
  17. | ------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  18. | string | No | Unique id used to interact with the view via the Navigation api, usually `Navigation.mergeOptions` which accepts the componentId as it's first argument. |
  19. ## `options`
  20. | Type | Required | Description |
  21. | ----------------------- | -------- | --------------------------------- |
  22. | [Options](options-root.mdx) | No | dynamic options for the component |
  23. ## `alignment`
  24. | Type | Required | Description |
  25. | ---------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  26. | enum('center', 'fill') | No | This option is relevant only to title components. `fill` will make the component stretch and consume all available space in the TopBar while `center` will center it in the middle of the TopBar. `center` is the default option in iOS while `fill` is the default for Android. |
  27. ## `waitForRender`
  28. | Type | Required | Description |
  29. | ------- | -------- | ------------------------------------------------------------------ |
  30. | boolean | No | Wait for this component to fully render before showing the screen. |
  31. This option is useful for ensuring that both a child screen pushed into the stack and all of the TopBar components (title, background and buttons) are displayed to the user at the same time.
  32. To enable this option, `waitForRender` in the relevant screen animation option needs to be enabled as well.
  33. :::caution
  34. This option might introduce delays when pushing screens and should be used with caution.
  35. :::
  36. ## `passProps`
  37. | Type | Required | Description |
  38. | ------ | -------- | ---------------------------------------------------------------------------------- |
  39. | object | No | A JavaScript object with props accessible inside the component using `this.props`. |