I have been trying to solve this problem for the past few days and I'm just not finding the solution. I have a Nativescript application that loads documents stored on a webAPI server. These documents are long, html documents. As such, I have wrapped the HtmlView tag with a scrollview (WebView won't work in this case as I need to put some buttons at the bottom of the scroll for the customer to sign the document). This works fine on Android, but on iOS, the scroll view doesn't expand to show the entire content until the user rotates their device. Then it will scroll and view everything just fine.
home.component.ts
import { Component, OnInit } from "@angular/core";
import { DocumentService } from "~/home/service/document.service";
import { IDocument, Document } from "~/home/service/document";
@Component({
selector: "Home",
moduleId: module.id,
templateUrl: "./home.component.html"
})
export class HomeComponent implements OnInit {
constructor(
private service: DocumentService,) {
// Use the component constructor to inject providers.
}
private document = new Document();
private text = '';
ngOnInit() {
this.text = `<div>Retrieving Document...</div>`;
}
ngAfterViewInit(): void {
this.service.getById('WEB-0000063',3)
.then((data: IDocument) => {
if (data) {
this.document = data;
this.text = `<!DOCTYPE><html><body>${this.document.Body}</body></html>`;
}
});
}
}
home.component.html
<GridLayout class="page">
<GridLayout rows="*" cols="*" height="100%">
<ScrollView row="0" height="100%">
<StackLayout height="100%">
<HtmlView [html]="text"></HtmlView>
</StackLayout>
</ScrollView>
</GridLayout>
</GridLayout>
If I hard-code the data, it works fine, but when it comes back from the server, it has the problem, but only on iOS.
Any help is appreciated.