Skip to content

Commit dc76381

Browse files
jamiboymgengjiawen
authored andcommitted
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
1 parent e816c70 commit dc76381

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Libraries/Image/ImageBackground.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ class ImageBackground extends React.Component<$FlowFixMeProps> {
7676
// So, we have to proxy/reapply these styles explicitly for actual <Image> component.
7777
// This workaround should be removed after implementing proper support of
7878
// intrinsic content size of the <Image>.
79-
width: style.width,
80-
height: style.height,
79+
width: '100%',
80+
height: '100%',
8181
},
8282
imageStyle,
8383
]}

0 commit comments

Comments
 (0)