Detect if given Component is LithoComponent

Summary: Useful for next diffs: enables to detect whether we have LithoComponent or CKComponent

Reviewed By: adityasharat

Differential Revision: D23128972

fbshipit-source-id: b9aef358c1426df4f05213c42e43402e8cae984f
This commit is contained in:
Dominik Wielgórski
2020-08-17 10:18:07 -07:00
committed by Facebook GitHub Bot
parent 26b54ece5a
commit 939ed27aad
4 changed files with 22 additions and 3 deletions

View File

@@ -332,7 +332,12 @@ public class DebugComponentDescriptor extends NodeDescriptor<DebugComponent> {
// doesn't add linked node descriptor // doesn't add linked node descriptor
} }
} }
extraInfo.put("className", node.getComponent().getClass().getName()); final FlipperObject.Builder metaData = new FlipperObject.Builder();
metaData.put("className", node.getComponent().getClass().getName());
metaData.put("framework", "LITHO");
extraInfo.put("metaData", metaData);
return extraInfo.build(); return extraInfo.build();
} }

View File

@@ -110,7 +110,13 @@ public class DebugSectionDescriptor extends NodeDescriptor<DebugSection> {
@Override @Override
public FlipperObject getExtraInfo(DebugSection node) { public FlipperObject getExtraInfo(DebugSection node) {
FlipperObject.Builder extraInfo = new FlipperObject.Builder(); FlipperObject.Builder extraInfo = new FlipperObject.Builder();
extraInfo.put("className", node.getSection().getClass().getName());
final FlipperObject.Builder metaData = new FlipperObject.Builder();
metaData.put("className", node.getSection().getClass().getName());
metaData.put("framework", "LITHO");
extraInfo.put("metaData", metaData);
return extraInfo.build(); return extraInfo.build();
} }

View File

@@ -171,6 +171,7 @@ export {default as SearchableTable_immutable} from './ui/components/searchable/S
export { export {
ElementID, ElementID,
ElementData, ElementData,
ElementFramework,
ElementAttribute, ElementAttribute,
Element, Element,
ElementSearchResultSet, ElementSearchResultSet,

View File

@@ -32,6 +32,11 @@ export type ElementData = {
}; };
}; };
export enum ElementFramework {
'LITHO',
'CK',
}
export type ElementAttribute = { export type ElementAttribute = {
name: string; name: string;
value: string; value: string;
@@ -41,7 +46,9 @@ export type ElementExtraInfo = {
linkedNode?: string; // id of linked node in opposite tree linkedNode?: string; // id of linked node in opposite tree
expandWithParent?: boolean; expandWithParent?: boolean;
linkedTree?: string; linkedTree?: string;
className?: string; metaData?: {
[key: string]: any;
};
}; };
export type Element = { export type Element = {