Skip to content

Commit 3d5de65

Browse files
fix(modals): fix ModalRoot on beta
Co-Authored-By: junkrunner <[email protected]>
1 parent 33d224b commit 3d5de65

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

src/components/Modal.ts

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -86,19 +86,23 @@ export const ConfirmModal = findModuleExport(
8686
(e: Export) => e?.toString()?.includes('bUpdateDisabled') && e?.toString()?.includes('closeModal') && e?.toString()?.includes('onGamepadCancel'),
8787
) as FC<ConfirmModalProps>;
8888

89-
export const ModalRoot = Object.values(
90-
findModule((m: any) => {
91-
if (typeof m !== 'object') return false;
92-
93-
for (let prop in m) {
94-
if (m[prop]?.m_mapModalManager && Object.values(m)?.find((x: any) => x?.type)) {
95-
return true;
89+
export const ModalRoot =
90+
// new
91+
findModuleExport((e: Export) => typeof e === 'function' && e.toString().includes('Either closeModal or onCancel should be passed to GenericDialog. Classes: ')) ||
92+
// old
93+
Object.values(
94+
findModule((m: any) => {
95+
if (typeof m !== 'object') return false;
96+
97+
for (let prop in m) {
98+
if (m[prop]?.m_mapModalManager && Object.values(m)?.find((x: any) => x?.type)) {
99+
return true;
100+
}
96101
}
97-
}
98102

99-
return false;
100-
}) || {},
101-
)?.find((x: any) => x?.type?.toString?.()?.includes('((function(){')) as FC<ModalRootProps>;
103+
return false;
104+
}) || {},
105+
)?.find((x: any) => x?.type?.toString?.()?.includes('((function(){')) as FC<ModalRootProps>;
102106

103107
interface SimpleModalProps {
104108
active?: boolean;

0 commit comments

Comments
 (0)