From 8b7d5ab5fc34fa7785b7801ca5de60e69bbf7392 Mon Sep 17 00:00:00 2001
From: Samuel Schultze
Date: Thu, 22 Dec 2022 01:27:25 -0300
Subject: [PATCH 01/76] fix(ios): reset additional insets if they're zero
(#10134)
---
packages/core/ui/core/view/view-helper/index.ios.ts | 2 ++
packages/core/ui/page/index.ios.ts | 2 ++
2 files changed, 4 insertions(+)
diff --git a/packages/core/ui/core/view/view-helper/index.ios.ts b/packages/core/ui/core/view/view-helper/index.ios.ts
index 0596c2fbfe..5b8022d39c 100644
--- a/packages/core/ui/core/view/view-helper/index.ios.ts
+++ b/packages/core/ui/core/view/view-helper/index.ios.ts
@@ -80,6 +80,8 @@ class UILayoutViewController extends UIViewController {
right: 0,
});
this.additionalSafeAreaInsets = additionalInsets;
+ } else {
+ this.additionalSafeAreaInsets = null;
}
}
}
diff --git a/packages/core/ui/page/index.ios.ts b/packages/core/ui/page/index.ios.ts
index 6b5b54d458..5694d66a06 100644
--- a/packages/core/ui/page/index.ios.ts
+++ b/packages/core/ui/page/index.ios.ts
@@ -325,6 +325,8 @@ class UIViewControllerImpl extends UIViewController {
right: 0,
});
this.additionalSafeAreaInsets = additionalInsets;
+ } else {
+ this.additionalSafeAreaInsets = null;
}
}
}
From 6948f7c03265ebf9b92a7d5f69bfbb4743ce449b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Juan=20de=20Dios=20Mart=C3=ADnez=20Vallejo?=
Date: Wed, 28 Dec 2022 04:41:34 +0100
Subject: [PATCH 02/76] fix(ios): box shadow border radius (#10142)
---
packages/core/ui/styling/background.ios.ts | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/packages/core/ui/styling/background.ios.ts b/packages/core/ui/styling/background.ios.ts
index e3eb08627f..6e8f8f3207 100644
--- a/packages/core/ui/styling/background.ios.ts
+++ b/packages/core/ui/styling/background.ios.ts
@@ -736,7 +736,12 @@ function drawBoxShadow(nativeView: NativeScriptUIView, view: View, boxShadow: CS
);
// this should match the view's border radius
- const cornerRadius = Length.toDevicePixels(view.style.borderRadius, 0.0);
+ let cornerRadius: number;
+ if (typeof view.style.borderRadius !== 'number') {
+ cornerRadius = Length.toDevicePixels(view.style.borderRadius, 0.0);
+ } else {
+ cornerRadius = view.style.borderRadius;
+ }
// apply spreadRadius by expanding shadow layer bounds
// prettier-ignore
From a4f28b831785c8cf6ba76c170fcd7a5628b12c35 Mon Sep 17 00:00:00 2001
From: farfromrefuge
Date: Wed, 28 Dec 2022 17:23:10 +0000
Subject: [PATCH 03/76] fix(ios): navigatingTo event handling (#10120)
---
.../src/navigation/navigation-tests.ts | 135 ++++++++++--------
apps/automated/src/test-runner.ts | 4 +-
packages/core/ui/frame/index.ios.ts | 11 +-
packages/core/ui/page/index.ios.ts | 7 +
4 files changed, 95 insertions(+), 62 deletions(-)
diff --git a/apps/automated/src/navigation/navigation-tests.ts b/apps/automated/src/navigation/navigation-tests.ts
index 62d943b54d..5f6eec22e7 100644
--- a/apps/automated/src/navigation/navigation-tests.ts
+++ b/apps/automated/src/navigation/navigation-tests.ts
@@ -32,6 +32,18 @@ function attachEventListeners(page: Page, events: Array) {
});
}
+function attachFrameEventListeners(frame: Frame, events: Array) {
+ let argsToString = (args: frame.NavigationData) => {
+ return `${(args.entry).resolvedPage.id} ${args.eventName} ${args.isBack ? 'back' : 'forward'}`;
+ };
+ frame.on(Page.navigatingToEvent, (args: NavigatedData) => {
+ events.push(argsToString(args));
+ });
+ frame.on(Page.navigatedToEvent, (args: NavigatedData) => {
+ events.push(argsToString(args));
+ });
+}
+
function _test_backstackVisible(transition?: NavigationTransition) {
let topmost = Frame.topmost();
let mainTestPage = topmost.currentPage;
@@ -186,86 +198,86 @@ export function test_backToEntry_WithTransition() {
_test_backToEntry({ name: 'fade', duration: 10 });
}
-function _test_ClearHistory(transition?: NavigationTransition) {
- let topmost = Frame.topmost();
+// function _test_ClearHistory(transition?: NavigationTransition) {
+// let topmost = Frame.topmost();
- helper.navigateWithEntry({ create: pageFactory, clearHistory: true, transition: transition, animated: !!transition });
- TKUnit.assertEqual(topmost.backStack.length, 0, '1.topmost.backStack.length');
- TKUnit.assertEqual(topmost.canGoBack(), false, '1.topmost.canGoBack().');
+// helper.navigateWithEntry({ create: pageFactory, clearHistory: true, transition: transition, animated: !!transition });
+// TKUnit.assertEqual(topmost.backStack.length, 0, '1.topmost.backStack.length');
+// TKUnit.assertEqual(topmost.canGoBack(), false, '1.topmost.canGoBack().');
- helper.navigateWithEntry({ create: pageFactory, transition: transition, animated: !!transition });
- TKUnit.assertEqual(topmost.backStack.length, 1, '2.topmost.backStack.length');
- TKUnit.assertEqual(topmost.canGoBack(), true, '2.topmost.canGoBack().');
+// helper.navigateWithEntry({ create: pageFactory, transition: transition, animated: !!transition });
+// TKUnit.assertEqual(topmost.backStack.length, 1, '2.topmost.backStack.length');
+// TKUnit.assertEqual(topmost.canGoBack(), true, '2.topmost.canGoBack().');
- helper.navigateWithEntry({ create: pageFactory, transition: transition, animated: !!transition });
- TKUnit.assertEqual(topmost.backStack.length, 2, '3.topmost.backStack.length');
- TKUnit.assertEqual(topmost.canGoBack(), true, '3.topmost.canGoBack().');
+// helper.navigateWithEntry({ create: pageFactory, transition: transition, animated: !!transition });
+// TKUnit.assertEqual(topmost.backStack.length, 2, '3.topmost.backStack.length');
+// TKUnit.assertEqual(topmost.canGoBack(), true, '3.topmost.canGoBack().');
- helper.navigateWithEntry({ create: pageFactory, clearHistory: true, transition: transition, animated: !!transition });
- TKUnit.assertEqual(topmost.backStack.length, 0, '4.topmost.backStack.length');
- TKUnit.assertEqual(topmost.canGoBack(), false, '4.topmost.canGoBack().');
-}
+// helper.navigateWithEntry({ create: pageFactory, clearHistory: true, transition: transition, animated: !!transition });
+// TKUnit.assertEqual(topmost.backStack.length, 0, '4.topmost.backStack.length');
+// TKUnit.assertEqual(topmost.canGoBack(), false, '4.topmost.canGoBack().');
+// }
-export function test_ClearHistory() {
- _test_ClearHistory();
-}
+// export function test_ClearHistory() {
+// _test_ClearHistory();
+// }
-export function test_ClearHistory_WithTransition() {
- _test_ClearHistory({ name: 'fade', duration: 10 });
-}
+// export function test_ClearHistory_WithTransition() {
+// _test_ClearHistory({ name: 'fade', duration: 10 });
+// }
// Test case for https://github.com/NativeScript/NativeScript/issues/1948
-export function test_ClearHistoryWithTransitionDoesNotBreakNavigation() {
- let topmost = Frame.topmost();
- let mainTestPage = new Page();
- let mainPageFactory = function (): Page {
- return mainTestPage;
- };
+// export function test_ClearHistoryWithTransitionDoesNotBreakNavigation() {
+// let topmost = Frame.topmost();
+// let mainTestPage = new Page();
+// let mainPageFactory = function (): Page {
+// return mainTestPage;
+// };
- // Go to details-page
- helper.navigateWithEntry({ create: pageFactory, clearHistory: false, animated: true });
+// // Go to details-page
+// helper.navigateWithEntry({ create: pageFactory, clearHistory: false, animated: true });
- // Go back to main-page with clearHistory
- topmost.transition = { name: 'fade', duration: 10 };
- helper.navigateWithEntry({ create: mainPageFactory, clearHistory: true, animated: true });
+// // Go back to main-page with clearHistory
+// topmost.transition = { name: 'fade', duration: 10 };
+// helper.navigateWithEntry({ create: mainPageFactory, clearHistory: true, animated: true });
- // Go to details-page AGAIN
- helper.navigateWithEntry({ create: pageFactory, clearHistory: false, animated: true });
+// // Go to details-page AGAIN
+// helper.navigateWithEntry({ create: pageFactory, clearHistory: false, animated: true });
- // Go back to main-page with clearHistory
- topmost.transition = { name: 'fade', duration: 10 };
- helper.navigateWithEntry({ create: mainPageFactory, clearHistory: true, animated: true });
+// // Go back to main-page with clearHistory
+// topmost.transition = { name: 'fade', duration: 10 };
+// helper.navigateWithEntry({ create: mainPageFactory, clearHistory: true, animated: true });
- // Clean up
- topmost.transition = undefined;
+// // Clean up
+// topmost.transition = undefined;
- TKUnit.assertEqual(topmost.currentPage, mainTestPage, 'We should be on the main test page at the end of the test.');
- TKUnit.assertEqual(topmost.backStack.length, 0, 'Back stack should be empty at the end of the test.');
-}
+// TKUnit.assertEqual(topmost.currentPage, mainTestPage, 'We should be on the main test page at the end of the test.');
+// TKUnit.assertEqual(topmost.backStack.length, 0, 'Back stack should be empty at the end of the test.');
+// }
-export function test_ClearHistoryWithTransitionDoesNotBreakNavigation_WithLocalTransition() {
- const topmost = Frame.topmost();
+// export function test_ClearHistoryWithTransitionDoesNotBreakNavigation_WithLocalTransition() {
+// const topmost = Frame.topmost();
- let mainTestPage = topmost.currentPage;
- let mainPageFactory = function (): Page {
- return mainTestPage;
- };
+// let mainTestPage = topmost.currentPage;
+// let mainPageFactory = function (): Page {
+// return mainTestPage;
+// };
- // Go to 1st page
- helper.navigateWithEntry({ create: pageFactory, clearHistory: false, transition: { name: 'fade', duration: 10 }, animated: true });
+// // Go to 1st page
+// helper.navigateWithEntry({ create: pageFactory, clearHistory: false, transition: { name: 'fade', duration: 10 }, animated: true });
- // Go to 2nd page
- helper.navigateWithEntry({ create: pageFactory, clearHistory: false, transition: { name: 'fade', duration: 10 }, animated: true });
+// // Go to 2nd page
+// helper.navigateWithEntry({ create: pageFactory, clearHistory: false, transition: { name: 'fade', duration: 10 }, animated: true });
- // Go to 3rd page with clearHistory
- helper.navigateWithEntry({ create: pageFactory, clearHistory: true, transition: { name: 'fade', duration: 10 }, animated: true });
+// // Go to 3rd page with clearHistory
+// helper.navigateWithEntry({ create: pageFactory, clearHistory: true, transition: { name: 'fade', duration: 10 }, animated: true });
- // Go back to main
- helper.navigateWithEntry({ create: mainPageFactory, clearHistory: true, transition: { name: 'fade', duration: 10 }, animated: true });
+// // Go back to main
+// helper.navigateWithEntry({ create: mainPageFactory, clearHistory: true, transition: { name: 'fade', duration: 10 }, animated: true });
- TKUnit.assertEqual(topmost.currentPage, mainTestPage, 'We should be on the main test page at the end of the test.');
- TKUnit.assertEqual(topmost.backStack.length, 0, 'Back stack should be empty at the end of the test.');
-}
+// TKUnit.assertEqual(topmost.currentPage, mainTestPage, 'We should be on the main test page at the end of the test.');
+// TKUnit.assertEqual(topmost.backStack.length, 0, 'Back stack should be empty at the end of the test.');
+// }
function _test_NavigationEvents(transition?: NavigationTransition) {
const topmost = Frame.topmost();
@@ -274,7 +286,9 @@ function _test_NavigationEvents(transition?: NavigationTransition) {
mainTestPage.id = 'main-page';
let actualMainPageEvents = new Array();
+ let actualMainFrameEvents = new Array();
attachEventListeners(mainTestPage, actualMainPageEvents);
+ attachFrameEventListeners(topmost, actualMainFrameEvents);
let actualSecondPageEvents = new Array();
let secondPageFactory = function (): Page {
@@ -298,6 +312,9 @@ function _test_NavigationEvents(transition?: NavigationTransition) {
let expectedMainPageEvents = ['main-page navigatingFrom forward', 'main-page navigatedFrom forward', 'main-page navigatingTo back', 'main-page navigatedTo back'];
TKUnit.arrayAssert(actualMainPageEvents, expectedMainPageEvents, 'Actual main-page events are different from expected.');
+ let expectedMainFrameEvents = ['second-page navigatingTo forward', 'second-page navigatedTo forward', 'main-page navigatingTo back', 'main-page navigatedTo back'];
+ TKUnit.arrayAssert(actualMainFrameEvents, expectedMainFrameEvents, 'Actual main-page events are different from expected.');
+
let expectedSecondPageEvents = ['second-page navigatingTo forward', 'second-page navigatedTo forward', 'second-page navigatingFrom back', 'second-page navigatedFrom back'];
TKUnit.arrayAssert(actualSecondPageEvents, expectedSecondPageEvents, 'Actual second-page events are different from expected.');
diff --git a/apps/automated/src/test-runner.ts b/apps/automated/src/test-runner.ts
index 613d8d415e..2e3d54e8ac 100644
--- a/apps/automated/src/test-runner.ts
+++ b/apps/automated/src/test-runner.ts
@@ -264,8 +264,8 @@ allTests['TRANSITIONS'] = transitionTests;
import * as searchBarTests from './ui/search-bar/search-bar-tests';
allTests['SEARCH-BAR'] = searchBarTests;
-// import * as navigationTests from './navigation/navigation-tests';
-// allTests['NAVIGATION'] = navigationTests;
+import * as navigationTests from './navigation/navigation-tests';
+allTests['NAVIGATION'] = navigationTests;
// import * as livesyncTests from './livesync/livesync-tests';
// allTests['LIVESYNC'] = livesyncTests;
diff --git a/packages/core/ui/frame/index.ios.ts b/packages/core/ui/frame/index.ios.ts
index 3ecc42e92a..547ed22c49 100644
--- a/packages/core/ui/frame/index.ios.ts
+++ b/packages/core/ui/frame/index.ios.ts
@@ -307,7 +307,16 @@ export class Frame extends FrameBase {
}
public _onNavigatingTo(backstackEntry: BackstackEntry, isBack: boolean) {
- super._onNavigatingTo(backstackEntry, isBack);
+ // for now to not break iOS events chain (calling navigation events from controller delegates)
+ // we dont call super(which would also trigger events) but only notify the frame of the navigation
+ // though it means events are not triggered at the same time (lifecycle) on iOS / Android
+ this.notify({
+ eventName: Page.navigatingToEvent,
+ object: this,
+ isBack,
+ entry: backstackEntry,
+ fromEntry: this._currentEntry,
+ });
}
}
diff --git a/packages/core/ui/page/index.ios.ts b/packages/core/ui/page/index.ios.ts
index 5694d66a06..b8ff65664f 100644
--- a/packages/core/ui/page/index.ios.ts
+++ b/packages/core/ui/page/index.ios.ts
@@ -118,7 +118,14 @@ class UIViewControllerImpl extends UIViewController {
}
const frame = this.navigationController ? (this.navigationController).owner : null;
+ const newEntry = this[ENTRY];
+ // Don't raise event if currentPage was showing modal page.
+ if (!owner._presentedViewController && newEntry && (!frame || frame.currentPage !== owner)) {
+ const isBack = isBackNavigationTo(owner, newEntry);
+ owner.onNavigatingTo(newEntry.entry.context, isBack, newEntry.entry.bindingContext);
+ }
+
if (frame) {
if (!owner.parent) {
owner._frame = frame;
From 6e1e9c4ad55c506e555da3f43257ceb565073565 Mon Sep 17 00:00:00 2001
From: Nathan Walker
Date: Wed, 28 Dec 2022 21:58:52 -0800
Subject: [PATCH 04/76] release: @nativescript/core 8.4.2
---
CHANGELOG.md | 15 +++++++++++++++
package.json | 2 +-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index eb647cf433..73f2d36734 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,18 @@
+## [8.4.2](https://github.com/NativeScript/NativeScript/compare/8.4.1-core...8.4.2-core) (2022-12-29)
+
+
+### Bug Fixes
+
+* **android:** backwards compat Java cast Float to Long for ApplicationSettings.getNumber ([#10140](https://github.com/NativeScript/NativeScript/issues/10140)) ([7c1590a](https://github.com/NativeScript/NativeScript/commit/7c1590abff0127fd1e5254648cdd1d8c7ab49869))
+* **core:** update metadata filtering for IOS 16 ([#10133](https://github.com/NativeScript/NativeScript/issues/10133)) ([c461f1b](https://github.com/NativeScript/NativeScript/commit/c461f1bb551a69e721548fa5ae6ca2c7601d0b87))
+* **ios:** box shadow border radius ([#10142](https://github.com/NativeScript/NativeScript/issues/10142)) ([6948f7c](https://github.com/NativeScript/NativeScript/commit/6948f7c03265ebf9b92a7d5f69bfbb4743ce449b))
+* **ios:** navigatingTo event handling ([#10120](https://github.com/NativeScript/NativeScript/issues/10120)) ([a4f28b8](https://github.com/NativeScript/NativeScript/commit/a4f28b831785c8cf6ba76c170fcd7a5628b12c35))
+* **ios:** reset additional insets if they're zero ([#10134](https://github.com/NativeScript/NativeScript/issues/10134)) ([8b7d5ab](https://github.com/NativeScript/NativeScript/commit/8b7d5ab5fc34fa7785b7801ca5de60e69bbf7392))
+* **listview:** delegate handling removed from unloaded ([#10138](https://github.com/NativeScript/NativeScript/issues/10138)) ([04c3d9a](https://github.com/NativeScript/NativeScript/commit/04c3d9a9795898386f26656018bc05cf697d09e2))
+* **utils:** ios to filter out null values ([#10117](https://github.com/NativeScript/NativeScript/issues/10117)) ([4723114](https://github.com/NativeScript/NativeScript/commit/47231145acb851552d7990e5a75b66dd6d06fee8))
+
+
+
## [8.4.1](https://github.com/NativeScript/NativeScript/compare/8.4.0-core...8.4.1-core) (2022-11-30)
### Bug Fixes
diff --git a/package.json b/package.json
index 77d55ccece..1b005e3fa3 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "nativescript",
- "version": "8.4.1",
+ "version": "8.4.2",
"license": "MIT",
"scripts": {
"clean": "git clean -f -X -d --exclude=!.idea/ --exclude=!.vscode/* --exclude=!.npmrc",
From ed3fe979e66018f127514059d0dd73f66b6be397 Mon Sep 17 00:00:00 2001
From: Nathan Walker
Date: Wed, 28 Dec 2022 22:00:15 -0800
Subject: [PATCH 05/76] chore: 8.4.3 next
---
packages/core/package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/core/package.json b/packages/core/package.json
index 6ffec39f69..a412807456 100644
--- a/packages/core/package.json
+++ b/packages/core/package.json
@@ -1,6 +1,6 @@
{
"name": "@nativescript/core",
- "version": "8.4.2",
+ "version": "8.4.3",
"description": "A JavaScript library providing an easy to use api for interacting with iOS and Android platform APIs.",
"main": "index",
"types": "index.d.ts",
From 760bbd06faf3acb7e0694acaf1ad3e029f1cd278 Mon Sep 17 00:00:00 2001
From: Eduardo Speroni
Date: Tue, 3 Jan 2023 13:23:32 -0300
Subject: [PATCH 06/76] fix(ios): prevent layout in viewSafeAreaInsetsDidChange
until first viewDidLayoutSubviews (#10151)
---
packages/core/ui/page/index.ios.ts | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/packages/core/ui/page/index.ios.ts b/packages/core/ui/page/index.ios.ts
index b8ff65664f..d6bc163670 100644
--- a/packages/core/ui/page/index.ios.ts
+++ b/packages/core/ui/page/index.ios.ts
@@ -74,6 +74,7 @@ class UIViewControllerImpl extends UIViewController {
public isBackstackSkipped: boolean;
public isBackstackCleared: boolean;
+ private didFirstLayout: boolean;
// this is initialized in initWithOwner since the constructor doesn't run on native classes
private _isRunningLayout: number;
private get isRunningLayout() {
@@ -84,6 +85,7 @@ class UIViewControllerImpl extends UIViewController {
}
private finishRunningLayout() {
this._isRunningLayout--;
+ this.didFirstLayout = true;
}
private runLayout(cb: () => void) {
try {
@@ -98,6 +100,7 @@ class UIViewControllerImpl extends UIViewController {
const controller = UIViewControllerImpl.new();
controller._owner = owner;
controller._isRunningLayout = 0;
+ controller.didFirstLayout = false;
return controller;
}
@@ -125,7 +128,7 @@ class UIViewControllerImpl extends UIViewController {
const isBack = isBackNavigationTo(owner, newEntry);
owner.onNavigatingTo(newEntry.entry.context, isBack, newEntry.entry.bindingContext);
}
-
+
if (frame) {
if (!owner.parent) {
owner._frame = frame;
@@ -276,7 +279,7 @@ class UIViewControllerImpl extends UIViewController {
public viewSafeAreaInsetsDidChange(): void {
super.viewSafeAreaInsetsDidChange();
- if (this.isRunningLayout) {
+ if (this.isRunningLayout || !this.didFirstLayout) {
return;
}
const owner = this._owner?.deref();
From d138ac000df2e2dfc890db992c39a4429e6ed8dc Mon Sep 17 00:00:00 2001
From: Nathan Walker
Date: Tue, 3 Jan 2023 15:01:21 -0800
Subject: [PATCH 07/76] fix(ios): prevent transitionCoordinator usage during
modal presentation (#10153)
closes https://github.com/NativeScript/NativeScript/issues/10115
---
packages/core/ui/frame/index.ios.ts | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/packages/core/ui/frame/index.ios.ts b/packages/core/ui/frame/index.ios.ts
index 547ed22c49..60a42befd8 100644
--- a/packages/core/ui/frame/index.ios.ts
+++ b/packages/core/ui/frame/index.ios.ts
@@ -118,7 +118,9 @@ export class Frame extends FrameBase {
if (!this._currentEntry) {
// Update action-bar with disabled animations before the initial navigation.
this._updateActionBar(backstackEntry.resolvedPage, true);
- this.pushViewControllerAnimated(viewController, animated);
+ // Core defaults modalPresentationStyle to 1 for standard frame navigation
+ // for all others, it's modal presentation
+ this.pushViewControllerAnimated(viewController, animated, this._ios?.controller?.modalPresentationStyle !== 1);
if (Trace.isEnabled()) {
Trace.write(`${this}.pushViewControllerAnimated(${viewController}, ${animated}); depth = ${navDepth}`, Trace.categories.Navigation);
}
@@ -180,13 +182,14 @@ export class Frame extends FrameBase {
}
}
- private pushViewControllerAnimated(viewController: UIViewController, animated: boolean) {
+ private pushViewControllerAnimated(viewController: UIViewController, animated: boolean, isModal: boolean) {
let transitionCoordinator = this._ios.controller.transitionCoordinator;
- if (transitionCoordinator) {
+ if (!isModal && transitionCoordinator) {
transitionCoordinator.animateAlongsideTransitionCompletion(null, () => {
this._ios.controller.pushViewControllerAnimated(viewController, animated);
});
} else {
+ // modal should always push immediately without transition coordinator
this._ios.controller.pushViewControllerAnimated(viewController, animated);
}
}
From 00944bb1b5b6f4cc8084cf7cde3db6448e28e0bd Mon Sep 17 00:00:00 2001
From: Nathan Walker
Date: Tue, 3 Jan 2023 17:36:56 -0800
Subject: [PATCH 08/76] fix(ios): TextField keyboard handling with emoji,
autofill, and shortcuts (#10154)
closes https://github.com/NativeScript/NativeScript/issues/10108
---
apps/toolbox/src/main-page.xml | 1 +
apps/toolbox/src/pages/forms.ts | 16 ++++++++++++++++
apps/toolbox/src/pages/forms.xml | 15 +++++++++++++++
package.json | 1 +
packages/core/index.d.ts | 3 ++-
packages/core/index.ts | 3 ++-
packages/core/package.json | 1 +
packages/core/ui/text-field/index.ios.ts | 7 +++++--
packages/core/utils/common.ts | 7 +++++++
9 files changed, 50 insertions(+), 4 deletions(-)
create mode 100644 apps/toolbox/src/pages/forms.ts
create mode 100644 apps/toolbox/src/pages/forms.xml
diff --git a/apps/toolbox/src/main-page.xml b/apps/toolbox/src/main-page.xml
index 28f53ca087..d4d7766e82 100644
--- a/apps/toolbox/src/main-page.xml
+++ b/apps/toolbox/src/main-page.xml
@@ -10,6 +10,7 @@
+
diff --git a/apps/toolbox/src/pages/forms.ts b/apps/toolbox/src/pages/forms.ts
new file mode 100644
index 0000000000..cbf927466e
--- /dev/null
+++ b/apps/toolbox/src/pages/forms.ts
@@ -0,0 +1,16 @@
+import { Page, Observable, EventData } from '@nativescript/core';
+
+let page: Page;
+
+export function navigatingTo(args: EventData) {
+ page = args.object;
+ page.bindingContext = new SampleData();
+}
+
+export class SampleData extends Observable {
+ textInput = '';
+ textChange(args) {
+ console.log(args.object.text);
+ this.notifyPropertyChange('textInput', args.object.text);
+ }
+}
diff --git a/apps/toolbox/src/pages/forms.xml b/apps/toolbox/src/pages/forms.xml
new file mode 100644
index 0000000000..dddddfedde
--- /dev/null
+++ b/apps/toolbox/src/pages/forms.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/package.json b/package.json
index 1b005e3fa3..af0a5d984d 100644
--- a/package.json
+++ b/package.json
@@ -44,6 +44,7 @@
"css": "^3.0.0",
"css-tree": "^1.1.2",
"dotenv": "10.0.0",
+ "emoji-regex": "^10.2.1",
"eslint": "7.22.0",
"eslint-config-prettier": "^8.1.0",
"gonzales": "^1.0.7",
diff --git a/packages/core/index.d.ts b/packages/core/index.d.ts
index 94f9f6f351..74ffa7fba4 100644
--- a/packages/core/index.d.ts
+++ b/packages/core/index.d.ts
@@ -105,7 +105,7 @@ export type { InstrumentationMode, TimerInfo } from './profiling';
export { encoding } from './text';
export * from './trace';
export * from './ui';
-import { GC, isFontIconURI, isDataURI, isFileOrResourcePath, executeOnMainThread, mainThreadify, isMainThread, dispatchToMainThread, executeOnUIThread, releaseNativeObject, getModuleName, openFile, openUrl, isRealDevice, layout, ad as androidUtils, iOSNativeHelper as iosUtils, Source, escapeRegexSymbols, convertString, dismissSoftInput, dismissKeyboard, queueMacrotask, queueGC, throttle, debounce, dataSerialize, dataDeserialize, copyToClipboard, getFileExtension } from './utils';
+import { GC, isFontIconURI, isDataURI, isFileOrResourcePath, executeOnMainThread, mainThreadify, isMainThread, dispatchToMainThread, executeOnUIThread, releaseNativeObject, getModuleName, openFile, openUrl, isRealDevice, layout, ad as androidUtils, iOSNativeHelper as iosUtils, Source, escapeRegexSymbols, convertString, dismissSoftInput, dismissKeyboard, queueMacrotask, queueGC, throttle, debounce, dataSerialize, dataDeserialize, copyToClipboard, getFileExtension, isEmoji } from './utils';
import { SDK_VERSION } from './utils/constants';
import { ClassInfo, getClass, getBaseClasses, getClassInfo, isBoolean, isDefined, isFunction, isNullOrUndefined, isNumber, isObject, isString, isUndefined, toUIString, verifyCallback, numberHasDecimals, numberIs64Bit } from './utils/types';
export declare const Utils: {
@@ -163,5 +163,6 @@ export declare const Utils: {
dismissSoftInput: typeof dismissSoftInput;
dismissKeyboard: typeof dismissKeyboard;
copyToClipboard: typeof copyToClipboard;
+ isEmoji: typeof isEmoji;
};
export { XmlParser, ParserEventType, ParserEvent } from './xml';
diff --git a/packages/core/index.ts b/packages/core/index.ts
index 8ffe4069a7..3f8f78582b 100644
--- a/packages/core/index.ts
+++ b/packages/core/index.ts
@@ -137,7 +137,7 @@ export * from './trace';
export * from './ui';
-import { GC, isFontIconURI, isDataURI, isFileOrResourcePath, executeOnMainThread, mainThreadify, isMainThread, dispatchToMainThread, executeOnUIThread, queueMacrotask, queueGC, debounce, throttle, releaseNativeObject, getModuleName, openFile, openUrl, isRealDevice, layout, ad as androidUtils, iOSNativeHelper as iosUtils, Source, RESOURCE_PREFIX, FILE_PREFIX, escapeRegexSymbols, convertString, dismissSoftInput, dismissKeyboard, dataDeserialize, dataSerialize, copyToClipboard, getFileExtension } from './utils';
+import { GC, isFontIconURI, isDataURI, isFileOrResourcePath, executeOnMainThread, mainThreadify, isMainThread, dispatchToMainThread, executeOnUIThread, queueMacrotask, queueGC, debounce, throttle, releaseNativeObject, getModuleName, openFile, openUrl, isRealDevice, layout, ad as androidUtils, iOSNativeHelper as iosUtils, Source, RESOURCE_PREFIX, FILE_PREFIX, escapeRegexSymbols, convertString, dismissSoftInput, dismissKeyboard, dataDeserialize, dataSerialize, copyToClipboard, getFileExtension, isEmoji } from './utils';
import { SDK_VERSION } from './utils/constants';
import { ClassInfo, getClass, getBaseClasses, getClassInfo, isBoolean, isDefined, isFunction, isNullOrUndefined, isNumber, isObject, isString, isUndefined, toUIString, verifyCallback, numberHasDecimals, numberIs64Bit } from './utils/types';
@@ -199,6 +199,7 @@ export const Utils = {
dismissSoftInput,
dismissKeyboard,
copyToClipboard,
+ isEmoji,
};
export { XmlParser, ParserEventType, ParserEvent } from './xml';
diff --git a/packages/core/package.json b/packages/core/package.json
index a412807456..f22c07f02c 100644
--- a/packages/core/package.json
+++ b/packages/core/package.json
@@ -47,6 +47,7 @@
"@nativescript/hook": "~2.0.0",
"acorn": "^8.7.0",
"css-tree": "^1.1.2",
+ "emoji-regex": "^10.2.1",
"reduce-css-calc": "^2.1.7",
"tslib": "^2.0.0"
},
diff --git a/packages/core/ui/text-field/index.ios.ts b/packages/core/ui/text-field/index.ios.ts
index f55b3204c1..5d08897b2c 100644
--- a/packages/core/ui/text-field/index.ios.ts
+++ b/packages/core/ui/text-field/index.ios.ts
@@ -4,7 +4,7 @@ import { hintProperty, placeholderColorProperty, _updateCharactersInRangeReplace
import { CoreTypes } from '../../core-types';
import { Color } from '../../color';
import { colorProperty, paddingTopProperty, paddingRightProperty, paddingBottomProperty, paddingLeftProperty } from '../styling/style-properties';
-import { layout } from '../../utils';
+import { layout, isEmoji } from '../../utils';
import { profile } from '../../profiling';
export * from './text-field-common';
@@ -200,7 +200,10 @@ export class TextField extends TextFieldBase {
}
if (this.updateTextTrigger === 'textChanged') {
- const shouldReplaceString = (textField.secureTextEntry && this.firstEdit) || delta > 1;
+ // 1. secureTextEntry with firstEdit should not replace
+ // 2. emoji's should not replace value
+ // 3. convenient keyboard shortcuts should not replace value (eg, '.com')
+ const shouldReplaceString = (textField.secureTextEntry && this.firstEdit) || (delta > 1 && !isEmoji(replacementString) && delta !== replacementString.length);
if (shouldReplaceString) {
textProperty.nativeValueChange(this, replacementString);
} else {
diff --git a/packages/core/utils/common.ts b/packages/core/utils/common.ts
index a4cbc10281..17c3ad4d81 100644
--- a/packages/core/utils/common.ts
+++ b/packages/core/utils/common.ts
@@ -1,6 +1,7 @@
import * as types from './types';
import { dispatchToMainThread, dispatchToUIThread, isMainThread } from './mainthread-helper';
import { sanitizeModuleName } from '../ui/builder/module-name-sanitizer';
+import emojiRegex from 'emoji-regex';
import { GC } from './index';
@@ -203,3 +204,9 @@ export function queueGC(delay = 900, useThrottle?: boolean) {
debouncedGC.get(delay)();
}
}
+
+export function isEmoji(value: string): boolean {
+ // TODO: In a future runtime update, we can switch to using Unicode Property Escapes:
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Unicode_Property_Escapes
+ return emojiRegex().test(value);
+}
From 84440876feb8a0b4bc5bc2309dc7a9315d1f91ef Mon Sep 17 00:00:00 2001
From: Prabu Devarrajan
Date: Tue, 3 Jan 2023 18:38:33 -0800
Subject: [PATCH 09/76] fix(android): WebView url and event handling (#10147)
(#10148)
closes https://github.com/NativeScript/NativeScript/issues/10147
---
packages/core/ui/web-view/index.android.ts | 3 +--
packages/core/utils/index.android.ts | 8 ++++++++
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/packages/core/ui/web-view/index.android.ts b/packages/core/ui/web-view/index.android.ts
index ec18b3dc30..b302d837de 100644
--- a/packages/core/ui/web-view/index.android.ts
+++ b/packages/core/ui/web-view/index.android.ts
@@ -29,8 +29,7 @@ function initializeWebViewClient(): void {
// Handle schemes like mailto, tel, etc
if (!android.webkit.URLUtil.isNetworkUrl(url)) {
- openUrl(url);
- return true;
+ return openUrl(url);
}
return false;
diff --git a/packages/core/utils/index.android.ts b/packages/core/utils/index.android.ts
index a34815a871..5cd1b0710a 100644
--- a/packages/core/utils/index.android.ts
+++ b/packages/core/utils/index.android.ts
@@ -22,8 +22,16 @@ export function openUrl(location: string): boolean {
const context = ad.getApplicationContext();
try {
const intent = new android.content.Intent(android.content.Intent.ACTION_VIEW, android.net.Uri.parse(location.trim()));
+ const packageManager = context.getPackageManager();
+
intent.addFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK);
+ // Handle schemes like mailto, tel, etc
+ if (intent.resolveActivity(packageManager) == null) {
+ Trace.write('Unable to open ' + location + '. Make sure to add queries element(https://developer.android.com/guide/topics/manifest/queries-element) matching the scheme to the AndroidManifest.xml file.', Trace.categories.Error, Trace.messageType.error);
+ return false;
+ }
+
context.startActivity(intent);
} catch (e) {
// We Don't do anything with an error. We just output it
From 191f83b8dc3b7568dad7fb9f5ba89ca9b0526840 Mon Sep 17 00:00:00 2001
From: Tim Gates
Date: Wed, 4 Jan 2023 13:40:39 +1100
Subject: [PATCH 10/76] docs: typos (#10145)
There were small typos in:
- apps/automated/src/ui/web-view/web-view.md
- tools/notes/DevelopmentWorkflow.md
Fixes:
- Should read `describe` rather than `decribe`.
- Should read `control` rather than `controll`.
Signed-off-by: Tim Gates
---
apps/automated/src/ui/web-view/web-view.md | 2 +-
tools/notes/DevelopmentWorkflow.md | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/apps/automated/src/ui/web-view/web-view.md b/apps/automated/src/ui/web-view/web-view.md
index d8153f0560..e9eb228ac8 100644
--- a/apps/automated/src/ui/web-view/web-view.md
+++ b/apps/automated/src/ui/web-view/web-view.md
@@ -34,4 +34,4 @@ Using a WebView requires the web-view module.
{%snippet web-view-loaded%}
->Note: to be able to use gestures in `WebView` component on Android, we should first disabled the zoom control. To do that we could access the `android` property and with the help of `setDisplayZoomControls` to set this controll to `false`.
+>Note: to be able to use gestures in `WebView` component on Android, we should first disabled the zoom control. To do that we could access the `android` property and with the help of `setDisplayZoomControls` to set this control to `false`.
diff --git a/tools/notes/DevelopmentWorkflow.md b/tools/notes/DevelopmentWorkflow.md
index 4bafcb872a..960629cb79 100644
--- a/tools/notes/DevelopmentWorkflow.md
+++ b/tools/notes/DevelopmentWorkflow.md
@@ -48,7 +48,7 @@ npx nx run core:test --watch
### Isolate tests by name
-Run a single test by it's decribe name, for example to run just the `xml/index.spec.ts`, the describe block is named `XmlParser` therefore:
+Run a single test by it's describe name, for example to run just the `xml/index.spec.ts`, the describe block is named `XmlParser` therefore:
```
npx nx run core:test --watch -t 'XmlParser'
From e4e05f4cf36c4545810ff370a3b0bdea17bfbe84 Mon Sep 17 00:00:00 2001
From: Nathan Walker
Date: Tue, 3 Jan 2023 18:52:07 -0800
Subject: [PATCH 11/76] release: @nativescript/core 8.4.3
---
CHANGELOG.md | 12 ++++++++++++
package.json | 2 +-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 73f2d36734..39d0964095 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,15 @@
+## [8.4.3](https://github.com/NativeScript/NativeScript/compare/8.4.2-core...8.4.3-core) (2023-01-04)
+
+
+### Bug Fixes
+
+* **android:** WebView url and event handling ([#10147](https://github.com/NativeScript/NativeScript/issues/10147)) ([#10148](https://github.com/NativeScript/NativeScript/issues/10148)) ([8444087](https://github.com/NativeScript/NativeScript/commit/84440876feb8a0b4bc5bc2309dc7a9315d1f91ef))
+* **ios:** prevent layout in viewSafeAreaInsetsDidChange until first viewDidLayoutSubviews ([#10151](https://github.com/NativeScript/NativeScript/issues/10151)) ([760bbd0](https://github.com/NativeScript/NativeScript/commit/760bbd06faf3acb7e0694acaf1ad3e029f1cd278))
+* **ios:** prevent transitionCoordinator usage during modal presentation ([#10153](https://github.com/NativeScript/NativeScript/issues/10153)) ([d138ac0](https://github.com/NativeScript/NativeScript/commit/d138ac000df2e2dfc890db992c39a4429e6ed8dc))
+* **ios:** TextField keyboard handling with emoji, autofill, and shortcuts ([#10154](https://github.com/NativeScript/NativeScript/issues/10154)) ([00944bb](https://github.com/NativeScript/NativeScript/commit/00944bb1b5b6f4cc8084cf7cde3db6448e28e0bd))
+
+
+
## [8.4.2](https://github.com/NativeScript/NativeScript/compare/8.4.1-core...8.4.2-core) (2022-12-29)
diff --git a/package.json b/package.json
index af0a5d984d..cbcf09a39f 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "nativescript",
- "version": "8.4.2",
+ "version": "8.4.3",
"license": "MIT",
"scripts": {
"clean": "git clean -f -X -d --exclude=!.idea/ --exclude=!.vscode/* --exclude=!.npmrc",
From 68d19afa034602e99f56452783a2234c51cd5de4 Mon Sep 17 00:00:00 2001
From: Nathan Walker
Date: Tue, 3 Jan 2023 18:54:43 -0800
Subject: [PATCH 12/76] chore: 8.4.4 next
---
packages/core/package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/core/package.json b/packages/core/package.json
index f22c07f02c..6e12349134 100644
--- a/packages/core/package.json
+++ b/packages/core/package.json
@@ -1,6 +1,6 @@
{
"name": "@nativescript/core",
- "version": "8.4.3",
+ "version": "8.4.4",
"description": "A JavaScript library providing an easy to use api for interacting with iOS and Android platform APIs.",
"main": "index",
"types": "index.d.ts",
From 5b6e4d68986f22219c41f434f2bf51e714e485a5 Mon Sep 17 00:00:00 2001
From: Nathan Walker
Date: Wed, 4 Jan 2023 09:57:58 -0800
Subject: [PATCH 13/76] fix(mac): utils for mac catalyst (#10157)
---
packages/core/platforms/ios/src/NativeScriptUtils.m | 3 +++
1 file changed, 3 insertions(+)
diff --git a/packages/core/platforms/ios/src/NativeScriptUtils.m b/packages/core/platforms/ios/src/NativeScriptUtils.m
index 4a0dbd287d..ace5af1165 100644
--- a/packages/core/platforms/ios/src/NativeScriptUtils.m
+++ b/packages/core/platforms/ios/src/NativeScriptUtils.m
@@ -49,8 +49,11 @@ +(UIFont*) createUIFont:(NSDictionary*)font {
BOOL actualItalic = result.fontDescriptor.symbolicTraits & UIFontDescriptorTraitItalic;
if ([[font valueForKey:@"isItalic"] boolValue] && !actualItalic) {
+ #if TARGET_OS_MACCATALYST
+ #else
// The font we got is not actually italic so emulate that with a matrix
result = [UIFont fontWithDescriptor:[descriptor fontDescriptorWithMatrix:CGAffineTransformMake(1, 0, 0.2, 1, 0, 0)] size:size];
+ #endif
}
// Check if the resolved font has the correct font-family
From 451c3cfe43a90be705bb6cc7abb220e674d1d906 Mon Sep 17 00:00:00 2001
From: Dimitris-Rafail Katsampas
Date: Sat, 7 Jan 2023 06:48:59 +0200
Subject: [PATCH 14/76] fix(android): openUrl (#10161)
---
packages/core/utils/index.android.ts | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/packages/core/utils/index.android.ts b/packages/core/utils/index.android.ts
index 5cd1b0710a..5677c54516 100644
--- a/packages/core/utils/index.android.ts
+++ b/packages/core/utils/index.android.ts
@@ -22,20 +22,11 @@ export function openUrl(location: string): boolean {
const context = ad.getApplicationContext();
try {
const intent = new android.content.Intent(android.content.Intent.ACTION_VIEW, android.net.Uri.parse(location.trim()));
- const packageManager = context.getPackageManager();
-
intent.addFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK);
-
- // Handle schemes like mailto, tel, etc
- if (intent.resolveActivity(packageManager) == null) {
- Trace.write('Unable to open ' + location + '. Make sure to add queries element(https://developer.android.com/guide/topics/manifest/queries-element) matching the scheme to the AndroidManifest.xml file.', Trace.categories.Error, Trace.messageType.error);
- return false;
- }
-
context.startActivity(intent);
} catch (e) {
- // We Don't do anything with an error. We just output it
- Trace.write('Error in OpenURL', Trace.categories.Error, Trace.messageType.error);
+ // We don't do anything with an error. We just output it
+ Trace.write(`Failed to start activity for handling URL: ${location}`, Trace.categories.Error, Trace.messageType.error);
return false;
}
From bff35e5163d126d44ae3b2828ed96dbdc6c2e6ef Mon Sep 17 00:00:00 2001
From: farfromrefuge
Date: Mon, 9 Jan 2023 17:38:28 +0000
Subject: [PATCH 15/76] feat(core): new autoFillTypes for newUsername,
newPassword and oneTimeCode (#10159)
---
packages/core/core-types/index.ts | 3 +++
packages/core/ui/editable-text-base/index.android.ts | 9 +++++++++
packages/core/ui/editable-text-base/index.ios.ts | 6 ++++++
3 files changed, 18 insertions(+)
diff --git a/packages/core/core-types/index.ts b/packages/core/core-types/index.ts
index 539ceb3f98..e4768f8e17 100644
--- a/packages/core/core-types/index.ts
+++ b/packages/core/core-types/index.ts
@@ -50,6 +50,9 @@ export namespace CoreTypes {
export module AutofillType {
export const username = 'username';
export const password = 'password';
+ export const newUsername = 'newUsername';
+ export const newPassword = 'newPassword';
+ export const oneTimeCode = 'oneTimeCode';
export const none = 'none';
}
diff --git a/packages/core/ui/editable-text-base/index.android.ts b/packages/core/ui/editable-text-base/index.android.ts
index e0d0352af6..6061fc960f 100644
--- a/packages/core/ui/editable-text-base/index.android.ts
+++ b/packages/core/ui/editable-text-base/index.android.ts
@@ -269,6 +269,15 @@ export abstract class EditableTextBase extends EditableTextBaseCommon {
case 'password':
newOptions = 'password'; // android.view.View.AUTOFILL_HINT_PASSWORD
break;
+ case 'newPassword':
+ newOptions = 'newPassword'; // android.view.View.AUTOFILL_HINT_NEW_PASSWORD
+ break;
+ case 'newUsername':
+ newOptions = 'newUsername'; // android.view.View.AUTOFILL_HINT_NEW_USERNAME
+ break;
+ case 'oneTimeCode':
+ newOptions = '2faAppOTPCode'; // android.view.View.AUTOFILL_HINT_2FA_APP_OTP
+ break;
case 'none':
newOptions = null;
break;
diff --git a/packages/core/ui/editable-text-base/index.ios.ts b/packages/core/ui/editable-text-base/index.ios.ts
index df6f436d2e..975e6fb0cb 100644
--- a/packages/core/ui/editable-text-base/index.ios.ts
+++ b/packages/core/ui/editable-text-base/index.ios.ts
@@ -96,6 +96,12 @@ export abstract class EditableTextBase extends EditableTextBaseCommon {
case 'password':
newTextContentType = UITextContentTypePassword;
break;
+ case 'newPassword':
+ newTextContentType = UITextContentTypeNewPassword;
+ break;
+ case 'oneTimeCode':
+ newTextContentType = UITextContentTypeOneTimeCode;
+ break;
case 'none':
newTextContentType = null;
default:
From 0632215793cad508b96a4e8bb0e39041a9160d2c Mon Sep 17 00:00:00 2001
From: farfromrefuge
Date: Mon, 9 Jan 2023 17:40:20 +0000
Subject: [PATCH 16/76] chore: eslint cleanup (#10160)
---
.eslintrc.json | 17 ++++-
packages/core/core-types/index.ts | 62 +++++++++----------
packages/core/css/parser.ts | 1 +
packages/core/data/observable-array/index.ts | 2 +-
packages/core/globals/index.ts | 2 +-
.../core/ui/action-bar/action-bar-common.ts | 7 ++-
.../ui/core/bindable/bindable-expressions.ts | 18 +++---
packages/core/ui/core/bindable/index.ts | 2 +-
.../ui/editable-text-base/index.android.ts | 3 +-
.../core/ui/editable-text-base/index.ios.ts | 10 ++-
packages/core/ui/frame/index.android.ts | 2 +-
packages/core/ui/frame/index.ios.ts | 4 +-
.../layouts/grid-layout/grid-layout-common.ts | 14 ++---
.../ui/layouts/root-layout/index.android.ts | 2 +-
packages/core/ui/styling/style-properties.ts | 1 +
packages/core/utils/common.ts | 6 +-
packages/core/utils/native-helper.android.ts | 5 +-
packages/core/utils/native-helper.ios.ts | 10 +--
18 files changed, 97 insertions(+), 71 deletions(-)
diff --git a/.eslintrc.json b/.eslintrc.json
index 5b7d009674..3eab9c6ec0 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -24,7 +24,22 @@
{
"files": ["*.ts", "*.tsx"],
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier", "plugin:@nrwl/nx/typescript"],
- "rules": {}
+ "rules": {
+ "no-empty": "off",
+ "no-useless-escape": "off",
+ "no-inner-declarations": "off",
+ "no-prototype-builtins": "off",
+ "@typescript-eslint/no-empty-interface": "off",
+ "@typescript-eslint/no-var-requires": "off",
+ "@typescript-eslint/no-empty-function": "off",
+ "@typescript-eslint/ban-ts-comment": "off",
+ "@typescript-eslint/ban-types": "off",
+ "@typescript-eslint/no-unused-vars": "off",
+ "@typescript-eslint/no-explicit-any": "off",
+ "@typescript-eslint/no-this-alias": "warn",
+ "@typescript-eslint/no-namespace": "off",
+ "@typescript-eslint/no-inferrable-types": "off"
+ }
},
{
"files": ["*.js", "*.jsx"],
diff --git a/packages/core/core-types/index.ts b/packages/core/core-types/index.ts
index e4768f8e17..2b8f1ddc86 100644
--- a/packages/core/core-types/index.ts
+++ b/packages/core/core-types/index.ts
@@ -38,7 +38,7 @@ export namespace CoreTypes {
};
export type KeyboardInputType = 'datetime' | 'phone' | 'number' | 'url' | 'email' | 'integer';
- export module KeyboardType {
+ export namespace KeyboardType {
export const datetime = 'datetime';
export const phone = 'phone';
export const number = 'number';
@@ -47,7 +47,7 @@ export namespace CoreTypes {
export const integer = 'integer';
}
export type AutofillType = 'username' | 'password' | 'none' | string;
- export module AutofillType {
+ export namespace AutofillType {
export const username = 'username';
export const password = 'password';
export const newUsername = 'newUsername';
@@ -57,7 +57,7 @@ export namespace CoreTypes {
}
export type ReturnKeyButtonType = 'done' | 'next' | 'go' | 'search' | 'send';
- export module ReturnKeyType {
+ export namespace ReturnKeyType {
export const done = 'done';
export const next = 'next';
export const go = 'go';
@@ -66,7 +66,7 @@ export namespace CoreTypes {
}
export type TextAlignmentType = 'initial' | 'left' | 'center' | 'right' | 'justify';
- export module TextAlignment {
+ export namespace TextAlignment {
export const left = 'left';
export const center = 'center';
export const right = 'right';
@@ -74,14 +74,14 @@ export namespace CoreTypes {
}
export type TextDecorationType = 'none' | 'underline' | 'line-through' | 'underline line-through';
- export module TextDecoration {
+ export namespace TextDecoration {
export const none = 'none';
export const underline = 'underline';
export const lineThrough = 'line-through';
}
export type TextTransformType = 'initial' | 'none' | 'capitalize' | 'uppercase' | 'lowercase';
- export module TextTransform {
+ export namespace TextTransform {
export const none = 'none';
export const capitalize = 'capitalize';
export const uppercase = 'uppercase';
@@ -89,7 +89,7 @@ export namespace CoreTypes {
}
export type WhiteSpaceType = 'initial' | 'normal' | 'nowrap';
- export module WhiteSpace {
+ export namespace WhiteSpace {
export const normal = 'normal';
export const nowrap = 'nowrap';
}
@@ -97,20 +97,20 @@ export namespace CoreTypes {
export type MaxLinesType = number;
export type OrientationType = 'horizontal' | 'vertical';
- export module Orientation {
+ export namespace Orientation {
export const horizontal = 'horizontal';
export const vertical = 'vertical';
}
export type DeviceOrientationType = 'portrait' | 'landscape' | 'unknown';
- export module DeviceOrientation {
+ export namespace DeviceOrientation {
export const portrait = 'portrait';
export const landscape = 'landscape';
export const unknown = 'unknown';
}
export type HorizontalAlignmentType = 'left' | 'center' | 'right' | 'stretch';
- export module HorizontalAlignment {
+ export namespace HorizontalAlignment {
export const left = 'left';
export const center = 'center';
export const right = 'right';
@@ -120,7 +120,7 @@ export namespace CoreTypes {
}
export type VerticalAlignmentType = 'top' | 'middle' | 'bottom' | 'stretch';
- export module VerticalAlignment {
+ export namespace VerticalAlignment {
export const top = 'top';
export const middle = 'middle';
export const bottom = 'bottom';
@@ -143,7 +143,7 @@ export namespace CoreTypes {
}
export type ImageStretchType = 'none' | 'aspectFill' | 'aspectFit' | 'fill';
- export module ImageStretch {
+ export namespace ImageStretch {
export const none: ImageStretchType = 'none';
export const aspectFill: ImageStretchType = 'aspectFill';
export const aspectFit: ImageStretchType = 'aspectFit';
@@ -151,7 +151,7 @@ export namespace CoreTypes {
}
export type VisibilityType = 'visible' | 'hidden' | 'collapse' | 'collapsed';
- export module Visibility {
+ export namespace Visibility {
export const visible: VisibilityType = 'visible';
export const collapse: VisibilityType = 'collapse';
export const collapsed: VisibilityType = 'collapsed';
@@ -161,30 +161,30 @@ export namespace CoreTypes {
const parseStrict = makeParser(isValid);
}
- export module FontAttributes {
+ export namespace FontAttributes {
export const Normal = 0;
export const Bold = 1;
export const Italic = 1 << 1;
}
- export module DeviceType {
+ export namespace DeviceType {
export const Phone: string = 'Phone';
export const Tablet: string = 'Tablet';
}
export type UpdateTextTriggerType = 'focusLost' | 'textChanged';
- export module UpdateTextTrigger {
+ export namespace UpdateTextTrigger {
export const focusLost: UpdateTextTriggerType = 'focusLost';
export const textChanged: UpdateTextTriggerType = 'textChanged';
}
- export module Accuracy {
+ export namespace Accuracy {
export const any: number = 300;
export const high: number = 3;
}
export type DockType = 'left' | 'top' | 'right' | 'bottom';
- export module Dock {
+ export namespace Dock {
export const left: DockType = 'left';
export const top: DockType = 'top';
export const right: DockType = 'right';
@@ -192,48 +192,48 @@ export namespace CoreTypes {
}
export type AutocapitalizationInputType = 'none' | 'words' | 'sentences' | 'allcharacters';
- export module AutocapitalizationType {
+ export namespace AutocapitalizationType {
export const none: AutocapitalizationInputType = 'none';
export const words: AutocapitalizationInputType = 'words';
export const sentences: AutocapitalizationInputType = 'sentences';
export const allCharacters: AutocapitalizationInputType = 'allcharacters';
}
- export module NavigationBarVisibility {
+ export namespace NavigationBarVisibility {
export const auto: string = 'auto';
export const never: string = 'never';
export const always: string = 'always';
}
- export module AndroidActionBarIconVisibility {
+ export namespace AndroidActionBarIconVisibility {
export const auto: string = 'auto';
export const never: string = 'never';
export const always: string = 'always';
}
- export module AndroidActionItemPosition {
+ export namespace AndroidActionItemPosition {
export const actionBar: string = 'actionBar';
export const actionBarIfRoom: string = 'actionBarIfRoom';
export const popup: string = 'popup';
}
- export module IOSActionItemPosition {
+ export namespace IOSActionItemPosition {
export const left: string = 'left';
export const right: string = 'right';
}
- export module ImageFormat {
+ export namespace ImageFormat {
export const png: string = 'png';
export const jpeg: string = 'jpeg';
export const jpg: string = 'jpg';
}
- export module FontStyle {
+ export namespace FontStyle {
export const normal: string = 'normal';
export const italic: string = 'italic';
}
- export module FontWeight {
+ export namespace FontWeight {
export const thin: string = '100';
export const extraLight: string = '200';
export const light: string = '300';
@@ -246,7 +246,7 @@ export namespace CoreTypes {
}
export type BackgroundRepeatType = 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat';
- export module BackgroundRepeat {
+ export namespace BackgroundRepeat {
export const repeat: BackgroundRepeatType = 'repeat';
export const repeatX: BackgroundRepeatType = 'repeat-x';
export const repeatY: BackgroundRepeatType = 'repeat-y';
@@ -257,26 +257,26 @@ export namespace CoreTypes {
let animation: typeof animationModule;
- export module AnimationCurve {
+ export namespace AnimationCurve {
export const ease = 'ease';
export const easeIn = 'easeIn';
export const easeOut = 'easeOut';
export const easeInOut = 'easeInOut';
export const linear = 'linear';
export const spring = 'spring';
- export function cubicBezier(x1: number, y1: number, x2: number, y2: number): Object {
+ export function cubicBezier(x1: number, y1: number, x2: number, y2: number) {
animation = animation || require('../ui/animation');
return new animation.CubicBezierAnimationCurve(x1, y1, x2, y2);
}
}
- export module StatusBarStyle {
+ export namespace StatusBarStyle {
export const light = 'light';
export const dark = 'dark';
}
- export module SystemAppearance {
+ export namespace SystemAppearance {
export const light = 'light';
export const dark = 'dark';
}
diff --git a/packages/core/css/parser.ts b/packages/core/css/parser.ts
index b3669b7c7f..83705ba3da 100644
--- a/packages/core/css/parser.ts
+++ b/packages/core/css/parser.ts
@@ -460,6 +460,7 @@ function parseArgumentsList(text: string, start: number, argument: (value: st
return { start, end, value };
}
+ // eslint-disable-next-line no-constant-condition
for (let index = 0; true; index++) {
const arg = argument(text, end, index);
if (!arg) {
diff --git a/packages/core/data/observable-array/index.ts b/packages/core/data/observable-array/index.ts
index 500950a4aa..03a5d7e18a 100644
--- a/packages/core/data/observable-array/index.ts
+++ b/packages/core/data/observable-array/index.ts
@@ -95,7 +95,7 @@ export class ObservableArray extends Observable {
}
*[Symbol.iterator]() {
- for (let item of this._array) {
+ for (const item of this._array) {
yield item;
}
}
diff --git a/packages/core/globals/index.ts b/packages/core/globals/index.ts
index eb6d0d0ca7..2af308001e 100644
--- a/packages/core/globals/index.ts
+++ b/packages/core/globals/index.ts
@@ -362,7 +362,7 @@ export function initGlobal() {
}
}
-declare var jest: any;
+declare const jest: any;
function isTestingEnv() {
return typeof jest !== 'undefined';
}
diff --git a/packages/core/ui/action-bar/action-bar-common.ts b/packages/core/ui/action-bar/action-bar-common.ts
index f5610e95a6..103699c020 100644
--- a/packages/core/ui/action-bar/action-bar-common.ts
+++ b/packages/core/ui/action-bar/action-bar-common.ts
@@ -22,13 +22,14 @@ export class ActionBarBase extends View implements ActionBarDefinition {
public effectiveContentInsetLeft: number;
public effectiveContentInsetRight: number;
- get navigationButton(): NavigationButton {
- return this._navigationButton;
- }
disposeNativeView() {
this._actionItems = null;
super.disposeNativeView();
}
+
+ get navigationButton(): NavigationButton {
+ return this._navigationButton;
+ }
set navigationButton(value: NavigationButton) {
if (this._navigationButton !== value) {
if (this._navigationButton) {
diff --git a/packages/core/ui/core/bindable/bindable-expressions.ts b/packages/core/ui/core/bindable/bindable-expressions.ts
index 6954030e93..0bd062c5a2 100644
--- a/packages/core/ui/core/bindable/bindable-expressions.ts
+++ b/packages/core/ui/core/bindable/bindable-expressions.ts
@@ -51,8 +51,8 @@ const logicalOperators = {
const expressionParsers = {
'ArrayExpression': (expression: ASTExpression, model, isBackConvert: boolean, changedModel) => {
const parsed = [];
- for (let element of expression.elements) {
- let value = convertExpressionToValue(element, model, isBackConvert, changedModel);
+ for (const element of expression.elements) {
+ const value = convertExpressionToValue(element, model, isBackConvert, changedModel);
element.type == 'SpreadElement' ? parsed.push(...value) : parsed.push(value);
}
return parsed;
@@ -116,8 +116,8 @@ const expressionParsers = {
}
const parsedArgs = [];
- for (let argument of expression.arguments) {
- let value = convertExpressionToValue(argument, model, isBackConvert, changedModel);
+ for (const argument of expression.arguments) {
+ const value = convertExpressionToValue(argument, model, isBackConvert, changedModel);
argument.type == 'SpreadElement' ? parsedArgs.push(...value) : parsedArgs.push(value);
}
return expression.optional ? callback?.(...parsedArgs) : callback(...parsedArgs);
@@ -181,8 +181,8 @@ const expressionParsers = {
'NewExpression': (expression: ASTExpression, model, isBackConvert: boolean, changedModel) => {
const callback = convertExpressionToValue(expression.callee, model, isBackConvert, changedModel);
const parsedArgs = [];
- for (let argument of expression.arguments) {
- let value = convertExpressionToValue(argument, model, isBackConvert, changedModel);
+ for (const argument of expression.arguments) {
+ const value = convertExpressionToValue(argument, model, isBackConvert, changedModel);
argument.type == 'SpreadElement' ? parsedArgs.push(...value) : parsedArgs.push(value);
}
@@ -194,7 +194,7 @@ const expressionParsers = {
},
'ObjectExpression': (expression: ASTExpression, model, isBackConvert: boolean, changedModel) => {
const parsedObject = {};
- for (let property of expression.properties) {
+ for (const property of expression.properties) {
const value = convertExpressionToValue(property, model, isBackConvert, changedModel);
Object.assign(parsedObject, value);
}
@@ -217,7 +217,7 @@ const expressionParsers = {
const length = expression.quasis.length;
for (let i = 0; i < length; i++) {
- let q = expression.quasis[i];
+ const q = expression.quasis[i];
parsedText += convertExpressionToValue(q, model, isBackConvert, changedModel);
if (!q.tail) {
parsedText += convertExpressionToValue(expression.expressions[i], model, isBackConvert, changedModel);
@@ -262,7 +262,7 @@ export function parseExpression(expressionText: string): ASTExpression {
if (expression == null) {
const program: any = parse(expressionText, { ecmaVersion: 2020 });
const statements = program.body;
- for (let statement of statements) {
+ for (const statement of statements) {
if (statement.type == 'ExpressionStatement') {
expression = statement.expression;
break;
diff --git a/packages/core/ui/core/bindable/index.ts b/packages/core/ui/core/bindable/index.ts
index cb0ee52205..a737f80f20 100644
--- a/packages/core/ui/core/bindable/index.ts
+++ b/packages/core/ui/core/bindable/index.ts
@@ -415,7 +415,7 @@ export class Binding {
}
// Clear added props
- for (let prop of addedProps) {
+ for (const prop of addedProps) {
delete context[prop];
}
addedProps.length = 0;
diff --git a/packages/core/ui/editable-text-base/index.android.ts b/packages/core/ui/editable-text-base/index.android.ts
index 6061fc960f..4c090a054a 100644
--- a/packages/core/ui/editable-text-base/index.android.ts
+++ b/packages/core/ui/editable-text-base/index.android.ts
@@ -229,7 +229,7 @@ export abstract class EditableTextBase extends EditableTextBaseCommon {
newInputType = android.text.InputType.TYPE_CLASS_NUMBER;
break;
- default:
+ default: {
const inputType = +value;
if (!isNaN(inputType)) {
newInputType = inputType;
@@ -237,6 +237,7 @@ export abstract class EditableTextBase extends EditableTextBaseCommon {
newInputType = android.text.InputType.TYPE_CLASS_TEXT;
}
break;
+ }
}
this._setInputType(newInputType);
diff --git a/packages/core/ui/editable-text-base/index.ios.ts b/packages/core/ui/editable-text-base/index.ios.ts
index 975e6fb0cb..305ddb359c 100644
--- a/packages/core/ui/editable-text-base/index.ios.ts
+++ b/packages/core/ui/editable-text-base/index.ios.ts
@@ -60,7 +60,7 @@ export abstract class EditableTextBase extends EditableTextBaseCommon {
newKeyboardType = UIKeyboardType.NumberPad;
break;
- default:
+ default: {
const kt = +value;
if (!isNaN(kt)) {
newKeyboardType = kt;
@@ -68,6 +68,7 @@ export abstract class EditableTextBase extends EditableTextBaseCommon {
newKeyboardType = UIKeyboardType.Default;
}
break;
+ }
}
this.nativeTextViewProtected.keyboardType = newKeyboardType;
@@ -104,9 +105,11 @@ export abstract class EditableTextBase extends EditableTextBaseCommon {
break;
case 'none':
newTextContentType = null;
- default:
+ break;
+ default: {
newTextContentType = value;
break;
+ }
}
this.nativeTextViewProtected.textContentType = newTextContentType;
@@ -152,7 +155,7 @@ export abstract class EditableTextBase extends EditableTextBaseCommon {
case 'send':
newValue = UIReturnKeyType.Send;
break;
- default:
+ default: {
const rkt = +value;
if (!isNaN(rkt)) {
newValue = rkt;
@@ -160,6 +163,7 @@ export abstract class EditableTextBase extends EditableTextBaseCommon {
newValue = UIKeyboardType.Default;
}
break;
+ }
}
this.nativeTextViewProtected.returnKeyType = newValue;
diff --git a/packages/core/ui/frame/index.android.ts b/packages/core/ui/frame/index.android.ts
index 8d652650ad..1b926728ec 100644
--- a/packages/core/ui/frame/index.android.ts
+++ b/packages/core/ui/frame/index.android.ts
@@ -439,7 +439,7 @@ export class Frame extends FrameBase {
const newFragmentTag = `fragment${fragmentId}[${navDepth}]`;
const newFragment = this.createFragment(newEntry, newFragmentTag);
const transaction = manager.beginTransaction();
- let animated = currentEntry ? this._getIsAnimatedNavigation(newEntry.entry) : false;
+ const animated = currentEntry ? this._getIsAnimatedNavigation(newEntry.entry) : false;
// NOTE: Don't use transition for the initial navigation (same as on iOS)
// On API 21+ transition won't be triggered unless there was at least one
// layout pass so we will wait forever for transitionCompleted handler...
diff --git a/packages/core/ui/frame/index.ios.ts b/packages/core/ui/frame/index.ios.ts
index 60a42befd8..71e4d73e23 100644
--- a/packages/core/ui/frame/index.ios.ts
+++ b/packages/core/ui/frame/index.ios.ts
@@ -84,7 +84,7 @@ export class Frame extends FrameBase {
}
let navigationTransition: NavigationTransition;
- let animated = this.currentPage ? this._getIsAnimatedNavigation(backstackEntry.entry) : false;
+ const animated = this.currentPage ? this._getIsAnimatedNavigation(backstackEntry.entry) : false;
if (animated) {
navigationTransition = this._getNavigationTransition(backstackEntry.entry);
if (navigationTransition) {
@@ -183,7 +183,7 @@ export class Frame extends FrameBase {
}
private pushViewControllerAnimated(viewController: UIViewController, animated: boolean, isModal: boolean) {
- let transitionCoordinator = this._ios.controller.transitionCoordinator;
+ const transitionCoordinator = this._ios.controller.transitionCoordinator;
if (!isModal && transitionCoordinator) {
transitionCoordinator.animateAlongsideTransitionCompletion(null, () => {
this._ios.controller.pushViewControllerAnimated(viewController, animated);
diff --git a/packages/core/ui/layouts/grid-layout/grid-layout-common.ts b/packages/core/ui/layouts/grid-layout/grid-layout-common.ts
index 581bcab04d..0e18444df9 100644
--- a/packages/core/ui/layouts/grid-layout/grid-layout-common.ts
+++ b/packages/core/ui/layouts/grid-layout/grid-layout-common.ts
@@ -78,15 +78,15 @@ export class ItemSpec extends Observable implements ItemSpecDefinition {
private _value: number;
private _unitType: GridUnitType;
- constructor() {
+ constructor(...args) {
super();
- if (arguments.length === 0) {
+ if (args.length === 0) {
this._value = 1;
this._unitType = GridUnitType.STAR;
} else if (arguments.length === 2) {
- const value = arguments[0];
- const type = arguments[1];
+ const value = args[0];
+ const type = args[1];
if (typeof value === 'number' && typeof type === 'string') {
if (value < 0 || isNaN(value) || !isFinite(value)) {
throw new Error(`Value should not be negative, NaN or Infinity: ${value}`);
@@ -381,9 +381,9 @@ rowSpanProperty.register(View);
export type GridUnitType = 'pixel' | 'star' | 'auto';
export namespace GridUnitType {
- export const PIXEL: 'pixel' = 'pixel';
- export const STAR: 'star' = 'star';
- export const AUTO: 'auto' = 'auto';
+ export const PIXEL = 'pixel';
+ export const STAR = 'star';
+ export const AUTO = 'auto';
export const isValid = makeValidator(PIXEL, STAR, AUTO);
export const parse = makeParser(isValid);
}
diff --git a/packages/core/ui/layouts/root-layout/index.android.ts b/packages/core/ui/layouts/root-layout/index.android.ts
index 1d5748d88d..fbb87988c2 100644
--- a/packages/core/ui/layouts/root-layout/index.android.ts
+++ b/packages/core/ui/layouts/root-layout/index.android.ts
@@ -109,7 +109,7 @@ export class RootLayout extends RootLayoutBase {
backgroundColorAnimator.addUpdateListener(
new android.animation.ValueAnimator.AnimatorUpdateListener({
onAnimationUpdate(animator: android.animation.ValueAnimator) {
- let argb = (animator.getAnimatedValue()).intValue();
+ const argb = (animator.getAnimatedValue()).intValue();
view.backgroundColor = new Color(argb);
},
})
diff --git a/packages/core/ui/styling/style-properties.ts b/packages/core/ui/styling/style-properties.ts
index 08da7e6d1b..90e9ad1a6b 100644
--- a/packages/core/ui/styling/style-properties.ts
+++ b/packages/core/ui/styling/style-properties.ts
@@ -734,6 +734,7 @@ function normalizeTransformation({ property, value }: Transformation): Transform
}
function convertTransformValue(property: string, stringValue: string): TransformationValue {
+ /* eslint-disable prefer-const */
let [x, y, z] = stringValue.split(',').map(parseFloat);
if (property === 'translate') {
y ??= IDENTITY_TRANSFORMATION.translate.y;
diff --git a/packages/core/utils/common.ts b/packages/core/utils/common.ts
index 17c3ad4d81..20cadd7a30 100644
--- a/packages/core/utils/common.ts
+++ b/packages/core/utils/common.ts
@@ -159,11 +159,11 @@ export function debounce(fn: any, delay = 300) {
};
}
-export function throttle(fn: any, delay = 300) {
+export function throttle(fn: Function, delay = 300) {
let waiting = false;
- return function () {
+ return function (...args) {
if (!waiting) {
- fn.apply(this, arguments);
+ fn.apply(this, args);
waiting = true;
setTimeout(function () {
waiting = false;
diff --git a/packages/core/utils/native-helper.android.ts b/packages/core/utils/native-helper.android.ts
index 48dadb2c37..3d8339107e 100644
--- a/packages/core/utils/native-helper.android.ts
+++ b/packages/core/utils/native-helper.android.ts
@@ -34,9 +34,10 @@ export function dataDeserialize(nativeData?: any) {
}
case 'org.json.JSONObject': {
store = {};
- let i = nativeData.keys();
+ const i = nativeData.keys();
+ let key;
while (i.hasNext()) {
- let key = i.next();
+ key = i.next();
store[key] = dataDeserialize(nativeData.get(key));
}
break;
diff --git a/packages/core/utils/native-helper.ios.ts b/packages/core/utils/native-helper.ios.ts
index 1b759f4fc4..0c73a9495f 100644
--- a/packages/core/utils/native-helper.ios.ts
+++ b/packages/core/utils/native-helper.ios.ts
@@ -36,8 +36,8 @@ export function dataDeserialize(nativeData?: any) {
case 'NSNull':
return null;
case 'NSMutableDictionary':
- case 'NSDictionary':
- let obj = {};
+ case 'NSDictionary': {
+ const obj = {};
const length = nativeData.count;
const keysArray = nativeData.allKeys as NSArray;
for (let i = 0; i < length; i++) {
@@ -45,14 +45,16 @@ export function dataDeserialize(nativeData?: any) {
obj[nativeKey] = dataDeserialize(nativeData.objectForKey(nativeKey));
}
return obj;
+ }
case 'NSMutableArray':
- case 'NSArray':
- let array = [];
+ case 'NSArray': {
+ const array = [];
const len = nativeData.count;
for (let i = 0; i < len; i++) {
array[i] = dataDeserialize(nativeData.objectAtIndex(i));
}
return array;
+ }
default:
return nativeData;
}
From 32c44fda3b7486ca802783b3d8997b32174dd8c3 Mon Sep 17 00:00:00 2001
From: Nathan Walker
Date: Mon, 9 Jan 2023 10:08:50 -0800
Subject: [PATCH 17/76] release: @nativescript/core 8.4.4
---
CHANGELOG.md | 15 +++++++++++++++
package.json | 2 +-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 39d0964095..7d6f997b30 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,18 @@
+## [8.4.4](https://github.com/NativeScript/NativeScript/compare/8.4.3-core...8.4.4) (2023-01-09)
+
+
+### Bug Fixes
+
+* **android:** openUrl ([#10161](https://github.com/NativeScript/NativeScript/issues/10161)) ([451c3cf](https://github.com/NativeScript/NativeScript/commit/451c3cfe43a90be705bb6cc7abb220e674d1d906))
+* **mac:** utils for mac catalyst ([#10157](https://github.com/NativeScript/NativeScript/issues/10157)) ([5b6e4d6](https://github.com/NativeScript/NativeScript/commit/5b6e4d68986f22219c41f434f2bf51e714e485a5))
+
+
+### Features
+
+* **core:** new autoFillTypes for newUsername, newPassword and oneTimeCode ([#10159](https://github.com/NativeScript/NativeScript/issues/10159)) ([bff35e5](https://github.com/NativeScript/NativeScript/commit/bff35e5163d126d44ae3b2828ed96dbdc6c2e6ef))
+
+
+
## [8.4.3](https://github.com/NativeScript/NativeScript/compare/8.4.2-core...8.4.3-core) (2023-01-04)
diff --git a/package.json b/package.json
index cbcf09a39f..37546cf0cd 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "nativescript",
- "version": "8.4.3",
+ "version": "8.4.4",
"license": "MIT",
"scripts": {
"clean": "git clean -f -X -d --exclude=!.idea/ --exclude=!.vscode/* --exclude=!.npmrc",
From 3c87a59c51e79edf1c34eb36b2d1327fc1e23df0 Mon Sep 17 00:00:00 2001
From: Nathan Walker
Date: Mon, 9 Jan 2023 10:09:49 -0800
Subject: [PATCH 18/76] chore: 8.4.5 next
---
CHANGELOG.md | 2 +-
packages/core/package.json | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7d6f997b30..017dbff6d4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,4 @@
-## [8.4.4](https://github.com/NativeScript/NativeScript/compare/8.4.3-core...8.4.4) (2023-01-09)
+## [8.4.4](https://github.com/NativeScript/NativeScript/compare/8.4.3-core...8.4.4-core) (2023-01-09)
### Bug Fixes
diff --git a/packages/core/package.json b/packages/core/package.json
index 6e12349134..4a2b0bb4f8 100644
--- a/packages/core/package.json
+++ b/packages/core/package.json
@@ -1,6 +1,6 @@
{
"name": "@nativescript/core",
- "version": "8.4.4",
+ "version": "8.4.5",
"description": "A JavaScript library providing an easy to use api for interacting with iOS and Android platform APIs.",
"main": "index",
"types": "index.d.ts",
From a69a9d6921bd1df11b29c9b697bfb847a3885458 Mon Sep 17 00:00:00 2001
From: Nathan Walker
Date: Fri, 13 Jan 2023 18:02:44 -0800
Subject: [PATCH 19/76] fix(ios): embedder usage of window (#10167)
---
packages/core/application/index.ios.ts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/packages/core/application/index.ios.ts b/packages/core/application/index.ios.ts
index 23ab08e053..d00acc3023 100644
--- a/packages/core/application/index.ios.ts
+++ b/packages/core/application/index.ios.ts
@@ -166,7 +166,7 @@ export class iOSApplication implements iOSApplicationDefinition {
get rootController(): UIViewController {
if (NativeScriptEmbedder.sharedInstance().delegate && !this._window) {
- this._window = UIApplication.sharedApplication.delegate.window;
+ this._window = UIApplication.sharedApplication.keyWindow;
}
return this._window.rootViewController;
}
@@ -254,7 +254,7 @@ export class iOSApplication implements iOSApplicationDefinition {
this.setWindowContent(args.root);
}
} else {
- this._window = UIApplication.sharedApplication.delegate.window;
+ this._window = UIApplication.sharedApplication.keyWindow;
}
}
From c9e29aa9af8b4b82cd259f8402fa11af4640f1b4 Mon Sep 17 00:00:00 2001
From: Nathan Walker
Date: Sun, 15 Jan 2023 19:49:28 -0800
Subject: [PATCH 20/76] fix(core): improve loaded/unloaded handling to be
stable and consistent (#10170)
---
packages/core/data/observable/index.ts | 30 +++++-----
packages/core/ui/button/index.ios.ts | 3 +-
packages/core/ui/core/view/index.android.ts | 18 +++---
packages/core/ui/core/view/index.ios.ts | 14 +++--
packages/core/ui/list-picker/index.ios.ts | 15 +----
packages/core/ui/scroll-view/index.android.ts | 55 +++++++++++--------
packages/core/ui/scroll-view/index.ios.ts | 28 +++++++---
.../core/ui/scroll-view/scroll-view-common.ts | 47 ++++------------
packages/core/ui/search-bar/index.ios.ts | 11 +---
packages/core/ui/text-field/index.ios.ts | 12 +---
packages/core/ui/text-view/index.ios.ts | 12 +---
packages/core/ui/web-view/index.ios.ts | 44 +++++++--------
12 files changed, 122 insertions(+), 167 deletions(-)
diff --git a/packages/core/data/observable/index.ts b/packages/core/data/observable/index.ts
index f27f9d08e6..0ad4c63fb2 100644
--- a/packages/core/data/observable/index.ts
+++ b/packages/core/data/observable/index.ts
@@ -291,22 +291,24 @@ export class Observable implements ObservableDefinition {
}
for (let i = observers.length - 1; i >= 0; i--) {
const entry = observers[i];
- if (entry.once) {
- observers.splice(i, 1);
- }
+ if (entry) {
+ if (entry.once) {
+ observers.splice(i, 1);
+ }
- let returnValue;
- if (entry.thisArg) {
- returnValue = entry.callback.apply(entry.thisArg, [data]);
- } else {
- returnValue = entry.callback(data);
- }
+ let returnValue;
+ if (entry.thisArg) {
+ returnValue = entry.callback.apply(entry.thisArg, [data]);
+ } else {
+ returnValue = entry.callback(data);
+ }
- // This ensures errors thrown inside asynchronous functions do not get swallowed
- if (returnValue && returnValue instanceof Promise) {
- returnValue.catch((err) => {
- console.error(err);
- });
+ // This ensures errors thrown inside asynchronous functions do not get swallowed
+ if (returnValue && returnValue instanceof Promise) {
+ returnValue.catch((err) => {
+ console.error(err);
+ });
+ }
}
}
}
diff --git a/packages/core/ui/button/index.ios.ts b/packages/core/ui/button/index.ios.ts
index d27ee24862..c49e812487 100644
--- a/packages/core/ui/button/index.ios.ts
+++ b/packages/core/ui/button/index.ios.ts
@@ -21,9 +21,8 @@ export class Button extends ButtonBase {
public initNativeView(): void {
super.initNativeView();
- const nativeView = this.nativeViewProtected;
this._tapHandler = TapHandlerImpl.initWithOwner(new WeakRef(this));
- nativeView.addTargetActionForControlEvents(this._tapHandler, 'tap', UIControlEvents.TouchUpInside);
+ this.nativeViewProtected.addTargetActionForControlEvents(this._tapHandler, 'tap', UIControlEvents.TouchUpInside);
}
public disposeNativeView(): void {
diff --git a/packages/core/ui/core/view/index.android.ts b/packages/core/ui/core/view/index.android.ts
index 62304fd517..9b785bac67 100644
--- a/packages/core/ui/core/view/index.android.ts
+++ b/packages/core/ui/core/view/index.android.ts
@@ -430,14 +430,6 @@ export class View extends ViewCommon {
@profile
public onUnloaded() {
- if (this.touchListenerIsSet) {
- this.touchListenerIsSet = false;
- if (this.nativeViewProtected) {
- this.nativeViewProtected.setOnTouchListener(null);
- this.nativeViewProtected.setClickable(this._isClickable);
- }
- }
-
this._manager = null;
this._rootManager = null;
super.onUnloaded();
@@ -474,7 +466,6 @@ export class View extends ViewCommon {
public initNativeView(): void {
super.initNativeView();
this._isClickable = this.nativeViewProtected.isClickable();
-
if (this.needsOnLayoutChangeListener()) {
this.setOnLayoutChangeListener();
}
@@ -486,7 +477,12 @@ export class View extends ViewCommon {
public disposeNativeView(): void {
super.disposeNativeView();
-
+ if (this.touchListenerIsSet) {
+ this.touchListenerIsSet = false;
+ if (this.nativeViewProtected) {
+ this.nativeViewProtected.setOnTouchListener(null);
+ }
+ }
if (this.layoutChangeListenerIsSet) {
this.layoutChangeListenerIsSet = false;
this.nativeViewProtected.removeOnLayoutChangeListener(this.layoutChangeListener);
@@ -494,7 +490,7 @@ export class View extends ViewCommon {
}
setOnTouchListener() {
- if (!this.nativeViewProtected || !this.hasGestureObservers()) {
+ if (this.touchListenerIsSet || !this.nativeViewProtected || !this.hasGestureObservers()) {
return;
}
diff --git a/packages/core/ui/core/view/index.ios.ts b/packages/core/ui/core/view/index.ios.ts
index 13f312204a..83dd35c46e 100644
--- a/packages/core/ui/core/view/index.ios.ts
+++ b/packages/core/ui/core/view/index.ios.ts
@@ -479,12 +479,14 @@ export class View extends ViewCommon implements ViewDefinition {
} else {
//use CSS & attribute width & height if option is not provided
const handler = () => {
- const w = (this.width || this.style.width);
- const h = (this.height || this.style.height);
-
- //TODO: only numeric value is supported, percentage value is not supported like Android
- if (w > 0 && h > 0) {
- controller.preferredContentSize = CGSizeMake(w, h);
+ if (controller) {
+ const w = (this.width || this.style.width);
+ const h = (this.height || this.style.height);
+
+ //TODO: only numeric value is supported, percentage value is not supported like Android
+ if (w > 0 && h > 0) {
+ controller.preferredContentSize = CGSizeMake(w, h);
+ }
}
this.off(View.loadedEvent, handler);
diff --git a/packages/core/ui/list-picker/index.ios.ts b/packages/core/ui/list-picker/index.ios.ts
index f8ff8ea7a2..6d6455d248 100644
--- a/packages/core/ui/list-picker/index.ios.ts
+++ b/packages/core/ui/list-picker/index.ios.ts
@@ -17,9 +17,9 @@ export class ListPicker extends ListPickerBase {
initNativeView() {
super.initNativeView();
- const nativeView = this.nativeViewProtected;
- nativeView.dataSource = this._dataSource = ListPickerDataSource.initWithOwner(new WeakRef(this));
+ this.nativeViewProtected.dataSource = this._dataSource = ListPickerDataSource.initWithOwner(new WeakRef(this));
this._delegate = ListPickerDelegateImpl.initWithOwner(new WeakRef(this));
+ this.nativeViewProtected.delegate = this._delegate;
}
public disposeNativeView() {
@@ -33,17 +33,6 @@ export class ListPicker extends ListPickerBase {
return this.nativeViewProtected;
}
- @profile
- public onLoaded() {
- super.onLoaded();
- this.ios.delegate = this._delegate;
- }
-
- public onUnloaded() {
- this.ios.delegate = null;
- super.onUnloaded();
- }
-
[selectedIndexProperty.getDefault](): number {
return -1;
}
diff --git a/packages/core/ui/scroll-view/index.android.ts b/packages/core/ui/scroll-view/index.android.ts
index 9ec97d9652..9d798ed616 100644
--- a/packages/core/ui/scroll-view/index.android.ts
+++ b/packages/core/ui/scroll-view/index.android.ts
@@ -118,17 +118,10 @@ export class ScrollView extends ScrollViewBase {
this.nativeViewProtected.setId(this._androidViewId);
}
- public _onOrientationChanged() {
- if (this.nativeViewProtected) {
- const parent = this.parent;
- if (parent) {
- parent._removeView(this);
- parent._addView(this);
- }
+ protected addNativeListener() {
+ if (!this.nativeViewProtected) {
+ return;
}
- }
-
- protected attachNative() {
const that = new WeakRef(this);
if (this.orientation === 'vertical') {
this.scrollChangeHandler = new androidx.core.widget.NestedScrollView.OnScrollChangeListener({
@@ -144,7 +137,7 @@ export class ScrollView extends ScrollViewBase {
}
},
});
- this.nativeView.setOnScrollChangeListener(this.scrollChangeHandler);
+ this.nativeViewProtected.setOnScrollChangeListener(this.scrollChangeHandler);
} else {
this.handler = new android.view.ViewTreeObserver.OnScrollChangedListener({
onScrollChanged: function () {
@@ -158,6 +151,35 @@ export class ScrollView extends ScrollViewBase {
}
}
+ protected removeNativeListener() {
+ if (!this.nativeViewProtected) {
+ return;
+ }
+ if (this.handler) {
+ this.nativeViewProtected?.getViewTreeObserver().removeOnScrollChangedListener(this.handler);
+ this.handler = null;
+ }
+ if (this.scrollChangeHandler) {
+ this.nativeView?.setOnScrollChangeListener(null);
+ this.scrollChangeHandler = null;
+ }
+ }
+
+ disposeNativeView() {
+ super.disposeNativeView();
+ this.removeNativeListener();
+ }
+
+ public _onOrientationChanged() {
+ if (this.nativeViewProtected) {
+ const parent = this.parent;
+ if (parent) {
+ parent._removeView(this);
+ parent._addView(this);
+ }
+ }
+ }
+
private _lastScrollX = -1;
private _lastScrollY = -1;
private _onScrollChanged() {
@@ -179,17 +201,6 @@ export class ScrollView extends ScrollViewBase {
}
}
}
-
- protected dettachNative() {
- if (this.handler) {
- this.nativeViewProtected?.getViewTreeObserver().removeOnScrollChangedListener(this.handler);
- this.handler = null;
- }
- if (this.scrollChangeHandler) {
- this.nativeView?.setOnScrollChangeListener(null);
- this.scrollChangeHandler = null;
- }
- }
}
ScrollView.prototype.recycleNativeView = 'never';
diff --git a/packages/core/ui/scroll-view/index.ios.ts b/packages/core/ui/scroll-view/index.ios.ts
index cab5f14c43..9b8c48cd7b 100644
--- a/packages/core/ui/scroll-view/index.ios.ts
+++ b/packages/core/ui/scroll-view/index.ios.ts
@@ -40,9 +40,7 @@ export class ScrollView extends ScrollViewBase {
private _delegate: UIScrollViewDelegateImpl;
public createNativeView() {
- const view = UIScrollView.new();
-
- return view;
+ return UIScrollView.new();
}
initNativeView() {
@@ -51,20 +49,34 @@ export class ScrollView extends ScrollViewBase {
this._setNativeClipToBounds();
}
- _setNativeClipToBounds() {
- // Always set clipsToBounds for scroll-view
- this.nativeViewProtected.clipsToBounds = true;
+ disposeNativeView() {
+ this._delegate = null;
+ super.disposeNativeView();
}
- protected attachNative() {
+ protected addNativeListener() {
+ if (!this.nativeViewProtected) {
+ return;
+ }
this._delegate = UIScrollViewDelegateImpl.initWithOwner(new WeakRef(this));
this.nativeViewProtected.delegate = this._delegate;
}
- protected dettachNative() {
+ protected removeNativeListener() {
+ if (!this.nativeViewProtected) {
+ return;
+ }
this.nativeViewProtected.delegate = null;
}
+ _setNativeClipToBounds() {
+ if (!this.nativeViewProtected) {
+ return;
+ }
+ // Always set clipsToBounds for scroll-view
+ this.nativeViewProtected.clipsToBounds = true;
+ }
+
protected updateScrollBarVisibility(value) {
if (!this.nativeViewProtected) {
return;
diff --git a/packages/core/ui/scroll-view/scroll-view-common.ts b/packages/core/ui/scroll-view/scroll-view-common.ts
index 3e25fb0986..bd8e1af32c 100644
--- a/packages/core/ui/scroll-view/scroll-view-common.ts
+++ b/packages/core/ui/scroll-view/scroll-view-common.ts
@@ -9,7 +9,7 @@ import { CoreTypes } from '../../core-types';
@CSSType('ScrollView')
export abstract class ScrollViewBase extends ContentView implements ScrollViewDefinition {
- private _scrollChangeCount = 0;
+ private _addedScrollEvent = false;
public static scrollEvent = 'scroll';
public orientation: CoreTypes.OrientationType;
@@ -19,52 +19,27 @@ export abstract class ScrollViewBase extends ContentView implements ScrollViewDe
public addEventListener(arg: string, callback: any, thisArg?: any) {
super.addEventListener(arg, callback, thisArg);
- if (arg === ScrollViewBase.scrollEvent) {
- this._scrollChangeCount++;
- this.attach();
+ if (arg === ScrollViewBase.scrollEvent && !this._addedScrollEvent) {
+ this._addedScrollEvent = true;
+ this.addNativeListener();
}
}
public removeEventListener(arg: string, callback: any, thisArg?: any) {
super.removeEventListener(arg, callback, thisArg);
- if (arg === ScrollViewBase.scrollEvent) {
- this._scrollChangeCount--;
- this.dettach();
+ if (arg === ScrollViewBase.scrollEvent && this._addedScrollEvent) {
+ this._addedScrollEvent = false;
+ this.removeNativeListener();
}
}
- @profile
- public onLoaded() {
- super.onLoaded();
-
- this.attach();
- }
-
- public onUnloaded() {
- super.onUnloaded();
-
- this.dettach();
- }
-
- private attach() {
- if (this._scrollChangeCount > 0 && this.isLoaded) {
- this.attachNative();
- }
- }
-
- private dettach() {
- if (this._scrollChangeCount === 0 && this.isLoaded) {
- this.dettachNative();
- }
- }
-
- protected attachNative() {
- //
+ protected addNativeListener() {
+ // implemented per platform
}
- protected dettachNative() {
- //
+ protected removeNativeListener() {
+ // implemented per platform
}
get horizontalOffset(): number {
diff --git a/packages/core/ui/search-bar/index.ios.ts b/packages/core/ui/search-bar/index.ios.ts
index 429a47d52d..051d4d8b7d 100644
--- a/packages/core/ui/search-bar/index.ios.ts
+++ b/packages/core/ui/search-bar/index.ios.ts
@@ -82,6 +82,7 @@ export class SearchBar extends SearchBarBase {
initNativeView() {
super.initNativeView();
this._delegate = UISearchBarDelegateImpl.initWithOwner(new WeakRef(this));
+ this.nativeViewProtected.delegate = this._delegate;
}
disposeNativeView() {
@@ -89,16 +90,6 @@ export class SearchBar extends SearchBarBase {
super.disposeNativeView();
}
- public onLoaded() {
- super.onLoaded();
- this.ios.delegate = this._delegate;
- }
-
- public onUnloaded() {
- this.ios.delegate = null;
- super.onUnloaded();
- }
-
public dismissSoftInput() {
(this.ios).resignFirstResponder();
}
diff --git a/packages/core/ui/text-field/index.ios.ts b/packages/core/ui/text-field/index.ios.ts
index 5d08897b2c..57ec452484 100644
--- a/packages/core/ui/text-field/index.ios.ts
+++ b/packages/core/ui/text-field/index.ios.ts
@@ -123,6 +123,7 @@ export class TextField extends TextFieldBase {
initNativeView() {
super.initNativeView();
this._delegate = UITextFieldDelegateImpl.initWithOwner(new WeakRef(this));
+ this.nativeViewProtected.delegate = this._delegate;
}
disposeNativeView() {
@@ -130,17 +131,6 @@ export class TextField extends TextFieldBase {
super.disposeNativeView();
}
- @profile
- public onLoaded() {
- super.onLoaded();
- this.ios.delegate = this._delegate;
- }
-
- public onUnloaded() {
- this.ios.delegate = null;
- super.onUnloaded();
- }
-
// @ts-ignore
get ios(): UITextField {
return this.nativeViewProtected;
diff --git a/packages/core/ui/text-view/index.ios.ts b/packages/core/ui/text-view/index.ios.ts
index ff4fc5f967..7b44166d6d 100644
--- a/packages/core/ui/text-view/index.ios.ts
+++ b/packages/core/ui/text-view/index.ios.ts
@@ -106,6 +106,7 @@ export class TextView extends TextViewBaseCommon {
initNativeView() {
super.initNativeView();
this._delegate = UITextViewDelegateImpl.initWithOwner(new WeakRef(this));
+ this.nativeTextViewProtected.delegate = this._delegate;
}
disposeNativeView() {
@@ -113,17 +114,6 @@ export class TextView extends TextViewBaseCommon {
super.disposeNativeView();
}
- @profile
- public onLoaded() {
- super.onLoaded();
- this.nativeTextViewProtected.delegate = this._delegate;
- }
-
- public onUnloaded() {
- this.nativeTextViewProtected.delegate = null;
- super.onUnloaded();
- }
-
// @ts-ignore
get ios(): UITextView {
return this.nativeViewProtected;
diff --git a/packages/core/ui/web-view/index.ios.ts b/packages/core/ui/web-view/index.ios.ts
index d3033f1286..5c7baf75a8 100644
--- a/packages/core/ui/web-view/index.ios.ts
+++ b/packages/core/ui/web-view/index.ios.ts
@@ -202,18 +202,16 @@ export class WebView extends WebViewBase {
this._delegate = WKNavigationDelegateImpl.initWithOwner(new WeakRef(this));
this._scrollDelegate = UIScrollViewDelegateImpl.initWithOwner(new WeakRef(this));
this._uiDelegate = WKUIDelegateImpl.initWithOwner(new WeakRef(this));
- this.ios.navigationDelegate = this._delegate;
- this.ios.scrollView.delegate = this._scrollDelegate;
- this.ios.UIDelegate = this._uiDelegate;
+ this.nativeViewProtected.navigationDelegate = this._delegate;
+ this.nativeViewProtected.scrollView.delegate = this._scrollDelegate;
+ this.nativeViewProtected.UIDelegate = this._uiDelegate;
}
- @profile
- public onLoaded() {
- super.onLoaded();
- }
-
- public onUnloaded() {
- super.onUnloaded();
+ disposeNativeView() {
+ super.disposeNativeView();
+ this._delegate = null;
+ this._scrollDelegate = null;
+ this._uiDelegate = null;
}
// @ts-ignore
@@ -222,48 +220,48 @@ export class WebView extends WebViewBase {
}
public stopLoading() {
- this.ios.stopLoading();
+ this.nativeViewProtected.stopLoading();
}
public _loadUrl(src: string) {
if (src.startsWith('file:///')) {
const cachePath = src.substring(0, src.lastIndexOf('/'));
- this.ios.loadFileURLAllowingReadAccessToURL(NSURL.URLWithString(src), NSURL.URLWithString(cachePath));
+ this.nativeViewProtected.loadFileURLAllowingReadAccessToURL(NSURL.URLWithString(src), NSURL.URLWithString(cachePath));
} else {
- this.ios.loadRequest(NSURLRequest.requestWithURL(NSURL.URLWithString(src)));
+ this.nativeViewProtected.loadRequest(NSURLRequest.requestWithURL(NSURL.URLWithString(src)));
}
}
public _loadData(content: string) {
- this.ios.loadHTMLStringBaseURL(content, NSURL.alloc().initWithString(`file:///${knownFolders.currentApp().path}/`));
+ this.nativeViewProtected.loadHTMLStringBaseURL(content, NSURL.alloc().initWithString(`file:///${knownFolders.currentApp().path}/`));
}
get canGoBack(): boolean {
- return this.ios.canGoBack;
+ return this.nativeViewProtected.canGoBack;
}
get canGoForward(): boolean {
- return this.ios.canGoForward;
+ return this.nativeViewProtected.canGoForward;
}
public goBack() {
- this.ios.goBack();
+ this.nativeViewProtected.goBack();
}
public goForward() {
- this.ios.goForward();
+ this.nativeViewProtected.goForward();
}
public reload() {
- this.ios.reload();
+ this.nativeViewProtected.reload();
}
[disableZoomProperty.setNative](value: boolean) {
if (!value && typeof this._minimumZoomScale === 'number' && typeof this._maximumZoomScale === 'number' && typeof this._zoomScale === 'number') {
- if (this.ios.scrollView) {
- this.ios.scrollView.minimumZoomScale = this._minimumZoomScale;
- this.ios.scrollView.maximumZoomScale = this._maximumZoomScale;
- this.ios.scrollView.zoomScale = this._zoomScale;
+ if (this.nativeViewProtected?.scrollView) {
+ this.nativeViewProtected.scrollView.minimumZoomScale = this._minimumZoomScale;
+ this.nativeViewProtected.scrollView.maximumZoomScale = this._maximumZoomScale;
+ this.nativeViewProtected.scrollView.zoomScale = this._zoomScale;
this._minimumZoomScale = undefined;
this._maximumZoomScale = undefined;
this._zoomScale = undefined;
From 18b911ed84173928d1d0cfc91be605e046a7e3d1 Mon Sep 17 00:00:00 2001
From: Nathan Walker
Date: Mon, 16 Jan 2023 11:41:04 -0800
Subject: [PATCH 21/76] fix(core): improve loaded/unloaded handling
---
packages/core/ui/action-bar/index.android.ts | 4 +++-
packages/core/ui/button/index.android.ts | 2 +-
packages/core/ui/core/view/index.android.ts | 7 +++++--
packages/core/ui/date-picker/index.android.ts | 4 +++-
packages/core/ui/image/index.android.ts | 4 +++-
packages/core/ui/image/index.ios.ts | 3 +--
.../ui/layouts/root-layout/index.android.ts | 18 ++++++++++--------
packages/core/ui/list-picker/index.android.ts | 8 ++++++--
packages/core/ui/list-view/index.android.ts | 8 ++++++--
packages/core/ui/scroll-view/index.android.ts | 2 +-
packages/core/ui/scroll-view/index.ios.ts | 1 +
packages/core/ui/search-bar/index.android.ts | 8 ++++++--
.../core/ui/segmented-bar/index.android.ts | 4 +++-
packages/core/ui/switch/index.android.ts | 4 +++-
packages/core/ui/tab-view/index.android.ts | 2 +-
packages/core/ui/web-view/index.android.ts | 4 +++-
packages/core/ui/web-view/index.ios.ts | 2 +-
17 files changed, 57 insertions(+), 28 deletions(-)
diff --git a/packages/core/ui/action-bar/index.android.ts b/packages/core/ui/action-bar/index.android.ts
index 7cb7b7ace2..9b41268863 100644
--- a/packages/core/ui/action-bar/index.android.ts
+++ b/packages/core/ui/action-bar/index.android.ts
@@ -177,7 +177,9 @@ export class ActionBar extends ActionBarBase {
}
public disposeNativeView() {
- (this.nativeViewProtected).menuItemClickListener.owner = null;
+ if ((this.nativeViewProtected)?.menuItemClickListener) {
+ (this.nativeViewProtected).menuItemClickListener.owner = null;
+ }
super.disposeNativeView();
}
diff --git a/packages/core/ui/button/index.android.ts b/packages/core/ui/button/index.android.ts
index 4099c24a86..097efc7341 100644
--- a/packages/core/ui/button/index.android.ts
+++ b/packages/core/ui/button/index.android.ts
@@ -95,7 +95,7 @@ export class Button extends ButtonBase {
}
public disposeNativeView() {
- if (this.nativeViewProtected) {
+ if ((this.nativeViewProtected)?.clickListener) {
(this.nativeViewProtected).clickListener.owner = null;
}
super.disposeNativeView();
diff --git a/packages/core/ui/core/view/index.android.ts b/packages/core/ui/core/view/index.android.ts
index 9b785bac67..af560c1011 100644
--- a/packages/core/ui/core/view/index.android.ts
+++ b/packages/core/ui/core/view/index.android.ts
@@ -476,7 +476,6 @@ export class View extends ViewCommon {
}
public disposeNativeView(): void {
- super.disposeNativeView();
if (this.touchListenerIsSet) {
this.touchListenerIsSet = false;
if (this.nativeViewProtected) {
@@ -485,8 +484,12 @@ export class View extends ViewCommon {
}
if (this.layoutChangeListenerIsSet) {
this.layoutChangeListenerIsSet = false;
- this.nativeViewProtected.removeOnLayoutChangeListener(this.layoutChangeListener);
+ if (this.nativeViewProtected) {
+ this.nativeViewProtected.removeOnLayoutChangeListener(this.layoutChangeListener);
+ this.layoutChangeListener = null;
+ }
}
+ super.disposeNativeView();
}
setOnTouchListener() {
diff --git a/packages/core/ui/date-picker/index.android.ts b/packages/core/ui/date-picker/index.android.ts
index c0bed9e73e..a90073fce1 100644
--- a/packages/core/ui/date-picker/index.android.ts
+++ b/packages/core/ui/date-picker/index.android.ts
@@ -91,7 +91,9 @@ export class DatePicker extends DatePickerBase {
if (this.timePicker) {
this.timePicker.disposeNativeView();
}
- (this.nativeViewProtected).listener.owner = null;
+ if ((this.nativeViewProtected)?.listener) {
+ (this.nativeViewProtected).listener.owner = null;
+ }
super.disposeNativeView();
}
diff --git a/packages/core/ui/image/index.android.ts b/packages/core/ui/image/index.android.ts
index 744ada369f..657dcb56f7 100644
--- a/packages/core/ui/image/index.android.ts
+++ b/packages/core/ui/image/index.android.ts
@@ -67,7 +67,9 @@ export class Image extends ImageBase {
}
public disposeNativeView() {
- (this.nativeViewProtected).listener.owner = null;
+ if ((this.nativeViewProtected)?.listener) {
+ (this.nativeViewProtected).listener.owner = null;
+ }
super.disposeNativeView();
}
diff --git a/packages/core/ui/image/index.ios.ts b/packages/core/ui/image/index.ios.ts
index 60ed145750..49e0675a20 100644
--- a/packages/core/ui/image/index.ios.ts
+++ b/packages/core/ui/image/index.ios.ts
@@ -39,13 +39,12 @@ export class Image extends ImageBase {
}
public disposeNativeView(): void {
- super.disposeNativeView();
-
if (this.nativeViewProtected?.image) {
this.nativeViewProtected.image = null;
}
this.disposeImageSource();
+ super.disposeNativeView();
}
private setTintColor(value: Color) {
diff --git a/packages/core/ui/layouts/root-layout/index.android.ts b/packages/core/ui/layouts/root-layout/index.android.ts
index fbb87988c2..e043f57fd8 100644
--- a/packages/core/ui/layouts/root-layout/index.android.ts
+++ b/packages/core/ui/layouts/root-layout/index.android.ts
@@ -16,17 +16,19 @@ export class RootLayout extends RootLayoutBase {
super.insertChild(view, atIndex);
if (!view.hasGestureObservers()) {
// block tap events from going through to layers behind the view
- view.nativeViewProtected.setOnTouchListener(
- new android.view.View.OnTouchListener({
- onTouch: function (view, event) {
- return true;
- },
- })
- );
+ if (view.nativeViewProtected) {
+ view.nativeViewProtected.setOnTouchListener(
+ new android.view.View.OnTouchListener({
+ onTouch: function (view, event) {
+ return true;
+ },
+ })
+ );
+ }
}
}
removeChild(view: View): void {
- if (view.hasGestureObservers()) {
+ if (view.hasGestureObservers() && view.nativeViewProtected) {
view.nativeViewProtected.setOnTouchListener(null);
}
super.removeChild(view);
diff --git a/packages/core/ui/list-picker/index.android.ts b/packages/core/ui/list-picker/index.android.ts
index 8313fb4184..cd4332d42f 100644
--- a/packages/core/ui/list-picker/index.android.ts
+++ b/packages/core/ui/list-picker/index.android.ts
@@ -131,8 +131,12 @@ export class ListPicker extends ListPickerBase {
public disposeNativeView() {
const nativeView = this.nativeViewProtected;
- (nativeView).formatter.owner = null;
- (nativeView).valueChangedListener.owner = null;
+ if ((nativeView)?.formatter) {
+ (nativeView).formatter.owner = null;
+ }
+ if ((nativeView)?.valueChangedListener) {
+ (nativeView).valueChangedListener.owner = null;
+ }
super.disposeNativeView();
}
diff --git a/packages/core/ui/list-view/index.android.ts b/packages/core/ui/list-view/index.android.ts
index 4da3a07b4e..bd48a8a7cd 100644
--- a/packages/core/ui/list-view/index.android.ts
+++ b/packages/core/ui/list-view/index.android.ts
@@ -153,8 +153,12 @@ export class ListView extends ListViewBase {
public disposeNativeView() {
const nativeView = this.nativeViewProtected;
nativeView.setAdapter(null);
- (nativeView).itemClickListener.owner = null;
- (nativeView).adapter.owner = null;
+ if ((nativeView).itemClickListener) {
+ (nativeView).itemClickListener.owner = null;
+ }
+ if ((nativeView).adapter) {
+ (nativeView).adapter.owner = null;
+ }
this.clearRealizedCells();
super.disposeNativeView();
}
diff --git a/packages/core/ui/scroll-view/index.android.ts b/packages/core/ui/scroll-view/index.android.ts
index 9d798ed616..7bcf6876d5 100644
--- a/packages/core/ui/scroll-view/index.android.ts
+++ b/packages/core/ui/scroll-view/index.android.ts
@@ -166,8 +166,8 @@ export class ScrollView extends ScrollViewBase {
}
disposeNativeView() {
- super.disposeNativeView();
this.removeNativeListener();
+ super.disposeNativeView();
}
public _onOrientationChanged() {
diff --git a/packages/core/ui/scroll-view/index.ios.ts b/packages/core/ui/scroll-view/index.ios.ts
index 9b8c48cd7b..95ef2cb7ce 100644
--- a/packages/core/ui/scroll-view/index.ios.ts
+++ b/packages/core/ui/scroll-view/index.ios.ts
@@ -50,6 +50,7 @@ export class ScrollView extends ScrollViewBase {
}
disposeNativeView() {
+ this.removeNativeListener();
this._delegate = null;
super.disposeNativeView();
}
diff --git a/packages/core/ui/search-bar/index.android.ts b/packages/core/ui/search-bar/index.android.ts
index 8a2cdd3834..dead0caf69 100644
--- a/packages/core/ui/search-bar/index.android.ts
+++ b/packages/core/ui/search-bar/index.android.ts
@@ -150,8 +150,12 @@ export class SearchBar extends SearchBarBase {
public disposeNativeView() {
const nativeView: any = this.nativeViewProtected;
- nativeView.closeListener.owner = null;
- nativeView.queryTextListener.owner = null;
+ if (nativeView.closeListener) {
+ nativeView.closeListener.owner = null;
+ }
+ if (nativeView.queryTextListener) {
+ nativeView.queryTextListener.owner = null;
+ }
this._searchPlate = null;
this._searchTextView = null;
super.disposeNativeView();
diff --git a/packages/core/ui/segmented-bar/index.android.ts b/packages/core/ui/segmented-bar/index.android.ts
index bc05883303..fda7afcf0f 100644
--- a/packages/core/ui/segmented-bar/index.android.ts
+++ b/packages/core/ui/segmented-bar/index.android.ts
@@ -238,7 +238,9 @@ export class SegmentedBar extends SegmentedBarBase {
public disposeNativeView() {
const nativeView: any = this.nativeViewProtected;
- nativeView.listener.owner = null;
+ if (nativeView?.listener) {
+ nativeView.listener.owner = null;
+ }
super.disposeNativeView();
}
diff --git a/packages/core/ui/switch/index.android.ts b/packages/core/ui/switch/index.android.ts
index bcf2805b5e..1f9670a66d 100644
--- a/packages/core/ui/switch/index.android.ts
+++ b/packages/core/ui/switch/index.android.ts
@@ -52,7 +52,9 @@ export class Switch extends SwitchBase {
public disposeNativeView() {
const nativeView: any = this.nativeViewProtected;
- nativeView.listener.owner = null;
+ if (nativeView.listener) {
+ nativeView.listener.owner = null;
+ }
super.disposeNativeView();
}
diff --git a/packages/core/ui/tab-view/index.android.ts b/packages/core/ui/tab-view/index.android.ts
index 9c012d760a..d25cf0828a 100644
--- a/packages/core/ui/tab-view/index.android.ts
+++ b/packages/core/ui/tab-view/index.android.ts
@@ -350,8 +350,8 @@ export class TabViewItem extends TabViewItemBase {
}
public disposeNativeView(): void {
- super.disposeNativeView();
(this).canBeLoaded = false;
+ super.disposeNativeView();
}
public createNativeView() {
diff --git a/packages/core/ui/web-view/index.android.ts b/packages/core/ui/web-view/index.android.ts
index b302d837de..ea1617fe4b 100644
--- a/packages/core/ui/web-view/index.android.ts
+++ b/packages/core/ui/web-view/index.android.ts
@@ -123,10 +123,12 @@ export class WebView extends WebViewBase {
public disposeNativeView() {
const nativeView = this.nativeViewProtected;
if (nativeView) {
+ if ((nativeView).client) {
+ (nativeView).client.owner = null;
+ }
nativeView.destroy();
}
- (nativeView).client.owner = null;
super.disposeNativeView();
}
diff --git a/packages/core/ui/web-view/index.ios.ts b/packages/core/ui/web-view/index.ios.ts
index 5c7baf75a8..9e8f4acc24 100644
--- a/packages/core/ui/web-view/index.ios.ts
+++ b/packages/core/ui/web-view/index.ios.ts
@@ -208,10 +208,10 @@ export class WebView extends WebViewBase {
}
disposeNativeView() {
- super.disposeNativeView();
this._delegate = null;
this._scrollDelegate = null;
this._uiDelegate = null;
+ super.disposeNativeView();
}
// @ts-ignore
From 645540d010a4a03150bf38fffd802b3a872f8443 Mon Sep 17 00:00:00 2001
From: Nathan Walker
Date: Mon, 16 Jan 2023 15:38:03 -0800
Subject: [PATCH 22/76] release: @nativescript/core 8.4.5
---
CHANGELOG.md | 11 +++++++++++
package.json | 2 +-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 017dbff6d4..415f179f6d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,14 @@
+## [8.4.5](https://github.com/NativeScript/NativeScript/compare/8.4.4-core...8.4.5-core) (2023-01-16)
+
+
+### Bug Fixes
+
+* **core:** improve loaded/unloaded handling ([18b911e](https://github.com/NativeScript/NativeScript/commit/18b911ed84173928d1d0cfc91be605e046a7e3d1))
+* **core:** improve loaded/unloaded handling to be stable and consistent ([#10170](https://github.com/NativeScript/NativeScript/issues/10170)) ([c9e29aa](https://github.com/NativeScript/NativeScript/commit/c9e29aa9af8b4b82cd259f8402fa11af4640f1b4))
+* **ios:** embedder usage of window ([#10167](https://github.com/NativeScript/NativeScript/issues/10167)) ([a69a9d6](https://github.com/NativeScript/NativeScript/commit/a69a9d6921bd1df11b29c9b697bfb847a3885458))
+
+
+
## [8.4.4](https://github.com/NativeScript/NativeScript/compare/8.4.3-core...8.4.4-core) (2023-01-09)
diff --git a/package.json b/package.json
index 37546cf0cd..f88071309b 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "nativescript",
- "version": "8.4.4",
+ "version": "8.4.5",
"license": "MIT",
"scripts": {
"clean": "git clean -f -X -d --exclude=!.idea/ --exclude=!.vscode/* --exclude=!.npmrc",
From 7993de51b34ccc57958600fe13481865dd4bc6ca Mon Sep 17 00:00:00 2001
From: Nathan Walker
Date: Mon, 16 Jan 2023 15:38:45 -0800
Subject: [PATCH 23/76] chore: 8.4.6 next
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index f88071309b..0d009f639c 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "nativescript",
- "version": "8.4.5",
+ "version": "8.4.6",
"license": "MIT",
"scripts": {
"clean": "git clean -f -X -d --exclude=!.idea/ --exclude=!.vscode/* --exclude=!.npmrc",
From 75821ead07dc69ffeb82c6bd6d6992095ee4fed1 Mon Sep 17 00:00:00 2001
From: Nathan Walker
Date: Thu, 19 Jan 2023 12:28:56 -0800
Subject: [PATCH 24/76] fix(core): ScrollView event wiring sequencing
improvement (#10178)
---
apps/toolbox/src/main-page.xml | 1 +
apps/toolbox/src/pages/scroll-view.ts | 26 +++++++
apps/toolbox/src/pages/scroll-view.xml | 14 ++++
packages/core/ui/scroll-view/index.android.ts | 69 +++++--------------
packages/core/ui/scroll-view/index.ios.ts | 24 +++----
.../core/ui/scroll-view/scroll-view-common.ts | 46 ++++++++++---
6 files changed, 106 insertions(+), 74 deletions(-)
create mode 100644 apps/toolbox/src/pages/scroll-view.ts
create mode 100644 apps/toolbox/src/pages/scroll-view.xml
diff --git a/apps/toolbox/src/main-page.xml b/apps/toolbox/src/main-page.xml
index d4d7766e82..5f8c600f1d 100644
--- a/apps/toolbox/src/main-page.xml
+++ b/apps/toolbox/src/main-page.xml
@@ -16,6 +16,7 @@
+
diff --git a/apps/toolbox/src/pages/scroll-view.ts b/apps/toolbox/src/pages/scroll-view.ts
new file mode 100644
index 0000000000..17713a2008
--- /dev/null
+++ b/apps/toolbox/src/pages/scroll-view.ts
@@ -0,0 +1,26 @@
+import { Observable, EventData, Page, ScrollEventData } from '@nativescript/core';
+
+let page: Page;
+
+export function navigatingTo(args: EventData) {
+ page = args.object;
+ page.bindingContext = new ScrollViewModel();
+}
+
+export class ScrollViewModel extends Observable {
+ longText = `The standard Lorem Ipsum passage, used since the 1500s
+ "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
+
+ Section 1.10.32 of "de Finibus Bonorum et Malorum", written by Cicero in 45 BC
+ "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?"
+
+ 1914 translation by H. Rackham
+ "But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?"
+
+ Section 1.10.33 of "de Finibus Bonorum et Malorum", written by Cicero in 45 BC
+ "At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat."`;
+
+ scroll(args: ScrollEventData) {
+ console.log('scroll:', args.scrollY);
+ }
+}
diff --git a/apps/toolbox/src/pages/scroll-view.xml b/apps/toolbox/src/pages/scroll-view.xml
new file mode 100644
index 0000000000..0c976a713b
--- /dev/null
+++ b/apps/toolbox/src/pages/scroll-view.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/packages/core/ui/scroll-view/index.android.ts b/packages/core/ui/scroll-view/index.android.ts
index 7bcf6876d5..153fdbc500 100644
--- a/packages/core/ui/scroll-view/index.android.ts
+++ b/packages/core/ui/scroll-view/index.android.ts
@@ -118,65 +118,29 @@ export class ScrollView extends ScrollViewBase {
this.nativeViewProtected.setId(this._androidViewId);
}
- protected addNativeListener() {
- if (!this.nativeViewProtected) {
- return;
+ public _onOrientationChanged() {
+ if (this.nativeViewProtected) {
+ const parent = this.parent;
+ if (parent) {
+ parent._removeView(this);
+ parent._addView(this);
+ }
}
- const that = new WeakRef(this);
- if (this.orientation === 'vertical') {
- this.scrollChangeHandler = new androidx.core.widget.NestedScrollView.OnScrollChangeListener({
- onScrollChange(view, scrollX, scrollY) {
- const owner: ScrollView = that?.get();
- if (owner) {
- owner.notify({
- object: owner,
- eventName: ScrollView.scrollEvent,
- scrollX: layout.toDeviceIndependentPixels(scrollX),
- scrollY: layout.toDeviceIndependentPixels(scrollY),
- });
- }
- },
- });
- this.nativeViewProtected.setOnScrollChangeListener(this.scrollChangeHandler);
- } else {
+ }
+
+ protected attachNative() {
+ if (!this.handler) {
+ const that = new WeakRef(this);
this.handler = new android.view.ViewTreeObserver.OnScrollChangedListener({
onScrollChanged: function () {
- const owner: ScrollView = that?.get();
+ const owner: ScrollView = that.get();
if (owner) {
owner._onScrollChanged();
}
},
});
- this.nativeViewProtected.getViewTreeObserver().addOnScrollChangedListener(this.handler);
- }
- }
- protected removeNativeListener() {
- if (!this.nativeViewProtected) {
- return;
- }
- if (this.handler) {
- this.nativeViewProtected?.getViewTreeObserver().removeOnScrollChangedListener(this.handler);
- this.handler = null;
- }
- if (this.scrollChangeHandler) {
- this.nativeView?.setOnScrollChangeListener(null);
- this.scrollChangeHandler = null;
- }
- }
-
- disposeNativeView() {
- this.removeNativeListener();
- super.disposeNativeView();
- }
-
- public _onOrientationChanged() {
- if (this.nativeViewProtected) {
- const parent = this.parent;
- if (parent) {
- parent._removeView(this);
- parent._addView(this);
- }
+ this.nativeViewProtected.getViewTreeObserver().addOnScrollChangedListener(this.handler);
}
}
@@ -201,6 +165,11 @@ export class ScrollView extends ScrollViewBase {
}
}
}
+
+ protected dettachNative() {
+ this.nativeViewProtected.getViewTreeObserver().removeOnScrollChangedListener(this.handler);
+ this.handler = null;
+ }
}
ScrollView.prototype.recycleNativeView = 'never';
diff --git a/packages/core/ui/scroll-view/index.ios.ts b/packages/core/ui/scroll-view/index.ios.ts
index 95ef2cb7ce..c374e74a1f 100644
--- a/packages/core/ui/scroll-view/index.ios.ts
+++ b/packages/core/ui/scroll-view/index.ios.ts
@@ -50,32 +50,30 @@ export class ScrollView extends ScrollViewBase {
}
disposeNativeView() {
- this.removeNativeListener();
+ this.dettachNative();
this._delegate = null;
super.disposeNativeView();
}
- protected addNativeListener() {
+ _setNativeClipToBounds() {
if (!this.nativeViewProtected) {
return;
}
- this._delegate = UIScrollViewDelegateImpl.initWithOwner(new WeakRef(this));
- this.nativeViewProtected.delegate = this._delegate;
+ // Always set clipsToBounds for scroll-view
+ this.nativeViewProtected.clipsToBounds = true;
}
- protected removeNativeListener() {
- if (!this.nativeViewProtected) {
- return;
+ protected attachNative() {
+ if (!this._delegate) {
+ this._delegate = UIScrollViewDelegateImpl.initWithOwner(new WeakRef(this));
+ this.nativeViewProtected.delegate = this._delegate;
}
- this.nativeViewProtected.delegate = null;
}
- _setNativeClipToBounds() {
- if (!this.nativeViewProtected) {
- return;
+ protected dettachNative() {
+ if (this.nativeViewProtected) {
+ this.nativeViewProtected.delegate = null;
}
- // Always set clipsToBounds for scroll-view
- this.nativeViewProtected.clipsToBounds = true;
}
protected updateScrollBarVisibility(value) {
diff --git a/packages/core/ui/scroll-view/scroll-view-common.ts b/packages/core/ui/scroll-view/scroll-view-common.ts
index bd8e1af32c..774d05b569 100644
--- a/packages/core/ui/scroll-view/scroll-view-common.ts
+++ b/packages/core/ui/scroll-view/scroll-view-common.ts
@@ -9,7 +9,7 @@ import { CoreTypes } from '../../core-types';
@CSSType('ScrollView')
export abstract class ScrollViewBase extends ContentView implements ScrollViewDefinition {
- private _addedScrollEvent = false;
+ private _scrollChangeCount = 0;
public static scrollEvent = 'scroll';
public orientation: CoreTypes.OrientationType;
@@ -19,27 +19,51 @@ export abstract class ScrollViewBase extends ContentView implements ScrollViewDe
public addEventListener(arg: string, callback: any, thisArg?: any) {
super.addEventListener(arg, callback, thisArg);
- if (arg === ScrollViewBase.scrollEvent && !this._addedScrollEvent) {
- this._addedScrollEvent = true;
- this.addNativeListener();
+ if (arg === ScrollViewBase.scrollEvent) {
+ this._scrollChangeCount++;
+ this.attach();
}
}
public removeEventListener(arg: string, callback: any, thisArg?: any) {
super.removeEventListener(arg, callback, thisArg);
- if (arg === ScrollViewBase.scrollEvent && this._addedScrollEvent) {
- this._addedScrollEvent = false;
- this.removeNativeListener();
+ if (arg === ScrollViewBase.scrollEvent) {
+ this._scrollChangeCount--;
+ this.dettach();
}
}
- protected addNativeListener() {
- // implemented per platform
+ @profile
+ public onLoaded() {
+ super.onLoaded();
+
+ this.attach();
+ }
+
+ public disposeNativeView() {
+ this.dettach();
+ super.disposeNativeView();
+ }
+
+ private attach() {
+ if (this._scrollChangeCount > 0 && this.isLoaded) {
+ this.attachNative();
+ }
+ }
+
+ private dettach() {
+ if (this._scrollChangeCount === 0 && this.isLoaded) {
+ this.dettachNative();
+ }
+ }
+
+ protected attachNative() {
+ //
}
- protected removeNativeListener() {
- // implemented per platform
+ protected dettachNative() {
+ //
}
get horizontalOffset(): number {
From daaf50c9eb1a56ec697e7057212c5c4edc4afd1f Mon Sep 17 00:00:00 2001
From: Nathan Walker
Date: Thu, 19 Jan 2023 14:16:23 -0800
Subject: [PATCH 25/76] release: @nativescript/core 8.4.6
---
CHANGELOG.md | 9 +++++++++
packages/core/package.json | 2 +-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 415f179f6d..c6b1b4b82b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,12 @@
+## [8.4.6](https://github.com/NativeScript/NativeScript/compare/8.4.5-core...8.4.6-core) (2023-01-19)
+
+
+### Bug Fixes
+
+* **core:** ScrollView event wiring sequencing improvement ([#10178](https://github.com/NativeScript/NativeScript/issues/10178)) ([75821ea](https://github.com/NativeScript/NativeScript/commit/75821ead07dc69ffeb82c6bd6d6992095ee4fed1))
+
+
+
## [8.4.5](https://github.com/NativeScript/NativeScript/compare/8.4.4-core...8.4.5-core) (2023-01-16)
diff --git a/packages/core/package.json b/packages/core/package.json
index 4a2b0bb4f8..8884b72a72 100644
--- a/packages/core/package.json
+++ b/packages/core/package.json
@@ -1,6 +1,6 @@
{
"name": "@nativescript/core",
- "version": "8.4.5",
+ "version": "8.4.6",
"description": "A JavaScript library providing an easy to use api for interacting with iOS and Android platform APIs.",
"main": "index",
"types": "index.d.ts",
From 1f862a5e0c84b4867434ac92f8a43e96e6bfad0a Mon Sep 17 00:00:00 2001
From: Nathan Walker
Date: Thu, 19 Jan 2023 14:16:59 -0800
Subject: [PATCH 26/76] chore: 8.4.7 next
---
packages/core/package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/core/package.json b/packages/core/package.json
index 8884b72a72..bec104cf5a 100644
--- a/packages/core/package.json
+++ b/packages/core/package.json
@@ -1,6 +1,6 @@
{
"name": "@nativescript/core",
- "version": "8.4.6",
+ "version": "8.4.7",
"description": "A JavaScript library providing an easy to use api for interacting with iOS and Android platform APIs.",
"main": "index",
"types": "index.d.ts",
From 6e792fe07d9ea7ef278f2e917631acb41b1f51f5 Mon Sep 17 00:00:00 2001
From: Manuel Roat
Date: Fri, 20 Jan 2023 13:09:45 +0100
Subject: [PATCH 27/76] fix(webpack): fix regex for PlatformSuffixPlugin
(#10169)
---
packages/webpack5/src/plugins/PlatformSuffixPlugin.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/webpack5/src/plugins/PlatformSuffixPlugin.ts b/packages/webpack5/src/plugins/PlatformSuffixPlugin.ts
index 51c9ae5c6a..2e4a298c42 100644
--- a/packages/webpack5/src/plugins/PlatformSuffixPlugin.ts
+++ b/packages/webpack5/src/plugins/PlatformSuffixPlugin.ts
@@ -34,7 +34,7 @@ export class PlatformSuffixPlugin {
}
apply(compiler: any) {
- const platformRE = new RegExp(`\.${this.platform}\.`);
+ const platformRE = new RegExp(`\\.${this.platform}\\.`);
// require.context
compiler.hooks.contextModuleFactory.tap(id, (cmf) => {
From 30a9b8f5a4657157283f240fd81f2cd7597c0adb Mon Sep 17 00:00:00 2001
From: Igor Randjelovic
Date: Fri, 20 Jan 2023 13:14:17 +0100
Subject: [PATCH 28/76] release: @nativescript/webpack 5.0.13
---
packages/webpack5/package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/webpack5/package.json b/packages/webpack5/package.json
index 8d2a512620..0f4a73f7ba 100644
--- a/packages/webpack5/package.json
+++ b/packages/webpack5/package.json
@@ -1,6 +1,6 @@
{
"name": "@nativescript/webpack",
- "version": "5.0.12",
+ "version": "5.0.13",
"private": false,
"main": "dist/index.js",
"files": [
From ed14e242831dc28398bce62a78c7ee8d71f50bed Mon Sep 17 00:00:00 2001
From: Adam Atri
Date: Fri, 20 Jan 2023 23:24:44 -0500
Subject: [PATCH 29/76] fix(ios): race condition when setting
preferredContentSize on view controller (#10179)
---
packages/core/ui/core/view/index.ios.ts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/packages/core/ui/core/view/index.ios.ts b/packages/core/ui/core/view/index.ios.ts
index 83dd35c46e..11bdba0fc0 100644
--- a/packages/core/ui/core/view/index.ios.ts
+++ b/packages/core/ui/core/view/index.ios.ts
@@ -479,13 +479,13 @@ export class View extends ViewCommon implements ViewDefinition {
} else {
//use CSS & attribute width & height if option is not provided
const handler = () => {
- if (controller) {
+ if (this.viewController) {
const w = (this.width || this.style.width);
const h = (this.height || this.style.height);
//TODO: only numeric value is supported, percentage value is not supported like Android
if (w > 0 && h > 0) {
- controller.preferredContentSize = CGSizeMake(w, h);
+ this.viewController.preferredContentSize = CGSizeMake(w, h);
}
}
From 9f76fea06e02a3f4de4fa69cbc73eb9aa0c8db47 Mon Sep 17 00:00:00 2001
From: Nathan Walker
Date: Mon, 23 Jan 2023 11:32:41 -0800
Subject: [PATCH 30/76] fix(core): allow CoreTypes declarations to be auto
generated (#10183)
---
packages/core/core-types/index.d.ts | 798 ----------------------------
1 file changed, 798 deletions(-)
delete mode 100644 packages/core/core-types/index.d.ts
diff --git a/packages/core/core-types/index.d.ts b/packages/core/core-types/index.d.ts
deleted file mode 100644
index 57790b9212..0000000000
--- a/packages/core/core-types/index.d.ts
+++ /dev/null
@@ -1,798 +0,0 @@
-import { CubicBezierAnimationCurve } from '../ui/animation';
-import { FontStyleType, FontWeightType } from '../ui/styling/font-common';
-
-export namespace CoreTypes {
- /**
- * Denotes a length number that is in device independent pixel units.
- */
- export type dip = number;
-
- /**
- * Denotes a length number that is in physical device pixels.
- */
- export type px = number;
-
- /**
- * Denotes a normalized percent number.
- * 0% is represented as 0
- * 50% is represented as 0.5
- * 100% is represented as 1
- */
- export type percent = number;
-
- export type LengthDipUnit = { readonly unit: 'dip'; readonly value: dip };
- export type LengthPxUnit = { readonly unit: 'px'; readonly value: px };
- export type LengthPercentUnit = { readonly unit: '%'; readonly value: percent };
-
- export type LengthType = 'auto' | dip | LengthDipUnit | LengthPxUnit;
- export type PercentLengthType = 'auto' | dip | LengthDipUnit | LengthPxUnit | LengthPercentUnit;
-
- export type KeyboardInputType = 'datetime' | 'phone' | 'number' | 'url' | 'email' | 'integer';
- /**
- * Represents a soft keyboard flavor.
- */
- export module KeyboardType {
- /**
- * Android: [TYPE_CLASS_DATETIME](http://developer.android.com/reference/android/text/InputType.html#TYPE_CLASS_DATETIME) | [TYPE_DATETIME_VARIATION_NORMAL](http://developer.android.com/reference/android/text/InputType.html#TYPE_DATETIME_VARIATION_NORMAL)
- * iOS: [UIKeyboardTypeNumbersAndPunctuation](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITextInputTraits_Protocol/index.html#//apple_ref/c/tdef/UIKeyboardType)
- */
- export const datetime: KeyboardInputType;
- /**
- * Android: [TYPE_CLASS_PHONE](http://developer.android.com/reference/android/text/InputType.html#TYPE_CLASS_PHONE)
- * iOS: [UIKeyboardTypePhonePad](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITextInputTraits_Protocol/index.html#//apple_ref/c/tdef/UIKeyboardType)
- */
- export const phone: KeyboardInputType;
-
- /**
- * Android: [TYPE_CLASS_NUMBER](http://developer.android.com/reference/android/text/InputType.html#TYPE_CLASS_NUMBER) | [TYPE_NUMBER_VARIATION_NORMAL](http://developer.android.com/intl/es/reference/android/text/InputType.html#TYPE_NUMBER_VARIATION_NORMAL) | [TYPE_NUMBER_FLAG_SIGNED](http://developer.android.com/reference/android/text/InputType.html#TYPE_NUMBER_FLAG_SIGNED) | [TYPE_NUMBER_FLAG_DECIMAL](http://developer.android.com/reference/android/text/InputType.html#TYPE_NUMBER_FLAG_DECIMAL)
- * iOS: [UIKeyboardTypeNumbersAndPunctuation](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITextInputTraits_Protocol/index.html#//apple_ref/c/tdef/UIKeyboardType)
- */
- export const number: KeyboardInputType;
-
- /**
- * Android: [TYPE_CLASS_TEXT](http://developer.android.com/reference/android/text/InputType.html#TYPE_CLASS_TEXT) | [TYPE_TEXT_VARIATION_URI](http://developer.android.com/reference/android/text/InputType.html#TYPE_TEXT_VARIATION_URI)
- * iOS: [UIKeyboardTypeURL](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITextInputTraits_Protocol/index.html#//apple_ref/c/tdef/UIKeyboardType)
- */
- export const url: KeyboardInputType;
-
- /**
- * Android: [TYPE_CLASS_TEXT](http://developer.android.com/reference/android/text/InputType.html#TYPE_CLASS_TEXT) | [TYPE_TEXT_VARIATION_EMAIL_ADDRESS](http://developer.android.com/reference/android/text/InputType.html#TYPE_TEXT_VARIATION_EMAIL_ADDRESS)
- * iOS: [UIKeyboardTypeEmailAddress](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITextInputTraits_Protocol/index.html#//apple_ref/c/tdef/UIKeyboardType)
- */
- export const email: KeyboardInputType;
-
- /**
- * Android: [TYPE_CLASS_NUMBER](http://developer.android.com/reference/android/text/InputType.html#TYPE_CLASS_NUMBER | [TYPE_NUMBER_VARIATION_PASSWORD](android type_text_variation_password))
- * iOS: [UIKeyboardTypeNumberPad](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITextInputTraits_Protocol/index.html#//apple_ref/c/tdef/UIKeyboardType)
- */
- export const integer: KeyboardInputType;
- }
-
- export type ReturnKeyButtonType = 'done' | 'next' | 'go' | 'search' | 'send';
- /**
- * Represents the flavor of the return key on the soft keyboard.
- */
- export module ReturnKeyType {
- /**
- * Android: [IME_ACTION_DONE](http://developer.android.com/reference/android/view/inputmethod/EditorInfo.html#IME_ACTION_DONE)
- * iOS: [UIReturnKeyDone](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITextInputTraits_Protocol/index.html#//apple_ref/c/tdef/UIReturnKeyType)
- */
- export const done: ReturnKeyButtonType;
-
- /**
- * Android: [IME_ACTION_NEXT](http://developer.android.com/reference/android/view/inputmethod/EditorInfo.html#IME_ACTION_NEXT)
- * iOS: [UIReturnKeyNext](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITextInputTraits_Protocol/index.html#//apple_ref/c/tdef/UIReturnKeyType)
- */
- export const next: ReturnKeyButtonType;
-
- /**
- * Android: [IME_ACTION_GO](http://developer.android.com/reference/android/view/inputmethod/EditorInfo.html#IME_ACTION_GO)
- * iOS: [UIReturnKeyGo](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITextInputTraits_Protocol/index.html#//apple_ref/c/tdef/UIReturnKeyType)
- */
- export const go: ReturnKeyButtonType;
-
- /**
- * Android: [IME_ACTION_SEARCH](http://developer.android.com/reference/android/view/inputmethod/EditorInfo.html#IME_ACTION_SEARCH)
- * iOS: [UIReturnKeySearch](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITextInputTraits_Protocol/index.html#//apple_ref/c/tdef/UIReturnKeyType)
- */
- export const search: ReturnKeyButtonType;
-
- /**
- * Android: [IME_ACTION_SEND](http://developer.android.com/reference/android/view/inputmethod/EditorInfo.html#IME_ACTION_SEND)
- * iOS: [UIReturnKeySend](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITextInputTraits_Protocol/index.html#//apple_ref/c/tdef/UIReturnKeyType)
- */
- export const send: string;
- }
-
- export type TextAlignmentType = 'initial' | 'left' | 'center' | 'right' | 'justify';
- /**
- * Represents a text-align enumeration.
- */
- export module TextAlignment {
- /**
- * Represents left text-align.
- */
- export const left: TextAlignmentType;
-
- /**
- * Represents center text-align.
- */
- export const center: TextAlignmentType;
-
- /**
- * Represents right text-align.
- */
- export const right: TextAlignmentType;
-
- /**
- * Represents justify text-align.
- */
- export const justify: TextAlignmentType;
- }
-
- export type OrientationType = 'horizontal' | 'vertical';
- /**
- * Orientation indicates a direction of a layout that can exist in a horizontal or vertical state.
- */
- export module Orientation {
- /**
- * Layout should be horizontally oriented.
- */
- export const horizontal: OrientationType;
- /**
- * Layout should be vertically oriented.
- */
- export const vertical: OrientationType;
- }
-
- export type DeviceOrientationType = 'portrait' | 'landscape' | 'unknown';
- /**
- * Orientation of a device.
- */
- export module DeviceOrientation {
- /**
- * Portrait orientation.
- */
- export const portrait: string;
- /**
- * Landscape orientation.
- */
- export const landscape: string;
- /**
- * Orientation cannot be determined.
- */
- export const unknown: string;
- }
-
- export type HorizontalAlignmentType = 'left' | 'center' | 'right' | 'stretch';
- /**
- * HorizontalAlignment indicates where an element should be displayed on the horizontal axis relative to the allocated layout slot of the parent element.
- */
- export module HorizontalAlignment {
- /**
- * An element should be left aligned.
- */
- export const left: HorizontalAlignmentType;
-
- /**
- * An element should be center aligned.
- */
- export const center: HorizontalAlignmentType;
-
- /**
- * An element should be right aligned.
- */
- export const right: HorizontalAlignmentType;
-
- /**
- * An element should be stretched to fill all the available size.
- */
- export const stretch: HorizontalAlignmentType;
- }
-
- export type VerticalAlignmentType = 'top' | 'middle' | 'bottom' | 'stretch';
- export type VerticalAlignmentTextType = (VerticalAlignmentType & 'text-top') | 'text-bottom' | 'super' | 'sub' | 'baseline';
- /**
- * VerticalAlignment indicates where an element should be displayed on the horizontal axis relative to the allocated layout slot of the parent element.
- */
- export module VerticalAlignment {
- /**
- * An element should be top aligned.
- */
- export const top: VerticalAlignmentType;
-
- /**
- * An element should be center aligned.
- */
- export const center: VerticalAlignmentType;
-
- /**
- * Same as center. An element should be aligned in the middle.
- */
- export const middle: VerticalAlignmentType;
-
- /**
- * An element should be bottom aligned.
- */
- export const bottom: VerticalAlignmentType;
-
- /**
- * An element should be stretched to fill all the available size.
- */
- export const stretch: VerticalAlignmentType;
- }
-
- export type ImageStretchType = 'none' | 'aspectFill' | 'aspectFit' | 'fill';
- /**
- * Describes how content is resized to fill its allocated space.
- */
- export module ImageStretch {
- /**
- * The image preserves its original size.
- */
- export const none: ImageStretchType;
-
- /**
- * The image is resized to fill in the destination dimensions while it preserves its native aspect ratio.
- * If the aspect ratio of the destination rectangle differs from the image, the image is clipped to fill
- * in the destination.
- */
- export const aspectFill: ImageStretchType;
-
- /**
- * The image is resized to fit the destination dimensions while it preserves
- * its native aspect ratio.
- */
- export const aspectFit: ImageStretchType;
-
- /**
- * The image is resized to fill the destination dimensions. The aspect ratio is not preserved.
- */
- export const fill: ImageStretchType;
- }
-
- export type VisibilityType = 'visible' | 'hidden' | 'collapse' | 'collapsed';
- /**
- * Represents the visibility mode of a view.
- */
- export module Visibility {
- /**
- * The view is visible.
- */
- export const visible: VisibilityType;
-
- /**
- * The view is not visible and won't take place in the layout.
- */
- export const collapse: VisibilityType;
-
- /**
- * @deprecated Use collapse instead
- */
- export const collapsed: VisibilityType;
-
- /**
- * The view is not visible but will take place in the layout.
- */
- export const hidden: VisibilityType;
- }
-
- /**
- * A flag enum that represents common font attributes.
- */
- export module FontAttributes {
- /**
- * Denotes that text should be drawn in a normal style.
- */
- export const Normal: number;
-
- /**
- * Denotes that text should be drawn in a bold weight.
- */
- export const Bold: number;
-
- /**
- * Denotes that text should be drawn in a italic style.
- */
- export const Italic: number;
- }
-
- /**
- * Describes the type of a device
- */
- export module DeviceType {
- /**
- * Indicates a smart-phone device.
- */
- export const Phone: string;
-
- /**
- * Indicates a tablet device.
- */
- export const Tablet: string;
- }
-
- export type UpdateTextTriggerType = 'focusLost' | 'textChanged';
- /**
- * Represents an enumeration specifying when the text property of an EditableTextBase will be updated.
- */
- export module UpdateTextTrigger {
- /**
- * The text property will be udpaded when the widget loses focus.
- */
- export const focusLost: UpdateTextTriggerType;
-
- /**
- * The text property will be udpaded on every single character typed by the user.
- */
- export const textChanged: UpdateTextTriggerType;
- }
-
- /**
- * Specifies common accuracy values.
- */
- export namespace Accuracy {
- /**
- * The default accuracy. About 300 meters.
- */
- export const any: number;
-
- /**
- * High accuracy. About 3 meters.
- */
- export const high: number;
- }
-
- export type DockType = 'left' | 'top' | 'right' | 'bottom';
- /**
- * Specifies the Dock position of a child element that is inside a DockLayout.
- */
- export module Dock {
- /**
- * A child element that is positioned on the left side of the DockLayout.
- */
- export const left: DockType;
-
- /**
- * A child element that is positioned on the top side of the DockLayout.
- */
- export const top: DockType;
-
- /**
- * A child element that is positioned on the right side of the DockLayout.
- */
- export const right: DockType;
-
- /**
- * A child element that is positioned on the bottom side of the DockLayout.
- */
- export const bottom: DockType;
- }
-
- export type AutocapitalizationInputType = 'none' | 'words' | 'sentences' | 'allcharacters';
- /**
- * Represents the auto-capitalization style for a text input.
- */
- export module AutocapitalizationType {
- /**
- * Do not capitalize any text automatically.
- */
- export const none: AutocapitalizationInputType;
-
- /**
- * Capitalize the first letter of each word automatically.
- */
- export const words: AutocapitalizationInputType;
-
- /**
- * Capitalize the first letter of each sentence automatically.
- */
- export const sentences: AutocapitalizationInputType;
-
- /**
- * Capitalize all characters automatically.
- */
- export const allCharacters: AutocapitalizationInputType;
- }
-
- /**
- * Defines the recognized image formats.
- */
- export module ImageFormat {
- /**
- * The W3C Portable Network Graphics (PNG) image format.
- */
- export const png: string;
-
- /**
- * The Joint Photographic Experts Group (JPEG) image format.
- */
- export const jpeg: string;
-
- /**
- * The Joint Photographic Experts Group (JPEG) image format.
- */
- export const jpg: string;
- }
-
- /**
- * Specifies NavigationBar visibility mode.
- */
- export module NavigationBarVisibility {
- /**
- * NavigationBar will be visible if there if frame backstack canGoBack is true or if the page Action Bar is not empty.
- */
- export const auto: string;
-
- /**
- * NavigationBar will be hidden.
- */
- export const never: string;
-
- /**
- * NavigationBar will be visible.
- */
- export const always: string;
- }
-
- /**
- * Specifies the visibility of the application bar icon
- */
- export module AndroidActionBarIconVisibility {
- export const auto: string;
- export const never: string;
- export const always: string;
- }
-
- /**
- * Specifies android MenuItem position.
- */
- export module AndroidActionItemPosition {
- /**
- * Always show this item as a button in an Action Bar.
- */
- export const actionBar: string;
-
- /**
- * Show this item as a button in an Action Bar if the system decides there is room for it.
- */
- export const actionBarIfRoom: string;
-
- /**
- * Never show this item as a button in an Action Bar.
- */
- export const popup: string;
- }
-
- /**
- * Specifies different font styles.
- */
- export module FontStyle {
- /**
- * Normal font style.
- */
- export const normal: FontStyleType;
-
- /**
- * Italic font style.
- */
- export const italic: FontStyleType;
- }
-
- export type TextDecorationType = 'none' | 'underline' | 'line-through' | 'underline line-through';
- /**
- * Specifies different text decorations.
- */
- export module TextDecoration {
- /**
- * No decoration.
- */
- export const none: TextDecorationType;
-
- /**
- * Text decoration underline.
- */
- export const underline: TextDecorationType;
-
- /**
- * Text decoration line-through.
- */
- export const lineThrough: TextDecorationType;
- }
-
- export type TextTransformType = 'initial' | 'none' | 'capitalize' | 'uppercase' | 'lowercase';
- /**
- * Specifies different text transforms.
- */
- export module TextTransform {
- /**
- * No transform.
- */
- export const none: TextTransformType;
-
- /**
- * Text transform capitalize.
- */
- export const capitalize: TextTransformType;
-
- /**
- * Text transform uppercase.
- */
- export const uppercase: TextTransformType;
-
- /**
- * Text transform lowercase.
- */
- export const lowercase: TextTransformType;
- }
-
- export type WhiteSpaceType = 'initial' | 'normal' | 'nowrap';
- /**
- * Specifies different white spaces.
- */
- export module WhiteSpace {
- /**
- * Normal wrap.
- */
- export const normal: WhiteSpaceType;
-
- /**
- * No wrap.
- */
- export const nowrap: WhiteSpaceType;
- }
-
- /**
- * Specifies different font weights.
- */
- export module FontWeight {
- /**
- * Thin font weight. CSS font-weight 100.
- */
- export const thin: FontWeightType;
-
- /**
- * Extra-light / Ultra-light font weight. CSS font-weight 200.
- */
- export const extraLight: FontWeightType;
-
- /**
- * Light font weight. CSS font-weight 300.
- */
- export const light: FontWeightType;
-
- /**
- * Normal font weight. CSS font-weight 400.
- */
- export const normal: FontWeightType;
-
- /**
- * Medium font weight. CSS font-weight 500.
- */
- export const medium: FontWeightType;
-
- /**
- * Semi-bold / Demi-bold font weight. CSS font-weight 600.
- */
- export const semiBold: FontWeightType;
-
- /**
- * Bold font weight. CSS font-weight 700.
- */
- export const bold: FontWeightType;
-
- /**
- * Extra-bold / Ultra-bold font weight. CSS font-weight 800.
- */
- export const extraBold: FontWeightType;
-
- /**
- * Black font weight. CSS font-weight 900.
- */
- export const black: FontWeightType;
- }
-
- export type BackgroundRepeatType = 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat';
- /**
- * Specifies background repeat.
- */
- export module BackgroundRepeat {
- export const repeat: BackgroundRepeatType;
- export const repeatX: BackgroundRepeatType;
- export const repeatY: BackgroundRepeatType;
- export const noRepeat: BackgroundRepeatType;
- export const isValid: (value: any) => BackgroundRepeatType;
- export const parse: (value: any) => BackgroundRepeatType;
- }
-
- /**
- * Specifies android MenuItem position.
- */
- export module IOSActionItemPosition {
- /**
- * Show this item at the left of the navigation bar.
- */
- export const left: string;
-
- /**
- * Show this item at the right of the action bar.
- */
- export const right: string;
- }
-
- /**
- * Represents an animation curve type.
- */
- export module AnimationCurve {
- /**
- * Default value. Specifies a transition effect with a slow start, then fast, then end slowly (equivalent to cubic-bezier(0.25,0.1,0.25,1))
- */
- export const ease: string;
-
- /**
- * An ease-in curve causes the animation to begin slowly, and then speed up as it progresses.
- */
- export const easeIn: string;
-
- /**
- * An ease-out curve causes the animation to begin quickly, and then slow down as it completes.
- */
- export const easeOut: string;
-
- /**
- * An ease-in ease-out curve causes the animation to begin slowly, accelerate through the middle of its duration, and then slow again before completing.
- */
- export const easeInOut: string;
-
- /**
- * A linear animation curve causes an animation to occur evenly over its duration.
- */
- export const linear: string;
-
- /**
- * A spring animation curve causes an animation to produce a spring (bounce) effect.
- */
- export const spring: string;
-
- /**
- * A custom cubic bezier function defined by its two control points. Possible values are numeric values from 0 to 1
- */
- export function cubicBezier(x1: number, y1: number, x2: number, y2: number): CubicBezierAnimationCurve;
- }
-
- /**
- * @deprecated use `SystemAppearance` instead.
- *
- * Specifies the types of the status bar style.
- */
- export module StatusBarStyle {
- /**
- * The light style of the status bar - light background with dark letters.
- */
- export const light: string;
-
- /**
- * The dark style of the status bar - dark background with light letters.
- */
- export const dark: string;
- }
-
- /**
- * Specifies the types of the system appearance.
- */
- export module SystemAppearance {
- /**
- * The light system appearance.
- */
- export const light: string;
-
- /**
- * The dark system appearance.
- */
- export const dark: string;
- }
-
- /**
- * @deprecated use `SystemAppearance` instead.
- *
- * Specifies the types of the user interface style.
- */
- export module UserInterfaceStyle {
- /**
- * The light style of the user interface.
- */
- export const light: string;
-
- /**
- * The dark style of the user interface.
- */
- export const dark: string;
- }
-}
-
-/**
- * @deprecated Use `CoreTypes.dip` instead.
- */
-export type dip = CoreTypes.dip;
-
-/**
- * @deprecated Use `CoreTypes.px` instead.
- */
-export type px = CoreTypes.px;
-
-/**
- * @deprecated Use `CoreTypes.percent` instead.
- */
-export type percent = CoreTypes.percent;
-
-/**
- * @deprecated Use `CoreTypes.LengthDipUnit` instead.
- */
-export type LengthDipUnit = CoreTypes.LengthDipUnit;
-/**
- * @deprecated Use `CoreTypes.LengthPxUnit` instead.
- */
-export type LengthPxUnit = CoreTypes.LengthPxUnit;
-/**
- * @deprecated Use `CoreTypes.LengthPercentUnit` instead.
- */
-export type LengthPercentUnit = CoreTypes.LengthPercentUnit;
-
-/**
- * @deprecated Use `CoreTypes.LengthType` instead.
- */
-export type LengthType = CoreTypes.LengthType;
-/**
- * @deprecated Use `CoreTypes.PercentLengthType` instead.
- */
-export type PercentLengthType = CoreTypes.PercentLengthType;
-
-/**
- * @deprecated Use `CoreTypes.AnimationCurve` instead.
- */
-export const AnimationCurve: typeof CoreTypes.AnimationCurve;
-
-/**
- * @deprecated Use `CoreTypes.HorizontalAlignmentType` instead.
- */
-export type HorizontalAlignment = CoreTypes.HorizontalAlignmentType;
-
-/**
- * @deprecated Use `CoreTypes.VerticalAlignmentType` instead.
- */
-export type VerticalAlignment = CoreTypes.VerticalAlignmentType;
-
-/**
- * @deprecated Use `CoreTypes` instead. Enums will be removed in 9.0
- */
-export declare const Enums: {
- Accuracy: typeof CoreTypes.Accuracy;
- AndroidActionBarIconVisibility: typeof CoreTypes.AndroidActionBarIconVisibility;
- AndroidActionItemPosition: typeof CoreTypes.AndroidActionItemPosition;
- AnimationCurve: typeof CoreTypes.AnimationCurve;
- AutocapitalizationType: typeof CoreTypes.AutocapitalizationType;
- BackgroundRepeat: typeof CoreTypes.BackgroundRepeat;
- DeviceOrientation: typeof CoreTypes.DeviceOrientation;
- DeviceType: typeof CoreTypes.DeviceType;
- Dock: typeof CoreTypes.Dock;
- FontAttributes: typeof CoreTypes.FontAttributes;
- FontStyle: typeof CoreTypes.FontStyle;
- FontWeight: typeof CoreTypes.FontWeight;
- HorizontalAlignment: typeof CoreTypes.HorizontalAlignment;
- IOSActionItemPosition: typeof CoreTypes.IOSActionItemPosition;
- ImageFormat: typeof CoreTypes.ImageFormat;
- KeyboardType: typeof CoreTypes.KeyboardType;
- NavigationBarVisibility: typeof CoreTypes.NavigationBarVisibility;
- Orientation: typeof CoreTypes.Orientation;
- ReturnKeyType: typeof CoreTypes.ReturnKeyType;
- StatusBarStyle: typeof CoreTypes.StatusBarStyle;
- Stretch: typeof CoreTypes.ImageStretch;
- SystemAppearance: typeof CoreTypes.SystemAppearance;
- TextAlignment: CoreTypes.TextAlignmentType;
- TextDecoration: CoreTypes.TextDecorationType;
- TextTransform: CoreTypes.TextTransformType;
- UpdateTextTrigger: CoreTypes.UpdateTextTriggerType;
- VerticalAlignment: CoreTypes.VerticalAlignmentType;
- Visibility: CoreTypes.VisibilityType;
- WhiteSpace: CoreTypes.WhiteSpaceType;
-};
From c42c3c5f2609afaa96bf874c427f0702f8cd5daa Mon Sep 17 00:00:00 2001
From: Nathan Walker
Date: Mon, 23 Jan 2023 12:08:00 -0800
Subject: [PATCH 31/76] fix(ios): race conditions with nativeView (#10182)
---
packages/core/ui/styling/background.ios.ts | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/packages/core/ui/styling/background.ios.ts b/packages/core/ui/styling/background.ios.ts
index 6e8f8f3207..c08121839f 100644
--- a/packages/core/ui/styling/background.ios.ts
+++ b/packages/core/ui/styling/background.ios.ts
@@ -193,11 +193,13 @@ function setUIColorFromImage(view: View, nativeView: UIView, callback: (uiColor:
bitmap = imageSource && imageSource.ios;
} else if (imageUri.indexOf('http') !== -1) {
style[symbolUrl] = imageUri;
- ImageSource.fromUrl(imageUri).then((r) => {
- if (style && style[symbolUrl] === imageUri) {
- uiColorFromImage(r.ios, view, callback, flip);
- }
- });
+ ImageSource.fromUrl(imageUri)
+ .then((r) => {
+ if (style && style[symbolUrl] === imageUri) {
+ uiColorFromImage(r.ios, view, callback, flip);
+ }
+ })
+ .catch(() => {});
}
uiColorFromImage(bitmap, view, callback, flip);
@@ -360,7 +362,7 @@ function getDrawParams(this: void, image: UIImage, background: BackgroundDefinit
function uiColorFromImage(img: UIImage, view: View, callback: (uiColor: UIColor) => void, flip?: boolean): void {
const background = view.style.backgroundInternal;
- if (!img) {
+ if (!img || !view.nativeViewProtected) {
callback(background.color && background.color.ios);
return;
From d2e4d53b4e12b02ab66e4cf08ce62c5805fee319 Mon Sep 17 00:00:00 2001
From: Piyush <118425491+piyush280599@users.noreply.github.com>
Date: Tue, 24 Jan 2023 03:55:46 +0530
Subject: [PATCH 32/76] chore: readme (#10176)
Removed extra space and added period for consistency.
---
README.md | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/README.md b/README.md
index e577a230a8..d8aa040d90 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@
-[NativeScript](http://www.nativescript.org) empowers you to access native APIs from JavaScript directly. Currently iOS and Android runtimes are provided for rich mobile development across a variety of diverse use cases.
+[NativeScript](http://www.nativescript.org) empowers you to access native APIs from JavaScript directly. Currently iOS and Android runtimes are provided for rich mobile development across a variety of diverse use cases.
## Contribute
@@ -37,19 +37,19 @@ We love you and your pull requests 🤗. Please follow our [contributing guide](
## @nativescript/*
* [@nativescript/core](https://github.com/NativeScript/NativeScript/tree/master/packages/core)
- * Core iOS/Android for NativeScript
+ * Core iOS/Android for NativeScript.
* [@nativescript/types](https://www.npmjs.com/package/@nativescript/types)
* Types for both iOS/Android below wrapped up as a convenience. *Most commonly used.*
* [@nativescript/types-ios](https://github.com/NativeScript/NativeScript/tree/master/packages/types-ios)
- * Types for iOS
+ * Types for iOS.
* [@nativescript/types-android](https://github.com/NativeScript/NativeScript/tree/master/packages/types-android)
- * Types for Android
+ * Types for Android.
* [@nativescript/types-minimal](https://github.com/NativeScript/NativeScript/tree/master/packages/types-minimal)
* A very minimal set of types for only the latest Android and iOS sdks. Most commonly used to optimize Web-based IDE's which auto load all type declarations from node_modules.
* [@nativescript/ui-mobile-base](https://github.com/NativeScript/NativeScript/tree/master/packages/ui-mobile-base)
- * UI mobile base native classes used by core
+ * UI mobile base native classes used by core.
* [@nativescript/webpack](https://github.com/NativeScript/NativeScript/tree/master/packages/webpack)
- * Webpack build utilities and configs used by NativeScript apps
+ * Webpack build utilities and configs used by NativeScript apps.
## Quick Links
From 2a2432f3368be9bbb064a700c7b1364492c311ec Mon Sep 17 00:00:00 2001
From: Nathan Walker
Date: Mon, 23 Jan 2023 14:29:32 -0800
Subject: [PATCH 33/76] release: @nativescript/core 8.4.7
---
CHANGELOG.md | 11 +++++++++++
package.json | 2 +-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c6b1b4b82b..d4b7ecab88 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,14 @@
+## [8.4.7](https://github.com/NativeScript/NativeScript/compare/5.0.13-webpack...8.4.7) (2023-01-23)
+
+
+### Bug Fixes
+
+* **core:** allow CoreTypes declarations to be auto generated ([#10183](https://github.com/NativeScript/NativeScript/issues/10183)) ([9f76fea](https://github.com/NativeScript/NativeScript/commit/9f76fea06e02a3f4de4fa69cbc73eb9aa0c8db47))
+* **ios:** race condition when setting preferredContentSize on view controller ([#10179](https://github.com/NativeScript/NativeScript/issues/10179)) ([ed14e24](https://github.com/NativeScript/NativeScript/commit/ed14e242831dc28398bce62a78c7ee8d71f50bed))
+* **ios:** race conditions with nativeView ([#10182](https://github.com/NativeScript/NativeScript/issues/10182)) ([c42c3c5](https://github.com/NativeScript/NativeScript/commit/c42c3c5f2609afaa96bf874c427f0702f8cd5daa))
+
+
+
## [8.4.6](https://github.com/NativeScript/NativeScript/compare/8.4.5-core...8.4.6-core) (2023-01-19)
diff --git a/package.json b/package.json
index 0d009f639c..a085d1fd2b 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "nativescript",
- "version": "8.4.6",
+ "version": "8.4.7",
"license": "MIT",
"scripts": {
"clean": "git clean -f -X -d --exclude=!.idea/ --exclude=!.vscode/* --exclude=!.npmrc",
From 50dec8c151d56ea4dfb6b252760c81a0eaadf00e Mon Sep 17 00:00:00 2001
From: Nathan Walker
Date: Mon, 23 Jan 2023 14:30:09 -0800
Subject: [PATCH 34/76] chore: 8.4.8 next
---
packages/core/package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/core/package.json b/packages/core/package.json
index bec104cf5a..49a8ef0aee 100644
--- a/packages/core/package.json
+++ b/packages/core/package.json
@@ -1,6 +1,6 @@
{
"name": "@nativescript/core",
- "version": "8.4.7",
+ "version": "8.4.8",
"description": "A JavaScript library providing an easy to use api for interacting with iOS and Android platform APIs.",
"main": "index",
"types": "index.d.ts",
From 497b2d737ee6d71dd43d325d86402f4e98918619 Mon Sep 17 00:00:00 2001
From: Nathan Walker
Date: Mon, 30 Jan 2023 19:17:49 -0800
Subject: [PATCH 35/76] chore: Nx 15.6, jest latest and TypeScript 4.9 (#10191)
---
.vscode/settings.json | 3 +-
apps/automated/package.json | 6 +--
apps/toolbox/package.json | 6 +--
apps/ui/package.json | 6 +--
nx.json | 2 +-
package.json | 44 ++++++++-----------
.../ui/builder/component-builder/index.ts | 31 ++++++-------
packages/core/ui/core/properties/index.ts | 12 ++---
packages/webpack5/package.json | 10 ++---
tools/assets/App_Resources/Android/app.gradle | 7 +--
tools/notes/CodingConvention.md | 9 ----
11 files changed, 59 insertions(+), 77 deletions(-)
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 3a51bc2980..5acd7ae98f 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -6,6 +6,5 @@
"**/platforms": true,
"**/*.js": true,
"**/*.js.map": true
- },
- "tslint.configFile": "./build/tslint.json"
+ }
}
\ No newline at end of file
diff --git a/apps/automated/package.json b/apps/automated/package.json
index 7c22fd46ea..154e9cf951 100644
--- a/apps/automated/package.json
+++ b/apps/automated/package.json
@@ -11,10 +11,10 @@
"nativescript-theme-core": "file:../../node_modules/nativescript-theme-core"
},
"devDependencies": {
- "@nativescript/android": "~8.3.0",
- "@nativescript/ios": "~8.3.0",
+ "@nativescript/android": "~8.4.0",
+ "@nativescript/ios": "~8.4.0",
"@nativescript/webpack": "file:../../dist/packages/nativescript-webpack.tgz",
- "typescript": "4.8.4"
+ "typescript": "~4.9.5"
},
"gitHead": "c06800e52ee1a184ea2dffd12a6702aaa43be4e3",
"readme": "NativeScript Application"
diff --git a/apps/toolbox/package.json b/apps/toolbox/package.json
index 88fd27c87d..636850fce3 100644
--- a/apps/toolbox/package.json
+++ b/apps/toolbox/package.json
@@ -12,9 +12,9 @@
"@nativescript/imagepicker": "^1.0.6"
},
"devDependencies": {
- "@nativescript/android": "~8.3.0",
- "@nativescript/ios": "~8.3.0",
+ "@nativescript/android": "~8.4.0",
+ "@nativescript/ios": "~8.4.0",
"@nativescript/webpack": "file:../../dist/packages/nativescript-webpack.tgz",
- "typescript": "4.8.4"
+ "typescript": "~4.9.5"
}
}
diff --git a/apps/ui/package.json b/apps/ui/package.json
index 2790dc2012..f097078ff2 100644
--- a/apps/ui/package.json
+++ b/apps/ui/package.json
@@ -11,10 +11,10 @@
"@nativescript/core": "file:../../packages/core"
},
"devDependencies": {
- "@nativescript/android": "~8.3.0",
- "@nativescript/ios": "~8.3.0",
+ "@nativescript/android": "~8.4.0",
+ "@nativescript/ios": "~8.4.0",
"@nativescript/webpack": "file:../../dist/packages/nativescript-webpack.tgz",
- "typescript": "4.8.4"
+ "typescript": "~4.9.5"
},
"gitHead": "8ab7726d1ee9991706069c1359c552e67ee0d1a4",
"readme": "NativeScript Application",
diff --git a/nx.json b/nx.json
index bfcc2e8a81..53d69cccd6 100644
--- a/nx.json
+++ b/nx.json
@@ -79,7 +79,7 @@
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"namedInputs": {
"default": ["{projectRoot}/**/*", "sharedGlobals"],
- "sharedGlobals": ["{workspaceRoot}/workspace.json", "{workspaceRoot}/tsconfig.json", "{workspaceRoot}/tslint.json", "{workspaceRoot}/nx.json"],
+ "sharedGlobals": ["{workspaceRoot}/workspace.json", "{workspaceRoot}/tsconfig.json", "{workspaceRoot}/nx.json"],
"production": ["default", "!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)", "!{projectRoot}/tsconfig.spec.json", "!{projectRoot}/jest.config.[jt]s"]
},
"targetDefaults": {
diff --git a/package.json b/package.json
index a085d1fd2b..f5a4a69f1e 100644
--- a/package.json
+++ b/package.json
@@ -18,28 +18,25 @@
"url": "https://github.com/NativeScript/NativeScript.git"
},
"dependencies": {
- "@nrwl/nx-cloud": "^15.0.2",
+ "@nrwl/nx-cloud": "15.0.3",
"nativescript-theme-core": "^1.0.4"
},
"devDependencies": {
"@nativescript/hook": "^2.0.0",
- "@nativescript/nx": "~4.1.0",
- "@nrwl/cli": "15.2.1",
- "@nrwl/eslint-plugin-nx": "15.2.1",
- "@nrwl/jest": "15.2.1",
- "@nrwl/node": "15.2.1",
- "@nrwl/workspace": "15.2.1",
+ "@nativescript/nx": "~4.2.0",
+ "@nrwl/cli": "15.6.3",
+ "@nrwl/eslint-plugin-nx": "15.6.3",
+ "@nrwl/jest": "15.6.3",
+ "@nrwl/node": "15.6.3",
+ "@nrwl/workspace": "15.6.3",
"@nstudio/focus": "^15.0.0",
"@nstudio/nps-i": "~2.0.0",
"@prettier/plugin-xml": "^2.2.0",
- "@types/chai": "^4.2.11",
- "@types/jest": "29.2.3",
- "@types/mocha": "^7.0.2",
+ "@types/jest": "29.4.0",
"@types/node": "18.7.1",
"@typescript-eslint/eslint-plugin": "^5.30.0",
"@typescript-eslint/parser": "^5.30.0",
- "chai": "^4.2.0",
- "conventional-changelog-cli": "^2.1.1",
+ "conventional-changelog-cli": "^2.2.2",
"copyfiles": "^2.4.0",
"css": "^3.0.0",
"css-tree": "^1.1.2",
@@ -49,14 +46,12 @@
"eslint-config-prettier": "^8.1.0",
"gonzales": "^1.0.7",
"husky": "^8.0.1",
- "jest": "29.3.1",
- "lint-staged": "^13.0.1",
- "mocha": "^8.0.1",
- "mocha-typescript": "^1.1.17",
+ "jest": "29.4.1",
+ "lint-staged": "^13.1.0",
"module-alias": "^2.2.2",
- "nativescript": "~8.3.0",
+ "nativescript": "~8.4.0",
"nativescript-typedoc-theme": "1.1.0",
- "nx": "15.2.1",
+ "nx": "15.6.3",
"parse-css": "git+https://github.com/tabatkins/parse-css.git",
"parserlib": "^1.1.1",
"prettier": "^2.6.2",
@@ -64,14 +59,12 @@
"sass": "^1.45.2",
"shady-css-parser": "^0.1.0",
"tree-kill": "^1.2.2",
- "ts-jest": "29.0.3",
+ "ts-jest": "29.0.5",
"ts-node": "10.9.1",
- "ts-patch": "^2.0.1",
- "tslib": "^2.4.0",
- "tslint": "6.1.3",
- "tslint-to-eslint-config": "^2.13.0",
- "typedoc": "^0.22.17",
- "typescript": "4.8.4",
+ "ts-patch": "^2.1.0",
+ "tslib": "^2.5.0",
+ "typedoc": "^0.23.24",
+ "typescript": "~4.9.5",
"zx": "^7.0.5"
},
"lint-staged": {
@@ -80,3 +73,4 @@
]
}
}
+
diff --git a/packages/core/ui/builder/component-builder/index.ts b/packages/core/ui/builder/component-builder/index.ts
index 14943cd363..757cd282a6 100644
--- a/packages/core/ui/builder/component-builder/index.ts
+++ b/packages/core/ui/builder/component-builder/index.ts
@@ -102,25 +102,22 @@ const createComponentInstance = profile('createComponentInstance', (elementName:
return { instance, instanceModule };
});
-const getComponentModuleExports = profile(
- 'getComponentModuleExports',
- (instance: View, moduleExports: Object, attributes: Object): Object => {
- if (attributes) {
- const codeFileAttribute = attributes[CODE_FILE] || attributes[IMPORT];
- if (codeFileAttribute) {
- const resolvedCodeFileModule = resolveModuleName(sanitizeModuleName(codeFileAttribute), '');
- if (resolvedCodeFileModule) {
- moduleExports = global.loadModule(resolvedCodeFileModule, true);
- (instance).exports = moduleExports;
- } else {
- throw new Error(`Code file with path "${codeFileAttribute}" cannot be found! Looking for webpack module with name "${resolvedCodeFileModule}"`);
- }
+const getComponentModuleExports = profile('getComponentModuleExports', (instance: View, moduleExports: Object, attributes: Object): Object => {
+ if (attributes) {
+ const codeFileAttribute = attributes[CODE_FILE] || attributes[IMPORT];
+ if (codeFileAttribute) {
+ const resolvedCodeFileModule = resolveModuleName(sanitizeModuleName(codeFileAttribute), '');
+ if (resolvedCodeFileModule) {
+ moduleExports = global.loadModule(resolvedCodeFileModule, true);
+ (instance).exports = moduleExports;
+ } else {
+ throw new Error(`Code file with path "${codeFileAttribute}" cannot be found! Looking for webpack module with name "${resolvedCodeFileModule}"`);
}
}
-
- return moduleExports;
}
-);
+
+ return moduleExports;
+});
const applyComponentCss = profile('applyComponentCss', (instance: View, moduleName: string, attributes: Object) => {
let cssApplied = false;
@@ -249,5 +246,5 @@ function isBinding(value: any): boolean {
// For example, ListView.itemTemplateSelector
const KNOWN_FUNCTIONS = 'knownFunctions';
function isKnownFunction(name: string, instance: View): boolean {
- return instance.constructor && KNOWN_FUNCTIONS in instance.constructor && instance.constructor[KNOWN_FUNCTIONS].indexOf(name) !== -1;
+ return instance.constructor && KNOWN_FUNCTIONS in instance.constructor && (instance.constructor[KNOWN_FUNCTIONS] as string).indexOf(name) !== -1;
}
diff --git a/packages/core/ui/core/properties/index.ts b/packages/core/ui/core/properties/index.ts
index b8c0de16b8..1eedb390ef 100644
--- a/packages/core/ui/core/properties/index.ts
+++ b/packages/core/ui/core/properties/index.ts
@@ -243,7 +243,7 @@ export class Property implements TypedPropertyDescriptor<
}
}
- const oldValue = key in this ? this[key] : defaultValue;
+ const oldValue = (key in this ? this[key] : defaultValue);
const changed: boolean = equalityComparer ? !equalityComparer(oldValue, value) : oldValue !== value;
if (wrapped || changed) {
@@ -310,11 +310,11 @@ export class Property implements TypedPropertyDescriptor<
};
this.get = function (this: T): U {
- return key in this ? this[key] : defaultValue;
+ return (key in this ? this[key] : defaultValue);
};
this.nativeValueChange = function (owner: T, value: U): void {
- const oldValue = key in owner ? owner[key] : defaultValue;
+ const oldValue = (key in owner ? owner[key] : defaultValue);
const changed = equalityComparer ? !equalityComparer(oldValue, value) : oldValue !== value;
if (changed) {
owner[key] = value;
@@ -406,7 +406,7 @@ export class CoercibleProperty extends Property imp
};
this.coerce = function (target: T): void {
- const originalValue: U = coerceKey in target ? target[coerceKey] : defaultValue;
+ const originalValue = (coerceKey in target ? target[coerceKey] : defaultValue);
// need that to make coercing but also fire change events
target[propertyName] = originalValue;
};
@@ -662,7 +662,7 @@ export class CssProperty implements CssProperty {
value = valueConverter && typeof newValue === 'string' ? valueConverter(newValue) : newValue;
}
- const oldValue: U = key in this ? this[key] : defaultValue;
+ const oldValue = (key in this ? this[key] : defaultValue);
const changed: boolean = equalityComparer ? !equalityComparer(oldValue, value) : oldValue !== value;
if (changed) {
@@ -747,7 +747,7 @@ export class CssProperty implements CssProperty {
this[sourceKey] = ValueSource.Css;
}
- const oldValue: U = key in this ? this[key] : defaultValue;
+ const oldValue = (key in this ? this[key] : defaultValue);
const changed: boolean = equalityComparer ? !equalityComparer(oldValue, value) : oldValue !== value;
if (changed) {
diff --git a/packages/webpack5/package.json b/packages/webpack5/package.json
index 0f4a73f7ba..1ef7a9b7f9 100644
--- a/packages/webpack5/package.json
+++ b/packages/webpack5/package.json
@@ -56,18 +56,18 @@
"devDependencies": {
"@angular-devkit/build-angular": "^15.0.1",
"@types/css": "0.0.33",
- "@types/jest": "29.1.1",
+ "@types/jest": "29.4.0",
"@types/loader-utils": "2.0.3",
"@types/lodash.get": "4.4.7",
"@types/micromatch": "4.0.2",
"@types/sax": "1.2.4",
"@types/terser-webpack-plugin": "5.2.0",
"@types/webpack-virtual-modules": "0.1.1",
- "jest": "29.1.2",
- "jest-matcher-utils": "29.1.2",
+ "jest": "29.4.1",
+ "jest-matcher-utils": "29.4.1",
"nativescript-vue-template-compiler": "2.9.3",
- "ts-jest": "29.0.3",
- "typescript": "4.8.4"
+ "ts-jest": "29.0.5",
+ "typescript": "~4.9.5"
},
"peerDependencies": {
"nativescript-vue-template-compiler": "^2.8.1"
diff --git a/tools/assets/App_Resources/Android/app.gradle b/tools/assets/App_Resources/Android/app.gradle
index 1c5f15925a..ebf69ee082 100644
--- a/tools/assets/App_Resources/Android/app.gradle
+++ b/tools/assets/App_Resources/Android/app.gradle
@@ -6,10 +6,11 @@
//}
android {
- compileSdkVersion 31
+ compileSdkVersion 33
+ buildToolsVersion "33.0.0"
defaultConfig {
- minSdkVersion 19
- targetSdkVersion 31
+ minSdkVersion 23
+ targetSdkVersion 33
generatedDensities = []
}
aaptOptions {
diff --git a/tools/notes/CodingConvention.md b/tools/notes/CodingConvention.md
index e20320c82f..1f8ceebe46 100644
--- a/tools/notes/CodingConvention.md
+++ b/tools/notes/CodingConvention.md
@@ -1,14 +1,5 @@
# NativeScript Modules Coding Convention
-## Linting
-
-We use [TSLint](https://palantir.github.io/tslint/) for linting. Rules are defined in `build/tslint.json`.
-Run the tslint from the root of the repo with:
-
-```bash
-npm run tslint
-```
-
## Tabs vs Spaces
Use 4 spaces indentation.
From 571d5156ec9eb764afedde3944be3120d4d95208 Mon Sep 17 00:00:00 2001
From: Igor Randjelovic
Date: Tue, 31 Jan 2023 07:22:42 +0100
Subject: [PATCH 36/76] fix(core): add equalityComparer to border-radius
properties (#10185)
---
packages/core/ui/styling/style-properties.ts | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/packages/core/ui/styling/style-properties.ts b/packages/core/ui/styling/style-properties.ts
index 90e9ad1a6b..54857c7e6e 100644
--- a/packages/core/ui/styling/style-properties.ts
+++ b/packages/core/ui/styling/style-properties.ts
@@ -1171,6 +1171,7 @@ export const borderTopLeftRadiusProperty = new CssProperty