@nativescript/core 9.0.0-alpha.24 → 9.0.0-alpha.26

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 (267) hide show
  1. package/application/application-common.d.ts +29 -10
  2. package/application/application-common.js +58 -5
  3. package/application/application-common.js.map +1 -1
  4. package/application/application-interfaces.d.ts +10 -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 +418 -342
  10. package/application/application.android.js.map +1 -1
  11. package/application/application.d.ts +8 -1
  12. package/application/application.ios.d.ts +16 -1
  13. package/application/application.ios.js +59 -21
  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/config/config.interface.d.ts +21 -0
  23. package/connectivity/index.android.js +25 -25
  24. package/connectivity/index.android.js.map +1 -1
  25. package/core-types/index.d.ts +77 -63
  26. package/core-types/index.js +10 -1
  27. package/core-types/index.js.map +1 -1
  28. package/core-types/validators.js +12 -6
  29. package/core-types/validators.js.map +1 -1
  30. package/data/observable/index.d.ts +2 -1
  31. package/data/observable/index.js +31 -19
  32. package/data/observable/index.js.map +1 -1
  33. package/fps-meter/fps-native.ios.js +1 -1
  34. package/fps-meter/fps-native.ios.js.map +1 -1
  35. package/http/http-request/index.ios.js +1 -1
  36. package/http/http-request/index.ios.js.map +1 -1
  37. package/image-source/index.d.ts +2 -2
  38. package/index.js +0 -1
  39. package/index.js.map +1 -1
  40. package/package.json +1 -1
  41. package/platform/screen/index.d.ts +5 -0
  42. package/platforms/android/widgets-release.aar +0 -0
  43. package/references.d.ts +1 -1
  44. package/timer/index.ios.js +1 -1
  45. package/timer/index.ios.js.map +1 -1
  46. package/ui/action-bar/index.android.js +18 -18
  47. package/ui/action-bar/index.android.js.map +1 -1
  48. package/ui/action-bar/index.ios.js +2 -4
  49. package/ui/action-bar/index.ios.js.map +1 -1
  50. package/ui/animation/index.ios.js +2 -3
  51. package/ui/animation/index.ios.js.map +1 -1
  52. package/ui/button/index.android.js +20 -20
  53. package/ui/button/index.android.js.map +1 -1
  54. package/ui/button/index.ios.d.ts +2 -1
  55. package/ui/button/index.ios.js +28 -10
  56. package/ui/button/index.ios.js.map +1 -1
  57. package/ui/core/control-state-change/index.ios.js +1 -1
  58. package/ui/core/control-state-change/index.ios.js.map +1 -1
  59. package/ui/core/view/index.android.d.ts +6 -6
  60. package/ui/core/view/index.android.js +337 -455
  61. package/ui/core/view/index.android.js.map +1 -1
  62. package/ui/core/view/index.d.ts +18 -5
  63. package/ui/core/view/index.ios.d.ts +10 -2
  64. package/ui/core/view/index.ios.js +99 -46
  65. package/ui/core/view/index.ios.js.map +1 -1
  66. package/ui/core/view/view-common.d.ts +46 -12
  67. package/ui/core/view/view-common.js +28 -0
  68. package/ui/core/view/view-common.js.map +1 -1
  69. package/ui/core/view/view-helper/index.d.ts +5 -0
  70. package/ui/core/view/view-helper/index.ios.d.ts +5 -4
  71. package/ui/core/view/view-helper/index.ios.js +20 -23
  72. package/ui/core/view/view-helper/index.ios.js.map +1 -1
  73. package/ui/core/view/view-helper/view-helper-common.js +7 -0
  74. package/ui/core/view/view-helper/view-helper-common.js.map +1 -1
  75. package/ui/core/view/view-interfaces.d.ts +3 -0
  76. package/ui/core/view-base/index.d.ts +4 -0
  77. package/ui/core/view-base/index.js +4 -0
  78. package/ui/core/view-base/index.js.map +1 -1
  79. package/ui/date-picker/index.android.js +38 -38
  80. package/ui/date-picker/index.android.js.map +1 -1
  81. package/ui/date-picker/index.ios.js +1 -1
  82. package/ui/date-picker/index.ios.js.map +1 -1
  83. package/ui/editable-text-base/index.android.js +34 -34
  84. package/ui/editable-text-base/index.android.js.map +1 -1
  85. package/ui/frame/fragment.transitions.android.d.ts +2 -1
  86. package/ui/frame/fragment.transitions.android.js +106 -104
  87. package/ui/frame/fragment.transitions.android.js.map +1 -1
  88. package/ui/frame/fragment.transitions.d.ts +3 -2
  89. package/ui/frame/index.android.js +57 -4
  90. package/ui/frame/index.android.js.map +1 -1
  91. package/ui/frame/index.ios.d.ts +2 -1
  92. package/ui/frame/index.ios.js +83 -43
  93. package/ui/frame/index.ios.js.map +1 -1
  94. package/ui/gestures/index.android.js +129 -130
  95. package/ui/gestures/index.android.js.map +1 -1
  96. package/ui/gestures/index.ios.js +3 -5
  97. package/ui/gestures/index.ios.js.map +1 -1
  98. package/ui/gestures/touch-manager.js +32 -32
  99. package/ui/gestures/touch-manager.js.map +1 -1
  100. package/ui/image/index.android.js +19 -19
  101. package/ui/image/index.android.js.map +1 -1
  102. package/ui/image-cache/index.android.js +12 -14
  103. package/ui/image-cache/index.android.js.map +1 -1
  104. package/ui/image-cache/index.ios.js +6 -6
  105. package/ui/image-cache/index.ios.js.map +1 -1
  106. package/ui/index.d.ts +2 -1
  107. package/ui/index.js +1 -0
  108. package/ui/index.js.map +1 -1
  109. package/ui/label/index.android.js +4 -1
  110. package/ui/label/index.android.js.map +1 -1
  111. package/ui/label/index.ios.d.ts +2 -1
  112. package/ui/label/index.ios.js +12 -2
  113. package/ui/label/index.ios.js.map +1 -1
  114. package/ui/layouts/flexbox-layout/index.ios.js +3 -6
  115. package/ui/layouts/flexbox-layout/index.ios.js.map +1 -1
  116. package/ui/layouts/index.d.ts +2 -0
  117. package/ui/layouts/index.js +2 -0
  118. package/ui/layouts/index.js.map +1 -1
  119. package/ui/layouts/liquid-glass/index.android.d.ts +5 -0
  120. package/ui/layouts/liquid-glass/index.android.js +8 -0
  121. package/ui/layouts/liquid-glass/index.android.js.map +1 -0
  122. package/ui/layouts/liquid-glass/index.d.ts +10 -0
  123. package/ui/layouts/liquid-glass/index.ios.d.ts +10 -0
  124. package/ui/layouts/liquid-glass/index.ios.js +59 -0
  125. package/ui/layouts/liquid-glass/index.ios.js.map +1 -0
  126. package/ui/layouts/liquid-glass/liquid-glass-common.d.ts +3 -0
  127. package/ui/layouts/liquid-glass/liquid-glass-common.js +4 -0
  128. package/ui/layouts/liquid-glass/liquid-glass-common.js.map +1 -0
  129. package/ui/layouts/liquid-glass-container/index.android.d.ts +3 -0
  130. package/ui/layouts/liquid-glass-container/index.android.js +4 -0
  131. package/ui/layouts/liquid-glass-container/index.android.js.map +1 -0
  132. package/ui/layouts/liquid-glass-container/index.d.ts +3 -0
  133. package/ui/layouts/liquid-glass-container/index.ios.d.ts +14 -0
  134. package/ui/layouts/liquid-glass-container/index.ios.js +121 -0
  135. package/ui/layouts/liquid-glass-container/index.ios.js.map +1 -0
  136. package/ui/layouts/liquid-glass-container/liquid-glass-container-common.d.ts +4 -0
  137. package/ui/layouts/liquid-glass-container/liquid-glass-container-common.js +5 -0
  138. package/ui/layouts/liquid-glass-container/liquid-glass-container-common.js.map +1 -0
  139. package/ui/layouts/stack-layout/index.ios.js +6 -0
  140. package/ui/layouts/stack-layout/index.ios.js.map +1 -1
  141. package/ui/list-picker/index.android.js +35 -35
  142. package/ui/list-picker/index.android.js.map +1 -1
  143. package/ui/list-picker/index.ios.js +2 -2
  144. package/ui/list-picker/index.ios.js.map +1 -1
  145. package/ui/list-view/index.android.d.ts +26 -1
  146. package/ui/list-view/index.android.js +765 -129
  147. package/ui/list-view/index.android.js.map +1 -1
  148. package/ui/list-view/index.d.ts +127 -0
  149. package/ui/list-view/index.ios.d.ts +34 -2
  150. package/ui/list-view/index.ios.js +557 -21
  151. package/ui/list-view/index.ios.js.map +1 -1
  152. package/ui/list-view/list-view-common.d.ts +22 -1
  153. package/ui/list-view/list-view-common.js +85 -0
  154. package/ui/list-view/list-view-common.js.map +1 -1
  155. package/ui/page/index.ios.js +25 -64
  156. package/ui/page/index.ios.js.map +1 -1
  157. package/ui/scroll-view/index.d.ts +1 -1
  158. package/ui/scroll-view/index.ios.d.ts +2 -0
  159. package/ui/scroll-view/index.ios.js +31 -12
  160. package/ui/scroll-view/index.ios.js.map +1 -1
  161. package/ui/scroll-view/scroll-view-common.d.ts +3 -8
  162. package/ui/scroll-view/scroll-view-common.js +4 -4
  163. package/ui/scroll-view/scroll-view-common.js.map +1 -1
  164. package/ui/search-bar/index.android.js +48 -52
  165. package/ui/search-bar/index.android.js.map +1 -1
  166. package/ui/search-bar/index.ios.js +3 -6
  167. package/ui/search-bar/index.ios.js.map +1 -1
  168. package/ui/segmented-bar/index.android.js +56 -58
  169. package/ui/segmented-bar/index.android.js.map +1 -1
  170. package/ui/segmented-bar/index.ios.js +1 -1
  171. package/ui/segmented-bar/index.ios.js.map +1 -1
  172. package/ui/slider/index.android.js +23 -25
  173. package/ui/slider/index.android.js.map +1 -1
  174. package/ui/slider/index.ios.js +2 -2
  175. package/ui/slider/index.ios.js.map +1 -1
  176. package/ui/split-view/index.android.d.ts +4 -0
  177. package/ui/split-view/index.android.js +4 -0
  178. package/ui/split-view/index.android.js.map +1 -0
  179. package/ui/split-view/index.d.ts +11 -0
  180. package/ui/split-view/index.ios.d.ts +39 -0
  181. package/ui/split-view/index.ios.js +368 -0
  182. package/ui/split-view/index.ios.js.map +1 -0
  183. package/ui/split-view/split-view-common.d.ts +51 -0
  184. package/ui/split-view/split-view-common.js +111 -0
  185. package/ui/split-view/split-view-common.js.map +1 -0
  186. package/ui/styling/background-common.d.ts +4 -4
  187. package/ui/styling/background-common.js +8 -8
  188. package/ui/styling/background-common.js.map +1 -1
  189. package/ui/styling/background.d.ts +0 -3
  190. package/ui/styling/background.ios.d.ts +2 -1
  191. package/ui/styling/background.ios.js +47 -38
  192. package/ui/styling/background.ios.js.map +1 -1
  193. package/ui/styling/css-utils.d.ts +1 -0
  194. package/ui/styling/css-utils.js +15 -4
  195. package/ui/styling/css-utils.js.map +1 -1
  196. package/ui/styling/style/index.d.ts +3 -1
  197. package/ui/styling/style/index.js.map +1 -1
  198. package/ui/styling/style-properties.d.ts +1 -0
  199. package/ui/styling/style-properties.js +30 -11
  200. package/ui/styling/style-properties.js.map +1 -1
  201. package/ui/switch/index.android.js +18 -18
  202. package/ui/switch/index.android.js.map +1 -1
  203. package/ui/switch/index.ios.d.ts +1 -0
  204. package/ui/switch/index.ios.js +62 -12
  205. package/ui/switch/index.ios.js.map +1 -1
  206. package/ui/tab-view/index.android.js +185 -187
  207. package/ui/tab-view/index.android.js.map +1 -1
  208. package/ui/tab-view/index.d.ts +17 -1
  209. package/ui/tab-view/index.ios.d.ts +13 -5
  210. package/ui/tab-view/index.ios.js +253 -49
  211. package/ui/tab-view/index.ios.js.map +1 -1
  212. package/ui/tab-view/tab-view-common.d.ts +14 -0
  213. package/ui/tab-view/tab-view-common.js +15 -0
  214. package/ui/tab-view/tab-view-common.js.map +1 -1
  215. package/ui/text-base/index.android.d.ts +2 -1
  216. package/ui/text-base/index.android.js +133 -101
  217. package/ui/text-base/index.android.js.map +1 -1
  218. package/ui/text-base/index.d.ts +5 -0
  219. package/ui/text-base/index.ios.js +12 -18
  220. package/ui/text-base/index.ios.js.map +1 -1
  221. package/ui/text-base/text-base-common.d.ts +2 -1
  222. package/ui/text-base/text-base-common.js +1 -0
  223. package/ui/text-base/text-base-common.js.map +1 -1
  224. package/ui/text-field/index.ios.d.ts +2 -1
  225. package/ui/text-field/index.ios.js +9 -5
  226. package/ui/text-field/index.ios.js.map +1 -1
  227. package/ui/text-view/index.ios.d.ts +2 -1
  228. package/ui/text-view/index.ios.js +12 -7
  229. package/ui/text-view/index.ios.js.map +1 -1
  230. package/ui/time-picker/index.android.js +21 -21
  231. package/ui/time-picker/index.android.js.map +1 -1
  232. package/ui/time-picker/index.ios.js +1 -1
  233. package/ui/time-picker/index.ios.js.map +1 -1
  234. package/ui/transition/fade-transition.ios.js +5 -6
  235. package/ui/transition/fade-transition.ios.js.map +1 -1
  236. package/ui/transition/modal-transition.ios.js +19 -26
  237. package/ui/transition/modal-transition.ios.js.map +1 -1
  238. package/ui/transition/page-transition.android.js +3 -12
  239. package/ui/transition/page-transition.android.js.map +1 -1
  240. package/ui/transition/page-transition.ios.js +19 -25
  241. package/ui/transition/page-transition.ios.js.map +1 -1
  242. package/ui/transition/slide-transition.ios.js +5 -6
  243. package/ui/transition/slide-transition.ios.js.map +1 -1
  244. package/ui/web-view/index.android.js +58 -62
  245. package/ui/web-view/index.android.js.map +1 -1
  246. package/ui/web-view/index.ios.js +18 -18
  247. package/ui/web-view/index.ios.js.map +1 -1
  248. package/utils/common.d.ts +3 -1
  249. package/utils/common.js +9 -3
  250. package/utils/common.js.map +1 -1
  251. package/utils/index.d.ts +6 -0
  252. package/utils/layout-helper/index.android.d.ts +1 -0
  253. package/utils/layout-helper/index.android.js +9 -0
  254. package/utils/layout-helper/index.android.js.map +1 -1
  255. package/utils/layout-helper/index.d.ts +5 -0
  256. package/utils/layout-helper/index.ios.d.ts +1 -0
  257. package/utils/layout-helper/index.ios.js +4 -0
  258. package/utils/layout-helper/index.ios.js.map +1 -1
  259. package/utils/native-helper-for-android.d.ts +14 -3
  260. package/utils/native-helper-for-android.js +57 -54
  261. package/utils/native-helper-for-android.js.map +1 -1
  262. package/utils/native-helper.android.d.ts +3 -3
  263. package/utils/native-helper.android.js +2 -2
  264. package/utils/native-helper.android.js.map +1 -1
  265. package/utils/native-helper.d.ts +22 -5
  266. package/utils/native-helper.ios.js +20 -20
  267. package/utils/native-helper.ios.js.map +1 -1
@@ -1,12 +1,12 @@
1
1
  import { getNativeScriptGlobals } from '../../../globals/global-utils';
2
- import { ViewCommon, isEnabledProperty, originXProperty, originYProperty, isUserInteractionEnabledProperty, testIDProperty, AndroidHelper, statusBarStyleProperty } from './view-common';
3
- import { paddingLeftProperty, paddingTopProperty, paddingRightProperty, paddingBottomProperty } from '../../styling/style-properties';
4
- import { Length } from '../../styling/length-shared';
2
+ import { ViewCommon, isEnabledProperty, originXProperty, originYProperty, isUserInteractionEnabledProperty, testIDProperty, AndroidHelper, androidOverflowEdgeProperty, statusBarStyleProperty } from './view-common';
3
+ import { paddingLeftProperty, paddingTopProperty, paddingRightProperty, paddingBottomProperty, directionProperty } from '../../styling/style-properties';
5
4
  import { layout } from '../../../utils';
6
5
  import { Trace } from '../../../trace';
7
6
  import { hiddenProperty } from '../view-base';
8
7
  import { isCssWideKeyword } from '../properties/property-shared';
9
8
  import { perspectiveProperty, visibilityProperty, opacityProperty, horizontalAlignmentProperty, verticalAlignmentProperty, minWidthProperty, minHeightProperty, widthProperty, heightProperty, marginLeftProperty, marginTopProperty, marginRightProperty, marginBottomProperty, rotateProperty, rotateXProperty, rotateYProperty, scaleXProperty, scaleYProperty, translateXProperty, translateYProperty, zIndexProperty, backgroundInternalProperty, androidElevationProperty, androidDynamicElevationOffsetProperty } from '../../styling/style-properties';
9
+ import { CoreTypes } from '../../../core-types';
10
10
  import { Background, refreshBorderDrawable } from '../../styling/background';
11
11
  import { profile } from '../../../profiling';
12
12
  import { topmost } from '../../frame/frame-stack';
@@ -44,196 +44,220 @@ const STATUS_BAR_DARK_BCKG = 1711276032;
44
44
  const modalMap = new Map();
45
45
  let TouchListener;
46
46
  let DialogFragment;
47
+ let OnBackPressedCallback;
48
+ if (SDK_VERSION >= 33) {
49
+ OnBackPressedCallback = androidx.activity.OnBackPressedCallback.extend({
50
+ handleOnBackPressed() {
51
+ console.log('OnBackPressedCallback handleOnBackPressed called');
52
+ const dialog = this['_dialog']?.get();
53
+ if (!dialog) {
54
+ // disable the callback and call super to avoid infinite loop
55
+ this.setEnabled(false);
56
+ return;
57
+ }
58
+ const view = dialog.fragment.owner;
59
+ const args = {
60
+ eventName: 'activityBackPressed',
61
+ object: view,
62
+ activity: view._context,
63
+ cancel: false,
64
+ };
65
+ // Fist fire application.android global event
66
+ getNativeScriptGlobals().events.notify(args);
67
+ if (args.cancel) {
68
+ return;
69
+ }
70
+ view.notify(args);
71
+ if (!args.cancel) {
72
+ this.setEnabled(false);
73
+ dialog.getOnBackPressedDispatcher().onBackPressed();
74
+ this.setEnabled(true);
75
+ }
76
+ },
77
+ });
78
+ }
47
79
  function initializeTouchListener() {
48
80
  if (TouchListener) {
49
81
  return;
50
82
  }
51
- var TouchListenerImpl = /** @class */ (function (_super) {
52
- __extends(TouchListenerImpl, _super);
53
- function TouchListenerImpl(owner) {
54
- var _this = _super.call(this) || this;
55
- _this.owner = new WeakRef(owner);
56
- return global.__native(_this);
57
- }
58
- TouchListenerImpl.prototype.onTouch = function (view, event) {
59
- var owner = this.owner.get();
60
- if (!owner) {
61
- return;
83
+ var TouchListenerImpl = (function (_super) {
84
+ __extends(TouchListenerImpl, _super);
85
+ function TouchListenerImpl(owner) {
86
+ var _this = _super.call(this) || this;
87
+ _this.owner = new WeakRef(owner);
88
+ return global.__native(_this);
62
89
  }
63
- owner.handleGestureTouch(event);
64
- var nativeView = owner.nativeViewProtected;
65
- if (!nativeView || !nativeView.onTouchEvent) {
66
- return false;
67
- }
68
- return nativeView.onTouchEvent(event);
69
- };
70
- var _a;
71
- TouchListenerImpl = __decorate([
72
- Interfaces([android.view.View.OnTouchListener]),
73
- __metadata("design:paramtypes", [typeof (_a = typeof View !== "undefined" && View) === "function" ? _a : Object])
74
- ], TouchListenerImpl);
75
- return TouchListenerImpl;
76
- }(java.lang.Object));
90
+ TouchListenerImpl.prototype.onTouch = function (view, event) {
91
+ var owner = this.owner.get();
92
+ if (!owner) {
93
+ return;
94
+ }
95
+ owner.handleGestureTouch(event);
96
+ var nativeView = owner.nativeViewProtected;
97
+ if (!nativeView || !nativeView.onTouchEvent) {
98
+ return false;
99
+ }
100
+ return nativeView.onTouchEvent(event);
101
+ };
102
+ var _a;
103
+ TouchListenerImpl = __decorate([
104
+ Interfaces([android.view.View.OnTouchListener]),
105
+ __metadata("design:paramtypes", [typeof (_a = typeof View !== "undefined" && View) === "function" ? _a : Object])
106
+ ], TouchListenerImpl);
107
+ return TouchListenerImpl;
108
+ }(java.lang.Object));
77
109
  TouchListener = TouchListenerImpl;
78
110
  }
79
111
  function initializeDialogFragment() {
80
112
  if (DialogFragment) {
81
113
  return;
82
114
  }
83
- var DialogImpl = /** @class */ (function (_super) {
84
- __extends(DialogImpl, _super);
85
- function DialogImpl(fragment, context, themeResId) {
86
- var _this = _super.call(this, context, themeResId) || this;
87
- _this.fragment = fragment;
88
- return global.__native(_this);
89
- }
90
- DialogImpl.prototype.onDetachedFromWindow = function () {
91
- _super.prototype.onDetachedFromWindow.call(this);
92
- this.fragment = null;
93
- };
94
- DialogImpl.prototype.onBackPressed = function () {
95
- var view = this.fragment.owner;
96
- var args = {
97
- eventName: 'activityBackPressed',
98
- object: view,
99
- activity: view._context,
100
- cancel: false,
101
- };
102
- // Fist fire application.android global event
103
- getNativeScriptGlobals().events.notify(args);
104
- if (args.cancel) {
105
- return;
106
- }
107
- view.notify(args);
108
- if (!args.cancel && !view.onBackPressed()) {
109
- _super.prototype.onBackPressed.call(this);
110
- }
111
- };
112
- return DialogImpl;
113
- }(android.app.Dialog));
114
- var DialogFragmentImpl = /** @class */ (function (_super) {
115
- __extends(DialogFragmentImpl, _super);
116
- function DialogFragmentImpl() {
117
- var _this = _super.call(this) || this;
118
- return global.__native(_this);
119
- }
120
- DialogFragmentImpl.prototype.onCreate = function (savedInstanceState) {
121
- var _a;
122
- _super.prototype.onCreate.call(this, savedInstanceState);
123
- var ownerId = (_a = this.getArguments()) === null || _a === void 0 ? void 0 : _a.getInt(DOMID);
124
- var options = getModalOptions(ownerId);
125
- // The teardown when the activity is destroyed happens after the state is saved, but is not recoverable,
126
- // Cancel the native dialog in this case or the app will crash with subsequent errors.
127
- if (savedInstanceState != null && options === undefined) {
128
- this.dismissAllowingStateLoss();
129
- }
130
- };
131
- DialogFragmentImpl.prototype.onCreateDialog = function (savedInstanceState) {
132
- var ownerId = this.getArguments().getInt(DOMID);
133
- var options = getModalOptions(ownerId);
134
- this.owner = options.owner;
135
- // Set owner._dialogFragment to this in case the DialogFragment was recreated after app suspend
136
- this.owner._dialogFragment = this;
137
- this._fullscreen = options.fullscreen;
138
- this._animated = options.animated;
139
- this._cancelable = options.cancelable;
140
- this._stretched = options.stretched;
141
- this._dismissCallback = options.dismissCallback;
142
- this._shownCallback = options.shownCallback;
143
- this._windowSoftInputMode = options.windowSoftInputMode;
144
- this.setStyle(androidx.fragment.app.DialogFragment.STYLE_NO_TITLE, 0);
145
- var theme = this.getTheme();
146
- if (this._fullscreen) {
147
- // In fullscreen mode, get the application's theme.
148
- theme = this.getActivity().getApplicationInfo().theme;
149
- }
150
- var dialog = new DialogImpl(this, this.getActivity(), theme);
151
- // do not override alignment unless fullscreen modal will be shown;
152
- // otherwise we might break component-level layout:
153
- // https://github.com/NativeScript/NativeScript/issues/5392
154
- if (!this._fullscreen && !this._stretched) {
155
- this.owner.horizontalAlignment = 'center';
156
- this.owner.verticalAlignment = 'middle';
157
- }
158
- else {
159
- this.owner.horizontalAlignment = 'stretch';
160
- this.owner.verticalAlignment = 'stretch';
161
- }
162
- // set the modal window animation
163
- // https://github.com/NativeScript/NativeScript/issues/5989
164
- if (this._animated) {
165
- dialog.getWindow().setWindowAnimations(styleAnimationDialog);
166
- }
167
- dialog.setCanceledOnTouchOutside(this._cancelable);
168
- return dialog;
169
- };
170
- DialogFragmentImpl.prototype.onCreateView = function (inflater, container, savedInstanceState) {
171
- var owner = this.owner;
172
- this.activity = new WeakRef(this.getActivity());
173
- owner._setupAsRootView(this.getActivity());
174
- owner._isAddedToNativeVisualTree = true;
175
- // we need to set the window SoftInputMode here.
176
- // it wont work is set in onStart
177
- var window = this.getDialog().getWindow();
178
- if (this._windowSoftInputMode !== undefined) {
179
- window.setSoftInputMode(this._windowSoftInputMode);
115
+ var DialogImpl = (function (_super) {
116
+ __extends(DialogImpl, _super);
117
+ function DialogImpl(fragment, context, themeResId) {
118
+ var _this = _super.call(this, context, themeResId) || this;
119
+ _this.fragment = fragment;
120
+ if (SDK_VERSION >= 33 && OnBackPressedCallback) {
121
+ var callback = new OnBackPressedCallback(true);
122
+ callback["_dialog"] = new WeakRef(_this);
123
+ _this.getOnBackPressedDispatcher().addCallback(_this, callback);
124
+ }
125
+ return global.__native(_this);
180
126
  }
181
- else {
182
- // the dialog seems to not follow the default activity softInputMode,
183
- // thus set we set it here.
184
- window.setSoftInputMode(owner._context.getWindow().getAttributes().softInputMode);
185
- }
186
- return owner.nativeViewProtected;
187
- };
188
- DialogFragmentImpl.prototype.onStart = function () {
189
- _super.prototype.onStart.call(this);
190
- if (this._fullscreen) {
127
+ DialogImpl.prototype.onDetachedFromWindow = function () {
128
+ _super.prototype.onDetachedFromWindow.call(this);
129
+ this.fragment = null;
130
+ };
131
+ DialogImpl.prototype.onBackPressed = function () {
132
+ if (SDK_VERSION >= 33) {
133
+ _super.prototype.onBackPressed.call(this);
134
+ return;
135
+ }
136
+ var view = this.fragment.owner;
137
+ var args = {
138
+ eventName: "activityBackPressed",
139
+ object: view,
140
+ activity: view._context,
141
+ cancel: false,
142
+ };
143
+ getNativeScriptGlobals().events.notify(args);
144
+ if (args.cancel) {
145
+ return;
146
+ }
147
+ view.notify(args);
148
+ if (!args.cancel && !view.onBackPressed()) {
149
+ _super.prototype.onBackPressed.call(this);
150
+ }
151
+ };
152
+ return DialogImpl;
153
+ }(androidx.appcompat.app.AppCompatDialog));
154
+ var DialogFragmentImpl = (function (_super) {
155
+ __extends(DialogFragmentImpl, _super);
156
+ function DialogFragmentImpl() {
157
+ var _this = _super.call(this) || this;
158
+ return global.__native(_this);
159
+ }
160
+ DialogFragmentImpl.prototype.onCreate = function (savedInstanceState) {
161
+ var _a;
162
+ _super.prototype.onCreate.call(this, savedInstanceState);
163
+ var ownerId = (_a = this.getArguments()) === null || _a === void 0 ? void 0 : _a.getInt(DOMID);
164
+ var options = getModalOptions(ownerId);
165
+ if (savedInstanceState != null && options === undefined) {
166
+ this.dismissAllowingStateLoss();
167
+ }
168
+ };
169
+ DialogFragmentImpl.prototype.onCreateDialog = function (savedInstanceState) {
170
+ var ownerId = this.getArguments().getInt(DOMID);
171
+ var options = getModalOptions(ownerId);
172
+ this.owner = options.owner;
173
+ this.owner._dialogFragment = this;
174
+ this._fullscreen = options.fullscreen;
175
+ this._animated = options.animated;
176
+ this._cancelable = options.cancelable;
177
+ this._stretched = options.stretched;
178
+ this._dismissCallback = options.dismissCallback;
179
+ this._shownCallback = options.shownCallback;
180
+ this._windowSoftInputMode = options.windowSoftInputMode;
181
+ this.setStyle(androidx.fragment.app.DialogFragment.STYLE_NO_TITLE, 0);
182
+ var theme = this.getTheme();
183
+ if (this._fullscreen) {
184
+ theme = this.getActivity().getApplicationInfo().theme;
185
+ }
186
+ var dialog = new DialogImpl(this, this.getActivity(), theme);
187
+ if (!this._fullscreen && !this._stretched) {
188
+ this.owner.horizontalAlignment = "center";
189
+ this.owner.verticalAlignment = "middle";
190
+ }
191
+ else {
192
+ this.owner.horizontalAlignment = "stretch";
193
+ this.owner.verticalAlignment = "stretch";
194
+ }
195
+ if (this._animated) {
196
+ dialog.getWindow().setWindowAnimations(styleAnimationDialog);
197
+ }
198
+ dialog.setCanceledOnTouchOutside(this._cancelable);
199
+ return dialog;
200
+ };
201
+ DialogFragmentImpl.prototype.onCreateView = function (inflater, container, savedInstanceState) {
202
+ var owner = this.owner;
203
+ this.activity = new WeakRef(this.getActivity());
204
+ owner._setupAsRootView(this.getActivity());
205
+ owner._isAddedToNativeVisualTree = true;
191
206
  var window = this.getDialog().getWindow();
192
- var length = android.view.ViewGroup.LayoutParams.MATCH_PARENT;
193
- window.setLayout(length, length);
194
- // This removes the default backgroundDrawable so there are no margins.
195
- window.setBackgroundDrawable(new android.graphics.drawable.ColorDrawable(android.graphics.Color.WHITE));
196
- }
197
- var owner = this.owner;
198
- if (owner && !owner.isLoaded) {
199
- owner.callLoaded();
200
- }
201
- this._shownCallback();
202
- };
203
- DialogFragmentImpl.prototype.onDismiss = function (dialog) {
204
- var _a;
205
- _super.prototype.onDismiss.call(this, dialog);
206
- var manager = this.getFragmentManager();
207
- var activity = (_a = this.activity) === null || _a === void 0 ? void 0 : _a.get();
208
- if (manager && !(activity === null || activity === void 0 ? void 0 : activity.isChangingConfigurations())) {
209
- removeModal(this.owner._domId);
210
- this._dismissCallback();
211
- }
212
- var owner = this.owner;
213
- if (owner && owner.isLoaded) {
214
- owner.callUnloaded();
215
- }
216
- };
217
- DialogFragmentImpl.prototype.onDestroy = function () {
218
- var _a;
219
- _super.prototype.onDestroy.call(this);
220
- var owner = this.owner;
221
- var activity = (_a = this.activity) === null || _a === void 0 ? void 0 : _a.get();
222
- if (!(activity === null || activity === void 0 ? void 0 : activity.isChangingConfigurations())) {
223
- this.activity = null;
224
- }
225
- if (owner) {
226
- // Android calls onDestroy before onDismiss.
227
- // Make sure we unload first and then call _tearDownUI.
228
- if (owner.isLoaded) {
207
+ if (this._windowSoftInputMode !== undefined) {
208
+ window.setSoftInputMode(this._windowSoftInputMode);
209
+ }
210
+ else {
211
+ window.setSoftInputMode(owner._context.getWindow().getAttributes().softInputMode);
212
+ }
213
+ return owner.nativeViewProtected;
214
+ };
215
+ DialogFragmentImpl.prototype.onStart = function () {
216
+ _super.prototype.onStart.call(this);
217
+ if (this._fullscreen) {
218
+ var window = this.getDialog().getWindow();
219
+ var length = android.view.ViewGroup.LayoutParams.MATCH_PARENT;
220
+ window.setLayout(length, length);
221
+ window.setBackgroundDrawable(new android.graphics.drawable.ColorDrawable(android.graphics.Color.WHITE));
222
+ }
223
+ var owner = this.owner;
224
+ if (owner && !owner.isLoaded) {
225
+ owner.callLoaded();
226
+ }
227
+ this._shownCallback();
228
+ };
229
+ DialogFragmentImpl.prototype.onDismiss = function (dialog) {
230
+ var _a;
231
+ _super.prototype.onDismiss.call(this, dialog);
232
+ var manager = this.getFragmentManager();
233
+ var activity = (_a = this.activity) === null || _a === void 0 ? void 0 : _a.get();
234
+ if (manager && !(activity === null || activity === void 0 ? void 0 : activity.isChangingConfigurations())) {
235
+ removeModal(this.owner._domId);
236
+ this._dismissCallback();
237
+ }
238
+ var owner = this.owner;
239
+ if (owner && owner.isLoaded) {
229
240
  owner.callUnloaded();
230
241
  }
231
- owner._isAddedToNativeVisualTree = false;
232
- owner._tearDownUI(true);
233
- }
234
- };
235
- return DialogFragmentImpl;
236
- }(androidx.fragment.app.DialogFragment));
242
+ };
243
+ DialogFragmentImpl.prototype.onDestroy = function () {
244
+ var _a;
245
+ _super.prototype.onDestroy.call(this);
246
+ var owner = this.owner;
247
+ var activity = (_a = this.activity) === null || _a === void 0 ? void 0 : _a.get();
248
+ if (!(activity === null || activity === void 0 ? void 0 : activity.isChangingConfigurations())) {
249
+ this.activity = null;
250
+ }
251
+ if (owner) {
252
+ if (owner.isLoaded) {
253
+ owner.callUnloaded();
254
+ }
255
+ owner._isAddedToNativeVisualTree = false;
256
+ owner._tearDownUI(true);
257
+ }
258
+ };
259
+ return DialogFragmentImpl;
260
+ }(androidx.fragment.app.DialogFragment));
237
261
  DialogFragment = DialogFragmentImpl;
238
262
  }
239
263
  function saveModal(options) {
@@ -253,20 +277,21 @@ const INSET_LEFT_CONSUMED = 16;
253
277
  const INSET_TOP_CONSUMED = 20;
254
278
  const INSET_RIGHT_CONSUMED = 24;
255
279
  const INSET_BOTTOM_CONSUMED = 28;
280
+ const OverflowEdgeIgnore = -1;
256
281
  const OverflowEdgeNone = 0;
257
- const OverflowEdgeLeft = 1;
258
- const OverflowEdgeTop = 1 << 1;
259
- const OverflowEdgeRight = 1 << 2;
260
- const OverflowEdgeBottom = 1 << 3;
261
- const OverflowEdgeDontApply = 1 << 4;
262
- const OverflowEdgeLeftDontConsume = 1 << 5;
263
- const OverflowEdgeTopDontConsume = 1 << 6;
264
- const OverflowEdgeRightDontConsume = 1 << 7;
265
- const OverflowEdgeBottomDontConsume = 1 << 8;
266
- const OverflowEdgeAllButLeft = 1 << 9;
267
- const OverflowEdgeAllButTop = 1 << 10;
268
- const OverflowEdgeAllButRight = 1 << 11;
269
- const OverflowEdgeAllButBottom = 1 << 12;
282
+ const OverflowEdgeLeft = 1 << 1;
283
+ const OverflowEdgeTop = 1 << 2;
284
+ const OverflowEdgeRight = 1 << 3;
285
+ const OverflowEdgeBottom = 1 << 4;
286
+ const OverflowEdgeDontApply = 1 << 5;
287
+ const OverflowEdgeLeftDontConsume = 1 << 6;
288
+ const OverflowEdgeTopDontConsume = 1 << 7;
289
+ const OverflowEdgeRightDontConsume = 1 << 8;
290
+ const OverflowEdgeBottomDontConsume = 1 << 9;
291
+ const OverflowEdgeAllButLeft = 1 << 10;
292
+ const OverflowEdgeAllButTop = 1 << 11;
293
+ const OverflowEdgeAllButRight = 1 << 12;
294
+ const OverflowEdgeAllButBottom = 1 << 13;
270
295
  class Inset {
271
296
  constructor(data) {
272
297
  this.data = ArrayBuffer.from(data);
@@ -337,11 +362,6 @@ class Inset {
337
362
  }
338
363
  }
339
364
  export class View extends ViewCommon {
340
- constructor() {
341
- super(...arguments);
342
- this._defaultOverflowEdge = OverflowEdgeNone;
343
- this._defaultOverflowEdgeValue = 'none';
344
- }
345
365
  // TODO: Implement unobserve that detach the touchListener.
346
366
  _observe(type, callback, thisArg) {
347
367
  super._observe(type, callback, thisArg);
@@ -449,128 +469,30 @@ export class View extends ViewCommon {
449
469
  }
450
470
  return manager;
451
471
  }
452
- // @ts-ignore
453
- set androidOverflowEdge(value) {
454
- if (typeof value !== 'string') {
455
- return;
456
- }
472
+ [androidOverflowEdgeProperty.setNative](value) {
457
473
  const nativeView = this.nativeViewProtected;
458
- if (nativeView && nativeView.setOverflowEdge) {
459
- if (value === 'none') {
460
- nativeView.setOverflowEdge(OverflowEdgeNone);
461
- }
462
- else {
463
- const newValue = parseEdges(value);
464
- if (newValue !== null) {
465
- nativeView.setOverflowEdge(newValue);
466
- }
467
- }
474
+ if (typeof value !== 'string' || nativeView === null || nativeView == undefined) {
475
+ return;
468
476
  }
469
- else {
470
- const edge = parseEdges(value);
471
- if (edge === null) {
472
- return;
473
- }
474
- this._defaultOverflowEdgeValue = value;
475
- this._defaultOverflowEdge = edge;
477
+ if (!('setOverflowEdge' in nativeView)) {
478
+ return;
476
479
  }
477
- }
478
- get androidOverflowEdge() {
479
- const nativeView = this.nativeViewProtected;
480
- if (nativeView && nativeView.getOverflowEdge) {
481
- const overflowEdge = nativeView.getOverflowEdge();
482
- switch (overflowEdge) {
483
- case OverflowEdgeNone:
484
- return 'none';
485
- case OverflowEdgeLeft:
486
- return 'left';
487
- case OverflowEdgeTop:
488
- return 'top';
489
- case OverflowEdgeRight:
490
- return 'right';
491
- case OverflowEdgeBottom:
492
- return 'bottom';
493
- case OverflowEdgeDontApply:
494
- return 'dont-apply';
495
- case OverflowEdgeLeftDontConsume:
496
- return 'left-dont-consume';
497
- case OverflowEdgeTopDontConsume:
498
- return 'top-dont-consume';
499
- case OverflowEdgeRightDontConsume:
500
- return 'right-dont-consume';
501
- case OverflowEdgeBottomDontConsume:
502
- return 'bottom-dont-consume';
503
- case OverflowEdgeAllButLeft:
504
- return 'all-but-left';
505
- case OverflowEdgeAllButTop:
506
- return 'all-but-top';
507
- case OverflowEdgeAllButRight:
508
- return 'all-but-right';
509
- case OverflowEdgeAllButBottom:
510
- return 'all-but-bottom';
511
- default:
512
- {
513
- let value = '';
514
- const overflowLeftConsume = (overflowEdge & OverflowEdgeLeft) == OverflowEdgeLeft;
515
- const overflowTopConsume = (overflowEdge & OverflowEdgeTop) == OverflowEdgeTop;
516
- const overflowRightConsume = (overflowEdge & OverflowEdgeRight) == OverflowEdgeRight;
517
- const overflowBottomConsume = (overflowEdge & OverflowEdgeBottom) == OverflowEdgeBottom;
518
- const overflowLeft = (overflowEdge & OverflowEdgeLeftDontConsume) == OverflowEdgeLeftDontConsume;
519
- const overflowTop = (overflowEdge & OverflowEdgeTopDontConsume) == OverflowEdgeTopDontConsume;
520
- const overflowRight = (overflowEdge & OverflowEdgeRightDontConsume) == OverflowEdgeRightDontConsume;
521
- const overflowBottom = (overflowEdge & OverflowEdgeBottomDontConsume) == OverflowEdgeBottomDontConsume;
522
- if (overflowLeftConsume) {
523
- value += 'left';
524
- }
525
- if (overflowTopConsume) {
526
- if (value.length > 0) {
527
- value += ',';
528
- }
529
- value += 'top';
530
- }
531
- if (overflowRightConsume) {
532
- if (value.length > 0) {
533
- value += ',';
534
- }
535
- value += 'right';
536
- }
537
- if (overflowBottomConsume) {
538
- if (value.length > 0) {
539
- value += ',';
540
- }
541
- value += 'bottom';
542
- }
543
- if (overflowLeft) {
544
- value += 'left-dont-consume';
545
- }
546
- if (overflowTop) {
547
- if (value.length > 0) {
548
- value += ',';
549
- }
550
- value += 'top-dont-consume';
551
- }
552
- if (overflowRight) {
553
- if (value.length > 0) {
554
- value += ',';
555
- }
556
- value += 'right-dont-consume';
557
- }
558
- if (overflowBottom) {
559
- if (value.length > 0) {
560
- value += ',';
561
- }
562
- value += 'bottom-dont-consume';
563
- }
480
+ switch (value) {
481
+ case 'none':
482
+ nativeView.setOverflowEdge(OverflowEdgeNone);
483
+ break;
484
+ case 'ignore':
485
+ nativeView.setOverflowEdge(OverflowEdgeIgnore);
486
+ break;
487
+ default:
488
+ {
489
+ const edge = parseEdges(value);
490
+ if (edge != null) {
491
+ nativeView.setOverflowEdge(edge);
564
492
  }
565
- break;
566
- }
567
- }
568
- else {
569
- if (this._defaultOverflowEdgeValue) {
570
- return this._defaultOverflowEdgeValue;
571
- }
493
+ }
494
+ break;
572
495
  }
573
- return 'none';
574
496
  }
575
497
  onLoaded() {
576
498
  this._manager = null;
@@ -593,11 +515,29 @@ export class View extends ViewCommon {
593
515
  return false;
594
516
  }
595
517
  handleGestureTouch(event) {
596
- for (const type in this._gestureObservers) {
597
- const list = this._gestureObservers[type];
598
- list.forEach((element) => {
599
- element.androidOnTouchEvent(event);
600
- });
518
+ // This keeps a copy of gesture observers from the map to ensure concurrency
519
+ const allObservers = Object.values(this._gestureObservers);
520
+ for (const observers of allObservers) {
521
+ const length = observers.length;
522
+ if (!length) {
523
+ continue;
524
+ }
525
+ if (length === 1) {
526
+ const entry = observers[0];
527
+ if (entry) {
528
+ entry.androidOnTouchEvent(event);
529
+ }
530
+ }
531
+ else {
532
+ // This keeps a copy of gesture observers list to ensure concurrency
533
+ const observersCp = observers.slice();
534
+ for (let i = 0; i < length; i++) {
535
+ const entry = observersCp[i];
536
+ if (entry) {
537
+ entry.androidOnTouchEvent(event);
538
+ }
539
+ }
540
+ }
601
541
  }
602
542
  if (this.parent instanceof View) {
603
543
  this.parent.handleGestureTouch(event);
@@ -614,12 +554,6 @@ export class View extends ViewCommon {
614
554
  if (!this.insetListenerIsSet && this.needsInsetListener) {
615
555
  this.setInsetListener();
616
556
  }
617
- const nativeView = this.nativeViewProtected;
618
- if (typeof this._defaultOverflowEdge === 'number') {
619
- if (nativeView && nativeView.setOverflowEdge) {
620
- nativeView.setOverflowEdge(this._defaultOverflowEdge);
621
- }
622
- }
623
557
  }
624
558
  needsOnLayoutChangeListener() {
625
559
  return this.hasListeners(ViewCommon.layoutChangedEvent);
@@ -945,8 +879,14 @@ export class View extends ViewCommon {
945
879
  const gravity = lp.gravity;
946
880
  const weight = lp.weight;
947
881
  // Set only if params gravity exists.
948
- if (gravity !== undefined) {
882
+ if (gravity != null) {
949
883
  switch (value) {
884
+ case 'start':
885
+ lp.gravity = (this.direction === CoreTypes.LayoutDirection.rtl ? GRAVITY_RIGHT : GRAVITY_LEFT) | (gravity & VERTICAL_GRAVITY_MASK);
886
+ if (weight < 0) {
887
+ lp.weight = -2;
888
+ }
889
+ break;
950
890
  case 'left':
951
891
  lp.gravity = GRAVITY_LEFT | (gravity & VERTICAL_GRAVITY_MASK);
952
892
  if (weight < 0) {
@@ -965,6 +905,12 @@ export class View extends ViewCommon {
965
905
  lp.weight = -2;
966
906
  }
967
907
  break;
908
+ case 'end':
909
+ lp.gravity = (this.direction === CoreTypes.LayoutDirection.rtl ? GRAVITY_LEFT : GRAVITY_RIGHT) | (gravity & VERTICAL_GRAVITY_MASK);
910
+ if (weight < 0) {
911
+ lp.weight = -2;
912
+ }
913
+ break;
968
914
  case 'stretch':
969
915
  lp.gravity = GRAVITY_FILL_HORIZONTAL | (gravity & VERTICAL_GRAVITY_MASK);
970
916
  if (weight < 0) {
@@ -1094,9 +1040,6 @@ export class View extends ViewCommon {
1094
1040
  }
1095
1041
  return this._context.getWindow();
1096
1042
  }
1097
- [testIDProperty.setNative](value) {
1098
- this.setAccessibilityIdentifier(this.nativeViewProtected, value);
1099
- }
1100
1043
  setAccessibilityIdentifier(view, value) {
1101
1044
  const id = Utils.android.resources.getId(':id/nativescript_accessibility_id');
1102
1045
  if (id) {
@@ -1108,6 +1051,23 @@ export class View extends ViewCommon {
1108
1051
  if (this.accessibilityIdentifier !== value)
1109
1052
  this.accessibilityIdentifier = value;
1110
1053
  }
1054
+ [directionProperty.setNative](value) {
1055
+ const nativeView = this.nativeViewProtected;
1056
+ switch (value) {
1057
+ case CoreTypes.LayoutDirection.ltr:
1058
+ nativeView.setLayoutDirection(android.view.View.LAYOUT_DIRECTION_LTR);
1059
+ break;
1060
+ case CoreTypes.LayoutDirection.rtl:
1061
+ nativeView.setLayoutDirection(android.view.View.LAYOUT_DIRECTION_RTL);
1062
+ break;
1063
+ default:
1064
+ nativeView.setLayoutDirection(android.view.View.LAYOUT_DIRECTION_LOCALE);
1065
+ break;
1066
+ }
1067
+ }
1068
+ [testIDProperty.setNative](value) {
1069
+ this.setAccessibilityIdentifier(this.nativeViewProtected, value);
1070
+ }
1111
1071
  [accessibilityEnabledProperty.setNative](value) {
1112
1072
  this.nativeViewProtected.setFocusable(!!value);
1113
1073
  updateA11yPropertiesCallback(this);
@@ -1303,17 +1263,21 @@ export class View extends ViewCommon {
1303
1263
  }
1304
1264
  }
1305
1265
  }
1306
- _drawBoxShadow(boxShadow) {
1266
+ _drawBoxShadow(boxShadows) {
1307
1267
  const nativeView = this.nativeViewProtected;
1308
- const config = {
1309
- shadowColor: boxShadow.color.android,
1310
- cornerRadius: Length.toDevicePixels(this.borderRadius, 0.0),
1311
- spreadRadius: boxShadow.spreadRadius,
1312
- blurRadius: boxShadow.blurRadius,
1313
- offsetX: boxShadow.offsetX,
1314
- offsetY: boxShadow.offsetY,
1315
- };
1316
- org.nativescript.widgets.Utils.drawBoxShadow(nativeView, JSON.stringify(config));
1268
+ const valueCount = 6;
1269
+ const nativeArray = Array.create('int', boxShadows.length * valueCount);
1270
+ for (let i = 0, length = boxShadows.length; i < length; i++) {
1271
+ const boxShadow = boxShadows[i];
1272
+ const nativeIndex = i * valueCount;
1273
+ nativeArray[nativeIndex + 0] = boxShadow.color.android;
1274
+ nativeArray[nativeIndex + 1] = boxShadow.spreadRadius;
1275
+ nativeArray[nativeIndex + 2] = boxShadow.blurRadius;
1276
+ nativeArray[nativeIndex + 3] = boxShadow.offsetX;
1277
+ nativeArray[nativeIndex + 4] = boxShadow.offsetY;
1278
+ nativeArray[nativeIndex + 5] = boxShadow.inset ? 1 : 0;
1279
+ }
1280
+ org.nativescript.widgets.Utils.drawBoxShadow(nativeView, nativeArray);
1317
1281
  }
1318
1282
  _redrawNativeBackground(value) {
1319
1283
  if (value instanceof Background) {
@@ -1356,13 +1320,13 @@ export class View extends ViewCommon {
1356
1320
  // prettier-ignore
1357
1321
  const onlyColor = !background.hasBorderWidth()
1358
1322
  && !background.hasBorderRadius()
1359
- && !background.hasBoxShadow()
1323
+ && !background.hasBoxShadows()
1360
1324
  && !background.clipPath
1361
1325
  && !background.image
1362
1326
  && !!background.color;
1363
1327
  this._applyBackground(background, isBorderDrawable, onlyColor, drawable);
1364
- if (background.hasBoxShadow()) {
1365
- this._drawBoxShadow(background.getBoxShadow());
1328
+ if (background.hasBoxShadows()) {
1329
+ this._drawBoxShadow(background.getBoxShadows());
1366
1330
  }
1367
1331
  // TODO: Can we move BorderWidths as separate native setter?
1368
1332
  // This way we could skip setPadding if borderWidth is not changed.
@@ -1410,123 +1374,41 @@ __decorate([
1410
1374
  __metadata("design:paramtypes", []),
1411
1375
  __metadata("design:returntype", void 0)
1412
1376
  ], View.prototype, "requestLayout", null);
1377
+ const edgeMap = {
1378
+ none: OverflowEdgeNone,
1379
+ left: OverflowEdgeLeft,
1380
+ top: OverflowEdgeTop,
1381
+ right: OverflowEdgeRight,
1382
+ bottom: OverflowEdgeBottom,
1383
+ 'dont-apply': OverflowEdgeDontApply,
1384
+ 'left-dont-consume': OverflowEdgeLeftDontConsume,
1385
+ 'top-dont-consume': OverflowEdgeTopDontConsume,
1386
+ 'right-dont-consume': OverflowEdgeRightDontConsume,
1387
+ 'bottom-dont-consume': OverflowEdgeBottomDontConsume,
1388
+ 'all-but-left': OverflowEdgeAllButLeft,
1389
+ 'all-but-top': OverflowEdgeAllButTop,
1390
+ 'all-but-right': OverflowEdgeAllButRight,
1391
+ 'all-but-bottom': OverflowEdgeAllButBottom,
1392
+ };
1413
1393
  function parseEdges(edges) {
1414
- const values = edges.trim().split(',');
1415
- let newValue = -1;
1416
- for (let value of values) {
1417
- const trimmedValue = value.trim();
1418
- switch (trimmedValue) {
1419
- case 'none':
1420
- if (newValue === -1) {
1421
- newValue = OverflowEdgeNone;
1422
- }
1423
- else {
1424
- newValue |= OverflowEdgeNone;
1425
- }
1426
- break;
1427
- case 'left':
1428
- if (newValue === -1) {
1429
- newValue = OverflowEdgeLeft;
1430
- }
1431
- else {
1432
- newValue |= OverflowEdgeLeft;
1433
- }
1434
- break;
1435
- case 'top':
1436
- if (newValue === -1) {
1437
- newValue = OverflowEdgeTop;
1438
- }
1439
- else {
1440
- newValue |= OverflowEdgeTop;
1441
- }
1442
- break;
1443
- case 'right':
1444
- if (newValue === -1) {
1445
- newValue = OverflowEdgeRight;
1446
- }
1447
- else {
1448
- newValue |= OverflowEdgeRight;
1449
- }
1450
- break;
1451
- case 'bottom':
1452
- if (newValue === -1) {
1453
- newValue = OverflowEdgeBottom;
1454
- }
1455
- else {
1456
- newValue |= OverflowEdgeBottom;
1457
- }
1458
- break;
1459
- case 'dont-apply':
1460
- newValue = OverflowEdgeDontApply;
1461
- break;
1462
- case 'left-dont-consume':
1463
- if (newValue === -1) {
1464
- newValue = OverflowEdgeLeftDontConsume;
1465
- }
1466
- else {
1467
- newValue |= OverflowEdgeLeftDontConsume;
1468
- }
1469
- break;
1470
- case 'top-dont-consume':
1471
- if (newValue === -1) {
1472
- newValue = OverflowEdgeTopDontConsume;
1473
- }
1474
- else {
1475
- newValue |= OverflowEdgeTopDontConsume;
1476
- }
1477
- break;
1478
- case 'right-dont-consume':
1479
- if (newValue === -1) {
1480
- newValue = OverflowEdgeRightDontConsume;
1481
- }
1482
- else {
1483
- newValue |= OverflowEdgeRightDontConsume;
1484
- }
1485
- break;
1486
- case 'bottom-dont-consume':
1487
- if (newValue === -1) {
1488
- newValue = OverflowEdgeBottomDontConsume;
1489
- }
1490
- else {
1491
- newValue |= OverflowEdgeBottomDontConsume;
1492
- }
1493
- case 'all-but-left':
1494
- if (newValue === -1) {
1495
- newValue = OverflowEdgeAllButLeft;
1496
- }
1497
- else {
1498
- newValue |= OverflowEdgeAllButLeft;
1499
- }
1500
- case 'all-but-top':
1501
- if (newValue === -1) {
1502
- newValue = OverflowEdgeAllButTop;
1503
- }
1504
- else {
1505
- newValue |= OverflowEdgeAllButTop;
1506
- }
1507
- case 'all-but-right':
1508
- if (newValue === -1) {
1509
- newValue = OverflowEdgeAllButRight;
1510
- }
1511
- else {
1512
- newValue |= OverflowEdgeAllButRight;
1513
- }
1514
- case 'all-but-bottom':
1515
- if (newValue === -1) {
1516
- newValue = OverflowEdgeAllButBottom;
1517
- }
1518
- else {
1519
- newValue |= OverflowEdgeAllButBottom;
1520
- }
1521
- break;
1522
- }
1523
- }
1524
- if (newValue === -1) {
1525
- return null;
1526
- }
1527
- return newValue;
1394
+ let result = 0;
1395
+ const values = edges.split(',');
1396
+ for (const raw of values) {
1397
+ const value = edgeMap[raw.trim()];
1398
+ if (value === undefined)
1399
+ continue;
1400
+ // dont-apply overrides everything else
1401
+ if (value === OverflowEdgeDontApply)
1402
+ return value;
1403
+ result |= value;
1404
+ }
1405
+ return result === 0 ? null : result;
1528
1406
  }
1529
1407
  export class ContainerView extends View {
1408
+ constructor() {
1409
+ super();
1410
+ this.androidOverflowEdge = 'none';
1411
+ }
1530
1412
  }
1531
1413
  export class CustomLayoutView extends ContainerView {
1532
1414
  createNativeView() {