mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
Comments and cleanups
This commit is contained in:
@ -1,4 +1,5 @@
|
|||||||
import viewCommon = require("./view-common");
|
import types = require("utils/types");
|
||||||
|
import viewCommon = require("./view-common");
|
||||||
import trace = require("trace");
|
import trace = require("trace");
|
||||||
import utils = require("utils/utils");
|
import utils = require("utils/utils");
|
||||||
import dependencyObservable = require("ui/core/dependency-observable");
|
import dependencyObservable = require("ui/core/dependency-observable");
|
||||||
@ -269,8 +270,6 @@ export class View extends viewCommon.View {
|
|||||||
|
|
||||||
public _addToSuperview(superview: any, atIndex?: number): boolean {
|
public _addToSuperview(superview: any, atIndex?: number): boolean {
|
||||||
if (superview && this._nativeView) {
|
if (superview && this._nativeView) {
|
||||||
var types = require("utils/types");
|
|
||||||
|
|
||||||
if (types.isNullOrUndefined(atIndex) || atIndex >= superview.subviews.count) {
|
if (types.isNullOrUndefined(atIndex) || atIndex >= superview.subviews.count) {
|
||||||
superview.addSubview(this._nativeView);
|
superview.addSubview(this._nativeView);
|
||||||
} else {
|
} else {
|
||||||
|
@ -4,18 +4,18 @@ import definition = require("ui/proxy-view-container");
|
|||||||
import trace = require("trace");
|
import trace = require("trace");
|
||||||
import layout = require("ui/layouts/layout-base");
|
import layout = require("ui/layouts/layout-base");
|
||||||
/**
|
/**
|
||||||
* Proxy view container that adds all its native children dirctly to the parent.
|
* Proxy view container that adds all its native children directly to the parent.
|
||||||
* To be used as a logical grouping container of views.
|
* To be used as a logical grouping container of views.
|
||||||
*/
|
*/
|
||||||
// Cases to cover:
|
// Cases to cover:
|
||||||
// * Child is added to the attached proxy. Handled in _addViewToNativeVisualTree.
|
// * Child is added to the attached proxy. Handled in _addViewToNativeVisualTree.
|
||||||
// * Proxy (with children) is added to the DOM.
|
// * Proxy (with children) is added to the DOM.
|
||||||
// - IOS: Handled in _addToSuperview - when the proxy is added, it adds all its children to the new parent.
|
// - IOS: Handled in _addToSuperview - when the proxy is added, it adds all its children to the new parent.
|
||||||
// - Android: _onAttached calls _addViewToNativeVisualTree recoursively when the proxy is added to the parent.
|
// - Android: _onAttached calls _addViewToNativeVisualTree recursively when the proxy is added to the parent.
|
||||||
// * Child is removed from attached proxy. Handled in _removeViewFromNativeVisualTree.
|
// * Child is removed from attached proxy. Handled in _removeViewFromNativeVisualTree.
|
||||||
// * Proxy (with children) is removed form the DOM.
|
// * Proxy (with children) is removed form the DOM.
|
||||||
// - IOS: Handled in _removeFromSuperview - when the proxy is removed, it removes all its children from its parent.
|
// - IOS: Handled in _removeFromSuperview - when the proxy is removed, it removes all its children from its parent.
|
||||||
// - Android: _onDetached calls _removeViewFromNativeVisualTree recoursively when the proxy is removed from its parent.
|
// - Android: _onDetached calls _removeViewFromNativeVisualTree recursively when the proxy is removed from its parent.
|
||||||
export class ProxyViewContainer extends layout.LayoutBase implements definition.ProxyViewContainer {
|
export class ProxyViewContainer extends layout.LayoutBase implements definition.ProxyViewContainer {
|
||||||
// No native view for proxy container.
|
// No native view for proxy container.
|
||||||
get ios(): any {
|
get ios(): any {
|
||||||
@ -60,8 +60,8 @@ export class ProxyViewContainer extends layout.LayoutBase implements definition.
|
|||||||
let baseIndex = 0;
|
let baseIndex = 0;
|
||||||
let insideIndex = 0;
|
let insideIndex = 0;
|
||||||
if (parent instanceof layout.LayoutBase) {
|
if (parent instanceof layout.LayoutBase) {
|
||||||
baseIndex = parent.getChildIndex(this);
|
// Get my index in parent and convert it to native index.
|
||||||
baseIndex = parent._childIndexToNativeChildIndex(baseIndex);
|
baseIndex = parent._childIndexToNativeChildIndex(parent.getChildIndex(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (types.isDefined(atIndex)) {
|
if (types.isDefined(atIndex)) {
|
||||||
|
Reference in New Issue
Block a user