Skip to content

Commit

Permalink
feat: Updated modal rotation logic (#361)
Browse files Browse the repository at this point in the history
Use width and height returned from "didUpdateDimensions" listener, instead of multiplying it by 2 which is not needed, and sometimes makes buttons unclickable.
  • Loading branch information
fstojanac authored Feb 24, 2020
1 parent b2063af commit 1ea9578
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }
]}
/>
</TouchableWithoutFeedback>
Expand Down

0 comments on commit 1ea9578

Please sign in to comment.