mirror of
https://github.com/status-im/react-native.git
synced 2025-01-09 09:12:02 +00:00
bee118096b
Summary: Addresses this comment: https://github.com/facebook/react-native/issues/2296#issuecomment-232446493 This pull request adds the `center` value to `ImageResizeMode`. When set, it will center the image within its frame. If the image is larger than its frame, the image is downscaled while maintaining its aspect ratio. That is how the Android implementation works, too. Sorry, don't have time to write tests. 😢 Any reviewers should make sure `RCTTargetRect` returns the correct value when: - the image is smaller than its frame (ie: no downscaling needed) - the image is larger than its frame (should be downscaled to avoid clipping) Closes https://github.com/facebook/react-native/pull/8792 Differential Revision: D3586134 Pulled By: javache fbshipit-source-id: 78fb8e5928284003437dac2c9ad264fa584f73ec
23 lines
651 B
Objective-C
23 lines
651 B
Objective-C
/**
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*/
|
|
|
|
#import "RCTResizeMode.h"
|
|
|
|
@implementation RCTConvert(RCTResizeMode)
|
|
|
|
RCT_ENUM_CONVERTER(RCTResizeMode, (@{
|
|
@"cover": @(RCTResizeModeCover),
|
|
@"contain": @(RCTResizeModeContain),
|
|
@"stretch": @(RCTResizeModeStretch),
|
|
@"center": @(RCTResizeModeCenter),
|
|
@"repeat": @(RCTResizeModeRepeat),
|
|
}), RCTResizeModeStretch, integerValue)
|
|
|
|
@end
|