Skip to content

Commit

Permalink
fix(ios): fix text rendering issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ruifanyuan authored and hippy-actions[bot] committed Oct 17, 2023
1 parent ed206ed commit a968697
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ - (void)amendLayoutBeforeMount:(NSMutableSet<NativeRenderApplierBlock> *)blocks
[textStorage enumerateAttribute:NativeRenderRenderObjectAttributeName inRange:characterRange options:0 usingBlock:^(
NativeRenderObjectView *child, NSRange range, __unused BOOL *_) {
if (child) {
float width = child.frame.size.width, height = child.frame.size.height;
float width = child.width, height = child.height;
if (isnan(width) || isnan(height)) {
HPLogError(@"Views nested within a <Text> must have a width and height");
}
Expand All @@ -254,8 +254,8 @@ - (void)amendLayoutBeforeMount:(NSMutableSet<NativeRenderApplierBlock> *)blocks

// take margin into account
// FIXME: margin currently not working, may have some bug in layout process
float left = child.nodeLayoutResult.left;
float top = child.nodeLayoutResult.top;
float left = 0;
float top = 0;
float marginV = child.nodeLayoutResult.marginTop + child.nodeLayoutResult.marginBottom;
CGFloat roundedHeightWithMargin = NativeRenderRoundPixelValue(height + marginV);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,23 @@ extern NSString *const NativeRenderShadowViewDiffTag;
*/
@property (nonatomic, assign, getter=isHidden) BOOL hidden;

/**
* Position and dimensions.
* Defaults to 0
*/
@property (nonatomic, assign) CGFloat top;
@property (nonatomic, assign) CGFloat left;
@property (nonatomic, assign) CGFloat bottom;
@property (nonatomic, assign) CGFloat right;

@property (nonatomic, assign) CGFloat width;
@property (nonatomic, assign) CGFloat height;

@property (nonatomic, assign) CGFloat minWidth;
@property (nonatomic, assign) CGFloat maxWidth;
@property (nonatomic, assign) CGFloat minHeight;
@property (nonatomic, assign) CGFloat maxHeight;

/**
* Get frame set by layout system
*/
Expand Down

0 comments on commit a968697

Please sign in to comment.