iOS Frame, Page and TabView measure/layout methods removed. We now rely on the framework positioning. This will result in a change that width, height, minWidth, minHeight, margins not respected on these controls

iOS layout positioning now respects native properties like automaticallyAdjustsScrollViewInsets, edgesForExtendedLayout, extendedLayoutIncludesOpaqueBars, navigationBar.translucent, tabBar.translucent
Removed frame-tests.ios.ts - those tests are now invalid
Added new layout tests inside page-tests.ios.ts
Commented few asserts in scroll-view-tests
View now expose ios namespace with layoutView method and UILayoutViewController used by page, tab-view and application module
ViewBase now expose viewController property that should be set from all widgets that are using viewcontrollers internally (like Page, Frame, TabView)
ViewBase now sets ios property to either the view returned from createNativeView or to nativeViewProptected
fragment.transitions now use animation/transition start to add fragments to waitingQueue. Before we did it manually in navigate/goBack. This way we can reuse the fragment.transition when calling showDialog. Also when animation/transition ends we check the animation/transition to see if this fragment should be set as current.
Frame expose new loadViewFromEntry method (to load a view from URI)
Frame navigation happens once frame is loaded
Frame now supports Page as a child in XML
Fixed GridLayout row, rowSpan, column, columnSpan properties type
Fixed bug in GridLayout where add/remove of columns/rows won't update the internal state of the grid (backport from android when GridLayout is recycled)
ListView will no longer invalidate layout when cell is removed
Fixed bug in ScrollView ios where effectiveMinWidth/Height was multiplied to density (it is already on device pixels so no need to multiply)
TabView android now calls loaded only on the selected child (not all)
Core refactoring
This commit is contained in:
Hristo Hristov
2017-09-27 10:32:28 +03:00
parent 7bc0daf222
commit af034089ca
38 changed files with 934 additions and 923 deletions

View File

@@ -5,20 +5,24 @@ import getter = utils.ios.getter;
export module ios {
export function getActualHeight(view: UIView): number {
if (view.window && !view.hidden) {
return view.frame.size.height;
return utils.layout.toDevicePixels(view.frame.size.height);
}
return 0;
}
export function getStatusBarHeight(): number {
var app = getter(UIApplication, UIApplication.sharedApplication);
export function getStatusBarHeight(viewController?: UIViewController): number {
const app = getter(UIApplication, UIApplication.sharedApplication);
if (!app || app.statusBarHidden) {
return 0;
}
var statusFrame = app.statusBarFrame;
let min = Math.min(statusFrame.size.width, statusFrame.size.height);
if (viewController && viewController.prefersStatusBarHidden) {
return 0;
}
const statusFrame = app.statusBarFrame;
const min = Math.min(statusFrame.size.width, statusFrame.size.height);
return utils.layout.toDevicePixels(min);
}
@@ -27,24 +31,19 @@ export module ios {
return;
}
let size = parentBounds.size;
let width = utils.layout.toDevicePixels(size.width);
let height = utils.layout.toDevicePixels(size.height);
var superview = (<UIView>rootView.nativeViewProtected).superview;
var superViewRotationRadians;
if (superview) {
superViewRotationRadians = atan2f(superview.transform.b, superview.transform.a);
}
var origin = parentBounds.origin;
var left = origin.x;
var top = origin.y;
var widthSpec = utils.layout.makeMeasureSpec(width, utils.layout.EXACTLY);
var heightSpec = utils.layout.makeMeasureSpec(height, utils.layout.EXACTLY);
const size = parentBounds.size;
const width = utils.layout.toDevicePixels(size.width);
const height = utils.layout.toDevicePixels(size.height);
const widthSpec = utils.layout.makeMeasureSpec(width, utils.layout.EXACTLY);
const heightSpec = utils.layout.makeMeasureSpec(height, utils.layout.EXACTLY);
rootView.measure(widthSpec, heightSpec);
const origin = parentBounds.origin;
const left = origin.x;
const top = origin.y;
rootView.layout(left, top, width, height);
}
}
}