From 1ea957855f1b0704deff654ba1df9783eab5440e Mon Sep 17 00:00:00 2001 From: Filip Stojanac Date: Mon, 24 Feb 2020 07:29:35 +0100 Subject: [PATCH] feat: Updated modal rotation logic (#361) Use width and height returned from "didUpdateDimensions" listener, instead of multiplying it by 2 which is not needed, and sometimes makes buttons unclickable. --- src/Modal.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Modal.js b/src/Modal.js index 98eced2..3a675aa 100644 --- a/src/Modal.js +++ b/src/Modal.js @@ -61,8 +61,8 @@ export class Modal extends Component { } handleDimensionsUpdate = dimensionsUpdate => { - const deviceWidth = Dimensions.get("window").width; - const deviceHeight = Dimensions.get("window").height; + const deviceWidth = dimensionsUpdate.width; + const deviceHeight = dimensionsUpdate.height; if ( deviceWidth !== this.state.deviceWidth || deviceHeight !== this.state.deviceHeight @@ -123,9 +123,7 @@ export class Modal extends Component { style={[ styles.backdrop, backdropAnimatedStyle, - // Multiplied by 2 to make sure the backdrop covers the entire - // screen even while changing orientation - { width: deviceWidth * 2, height: deviceHeight * 2 } + { width: deviceWidth, height: deviceHeight } ]} />