diff --git a/src/components/ImageView/index.native.js b/src/components/ImageView/index.native.js index f851246e56ef..4a364bdd3583 100644 --- a/src/components/ImageView/index.native.js +++ b/src/components/ImageView/index.native.js @@ -34,6 +34,7 @@ class ImageView extends PureComponent { imageWidth: undefined, imageHeight: undefined, interactionPromise: undefined, + containerHeight: undefined, }; // Use the default double click interval from the ImageZoom library @@ -72,7 +73,7 @@ class ImageView extends PureComponent { let imageWidth = width; let imageHeight = height; const containerWidth = Math.round(this.props.windowWidth); - const containerHeight = Math.round(this.props.windowHeight - variables.contentHeaderHeight); + const containerHeight = Math.round(this.state.containerHeight); const aspectRatio = Math.min(containerHeight / imageHeight, containerWidth / imageWidth); @@ -134,6 +135,12 @@ class ImageView extends PureComponent { styles.overflowHidden, styles.errorOutline, ]} + onLayout={(event) => { + const layout = event.nativeEvent.layout; + this.setState({ + containerHeight: layout.height, + }); + }} > { const {isSmallScreenWidth, windowWidth} = windowDimensions; diff --git a/src/styles/getModalStyles/index.android.js b/src/styles/getModalStyles/index.android.js new file mode 100644 index 000000000000..e7e3531171ae --- /dev/null +++ b/src/styles/getModalStyles/index.android.js @@ -0,0 +1,7 @@ +import getBaseModalStyles from './getBaseModalStyles'; + +// Only apply top padding on iOS since it's the only platform using SafeAreaView +export default (type, windowDimensions, popoverAnchorPosition = {}, containerStyle = {}) => ({ + ...getBaseModalStyles(type, windowDimensions, popoverAnchorPosition, containerStyle), + shouldAddTopSafeAreaPadding: false, +}); diff --git a/src/styles/getModalStyles/index.js b/src/styles/getModalStyles/index.js new file mode 100644 index 000000000000..4e35fa589119 --- /dev/null +++ b/src/styles/getModalStyles/index.js @@ -0,0 +1,3 @@ +import getBaseModalStyles from './getBaseModalStyles'; + +export default getBaseModalStyles;