@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,12 +1,12 @@
1
1
  import { getNativeScriptGlobals } from '../../../globals/global-utils';
2
- import { ViewCommon, isEnabledProperty, originXProperty, originYProperty, isUserInteractionEnabledProperty, testIDProperty, AndroidHelper } 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';
@@ -38,199 +38,224 @@ const GRAVITY_CENTER_HORIZONTAL = 1; // android.view.Gravity.CENTER_HORIZONTAL
38
38
  const GRAVITY_FILL_HORIZONTAL = 7; // android.view.Gravity.FILL_HORIZONTAL
39
39
  const GRAVITY_CENTER_VERTICAL = 16; // android.view.Gravity.CENTER_VERTICAL
40
40
  const GRAVITY_FILL_VERTICAL = 112; // android.view.Gravity.FILL_VERTICAL
41
+ const SYSTEM_UI_FLAG_LIGHT_STATUS_BAR = 0x00002000;
42
+ const STATUS_BAR_LIGHT_BCKG = -657931;
43
+ const STATUS_BAR_DARK_BCKG = 1711276032;
41
44
  const modalMap = new Map();
42
45
  let TouchListener;
43
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
+ }
44
79
  function initializeTouchListener() {
45
80
  if (TouchListener) {
46
81
  return;
47
82
  }
48
- var TouchListenerImpl = /** @class */ (function (_super) {
49
- __extends(TouchListenerImpl, _super);
50
- function TouchListenerImpl(owner) {
51
- var _this = _super.call(this) || this;
52
- _this.owner = new WeakRef(owner);
53
- return global.__native(_this);
54
- }
55
- TouchListenerImpl.prototype.onTouch = function (view, event) {
56
- var owner = this.owner.get();
57
- if (!owner) {
58
- return;
59
- }
60
- owner.handleGestureTouch(event);
61
- var nativeView = owner.nativeViewProtected;
62
- if (!nativeView || !nativeView.onTouchEvent) {
63
- return false;
64
- }
65
- return nativeView.onTouchEvent(event);
66
- };
67
- var _a;
68
- TouchListenerImpl = __decorate([
69
- Interfaces([android.view.View.OnTouchListener]),
70
- __metadata("design:paramtypes", [typeof (_a = typeof View !== "undefined" && View) === "function" ? _a : Object])
71
- ], TouchListenerImpl);
72
- return TouchListenerImpl;
73
- }(java.lang.Object));
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);
89
+ }
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
+ TouchListenerImpl = __decorate([
103
+ Interfaces([android.view.View.OnTouchListener])
104
+ ], TouchListenerImpl);
105
+ return TouchListenerImpl;
106
+ }(java.lang.Object));
74
107
  TouchListener = TouchListenerImpl;
75
108
  }
