mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
Fix for iOS 11 ListView top offset (#4919)
* Changed the default value of the new iOS11 'contentInsetAdjustmentBehavior' property #4916 * Fixed missing ts definitions and added TODOs
This commit is contained in:

committed by
Hristo Hristov

parent
7c68953009
commit
2eba7c66e4
@ -8,6 +8,7 @@ import { StackLayout } from "../layouts/stack-layout";
|
|||||||
import { ProxyViewContainer } from "../proxy-view-container";
|
import { ProxyViewContainer } from "../proxy-view-container";
|
||||||
import { ios } from "../../utils/utils";
|
import { ios } from "../../utils/utils";
|
||||||
import { profile } from "../../profiling";
|
import { profile } from "../../profiling";
|
||||||
|
import { device } from "../../platform";
|
||||||
|
|
||||||
export * from "./list-view-common";
|
export * from "./list-view-common";
|
||||||
|
|
||||||
@ -204,6 +205,17 @@ class UITableViewRowHeightDelegateImpl extends NSObject implements UITableViewDe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Remove this declaration when 'tns-platform-declarations' is update with iOS 11 declarations
|
||||||
|
declare const enum UIScrollViewContentInsetAdjustmentBehavior {
|
||||||
|
Automatic = 0,
|
||||||
|
|
||||||
|
ScrollableAxes = 1,
|
||||||
|
|
||||||
|
Never = 2,
|
||||||
|
|
||||||
|
Always = 3
|
||||||
|
}
|
||||||
|
|
||||||
export class ListView extends ListViewBase {
|
export class ListView extends ListViewBase {
|
||||||
public _ios: UITableView;
|
public _ios: UITableView;
|
||||||
private _dataSource;
|
private _dataSource;
|
||||||
@ -222,6 +234,11 @@ export class ListView extends ListViewBase {
|
|||||||
this._ios.estimatedRowHeight = DEFAULT_HEIGHT;
|
this._ios.estimatedRowHeight = DEFAULT_HEIGHT;
|
||||||
this._ios.rowHeight = UITableViewAutomaticDimension;
|
this._ios.rowHeight = UITableViewAutomaticDimension;
|
||||||
this._ios.dataSource = this._dataSource = DataSource.initWithOwner(new WeakRef(this));
|
this._ios.dataSource = this._dataSource = DataSource.initWithOwner(new WeakRef(this));
|
||||||
|
if (parseInt(device.sdkVersion) >= 11) {
|
||||||
|
// TODO: Remove the cast to 'any' when 'tns-platform-declarations' is update with iOS 11 declarations
|
||||||
|
(<any>this._ios).contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentBehavior.Never;
|
||||||
|
}
|
||||||
|
|
||||||
this._delegate = UITableViewDelegateImpl.initWithOwner(new WeakRef(this));
|
this._delegate = UITableViewDelegateImpl.initWithOwner(new WeakRef(this));
|
||||||
this._heights = new Array<number>();
|
this._heights = new Array<number>();
|
||||||
this._map = new Map<ListViewCell, View>();
|
this._map = new Map<ListViewCell, View>();
|
||||||
|
Reference in New Issue
Block a user