From d1676ca3664043b3545f0b4f6335ccde9018bf04 Mon Sep 17 00:00:00 2001 From: vakrilov Date: Tue, 26 Jan 2016 11:20:15 +0200 Subject: [PATCH] Comments and cleanups --- ui/core/view.ios.ts | 5 ++--- ui/proxy-view-container/proxy-view-container.ts | 10 +++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/ui/core/view.ios.ts b/ui/core/view.ios.ts index 1b3bcaa44..b4dc36f59 100644 --- a/ui/core/view.ios.ts +++ b/ui/core/view.ios.ts @@ -1,4 +1,5 @@ -import viewCommon = require("./view-common"); +import types = require("utils/types"); +import viewCommon = require("./view-common"); import trace = require("trace"); import utils = require("utils/utils"); import dependencyObservable = require("ui/core/dependency-observable"); @@ -269,8 +270,6 @@ export class View extends viewCommon.View { public _addToSuperview(superview: any, atIndex?: number): boolean { if (superview && this._nativeView) { - var types = require("utils/types"); - if (types.isNullOrUndefined(atIndex) || atIndex >= superview.subviews.count) { superview.addSubview(this._nativeView); } else { diff --git a/ui/proxy-view-container/proxy-view-container.ts b/ui/proxy-view-container/proxy-view-container.ts index 59f444501..446122cd3 100644 --- a/ui/proxy-view-container/proxy-view-container.ts +++ b/ui/proxy-view-container/proxy-view-container.ts @@ -4,18 +4,18 @@ import definition = require("ui/proxy-view-container"); import trace = require("trace"); 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. */ // Cases to cover: // * Child is added to the attached proxy. Handled in _addViewToNativeVisualTree. // * 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. -// - 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. // * 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. -// - 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 { // No native view for proxy container. get ios(): any { @@ -60,8 +60,8 @@ export class ProxyViewContainer extends layout.LayoutBase implements definition. let baseIndex = 0; let insideIndex = 0; if (parent instanceof layout.LayoutBase) { - baseIndex = parent.getChildIndex(this); - baseIndex = parent._childIndexToNativeChildIndex(baseIndex); + // Get my index in parent and convert it to native index. + baseIndex = parent._childIndexToNativeChildIndex(parent.getChildIndex(this)); } if (types.isDefined(atIndex)) {