Change ImageBackground to work with percentage image sizes

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
This commit is contained in:
Jamiboy Mohammad 2018-09-10 13:37:59 -07:00 committed by Facebook Github Bot
parent 7eb82f32a2
commit dbec6e1096

View File

@ -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,
]}