From 5735a01695d7967b5a63222dcec760ddac0533e3 Mon Sep 17 00:00:00 2001 From: Eduardo Speroni Date: Mon, 21 Sep 2020 20:08:43 -0300 Subject: [PATCH] fix(renderer): dynamic views can't be prepended (#2262) --- nativescript-angular/view-util.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nativescript-angular/view-util.ts b/nativescript-angular/view-util.ts index ea2c3976..d254b8fd 100644 --- a/nativescript-angular/view-util.ts +++ b/nativescript-angular/view-util.ts @@ -41,7 +41,11 @@ export class ViewUtil { const extendedParent = this.ensureNgViewExtensions(parent); const extendedChild = this.ensureNgViewExtensions(child); - if (!previous) { + // the element should be between previous and next + // if there's next but no previous, it's the first element + // if there's previous but no next, it's the last element + // elements that have no previous/next elements must be appended + if (!previous && !next) { previous = extendedParent.lastChild; } this.addToQueue(extendedParent, extendedChild, previous, next);