Skip to content

Commit

Permalink
Change ImageBackground to work with percentage image sizes
Browse files Browse the repository at this point in the history
Summary: ImageBackground assigned its Image the same `width` and `height` styles as itself. This became an issue for ImageBackground instances that were assigned (non 100%) percentage size values. For example, if the `width` and/or `height` of the ImageBackground was set to be 50%, it would be half the size of the current component it is in (as intended), but the Image would be 50% of the ImageBackground, which is only 25% the size of the ImageBackground's parent component.

Reviewed By: shergin

Differential Revision: D9307123

fbshipit-source-id: cec3802d30b72c44f66dd3a53693ebd669cc8db4
  • Loading branch information
jamiboym authored and facebook-github-bot committed Sep 10, 2018
1 parent f5d2889 commit 529e9ae
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Libraries/Image/ImageBackground.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ class ImageBackground extends React.Component<$FlowFixMeProps> {
// So, we have to proxy/reapply these styles explicitly for actual <Image> component.
// This workaround should be removed after implementing proper support of
// intrinsic content size of the <Image>.
width: style.width,
height: style.height,
width: '100%',
height: '100%',
},
imageStyle,
]}
Expand Down

0 comments on commit 529e9ae

Please sign in to comment.