From d64c42ac310d3c3266c4ff610d9ec5ab6c7707b6 Mon Sep 17 00:00:00 2001 From: AAGaming Date: Wed, 17 Jul 2024 19:29:25 -0400 Subject: [PATCH] fix(Menu/MenuGroup): rewrite filter to work on beta and prevent future errors --- src/components/Menu.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/components/Menu.ts b/src/components/Menu.ts index 6b7cbbf..08d4c1c 100755 --- a/src/components/Menu.ts +++ b/src/components/Menu.ts @@ -1,7 +1,6 @@ import { FC, ReactNode } from 'react'; -import { fakeRenderComponent } from '../utils'; -import { Export, findModuleExport } from '../webpack'; +import { Export, findModuleByExport, findModuleExport } from '../webpack'; import { FooterLegendProps } from './FooterLegend'; export const showContextMenu: (children: ReactNode, parent?: EventTarget) => void = findModuleExport( @@ -26,12 +25,8 @@ export interface MenuGroupProps { children?: ReactNode; } -export const MenuGroup: FC = findModuleExport( - (e: Export) => - (e?.toString()?.includes?.('bInGamepadUI:') && - fakeRenderComponent(() => e({ overview: { appid: 7 } }), {useContext: () => ({IN_GAMEPADUI: true})})?.type?.prototype?.RenderSubMenu) || - (e?.prototype?.RenderSubMenu && e?.prototype?.ShowSubMenu) -); +const MenuGoupModule = findModuleByExport(e => e?.prototype?.Focus && e?.prototype?.OnOKButton && e?.prototype?.render?.toString().includes?.(`"emphasis"==this.props.tone`)); +export const MenuGroup: FC = MenuGoupModule && Object.values(MenuGoupModule).find((e: Export) => typeof e == "function" && e?.toString()?.includes("bInGamepadUI:")); export interface MenuItemProps extends FooterLegendProps { bInteractableItem?: boolean; onClick?(evt: Event): void;