diff options
| author | AAGaming <aa@mail.catvibers.me> | 2022-09-04 22:14:35 -0400 |
|---|---|---|
| committer | AAGaming <aa@mail.catvibers.me> | 2022-09-04 22:14:35 -0400 |
| commit | 843e03b42c7a33ba081be7ccde50f08c8f8d4812 (patch) | |
| tree | b794035ba72816ba072e78d6512a0ab4b42f5950 | |
| parent | 5f469bfb1628ffe17eb7921359682d6b24e380c4 (diff) | |
| download | decky-loader-843e03b42c7a33ba081be7ccde50f08c8f8d4812.tar.gz decky-loader-843e03b42c7a33ba081be7ccde50f08c8f8d4812.zip | |
fix(toaster): allow toasts to show ingame
| -rw-r--r-- | frontend/src/components/Toast.tsx | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/frontend/src/components/Toast.tsx b/frontend/src/components/Toast.tsx index 559c37c6..9a74eb5d 100644 --- a/frontend/src/components/Toast.tsx +++ b/frontend/src/components/Toast.tsx @@ -1,5 +1,5 @@ -import { ToastData, findModule, joinClassNames } from 'decky-frontend-lib'; -import { FunctionComponent } from 'react'; +import { ToastData, findModule, findModuleChild, joinClassNames } from 'decky-frontend-lib'; +import { FunctionComponent, useEffect } from 'react'; interface ToastProps { toast: { @@ -28,7 +28,21 @@ const templateClasses = findModule((mod) => { return false; }); +const useComposition = findModuleChild((m: any) => { + if (typeof m !== 'object') return false; + for (let prop in m) { + if (m[prop]?.toString()?.includes('.Get().ChangeMinimumCompositionStateRequest')) return m[prop]; + } + return false; +}); + const Toast: FunctionComponent<ToastProps> = ({ toast }) => { + const composition = useComposition(2); // 2: overlay + useEffect(() => { + return () => { + composition.releaseComposition(); + }; + }, []); return ( <div style={{ '--toast-duration': `${toast.nToastDurationMS}ms` } as React.CSSProperties} |
