feat(utils): add wrapReactClass

This commit is contained in:
AAGaming
2022-08-17 14:45:34 -04:00
parent f7d73b4dc3
commit d237bd48e4

View File

@@ -82,8 +82,14 @@ export function unpatch(obj: any, name: any): void {
obj[name] = obj[name].__deckyOrig;
}
export function wrapReactType(node: any) {
return node.type = {...node.type}
export function wrapReactType(node: any, prop?: any) {
return node[prop || "type"] = {...node[prop || "type"]};
}
export function wrapReactClass(node: any, prop?: any) {
const cls = node[prop || "type"];
const wrappedCls = class extends cls {};
return node[prop || "type"] = wrappedCls;
}
export function getReactInstance(o: HTMLElement | Element | Node) {