remove locationOnScreen usage

This commit is contained in:
Martin Yankov
2018-08-27 14:32:45 +03:00
parent fea47e838d
commit 6e0ee3f344
2 changed files with 26 additions and 32 deletions

View File

@@ -709,7 +709,7 @@ export abstract class View extends ViewBase {
*/
export class ContainerView extends View {
/**
* Instruct container view to expand the safe area. This property is iOS specific. Default value: true
* Instruct container view to expand beyond the safe area. This property is iOS specific. Default value: true
*/
public iosExpandSafeArea: boolean;
}

View File

@@ -233,15 +233,10 @@ export class View extends ViewCommon {
const adjustedFrame = ios.getFrameFromPosition(position, insets);
return adjustedFrame;
}
} else {
const locationOnScreen = this.getLocationOnScreen();
if (locationOnScreen) {
} else if (this.nativeViewProtected && this.nativeViewProtected.window) {
const parentWithController = ios.getParentWithViewController(this);
const safeArea = parentWithController.viewController.view.safeAreaLayoutGuide.layoutFrame;
const fullscreen = parentWithController.viewController.view.frame;
const onScreenLeft = layout.round(layout.toDevicePixels(locationOnScreen.x));
const onScreenTop = layout.round(layout.toDevicePixels(locationOnScreen.y));
const position = ios.getPositionFromFrame(frame);
const safeAreaPosition = ios.getPositionFromFrame(safeArea);
@@ -249,11 +244,11 @@ export class View extends ViewCommon {
const adjustedPosition = position;
if (position.left && onScreenLeft <= safeAreaPosition.left) {
if (position.left && position.left <= safeAreaPosition.left) {
adjustedPosition.left = fullscreenPosition.left;
}
if (position.top && onScreenTop <= safeAreaPosition.top) {
if (position.top && position.top <= safeAreaPosition.top) {
adjustedPosition.top = fullscreenPosition.top;
}
@@ -268,7 +263,6 @@ export class View extends ViewCommon {
const adjustedFrame = CGRectMake(layout.toDeviceIndependentPixels(adjustedPosition.left), layout.toDeviceIndependentPixels(adjustedPosition.top), layout.toDeviceIndependentPixels(adjustedPosition.right - adjustedPosition.left), layout.toDeviceIndependentPixels(adjustedPosition.bottom - adjustedPosition.top));
return adjustedFrame;
}
}
return null;
}