react-native/Libraries/Image/RCTImageShadowView.m
Valentin Shergin 279f5f1c56 Using <Image> with nested content now causes warning (yellowbox)
Summary:
We are removing support of nesting views inside <Image> component. We decided to do this because having this feature makes supporting intrinsinc content size of the <Image> impossible; so when the transition process is complete, there will be no need to specify image size explicitly, it can be inferred from actual image bitmap.

And this is the step #2: Yellow Box.

<ImageBackground> is very simple drop-in replacement which implements this functionality via very simple styling.
Please, use <ImageBackground> instead of <Image> if you want to put something inside.

Reviewed By: yungsters

Differential Revision: D5139264

fbshipit-source-id: 99442107e10a321618fd34802c57a8c205ce66fb
2017-05-30 20:04:55 -07:00

26 lines
744 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 "RCTImageShadowView.h"
#import <React/RCTLog.h>
@implementation RCTImageShadowView
- (void)insertReactSubview:(RCTShadowView *)subview atIndex:(NSInteger)atIndex
{
RCTLogWarn(@"Using <Image> with children is deprecated "
"and will be an error in the near future. "
"Please reconsider the layout or use <ImageBackground> instead.");
[super insertReactSubview:subview atIndex:atIndex];
}
@end