mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Flexbox ios initial commit
Items now appear, but they should initially shrink and they don't Add 15-ish tests for flexbox layout Port reasonable flexbox test set Fixing issues, adding unit tests Moved from .tsx to .ts and used our ui/builder.parse
This commit is contained in:
@@ -727,6 +727,12 @@ export class View extends ProxyObject implements definition.View {
|
||||
return this._measuredHeight & utils.layout.MEASURED_SIZE_MASK;
|
||||
}
|
||||
|
||||
public getMeasuredState(): number {
|
||||
return (this._measuredWidth & utils.layout.MEASURED_STATE_MASK)
|
||||
| ((this._measuredHeight >> utils.layout.MEASURED_HEIGHT_STATE_SHIFT)
|
||||
& (utils.layout.MEASURED_STATE_MASK >> utils.layout.MEASURED_HEIGHT_STATE_SHIFT));
|
||||
}
|
||||
|
||||
public setMeasuredDimension(measuredWidth: number, measuredHeight: number): void {
|
||||
this._measuredWidth = measuredWidth;
|
||||
this._measuredHeight = measuredHeight;
|
||||
@@ -786,6 +792,10 @@ export class View extends ProxyObject implements definition.View {
|
||||
return Math.round(result + 0.499) | (childMeasuredState & utils.layout.MEASURED_STATE_MASK);
|
||||
}
|
||||
|
||||
public static combineMeasuredStates(curState: number, newState): number {
|
||||
return curState | newState;
|
||||
}
|
||||
|
||||
public static layoutChild(parent: View, child: View, left: number, top: number, right: number, bottom: number): void {
|
||||
if (!child || !child._isVisible) {
|
||||
return;
|
||||
|
||||
@@ -12,6 +12,8 @@ import background = require("ui/styling/background");
|
||||
import {CommonLayoutParams} from "ui/styling/style";
|
||||
import {device} from "platform";
|
||||
|
||||
var flexbox;
|
||||
|
||||
global.moduleMerge(viewCommon, exports);
|
||||
|
||||
var ANDROID = "_android";
|
||||
@@ -607,6 +609,13 @@ export class ViewStyler implements style.Styler {
|
||||
lp.rightMargin = Math.round(params.rightMargin * utils.layout.getDisplayDensity());
|
||||
lp.bottomMargin = Math.round(params.bottomMargin * utils.layout.getDisplayDensity());
|
||||
lp.gravity = gravity;
|
||||
|
||||
if (lp instanceof org.nativescript.widgets.FlexboxLayout.LayoutParams) {
|
||||
if (!flexbox) {
|
||||
flexbox = require("ui/layouts/flexbox-layout");
|
||||
}
|
||||
flexbox._setAndroidLayoutParams(lp, view);
|
||||
}
|
||||
}
|
||||
else {
|
||||
let layoutParams: any = lp;
|
||||
|
||||
4
tns-core-modules/ui/core/view.d.ts
vendored
4
tns-core-modules/ui/core/view.d.ts
vendored
@@ -394,6 +394,8 @@ declare module "ui/core/view" {
|
||||
*/
|
||||
public getMeasuredHeight(): number;
|
||||
|
||||
public getMeasuredState(): number;
|
||||
|
||||
/**
|
||||
* Call this when something has changed which has invalidated the layout of this view. This will schedule a layout pass of the view tree.
|
||||
*/
|
||||
@@ -462,6 +464,8 @@ declare module "ui/core/view" {
|
||||
*/
|
||||
public static resolveSizeAndState(size: number, specSize: number, specMode: number, childMeasuredState: number): number;
|
||||
|
||||
public static combineMeasuredStates(curState: number, newState): number;
|
||||
|
||||
/**
|
||||
* Returns the child view with the specified id.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user