Skip to content

Commit

Permalink
fix(ui): modal center positioning
Browse files Browse the repository at this point in the history
  • Loading branch information
Artur Yorsh committed Oct 30, 2019
1 parent 480311f commit 1932d96
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/framework/ui/modal/modal.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
import { Size } from '../popover/type';
import { ModalPresentingBased } from '../support/typings';

const { width: screenWidth, height: screenHeight } = Dimensions.get('screen');
const initialWindowSize: Size = Dimensions.get('screen');
const TAG_CHILD: string = 'Modal';
const initialContentSize: Size = { width: 0, height: 0 };
export const baseModalTestId: string = '@modal/base';
Expand Down Expand Up @@ -61,7 +61,7 @@ export type ModalElement = React.ReactElement<ModalProps>;
* @property {() => void} onBackdropPress - Determines component's behavior when the user is
* tapping on back-drop.
*
* @property ViewProps
* @property ViewProps - Any props applied to View component.
*
* @overview-example Simple Usage
*
Expand Down Expand Up @@ -209,11 +209,11 @@ export class Modal extends React.Component<ModalProps> {
};

private getAbsoluteRelatedStyle = (): StyleType => {
const { width, height } = this.contentSize;
const windowSize: Size = Dimensions.get('window');

return {
top: (screenHeight - height) / 2,
left: (screenWidth - width) / 2,
top: (windowSize.height - this.contentSize.height) / 2,
left: (windowSize.width - this.contentSize.width) / 2,
};
};

Expand Down Expand Up @@ -278,8 +278,8 @@ const styles = StyleSheet.create({
},
backdrop: {
position: 'absolute',
width: screenWidth,
height: screenHeight,
width: initialWindowSize.width,
height: initialWindowSize.height,
},
hiddenModal: {
opacity: 0,
Expand Down

0 comments on commit 1932d96

Please sign in to comment.