mirror of
https://github.com/status-im/react-native.git
synced 2025-01-09 17:15:54 +00:00
486dbe4e8f
Summary: Previously, only Text and Image could be nested within Text. Now, any view can be nested within Text. One restriction of this feature is that developers must give inline views a width and a height via the style prop. Previously, inline Images were supported by using iOS's built-in support for rendering images with an NSAttributedString via NSTextAttachment. However, NSAttributedString doesn't support rendering arbitrary views. This change adds support for nesting views within Text by creating one NSTextAttachment per inline view. The NSTextAttachments act as placeholders. They are set to be the size of the corresponding view. After the text is laid out, we query the text system to find out where it has positioned each NSTextAttachment. We then position the views to be at those locations. This commit also contains a change in `RCTShadowText.m` `_setParagraphStyleOnAttributedString:heightOfTallestSubview:`. It now only sets `lineHeight`, `textAlign`, and `writingDirection` when they've actua Closes https://github.com/facebook/react-native/pull/7304 Reviewed By: javache Differential Revision: D3365373 Pulled By: nicklockwood fbshipit-source-id: 66d149eb80c5c6725311e1e46d7323eec086ce64
27 lines
804 B
Objective-C
27 lines
804 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 <UIKit/UIKit.h>
|
|
#import "RCTResizeMode.h"
|
|
|
|
@class RCTBridge;
|
|
@class RCTImageSource;
|
|
|
|
@interface RCTImageView : UIImageView
|
|
|
|
- (instancetype)initWithBridge:(RCTBridge *)bridge NS_DESIGNATED_INITIALIZER;
|
|
|
|
@property (nonatomic, assign) UIEdgeInsets capInsets;
|
|
@property (nonatomic, strong) UIImage *defaultImage;
|
|
@property (nonatomic, assign) UIImageRenderingMode renderingMode;
|
|
@property (nonatomic, strong) RCTImageSource *source;
|
|
@property (nonatomic, assign) CGFloat blurRadius;
|
|
|
|
@end
|