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:
committed by
Facebook Github Bot
parent
e87a1a44c4
commit
c45724a767
@@ -50,7 +50,7 @@ type Props = {|
|
|||||||
target: Client | BaseDevice | null,
|
target: Client | BaseDevice | null,
|
||||||
pluginKey: ?string,
|
pluginKey: ?string,
|
||||||
deepLinkPayload: ?string,
|
deepLinkPayload: ?string,
|
||||||
|
selectedApp: ?string,
|
||||||
selectPlugin: (payload: {|
|
selectPlugin: (payload: {|
|
||||||
selectedPlugin: ?string,
|
selectedPlugin: ?string,
|
||||||
selectedApp?: ?string,
|
selectedApp?: ?string,
|
||||||
@@ -94,6 +94,7 @@ class PluginContainer extends PureComponent<Props> {
|
|||||||
pluginKey,
|
pluginKey,
|
||||||
target,
|
target,
|
||||||
isArchivedDevice,
|
isArchivedDevice,
|
||||||
|
selectedApp,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
if (!activePlugin || !target || !pluginKey) {
|
if (!activePlugin || !target || !pluginKey) {
|
||||||
console.warn(`No selected plugin. Rendering empty!`);
|
console.warn(`No selected plugin. Rendering empty!`);
|
||||||
@@ -102,6 +103,7 @@ class PluginContainer extends PureComponent<Props> {
|
|||||||
const props: PluginProps<Object> = {
|
const props: PluginProps<Object> = {
|
||||||
key: pluginKey,
|
key: pluginKey,
|
||||||
logger: this.props.logger,
|
logger: this.props.logger,
|
||||||
|
selectedApp,
|
||||||
persistedState: activePlugin.defaultPersistedState
|
persistedState: activePlugin.defaultPersistedState
|
||||||
? {
|
? {
|
||||||
...activePlugin.defaultPersistedState,
|
...activePlugin.defaultPersistedState,
|
||||||
@@ -190,6 +192,7 @@ export default connect<Props, OwnProps, _, _, _, _>(
|
|||||||
deepLinkPayload,
|
deepLinkPayload,
|
||||||
pluginKey,
|
pluginKey,
|
||||||
isArchivedDevice,
|
isArchivedDevice,
|
||||||
|
selectedApp,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ export type Props<T> = {
|
|||||||
deepLinkPayload: ?string,
|
deepLinkPayload: ?string,
|
||||||
selectPlugin: (pluginID: string, deepLinkPayload: ?string) => boolean,
|
selectPlugin: (pluginID: string, deepLinkPayload: ?string) => boolean,
|
||||||
isArchivedDevice: boolean,
|
isArchivedDevice: boolean,
|
||||||
|
selectedApp: ?string,
|
||||||
};
|
};
|
||||||
|
|
||||||
export class FlipperBasePlugin<
|
export class FlipperBasePlugin<
|
||||||
|
|||||||
Reference in New Issue
Block a user