Skip to content

Commit 8c03991

Browse files
committed
fix(android): support new optimized GridLayout (not yet released)
1 parent 1dc0a5c commit 8c03991

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/gesturehandler/gesturehandler.android.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,17 @@ export function install(overrideNGestures = false) {
8080
PageLayout = com.nativescript.gesturehandler.PageLayout;
8181
}
8282
const layout = new PageLayout(this._context, ROOT_GESTURE_HANDLER_TAG);
83-
layout.addRow(new org.nativescript.widgets.ItemSpec(1, org.nativescript.widgets.GridUnitType.auto));
84-
layout.addRow(new org.nativescript.widgets.ItemSpec(1, org.nativescript.widgets.GridUnitType.star));
83+
if (layout.addRowsFromJSON) {
84+
layout.addRowsFromJSON(
85+
JSON.stringify([
86+
{ value: 1, type: 0 /* org.nativescript.widgets.GridUnitType.auto */ },
87+
{ value: 1, type: 2 /* org.nativescript.widgets.GridUnitType.star */ },
88+
])
89+
);
90+
} else {
91+
layout.addRow(new org.nativescript.widgets.ItemSpec(1, org.nativescript.widgets.GridUnitType.auto));
92+
layout.addRow(new org.nativescript.widgets.ItemSpec(1, org.nativescript.widgets.GridUnitType.star));
93+
}
8594

8695
// this.gestureRegistry = layout.registry();
8796
return layout;

0 commit comments

Comments
 (0)