diff options
| author | AAGaming <aagaming@riseup.net> | 2024-05-12 15:47:08 -0400 |
|---|---|---|
| committer | AAGaming <aagaming@riseup.net> | 2024-05-12 15:47:08 -0400 |
| commit | 0b1c0694489b1b74b21c10ad29b59912edeb5e01 (patch) | |
| tree | 659ef5ba75e3678c60bbf27c8a854e00e0bf74b2 /frontend/src/router-hook.tsx | |
| parent | 43b940e216e6b654e689cf791d298d57215196d4 (diff) | |
| download | decky-loader-0b1c0694489b1b74b21c10ad29b59912edeb5e01.tar.gz decky-loader-0b1c0694489b1b74b21c10ad29b59912edeb5e01.zip | |
port to @decky/ui
TODO: update package.json to match once @decky/ui is on NPM
Diffstat (limited to 'frontend/src/router-hook.tsx')
| -rw-r--r-- | frontend/src/router-hook.tsx | 12 |
1 files changed, 4 insertions, 8 deletions
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. |
