mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Fix a crash when using a ProxyViewContainer in ListView item templates.
Not a regular {N} usage scenario, but it can happen with Angular components
which get wrapped in a proxy container.
This commit is contained in:
@@ -8,6 +8,7 @@ import {LayoutBase} from "ui/layouts/layout-base"
|
||||
import {StackLayout} from "ui/layouts/stack-layout"
|
||||
import {GridLayout} from "ui/layouts/grid-layout"
|
||||
import {ProxyViewContainer} from "ui/proxy-view-container";
|
||||
import {ListView} from "ui/list-view";
|
||||
|
||||
export function test_add_children_to_attached_proxy() {
|
||||
var outer = new StackLayout();
|
||||
@@ -224,6 +225,25 @@ export function test_proxy_iniside_border() {
|
||||
helper.buildUIAndRunTest(scroll, testAction);
|
||||
}
|
||||
|
||||
export function test_proxy_iniside_listview_itemtemplate_crash() {
|
||||
// Usually reproducible with an Angular component in the template
|
||||
// We use a simple declaration here to simulate it.
|
||||
var list = new ListView();
|
||||
list.items = ["item 1"];
|
||||
list.itemTemplate = `
|
||||
<ProxyViewContainer>
|
||||
<Label text="{{$value}}"></Label>
|
||||
</ProxyViewContainer>
|
||||
`;
|
||||
|
||||
function testAction(views: Array<View>) {
|
||||
var page = <Page>views[1];
|
||||
waitUntilElementLayoutIsValid(page);
|
||||
};
|
||||
|
||||
helper.buildUIAndRunTest(list, testAction);
|
||||
}
|
||||
|
||||
// TODO: Proxy as a direct child to of TabItem is not supported. Not sure if we want to support it.
|
||||
//export function test_proxy_iniside_tab() {
|
||||
// var proxy = new ProxyViewContainer();
|
||||
|
||||
Reference in New Issue
Block a user