Skip to content

Commit e2e4f5a

Browse files
sis0k0Alexander Vakrilov
authored and
Alexander Vakrilov
committed
fix(animations): enable routable animations (#926)
When querying for `ng-components` (natively represented by `ProxyViewContainer`s), the container's children are selected instead of the container itself.
1 parent eb3fd81 commit e2e4f5a

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

Diff for: nativescript-angular/animations/animation-driver.ts

+9-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { AnimationPlayer } from "@angular/animations";
22
import { AnimationDriver } from "@angular/animations/browser";
3+
import { ProxyViewContainer } from "tns-core-modules/ui/proxy-view-container";
34
import { eachDescendant } from "tns-core-modules/ui/core/view";
45

56
import { NativeScriptAnimationPlayer } from "./animation-player";
@@ -177,14 +178,18 @@ function queryDescendants(
177178
// skip comment and text nodes
178179
// because they are not actual Views
179180
// and cannot be animated
180-
if (element instanceof InvisibleNode) {
181+
if (element instanceof InvisibleNode || !selector.match(element)) {
181182
return true;
182183
}
183184

184-
if (selector.match(element)) {
185+
if (element instanceof ProxyViewContainer) {
186+
element.eachChild((child: NgView) => {
187+
result.matches.push(child);
188+
return true;
189+
});
190+
} else {
185191
result.matches.push(element);
186-
return multi;
187192
}
188193

189-
return true;
194+
return multi;
190195
}

0 commit comments

Comments
 (0)