Skip to content

Commit 4f5a092

Browse files
rubennortefacebook-github-bot
authored andcommitted
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
1 parent 0348953 commit 4f5a092

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

Libraries/ReactNative/AppContainer.js

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ type Props = $ReadOnly<{|
2424
children?: React.Node,
2525
fabric?: boolean,
2626
rootTag: number,
27+
initialProps?: {...},
2728
showArchitectureIndicator?: boolean,
2829
WrapperComponent?: ?React.ComponentType<any>,
2930
internal_excludeLogBox?: ?boolean,
@@ -119,6 +120,7 @@ class AppContainer extends React.Component<Props, State> {
119120
if (Wrapper != null) {
120121
innerView = (
121122
<Wrapper
123+
initialProps={this.props.initialProps}
122124
fabric={this.props.fabric === true}
123125
showArchitectureIndicator={
124126
this.props.showArchitectureIndicator === true

Libraries/ReactNative/renderApplication.js

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ function renderApplication<Props: Object>(
4141
fabric={fabric}
4242
showArchitectureIndicator={showArchitectureIndicator}
4343
WrapperComponent={WrapperComponent}
44+
initialProps={initialProps}
4445
internal_excludeLogBox={isLogBox}>
4546
<RootComponent {...initialProps} rootTag={rootTag} />
4647
</AppContainer>

0 commit comments

Comments
 (0)