-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
1 parent
adaf2bf
commit 279f5f1
Showing
4 changed files
with
55 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* 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 <React/RCTShadowView.h> | ||
|
||
@interface RCTImageShadowView : RCTShadowView | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters