@nativescript/core 9.0.0-preview.3 → 9.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (322) hide show
  1. package/application/application-common.d.ts +40 -14
  2. package/application/application-common.js +109 -5
  3. package/application/application-common.js.map +1 -1
  4. package/application/application-interfaces.d.ts +31 -0
  5. package/application/application-shims.d.ts +27 -0
  6. package/application/application-shims.js +27 -0
  7. package/application/application-shims.js.map +1 -1
  8. package/application/application.android.d.ts +12 -2
  9. package/application/application.android.js +380 -343
  10. package/application/application.android.js.map +1 -1
  11. package/application/application.d.ts +74 -1
  12. package/application/application.ios.d.ts +68 -1
  13. package/application/application.ios.js +642 -16
  14. package/application/application.ios.js.map +1 -1
  15. package/application/helpers.android.d.ts +0 -9
  16. package/application/helpers.android.js +0 -54
  17. package/application/helpers.android.js.map +1 -1
  18. package/application/helpers.d.ts +0 -10
  19. package/application/helpers.ios.d.ts +0 -19
  20. package/application/helpers.ios.js +0 -38
  21. package/application/helpers.ios.js.map +1 -1
  22. package/cli-hooks/{before-checkForChanges.js → before-checkForChanges.mjs} +7 -7
  23. package/cli-hooks/postinstall.mjs +7 -0
  24. package/cli-hooks/preuninstall.mjs +7 -0
  25. package/config/config.interface.d.ts +21 -0
  26. package/connectivity/index.android.js +25 -25
  27. package/connectivity/index.android.js.map +1 -1
  28. package/core-types/index.d.ts +78 -63
  29. package/core-types/index.js +11 -1
  30. package/core-types/index.js.map +1 -1
  31. package/core-types/validators.js +14 -5
  32. package/core-types/validators.js.map +1 -1
  33. package/data/observable/index.d.ts +2 -1
  34. package/data/observable/index.js +31 -19
  35. package/data/observable/index.js.map +1 -1
  36. package/fps-meter/fps-native.ios.js +1 -1
  37. package/fps-meter/fps-native.ios.js.map +1 -1
  38. package/globals/index.js +1 -2
  39. package/globals/index.js.map +1 -1
  40. package/http/http-request/index.ios.js +1 -1
  41. package/http/http-request/index.ios.js.map +1 -1
  42. package/image-asset/image-asset-common.js +31 -3
  43. package/image-asset/image-asset-common.js.map +1 -1
  44. package/image-source/index.android.js +4 -3
  45. package/image-source/index.android.js.map +1 -1
  46. package/image-source/index.d.ts +2 -2
  47. package/index.d.ts +1 -0
  48. package/index.js +0 -1
  49. package/index.js.map +1 -1
  50. package/inspector_modules.d.ts +0 -5
  51. package/inspector_modules.js +223 -103
  52. package/inspector_modules.js.map +1 -1
  53. package/package.json +15 -13
  54. package/platform/screen/index.d.ts +5 -0
  55. package/platforms/android/widgets-release.aar +0 -0
  56. package/references.d.ts +1 -1
  57. package/timer/index.android.js +15 -7
  58. package/timer/index.android.js.map +1 -1
  59. package/timer/index.ios.js +1 -1
  60. package/timer/index.ios.js.map +1 -1
  61. package/ui/action-bar/index.android.js +16 -18
  62. package/ui/action-bar/index.android.js.map +1 -1
  63. package/ui/action-bar/index.ios.d.ts +1 -0
  64. package/ui/action-bar/index.ios.js +28 -4
  65. package/ui/action-bar/index.ios.js.map +1 -1
  66. package/ui/animation/index.d.ts +14 -1
  67. package/ui/animation/index.ios.js +2 -3
  68. package/ui/animation/index.ios.js.map +1 -1
  69. package/ui/button/index.android.js +20 -20
  70. package/ui/button/index.android.js.map +1 -1
  71. package/ui/button/index.d.ts +1 -1
  72. package/ui/button/index.ios.d.ts +2 -1
  73. package/ui/button/index.ios.js +28 -10
  74. package/ui/button/index.ios.js.map +1 -1
  75. package/ui/core/control-state-change/index.ios.js +1 -1
  76. package/ui/core/control-state-change/index.ios.js.map +1 -1
  77. package/ui/core/properties/index.js +64 -52
  78. package/ui/core/properties/index.js.map +1 -1
  79. package/ui/core/view/index.android.d.ts +19 -2
  80. package/ui/core/view/index.android.js +544 -200
  81. package/ui/core/view/index.android.js.map +1 -1
  82. package/ui/core/view/index.d.ts +55 -4
  83. package/ui/core/view/index.ios.d.ts +19 -2
  84. package/ui/core/view/index.ios.js +148 -10
  85. package/ui/core/view/index.ios.js.map +1 -1
  86. package/ui/core/view/view-common.d.ts +70 -10
  87. package/ui/core/view/view-common.js +66 -1
  88. package/ui/core/view/view-common.js.map +1 -1
  89. package/ui/core/view/view-helper/index.d.ts +5 -0
  90. package/ui/core/view/view-helper/index.ios.d.ts +6 -4
  91. package/ui/core/view/view-helper/index.ios.js +37 -20
  92. package/ui/core/view/view-helper/index.ios.js.map +1 -1
  93. package/ui/core/view/view-helper/view-helper-common.js +7 -0
  94. package/ui/core/view/view-helper/view-helper-common.js.map +1 -1
  95. package/ui/core/view/view-interfaces.d.ts +22 -0
  96. package/ui/core/view-base/index.d.ts +4 -0
  97. package/ui/core/view-base/index.js.map +1 -1
  98. package/ui/date-picker/index.android.js +36 -38
  99. package/ui/date-picker/index.android.js.map +1 -1
  100. package/ui/date-picker/index.ios.js +1 -1
  101. package/ui/date-picker/index.ios.js.map +1 -1
  102. package/ui/dialogs/index.ios.js +4 -2
  103. package/ui/dialogs/index.ios.js.map +1 -1
  104. package/ui/editable-text-base/editable-text-base-common.js +1 -1
  105. package/ui/editable-text-base/editable-text-base-common.js.map +1 -1
  106. package/ui/editable-text-base/index.android.d.ts +1 -1
  107. package/ui/editable-text-base/index.android.js +35 -34
  108. package/ui/editable-text-base/index.android.js.map +1 -1
  109. package/ui/editable-text-base/index.ios.d.ts +1 -1
  110. package/ui/editable-text-base/index.ios.js +3 -0
  111. package/ui/editable-text-base/index.ios.js.map +1 -1
  112. package/ui/frame/activity.android.js +3 -0
  113. package/ui/frame/activity.android.js.map +1 -1
  114. package/ui/frame/fragment.transitions.android.d.ts +2 -1
  115. package/ui/frame/fragment.transitions.android.js +103 -104
  116. package/ui/frame/fragment.transitions.android.js.map +1 -1
  117. package/ui/frame/fragment.transitions.d.ts +3 -2
  118. package/ui/frame/frame-interfaces.d.ts +18 -8
  119. package/ui/frame/index.android.d.ts +2 -0
  120. package/ui/frame/index.android.js +57 -2
  121. package/ui/frame/index.android.js.map +1 -1
  122. package/ui/frame/index.d.ts +1 -1
  123. package/ui/frame/index.ios.d.ts +3 -1
  124. package/ui/frame/index.ios.js +94 -59
  125. package/ui/frame/index.ios.js.map +1 -1
  126. package/ui/gestures/index.android.js +129 -130
  127. package/ui/gestures/index.android.js.map +1 -1
  128. package/ui/gestures/index.ios.js +3 -5
  129. package/ui/gestures/index.ios.js.map +1 -1
  130. package/ui/gestures/touch-manager.js +32 -32
  131. package/ui/gestures/touch-manager.js.map +1 -1
  132. package/ui/image/index.android.js +17 -19
  133. package/ui/image/index.android.js.map +1 -1
  134. package/ui/image-cache/index.android.js +12 -14
  135. package/ui/image-cache/index.android.js.map +1 -1
  136. package/ui/image-cache/index.ios.js +6 -6
  137. package/ui/image-cache/index.ios.js.map +1 -1
  138. package/ui/index.d.ts +10 -4
  139. package/ui/index.js +4 -1
  140. package/ui/index.js.map +1 -1
  141. package/ui/label/index.android.js +4 -1
  142. package/ui/label/index.android.js.map +1 -1
  143. package/ui/label/index.ios.d.ts +2 -1
  144. package/ui/label/index.ios.js +12 -2
  145. package/ui/label/index.ios.js.map +1 -1
  146. package/ui/layouts/flexbox-layout/index.ios.js +3 -6
  147. package/ui/layouts/flexbox-layout/index.ios.js.map +1 -1
  148. package/ui/layouts/index.d.ts +5 -1
  149. package/ui/layouts/index.js +2 -0
  150. package/ui/layouts/index.js.map +1 -1
  151. package/ui/layouts/liquid-glass/index.android.d.ts +5 -0
  152. package/ui/layouts/liquid-glass/index.android.js +8 -0
  153. package/ui/layouts/liquid-glass/index.android.js.map +1 -0
  154. package/ui/layouts/liquid-glass/index.d.ts +10 -0
  155. package/ui/layouts/liquid-glass/index.ios.d.ts +10 -0
  156. package/ui/layouts/liquid-glass/index.ios.js +59 -0
  157. package/ui/layouts/liquid-glass/index.ios.js.map +1 -0
  158. package/ui/layouts/liquid-glass/liquid-glass-common.d.ts +3 -0
  159. package/ui/layouts/liquid-glass/liquid-glass-common.js +4 -0
  160. package/ui/layouts/liquid-glass/liquid-glass-common.js.map +1 -0
  161. package/ui/layouts/liquid-glass-container/index.android.d.ts +3 -0
  162. package/ui/layouts/liquid-glass-container/index.android.js +4 -0
  163. package/ui/layouts/liquid-glass-container/index.android.js.map +1 -0
  164. package/ui/layouts/liquid-glass-container/index.d.ts +3 -0
  165. package/ui/layouts/liquid-glass-container/index.ios.d.ts +14 -0
  166. package/ui/layouts/liquid-glass-container/index.ios.js +121 -0
  167. package/ui/layouts/liquid-glass-container/index.ios.js.map +1 -0
  168. package/ui/layouts/liquid-glass-container/liquid-glass-container-common.d.ts +4 -0
  169. package/ui/layouts/liquid-glass-container/liquid-glass-container-common.js +5 -0
  170. package/ui/layouts/liquid-glass-container/liquid-glass-container-common.js.map +1 -0
  171. package/ui/layouts/stack-layout/index.ios.js +6 -0
  172. package/ui/layouts/stack-layout/index.ios.js.map +1 -1
  173. package/ui/list-picker/index.android.js +31 -35
  174. package/ui/list-picker/index.android.js.map +1 -1
  175. package/ui/list-picker/index.ios.js +2 -2
  176. package/ui/list-picker/index.ios.js.map +1 -1
  177. package/ui/list-view/index.android.js +320 -321
  178. package/ui/list-view/index.android.js.map +1 -1
  179. package/ui/list-view/index.d.ts +7 -2
  180. package/ui/list-view/index.ios.d.ts +1 -1
  181. package/ui/list-view/index.ios.js +12 -27
  182. package/ui/list-view/index.ios.js.map +1 -1
  183. package/ui/page/index.android.d.ts +1 -10
  184. package/ui/page/index.android.js +1 -45
  185. package/ui/page/index.android.js.map +1 -1
  186. package/ui/page/index.d.ts +0 -8
  187. package/ui/page/index.ios.d.ts +1 -3
  188. package/ui/page/index.ios.js +33 -91
  189. package/ui/page/index.ios.js.map +1 -1
  190. package/ui/page/page-common.d.ts +0 -6
  191. package/ui/page/page-common.js +0 -14
  192. package/ui/page/page-common.js.map +1 -1
  193. package/ui/scroll-view/index.d.ts +1 -1
  194. package/ui/scroll-view/index.ios.d.ts +2 -0
  195. package/ui/scroll-view/index.ios.js +31 -12
  196. package/ui/scroll-view/index.ios.js.map +1 -1
  197. package/ui/scroll-view/scroll-view-common.d.ts +3 -8
  198. package/ui/scroll-view/scroll-view-common.js +4 -4
  199. package/ui/scroll-view/scroll-view-common.js.map +1 -1
  200. package/ui/search-bar/index.android.d.ts +2 -1
  201. package/ui/search-bar/index.android.js +64 -53
  202. package/ui/search-bar/index.android.js.map +1 -1
  203. package/ui/search-bar/index.d.ts +7 -0
  204. package/ui/search-bar/index.ios.d.ts +2 -1
  205. package/ui/search-bar/index.ios.js +14 -7
  206. package/ui/search-bar/index.ios.js.map +1 -1
  207. package/ui/search-bar/search-bar-common.d.ts +2 -0
  208. package/ui/search-bar/search-bar-common.js +7 -0
  209. package/ui/search-bar/search-bar-common.js.map +1 -1
  210. package/ui/segmented-bar/index.android.js +52 -58
  211. package/ui/segmented-bar/index.android.js.map +1 -1
  212. package/ui/segmented-bar/index.ios.js +1 -1
  213. package/ui/segmented-bar/index.ios.js.map +1 -1
  214. package/ui/slider/index.android.js +22 -25
  215. package/ui/slider/index.android.js.map +1 -1
  216. package/ui/slider/index.d.ts +1 -1
  217. package/ui/slider/index.ios.js +2 -2
  218. package/ui/slider/index.ios.js.map +1 -1
  219. package/ui/split-view/index.android.d.ts +4 -0
  220. package/ui/split-view/index.android.js +4 -0
  221. package/ui/split-view/index.android.js.map +1 -0
  222. package/ui/split-view/index.d.ts +11 -0
  223. package/ui/split-view/index.ios.d.ts +39 -0
  224. package/ui/split-view/index.ios.js +368 -0
  225. package/ui/split-view/index.ios.js.map +1 -0
  226. package/ui/split-view/split-view-common.d.ts +51 -0
  227. package/ui/split-view/split-view-common.js +111 -0
  228. package/ui/split-view/split-view-common.js.map +1 -0
  229. package/ui/styling/background-common.d.ts +4 -4
  230. package/ui/styling/background-common.js +8 -8
  231. package/ui/styling/background-common.js.map +1 -1
  232. package/ui/styling/background.d.ts +0 -3
  233. package/ui/styling/background.ios.d.ts +2 -1
  234. package/ui/styling/background.ios.js +47 -38
  235. package/ui/styling/background.ios.js.map +1 -1
  236. package/ui/styling/css-stroke.js.map +1 -1
  237. package/ui/styling/css-utils.d.ts +1 -0
  238. package/ui/styling/css-utils.js +15 -4
  239. package/ui/styling/css-utils.js.map +1 -1
  240. package/ui/styling/style/index.d.ts +3 -1
  241. package/ui/styling/style/index.js.map +1 -1
  242. package/ui/styling/style-properties.d.ts +1 -0
  243. package/ui/styling/style-properties.js +30 -11
  244. package/ui/styling/style-properties.js.map +1 -1
  245. package/ui/switch/index.android.js +16 -18
  246. package/ui/switch/index.android.js.map +1 -1
  247. package/ui/switch/index.ios.d.ts +1 -1
  248. package/ui/switch/index.ios.js +62 -25
  249. package/ui/switch/index.ios.js.map +1 -1
  250. package/ui/tab-view/index.android.js +185 -187
  251. package/ui/tab-view/index.android.js.map +1 -1
  252. package/ui/tab-view/index.d.ts +17 -1
  253. package/ui/tab-view/index.ios.d.ts +13 -5
  254. package/ui/tab-view/index.ios.js +255 -57
  255. package/ui/tab-view/index.ios.js.map +1 -1
  256. package/ui/tab-view/tab-view-common.d.ts +14 -0
  257. package/ui/tab-view/tab-view-common.js +15 -0
  258. package/ui/tab-view/tab-view-common.js.map +1 -1
  259. package/ui/text-base/index.android.d.ts +2 -1
  260. package/ui/text-base/index.android.js +134 -101
  261. package/ui/text-base/index.android.js.map +1 -1
  262. package/ui/text-base/index.d.ts +5 -0
  263. package/ui/text-base/index.ios.js +12 -18
  264. package/ui/text-base/index.ios.js.map +1 -1
  265. package/ui/text-base/text-base-common.d.ts +2 -1
  266. package/ui/text-base/text-base-common.js +1 -0
  267. package/ui/text-base/text-base-common.js.map +1 -1
  268. package/ui/text-field/index.android.js +3 -0
  269. package/ui/text-field/index.android.js.map +1 -1
  270. package/ui/text-field/index.ios.d.ts +2 -1
  271. package/ui/text-field/index.ios.js +9 -5
  272. package/ui/text-field/index.ios.js.map +1 -1
  273. package/ui/text-view/index.ios.d.ts +2 -1
  274. package/ui/text-view/index.ios.js +12 -7
  275. package/ui/text-view/index.ios.js.map +1 -1
  276. package/ui/time-picker/index.android.js +19 -21
  277. package/ui/time-picker/index.android.js.map +1 -1
  278. package/ui/time-picker/index.ios.js +1 -1
  279. package/ui/time-picker/index.ios.js.map +1 -1
  280. package/ui/transition/fade-transition.ios.js +5 -6
  281. package/ui/transition/fade-transition.ios.js.map +1 -1
  282. package/ui/transition/modal-transition.ios.js +19 -26
  283. package/ui/transition/modal-transition.ios.js.map +1 -1
  284. package/ui/transition/page-transition.android.js +18 -13
  285. package/ui/transition/page-transition.android.js.map +1 -1
  286. package/ui/transition/page-transition.ios.js +19 -25
  287. package/ui/transition/page-transition.ios.js.map +1 -1
  288. package/ui/transition/slide-transition.ios.js +5 -6
  289. package/ui/transition/slide-transition.ios.js.map +1 -1
  290. package/ui/web-view/index.android.js +58 -62
  291. package/ui/web-view/index.android.js.map +1 -1
  292. package/ui/web-view/index.ios.js +18 -18
  293. package/ui/web-view/index.ios.js.map +1 -1
  294. package/utils/common.d.ts +3 -1
  295. package/utils/common.js +9 -3
  296. package/utils/common.js.map +1 -1
  297. package/utils/constants.android.d.ts +1 -0
  298. package/utils/constants.android.js +3 -0
  299. package/utils/constants.android.js.map +1 -1
  300. package/utils/constants.d.ts +1 -0
  301. package/utils/constants.ios.d.ts +1 -0
  302. package/utils/constants.ios.js +3 -0
  303. package/utils/constants.ios.js.map +1 -1
  304. package/utils/index.d.ts +6 -0
  305. package/utils/layout-helper/index.android.d.ts +1 -0
  306. package/utils/layout-helper/index.android.js +9 -0
  307. package/utils/layout-helper/index.android.js.map +1 -1
  308. package/utils/layout-helper/index.d.ts +5 -0
  309. package/utils/layout-helper/index.ios.d.ts +1 -0
  310. package/utils/layout-helper/index.ios.js +4 -0
  311. package/utils/layout-helper/index.ios.js.map +1 -1
  312. package/utils/native-helper-for-android.d.ts +22 -0
  313. package/utils/native-helper-for-android.js +103 -0
  314. package/utils/native-helper-for-android.js.map +1 -1
  315. package/utils/native-helper.android.d.ts +9 -1
  316. package/utils/native-helper.android.js +5 -1
  317. package/utils/native-helper.android.js.map +1 -1
  318. package/utils/native-helper.d.ts +30 -0
  319. package/utils/native-helper.ios.js +20 -20
  320. package/utils/native-helper.ios.js.map +1 -1
  321. package/cli-hooks/postinstall.js +0 -2
  322. package/cli-hooks/preuninstall.js +0 -2
@@ -1,5 +1,6 @@
1
1
  import { ListViewBase, separatorColorProperty, itemTemplatesProperty, stickyHeaderProperty, stickyHeaderTemplateProperty, sectionedProperty, showSearchProperty } from './list-view-common';
2
2
  import { View } from '../core/view';
3
+ import { PercentLength } from '../styling/length-shared';
3
4
  import { unsetValue } from '../core/properties/property-shared';
4
5
  import { Color } from '../../color';
5
6
  import { Observable } from '../../data/observable';
@@ -7,6 +8,7 @@ import { StackLayout } from '../layouts/stack-layout';
7
8
  import { ProxyViewContainer } from '../proxy-view-container';
8
9
  import { LayoutBase } from '../layouts/layout-base';
9
10
  import { profile } from '../../profiling';
11
+ import { Trace } from '../../trace';
10
12
  import { Builder } from '../builder';
11
13
  import { Label } from '../label';
12
14
  export * from './list-view-common';
@@ -14,6 +16,8 @@ const ITEMLOADING = ListViewBase.itemLoadingEvent;
14
16
  const LOADMOREITEMS = ListViewBase.loadMoreItemsEvent;
15
17
  const ITEMTAP = ListViewBase.itemTapEvent;
16
18
  const SEARCHCHANGE = ListViewBase.searchChangeEvent;
19
+ const STICKY_HEADER_Z_INDEX = 1000;
20
+ const SEARCH_VIEW_Z_INDEX = 2000;
17
21
  // View type constants for sectioned lists
18
22
  const ITEM_VIEW_TYPE = 0;
19
23
  let ItemClickListener;
@@ -21,30 +25,28 @@ function initializeItemClickListener() {
21
25
  if (ItemClickListener) {
22
26
  return;
23
27
  }
24
- var ItemClickListenerImpl = /** @class */ (function (_super) {
25
- __extends(ItemClickListenerImpl, _super);
26
- function ItemClickListenerImpl(owner) {
27
- var _this = _super.call(this) || this;
28
- _this.owner = owner;
29
- return global.__native(_this);
30
- }
31
- ItemClickListenerImpl.prototype.onItemClick = function (parent, convertView, index, id) {
32
- var owner = this.owner;
33
- var view = owner._realizedItems.get(convertView).view;
34
- owner.notify({
35
- eventName: ITEMTAP,
36
- object: owner,
37
- index: index,
38
- view: view,
39
- });
40
- };
41
- var _a;
42
- ItemClickListenerImpl = __decorate([
43
- Interfaces([android.widget.AdapterView.OnItemClickListener]),
44
- __metadata("design:paramtypes", [typeof (_a = typeof ListView !== "undefined" && ListView) === "function" ? _a : Object])
45
- ], ItemClickListenerImpl);
46
- return ItemClickListenerImpl;
47
- }(java.lang.Object));
28
+ var ItemClickListenerImpl = (function (_super) {
29
+ __extends(ItemClickListenerImpl, _super);
30
+ function ItemClickListenerImpl(owner) {
31
+ var _this = _super.call(this) || this;
32
+ _this.owner = owner;
33
+ return global.__native(_this);
34
+ }
35
+ ItemClickListenerImpl.prototype.onItemClick = function (parent, convertView, index, id) {
36
+ var owner = this.owner;
37
+ var view = owner._realizedItems.get(convertView).view;
38
+ owner.notify({
39
+ eventName: ITEMTAP,
40
+ object: owner,
41
+ index: index,
42
+ view: view,
43
+ });
44
+ };
45
+ ItemClickListenerImpl = __decorate([
46
+ Interfaces([android.widget.AdapterView.OnItemClickListener])
47
+ ], ItemClickListenerImpl);
48
+ return ItemClickListenerImpl;
49
+ }(java.lang.Object));
48
50
  ItemClickListener = ItemClickListenerImpl;
49
51
  }
50
52
  export class ListView extends ListViewBase {
@@ -197,7 +199,9 @@ export class ListView extends ListViewBase {
197
199
  adapter.notifyDataSetChanged();
198
200
  }
199
201
  catch (error) {
200
- console.log('Error refreshing adapter, recreating:', error);
202
+ if (Trace.isEnabled()) {
203
+ Trace.error('Error refreshing adapter, recreating: ' + error);
204
+ }
201
205
  nativeView.setAdapter(new ListViewAdapterClass(this));
202
206
  }
203
207
  }
@@ -328,7 +332,7 @@ export class ListView extends ListViewBase {
328
332
  this._stickyHeaderView.marginTop = 0; // Reset any previous margin
329
333
  // Position sticky header with proper offset using native positioning
330
334
  if (this._stickyHeaderView.nativeViewProtected) {
331
- this._stickyHeaderView.nativeViewProtected.setZ(1000);
335
+ this._stickyHeaderView.nativeViewProtected.setZ(STICKY_HEADER_Z_INDEX);
332
336
  // Use a timeout to ensure search view is measured first
333
337
  setTimeout(() => {
334
338
  if (this._searchView && this._searchView._wrapper) {
@@ -347,7 +351,7 @@ export class ListView extends ListViewBase {
347
351
  else {
348
352
  // No search view - position at top
349
353
  if (this._stickyHeaderView.nativeViewProtected) {
350
- this._stickyHeaderView.nativeViewProtected.setZ(1000);
354
+ this._stickyHeaderView.nativeViewProtected.setZ(STICKY_HEADER_Z_INDEX);
351
355
  this._stickyHeaderView.nativeViewProtected.setTranslationY(0);
352
356
  }
353
357
  }
@@ -374,29 +378,33 @@ export class ListView extends ListViewBase {
374
378
  this._stickyHeaderHeight = defaultHeaderHeight;
375
379
  // Request layout to ensure proper measurement
376
380
  this._stickyHeaderView.requestLayout();
377
- // Then measure and adjust padding if needed
378
- setTimeout(() => {
379
- if (this._stickyHeaderView) {
380
- // Get the actual measured height from the native view
381
- const nativeView = this._stickyHeaderView.nativeViewProtected;
382
- if (nativeView && nativeView.getMeasuredHeight() > 0) {
383
- const measuredHeaderHeight = nativeView.getMeasuredHeight();
384
- let finalSearchHeight = searchViewHeight;
385
- // Re-measure search view if needed
386
- if (this.showSearch && this._searchView && this._searchView._wrapper) {
387
- const searchWrapper = this._searchView._wrapper;
388
- if (searchWrapper.nativeViewProtected && searchWrapper.nativeViewProtected.getMeasuredHeight() > 0) {
389
- finalSearchHeight = searchWrapper.nativeViewProtected.getMeasuredHeight();
381
+ // Then measure and adjust padding if needed using a layout listener for determinism
382
+ const stickyHeaderNativeView = this._stickyHeaderView && this._stickyHeaderView.nativeViewProtected;
383
+ if (stickyHeaderNativeView) {
384
+ const layoutListener = new android.view.View.OnLayoutChangeListener({
385
+ onLayoutChange: (v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) => {
386
+ if (v.getMeasuredHeight() > 0) {
387
+ const measuredHeaderHeight = v.getMeasuredHeight();
388
+ let finalSearchHeight = searchViewHeight;
389
+ // Re-measure search view if needed
390
+ if (this.showSearch && this._searchView && this._searchView._wrapper) {
391
+ const searchWrapper = this._searchView._wrapper;
392
+ if (searchWrapper.nativeViewProtected && searchWrapper.nativeViewProtected.getMeasuredHeight() > 0) {
393
+ finalSearchHeight = searchWrapper.nativeViewProtected.getMeasuredHeight();
394
+ }
390
395
  }
396
+ // Calculate final padding: search height + sticky header height + small buffer
397
+ const totalPaddingHeight = finalSearchHeight + measuredHeaderHeight + 4;
398
+ this._stickyHeaderHeight = measuredHeaderHeight;
399
+ this.nativeViewProtected.setPadding(0, totalPaddingHeight, 0, 0);
400
+ this.scrollToIndex(0);
401
+ // Remove the listener after first valid layout
402
+ v.removeOnLayoutChangeListener(layoutListener);
391
403
  }
392
- // Calculate final padding: search height + sticky header height + small buffer
393
- const totalPaddingHeight = finalSearchHeight + measuredHeaderHeight + 4;
394
- this._stickyHeaderHeight = measuredHeaderHeight;
395
- this.nativeViewProtected.setPadding(0, totalPaddingHeight, 0, 0);
396
- this.scrollToIndex(0);
397
- }
398
- }
399
- }, 150); // Slightly longer delay for more reliable measurement after positioning
404
+ },
405
+ });
406
+ stickyHeaderNativeView.addOnLayoutChangeListener(layoutListener);
407
+ }
400
408
  }
401
409
  _setupScrollListener() {
402
410
  if (this._scrollListener) {
@@ -427,7 +435,8 @@ export class ListView extends ListViewBase {
427
435
  const sectionCount = this._getSectionCount();
428
436
  for (let section = 0; section < sectionCount; section++) {
429
437
  // Check if firstVisibleItem is in this section (header or items)
430
- const itemsInSection = this._getItemsInSection(section).length;
438
+ const sectionItems = this._getItemsInSection(section) || [];
439
+ const itemsInSection = sectionItems.length || 0;
431
440
  const sectionEndPosition = currentPosition + 1 + itemsInSection; // +1 for header
432
441
  if (firstVisibleItem < sectionEndPosition) {
433
442
  return section;
@@ -624,7 +633,7 @@ export class ListView extends ListViewBase {
624
633
  }
625
634
  // Ensure search view appears above everything else
626
635
  if (searchViewWrapper.nativeViewProtected) {
627
- searchViewWrapper.nativeViewProtected.setZ(2000); // Higher than sticky header (1000)
636
+ searchViewWrapper.nativeViewProtected.setZ(SEARCH_VIEW_Z_INDEX);
628
637
  }
629
638
  // Store reference for cleanup
630
639
  this._searchView._wrapper = searchViewWrapper;
@@ -699,301 +708,291 @@ function ensureListViewAdapterClass() {
699
708
  if (ListViewAdapterClass) {
700
709
  return;
701
710
  }
702
- var ListViewAdapter = /** @class */ (function (_super) {
703
- __extends(ListViewAdapter, _super);
704
- function ListViewAdapter(owner) {
705
- var _this = _super.call(this) || this;
706
- _this.owner = owner;
707
- return global.__native(_this);
708
- }
709
- ListViewAdapter.prototype.getCount = function () {
710
- if (!this.owner || !this.owner.items) {
711
- return 0;
711
+ var ListViewAdapter = (function (_super) {
712
+ __extends(ListViewAdapter, _super);
713
+ function ListViewAdapter(owner) {
714
+ var _this = _super.call(this) || this;
715
+ _this.owner = owner;
716
+ return global.__native(_this);
712
717
  }
713
- // Ensure we always have at least the items array length, even if empty
714
- var count = 0;
715
- if (this.owner.sectioned) {
716
- // Count items + section headers
717
- var sectionCount = this.owner._getSectionCount();
718
- for (var i = 0; i < sectionCount; i++) {
719
- var itemsInSection = this.owner._getItemsInSection(i);
720
- // Only add header if section has items or we want to show empty sections
721
- if (itemsInSection.length > 0) {
722
- count += 1; // Section header
723
- count += itemsInSection.length; // Items in section
718
+ ListViewAdapter.prototype.getCount = function () {
719
+ if (!this.owner) {
720
+ return 0;
721
+ }
722
+ var count = 0;
723
+ if (this.owner.sectioned) {
724
+ var sectionCount = this.owner._getSectionCount();
725
+ if (!this.owner.items || sectionCount <= 0) {
726
+ return 0;
727
+ }
728
+ for (var i = 0; i < sectionCount; i++) {
729
+ var itemsInSection = this.owner._getItemsInSection(i) || [];
730
+ if (itemsInSection.length > 0) {
731
+ count += 1;
732
+ count += itemsInSection.length;
733
+ }
724
734
  }
725
735
  }
726
- }
727
- else {
728
- count = this.owner.items.length;
729
- }
730
- // Return the count, ensuring it's never negative
731
- return Math.max(0, count);
732
- };
733
- ListViewAdapter.prototype.getItem = function (i) {
734
- if (!this.owner || !this.owner.items) {
735
- return null;
736
- }
737
- // Safety check for index bounds
738
- var totalCount = this.getCount();
739
- if (i < 0 || i >= totalCount) {
740
- return null;
741
- }
742
- if (this.owner.sectioned) {
743
- var positionInfo = this._getPositionInfo(i);
744
- if (positionInfo.isHeader) {
745
- return this.owner._getSectionData(positionInfo.section);
736
+ else {
737
+ var src = this.owner.items;
738
+ count = src && typeof src.length === "number" ? src.length : 0;
739
+ }
740
+ return Math.max(0, count);
741
+ };
742
+ ListViewAdapter.prototype.getItem = function (i) {
743
+ if (!this.owner || !this.owner.items) {
744
+ return null;
745
+ }
746
+ var totalCount = this.getCount();
747
+ if (i < 0 || i >= totalCount) {
748
+ return null;
749
+ }
750
+ if (this.owner.sectioned) {
751
+ var positionInfo = this._getPositionInfo(i);
752
+ if (positionInfo.isHeader) {
753
+ return this.owner._getSectionData(positionInfo.section);
754
+ }
755
+ else {
756
+ return this.owner._getDataItemInSection(positionInfo.section, positionInfo.itemIndex);
757
+ }
746
758
  }
747
759
  else {
748
- return this.owner._getDataItemInSection(positionInfo.section, positionInfo.itemIndex);
760
+ var src = this.owner.items;
761
+ if (src && typeof src.length === "number" && i < src.length) {
762
+ var getItem = src.getItem;
763
+ return getItem ? getItem.call(src, i) : src[i];
764
+ }
749
765
  }
750
- }
751
- else {
752
- if (i < this.owner.items.length) {
753
- var getItem = this.owner.items.getItem;
754
- return getItem ? getItem.call(this.owner.items, i) : this.owner.items[i];
766
+ return null;
767
+ };
768
+ ListViewAdapter.prototype._getPositionInfo = function (position) {
769
+ if (!this.owner.sectioned) {
770
+ return { isHeader: false, section: 0, itemIndex: position };
755
771
  }
756
- }
757
- return null;
758
- };
759
- // Helper method to determine if position is header and get section/item info
760
- ListViewAdapter.prototype._getPositionInfo = function (position) {
761
- if (!this.owner.sectioned) {
762
- return { isHeader: false, section: 0, itemIndex: position };
763
- }
764
- var currentPosition = 0;
765
- var sectionCount = this.owner._getSectionCount();
766
- for (var section = 0; section < sectionCount; section++) {
767
- var itemsInSection = this.owner._getItemsInSection(section);
768
- // Skip sections with no items (they won't have headers in our count)
769
- if (itemsInSection.length === 0) {
770
- continue;
771
- }
772
- // Check if this position is the section header
773
- if (currentPosition === position) {
774
- return { isHeader: true, section: section, itemIndex: -1 };
775
- }
776
- currentPosition++; // Move past header
777
- // Check if position is within this section's items
778
- if (position < currentPosition + itemsInSection.length) {
779
- var itemIndex = position - currentPosition;
780
- return { isHeader: false, section: section, itemIndex: itemIndex };
781
- }
782
- currentPosition += itemsInSection.length; // Move past items
783
- }
784
- // Fallback - should not reach here with proper bounds checking
785
- return { isHeader: false, section: 0, itemIndex: 0 };
786
- };
787
- ListViewAdapter.prototype.getItemId = function (i) {
788
- var item = this.getItem(i);
789
- var id = i;
790
- if (this.owner && item && this.owner.items) {
791
- id = this.owner.itemIdGenerator(item, i, this.owner.items);
792
- }
793
- return long(id);
794
- };
795
- ListViewAdapter.prototype.hasStableIds = function () {
796
- return true;
797
- };
798
- ListViewAdapter.prototype.isEnabled = function (position) {
799
- // Safety check to prevent crashes when adapter is empty
800
- var totalCount = this.getCount();
801
- if (totalCount === 0 || position < 0 || position >= totalCount) {
802
- return false;
803
- }
804
- // For sectioned lists, check if this is a header position
805
- if (this.owner.sectioned) {
806
- var positionInfo = this._getPositionInfo(position);
807
- // Headers are typically not clickable, items are
808
- return !positionInfo.isHeader;
809
- }
810
- return true;
811
- };
812
- ListViewAdapter.prototype.getViewTypeCount = function () {
813
- var count = this.owner._itemTemplatesInternal.length;
814
- // Add 1 for header view type when sectioned
815
- if (this.owner.sectioned && this.owner.stickyHeaderTemplate) {
816
- count += 1;
817
- }
818
- return count;
819
- };
820
- ListViewAdapter.prototype.getItemViewType = function (index) {
821
- if (this.owner.sectioned) {
822
- var positionInfo = this._getPositionInfo(index);
823
- if (positionInfo.isHeader) {
824
- // Header view type is the last index (after all item template types)
825
- return this.owner._itemTemplatesInternal.length;
772
+ var currentPosition = 0;
773
+ var sectionCount = this.owner._getSectionCount();
774
+ for (var section = 0; section < sectionCount; section++) {
775
+ var itemsInSection = this.owner._getItemsInSection(section) || [];
776
+ if (itemsInSection.length === 0) {
777
+ continue;
778
+ }
779
+ if (currentPosition === position) {
780
+ return { isHeader: true, section: section, itemIndex: -1 };
781
+ }
782
+ currentPosition++;
783
+ if (position < currentPosition + itemsInSection.length) {
784
+ var itemIndex = position - currentPosition;
785
+ return { isHeader: false, section: section, itemIndex: itemIndex };
786
+ }
787
+ currentPosition += itemsInSection.length;
788
+ }
789
+ return { isHeader: false, section: 0, itemIndex: 0 };
790
+ };
791
+ ListViewAdapter.prototype.getItemId = function (i) {
792
+ var item = this.getItem(i);
793
+ var id = i;
794
+ if (this.owner && item && this.owner.items) {
795
+ id = this.owner.itemIdGenerator(item, i, this.owner.items);
796
+ }
797
+ return long(id);
798
+ };
799
+ ListViewAdapter.prototype.hasStableIds = function () {
800
+ return true;
801
+ };
802
+ ListViewAdapter.prototype.isEnabled = function (position) {
803
+ var totalCount = this.getCount();
804
+ if (totalCount === 0 || position < 0 || position >= totalCount) {
805
+ return false;
806
+ }
807
+ if (this.owner.sectioned) {
808
+ var positionInfo = this._getPositionInfo(position);
809
+ return !positionInfo.isHeader;
810
+ }
811
+ return true;
812
+ };
813
+ ListViewAdapter.prototype.getViewTypeCount = function () {
814
+ var count = this.owner._itemTemplatesInternal.length;
815
+ if (this.owner.sectioned && this.owner.stickyHeaderTemplate) {
816
+ count += 1;
817
+ }
818
+ return count;
819
+ };
820
+ ListViewAdapter.prototype.getItemViewType = function (index) {
821
+ if (this.owner.sectioned) {
822
+ var positionInfo = this._getPositionInfo(index);
823
+ if (positionInfo.isHeader) {
824
+ return this.owner._itemTemplatesInternal.length;
825
+ }
826
+ else {
827
+ var template = this.owner._getItemTemplate(positionInfo.itemIndex);
828
+ return this.owner._itemTemplatesInternal.indexOf(template);
829
+ }
826
830
  }
827
831
  else {
828
- // Get template for the actual item
829
- var template = this.owner._getItemTemplate(positionInfo.itemIndex);
832
+ var template = this.owner._getItemTemplate(index);
830
833
  return this.owner._itemTemplatesInternal.indexOf(template);
831
834
  }
832
- }
833
- else {
834
- var template = this.owner._getItemTemplate(index);
835
- return this.owner._itemTemplatesInternal.indexOf(template);
836
- }
837
- };
838
- ListViewAdapter.prototype.getView = function (index, convertView, parent) {
839
- //this.owner._dumpRealizedTemplates();
840
- if (!this.owner) {
841
- return null;
842
- }
843
- // Safety check for empty adapter
844
- var totalCount = this.getCount();
845
- if (index < 0 || index >= totalCount) {
846
- // Return a minimal empty view to prevent crashes
847
- var emptyView = new android.view.View(this.owner._context);
848
- var layoutParams = new android.view.ViewGroup.LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT, 0);
849
- emptyView.setLayoutParams(layoutParams);
850
- return emptyView;
851
- }
852
- if (this.owner.sectioned) {
853
- var positionInfo = this._getPositionInfo(index);
854
- if (positionInfo.isHeader) {
855
- // Create section header view (pass index for hiding logic)
856
- return this._createHeaderView(positionInfo.section, convertView, parent, index);
835
+ };
836
+ ListViewAdapter.prototype.getView = function (index, convertView, parent) {
837
+ if (!this.owner) {
838
+ return null;
839
+ }
840
+ var totalCount = this.getCount();
841
+ if (index < 0 || index >= totalCount) {
842
+ var emptyView = new android.view.View(this.owner._context);
843
+ var layoutParams = new android.view.ViewGroup.LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT, 0);
844
+ emptyView.setLayoutParams(layoutParams);
845
+ return emptyView;
846
+ }
847
+ if (index === totalCount - 1) {
848
+ this.owner.notify({
849
+ eventName: LOADMOREITEMS,
850
+ object: this.owner,
851
+ });
852
+ }
853
+ if (this.owner.sectioned) {
854
+ var positionInfo = this._getPositionInfo(index);
855
+ if (positionInfo.isHeader) {
856
+ return this._createHeaderView(positionInfo.section, convertView, parent, index);
857
+ }
858
+ else {
859
+ return this._createItemView(positionInfo.section, positionInfo.itemIndex, convertView, parent);
860
+ }
857
861
  }
858
862
  else {
859
- // Create regular item view with adjusted index
860
- return this._createItemView(positionInfo.section, positionInfo.itemIndex, convertView, parent);
863
+ return this._createItemView(0, index, convertView, parent);
861
864
  }
862
- }
863
- else {
864
- // Non-sectioned - use original logic
865
- return this._createItemView(0, index, convertView, parent);
866
- }
867
- };
868
- ListViewAdapter.prototype._createHeaderView = function (section, convertView, parent, index) {
869
- // Check if this header should be hidden to avoid duplication with sticky header
870
- if (this.owner._hiddenHeaderPositions.has(index)) {
871
- // Return an empty view with zero height
872
- var emptyView = new android.view.View(this.owner._context);
873
- var layoutParams = new android.view.ViewGroup.LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT, 0);
874
- emptyView.setLayoutParams(layoutParams);
875
- return emptyView;
876
- }
877
- var headerView = null;
878
- var headerViewType = this.owner._itemTemplatesInternal.length; // Same as getItemViewType for headers
879
- // Try to reuse convertView if it's the right type
880
- if (convertView) {
881
- var existingData = this.owner._realizedItems.get(convertView);
882
- if (existingData && existingData.templateKey === "header_".concat(headerViewType)) {
883
- headerView = existingData.view;
884
- }
885
- }
886
- // Create new header view if we can't reuse
887
- if (!headerView) {
888
- if (this.owner.stickyHeaderTemplate) {
889
- if (typeof this.owner.stickyHeaderTemplate === 'string') {
890
- try {
891
- headerView = Builder.parse(this.owner.stickyHeaderTemplate, this.owner);
892
- }
893
- catch (error) {
894
- // Fallback to simple label
895
- headerView = new Label();
896
- headerView.text = 'Header Error';
897
- }
865
+ };
866
+ ListViewAdapter.prototype._createHeaderView = function (section, convertView, parent, index) {
867
+ if (this.owner._hiddenHeaderPositions.has(index)) {
868
+ var emptyView = new android.view.View(this.owner._context);
869
+ var layoutParams = new android.view.ViewGroup.LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT, 0);
870
+ emptyView.setLayoutParams(layoutParams);
871
+ return emptyView;
872
+ }
873
+ var headerView = null;
874
+ var headerViewType = this.owner._itemTemplatesInternal.length;
875
+ if (convertView) {
876
+ var existingData = this.owner._realizedItems.get(convertView);
877
+ if (existingData && existingData.templateKey === "header_".concat(headerViewType)) {
878
+ headerView = existingData.view;
898
879
  }
899
880
  }
900
881
  if (!headerView) {
901
- // Default header
902
- headerView = new Label();
903
- headerView.text = "Section ".concat(section);
904
- }
905
- // Add to parent and get native view
906
- if (!headerView.parent) {
907
- if (headerView instanceof LayoutBase && !(headerView instanceof ProxyViewContainer)) {
908
- this.owner._addView(headerView);
909
- convertView = headerView.nativeViewProtected;
882
+ if (this.owner.stickyHeaderTemplate) {
883
+ if (typeof this.owner.stickyHeaderTemplate === "string") {
884
+ try {
885
+ headerView = Builder.parse(this.owner.stickyHeaderTemplate, this.owner);
886
+ }
887
+ catch (error) {
888
+ headerView = new Label();
889
+ headerView.text = "Header Error";
890
+ }
891
+ }
910
892
  }
911
- else {
912
- var sp = new StackLayout();
913
- sp.addChild(headerView);
914
- this.owner._addView(sp);
915
- convertView = sp.nativeViewProtected;
893
+ if (!headerView) {
894
+ headerView = new Label();
895
+ headerView.text = "Section ".concat(section);
896
+ }
897
+ if (!headerView.parent) {
898
+ if (headerView instanceof LayoutBase && !(headerView instanceof ProxyViewContainer)) {
899
+ this.owner._addView(headerView);
900
+ convertView = headerView.nativeViewProtected;
901
+ }
902
+ else {
903
+ var sp = new StackLayout();
904
+ sp.addChild(headerView);
905
+ this.owner._addView(sp);
906
+ convertView = sp.nativeViewProtected;
907
+ }
916
908
  }
909
+ this.owner._realizedItems.set(convertView, {
910
+ view: headerView,
911
+ templateKey: "header_".concat(headerViewType),
912
+ });
917
913
  }
918
- // Register the header view for recycling
919
- this.owner._realizedItems.set(convertView, {
920
- view: headerView,
921
- templateKey: "header_".concat(headerViewType),
922
- });
923
- }
924
- // Set binding context to section data (always update, even for recycled views)
925
- var sectionData = this.owner._getSectionData(section);
926
- if (sectionData) {
927
- headerView.bindingContext = sectionData;
928
- }
929
- else {
930
- headerView.bindingContext = { title: "Section ".concat(section), section: section };
931
- }
932
- return convertView;
933
- };
934
- ListViewAdapter.prototype._createItemView = function (section, itemIndex, convertView, parent) {
935
- // Use existing item creation logic but with sectioned data
936
- var template = this.owner._getItemTemplate(itemIndex);
937
- var view;
938
- // convertView is of the wrong type
939
- if (convertView && this.owner._getKeyFromView(convertView) !== template.key) {
940
- this.owner._markViewUnused(convertView); // release this view
941
- convertView = this.owner._getAvailableView(template.key); // get a view from the right type or null
942
- }
943
- if (convertView) {
944
- view = this.owner._realizedItems.get(convertView).view;
945
- }
946
- if (!view) {
947
- view = template.createView();
948
- }
949
- var args = {
950
- eventName: ITEMLOADING,
951
- object: this.owner,
952
- index: itemIndex,
953
- view: view,
954
- android: parent,
955
- ios: undefined,
956
- };
957
- this.owner.notify(args);
958
- if (!args.view) {
959
- args.view = this.owner._getDefaultItemContent(itemIndex);
960
- }
961
- if (args.view) {
962
- if (this.owner._effectiveRowHeight > -1) {
963
- args.view.height = this.owner.rowHeight;
914
+ var sectionData = this.owner._getSectionData(section);
915
+ if (sectionData) {
916
+ headerView.bindingContext = sectionData;
964
917
  }
965
918
  else {
966
- args.view.height = unsetValue;
919
+ headerView.bindingContext = { title: "Section ".concat(section), section: section };
967
920
  }
968
- // Use sectioned item preparation
969
- if (this.owner.sectioned) {
970
- this.owner._prepareItemInSection(args.view, section, itemIndex);
921
+ return convertView;
922
+ };
923
+ ListViewAdapter.prototype._createItemView = function (section, itemIndex, convertView, parent) {
924
+ var template = this.owner._getItemTemplate(itemIndex);
925
+ var view;
926
+ if (convertView && this.owner._getKeyFromView(convertView) !== template.key) {
927
+ this.owner._markViewUnused(convertView);
928
+ convertView = this.owner._getAvailableView(template.key);
929
+ }
930
+ if (convertView) {
931
+ view = this.owner._realizedItems.get(convertView).view;
932
+ }
933
+ if (!view) {
934
+ view = template.createView();
935
+ }
936
+ var args = {
937
+ eventName: ITEMLOADING,
938
+ object: this.owner,
939
+ index: itemIndex,
940
+ view: view,
941
+ android: parent,
942
+ ios: undefined,
943
+ };
944
+ this.owner.notify(args);
945
+ if (!args.view) {
946
+ args.view = this.owner._getDefaultItemContent(itemIndex);
947
+ }
948
+ if (args.view) {
949
+ if (this.owner._effectiveRowHeight > -1) {
950
+ args.view.height = this.owner.rowHeight;
951
+ }
952
+ else {
953
+ args.view.height = unsetValue;
954
+ }
955
+ if (this.owner.sectioned) {
956
+ this.owner._prepareItemInSection(args.view, section, itemIndex);
957
+ }
958
+ else {
959
+ this.owner._prepareItem(args.view, itemIndex);
960
+ }
961
+ if (!args.view.parent) {
962
+ if (args.view instanceof LayoutBase && !(args.view instanceof ProxyViewContainer)) {
963
+ var mt = PercentLength.toDevicePixels(args.view.marginTop, 0, Number.NaN);
964
+ var mb = PercentLength.toDevicePixels(args.view.marginBottom, 0, Number.NaN);
965
+ var ml = PercentLength.toDevicePixels(args.view.marginLeft, 0, Number.NaN);
966
+ var mr = PercentLength.toDevicePixels(args.view.marginRight, 0, Number.NaN);
967
+ var hasMargins = mt > 0 || mb > 0 || ml > 0 || mr > 0;
968
+ if (hasMargins) {
969
+ var outer = new StackLayout();
970
+ outer.addChild(args.view);
971
+ this.owner._addView(outer);
972
+ convertView = outer.nativeViewProtected;
973
+ }
974
+ else {
975
+ this.owner._addView(args.view);
976
+ convertView = args.view.nativeViewProtected;
977
+ }
978
+ }
979
+ else {
980
+ var sp = new StackLayout();
981
+ sp.addChild(args.view);
982
+ this.owner._addView(sp);
983
+ convertView = sp.nativeViewProtected;
984
+ }
985
+ }
986
+ this.owner._registerViewToTemplate(template.key, convertView, args.view);
987
+ this.owner._markViewUsed(convertView);
971
988
  }
972
- else {
973
- this.owner._prepareItem(args.view, itemIndex);
974
- }
975
- if (!args.view.parent) {
976
- // Android ListView doesn't properly respect margins on direct child views.
977
- // Always wrap item views in a StackLayout container to ensure margins work correctly.
978
- var container = new StackLayout();
979
- container.addChild(args.view);
980
- this.owner._addView(container);
981
- convertView = container.nativeViewProtected;
982
- }
983
- this.owner._registerViewToTemplate(template.key, convertView, args.view);
984
- this.owner._markViewUsed(convertView);
985
- }
986
- return convertView;
987
- };
988
- var _a, _b, _c, _d, _e, _f;
989
- __decorate([
990
- profile,
991
- __metadata("design:type", Function),
992
- __metadata("design:paramtypes", [Number, typeof (_b = typeof android !== "undefined" && (_a = android.view) !== void 0 && _a.View) === "function" ? _b : Object, typeof (_d = typeof android !== "undefined" && (_c = android.view) !== void 0 && _c.ViewGroup) === "function" ? _d : Object]),
993
- __metadata("design:returntype", typeof (_f = typeof android !== "undefined" && (_e = android.view) !== void 0 && _e.View) === "function" ? _f : Object)
994
- ], ListViewAdapter.prototype, "getView", null);
995
- return ListViewAdapter;
996
- }(android.widget.BaseAdapter));
989
+ return convertView;
990
+ };
991
+ __decorate([
992
+ profile
993
+ ], ListViewAdapter.prototype, "getView", null);
994
+ return ListViewAdapter;
995
+ }(android.widget.BaseAdapter));
997
996
  ListViewAdapterClass = ListViewAdapter;
998
997
  }
999
998
  //# sourceMappingURL=index.android.js.map