From 0b1c0694489b1b74b21c10ad29b59912edeb5e01 Mon Sep 17 00:00:00 2001 From: AAGaming Date: Sun, 12 May 2024 15:47:08 -0400 Subject: port to @decky/ui TODO: update package.json to match once @decky/ui is on NPM --- frontend/src/router-hook.tsx | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'frontend/src/router-hook.tsx') diff --git a/frontend/src/router-hook.tsx b/frontend/src/router-hook.tsx index 28f6923c..7c52e581 100644 --- a/frontend/src/router-hook.tsx +++ b/frontend/src/router-hook.tsx @@ -1,4 +1,4 @@ -import { Patch, afterPatch, findModuleChild } from 'decky-frontend-lib'; +import { Export, Patch, afterPatch, findModuleExport } from '@decky/ui'; import { FC, ReactElement, ReactNode, cloneElement, createElement, memo } from 'react'; import type { Route } from 'react-router'; @@ -41,13 +41,9 @@ class RouterHook extends Logger { window.__ROUTER_HOOK_INSTANCE?.deinit?.(); window.__ROUTER_HOOK_INSTANCE = this; - this.gamepadWrapper = findModuleChild((m) => { - if (typeof m !== 'object') return undefined; - for (let prop in m) { - if (m[prop]?.render?.toString()?.includes('["flow-children","onActivate","onCancel","focusClassName",')) - return m[prop]; - } - }); + this.gamepadWrapper = findModuleExport((e: Export) => + e?.render?.toString()?.includes('["flow-children","onActivate","onCancel","focusClassName",'), + ); let Route: new () => Route; // Used to store the new replicated routes we create to allow routes to be unpatched. -- cgit v1.2.3