From 4f5a092bf68a0cd825328ce4a1e6bb41a8fad2e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Norte?= Date: Tue, 5 May 2020 04:52:13 -0700 Subject: [PATCH] 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 --- Libraries/ReactNative/AppContainer.js | 2 ++ Libraries/ReactNative/renderApplication.js | 1 + 2 files changed, 3 insertions(+) diff --git a/Libraries/ReactNative/AppContainer.js b/Libraries/ReactNative/AppContainer.js index 93c83fba66350b..2c2b0fc157fd94 100644 --- a/Libraries/ReactNative/AppContainer.js +++ b/Libraries/ReactNative/AppContainer.js @@ -24,6 +24,7 @@ type Props = $ReadOnly<{| children?: React.Node, fabric?: boolean, rootTag: number, + initialProps?: {...}, showArchitectureIndicator?: boolean, WrapperComponent?: ?React.ComponentType, internal_excludeLogBox?: ?boolean, @@ -119,6 +120,7 @@ class AppContainer extends React.Component { if (Wrapper != null) { innerView = ( ( fabric={fabric} showArchitectureIndicator={showArchitectureIndicator} WrapperComponent={WrapperComponent} + initialProps={initialProps} internal_excludeLogBox={isLogBox}>