mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-07-11 11:41:58 +00:00
fix(toasts): handle toasts ingame properly without useComposition hack
This commit is contained in:
@@ -28,21 +28,7 @@ const templateClasses = findModule((mod) => {
|
|||||||
return false;
|
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 Toast: FunctionComponent<ToastProps> = ({ toast }) => {
|
||||||
const composition = useComposition(2); // 2: overlay
|
|
||||||
useEffect(() => {
|
|
||||||
return () => {
|
|
||||||
composition.releaseComposition();
|
|
||||||
};
|
|
||||||
}, []);
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
style={{ '--toast-duration': `${toast.nToastDurationMS}ms` } as React.CSSProperties}
|
style={{ '--toast-duration': `${toast.nToastDurationMS}ms` } as React.CSSProperties}
|
||||||
|
|||||||
@@ -79,7 +79,6 @@ class Toaster extends Logger {
|
|||||||
return;
|
return;
|
||||||
window.NotificationStore.m_rgNotificationToasts.push(toastData);
|
window.NotificationStore.m_rgNotificationToasts.push(toastData);
|
||||||
window.NotificationStore.DispatchNextToast();
|
window.NotificationStore.DispatchNextToast();
|
||||||
window.NotificationStore.m_rgNotificationToasts.pop();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
deinit() {
|
deinit() {
|
||||||
|
|||||||
Reference in New Issue
Block a user