mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-07 22:40:55 +08:00
Add center ImageResizeMode option
Summary:Adds a `center` option to `Image`'s `resizeMode` prop, which doesn't enlarge images.
This is how it looks in UIExplorer:
{F60386921}
Reviewed By: dmmiller
Differential Revision: D3064284
fb-gh-sync-id: 79cd2da8f44c5b3da2e42d3bebf3131335f53c28
shipit-source-id: 79cd2da8f44c5b3da2e42d3bebf3131335f53c28
This commit is contained in:
committed by
Facebook Github Bot 7
parent
05b9902ae6
commit
fb8340d289
@@ -89,7 +89,9 @@ import com.facebook.react.uimanager.events.TouchEventType;
|
||||
"ScaleAspectFit",
|
||||
ImageView.ScaleType.FIT_CENTER.ordinal(),
|
||||
"ScaleAspectFill",
|
||||
ImageView.ScaleType.CENTER_CROP.ordinal())));
|
||||
ImageView.ScaleType.CENTER_CROP.ordinal(),
|
||||
"ScaleAspectCenter",
|
||||
ImageView.ScaleType.CENTER_INSIDE.ordinal())));
|
||||
|
||||
DisplayMetrics displayMetrics = DisplayMetricsHolder.getWindowDisplayMetrics();
|
||||
DisplayMetrics screenDisplayMetrics = DisplayMetricsHolder.getScreenDisplayMetrics();
|
||||
|
||||
@@ -33,6 +33,9 @@ public class ImageResizeMode {
|
||||
if ("stretch".equals(resizeModeValue)) {
|
||||
return ScalingUtils.ScaleType.FIT_XY;
|
||||
}
|
||||
if ("center".equals(resizeModeValue)) {
|
||||
return ScalingUtils.ScaleType.CENTER_INSIDE;
|
||||
}
|
||||
if (resizeModeValue == null) {
|
||||
// Use the default. Never use null.
|
||||
return defaultValue();
|
||||
|
||||
Reference in New Issue
Block a user