mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Pass initial props to WrapperComponent
Summary: `renderApplication` receives the root component that we need to render and an optional wrapper component. There are cases where we want to use the initial props passed to the root component in the wrapper component as well (e.g.: to provide a specific context to the root component), so this adds modifies `AppContainer` to accept the initial props and inject them into the wrapper component. Changelog: [General] [Added] - Modified `renderApplication` to forward `initialProps` to `WrapperComponent` Reviewed By: fkgozali Differential Revision: D21347486 fbshipit-source-id: 1c4f702a3875077630de1a44d3ac9ef2c80bc10c
This commit is contained in:
committed by
Facebook GitHub Bot
parent
0348953914
commit
4f5a092bf6
@@ -24,6 +24,7 @@ type Props = $ReadOnly<{|
|
||||
children?: React.Node,
|
||||
fabric?: boolean,
|
||||
rootTag: number,
|
||||
initialProps?: {...},
|
||||
showArchitectureIndicator?: boolean,
|
||||
WrapperComponent?: ?React.ComponentType<any>,
|
||||
internal_excludeLogBox?: ?boolean,
|
||||
@@ -119,6 +120,7 @@ class AppContainer extends React.Component<Props, State> {
|
||||
if (Wrapper != null) {
|
||||
innerView = (
|
||||
<Wrapper
|
||||
initialProps={this.props.initialProps}
|
||||
fabric={this.props.fabric === true}
|
||||
showArchitectureIndicator={
|
||||
this.props.showArchitectureIndicator === true
|
||||
|
||||
@@ -41,6 +41,7 @@ function renderApplication<Props: Object>(
|
||||
fabric={fabric}
|
||||
showArchitectureIndicator={showArchitectureIndicator}
|
||||
WrapperComponent={WrapperComponent}
|
||||
initialProps={initialProps}
|
||||
internal_excludeLogBox={isLogBox}>
|
||||
<RootComponent {...initialProps} rootTag={rootTag} />
|
||||
</AppContainer>
|
||||
|
||||
Reference in New Issue
Block a user