Expose setSurfaceProps API in JS
Summary: This diff introduces the new function "setSurfaceProps" in SurfaceRegistry and AppRegistry This new method will be used to update initialProps of a surface at the root level. In the near future this will be useful to integrate the OffScreen API component in pre-rendering changelog: [internal] internal Reviewed By: JoshuaGross Differential Revision: D27607587 fbshipit-source-id: 3cc58c51924feb68f6a24bf762986c57f9a245ae
This commit is contained in:
Родитель
c91e32b050
Коммит
b5e2e1d52d
|
@ -201,6 +201,33 @@ const AppRegistry = {
|
|||
runnables[appKey].run(appParameters);
|
||||
},
|
||||
|
||||
/**
|
||||
* Update initial props for a surface that's already rendered
|
||||
*/
|
||||
setSurfaceProps(appKey: string, appParameters: any): void {
|
||||
if (appKey !== 'LogBox') {
|
||||
const msg =
|
||||
'Updating props for Surface "' +
|
||||
appKey +
|
||||
'" with ' +
|
||||
JSON.stringify(appParameters);
|
||||
infoLog(msg);
|
||||
BugReporting.addSource(
|
||||
'AppRegistry.setSurfaceProps' + runCount++,
|
||||
() => msg,
|
||||
);
|
||||
}
|
||||
invariant(
|
||||
runnables[appKey] && runnables[appKey].run,
|
||||
`"${appKey}" has not been registered. This can happen if:\n` +
|
||||
'* Metro (the local dev server) is run from the wrong folder. ' +
|
||||
'Check if Metro is running, stop it and restart it in the current project.\n' +
|
||||
"* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.",
|
||||
);
|
||||
|
||||
runnables[appKey].run(appParameters);
|
||||
},
|
||||
|
||||
/**
|
||||
* Stops an application when a view should be destroyed.
|
||||
*
|
||||
|
|
Загрузка…
Ссылка в новой задаче