NativeScript / nativescript-angular

Integrating NativeScript with Angular
http://docs.nativescript.org/angular/tutorial/ng-chapter-0
Apache License 2.0
1.22k stars 241 forks source link

ngFor inside StackLayout is displayed as last component after building apk #2337

Closed anoggi closed 3 years ago

anoggi commented 3 years ago

Environment

Describe the bug I have a small view with a StackLayout. When using tns preview the components inside are displayed as expected in the order specified. However, when using the apk, the CheckBoxes are displayed as last component of the StackLayout. The reason seems to be the use of ngFor.

Here are two screenshots illustrating the issue:

Correct behavior when using tns preview

Incorrect behavior when using apk

To Reproduce

<app-action-bar title="{{getTitle()}} - Lernen"></app-action-bar>

<StackLayout>

    <Label text="{{currentQuestion.question}}" textwrap="true"></Label>

    <CheckBox *ngFor="let answer of this.userAnswers" text="{{answer.answer}}"></CheckBox>

    <Button text="Weiter!"></Button>

    <Button text="Feedback"></Button>

</StackLayout>

Expected behavior apk behaving like in the first screenshot (with tns preview)

edusperoni commented 3 years ago

This issue was fixed in @nativescript/angular 10.1.4 and 10.1.5, see https://github.com/NativeScript/nativescript-angular/blob/master/CHANGELOG.md#1015-2020-09-21

Preview is using nativescript-angular >= 10.1.5, which is why the error is not occurring.