76
109
  function initializeDialogFragment() {
77
110
  if (DialogFragment) {
78
111
  return;
79
112
  }
80
- var DialogImpl = /** @class */ (function (_super) {
81
- __extends(DialogImpl, _super);
82
- function DialogImpl(fragment, context, themeResId) {
83
- var _this = _super.call(this, context, themeResId) || this;
84
- _this.fragment = fragment;
85
- return global.__native(_this);
86
- }
87
- DialogImpl.prototype.onDetachedFromWindow = function () {
88
- _super.prototype.onDetachedFromWindow.call(this);
89
- this.fragment = null;
90
- };
91
- DialogImpl.prototype.onBackPressed = function () {
92
- var view = this.fragment.owner;
93
- var args = {
94
- eventName: 'activityBackPressed',
95
- object: view,
96
- activity: view._context,
97
- cancel: false,
98
- };
99
- // Fist fire application.android global event
100
- getNativeScriptGlobals().events.notify(args);
101
- if (args.cancel) {
102
- return;
103
- }
104
- view.notify(args);
105
- if (!args.cancel && !view.onBackPressed()) {
106
- _super.prototype.onBackPressed.call(this);
107
- }
108
- };
109
- return DialogImpl;
110
- }(android.app.Dialog));
111
- var DialogFragmentImpl = /** @class */ (function (_super) {
112
- __extends(DialogFragmentImpl, _super);
113
- function DialogFragmentImpl() {
114
- var _this = _super.call(this) || this;
115
- return global.__native(_this);
116
- }
117
- DialogFragmentImpl.prototype.onCreate = function (savedInstanceState) {
118
- var _a;
119
- _super.prototype.onCreate.call(this, savedInstanceState);
120
- var ownerId = (_a = this.getArguments()) === null || _a === void 0 ? void 0 : _a.getInt(DOMID);
121
- var options = getModalOptions(ownerId);
122
- // The teardown when the activity is destroyed happens after the state is saved, but is not recoverable,
123
- // Cancel the native dialog in this case or the app will crash with subsequent errors.
124
- if (savedInstanceState != null && options === undefined) {
125
- this.dismissAllowingStateLoss();
126
- }
127
- };
128
- DialogFragmentImpl.prototype.onCreateDialog = function (savedInstanceState) {
129
- var ownerId = this.getArguments().getInt(DOMID);
130
- var options = getModalOptions(ownerId);
131
- this.owner = options.owner;
132
- // Set owner._dialogFragment to this in case the DialogFragment was recreated after app suspend
133
- this.owner._dialogFragment = this;
134
- this._fullscreen = options.fullscreen;
135
- this._animated = options.animated;
136
- this._cancelable = options.cancelable;
137
- this._stretched = options.stretched;
138
- this._dismissCallback = options.dismissCallback;
139
- this._shownCallback = options.shownCallback;
140
- this._windowSoftInputMode = options.windowSoftInputMode;
141
- this.setStyle(androidx.fragment.app.DialogFragment.STYLE_NO_TITLE, 0);
142
- var theme = this.getTheme();
143
- if (this._fullscreen) {
144
- // In fullscreen mode, get the application's theme.
145
- theme = this.getActivity().getApplicationInfo().theme;
146
- }
147
- var dialog = new DialogImpl(this, this.getActivity(), theme);
148
- // do not override alignment unless fullscreen modal will be shown;
149
- // otherwise we might break component-level layout:
150
- // https://github.com/NativeScript/NativeScript/issues/5392
151
- if (!this._fullscreen && !this._stretched) {
152
- this.owner.horizontalAlignment = 'center';
153
- this.owner.verticalAlignment = 'middle';
154
- }
155
- else {
156
- this.owner.horizontalAlignment = 'stretch';
157
- this.owner.verticalAlignment = 'stretch';
158
- }
159
- // set the modal window animation
160
- // https://github.com/NativeScript/NativeScript/issues/5989
161
- if (this._animated) {
162
- dialog.getWindow().setWindowAnimations(styleAnimationDialog);
163
- }
164
- dialog.setCanceledOnTouchOutside(this._cancelable);
165
- return dialog;
166
- };
167
- DialogFragmentImpl.prototype.onCreateView = function (inflater, container, savedInstanceState) {
168
- var owner = this.owner;
169
- this.activity = new WeakRef(this.getActivity());
170
- owner._setupAsRootView(this.getActivity());
171
- owner._isAddedToNativeVisualTree = true;
172
- // we need to set the window SoftInputMode here.
173
- // it wont work is set in onStart
174
- var window = this.getDialog().getWindow();
175
- if (this._windowSoftInputMode !== undefined) {
176
- window.setSoftInputMode(this._windowSoftInputMode);
113
+ var DialogImpl = (function (_super) {
114
+ __extends(DialogImpl, _super);
115
+ function DialogImpl(fragment, context, themeResId) {
116
+ var _this = _super.call(this, context, themeResId) || this;
117
+ _this.fragment = fragment;
118
+ if (SDK_VERSION >= 33 && OnBackPressedCallback) {
119
+ var callback = new OnBackPressedCallback(true);
120
+ callback["_dialog"] = new WeakRef(_this);
121
+ _this.getOnBackPressedDispatcher().addCallback(_this, callback);
122
+ }
123
+ return global.__native(_this);
177
124
  }
178
- else {
179
- // the dialog seems to not follow the default activity softInputMode,
180
- // thus set we set it here.
181
- window.setSoftInputMode(owner._context.getWindow().getAttributes().softInputMode);
182
- }
183
- return owner.nativeViewProtected;
184
- };
185
- DialogFragmentImpl.prototype.onStart = function () {
186
- _super.prototype.onStart.call(this);
187
- if (this._fullscreen) {
125
+ DialogImpl.prototype.onDetachedFromWindow = function () {
126
+ _super.prototype.onDetachedFromWindow.call(this);
127
+ this.fragment = null;
128
+ };
129
+ DialogImpl.prototype.onBackPressed = function () {
130
+ if (SDK_VERSION >= 33) {
131
+ _super.prototype.onBackPressed.call(this);
132
+ return;
133
+ }
134
+ var view = this.fragment.owner;
135
+ var args = {
136
+ eventName: "activityBackPressed",
137
+ object: view,
138
+ activity: view._context,
139
+ cancel: false,
140
+ };
141
+ getNativeScriptGlobals().events.notify(args);
142
+ if (args.cancel) {
143
+ return;
144
+ }
145
+ view.notify(args);
146
+ if (!args.cancel && !view.onBackPressed()) {
147
+ _super.prototype.onBackPressed.call(this);
148
+ }
149
+ };
150
+ return DialogImpl;
151
+ }(androidx.appcompat.app.AppCompatDialog));
152
+ var DialogFragmentImpl = (function (_super) {
153
+ __extends(DialogFragmentImpl, _super);
154
+ function DialogFragmentImpl() {
155
+ var _this = _super.call(this) || this;
156
+ return global.__native(_this);
157
+ }
158
+ DialogFragmentImpl.prototype.onCreate = function (savedInstanceState) {
159
+ var _a;
160
+ _super.prototype.onCreate.call(this, savedInstanceState);
161
+ var ownerId = (_a = this.getArguments()) === null || _a === void 0 ? void 0 : _a.getInt(DOMID);
162
+ var options = getModalOptions(ownerId);
163
+ if (savedInstanceState != null && options === undefined) {
164
+ this.dismissAllowingStateLoss();
165
+ }
166
+ };
167
+ DialogFragmentImpl.prototype.onCreateDialog = function (savedInstanceState) {
168
+ var ownerId = this.getArguments().getInt(DOMID);
169
+ var options = getModalOptions(ownerId);
170
+ this.owner = options.owner;
171
+ this.owner._dialogFragment = this;
172
+ this._fullscreen = options.fullscreen;
173
+ this._animated = options.animated;
174
+ this._cancelable = options.cancelable;
175
+ this._stretched = options.stretched;
176
+ this._dismissCallback = options.dismissCallback;
177
+ this._shownCallback = options.shownCallback;
178
+ this._windowSoftInputMode = options.windowSoftInputMode;
179
+ this.setStyle(androidx.fragment.app.DialogFragment.STYLE_NO_TITLE, 0);
180
+ var theme = this.getTheme();
181
+ if (this._fullscreen) {
182
+ theme = this.getActivity().getApplicationInfo().theme;
183
+ }
184
+ var dialog = new DialogImpl(this, this.getActivity(), theme);
185
+ if (!this._fullscreen && !this._stretched) {
186
+ this.owner.horizontalAlignment = "center";
187
+ this.owner.verticalAlignment = "middle";
188
+ }
189
+ else {
190
+ this.owner.horizontalAlignment = "stretch";
191
+ this.owner.verticalAlignment = "stretch";
192
+ }
193
+ if (this._animated) {
194
+ dialog.getWindow().setWindowAnimations(styleAnimationDialog);
195
+ }
196
+ dialog.setCanceledOnTouchOutside(this._cancelable);
197
+ return dialog;
198
+ };
199
+ DialogFragmentImpl.prototype.onCreateView = function (inflater, container, savedInstanceState) {
200
+ var owner = this.owner;
201
+ this.activity = new WeakRef(this.getActivity());
202
+ owner._setupAsRootView(this.getActivity());
203
+ owner._isAddedToNativeVisualTree = true;
188
204
  var window = this.getDialog().getWindow();
189
- var length = android.view.ViewGroup.LayoutParams.MATCH_PARENT;
190
- window.setLayout(length, length);
191
- // This removes the default backgroundDrawable so there are no margins.
192
- window.setBackgroundDrawable(new android.graphics.drawable.ColorDrawable(android.graphics.Color.WHITE));
193
- }
194
- var owner = this.owner;
195
- if (owner && !owner.isLoaded) {
196
- owner.callLoaded();
197
- }
198
- this._shownCallback();
199
- };
200
- DialogFragmentImpl.prototype.onDismiss = function (dialog) {
201
- var _a;
202
- _super.prototype.onDismiss.call(this, dialog);
203
- var manager = this.getFragmentManager();
204
- var activity = (_a = this.activity) === null || _a === void 0 ? void 0 : _a.get();
205
- if (manager && !(activity === null || activity === void 0 ? void 0 : activity.isChangingConfigurations())) {
206
- removeModal(this.owner._domId);
207
- this._dismissCallback();
208
- }
209
- var owner = this.owner;
210
- if (owner && owner.isLoaded) {
211
- owner.callUnloaded();
212
- }
213
- };
214
- DialogFragmentImpl.prototype.onDestroy = function () {
215
- var _a;
216
- _super.prototype.onDestroy.call(this);
217
- var owner = this.owner;
218
- var activity = (_a = this.activity) === null || _a === void 0 ? void 0 : _a.get();
219
- if (!(activity === null || activity === void 0 ? void 0 : activity.isChangingConfigurations())) {
220
- this.activity = null;
221
- }
222
- if (owner) {
223
- // Android calls onDestroy before onDismiss.
224
- // Make sure we unload first and then call _tearDownUI.
225
- if (owner.isLoaded) {
205
+ if (this._windowSoftInputMode !== undefined) {
206
+ window.setSoftInputMode(this._windowSoftInputMode);
207
+ }
208
+ else {
209
+ window.setSoftInputMode(owner._context.getWindow().getAttributes().softInputMode);
210
+ }
211
+ return owner.nativeViewProtected;
212
+ };
213
+ DialogFragmentImpl.prototype.onStart = function () {
214
+ _super.prototype.onStart.call(this);
215
+ if (this._fullscreen) {
216
+ var window = this.getDialog().getWindow();
217
+ var length = android.view.ViewGroup.LayoutParams.MATCH_PARENT;
218
+ window.setLayout(length, length);
219
+ window.setBackgroundDrawable(new android.graphics.drawable.ColorDrawable(android.graphics.Color.WHITE));
220
+ }
221
+ var owner = this.owner;
222
+ if (owner && !owner.isLoaded) {
223
+ owner.callLoaded();
224
+ }
225
+ this._shownCallback();
226
+ };
227
+ DialogFragmentImpl.prototype.onDismiss = function (dialog) {
228
+ var _a;
229
+ _super.prototype.onDismiss.call(this, dialog);
230
+ var manager = this.getFragmentManager();
231
+ var activity = (_a = this.activity) === null || _a === void 0 ? void 0 : _a.get();
232
+ if (manager && !(activity === null || activity === void 0 ? void 0 : activity.isChangingConfigurations())) {
233
+ removeModal(this.owner._domId);
234
+ this._dismissCallback();
235
+ }
236
+ var owner = this.owner;
237
+ if (owner && owner.isLoaded) {
226
238
  owner.callUnloaded();
227
239
  }
228
- owner._isAddedToNativeVisualTree = false;
229
- owner._tearDownUI(true);
230
- }
231
- };
232
- return DialogFragmentImpl;
233
- }(androidx.fragment.app.DialogFragment));
240
+ };
241
+ DialogFragmentImpl.prototype.onDestroy = function () {
242
+ var _a;
243
+ _super.prototype.onDestroy.call(this);
244
+ var owner = this.owner;
245
+ var activity = (_a = this.activity) === null || _a === void 0 ? void 0 : _a.get();
246
+ if (!(activity === null || activity === void 0 ? void 0 : activity.isChangingConfigurations())) {
247
+ this.activity = null;
248
+ }
249
+ if (owner) {
250
+ if (owner.isLoaded) {
251
+ owner.callUnloaded();
252
+ }
253
+ owner._isAddedToNativeVisualTree = false;
254
+ owner._tearDownUI(true);
255
+ }
256
+ };
257
+ return DialogFragmentImpl;
258
+ }(androidx.fragment.app.DialogFragment));
234
259
  DialogFragment = DialogFragmentImpl;
235
260
  }
236
261
  function saveModal(options) {
@@ -242,6 +267,98 @@ function removeModal(domId) {
242
267
  function getModalOptions(domId) {
243
268
  return modalMap.get(domId);
244
269
  }
270
+ const INSET_LEFT = 0;
271
+ const INSET_TOP = 4;
272
+ const INSET_RIGHT = 8;
273
+ const INSET_BOTTOM = 12;
274
+ const INSET_LEFT_CONSUMED = 16;
275
+ const INSET_TOP_CONSUMED = 20;
276
+ const INSET_RIGHT_CONSUMED = 24;
277
+ const INSET_BOTTOM_CONSUMED = 28;
278
+ const OverflowEdgeIgnore = -1;
279
+ const OverflowEdgeNone = 0;
280
+ const OverflowEdgeLeft = 1 << 1;
281
+ const OverflowEdgeTop = 1 << 2;
282
+ const OverflowEdgeRight = 1 << 3;
283
+ const OverflowEdgeBottom = 1 << 4;
284
+ const OverflowEdgeDontApply = 1 << 5;
285
+ const OverflowEdgeLeftDontConsume = 1 << 6;
286
+ const OverflowEdgeTopDontConsume = 1 << 7;
287
+ const OverflowEdgeRightDontConsume = 1 << 8;
288
+ const OverflowEdgeBottomDontConsume = 1 << 9;
289
+ const OverflowEdgeAllButLeft = 1 << 10;
290
+ const OverflowEdgeAllButTop = 1 << 11;
291
+ const OverflowEdgeAllButRight = 1 << 12;
292
+ const OverflowEdgeAllButBottom = 1 << 13;
293
+ class Inset {
294
+ constructor(data) {
295
+ this.data = ArrayBuffer.from(data);
296
+ this.view = new DataView(this.data);
297
+ }
298
+ get left() {
299
+ return this.view.getInt32(INSET_LEFT, true);
300
+ }
301
+ set left(value) {
302
+ this.view.setInt32(INSET_LEFT, value, true);
303
+ }
304
+ get top() {
305
+ return this.view.getInt32(INSET_TOP, true);
306
+ }
307
+ set top(value) {
308
+ this.view.setInt32(INSET_TOP, value, true);
309
+ }
310
+ get right() {
311
+ return this.view.getInt32(INSET_RIGHT, true);
312
+ }
313
+ set right(value) {
314
+ this.view.setInt32(INSET_RIGHT, value, true);
315
+ }
316
+ get bottom() {
317
+ return this.view.getInt32(INSET_BOTTOM, true);
318
+ }
319
+ set bottom(value) {
320
+ this.view.setInt32(INSET_BOTTOM, value, true);
321
+ }
322
+ get leftConsumed() {
323
+ return this.view.getInt32(INSET_LEFT_CONSUMED, true) > 0;
324
+ }
325
+ set leftConsumed(value) {
326
+ this.view.setInt32(INSET_LEFT_CONSUMED, value ? 1 : 0, true);
327
+ }
328
+ get topConsumed() {
329
+ return this.view.getInt32(INSET_TOP_CONSUMED, true) > 0;
330
+ }
331
+ set topConsumed(value) {
332
+ this.view.setInt32(INSET_TOP_CONSUMED, value ? 1 : 0, true);
333
+ }
334
+ get rightConsumed() {
335
+ return this.view.getInt32(INSET_RIGHT_CONSUMED, true) > 0;
336
+ }
337
+ set rightConsumed(value) {
338
+ this.view.setInt32(INSET_RIGHT_CONSUMED, value ? 1 : 0, true);
339
+ }
340
+ get bottomConsumed() {
341
+ return this.view.getInt32(INSET_BOTTOM_CONSUMED, true) > 0;
342
+ }
343
+ set bottomConsumed(value) {
344
+ this.view.setInt32(INSET_BOTTOM_CONSUMED, value ? 1 : 0, true);
345
+ }
346
+ toString() {
347
+ return `Inset: left=${this.left}, top=${this.top}, right=${this.right}, bottom=${this.bottom}, ` + `leftConsumed=${this.leftConsumed}, topConsumed=${this.topConsumed}, ` + `rightConsumed=${this.rightConsumed}, bottomConsumed=${this.bottomConsumed}`;
348
+ }
349
+ toJSON() {
350
+ return {
351
+ left: this.left,
352
+ top: this.top,
353
+ right: this.right,
354
+ bottom: this.bottom,
355
+ leftConsumed: this.leftConsumed,
356
+ topConsumed: this.topConsumed,
357
+ rightConsumed: this.rightConsumed,
358
+ bottomConsumed: this.bottomConsumed,
359
+ };
360
+ }
361
+ }
245
362
  export class View extends ViewCommon {
246
363
  // TODO: Implement unobserve that detach the touchListener.
247
364
  _observe(type, callback, thisArg) {
@@ -256,6 +373,11 @@ export class View extends ViewCommon {
256
373
  if (this.isLoaded && !this.layoutChangeListenerIsSet && isLayoutEvent) {
257
374
  this.setOnLayoutChangeListener();
258
375
  }
376
+ const isInsetEvent = typeof eventNames === 'string' ? eventNames.indexOf(ViewCommon.androidOverflowInsetEvent) !== -1 : false;
377
+ // only avaiable on LayoutBase
378
+ if (!this.insetListenerIsSet && isInsetEvent) {
379
+ this.setInsetListener();
380
+ }
259
381
  }
260
382
  removeEventListener(eventNames, callback, thisArg) {
261
383
  super.removeEventListener(eventNames, callback, thisArg);
@@ -265,6 +387,38 @@ export class View extends ViewCommon {
265
387
  this.nativeViewProtected.removeOnLayoutChangeListener(this.layoutChangeListener);
266
388
  this.layoutChangeListenerIsSet = false;
267
389
  }
390
+ const isInsetEvent = typeof eventNames === 'string' ? eventNames.indexOf(ViewCommon.androidOverflowInsetEvent) !== -1 : false;
391
+ if (this.insetListenerIsSet && isInsetEvent && this.nativeViewProtected && this.nativeViewProtected.setInsetListener) {
392
+ this.nativeViewProtected.setInsetListener(null);
393
+ this.insetListenerIsSet = false;
394
+ }
395
+ }
396
+ setInsetListener() {
397
+ if (this.nativeViewProtected) {
398
+ if (this.nativeViewProtected.setInsetListener) {
399
+ const ref = new WeakRef(this);
400
+ this.nativeViewProtected.setInsetListener(new org.nativescript.widgets.LayoutBase.WindowInsetListener({
401
+ onApplyWindowInsets(param0) {
402
+ const owner = ref.get();
403
+ if (!owner) {
404
+ return;
405
+ }
406
+ const inset = new Inset(param0);
407
+ const args = {
408
+ eventName: ViewCommon.androidOverflowInsetEvent,
409
+ object: this,
410
+ inset,
411
+ };
412
+ owner.notify(args);
413
+ },
414
+ }));
415
+ this.insetListenerIsSet = true;
416
+ }
417
+ this.needsInsetListener = false;
418
+ }
419
+ else {
420
+ this.needsInsetListener = true;
421
+ }
268
422
  }
269
423
  _getChildFragmentManager() {
270
424
  return null;
@@ -313,6 +467,31 @@ export class View extends ViewCommon {
313
467
  }
314
468
  return manager;
315
469
  }
470
+ [androidOverflowEdgeProperty.setNative](value) {
471
+ const nativeView = this.nativeViewProtected;
472
+ if (typeof value !== 'string' || nativeView === null || nativeView == undefined) {
473
+ return;
474
+ }
475
+ if (!('setOverflowEdge' in nativeView)) {
476
+ return;
477
+ }
478
+ switch (value) {
479
+ case 'none':
480
+ nativeView.setOverflowEdge(OverflowEdgeNone);
481
+ break;
482
+ case 'ignore':
483
+ nativeView.setOverflowEdge(OverflowEdgeIgnore);
484
+ break;
485
+ default:
486
+ {
487
+ const edge = parseEdges(value);
488
+ if (edge != null) {
489
+ nativeView.setOverflowEdge(edge);
490
+ }
491
+ }
492
+ break;
493
+ }
494
+ }
316
495
  onLoaded() {
317
496
  this._manager = null;
318
497
  this._rootManager = null;
@@ -334,11 +513,29 @@ export class View extends ViewCommon {
334
513
  return false;
335
514
  }
336
515
  handleGestureTouch(event) {
337
- for (const type in this._gestureObservers) {
338
- const list = this._gestureObservers[type];
339
- list.forEach((element) => {
340
- element.androidOnTouchEvent(event);
341
- });
516
+ // This keeps a copy of gesture observers from the map to ensure concurrency
517
+ const allObservers = Object.values(this._gestureObservers);
518
+ for (const observers of allObservers) {
519
+ const length = observers.length;
520
+ if (!length) {
521
+ continue;
522
+ }
523
+ if (length === 1) {
524
+ const entry = observers[0];
525
+ if (entry) {
526
+ entry.androidOnTouchEvent(event);
527
+ }
528
+ }
529
+ else {
530
+ // This keeps a copy of gesture observers list to ensure concurrency
531
+ const observersCp = observers.slice();
532
+ for (let i = 0; i < length; i++) {
533
+ const entry = observersCp[i];
534
+ if (entry) {
535
+ entry.androidOnTouchEvent(event);
536
+ }
537
+ }
538
+ }
342
539
  }
343
540
  if (this.parent instanceof View) {
344
541
  this.parent.handleGestureTouch(event);
@@ -352,6 +549,9 @@ export class View extends ViewCommon {
352
549
  if (this.needsOnLayoutChangeListener()) {
353
550
  this.setOnLayoutChangeListener();
354
551
  }
552
+ if (!this.insetListenerIsSet && this.needsInsetListener) {
553
+ this.setInsetListener();
554
+ }
355
555
  }
356
556
  needsOnLayoutChangeListener() {
357
557
  return this.hasListeners(ViewCommon.layoutChangedEvent);
@@ -677,8 +877,14 @@ export class View extends ViewCommon {
677
877
  const gravity = lp.gravity;
678
878
  const weight = lp.weight;
679
879
  // Set only if params gravity exists.
680
- if (gravity !== undefined) {
880
+ if (gravity != null) {
681
881
  switch (value) {
882
+ case 'start':
883
+ lp.gravity = (this.direction === CoreTypes.LayoutDirection.rtl ? GRAVITY_RIGHT : GRAVITY_LEFT) | (gravity & VERTICAL_GRAVITY_MASK);
884
+ if (weight < 0) {
885
+ lp.weight = -2;
886
+ }
887
+ break;
682
888
  case 'left':
683
889
  lp.gravity = GRAVITY_LEFT | (gravity & VERTICAL_GRAVITY_MASK);
684
890
  if (weight < 0) {
@@ -697,6 +903,12 @@ export class View extends ViewCommon {
697
903
  lp.weight = -2;
698
904
  }
699
905
  break;
906
+ case 'end':
907
+ lp.gravity = (this.direction === CoreTypes.LayoutDirection.rtl ? GRAVITY_LEFT : GRAVITY_RIGHT) | (gravity & VERTICAL_GRAVITY_MASK);
908
+ if (weight < 0) {
909
+ lp.weight = -2;
910
+ }
911
+ break;
700
912
  case 'stretch':
701
913
  lp.gravity = GRAVITY_FILL_HORIZONTAL | (gravity & VERTICAL_GRAVITY_MASK);
702
914
  if (weight < 0) {
@@ -746,8 +958,85 @@ export class View extends ViewCommon {
746
958
  nativeView.setLayoutParams(lp);
747
959
  }
748
960
  }
749
- [testIDProperty.setNative](value) {
750
- this.setAccessibilityIdentifier(this.nativeViewProtected, value);
961
+ [statusBarStyleProperty.getDefault]() {
962
+ return this.style.statusBarStyle;
963
+ }
964
+ [statusBarStyleProperty.setNative](value) {
965
+ this.updateStatusBarStyle(value);
966
+ }
967
+ updateStatusBarStyle(value) {
968
+ if (SDK_VERSION < 21)
969
+ return; // nothing we can do
970
+ const window = this.getClosestWindow();
971
+ // Ensure the window draws system bar backgrounds (required to color status bar)
972
+ window.clearFlags(android.view.WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
973
+ window.addFlags(android.view.WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
974
+ const decorView = window.getDecorView();
975
+ // API 30+ path (preferred)
976
+ const controller = window.getInsetsController?.();
977
+ if (controller && SDK_VERSION >= 30) {
978
+ const APPEARANCE_LIGHT_STATUS_BARS = android.view.WindowInsetsController?.APPEARANCE_LIGHT_STATUS_BARS;
979
+ if (typeof value === 'string') {
980
+ this.style.statusBarStyle = value;
981
+ if (value === 'light') {
982
+ // light icons/text
983
+ controller.setSystemBarsAppearance(0, APPEARANCE_LIGHT_STATUS_BARS);
984
+ }
985
+ else {
986
+ // dark icons/text
987
+ controller.setSystemBarsAppearance(APPEARANCE_LIGHT_STATUS_BARS, APPEARANCE_LIGHT_STATUS_BARS);
988
+ }
989
+ }
990
+ else {
991
+ if (value.color != null)
992
+ window.setStatusBarColor(value.color);
993
+ // No direct passthrough for systemUiVisibility on API 30+, use appearances instead
994
+ }
995
+ return;
996
+ }
997
+ // API 23–29 path (systemUiVisibility)
998
+ if (SDK_VERSION >= 23) {
999
+ if (typeof value === 'string') {
1000
+ this.style.statusBarStyle = value;
1001
+ let flags = decorView.getSystemUiVisibility();
1002
+ if (value === 'light') {
1003
+ // Add the LIGHT_STATUS_BAR bit without clobbering other flags
1004
+ flags |= android.view.View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
1005
+ decorView.setSystemUiVisibility(flags);
1006
+ }
1007
+ else {
1008
+ // Remove only the LIGHT_STATUS_BAR bit
1009
+ flags &= ~android.view.View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
1010
+ decorView.setSystemUiVisibility(flags);
1011
+ }
1012
+ }
1013
+ else {
1014
+ if (value.color != null)
1015
+ window.setStatusBarColor(value.color);
1016
+ if (value.systemUiVisibility != null) {
1017
+ // Preserve existing flags, don’t blindly overwrite to 0
1018
+ const merged = (decorView.getSystemUiVisibility() & ~android.view.View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR) | (value.systemUiVisibility & android.view.View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
1019
+ decorView.setSystemUiVisibility(merged);
1020
+ }
1021
+ }
1022
+ return;
1023
+ }
1024
+ // API 21–22: you can only change the background color; icon color is fixed (light)
1025
+ if (typeof value === 'object' && value.color != null) {
1026
+ window.setStatusBarColor(value.color);
1027
+ }
1028
+ }
1029
+ getClosestWindow() {
1030
+ // When it comes to modals, check parent as it may not be the modal root view itself
1031
+ const view = this.parent ?? this;
1032
+ const dialogFragment = view._dialogFragment;
1033
+ if (dialogFragment) {
1034
+ const dialog = dialogFragment.getDialog();
1035
+ if (dialog) {
1036
+ return dialog.getWindow();
1037
+ }
1038
+ }
1039
+ return this._context.getWindow();
751
1040
  }
752
1041
  setAccessibilityIdentifier(view, value) {
753
1042
  const id = Utils.android.resources.getId(':id/nativescript_accessibility_id');
@@ -760,6 +1049,23 @@ export class View extends ViewCommon {
760
1049
  if (this.accessibilityIdentifier !== value)
761
1050
  this.accessibilityIdentifier = value;
762
1051
  }
1052
+ [directionProperty.setNative](value) {
1053
+ const nativeView = this.nativeViewProtected;
1054
+ switch (value) {
1055
+ case CoreTypes.LayoutDirection.ltr:
1056
+ nativeView.setLayoutDirection(android.view.View.LAYOUT_DIRECTION_LTR);
1057
+ break;
1058
+ case CoreTypes.LayoutDirection.rtl:
1059
+ nativeView.setLayoutDirection(android.view.View.LAYOUT_DIRECTION_RTL);
1060
+ break;
1061
+ default:
1062
+ nativeView.setLayoutDirection(android.view.View.LAYOUT_DIRECTION_LOCALE);
1063
+ break;
1064
+ }
1065
+ }
1066
+ [testIDProperty.setNative](value) {
1067
+ this.setAccessibilityIdentifier(this.nativeViewProtected, value);
1068
+ }
763
1069
  [accessibilityEnabledProperty.setNative](value) {
764
1070
  this.nativeViewProtected.setFocusable(!!value);
765
1071
  updateA11yPropertiesCallback(this);
@@ -955,17 +1261,21 @@ export class View extends ViewCommon {
955
1261
  }
956
1262
  }
957
1263
  }
958
- _drawBoxShadow(boxShadow) {
1264
+ _drawBoxShadow(boxShadows) {
959
1265
  const nativeView = this.nativeViewProtected;
960
- const config = {
961
- shadowColor: boxShadow.color.android,
962
- cornerRadius: Length.toDevicePixels(this.borderRadius, 0.0),
963
- spreadRadius: boxShadow.spreadRadius,
964
- blurRadius: boxShadow.blurRadius,
965
- offsetX: boxShadow.offsetX,
966
- offsetY: boxShadow.offsetY,
967
- };
968
- org.nativescript.widgets.Utils.drawBoxShadow(nativeView, JSON.stringify(config));
1266
+ const valueCount = 6;
1267
+ const nativeArray = Array.create('int', boxShadows.length * valueCount);
1268
+ for (let i = 0, length = boxShadows.length; i < length; i++) {
1269
+ const boxShadow = boxShadows[i];
1270
+ const nativeIndex = i * valueCount;
1271
+ nativeArray[nativeIndex + 0] = boxShadow.color.android;
1272
+ nativeArray[nativeIndex + 1] = boxShadow.spreadRadius;
1273
+ nativeArray[nativeIndex + 2] = boxShadow.blurRadius;
1274
+ nativeArray[nativeIndex + 3] = boxShadow.offsetX;
1275
+ nativeArray[nativeIndex + 4] = boxShadow.offsetY;
1276
+ nativeArray[nativeIndex + 5] = boxShadow.inset ? 1 : 0;
1277
+ }
1278
+ org.nativescript.widgets.Utils.drawBoxShadow(nativeView, nativeArray);
969
1279
  }
970
1280
  _redrawNativeBackground(value) {
971
1281
  if (value instanceof Background) {
@@ -1008,13 +1318,13 @@ export class View extends ViewCommon {
1008
1318
  // prettier-ignore
1009
1319
  const onlyColor = !background.hasBorderWidth()
1010
1320
  && !background.hasBorderRadius()
1011
- && !background.hasBoxShadow()
1321
+ && !background.hasBoxShadows()
1012
1322
  && !background.clipPath
1013
1323
  && !background.image
1014
1324
  && !!background.color;
1015
1325
  this._applyBackground(background, isBorderDrawable, onlyColor, drawable);
1016
- if (background.hasBoxShadow()) {
1017
- this._drawBoxShadow(background.getBoxShadow());
1326
+ if (background.hasBoxShadows()) {
1327
+ this._drawBoxShadow(background.getBoxShadows());
1018
1328
  }
1019
1329
  // TODO: Can we move BorderWidths as separate native setter?
1020
1330
  // This way we could skip setPadding if borderWidth is not changed.
@@ -1062,7 +1372,41 @@ __decorate([
1062
1372
  __metadata("design:paramtypes", []),
1063
1373
  __metadata("design:returntype", void 0)
1064
1374
  ], View.prototype, "requestLayout", null);
1375
+ const edgeMap = {
1376
+ none: OverflowEdgeNone,
1377
+ left: OverflowEdgeLeft,
1378
+ top: OverflowEdgeTop,
1379
+ right: OverflowEdgeRight,
1380
+ bottom: OverflowEdgeBottom,
1381
+ 'dont-apply': OverflowEdgeDontApply,
1382
+ 'left-dont-consume': OverflowEdgeLeftDontConsume,
1383
+ 'top-dont-consume': OverflowEdgeTopDontConsume,
1384
+ 'right-dont-consume': OverflowEdgeRightDontConsume,
1385
+ 'bottom-dont-consume': OverflowEdgeBottomDontConsume,
1386
+ 'all-but-left': OverflowEdgeAllButLeft,
1387
+ 'all-but-top': OverflowEdgeAllButTop,
1388
+ 'all-but-right': OverflowEdgeAllButRight,
1389
+ 'all-but-bottom': OverflowEdgeAllButBottom,
1390
+ };
1391
+ function parseEdges(edges) {
1392
+ let result = 0;
1393
+ const values = edges.split(',');
1394
+ for (const raw of values) {
1395
+ const value = edgeMap[raw.trim()];
1396
+ if (value === undefined)
1397
+ continue;
1398
+ // dont-apply overrides everything else
1399
+ if (value === OverflowEdgeDontApply)
1400
+ return value;
1401
+ result |= value;
1402
+ }
1403
+ return result === 0 ? null : result;
1404
+ }
1065
1405
  export class ContainerView extends View {
1406
+ constructor() {
1407
+ super();
1408
+ this.androidOverflowEdge = 'none';
1409
+ }
1066
1410
  }
1067
1411
  export class CustomLayoutView extends ContainerView {
1068
1412
  createNativeView() {