feat(Utilities): add wrapReactType utility

This commit is contained in:
AAGaming
2022-08-12 21:24:51 -04:00
parent df1c8dbb8b
commit 7cf45cf371

View File

@@ -82,6 +82,11 @@ export function unpatch(obj: any, name: any): void {
obj[name] = obj[name].__deckyOrig;
}
export function wrapReactType(node: any) {
const oldComponent = node.type;
return node.type = (...args: any[]) => React.createElement(oldComponent, ...args)
}
export function getReactInstance(o: HTMLElement | Element | Node) {
return o[Object.keys(o).find(k => k.startsWith('__reactInternalInstance')) as string]
}