mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-01 09:23:16 +08:00
Convert Image resizeMode contain to FIT_CENTER
Summary:Convert from `CENTER_INSIDE` to `FIT_CENTER`. The difference between those is that `CENTER_INSIDE` will not upscale if the image is too small. See the Fresco docs: http://frescolib.org/javadoc/reference/com/facebook/drawee/drawable/ScalingUtils.ScaleType.html Original issue: https://github.com/facebook/react-native/issues/4031 Closes https://github.com/facebook/react-native/pull/5738 Differential Revision: D2959473 Pulled By: mkonicek fb-gh-sync-id: 8f76944e53b3d56fec0dc7303db339a71d0c389e shipit-source-id: 8f76944e53b3d56fec0dc7303db339a71d0c389e
This commit is contained in:
committed by
Facebook Github Bot 0
parent
10ad47a711
commit
2070efa019
@@ -87,7 +87,7 @@ import com.facebook.react.uimanager.events.TouchEventType;
|
||||
"ContentMode",
|
||||
MapBuilder.of(
|
||||
"ScaleAspectFit",
|
||||
ImageView.ScaleType.CENTER_INSIDE.ordinal(),
|
||||
ImageView.ScaleType.FIT_CENTER.ordinal(),
|
||||
"ScaleAspectFill",
|
||||
ImageView.ScaleType.CENTER_CROP.ordinal())));
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ public class ImageResizeMode {
|
||||
*/
|
||||
public static ScalingUtils.ScaleType toScaleType(@Nullable String resizeModeValue) {
|
||||
if ("contain".equals(resizeModeValue)) {
|
||||
return ScalingUtils.ScaleType.CENTER_INSIDE;
|
||||
return ScalingUtils.ScaleType.FIT_CENTER;
|
||||
}
|
||||
if ("cover".equals(resizeModeValue)) {
|
||||
return ScalingUtils.ScaleType.CENTER_CROP;
|
||||
|
||||
@@ -34,7 +34,7 @@ public class ImageResizeModeTest {
|
||||
.isEqualTo(ScalingUtils.ScaleType.CENTER_CROP);
|
||||
|
||||
assertThat(ImageResizeMode.toScaleType("contain"))
|
||||
.isEqualTo(ScalingUtils.ScaleType.CENTER_INSIDE);
|
||||
.isEqualTo(ScalingUtils.ScaleType.FIT_CENTER);
|
||||
|
||||
assertThat(ImageResizeMode.toScaleType("cover"))
|
||||
.isEqualTo(ScalingUtils.ScaleType.CENTER_CROP);
|
||||
|
||||
Reference in New Issue
Block a user