Open bradmartin opened 2 years ago
@bradmartin does it work outside of the bottom sheet ?
🥸 totally forgot to check, but I believe so, have it in another section of the app and it is fine. Let me double check.
Yea works fine, toward bottom near the button is HTMLLabel with the url. Pretty standard <stacklayout>
as parent on that screen stacking the views.
@bradmartin sorry for the late reply. I ll see what I can do. must be an issue with bottomsheet
no worries, was gonna try to look into it later today
I'm also having this issue with HTMLLabel in a RadListView. Some of the cells render the height correctly, but as you scroll down many HTMLLabels have much of the content cut off.
Just digging in and have some logs and a timeout workaround for my use case for now.
onHtmlLabelLoaded(event) {
const x = event.object as Label;
console.log(x.height, x.minHeight, x.textWrap, x.nativeView, x.getActualSize(), x.getMeasuredHeight());
setTimeout(() => {
x.requestLayout();
console.log(x.height, x.minHeight, x.textWrap, x.nativeView, x.getActualSize(), x.getMeasuredHeight());
}, 100);
}
before the timeout in the loaded
event of the HTMLLabel
:
CONSOLE LOG: auto {
"value": 0,
"unit": "px"
} true <UITextView: 0x7f9a55052e00; frame = (0 0; 0 0); text = ''; clipsToBounds = YES; gestureRecognizers = <NSArray: 0x6000023f5560>; layer = <CALayer: 0x600002df3b60>; contentOffset: {0, 0}; contentSize: {0, 0}; adjustedContentInset: {0, 0, 0, 0}> {
"width": 0,
"height": 0
} 0
after the timeout:
CONSOLE LOG: auto {
"value": 0,
"unit": "px"
} true <UITextView: 0x7f9a55052e00; frame = (0 0; 388 17); text = 'Lorem ipsum some really r...'; clipsToBounds = YES; tag = 175; gestureRecognizers = <NSArray: 0x6000023f5560>; layer = <CALayer: 0x600002df3b60>; contentOffset: {0, 0}; contentSize: {388, 17}; adjustedContentInset: {0, 0, 0, 0}> {
"width": 388,
"height": 17
} 51
requestLayout()
in the timeout causes it to redraw and it does the textWrap correctly for the long string of text to render. Without the requestLayout()
the logs are the same but the UI does not update.
Okay scratch all of that... even easier workaround for now (tested on iOS Pro 13 max sim and google pixel 4):
onHtmlLabelLoaded(event) {
const x = event.object as Label;
x.text = this._params.context.label;
}
instead of
ngOnInit() {
Logger.info('ConfirmationDialogComponent.ngOnInit()', this._params.context);
this.title = this._params.context.title;
this.label = this._params.context.label;
}
This is dependent on my layout having rows="*"
on the grid wrapping the HTMLLabel, using auto and this does not work.
<GridLayout row="1" colSpan="2" rows="*" columns="*">
<HTMLLabel
fontSize="14"
[html]="label"
linkColor="#336699"
linkUnderline="true"
(linkTap)="onLinkTap($event)"
textWrap="true"
(loaded)="onHtmlLabelLoaded($event)"
marginBottom="10"
></HTMLLabel>
</GridLayout>
@bradmartin I tried your solution but i get this when I try setting the text
:
https://share.getcloudapp.com/rRuQp9Dm
htmlLabelLoaded(args) {
this._win.setTimeout(() => {
args.object.text = this.getPostHtml(this.post.message);
}, 100)
}
Any ideas?
I'd try dropping the timeout and then maybe calling the requestLayout()
and see if something ends up working. Def seems like a timing issue with the layout process for the label inside different parents (bottomsheet, rlv)
@bradmartin i cant reproduce the issue here. Can you manage to reproduce it in a simple repro example not angular? That would help a lot. I am thinking the issue comes from somewhere else
@farfromrefug have you tried it in a rad List view? I imagine it's the same problem.
No and I am not sure it is the same issue. Plus RLV is too much of a mess and impossible to debug (the simple way). Tbh I don't trust RLV so I couldnt say if the issue comes from RLV or ui-label. So I prefer to debug this with bottomsheet
It could be an angular issue since that's something Dave and I have in common here. If you can't repro it without angular, I'm guessing something with the UI and angular data binding possibly causes, which is why the workarounds I've tried seem to be a "fix" for now.
If you already tried to repro it without angular I won't waste my time 👍🏻 thanks for trying though. I know these issues are odd, luckily I worked around mine with the approach of databinding with the loaded event and not the component init.
@bradmartin I did try but maybe my example was not reproducing the full context of your app. any way if you manage at one point to pinpoint it a bit more I can look at it (except from the angular part :p I really avoid this framework, sorry)
Make sure to check the demo app(s) for sample usage
Make sure to check the existing issues in this repository
If the demo apps cannot help and there is no issue for your problem, tell us about it
Please, ensure your title is less than 63 characters long and starts with a capital letter.
Which platform(s) does your issue occur on?
Please, provide the following version numbers that your issue occurs with:
package.json
file of your project and paste your dependencies and devDependencies here)Please, tell us how to recreate the issue in as much detail as possible.
Describe the steps to reproduce it.
Is there any code involved?
The fix is by explicitly putting a height value on the HTMLLabel, ideally it should scale and be visible (since textWrap is true).
When
height=300
is on theHTMLLabel
the full text of the item is shown, but not ideal since the message in the label can vary in length.Works but obviously having the large gap not defined in the layout is a negative.