When resizeMode.contain is it possible not "center" the image?
See original GitHub issueDescribe the bug I’m not sure if this is a bug, but following the code and image bellow, I notice that there’s always a white space between the image, like the image it’s been centered some how. I tried flex alignments but noting seems to work.
Using resizeMode.contain
I got the white spaces; using resizeMode.cover
I loose a little of the width.
The white space increase as the image gets taller (huge height).
To Reproduce Follow the code:
<FastImage
style={{ flex: 1 }}
source={{
priority: FastImage.priority.normal,
uri: this.props.src
}}
resizeMode={this.props.resizeMode || FastImage.resizeMode.contain}
/>
Expected behavior
The image should not have those white spaces at top and bottom of the element <FastImage
.
Screenshots
Dependency versions
- React Native version: 0.59.9
- React version: 16.8.3
- React Native Fast Image version: 6.0.3
Note: if these are not the latest versions of each I recommend updating as extra effort will not be taken to be backwards compatible, and updating might resolving your issue.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:6
- Comments:8
Top GitHub Comments
I just faced the same issue, - an image with
resizeMode="contain"
gets centered and ignored thejustifyContent="flex-end"
setting of the outer container. I managed to “fix” this by setting bothwidth
andheight
of the image toundefined
and also specifying itsaspectRatio
, just like this:Hope this may help somebody.
Hey @rochapablo did you end up solving this?