Merge pull request #1728 from BetterDiscord/hotfix-031524
Fix for more functional components
This commit is contained in:
commit
1594242c59
|
@ -237,7 +237,7 @@
|
|||
}
|
||||
|
||||
.bd-addon-modal {
|
||||
min-height: unset;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.bd-addon-modal-settings {
|
||||
|
|
|
@ -15,7 +15,7 @@ export default class ErrorBoundary extends React.Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
if (this.state.hasError) return <div onClick={() => IPC.openDevTools()} className="react-error">There was an unexpected Error. Click to open console for more details.</div>;
|
||||
if (this.state.hasError && !this.props.hideError) return <div onClick={() => IPC.openDevTools()} className="react-error">There was an unexpected Error. Click to open console for more details.</div>;
|
||||
return this.props.children;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -280,7 +280,7 @@ export default class Modals {
|
|||
static makeStack() {
|
||||
const div = DOMManager.parseHTML(`<div id="bd-modal-container">`);
|
||||
DOMManager.bdBody.append(div);
|
||||
ReactDOM.render(<ModalStack />, div);
|
||||
ReactDOM.render(<ErrorBoundary hideError={true}><ModalStack /></ErrorBoundary>, div);
|
||||
this.hasInitialized = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@ import Backdrop from "./backdrop";
|
|||
const {Fragment, useState, useCallback, useEffect} = React;
|
||||
|
||||
|
||||
const Transitions = WebpackModules.getModule(m => m?.defaultProps?.transitionAppear);
|
||||
// const Transitions = WebpackModules.getByProps("TransitionGroup").TransitionGroup;
|
||||
const Transitions = WebpackModules.getModule(m => m?.defaultProps?.transitionAppear || m?.TransitionGroup?.defaultProps);
|
||||
const TransitionGroup = Transitions.TransitionGroup ?? Transitions;
|
||||
|
||||
class ModalLayer extends React.Component {
|
||||
constructor(props) {
|
||||
|
@ -69,8 +69,8 @@ export default function ModalStack() {
|
|||
};
|
||||
}, [addModal]);
|
||||
|
||||
return <Transitions component={Fragment}>
|
||||
return <TransitionGroup component={Fragment}>
|
||||
<Backdrop isVisible={!!modals.length} onClick={() => removeModal(modals[modals.length - 1].modalKey)} />
|
||||
{modals.length && <ModalLayer key={modals[modals.length - 1].modalKey} {...modals[modals.length - 1]} onClose={() => removeModal(modals[modals.length - 1].modalKey)} />}
|
||||
</Transitions>;
|
||||
</TransitionGroup>;
|
||||
}
|
Loading…
Reference in New Issue