mirror of
https://github.com/SteamDeckHomebrew/decky-frontend-lib.git
synced 2026-05-23 03:18:48 +02:00
feat(modal): support for latest steamos preview
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { FC, ReactNode } from 'react';
|
||||
import { findSP } from '../utils';
|
||||
import { findModuleChild } from '../webpack';
|
||||
|
||||
// All of the popout options + strTitle are related. Proper usage is not yet known...
|
||||
@@ -27,7 +28,7 @@ export interface ShowModalResult {
|
||||
Update: (modal: ReactNode) => void;
|
||||
}
|
||||
|
||||
export const showModal: (modal: ReactNode, parent?: EventTarget, props?: ShowModalProps) => Promise<ShowModalResult> = findModuleChild((m) => {
|
||||
const showModalRaw: (modal: ReactNode, parent?: EventTarget, props?: ShowModalProps) => Promise<ShowModalResult> = findModuleChild((m) => {
|
||||
if (typeof m !== 'object') return undefined;
|
||||
for (let prop in m) {
|
||||
if (typeof m[prop] === 'function' && m[prop].toString().includes('bHideMainWindowForPopouts:!0')) {
|
||||
@@ -36,6 +37,10 @@ export const showModal: (modal: ReactNode, parent?: EventTarget, props?: ShowMod
|
||||
}
|
||||
});
|
||||
|
||||
export const showModal = (modal: ReactNode, parent?: EventTarget, props?: ShowModalProps): Promise<ShowModalResult> => {
|
||||
return showModalRaw(modal, parent || findSP(), props)
|
||||
}
|
||||
|
||||
export interface ModalRootProps {
|
||||
children?: ReactNode;
|
||||
onCancel?(): void;
|
||||
|
||||
Reference in New Issue
Block a user