Pass selectedApp as prop to FlipperPlugin

Summary: I have found it neccessary to get the current app name for the Navigation plugin. This passes the current selectedApp as a prop into any FlipperPlugin.

Reviewed By: jknoxville

Differential Revision: D16645855

fbshipit-source-id: 996d41b1a0e939427e66fa0df172ce1a6471f686
This commit is contained in:
Benjamin Elo
2019-08-05 03:49:24 -07:00
committed by Facebook Github Bot
parent e87a1a44c4
commit c45724a767
2 changed files with 5 additions and 1 deletions

View File

@@ -50,7 +50,7 @@ type Props = {|
target: Client | BaseDevice | null,
pluginKey: ?string,
deepLinkPayload: ?string,
selectedApp: ?string,
selectPlugin: (payload: {|
selectedPlugin: ?string,
selectedApp?: ?string,
@@ -94,6 +94,7 @@ class PluginContainer extends PureComponent<Props> {
pluginKey,
target,
isArchivedDevice,
selectedApp,
} = this.props;
if (!activePlugin || !target || !pluginKey) {
console.warn(`No selected plugin. Rendering empty!`);
@@ -102,6 +103,7 @@ class PluginContainer extends PureComponent<Props> {
const props: PluginProps<Object> = {
key: pluginKey,
logger: this.props.logger,
selectedApp,
persistedState: activePlugin.defaultPersistedState
? {
...activePlugin.defaultPersistedState,
@@ -190,6 +192,7 @@ export default connect<Props, OwnProps, _, _, _, _>(
deepLinkPayload,
pluginKey,
isArchivedDevice,
selectedApp,
};
},
{

View File

@@ -59,6 +59,7 @@ export type Props<T> = {
deepLinkPayload: ?string,
selectPlugin: (pluginID: string, deepLinkPayload: ?string) => boolean,
isArchivedDevice: boolean,
selectedApp: ?string,
};
export class FlipperBasePlugin<