Skip to content

Commit

Permalink
Merge pull request #2706 from myxmaster/hide-modal-when-locked
Browse files Browse the repository at this point in the history
Hide modal dialogs on lock screen
  • Loading branch information
kaloudis authored Jan 6, 2025
2 parents 97c392a + 58f5ddd commit 9208389
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions components/ModalBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ import {
StyleProp,
LayoutChangeEvent
} from 'react-native';
import { inject, observer } from 'mobx-react';

import SettingsStore from '../stores/SettingsStore';

const {
height: SCREEN_HEIGHT,
Expand Down Expand Up @@ -69,6 +72,7 @@ interface ModalBoxProps {
children?: React.ReactNode;
useNativeDriver?: boolean;
onLayout?: (event: LayoutChangeEvent) => void;
SettingsStore?: SettingsStore;
}

interface ModalBoxState {
Expand All @@ -92,6 +96,8 @@ interface ModalBoxState {
positionDest?: number;
}

@inject('SettingsStore')
@observer
export default class ModalBox extends React.PureComponent<
ModalBoxProps,
ModalBoxState
Expand Down Expand Up @@ -641,9 +647,10 @@ export default class ModalBox extends React.PureComponent<
*/
render() {
const visible =
this.state.isOpen ||
this.state.isAnimateOpen ||
this.state.isAnimateClose;
!this.props.SettingsStore!.loginRequired() &&
(this.state.isOpen ||
this.state.isAnimateOpen ||
this.state.isAnimateClose);

if (!visible) return <View />;

Expand Down

0 comments on commit 9208389

Please sign in to comment.