-
Notifications
You must be signed in to change notification settings - Fork 587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When right aligning a text component and setting the truncation string , the truncation string doesn't show #75
Comments
Could you please provide sample code and a screenshot of your observed
|
Sure: +(instancetype)n {
// the left label should fit and aligned to left side
CKLabelComponent *leftLabel = [CKLabelComponent newWithLabelAttributes:{
.string = @"Left label",
.maximumNumberOfLines = 1,
.color = [UIColor componentsLightGreyColor],
.font = [UIFont componentsTitleFont]
}viewAttributes:{
{@selector(setBackgroundColor:),[UIColor clearColor]}
}];
// the right label should be aligned to the right of the container and truncated
CKLabelComponent *right = [CKLabelComponent newWithLabelAttributes:{
.string = @"This is a really long string that should be truncated",
.truncationString = @"... more",
.maximumNumberOfLines = 1,
.alignment = NSTextAlignmentRight
}viewAttributes:{
{@selector(setBackgroundColor:),[UIColor clearColor]}
}];
CKStackLayoutComponent *stack = [CKStackLayoutComponent newWithView:{
[UIView class],
{
{@selector(setBackgroundColor:),[UIColor clearColor]}
}
} size:{
.minHeight = 44
}style:{
.alignItems = CKStackLayoutAlignItemsStretch,
.direction = CKStackLayoutDirectionHorizontal,
}children:{
{
.component = [CKCenterLayoutComponent newWithCenteringOptions:CKCenterLayoutComponentCenteringY sizingOptions:CKCenterLayoutComponentSizingOptionDefault child:leftLabel size:{.minHeight = 44}],
.flexGrow = YES,
.spacingBefore = 15
},
{
.component = [CKCenterLayoutComponent newWithCenteringOptions:CKCenterLayoutComponentCenteringY sizingOptions:CKCenterLayoutComponentSizingOptionDefault child:right size:{.minHeight = 44}],
.spacingBefore = 20,
.spacingAfter = 15,
.flexShrink = YES
}
}];
return [super newWithComponent:stack];
} |
If i play with the . maximumNumberOfLines the behavior is as you would expect. |
Hmm, yeah, ideally it should consume all available space, not sure yet if this is a bug in text component's truncation or sizing behavior, or if it's an interaction between the stack layout component and the text component. |
Confirmed this is a bug in CKTextKitTailTruncater. I had assumed that right-aligned text was RTL writing direction and as a result the truncation location selected is incorrect. Will fix. |
This should be fixed now, let me know if you continue to have issues. |
@ocrickard |
I right aligned the text component, limited it to 1 line and set a truncation string. The truncation string doesn't display as expected
The text was updated successfully, but these errors were encountered: