fix: move _getCurrentLayoutBounds from CustomLayoutView to View as extended by ListViewBase

This commit is contained in:
Vasil Chimev
2018-09-26 15:13:56 +03:00
parent 815369b708
commit 5df6921635
3 changed files with 22 additions and 22 deletions

View File

@@ -619,10 +619,10 @@ export class SafeAreaTests extends testModule.UITest<any> {
isAboveWith(cells[2][1], grid, insets.bottom);
isAboveWith(cells[2][2], grid, insets.bottom);
equal(height(cells[0][1]), height(cells[1][1]), `cell height should be equal - cell01<${height(cells[0][1])}> - cell11<${height(cells[1][1])}>`);
closeEnough(height(cells[0][1]), height(cells[1][1]), `cell height should be equal - cell01<${height(cells[0][1])}> - cell11<${height(cells[1][1])}>`);
equal(height(cells[1][1]), height(cells[2][1]), `cell height should be equal - cell11<${height(cells[1][1])}> - cell21<${height(cells[2][1])}>`);
const sumOfLabelHeightAndInsets = insets.top + height(cells[0][1]) + height(cells[1][1]) + height(cells[2][1]) + insets.bottom;
equal(height(grid), sumOfLabelHeightAndInsets, `grid height<${height(grid)}> sum of labels height and insets<${sumOfLabelHeightAndInsets}>`);
closeEnough(height(grid), sumOfLabelHeightAndInsets, `grid height<${height(grid)}> sum of labels height and insets<${sumOfLabelHeightAndInsets}>`);
equal(width(cells[1][0]), width(cells[1][1]), `cell width should be equal - cell10<${width(cells[1][0])}> - cell11<${width(cells[1][1])}>`);
equal(width(cells[1][1]), width(cells[1][2]), `cell width should be equal - cell11<${width(cells[1][1])}> - cell12<${width(cells[1][2])}>`);

View File

@@ -843,7 +843,7 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition {
}
_getCurrentLayoutBounds(): { left: number; top: number; right: number; bottom: number } {
return { left: this._oldLeft, top: this._oldTop, right: this._oldRight, bottom: this._oldBottom };
return { left: 0, top: 0, right: 0, bottom: 0 };
}
/**
@@ -881,7 +881,7 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition {
}
public getSafeAreaInsets(): { left, top, right, bottom } {
return {left: 0, top: 0, right: 0, bottom: 0};
return { left: 0, top: 0, right: 0, bottom: 0 };
}
public getLocationInWindow(): Point {

View File

@@ -545,6 +545,23 @@ export class View extends ViewCommon {
}
}
_getCurrentLayoutBounds(): { left: number; top: number; right: number; bottom: number } {
const nativeView = this.nativeViewProtected;
if (nativeView && !this.isCollapsed) {
const frame = nativeView.frame;
const origin = frame.origin;
const size = frame.size;
return {
left: Math.round(layout.toDevicePixels(origin.x)),
top: Math.round(layout.toDevicePixels(origin.y)),
right: Math.round(layout.toDevicePixels(origin.x + size.width)),
bottom: Math.round(layout.toDevicePixels(origin.y + size.height))
};
} else {
return { left: 0, top: 0, right: 0, bottom: 0 };
}
}
_redrawNativeBackground(value: UIColor | Background): void {
let updateSuspended = this._isPresentationLayerUpdateSuspeneded();
if (!updateSuspended) {
@@ -630,23 +647,6 @@ export class CustomLayoutView extends ContainerView {
child.nativeViewProtected.removeFromSuperview();
}
}
_getCurrentLayoutBounds(): { left: number; top: number; right: number; bottom: number } {
const nativeView = this.nativeViewProtected;
if (nativeView && !this.isCollapsed) {
const frame = nativeView.frame;
const origin = frame.origin;
const size = frame.size;
return {
left: layout.toDevicePixels(origin.x),
top: layout.toDevicePixels(origin.y),
right: layout.toDevicePixels(origin.x + size.width),
bottom: layout.toDevicePixels(origin.y + size.height)
};
} else {
return { left: 0, top: 0, right: 0, bottom: 0 };
}
}
}
export namespace ios {
@@ -845,7 +845,7 @@ export namespace ios {
}
}
return { safeArea: safeArea, fullscreen: fullscreen}
return { safeArea: safeArea, fullscreen: fullscreen }
}
export class UILayoutViewController extends UIViewController {