diff --git a/.eslintrc b/.eslintrc
index 12c201f..d3db0e1 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -100,7 +100,7 @@
"no-multi-str": "error",
"no-multiple-empty-lines": "error",
"no-negated-condition": "off",
- "no-nested-ternary": "error",
+ "no-nested-ternary": "off",
"no-new": "error",
"no-new-func": "error",
"no-new-object": "error",
@@ -230,6 +230,7 @@
"ecmaVersion": 6,
"ecmaFeatures": {
"impliedStrict": true
- }
+ },
+ "sourceType": "module"
}
}
diff --git a/.gitignore b/.gitignore
index 8a00a0a..af55efb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,6 +8,7 @@ report
app/**/*.map
app/**/*-ts-*.js
+.migration_backup/
.DS_Store
**/*.log
diff --git a/.npmrc b/.npmrc
deleted file mode 100644
index 43c97e7..0000000
--- a/.npmrc
+++ /dev/null
@@ -1 +0,0 @@
-package-lock=false
diff --git a/CONTRIBUTE.md b/CONTRIBUTE.md
index 7b77e50..e6b89f2 100644
--- a/CONTRIBUTE.md
+++ b/CONTRIBUTE.md
@@ -35,11 +35,10 @@ Set Button in XML
######text.component.js
```JavaScript
-var EventData = require("tns-core-modules/data/observable").EventData;
-var Button = require("tns-core-modules/ui/button").Button;
+import { Button, EventData } from "@nativescript/core";
// >> button-tap-javascript
-exports.onTap = function(args) {
+export function onTap(args) {
var myButton = args.object;
console.log(myButton + " was tapped!");
}
@@ -49,8 +48,7 @@ exports.onTap = function(args) {
######text.component.ts
```TypeScript
-import { EventData } from "tns-core-modules/data/observable";
-import { Button } from "tns-core-modules/ui/button";
+import { Button, EventData } from "@nativescript/core";
// >> button-tap-ts
export function onTap(args: EventData) {
diff --git a/app/App_Resources/Android/AndroidManifest.xml b/app/App_Resources/Android/src/main/AndroidManifest.xml
similarity index 100%
rename from app/App_Resources/Android/AndroidManifest.xml
rename to app/App_Resources/Android/src/main/AndroidManifest.xml
diff --git a/app/App_Resources/Android/drawable-hdpi/background.png b/app/App_Resources/Android/src/main/res/drawable-hdpi/background.png
similarity index 100%
rename from app/App_Resources/Android/drawable-hdpi/background.png
rename to app/App_Resources/Android/src/main/res/drawable-hdpi/background.png
diff --git a/app/App_Resources/Android/drawable-hdpi/icon.png b/app/App_Resources/Android/src/main/res/drawable-hdpi/icon.png
similarity index 100%
rename from app/App_Resources/Android/drawable-hdpi/icon.png
rename to app/App_Resources/Android/src/main/res/drawable-hdpi/icon.png
diff --git a/app/App_Resources/Android/drawable-hdpi/logo.png b/app/App_Resources/Android/src/main/res/drawable-hdpi/logo.png
similarity index 100%
rename from app/App_Resources/Android/drawable-hdpi/logo.png
rename to app/App_Resources/Android/src/main/res/drawable-hdpi/logo.png
diff --git a/app/App_Resources/Android/drawable-hdpi/menu.png b/app/App_Resources/Android/src/main/res/drawable-hdpi/menu.png
similarity index 100%
rename from app/App_Resources/Android/drawable-hdpi/menu.png
rename to app/App_Resources/Android/src/main/res/drawable-hdpi/menu.png
diff --git a/app/App_Resources/Android/drawable-ldpi/background.png b/app/App_Resources/Android/src/main/res/drawable-ldpi/background.png
similarity index 100%
rename from app/App_Resources/Android/drawable-ldpi/background.png
rename to app/App_Resources/Android/src/main/res/drawable-ldpi/background.png
diff --git a/app/App_Resources/Android/drawable-ldpi/icon.png b/app/App_Resources/Android/src/main/res/drawable-ldpi/icon.png
similarity index 100%
rename from app/App_Resources/Android/drawable-ldpi/icon.png
rename to app/App_Resources/Android/src/main/res/drawable-ldpi/icon.png
diff --git a/app/App_Resources/Android/drawable-ldpi/logo.png b/app/App_Resources/Android/src/main/res/drawable-ldpi/logo.png
similarity index 100%
rename from app/App_Resources/Android/drawable-ldpi/logo.png
rename to app/App_Resources/Android/src/main/res/drawable-ldpi/logo.png
diff --git a/app/App_Resources/Android/drawable-ldpi/menu.png b/app/App_Resources/Android/src/main/res/drawable-ldpi/menu.png
similarity index 100%
rename from app/App_Resources/Android/drawable-ldpi/menu.png
rename to app/App_Resources/Android/src/main/res/drawable-ldpi/menu.png
diff --git a/app/App_Resources/Android/drawable-mdpi/background.png b/app/App_Resources/Android/src/main/res/drawable-mdpi/background.png
similarity index 100%
rename from app/App_Resources/Android/drawable-mdpi/background.png
rename to app/App_Resources/Android/src/main/res/drawable-mdpi/background.png
diff --git a/app/App_Resources/Android/drawable-mdpi/icon.png b/app/App_Resources/Android/src/main/res/drawable-mdpi/icon.png
similarity index 100%
rename from app/App_Resources/Android/drawable-mdpi/icon.png
rename to app/App_Resources/Android/src/main/res/drawable-mdpi/icon.png
diff --git a/app/App_Resources/Android/drawable-mdpi/logo.png b/app/App_Resources/Android/src/main/res/drawable-mdpi/logo.png
similarity index 100%
rename from app/App_Resources/Android/drawable-mdpi/logo.png
rename to app/App_Resources/Android/src/main/res/drawable-mdpi/logo.png
diff --git a/app/App_Resources/Android/drawable-mdpi/menu.png b/app/App_Resources/Android/src/main/res/drawable-mdpi/menu.png
similarity index 100%
rename from app/App_Resources/Android/drawable-mdpi/menu.png
rename to app/App_Resources/Android/src/main/res/drawable-mdpi/menu.png
diff --git a/app/App_Resources/Android/drawable-nodpi/splash_screen.xml b/app/App_Resources/Android/src/main/res/drawable-nodpi/splash_screen.xml
similarity index 100%
rename from app/App_Resources/Android/drawable-nodpi/splash_screen.xml
rename to app/App_Resources/Android/src/main/res/drawable-nodpi/splash_screen.xml
diff --git a/app/App_Resources/Android/drawable-xhdpi/background.png b/app/App_Resources/Android/src/main/res/drawable-xhdpi/background.png
similarity index 100%
rename from app/App_Resources/Android/drawable-xhdpi/background.png
rename to app/App_Resources/Android/src/main/res/drawable-xhdpi/background.png
diff --git a/app/App_Resources/Android/drawable-xhdpi/icon.png b/app/App_Resources/Android/src/main/res/drawable-xhdpi/icon.png
similarity index 100%
rename from app/App_Resources/Android/drawable-xhdpi/icon.png
rename to app/App_Resources/Android/src/main/res/drawable-xhdpi/icon.png
diff --git a/app/App_Resources/Android/drawable-xhdpi/logo.png b/app/App_Resources/Android/src/main/res/drawable-xhdpi/logo.png
similarity index 100%
rename from app/App_Resources/Android/drawable-xhdpi/logo.png
rename to app/App_Resources/Android/src/main/res/drawable-xhdpi/logo.png
diff --git a/app/App_Resources/Android/drawable-xhdpi/menu.png b/app/App_Resources/Android/src/main/res/drawable-xhdpi/menu.png
similarity index 100%
rename from app/App_Resources/Android/drawable-xhdpi/menu.png
rename to app/App_Resources/Android/src/main/res/drawable-xhdpi/menu.png
diff --git a/app/App_Resources/Android/drawable-xxhdpi/background.png b/app/App_Resources/Android/src/main/res/drawable-xxhdpi/background.png
similarity index 100%
rename from app/App_Resources/Android/drawable-xxhdpi/background.png
rename to app/App_Resources/Android/src/main/res/drawable-xxhdpi/background.png
diff --git a/app/App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_account_balance_black_18pt.png b/app/App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_account_balance_black_18pt.png
new file mode 100755
index 0000000..80fc185
Binary files /dev/null and b/app/App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_account_balance_black_18pt.png differ
diff --git a/app/App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_account_balance_black_24pt.png b/app/App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_account_balance_black_24pt.png
new file mode 100755
index 0000000..6fe8260
Binary files /dev/null and b/app/App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_account_balance_black_24pt.png differ
diff --git a/app/App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_account_balance_black_36pt.png b/app/App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_account_balance_black_36pt.png
new file mode 100755
index 0000000..43bc691
Binary files /dev/null and b/app/App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_account_balance_black_36pt.png differ
diff --git a/app/App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_account_balance_black_48pt.png b/app/App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_account_balance_black_48pt.png
new file mode 100755
index 0000000..2b9f841
Binary files /dev/null and b/app/App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_account_balance_black_48pt.png differ
diff --git a/app/App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_home_black_18pt.png b/app/App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_home_black_18pt.png
new file mode 100755
index 0000000..52ac80e
Binary files /dev/null and b/app/App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_home_black_18pt.png differ
diff --git a/app/App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_home_black_24pt.png b/app/App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_home_black_24pt.png
new file mode 100755
index 0000000..bcbeb19
Binary files /dev/null and b/app/App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_home_black_24pt.png differ
diff --git a/app/App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_home_black_36pt.png b/app/App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_home_black_36pt.png
new file mode 100755
index 0000000..aac69f8
Binary files /dev/null and b/app/App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_home_black_36pt.png differ
diff --git a/app/App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_home_black_48pt.png b/app/App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_home_black_48pt.png
new file mode 100755
index 0000000..2eb968b
Binary files /dev/null and b/app/App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_home_black_48pt.png differ
diff --git a/app/App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_search_black_18pt.png b/app/App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_search_black_18pt.png
new file mode 100755
index 0000000..e225a47
Binary files /dev/null and b/app/App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_search_black_18pt.png differ
diff --git a/app/App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_search_black_24pt.png b/app/App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_search_black_24pt.png
new file mode 100755
index 0000000..96f68e2
Binary files /dev/null and b/app/App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_search_black_24pt.png differ
diff --git a/app/App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_search_black_36pt.png b/app/App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_search_black_36pt.png
new file mode 100755
index 0000000..353d5f3
Binary files /dev/null and b/app/App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_search_black_36pt.png differ
diff --git a/app/App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_search_black_48pt.png b/app/App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_search_black_48pt.png
new file mode 100755
index 0000000..9a5c0bf
Binary files /dev/null and b/app/App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_search_black_48pt.png differ
diff --git a/app/App_Resources/Android/drawable-xxhdpi/icon.png b/app/App_Resources/Android/src/main/res/drawable-xxhdpi/icon.png
similarity index 100%
rename from app/App_Resources/Android/drawable-xxhdpi/icon.png
rename to app/App_Resources/Android/src/main/res/drawable-xxhdpi/icon.png
diff --git a/app/App_Resources/Android/drawable-xxhdpi/logo.png b/app/App_Resources/Android/src/main/res/drawable-xxhdpi/logo.png
similarity index 100%
rename from app/App_Resources/Android/drawable-xxhdpi/logo.png
rename to app/App_Resources/Android/src/main/res/drawable-xxhdpi/logo.png
diff --git a/app/App_Resources/Android/drawable-xxhdpi/menu.png b/app/App_Resources/Android/src/main/res/drawable-xxhdpi/menu.png
similarity index 100%
rename from app/App_Resources/Android/drawable-xxhdpi/menu.png
rename to app/App_Resources/Android/src/main/res/drawable-xxhdpi/menu.png
diff --git a/app/App_Resources/Android/drawable-xxxhdpi/background.png b/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/background.png
similarity index 100%
rename from app/App_Resources/Android/drawable-xxxhdpi/background.png
rename to app/App_Resources/Android/src/main/res/drawable-xxxhdpi/background.png
diff --git a/app/App_Resources/Android/drawable-xxxhdpi/icon.png b/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/icon.png
similarity index 100%
rename from app/App_Resources/Android/drawable-xxxhdpi/icon.png
rename to app/App_Resources/Android/src/main/res/drawable-xxxhdpi/icon.png
diff --git a/app/App_Resources/Android/drawable-xxxhdpi/logo.png b/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/logo.png
similarity index 100%
rename from app/App_Resources/Android/drawable-xxxhdpi/logo.png
rename to app/App_Resources/Android/src/main/res/drawable-xxxhdpi/logo.png
diff --git a/app/App_Resources/Android/drawable-xxxhdpi/menu.png b/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/menu.png
similarity index 100%
rename from app/App_Resources/Android/drawable-xxxhdpi/menu.png
rename to app/App_Resources/Android/src/main/res/drawable-xxxhdpi/menu.png
diff --git a/app/App_Resources/Android/values-v21/colors.xml b/app/App_Resources/Android/src/main/res/values-v21/colors.xml
similarity index 100%
rename from app/App_Resources/Android/values-v21/colors.xml
rename to app/App_Resources/Android/src/main/res/values-v21/colors.xml
diff --git a/app/App_Resources/Android/values-v21/styles.xml b/app/App_Resources/Android/src/main/res/values-v21/styles.xml
similarity index 100%
rename from app/App_Resources/Android/values-v21/styles.xml
rename to app/App_Resources/Android/src/main/res/values-v21/styles.xml
diff --git a/app/App_Resources/Android/values/colors.xml b/app/App_Resources/Android/src/main/res/values/colors.xml
similarity index 100%
rename from app/App_Resources/Android/values/colors.xml
rename to app/App_Resources/Android/src/main/res/values/colors.xml
diff --git a/app/App_Resources/Android/values/styles.xml b/app/App_Resources/Android/src/main/res/values/styles.xml
similarity index 100%
rename from app/App_Resources/Android/values/styles.xml
rename to app/App_Resources/Android/src/main/res/values/styles.xml
diff --git a/app/App_Resources/iOS/baseline_account_balance_black_18pt@1x.png b/app/App_Resources/iOS/baseline_account_balance_black_18pt@1x.png
new file mode 100755
index 0000000..8f7c904
Binary files /dev/null and b/app/App_Resources/iOS/baseline_account_balance_black_18pt@1x.png differ
diff --git a/app/App_Resources/iOS/baseline_account_balance_black_18pt@2x.png b/app/App_Resources/iOS/baseline_account_balance_black_18pt@2x.png
new file mode 100755
index 0000000..4ffd291
Binary files /dev/null and b/app/App_Resources/iOS/baseline_account_balance_black_18pt@2x.png differ
diff --git a/app/App_Resources/iOS/baseline_account_balance_black_18pt@3x.png b/app/App_Resources/iOS/baseline_account_balance_black_18pt@3x.png
new file mode 100755
index 0000000..80fc185
Binary files /dev/null and b/app/App_Resources/iOS/baseline_account_balance_black_18pt@3x.png differ
diff --git a/app/App_Resources/iOS/baseline_account_balance_black_24pt@1x.png b/app/App_Resources/iOS/baseline_account_balance_black_24pt@1x.png
new file mode 100755
index 0000000..384f82d
Binary files /dev/null and b/app/App_Resources/iOS/baseline_account_balance_black_24pt@1x.png differ
diff --git a/app/App_Resources/iOS/baseline_account_balance_black_24pt@2x.png b/app/App_Resources/iOS/baseline_account_balance_black_24pt@2x.png
new file mode 100755
index 0000000..caac1ad
Binary files /dev/null and b/app/App_Resources/iOS/baseline_account_balance_black_24pt@2x.png differ
diff --git a/app/App_Resources/iOS/baseline_account_balance_black_24pt@3x.png b/app/App_Resources/iOS/baseline_account_balance_black_24pt@3x.png
new file mode 100755
index 0000000..6fe8260
Binary files /dev/null and b/app/App_Resources/iOS/baseline_account_balance_black_24pt@3x.png differ
diff --git a/app/App_Resources/iOS/baseline_home_black_18pt@1x.png b/app/App_Resources/iOS/baseline_home_black_18pt@1x.png
new file mode 100755
index 0000000..aa43dda
Binary files /dev/null and b/app/App_Resources/iOS/baseline_home_black_18pt@1x.png differ
diff --git a/app/App_Resources/iOS/baseline_home_black_18pt@2x.png b/app/App_Resources/iOS/baseline_home_black_18pt@2x.png
new file mode 100755
index 0000000..a9e2993
Binary files /dev/null and b/app/App_Resources/iOS/baseline_home_black_18pt@2x.png differ
diff --git a/app/App_Resources/iOS/baseline_home_black_18pt@3x.png b/app/App_Resources/iOS/baseline_home_black_18pt@3x.png
new file mode 100755
index 0000000..52ac80e
Binary files /dev/null and b/app/App_Resources/iOS/baseline_home_black_18pt@3x.png differ
diff --git a/app/App_Resources/iOS/baseline_home_black_24pt@1x.png b/app/App_Resources/iOS/baseline_home_black_24pt@1x.png
new file mode 100755
index 0000000..1eba637
Binary files /dev/null and b/app/App_Resources/iOS/baseline_home_black_24pt@1x.png differ
diff --git a/app/App_Resources/iOS/baseline_home_black_24pt@2x.png b/app/App_Resources/iOS/baseline_home_black_24pt@2x.png
new file mode 100755
index 0000000..e20865a
Binary files /dev/null and b/app/App_Resources/iOS/baseline_home_black_24pt@2x.png differ
diff --git a/app/App_Resources/iOS/baseline_home_black_24pt@3x.png b/app/App_Resources/iOS/baseline_home_black_24pt@3x.png
new file mode 100755
index 0000000..bcbeb19
Binary files /dev/null and b/app/App_Resources/iOS/baseline_home_black_24pt@3x.png differ
diff --git a/app/App_Resources/iOS/baseline_search_black_18pt@1x.png b/app/App_Resources/iOS/baseline_search_black_18pt@1x.png
new file mode 100755
index 0000000..70203ac
Binary files /dev/null and b/app/App_Resources/iOS/baseline_search_black_18pt@1x.png differ
diff --git a/app/App_Resources/iOS/baseline_search_black_18pt@2x.png b/app/App_Resources/iOS/baseline_search_black_18pt@2x.png
new file mode 100755
index 0000000..c1066f3
Binary files /dev/null and b/app/App_Resources/iOS/baseline_search_black_18pt@2x.png differ
diff --git a/app/App_Resources/iOS/baseline_search_black_18pt@3x.png b/app/App_Resources/iOS/baseline_search_black_18pt@3x.png
new file mode 100755
index 0000000..e225a47
Binary files /dev/null and b/app/App_Resources/iOS/baseline_search_black_18pt@3x.png differ
diff --git a/app/App_Resources/iOS/baseline_search_black_24pt@1x.png b/app/App_Resources/iOS/baseline_search_black_24pt@1x.png
new file mode 100755
index 0000000..87e74ff
Binary files /dev/null and b/app/App_Resources/iOS/baseline_search_black_24pt@1x.png differ
diff --git a/app/App_Resources/iOS/baseline_search_black_24pt@2x.png b/app/App_Resources/iOS/baseline_search_black_24pt@2x.png
new file mode 100755
index 0000000..090acd4
Binary files /dev/null and b/app/App_Resources/iOS/baseline_search_black_24pt@2x.png differ
diff --git a/app/App_Resources/iOS/baseline_search_black_24pt@3x.png b/app/App_Resources/iOS/baseline_search_black_24pt@3x.png
new file mode 100755
index 0000000..96f68e2
Binary files /dev/null and b/app/App_Resources/iOS/baseline_search_black_24pt@3x.png differ
diff --git a/app/app.css b/app/app.css
index 7440e9d..005e770 100644
--- a/app/app.css
+++ b/app/app.css
@@ -1,34 +1,17 @@
-/*
-In NativeScript, the app.css file is where you place CSS rules that
-you would like to apply to your entire application. Check out
-http://docs.nativescript.org/ui/styling for a full list of the CSS
-selectors and properties you can use to style UI components.
-
-/*
-In many cases you may want to use the NativeScript core theme instead
-of writing your own CSS rules. For a full list of class names in the theme
-refer to http://docs.nativescript.org/ui/theme.
-The imported CSS rules must precede all other types of rules.
-*/
-@import '~nativescript-theme-core/css/core.light.css';
-
-/*
-The following CSS rule changes the font size of all UI
-components that have the btn class name.
-*/
-.btn {
- font-size: 18;
-}
+@import '~nativescript-theme-core/css/core.css';
+@import '~nativescript-theme-core/css/forest.css';
.far {
font-family: "Font Awesome 5 Free", "fa-regular-400";
+ font-weight: 400;
}
.fab {
font-family: "Font Awesome 5 Brands", "fa-brands-400";
+ font-weight: 400;
}
.fas {
font-family: "Font Awesome 5 Free", "fa-solid-900";
-}
-
+ font-weight: 900;
+}
\ No newline at end of file
diff --git a/app/app.js b/app/app.js
index 4d735d6..12f00eb 100644
--- a/app/app.js
+++ b/app/app.js
@@ -1,19 +1,20 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-var application = require("tns-core-modules/application");
-var platformModule = require("tns-core-modules/platform");
-var applicationSettingsModule = require("tns-core-modules/application-settings");
-var deepLinkDataModule = require("./shared/deep-link-data");
-if (platformModule.isIOS) {
- var mydelegate = require("./delegate/my-delegate");
- application.ios.delegate = mydelegate.MyDelegate;
+/*
+In NativeScript, the app.js file is the entry point to your application.
+You can use this file to perform app-level initialization, but the primary
+purpose of the file is to pass control to the app’s first module.
+*/
+import { Application, ApplicationSettings, isIOS } from "@nativescript/core";
+import { DeepLinkData } from "./shared/deep-link-data";
+if (isIOS) {
+ const mydelegate = require("./delegate/my-delegate");
+ Application.ios.delegate = mydelegate.MyDelegate;
}
function launchExample() {
- var rootView = application.getRootView();
- if (applicationSettingsModule.hasKey("gotoexample")) {
- var value = applicationSettingsModule.getString("gotoexample");
+ const rootView = Application.getRootView();
+ if (ApplicationSettings.hasKey("gotoexample")) {
+ const value = ApplicationSettings.getString("gotoexample");
if (value !== "") {
- applicationSettingsModule.remove("gotoexample");
+ ApplicationSettings.remove("gotoexample");
rootView.navigate({
moduleName: value,
clearHistory: true
@@ -21,14 +22,17 @@ function launchExample() {
}
}
}
-application.on(application.resumeEvent, function (args) {
+Application.on(Application.resumeEvent, (args) => {
if (args.android) {
- var dld = new deepLinkDataModule.DeepLinkData("", args.android);
+ const dld = new DeepLinkData("", args.android);
launchExample();
}
else if (args.ios) {
launchExample();
}
});
-application.run({ moduleName: "app-root" });
-//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXBwLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiYXBwLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBS0EsMERBQTREO0FBQzVELDBEQUE0RDtBQUM1RCxpRkFBa0Y7QUFFbEYsSUFBTSxrQkFBa0IsR0FBRyxPQUFPLENBQUMseUJBQXlCLENBQUMsQ0FBQztBQUM5RCxJQUFJLGNBQWMsQ0FBQyxLQUFLLEVBQUU7SUFDdEIsSUFBTSxVQUFVLEdBQUcsT0FBTyxDQUFDLHdCQUF3QixDQUFDLENBQUM7SUFDckQsV0FBVyxDQUFDLEdBQUcsQ0FBQyxRQUFRLEdBQUcsVUFBVSxDQUFDLFVBQVUsQ0FBQztDQUNwRDtBQUVELFNBQVMsYUFBYTtJQUNsQixJQUFNLFFBQVEsR0FBa0IsV0FBVyxDQUFDLFdBQVcsRUFBRSxDQUFDO0lBQzFELElBQUkseUJBQXlCLENBQUMsTUFBTSxDQUFDLGFBQWEsQ0FBQyxFQUFFO1FBQ2pELElBQU0sS0FBSyxHQUFHLHlCQUF5QixDQUFDLFNBQVMsQ0FBQyxhQUFhLENBQUMsQ0FBQztRQUNqRSxJQUFJLEtBQUssS0FBSyxFQUFFLEVBQUU7WUFDZCx5QkFBeUIsQ0FBQyxNQUFNLENBQUMsYUFBYSxDQUFDLENBQUM7WUFDaEQsUUFBUSxDQUFDLFFBQVEsQ0FBQztnQkFDZCxVQUFVLEVBQUUsS0FBSztnQkFDakIsWUFBWSxFQUFFLElBQUk7YUFDckIsQ0FBQyxDQUFDO1NBQ047S0FDSjtBQUNMLENBQUM7QUFDRCxXQUFXLENBQUMsRUFBRSxDQUFDLFdBQVcsQ0FBQyxXQUFXLEVBQUUsVUFBQyxJQUFJO0lBQ3pDLElBQUksSUFBSSxDQUFDLE9BQU8sRUFBRTtRQUNkLElBQU0sR0FBRyxHQUFHLElBQUksa0JBQWtCLENBQUMsWUFBWSxDQUFDLEVBQUUsRUFBRSxJQUFJLENBQUMsT0FBTyxDQUFDLENBQUM7UUFDbEUsYUFBYSxFQUFFLENBQUM7S0FDbkI7U0FBTSxJQUFJLElBQUksQ0FBQyxHQUFHLEVBQUU7UUFDakIsYUFBYSxFQUFFLENBQUM7S0FDbkI7QUFDTCxDQUFDLENBQUMsQ0FBQztBQUNILFdBQVcsQ0FBQyxHQUFHLENBQUMsRUFBRSxVQUFVLEVBQUUsVUFBVSxFQUFFLENBQUMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qXG5JbiBOYXRpdmVTY3JpcHQsIHRoZSBhcHAuanMgZmlsZSBpcyB0aGUgZW50cnkgcG9pbnQgdG8geW91ciBhcHBsaWNhdGlvbi5cbllvdSBjYW4gdXNlIHRoaXMgZmlsZSB0byBwZXJmb3JtIGFwcC1sZXZlbCBpbml0aWFsaXphdGlvbiwgYnV0IHRoZSBwcmltYXJ5XG5wdXJwb3NlIG9mIHRoZSBmaWxlIGlzIHRvIHBhc3MgY29udHJvbCB0byB0aGUgYXBw4oCZcyBmaXJzdCBtb2R1bGUuXG4qL1xuaW1wb3J0ICogYXMgYXBwbGljYXRpb24gZnJvbSBcInRucy1jb3JlLW1vZHVsZXMvYXBwbGljYXRpb25cIjtcbmltcG9ydCAqIGFzIHBsYXRmb3JtTW9kdWxlIGZyb20gXCJ0bnMtY29yZS1tb2R1bGVzL3BsYXRmb3JtXCI7XG5pbXBvcnQgKiBhcyBhcHBsaWNhdGlvblNldHRpbmdzTW9kdWxlIGZyb21cInRucy1jb3JlLW1vZHVsZXMvYXBwbGljYXRpb24tc2V0dGluZ3NcIjtcbmltcG9ydCB7RnJhbWV9IGZyb20gXCJ0bnMtY29yZS1tb2R1bGVzL3VpL2ZyYW1lXCI7XG5jb25zdCBkZWVwTGlua0RhdGFNb2R1bGUgPSByZXF1aXJlKFwiLi9zaGFyZWQvZGVlcC1saW5rLWRhdGFcIik7XG5pZiAocGxhdGZvcm1Nb2R1bGUuaXNJT1MpIHtcbiAgICBjb25zdCBteWRlbGVnYXRlID0gcmVxdWlyZShcIi4vZGVsZWdhdGUvbXktZGVsZWdhdGVcIik7XG4gICAgYXBwbGljYXRpb24uaW9zLmRlbGVnYXRlID0gbXlkZWxlZ2F0ZS5NeURlbGVnYXRlO1xufVxuXG5mdW5jdGlvbiBsYXVuY2hFeGFtcGxlKCkge1xuICAgIGNvbnN0IHJvb3RWaWV3OiBGcmFtZSA9IDxGcmFtZT4gYXBwbGljYXRpb24uZ2V0Um9vdFZpZXcoKTtcbiAgICBpZiAoYXBwbGljYXRpb25TZXR0aW5nc01vZHVsZS5oYXNLZXkoXCJnb3RvZXhhbXBsZVwiKSkge1xuICAgICAgICBjb25zdCB2YWx1ZSA9IGFwcGxpY2F0aW9uU2V0dGluZ3NNb2R1bGUuZ2V0U3RyaW5nKFwiZ290b2V4YW1wbGVcIik7XG4gICAgICAgIGlmICh2YWx1ZSAhPT0gXCJcIikge1xuICAgICAgICAgICAgYXBwbGljYXRpb25TZXR0aW5nc01vZHVsZS5yZW1vdmUoXCJnb3RvZXhhbXBsZVwiKTtcbiAgICAgICAgICAgIHJvb3RWaWV3Lm5hdmlnYXRlKHtcbiAgICAgICAgICAgICAgICBtb2R1bGVOYW1lOiB2YWx1ZSxcbiAgICAgICAgICAgICAgICBjbGVhckhpc3Rvcnk6IHRydWVcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgfVxufVxuYXBwbGljYXRpb24ub24oYXBwbGljYXRpb24ucmVzdW1lRXZlbnQsIChhcmdzKSA9PiB7XG4gICAgaWYgKGFyZ3MuYW5kcm9pZCkge1xuICAgICAgICBjb25zdCBkbGQgPSBuZXcgZGVlcExpbmtEYXRhTW9kdWxlLkRlZXBMaW5rRGF0YShcIlwiLCBhcmdzLmFuZHJvaWQpO1xuICAgICAgICBsYXVuY2hFeGFtcGxlKCk7XG4gICAgfSBlbHNlIGlmIChhcmdzLmlvcykge1xuICAgICAgICBsYXVuY2hFeGFtcGxlKCk7XG4gICAgfVxufSk7XG5hcHBsaWNhdGlvbi5ydW4oeyBtb2R1bGVOYW1lOiBcImFwcC1yb290XCIgfSk7XG5cbi8qXG5EbyBub3QgcGxhY2UgYW55IGNvZGUgYWZ0ZXIgdGhlIGFwcGxpY2F0aW9uIGhhcyBiZWVuIHN0YXJ0ZWQgYXMgaXQgd2lsbCBub3RcbmJlIGV4ZWN1dGVkIG9uIGlPUy5cbiovXG4iXX0=
\ No newline at end of file
+Application.run({ moduleName: "app-root" });
+/*
+Do not place any code after the application has been started as it will not
+be executed on iOS.
+*/
diff --git a/app/app.ts b/app/app.ts
index 0e355c9..00d6bfb 100644
--- a/app/app.ts
+++ b/app/app.ts
@@ -3,22 +3,20 @@ In NativeScript, the app.js file is the entry point to your application.
You can use this file to perform app-level initialization, but the primary
purpose of the file is to pass control to the app’s first module.
*/
-import * as application from "tns-core-modules/application";
-import * as platformModule from "tns-core-modules/platform";
-import * as applicationSettingsModule from"tns-core-modules/application-settings";
-import {Frame} from "tns-core-modules/ui/frame";
-const deepLinkDataModule = require("./shared/deep-link-data");
-if (platformModule.isIOS) {
+import { Application, ApplicationSettings, Frame, isIOS } from "@nativescript/core";
+import { DeepLinkData } from "./shared/deep-link-data";
+
+if (isIOS) {
const mydelegate = require("./delegate/my-delegate");
- application.ios.delegate = mydelegate.MyDelegate;
+ Application.ios.delegate = mydelegate.MyDelegate;
}
function launchExample() {
- const rootView: Frame = application.getRootView();
- if (applicationSettingsModule.hasKey("gotoexample")) {
- const value = applicationSettingsModule.getString("gotoexample");
+ const rootView: Frame = Application.getRootView();
+ if (ApplicationSettings.hasKey("gotoexample")) {
+ const value = ApplicationSettings.getString("gotoexample");
if (value !== "") {
- applicationSettingsModule.remove("gotoexample");
+ ApplicationSettings.remove("gotoexample");
rootView.navigate({
moduleName: value,
clearHistory: true
@@ -26,15 +24,15 @@ function launchExample() {
}
}
}
-application.on(application.resumeEvent, (args) => {
+Application.on(Application.resumeEvent, (args) => {
if (args.android) {
- const dld = new deepLinkDataModule.DeepLinkData("", args.android);
+ const dld = new DeepLinkData("", args.android);
launchExample();
} else if (args.ios) {
launchExample();
}
});
-application.run({ moduleName: "app-root" });
+Application.run({ moduleName: "app-root" });
/*
Do not place any code after the application has been started as it will not
diff --git a/app/delegate/my-delegate.js b/app/delegate/my-delegate.js
index e2e67a1..af27f87 100644
--- a/app/delegate/my-delegate.js
+++ b/app/delegate/my-delegate.js
@@ -1,5 +1,5 @@
-const deepLinkDataModule = require("../shared/deep-link-data");
-const MyDelegate = (function(_super) {
+import { DeepLinkData } from "../shared/deep-link-data";
+export const MyDelegate = (function(_super) {
__extends(MyDelegate, _super);
MyDelegate.ObjCProtocols = [UIApplicationDelegate];
@@ -14,7 +14,7 @@ const MyDelegate = (function(_super) {
MyDelegate.prototype.applicationHandleOpenURL = function (application, url) {
console.log("MyDelegate.prototype.applicationHandleOpenURL");
- const dld = new deepLinkDataModule.DeepLinkData(url, undefined);
+ const dld = new DeepLinkData(url, undefined);
return true;
@@ -23,5 +23,3 @@ const MyDelegate = (function(_super) {
return MyDelegate;
}(UIResponder));
-
-exports.MyDelegate = MyDelegate;
diff --git a/app/home/first-page.js b/app/home/first-page.js
index f6b5fa4..877f0fe 100644
--- a/app/home/first-page.js
+++ b/app/home/first-page.js
@@ -1,20 +1,21 @@
// >> frame-navigate-base
-const getFrameById = require("tns-core-modules/ui/frame").getFrameById;
+import { Frame, Transition } from "@nativescript/core";
+
// >> (hide)
-exports.navigate = function() {
+export function navigate() {
// << (hide)
- // Example using `getFrameById(frameId)` to get a `Frame` reference
+ // Example using `Frame.getFrameById(frameId)` to get a `Frame` reference
// As an alternative, we could use `topmost()` method or `page.frame` property
- const frame = getFrameById("my-frame-id");
+ const frame = Frame.getFrameById("my-frame-id");
frame.navigate("home/second-page");
// >> (hide)
-};
+}
// << (hide)
// << frame-navigate-base
-exports.navigateByModule = function() {
+export function navigateByModule() {
// >> frame-navigate-module
- const frame = getFrameById("my-frame-id");
+ const frame = Frame.getFrameById("my-frame-id");
const navigationEntry = {
moduleName: "home/second-page",
@@ -23,11 +24,11 @@ exports.navigateByModule = function() {
};
frame.navigate(navigationEntry);
// << frame-navigate-module
-};
+}
-exports.navigateWithBackstackVisible = function() {
+export function navigateWithBackstackVisible() {
// >> frame-navigate-backstackvisible
- const frame = getFrameById("my-frame-id");
+ const frame = Frame.getFrameById("my-frame-id");
const navigationEntry = {
moduleName: "home/second-page",
@@ -35,11 +36,11 @@ exports.navigateWithBackstackVisible = function() {
};
frame.navigate(navigationEntry);
// << frame-navigate-backstackvisible
-};
+}
-exports.navigateWithClearHistory = function() {
+export function navigateWithClearHistory() {
// >> frame-navigate-clearhistory
- const frame = getFrameById("my-frame-id");
+ const frame = Frame.getFrameById("my-frame-id");
const navigationEntry = {
moduleName: "home/second-page",
@@ -47,11 +48,11 @@ exports.navigateWithClearHistory = function() {
};
frame.navigate(navigationEntry);
// << frame-navigate-clearhistory
-};
+}
-exports.navigateWithTransition = function() {
+export function navigateWithTransition() {
// >> frame-navigate-transitions
- const frame = getFrameById("my-frame-id");
+ const frame = Frame.getFrameById("my-frame-id");
const navigationEntry = {
moduleName: "home/second-page",
@@ -67,20 +68,20 @@ exports.navigateWithTransition = function() {
// << frame-navigate-transitions
// >> frame-navigate-default-transition
- // const getFrameById = require("tns-core-modules/ui/frame").getFrameById;
- // const myFrame = getFrameById("firstFrame");
+ // import { Frame } from "@nativescript/core";
+ // const myFrame = Frame.getFrameById("firstFrame");
myFrame.transition = { name: "flip" };
myFrame.navigate("main-page");
// << frame-navigate-default-transition
// >> frame-navigate-defailt-transition-app
- // const frameModule = require("tns-core-modules/ui/frame");
- frameModule.Frame.defaultTransition = { name: "fade" };
+ // import { Frame } from "@nativescript/core";
+ Frame.defaultTransition = { name: "fade" };
// << frame-navigate-defailt-transition-app
-};
+}
-exports.navigatePlatformSpecificTransitions = function() {
+export function navigatePlatformSpecificTransitions() {
// >> frame-navigate-platform-specific-transitions
const navigationEntry = {
moduleName: "main-page",
@@ -97,15 +98,16 @@ exports.navigatePlatformSpecificTransitions = function() {
curve: "easeOut"
}
};
- const frame = getFrameById("my-frame");
+ const frame = Frame.getFrameById("my-frame");
frame.navigate(navigationEntry);
// << frame-navigate-platform-specific-transitions
-};
+}
// >> frame-navigate-custom-transitions-android-ts
-const transition = require("tns-core-modules/ui/transition");
+// import { Transition } from "@nativescript/core";
const floatType = java.lang.Float.class.getField("TYPE").get(null);
-const CustomTransition = (function (_super) {
+
+export const CustomTransition = (function (_super) {
__extends(CustomTransition, _super);
function CustomTransition() {
_super.apply(this, arguments);
@@ -113,13 +115,13 @@ const CustomTransition = (function (_super) {
CustomTransition.prototype.createAndroidAnimator = function(transitionType) {
const scaleValues = java.lang.reflect.Array.newInstance(floatType, 2);
switch (transitionType) {
- case transition.AndroidTransitionType.enter:
- case transition.AndroidTransitionType.popEnter:
+ case Transition.AndroidTransitionType.enter:
+ case Transition.AndroidTransitionType.popEnter:
scaleValues[0] = 0;
scaleValues[1] = 1;
break;
- case transition.AndroidTransitionType.exit:
- case transition.AndroidTransitionType.popExit:
+ case Transition.AndroidTransitionType.exit:
+ case Transition.AndroidTransitionType.popExit:
scaleValues[0] = 1;
scaleValues[1] = 0;
break;
@@ -141,13 +143,12 @@ const CustomTransition = (function (_super) {
};
return CustomTransition;
-})(transition.Transition);
-exports.CustomTransition = CustomTransition;
+})(Transition.Transition);
// << frame-navigate-custom-transitions-android-ts
// >> frame-navigate-custom-transitions-ios-ts
-// const transition = require("tns-core-modules/ui/transition");
-const CustomTransitionIOS = (function (_super) {
+// import { Transition } from "@nativescript/core";
+export const CustomTransitionIOS = (function (_super) {
__extends(CustomTransition, _super);
function CustomTransition() {
_super.apply(this, arguments);
@@ -175,15 +176,14 @@ const CustomTransitionIOS = (function (_super) {
};
return CustomTransitionIOS;
-})(transition.Transition);
-exports.CustomTransitionIOS = CustomTransitionIOS;
+})(Transition.Transition);
// << frame-navigate-custom-transitions-ios-ts
-exports.goBack = function() {
+export function goBack() {
// >> frame-navigate-go-back
- // const getFrameById = require("tns-core-modules/ui/frame").getFrameById;
- const myFrame = getFrameById("my-frame");
+ // import { Frame } from "@nativescript/core";
+ const myFrame = Frame.getFrameById("my-frame");
myFrame.goBack();
// << frame-navigate-go-back
-};
+}
diff --git a/app/home/first-ts-page.ts b/app/home/first-ts-page.ts
index aff3464..2b6d9a6 100644
--- a/app/home/first-ts-page.ts
+++ b/app/home/first-ts-page.ts
@@ -1,28 +1,24 @@
-import { AnimationCurve } from "tns-core-modules/ui/enums";
-import * as frameModule from "tns-core-modules/ui/frame";
-import { isAndroid, isIOS } from "tns-core-modules/platform";
-
// >> frame-navigate-base-ts
-import { getFrameById } from "tns-core-modules/ui/frame";
+import { Frame } from "@nativescript/core";
// >> (hide)
export function navigate() {
// << (hide)
- // Example using `getFrameById(frameId)` to get a `Frame` reference
+ // Example using `Frame.getFrameById(frameId)` to get a `Frame` reference
// As an alternative, we could use `topmost()` method or `page.frame` property
- const frame = getFrameById("my-frame-id");
+ const frame = Frame.getFrameById("my-frame-id");
frame.navigate("home/second-page");
// >> (hide)
}
// << (hide)
// << frame-navigate-base-ts
-import { NavigationEntry } from "tns-core-modules/ui/frame";
+import { NavigationEntry } from "@nativescript/core";
export function navigateByModule() {
// >> frame-navigate-module-ts
- const frame = getFrameById("my-frame-id");
+ const frame = Frame.getFrameById("my-frame-id");
- // import { NavigationEntry } from "tns-core-modules/ui/frame";
+ // import { NavigationEntry } from "@nativescript/core";
const navigationEntry: NavigationEntry = {
moduleName: "home/second-page",
context: { info: "something you want to pass to your page" },
@@ -34,9 +30,9 @@ export function navigateByModule() {
export function navigateWithBackstackVisible() {
// >> frame-navigate-backstackvisible-ts
- const frame = getFrameById("my-frame-id");
+ const frame = Frame.getFrameById("my-frame-id");
- // import { NavigationEntry } from "tns-core-modules/ui/frame";
+ // import { NavigationEntry } from "@nativescript/core";
const navigationEntry: NavigationEntry = {
moduleName: "home/second-page",
backstackVisible: false
@@ -47,9 +43,9 @@ export function navigateWithBackstackVisible() {
export function navigateWithClearHistory() {
// >> frame-navigate-clearhistory-ts
- const frame = getFrameById("my-frame-id");
+ const frame = Frame.getFrameById("my-frame-id");
- // import { NavigationEntry } from "tns-core-modules/ui/frame";
+ // import { NavigationEntry } from "@nativescript/core";
const navigationEntry: NavigationEntry = {
moduleName: "home/second-page",
clearHistory: true
@@ -58,12 +54,13 @@ export function navigateWithClearHistory() {
// << frame-navigate-clearhistory-ts
}
+import { Enums } from "@nativescript/core";
+
export function navigateWithTransition() {
// >> frame-navigate-transitions-ts
- const frame = getFrameById("my-frame-id");
+ const frame = Frame.getFrameById("my-frame-id");
- // import { NavigationEntry } from "tns-core-modules/ui/frame";
- // import { AnimationCurve } from "tns-core-modules/ui/enums";
+ // import { Enums, NavigationEntry } from "@nativescript/core";
const navigationEntry: NavigationEntry = {
moduleName: "home/second-page",
animated: true,
@@ -71,7 +68,7 @@ export function navigateWithTransition() {
transition: {
name: "slide",
duration: 380,
- curve: AnimationCurve.easeIn
+ curve: Enums.AnimationCurve.easeIn
}
};
frame.navigate(navigationEntry);
@@ -79,15 +76,15 @@ export function navigateWithTransition() {
// >> frame-navigate-default-transition-ts
- // const getFrameById = require("tns-core-modules/ui/frame").getFrameById;
- // const frame = getFrameById("firstFrame");
+ // import { Frame } from "@nativescript/core";
+ // const frame = Frame.getFrameById("firstFrame");
frame.transition = { name: "flip" };
frame.navigate("main-page");
// << frame-navigate-default-transition-ts
// >> frame-navigate-defailt-transition-app-ts
- // import * as frameModule from "tns-core-modules/ui/frame";
- frameModule.Frame.defaultTransition = { name: "fade" };
+ // import { Frame } from "@nativescript/core";
+ Frame.defaultTransition = { name: "fade" };
// << frame-navigate-defailt-transition-app-ts
}
@@ -100,21 +97,21 @@ export function navigatePlatformSpecificTransitions() {
transitioniOS: {
name: "curl",
duration: 380,
- curve: AnimationCurve.easeInOut
+ curve: Enums.AnimationCurve.easeInOut
},
transitionAndroid: {
name: "explode",
duration: 300,
- curve: AnimationCurve.spring
+ curve: Enums.AnimationCurve.spring
}
};
- const frame = getFrameById("my-frame");
+ const frame = Frame.getFrameById("my-frame");
frame.navigate(navigationEntry);
// << frame-navigate-platform-specific-transitions-ts
}
// >> frame-navigate-custom-transitions-ios-ts
-// import { Transition } from "tns-core-modules/ui/transition";
+// import { Transition } from "@nativescript/core";
declare let UINavigationControllerOperation: any; // or use tns-platform-declarations
export class CustomTransitionIOS extends Transition {
@@ -159,18 +156,18 @@ export class CustomTransitionIOS extends Transition {
// << frame-navigate-custom-transitions-ios-ts
// >> frame-navigate-custom-transitions-android-ts
-import { Transition, AndroidTransitionType } from "tns-core-modules/ui/transition";
+import { Transition } from "@nativescript/core";
export class CustomTransition extends Transition {
public createAndroidAnimator(transitionType: string): android.animation.Animator {
const scaleValues = (Array).create("float", 2);
switch (transitionType) {
- case AndroidTransitionType.enter:
- case AndroidTransitionType.popEnter:
+ case Transition.AndroidTransitionType.enter:
+ case Transition.AndroidTransitionType.popEnter:
scaleValues[0] = 0;
scaleValues[1] = 1;
break;
- case AndroidTransitionType.exit:
- case AndroidTransitionType.popExit:
+ case Transition.AndroidTransitionType.exit:
+ case Transition.AndroidTransitionType.popExit:
scaleValues[0] = 1;
scaleValues[1] = 0;
break;
@@ -197,8 +194,8 @@ export class CustomTransition extends Transition {
export function goBack() {
// >> frame-navigate-go-back-ts
- // import { getFrameById } from "tns-core-modules/ui/frame";
- const myFrame = getFrameById("my-frame");
+ // import { Frame } from "@nativescript/core";
+ const myFrame = Frame.getFrameById("my-frame");
myFrame.goBack();
// << frame-navigate-go-back-ts
}
diff --git a/app/home/second-page.js b/app/home/second-page.js
index a547ff6..2c5e3c8 100644
--- a/app/home/second-page.js
+++ b/app/home/second-page.js
@@ -1,5 +1,5 @@
// >> nav-context-receive
-function onNavigatedTo(args) {
+export function onNavigatedTo(args) {
const page = args.object;
const navigationContext = page.navigationContext;
@@ -8,5 +8,4 @@ function onNavigatedTo(args) {
page.bindingContext = navigationContext;
}
-exports.onNavigatedTo = onNavigatedTo;
// << nav-context-receive
diff --git a/app/home/second-ts-page.ts b/app/home/second-ts-page.ts
index 930fbd7..1362aea 100644
--- a/app/home/second-ts-page.ts
+++ b/app/home/second-ts-page.ts
@@ -1,5 +1,5 @@
// >> nav-context-receive-ts
-import { Page, NavigatedData } from "tns-core-modules/ui/page";
+import { Page, NavigatedData } from "@nativescript/core";
// Event handler for Page "navigatedTo" event attached in details-page.xml e.g.
export function onNavigatedTo(args: NavigatedData): void {
diff --git a/app/link.js b/app/link.js
index 5342e43..87f6f8c 100644
--- a/app/link.js
+++ b/app/link.js
@@ -1,6 +1,8 @@
-function Link(title, link) {
- this.title = title;
- this.link = link;
+class Link {
+ constructor(title, link) {
+ this.title = title;
+ this.link = link;
+ }
}
-module.exports = Link;
+export default Link;
diff --git a/app/links-view-model.js b/app/links-view-model.js
index bca5418..8485461 100644
--- a/app/links-view-model.js
+++ b/app/links-view-model.js
@@ -1,6 +1,4 @@
-const observableModule = require("tns-core-modules/data/observable");
-const observableArrayModule = require("tns-core-modules/data/observable-array");
-const frameModule = require("tns-core-modules/ui/frame");
+import { Frame, ObservableArray, fromObject } from "@nativescript/core";
function linksSort(value) {
value.sort((a, b) => {
@@ -16,24 +14,23 @@ function linksSort(value) {
function ListViewLinksModel(info) {
info = info || {};
linksSort(info.links);
-
- const viewModel = new observableModule.fromObject({
- "links": new observableArrayModule.ObservableArray(info.links),
+ const viewModel = new fromObject({
+ "links": new ObservableArray(info.links),
"actionBarTitle": info.actionBarTitle,
"showTypeScriptExamples": info.showTypeScriptExamples ? info.showTypeScriptExamples : false,
- "tsclinks": info.tsclinks ? new observableArrayModule.ObservableArray(info.tsclinks) : undefined
+ "tsclinks": info.tsclinks ? new ObservableArray(info.tsclinks) : undefined
});
viewModel.set("onItemTap", (args) => {
const linkItem = viewModel.get("links").getItem(args.index);
- frameModule.topmost().navigate({
+ Frame.topmost().navigate({
moduleName: linkItem.link,
context: { "title": linkItem.title }
});
});
viewModel.set("onSecondItemTap", (args) => {
const linkItem = viewModel.get("tsclinks").getItem(args.index);
- frameModule.topmost().navigate({
+ Frame.topmost().navigate({
moduleName: linkItem.link,
context: { "title": linkItem.title }
});
@@ -46,4 +43,4 @@ function ListViewLinksModel(info) {
return viewModel;
}
-module.exports = ListViewLinksModel;
+export default ListViewLinksModel;
diff --git a/app/main-page.js b/app/main-page.js
index 809d393..a7840b2 100644
--- a/app/main-page.js
+++ b/app/main-page.js
@@ -1,59 +1,62 @@
-const ListViewLinksModel = require("./links-view-model");
-const link = require("./link");
+import Link from "./link";
+import ListViewLinksModel from "./links-view-model";
+
const navigationLinks = [
- new link("Observable", "ns-framework-modules-category/observable/observable-page"),
- new link("Observable Array", "ns-framework-modules-category/observable-array/observable-array-page"),
- new link("Virtual Array", "ns-framework-modules-category/virtual-array/virtual-array-page"),
- new link("Application", "ns-framework-modules-category/application/application-page"),
- new link("Application Settings", "ns-framework-modules-category/application-settings/application-settings-page"),
- new link("Action Bar", "ns-ui-widgets-category/action-bar/action-bar-page"),
- new link("ActivityIndicator", "ns-ui-widgets-category/activity-indicator/activity-indicator-page"),
- new link("Animations", "ns-ui-widgets-category/animations/animations-page"),
- new link("Button", "ns-ui-widgets-category/button/button-page"),
- new link("Color", "ns-framework-modules-category/color/color-page"),
- new link("Connectivity", "ns-framework-modules-category/connectivity/connectivity-page"),
- new link("Console", "ns-framework-modules-category/console/console-page"),
- new link("DatePicker", "ns-ui-widgets-category/date-picker/date-picker-page"),
- new link("Dialogs", "ns-ui-widgets-category/dialogs/dialogs-page"),
- new link("Gestures", "ns-ui-widgets-category/gestures/gestures-page"),
- new link("HtmlView", "ns-ui-widgets-category/html-view/html-view-page"),
- new link("IconFonts", "ns-ui-category/icon-fonts/icon-fonts-page"),
- new link("Image", "ns-ui-widgets-category/image/image-page"),
- new link("Image Cache", "ns-ui-widgets-category/image-cache/image-cache-page"),
- new link("Layouts", "ns-ui-widgets-category/layouts/layouts-page"),
- new link("TimePicker", "ns-ui-widgets-category/time-picker/time-picker-page"),
- new link("ScrollView", "ns-ui-widgets-category/scroll-view/scroll-view-page"),
- new link("SearchBar", "ns-ui-widgets-category/search-bar/search-bar-page"),
- new link("SegmentedBar", "ns-ui-widgets-category/segmented-bar/segmented-bar-page"),
- new link("Slider", "ns-ui-widgets-category/slider/slider-page"),
- new link("Switch", "ns-ui-widgets-category/switch/switch-page"),
- new link("TabView", "ns-ui-widgets-category/tab-view/tab-view-page"),
- new link("TextField", "ns-ui-widgets-category/text-field/text-field-page"),
- new link("TextView", "ns-ui-widgets-category/text-view/text-view-page"),
- new link("WebView", "ns-ui-widgets-category/web-view/web-view-page"),
- new link("Style", "ns-ui-widgets-category/styling/styling-page"),
- new link("Label", "ns-ui-widgets-category/label/label-page"),
- new link("ListPicker", "ns-ui-widgets-category/list-picker/list-picker-page"),
- new link("ListView", "ns-ui-widgets-category/list-view/list-view-page"),
- new link("Page", "ns-ui-widgets-category/page/page-page"),
- new link("Progress", "ns-ui-widgets-category/progress/progress-page"),
- new link("Frame", "ns-ui-widgets-category/frame/frame-page"),
- new link("Formatted String", "ns-ui-widgets-category/formatted-string/formatted-string-page"),
- new link("Trace Module", "ns-framework-modules-category/trace/trace-page"),
- new link("Timer Module", "ns-framework-modules-category/timer/timer-page"),
- new link("Placeholder", "ns-ui-widgets-category/placeholder/placeholder-page"),
- new link("Repeater", "ns-ui-widgets-category/repeater/repeater-page"),
- new link("Platform Module", "ns-framework-modules-category/platform/platform-page"),
- new link("FPS Meter", "ns-framework-modules-category/fps-meter/fps-meter-page"),
- new link("HTTP Module", "ns-framework-modules-category/http/http-page"),
- new link("Fetch", "ns-framework-modules-category/fetch/fetch-page"),
- new link("ImageSource", "ns-framework-modules-category/image-source/image-source-page"),
- new link("File System", "ns-framework-modules-category/file-system/file-system-page"),
- new link("Modal view", "ns-ui-category/modal-view/modal-view-examples-page"),
- new link("XML Parser", "ns-framework-modules-category/xml-parser/xml-parser-page")
+ new Link("Observable", "ns-framework-modules-category/observable/observable-page"),
+ new Link("Observable Array", "ns-framework-modules-category/observable-array/observable-array-page"),
+ new Link("Virtual Array", "ns-framework-modules-category/virtual-array/virtual-array-page"),
+ new Link("Application", "ns-framework-modules-category/application/application-page"),
+ new Link("Application Settings", "ns-framework-modules-category/application-settings/application-settings-page"),
+ new Link("Action Bar", "ns-ui-widgets-category/action-bar/action-bar-page"),
+ new Link("ActivityIndicator", "ns-ui-widgets-category/activity-indicator/activity-indicator-page"),
+ new Link("Animations", "ns-ui-widgets-category/animations/animations-page"),
+ new Link("Button", "ns-ui-widgets-category/button/button-page"),
+ new Link("Color", "ns-framework-modules-category/color/color-page"),
+ new Link("Connectivity", "ns-framework-modules-category/connectivity/connectivity-page"),
+ new Link("Console", "ns-framework-modules-category/console/console-page"),
+ new Link("DatePicker", "ns-ui-widgets-category/date-picker/date-picker-page"),
+ new Link("Dialogs", "ns-ui-widgets-category/dialogs/dialogs-page"),
+ new Link("Gestures", "ns-ui-widgets-category/gestures/gestures-page"),
+ new Link("HtmlView", "ns-ui-widgets-category/html-view/html-view-page"),
+ new Link("IconFonts", "ns-ui-category/icon-fonts/icon-fonts-page"),
+ new Link("Image", "ns-ui-widgets-category/image/image-page"),
+ new Link("Image Cache", "ns-ui-widgets-category/image-cache/image-cache-page"),
+ new Link("Layouts", "ns-ui-widgets-category/layouts/layouts-page"),
+ new Link("TimePicker", "ns-ui-widgets-category/time-picker/time-picker-page"),
+ new Link("ScrollView", "ns-ui-widgets-category/scroll-view/scroll-view-page"),
+ new Link("SearchBar", "ns-ui-widgets-category/search-bar/search-bar-page"),
+ new Link("SegmentedBar", "ns-ui-widgets-category/segmented-bar/segmented-bar-page"),
+ new Link("Slider", "ns-ui-widgets-category/slider/slider-page"),
+ new Link("Switch", "ns-ui-widgets-category/switch/switch-page"),
+ new Link("TabView", "ns-ui-widgets-category/tab-view/tab-view-page"),
+ new Link("TextField", "ns-ui-widgets-category/text-field/text-field-page"),
+ new Link("TextView", "ns-ui-widgets-category/text-view/text-view-page"),
+ new Link("WebView", "ns-ui-widgets-category/web-view/web-view-page"),
+ new Link("Style", "ns-ui-widgets-category/styling/styling-page"),
+ new Link("Label", "ns-ui-widgets-category/label/label-page"),
+ new Link("ListPicker", "ns-ui-widgets-category/list-picker/list-picker-page"),
+ new Link("ListView", "ns-ui-widgets-category/list-view/list-view-page"),
+ new Link("Page", "ns-ui-widgets-category/page/page-page"),
+ new Link("Progress", "ns-ui-widgets-category/progress/progress-page"),
+ new Link("Frame", "ns-ui-widgets-category/frame/frame-page"),
+ new Link("Formatted String", "ns-ui-widgets-category/formatted-string/formatted-string-page"),
+ new Link("Trace Module", "ns-framework-modules-category/trace/trace-page"),
+ new Link("Timer Module", "ns-framework-modules-category/timer/timer-page"),
+ new Link("Placeholder", "ns-ui-widgets-category/placeholder/placeholder-page"),
+ new Link("Repeater", "ns-ui-widgets-category/repeater/repeater-page"),
+ new Link("Platform Module", "ns-framework-modules-category/platform/platform-page"),
+ new Link("FPS Meter", "ns-framework-modules-category/fps-meter/fps-meter-page"),
+ new Link("HTTP Module", "ns-framework-modules-category/http/http-page"),
+ new Link("Fetch", "ns-framework-modules-category/fetch/fetch-page"),
+ new Link("ImageSource", "ns-framework-modules-category/image-source/image-source-page"),
+ new Link("File System", "ns-framework-modules-category/file-system/file-system-page"),
+ new Link("Modal view", "ns-ui-category/modal-view/modal-view-examples-page"),
+ new Link("XML Parser", "ns-framework-modules-category/xml-parser/xml-parser-page"),
+ new Link("BottomNavigation", "ns-ui-widgets-category/bottom-navigation/bottom-navigation-page"),
+ new Link("Tabs", "ns-ui-widgets-category/tabs/tabs-page")
];
-function onNavigatingTo(args) {
+export function onNavigatingTo(args) {
const page = args.object;
const vm = new ListViewLinksModel({
links: navigationLinks,
@@ -61,4 +64,3 @@ function onNavigatingTo(args) {
});
page.bindingContext = vm;
}
-exports.onNavigatingTo = onNavigatingTo;
diff --git a/app/ns-framework-modules-category/application-settings/application-settings-page.js b/app/ns-framework-modules-category/application-settings/application-settings-page.js
index 64f33fa..21b4c22 100644
--- a/app/ns-framework-modules-category/application-settings/application-settings-page.js
+++ b/app/ns-framework-modules-category/application-settings/application-settings-page.js
@@ -1,14 +1,12 @@
-const ListViewLinksModel = require("../../links-view-model");
-const link = require("../../link");
+import ListViewLinksModel from "../../links-view-model";
+import Link from "../../link";
const navigationLinks = [
- new link("Basics", "ns-framework-modules-category/application-settings/basics/basics-page"),
- new link("Native Access", "ns-framework-modules-category/application-settings/native-access/native-access-page")
+ new Link("Usage", "ns-framework-modules-category/application-settings/usage/usage-page")
];
const navigationLinksTsc = [
- new link("Basics", "ns-framework-modules-category/application-settings/basics/basics-ts-page"),
- new link("Native Access", "ns-framework-modules-category/application-settings/native-access/native-access-ts-page")
+ new Link("Usage", "ns-framework-modules-category/application-settings/usage/usage-ts-page")
];
-function onNavigatingTo(args) {
+export function onNavigatingTo(args) {
const page = args.object;
page.bindingContext = new ListViewLinksModel({
links: navigationLinks,
@@ -17,4 +15,4 @@ function onNavigatingTo(args) {
tsclinks: navigationLinksTsc
});
}
-exports.onNavigatingTo = onNavigatingTo;
+
diff --git a/app/ns-framework-modules-category/application-settings/basics/article.md b/app/ns-framework-modules-category/application-settings/basics/article.md
deleted file mode 100644
index 8eb7e90..0000000
--- a/app/ns-framework-modules-category/application-settings/basics/article.md
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-### Get and Set Boolean
-
-Set and get a `boolean` value and provide default value in case it is not set.
-
-
-
-### Get and Set String
-
-Set and get a string value.
-
-
-
-### Get and Set Number
-
-Set and get a numeric value.
-
-
-
-### Key Check
-
-Checking for existence of specific key.
-
-
-
-### Delete a Value
-
-Removes a value (if existing) for a key.
-
-
-
-### Delete All Values
-
-Removes all values from the application settings.
-
-
-
-### Default Values
-
-Reading values that are not set before, while providing default value.
-
-
-
-Reading values that are not set before not providing default value.
-
-
diff --git a/app/ns-framework-modules-category/application-settings/basics/basics-page.css b/app/ns-framework-modules-category/application-settings/basics/basics-page.css
deleted file mode 100644
index 658fc9c..0000000
--- a/app/ns-framework-modules-category/application-settings/basics/basics-page.css
+++ /dev/null
@@ -1,13 +0,0 @@
-Label {
- background-color: blue;
- color: white;
- margin:8;
- padding: 6;
-}
-
-#info {
- background-color: orangered;
- color: white;
- margin:8;
- padding: 16;
-}
\ No newline at end of file
diff --git a/app/ns-framework-modules-category/application-settings/basics/basics-page.js b/app/ns-framework-modules-category/application-settings/basics/basics-page.js
deleted file mode 100644
index 07e118a..0000000
--- a/app/ns-framework-modules-category/application-settings/basics/basics-page.js
+++ /dev/null
@@ -1,74 +0,0 @@
-// >> app-settings-require
-const appSettings = require("application-settings");
-// << app-settings-require
-const fromObject = require("data/observable").fromObject;
-
-class Item {
- constructor(key, item) {
- this.key = key;
- this.item = item;
- }
-}
-
-function onNavigatingTo(args) {
- // >> app-settings-bool-code
- const items = [];
- appSettings.setBoolean("isTurnedOn", true);
- const isTurnedOn = appSettings.getBoolean("isTurnedOn", false);
- // << app-settings-bool-code
- items.push(new Item("isTurnedOn", `${isTurnedOn}`));
-
- // >> app-settings-string-code
- appSettings.setString("username", "NickIliev");
- const username = appSettings.getString("username");
- // << app-settings-string-code
- items.push(new Item("username", `${username}`));
-
- // >> app-settings-number-code
- appSettings.setNumber("locationX", 54.321);
- const locationX = parseFloat(appSettings.getNumber("locationX").toFixed(3));
-
- // Note: The MIN & MAX number ranges are limited by the JavaScript number implementation - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER
- // On Android, the native method is also setting java.lang.Float which might lead to approximations during the conversion.
- // For really large numbers (e.g. like the value from getDate()) use setString and save the values as strings.
- // << app-settings-number-code
- items.push(new Item("locationX", `${locationX}`));
-
- // >> app-settings-remove-entry
- // will remove the setting for a key
- appSettings.remove("keyToRemove");
- // << app-settings-remove-entry
-
- // >> app-settings-default-value-code
- // will return "No string value" if there is no value for "noSuchKey"
- const someKey = appSettings.getString("noSuchKey", "No string value");
- // << app-settings-default-value-code
- items.push(new Item("noSuchKey", `${someKey}`));
-
- // >> app-settings-no-value-code
- // will return undefined if there is no value for "noSuchKey"
- const defaultValue = appSettings.getString("noSuchKey");
- // << app-settings-no-value-code
- items.push(new Item("noSuchKey", `${defaultValue}`));
-
- // >> app-settings-no-key-code
- // will return false if there is no "noBoolKey"
- const noBoolKey = appSettings.hasKey("noBoolKey");
- // << app-settings-no-key-code
- items.push(new Item("noBoolKey", `${noBoolKey}`));
-
- const page = args.object;
- const viewModel = fromObject({
- items: items
- });
-
- page.bindingContext = viewModel;
-}
-exports.onNavigatingTo = onNavigatingTo;
-
-function clearAll() {
- // >> app-settings-clear-all
- // Removes all values.
- appSettings.clear();
- // << app-settings-clear-all
-}
diff --git a/app/ns-framework-modules-category/application-settings/basics/basics-page.xml b/app/ns-framework-modules-category/application-settings/basics/basics-page.xml
deleted file mode 100644
index 0e919ef..0000000
--- a/app/ns-framework-modules-category/application-settings/basics/basics-page.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/ns-framework-modules-category/application-settings/basics/basics-ts-page.css b/app/ns-framework-modules-category/application-settings/basics/basics-ts-page.css
deleted file mode 100644
index 658fc9c..0000000
--- a/app/ns-framework-modules-category/application-settings/basics/basics-ts-page.css
+++ /dev/null
@@ -1,13 +0,0 @@
-Label {
- background-color: blue;
- color: white;
- margin:8;
- padding: 6;
-}
-
-#info {
- background-color: orangered;
- color: white;
- margin:8;
- padding: 16;
-}
\ No newline at end of file
diff --git a/app/ns-framework-modules-category/application-settings/basics/basics-ts-page.ts b/app/ns-framework-modules-category/application-settings/basics/basics-ts-page.ts
deleted file mode 100644
index f990388..0000000
--- a/app/ns-framework-modules-category/application-settings/basics/basics-ts-page.ts
+++ /dev/null
@@ -1,73 +0,0 @@
-// >> app-settings-require-ts
-import * as appSettings from "tns-core-modules/application-settings";
-// << app-settings-require-ts
-import { fromObject } from "tns-core-modules/data/observable";
-
-class Item {
- key: string;
- item: any;
-
- constructor(key, item) {
- this.key = key;
- this.item = item;
- }
-}
-
-export function onNavigatingTo(args) {
- // >> app-settings-bool-code-ts
- const items = [];
- appSettings.setBoolean("isTurnedOn", true);
- const isTurnedOn = appSettings.getBoolean("isTurnedOn", false);
- // << app-settings-bool-code-ts
- items.push(new Item("isTurnedOn", `${isTurnedOn}`));
-
- // >> app-settings-string-code-ts
- appSettings.setString("username", "NickIliev");
- const username = appSettings.getString("username");
- // << app-settings-string-code-ts
- items.push(new Item("username", `${username}`));
-
- // >> app-settings-number-code-ts
- appSettings.setNumber("locationX", 54.321);
- const locX = appSettings.getNumber("locationX").toFixed(3);
-
- // Note: The MIN & MAX number ranges are limited by the JavaScript number implementation
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER
- // On Android, the native method is also setting java.lang.Float which leads to approximations during conversion.
- // For really large numbers (e.g. like the value from getDate()) use setString and save the values as strings.
- // << app-settings-number-code-ts
- const locationX = parseFloat(locX);
- items.push(new Item("locationX", `${locationX}`));
-
- // >> app-settings-default-value-code-ts
- // will return "No string value" if there is no value for "noSuchKey"
- const someKey = appSettings.getString("noSuchKey", "No string value");
- // << app-settings-default-value-code-ts
- items.push(new Item("noSuchKey", `${someKey}`));
-
- // >> app-settings-no-value-code-ts
- // will return undefined if there is no value for "noSuchKey"
- const defaultValue = appSettings.getString("noSuchKey");
- // << app-settings-no-value-code-ts
- items.push(new Item("noSuchKey", `${defaultValue}`));
-
- // >> app-settings-no-key-code-ts
- // will return false if there is no "noBoolKey"
- const noBoolKey = appSettings.hasKey("noBoolKey");
- // << app-settings-no-key-code-ts
- items.push(new Item("noBoolKey", `${noBoolKey}`));
-
- const page = args.object;
- const viewModel = fromObject({
- items: items
- });
-
- page.bindingContext = viewModel;
-}
-
-function clearAll() {
- // >> app-settings-clear-all-ts
- // Removes all values.
- appSettings.clear();
- // << app-settings-clear-all-ts
-}
diff --git a/app/ns-framework-modules-category/application-settings/basics/basics-ts-page.xml b/app/ns-framework-modules-category/application-settings/basics/basics-ts-page.xml
deleted file mode 100644
index 0e919ef..0000000
--- a/app/ns-framework-modules-category/application-settings/basics/basics-ts-page.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/ns-framework-modules-category/application-settings/end.md b/app/ns-framework-modules-category/application-settings/end.md
index d317ba7..0713df8 100644
--- a/app/ns-framework-modules-category/application-settings/end.md
+++ b/app/ns-framework-modules-category/application-settings/end.md
@@ -1,5 +1,28 @@
-**Native Component**
+## Methods
+
+| Name | Type | Description |
+|----------|---------|----------------|
+| `clear` | `void` | Removes all stored values. |
+| `flush` | `boolean` | Flush all changes to disk synchronously. The return flag indicates if changes were saved successfully to disk. |
+| `getAllKeys` | `Array` | Array containing all stored keys |
+| `getBoolean(key: string, deafaultValue?: boolean)` | `boolean` | Gets a value (if existing) for a key as a Boolean Object. A default value can be provided in case there is no existing value. |
+| `getNumber(key: string, deafaultValue?: number)` | `number` | Gets a value (if existing) for a key as a Number Object. A default value can be provided in case there is no existing value |
+| `getString(key: string, deafaultValue?: string)` | `string` | Gets a value (if existing) for a key as a String Object. A default value can be provided in case there is no existing value. |
+| `hasKey(key: string)` | `boolean` | Checks whether such a key exists. |
+| `remove` | `void` | Removes an entry by its key name. |
+| `setBoolean(key: string, value: boolean)` | `void` | Sets a Boolean Object for a key. |
+| `setNumber(key: string, value: number)` | `void` | Sets a Number Object for a key. |
+| `setString(key: string, value: string)` | `void` | Sets a String Object for a key. |
+
+
+## API References
+
+| Name | Type |
+|----------|---------|
+| [tns-core-modules/application-settings](https://docs.nativescript.org/api-reference/modules/_application_settings_.html) | `Module` |
+
+## Native Component
| Android | iOS |
|:----------------------|:---------|
-| [android.content.SharedPreferences](https://developer.android.com/reference/android/content/SharedPreferences.html) | [NSUserDefaults](https://developer.apple.com/documentation/foundation/userdefaults) |
+| [android.content.SharedPreferences](https://developer.android.com/reference/android/content/SharedPreferences.html) | [NSUserDefaults](https://developer.apple.com/documentation/foundation/nsuserdefaults) |
diff --git a/app/ns-framework-modules-category/application-settings/native-access/article.md b/app/ns-framework-modules-category/application-settings/native-access/article.md
deleted file mode 100644
index 4c7565c..0000000
--- a/app/ns-framework-modules-category/application-settings/native-access/article.md
+++ /dev/null
@@ -1,3 +0,0 @@
-One of the main advantages of NativeScript is the direct access to the native APIs for both Android and iOS. The `application-module` functionality can be extended with native logic just as every other module and widget in NativeScript. The below example demonstrates how to access all stored keys using the native APIs on Android and iOS.
-
-
\ No newline at end of file
diff --git a/app/ns-framework-modules-category/application-settings/native-access/native-access-page.css b/app/ns-framework-modules-category/application-settings/native-access/native-access-page.css
deleted file mode 100644
index 1d8430c..0000000
--- a/app/ns-framework-modules-category/application-settings/native-access/native-access-page.css
+++ /dev/null
@@ -1,6 +0,0 @@
-Label {
- background-color: orangered;
- color: white;
- margin:8;
- padding: 16;
-}
\ No newline at end of file
diff --git a/app/ns-framework-modules-category/application-settings/native-access/native-access-page.js b/app/ns-framework-modules-category/application-settings/native-access/native-access-page.js
deleted file mode 100644
index 93a8e9c..0000000
--- a/app/ns-framework-modules-category/application-settings/native-access/native-access-page.js
+++ /dev/null
@@ -1,31 +0,0 @@
-// >> app-settings-native-access
-const getNativeApplication = require("application").getNativeApplication;
-const platformModule = require("platform");
-const utils = require("utils/utils");
-
-function getAll() {
- if (platformModule.isAndroid) {
- const sharedPreferences = getNativeApplication().getApplicationContext().getSharedPreferences("prefs.db", 0);
- const mappedPreferences = sharedPreferences.getAll();
- const iterator = mappedPreferences.keySet().iterator();
-
- while (iterator.hasNext()) {
- const key = iterator.next();
- console.log(key); // myString, myNumbver, isReal
- const value = mappedPreferences.get(key);
- console.log(value); // "John Doe", 42, true
- }
-
- } else if (platformModule.isIOS) {
- // Note: If using TypeScript you will need tns-platform-declarations plugin to access the native APIs like NSUserDefaults
- const userDefaults = utils.ios.getter(NSUserDefaults, NSUserDefaults.standardUserDefaults);
- const dictionaryUserDefaults = userDefaults.dictionaryRepresentation();
-
- const allKeys = dictionaryUserDefaults.allKeys;
- console.log(allKeys);
- const allValues = dictionaryUserDefaults.allValues;
- console.log(allValues);
- }
-}
-// << app-settings-native-access
-exports.getAll = getAll;
diff --git a/app/ns-framework-modules-category/application-settings/native-access/native-access-ts-page.css b/app/ns-framework-modules-category/application-settings/native-access/native-access-ts-page.css
deleted file mode 100644
index 1d8430c..0000000
--- a/app/ns-framework-modules-category/application-settings/native-access/native-access-ts-page.css
+++ /dev/null
@@ -1,6 +0,0 @@
-Label {
- background-color: orangered;
- color: white;
- margin:8;
- padding: 16;
-}
\ No newline at end of file
diff --git a/app/ns-framework-modules-category/application-settings/native-access/native-access-ts-page.ts b/app/ns-framework-modules-category/application-settings/native-access/native-access-ts-page.ts
deleted file mode 100644
index 2615101..0000000
--- a/app/ns-framework-modules-category/application-settings/native-access/native-access-ts-page.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-// >> app-settings-native-access-ts
-import { getNativeApplication } from "tns-core-modules/application";
-import { isAndroid, isIOS } from "tns-core-modules/platform";
-
-export function getAll() {
- if (isAndroid) {
- const sharedPreferences = getNativeApplication().getApplicationContext().getSharedPreferences("prefs.db", 0);
- const mappedPreferences = sharedPreferences.getAll();
- const iterator = mappedPreferences.keySet().iterator();
-
- while (iterator.hasNext()) {
- const key = iterator.next();
- console.log(key); // myString, myNumbver, isReal
- const value = mappedPreferences.get(key);
- console.log(value); // "John Doe", 42, true
- }
-
- } else if (isIOS) {
- // tslint:disable-next-line
- // Note: If using TypeScript you will need tns-platform-declarations plugin to access the native APIs like NSUserDefaults
- const userDefaults = NSUserDefaults.standardUserDefaults;
- const dictionaryUserDefaults = userDefaults.dictionaryRepresentation();
-
- const allKeys = dictionaryUserDefaults.allKeys;
- console.log(allKeys);
- const allValues = dictionaryUserDefaults.allValues;
- console.log(allValues);
- }
-}
-// << app-settings-native-access-ts
diff --git a/app/ns-framework-modules-category/application-settings/native-access/native-access-ts-page.xml b/app/ns-framework-modules-category/application-settings/native-access/native-access-ts-page.xml
deleted file mode 100644
index a043377..0000000
--- a/app/ns-framework-modules-category/application-settings/native-access/native-access-ts-page.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/ns-framework-modules-category/application-settings/overview.md b/app/ns-framework-modules-category/application-settings/overview.md
index 9b1b46f..ad97a02 100644
--- a/app/ns-framework-modules-category/application-settings/overview.md
+++ b/app/ns-framework-modules-category/application-settings/overview.md
@@ -1,6 +1 @@
-The [Application Settings](https://docs.nativescript.org/api-reference/modules/_application_settings_) module is used to store strings, booleans and numbers in built-in key/value store.
-The module uses `SharedPreferences` on Android and `NSUserDefaults` on iOS. The application-settings is suitable for tasks like saving and retriving small portions of custom values from the device’s local storage. Storing to local storage means that you can reuse the key-value pairs after the application is restarted (e.g. remember if a user has logged in orsave user UI preferences).
-
-The application settings module is required from `tns-core-modules/application-settings`.
-
-
\ No newline at end of file
+The `application-settings` module allows you to save and restore information related to your application.
\ No newline at end of file
diff --git a/app/ns-framework-modules-category/application-settings/usage/article.md b/app/ns-framework-modules-category/application-settings/usage/article.md
new file mode 100644
index 0000000..558a959
--- /dev/null
+++ b/app/ns-framework-modules-category/application-settings/usage/article.md
@@ -0,0 +1,4 @@
+Basic usage of the `application-settings` module in a component:
+
+
+
diff --git a/app/ns-framework-modules-category/application-settings/usage/usage-page.js b/app/ns-framework-modules-category/application-settings/usage/usage-page.js
new file mode 100644
index 0000000..44aa09f
--- /dev/null
+++ b/app/ns-framework-modules-category/application-settings/usage/usage-page.js
@@ -0,0 +1,29 @@
+// >> app-settings-code-js
+import { ApplicationSettings } from "@nativescript/core";
+
+
+export function onNavigatingTo(args) {
+ ApplicationSettings.setBoolean("isTurnedOn", true);
+ ApplicationSettings.setString("username", "Wolfgang");
+ ApplicationSettings.setNumber("locationX", 54.321);
+
+ const isTurnedOn = ApplicationSettings.getBoolean("isTurnedOn");
+ const username = ApplicationSettings.getString("username");
+ const locationX = ApplicationSettings.getNumber("locationX");
+
+ // Will return "No string value" if there is no value for "noSuchKey"
+ const someKey = ApplicationSettings.getString("noSuchKey", "No string value");
+
+ // Will return false if there is no key with name "noSuchKey"
+ const isKeExisting = ApplicationSettings.hasKey("noSuchKey");
+}
+
+
+function onClear() {
+ // Removing a single entry via its key name
+ ApplicationSettings.remove("isTurnedOn");
+
+ // Clearing the whole application-settings for this app
+ ApplicationSettings.clear();
+}
+// << app-settings-code-js
diff --git a/app/ns-framework-modules-category/application-settings/usage/usage-page.xml b/app/ns-framework-modules-category/application-settings/usage/usage-page.xml
new file mode 100644
index 0000000..8889d4f
--- /dev/null
+++ b/app/ns-framework-modules-category/application-settings/usage/usage-page.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-framework-modules-category/application-settings/usage/usage-ts-page.ts b/app/ns-framework-modules-category/application-settings/usage/usage-ts-page.ts
new file mode 100644
index 0000000..4bb5c11
--- /dev/null
+++ b/app/ns-framework-modules-category/application-settings/usage/usage-ts-page.ts
@@ -0,0 +1,27 @@
+// >> app-settings-code-ts
+import { ApplicationSettings } from "@nativescript/core";
+
+export function onNavigatingTo(args) {
+ ApplicationSettings.setBoolean("isTurnedOn", true);
+ ApplicationSettings.setString("username", "Wolfgang");
+ ApplicationSettings.setNumber("locationX", 54.321);
+
+ const isTurnedOn: boolean = ApplicationSettings.getBoolean("isTurnedOn");
+ const username: string = ApplicationSettings.getString("username");
+ const locationX: number = ApplicationSettings.getNumber("locationX");
+
+ // Will return "No string value" if there is no value for "noSuchKey"
+ const someKey: string = ApplicationSettings.getString("noSuchKey", "No string value");
+
+ // Will return false if there is no key with name "noSuchKey"
+ let isKeExisting: boolean = ApplicationSettings.hasKey("noSuchKey");
+}
+
+function onClear() {
+ // Removing a single entry via its key name
+ ApplicationSettings.remove("isTurnedOn");
+
+ // Clearing the whole application-settings for this app
+ ApplicationSettings.clear();
+}
+// << app-settings-code-ts
diff --git a/app/ns-framework-modules-category/application-settings/usage/usage-ts-page.xml b/app/ns-framework-modules-category/application-settings/usage/usage-ts-page.xml
new file mode 100644
index 0000000..8889d4f
--- /dev/null
+++ b/app/ns-framework-modules-category/application-settings/usage/usage-ts-page.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-framework-modules-category/application/android-broadcast-receiver/android-broadcast-receiver-page.js b/app/ns-framework-modules-category/application/android-broadcast-receiver/android-broadcast-receiver-page.js
index fd581a1..8ad9565 100644
--- a/app/ns-framework-modules-category/application/android-broadcast-receiver/android-broadcast-receiver-page.js
+++ b/app/ns-framework-modules-category/application/android-broadcast-receiver/android-broadcast-receiver-page.js
@@ -1,25 +1,22 @@
-
-const applicationModule = require("tns-core-modules/application");
-const Observable = require("tns-core-modules/data/observable").Observable;
-const platformModule = require("tns-core-modules/platform");
+import { AndroidApplication, Observable, isAndroid } from "@nativescript/core";
let vm;
-function onNavigatingTo(args) {
+export function onNavigatingTo(args) {
const page = args.object;
page.actionBar.title = "";
vm = new Observable();
vm.set("info", "Using Android Broadcast Receiver \nto check the battery life");
vm.set("batteryLife", "0");
- vm.set("isAndroid", platformModule.isAndroid);
+ vm.set("isAndroid", isAndroid);
page.bindingContext = vm;
page.actionBar.title = args.context.title;
}
-exports.onNavigatingTo = onNavigatingTo;
-function onNavigatedTo(args) {
+
+export function onNavigatedTo(args) {
vm.set("actionBarTitle", args.context.actionBarTitle);
// >> broadcast-receiver
- if (platformModule.isAndroid) {
- // use tns-platform-dclarations to acces native APIs (e.g. ndroid.content.Intent)
+ if (isAndroid) {
+ // use tns-platform-declarations to acces native APIs (e.g. android.content.Intent)
const receiverCallback = (androidContext, intent) => {
const level = intent.getIntExtra(android.os.BatteryManager.EXTRA_LEVEL, -1);
const scale = intent.getIntExtra(android.os.BatteryManager.EXTRA_SCALE, -1);
@@ -27,19 +24,19 @@ function onNavigatedTo(args) {
vm.set("batteryLife", percent.toString());
};
- applicationModule.android.registerBroadcastReceiver(
+ AndroidApplication.android.registerBroadcastReceiver(
android.content.Intent.ACTION_BATTERY_CHANGED,
receiverCallback
);
}
// << broadcast-receiver
}
-exports.onNavigatedTo = onNavigatedTo;
-function onUnloaded() {
- if (platformModule.isAndroid) {
+
+export function onUnloaded() {
+ if (isAndroid) {
// >> broadcast-receiver-remove
- applicationModule.android.unregisterBroadcastReceiver(android.content.Intent.ACTION_BATTERY_CHANGED);
+ AndroidApplication.android.unregisterBroadcastReceiver(android.content.Intent.ACTION_BATTERY_CHANGED);
// << broadcast-receiver-remove
}
}
-exports.onUnloaded = onUnloaded;
+
diff --git a/app/ns-framework-modules-category/application/android-broadcast-receiver/android-broadcast-receiver-ts-page.ts b/app/ns-framework-modules-category/application/android-broadcast-receiver/android-broadcast-receiver-ts-page.ts
index 67f02d7..d0baf93 100644
--- a/app/ns-framework-modules-category/application/android-broadcast-receiver/android-broadcast-receiver-ts-page.ts
+++ b/app/ns-framework-modules-category/application/android-broadcast-receiver/android-broadcast-receiver-ts-page.ts
@@ -1,9 +1,5 @@
-import * as applicationModule from "tns-core-modules/application";
-import { android as androidApp } from "tns-core-modules/application";
-import { Observable } from "tns-core-modules/data/observable";
-import { isAndroid } from "tns-core-modules/platform";
-import { Page, NavigatedData } from "tns-core-modules/ui/page";
+import { Application, NavigatedData, Observable, Page, isAndroid } from "@nativescript/core";
let vm;
export function onNavigatingTo(args: NavigatedData) {
@@ -21,17 +17,17 @@ export function onNavigatedTo(args: NavigatedData) {
vm.set("actionBarTitle", args.context.actionBarTitle);
// >> app-class-properties
- // import { android as androidApp } from "tns-core-modules/application";
- let isPaused = androidApp.paused; // e.g. false
- let packageName = androidApp.packageName; // The package ID e.g. org.nativescript.nativescriptsdkexamplesng
- let nativeApp = androidApp.nativeApp; // The native APplication reference
- let foregroundActivity = androidApp.foregroundActivity; // The current Activity reference
- let context = androidApp.context; // The current Android context
+ // import { Application } from "@nativescript/core";
+ let isPaused = Application.android.paused; // e.g. false
+ let packageName = Application.android.packageName; // The package ID e.g. org.nativescript.nativescriptsdkexamplesng
+ let nativeApp = Application.android.nativeApp; // The native Application reference
+ let foregroundActivity = Application.android.foregroundActivity; // The current Activity reference
+ let context = Application.android.context; // The current Android context
// << app-class-properties
// >> broadcast-receiver-ts
if (isAndroid) {
- // use tns-platform-dclarations to access native APIs (e.g. android.content.Intent)
+ // use tns-platform-declarations to access native APIs (e.g. android.content.Intent)
let receiverCallback = (androidContext, intent) => {
const level = intent.getIntExtra(android.os.BatteryManager.EXTRA_LEVEL, -1);
const scale = intent.getIntExtra(android.os.BatteryManager.EXTRA_SCALE, -1);
@@ -39,7 +35,7 @@ export function onNavigatedTo(args: NavigatedData) {
vm.set("batteryLife", percent.toString());
};
- applicationModule.android.registerBroadcastReceiver(
+ Application.android.registerBroadcastReceiver(
android.content.Intent.ACTION_BATTERY_CHANGED,
receiverCallback
);
@@ -50,7 +46,7 @@ export function onNavigatedTo(args: NavigatedData) {
export function onUnloaded() {
if (isAndroid) {
// >> broadcast-receiver-remove-ts
- applicationModule.android.unregisterBroadcastReceiver(android.content.Intent.ACTION_BATTERY_CHANGED);
+ Application.android.unregisterBroadcastReceiver(android.content.Intent.ACTION_BATTERY_CHANGED);
// << broadcast-receiver-remove-ts
}
}
diff --git a/app/ns-framework-modules-category/application/application-events/application-events-page.js b/app/ns-framework-modules-category/application/application-events/application-events-page.js
index 44424a2..3d3726a 100644
--- a/app/ns-framework-modules-category/application/application-events/application-events-page.js
+++ b/app/ns-framework-modules-category/application/application-events/application-events-page.js
@@ -1,8 +1,7 @@
// >> application-import
-const applicationModule = require("tns-core-modules/application");
+import { Application } from "@nativescript/core";
// << application-import
-const Observable = require("tns-core-modules/data/observable").Observable;
-const enums = require("ui/enums");
+import { Observable, Enums } from "@nativescript/core";
let vm;
let launchListener;
let suspendListener;
@@ -13,28 +12,28 @@ let lowMemoryListener;
let orientationChangedListener;
let uncaughtErrorListener;
-const onNavigatingTo = (args) => {
+export const onNavigatingTo = (args) => {
const page = args.object;
vm = new Observable();
vm.set("actionBarTitle", args.context.actionBarTitle);
vm.set("info", "Refer to the code-behind files \nfor Application Events snippets");
- if (applicationModule.android) {
- const activity = applicationModule.android.foregroundActivity;
+ if (Application.android) {
+ const activity = Application.android.foregroundActivity;
const orientationEnum = activity.getResources().getConfiguration().orientation;
- vm.set("orientation", (orientationEnum === 1 ? enums.DeviceOrientation.portrait : enums.DeviceOrientation.landscape));
+ vm.set("orientation", (orientationEnum === 1 ? Enums.DeviceOrientation.portrait : Enums.DeviceOrientation.landscape));
vm.set("resumeEvent", "");
vm.set("resumeEvent", "");
vm.set("launchEvent", "");
vm.set("displayedEvent", "");
- } else if (applicationModule.ios) {
+ } else if (Application.ios) {
vm.set("orientation", "portrait");
}
page.bindingContext = vm;
page.actionBar.title = args.context.title;
};
-exports.onNavigatingTo = onNavigatingTo;
-const onGridLoaded = (args) => {
+
+export const onGridLoaded = (args) => {
// >> application-events-launch
launchListener = (args) => {
// The root view for this Window on iOS or Activity for Android.
@@ -43,7 +42,7 @@ const onGridLoaded = (args) => {
console.log("The appication was launched!");
vm.set("resumeEvent", "The appication was launched!");
};
- applicationModule.on(applicationModule.launchEvent, launchListener);
+ Application.on(Application.launchEvent, launchListener);
// << application-events-launch
// >> application-events-suspend
@@ -51,7 +50,7 @@ const onGridLoaded = (args) => {
console.log("The appication was suspended!");
vm.set("suspendEvent", "The appication was suspended!");
};
- applicationModule.on(applicationModule.suspendEvent, suspendListener);
+ Application.on(Application.suspendEvent, suspendListener);
// << application-events-suspend
// >> application-events-resume
@@ -59,14 +58,14 @@ const onGridLoaded = (args) => {
console.log("The appication was resumed!");
vm.set("resumeEvent", "The appication was resumed!");
};
- applicationModule.on(applicationModule.resumeEvent, resumeListener);
+ Application.on(Application.resumeEvent, resumeListener);
// << application-events-resume
// >> application-events-exit
exitListener = (args) => {
console.log("The appication was closed!");
};
- applicationModule.on(applicationModule.exitEvent, exitListener);
+ Application.on(Application.exitEvent, exitListener);
// << application-events-exit
// >> application-events-displayed
@@ -74,7 +73,7 @@ const onGridLoaded = (args) => {
console.log("NativeScript displayedEvent!");
vm.set("displayedEvent", "The appication is displayed!");
};
- applicationModule.on(applicationModule.displayedEvent, displayedListener);
+ Application.on(Application.displayedEvent, displayedListener);
// << application-events-displayed
// >> application-events-low-memory
@@ -82,7 +81,7 @@ const onGridLoaded = (args) => {
// the instance that has raidsed the event
console.log("Instance: ", args.object);
};
- applicationModule.on(applicationModule.lowMemoryEvent, lowMemoryListener);
+ Application.on(Application.lowMemoryEvent, lowMemoryListener);
// << application-events-low-memory
// >> application-events-orientation
@@ -91,7 +90,7 @@ const onGridLoaded = (args) => {
console.log("Orientation: ", args.newValue);
vm.set("orientation", args.newValue);
};
- applicationModule.on(applicationModule.orientationChangedEvent, orientationChangedListener);
+ Application.on(Application.orientationChangedEvent, orientationChangedListener);
// << application-events-orientation
// >> application-events-error
@@ -99,21 +98,19 @@ const onGridLoaded = (args) => {
// UnhandledErrorEventData.error: NativeScriptError
console.log("NativeScript Error: ", args.error);
};
- applicationModule.on(applicationModule.uncaughtErrorEvent, uncaughtErrorListener);
+ Application.on(Application.uncaughtErrorEvent, uncaughtErrorListener);
// << application-events-error
};
-exports.onGridLoaded = onGridLoaded;
-const onGridUnloaded = () => {
+export const onGridUnloaded = () => {
// >> application-events-off
- applicationModule.off(applicationModule.launchEvent, launchListener);
- applicationModule.off(applicationModule.resumeEvent, resumeListener);
- applicationModule.off(applicationModule.suspendEvent, suspendListener);
- applicationModule.off(applicationModule.exitEvent, exitListener);
- applicationModule.off(applicationModule.displayedEvent, displayedListener);
- applicationModule.off(applicationModule.lowMemoryEvent, lowMemoryListener);
- applicationModule.off(applicationModule.orientationChangedEvent, orientationChangedListener);
- applicationModule.off(applicationModule.uncaughtErrorEvent, uncaughtErrorListener);
+ Application.off(Application.launchEvent, launchListener);
+ Application.off(Application.resumeEvent, resumeListener);
+ Application.off(Application.suspendEvent, suspendListener);
+ Application.off(Application.exitEvent, exitListener);
+ Application.off(Application.displayedEvent, displayedListener);
+ Application.off(Application.lowMemoryEvent, lowMemoryListener);
+ Application.off(Application.orientationChangedEvent, orientationChangedListener);
+ Application.off(Application.uncaughtErrorEvent, uncaughtErrorListener);
// << application-events-off
};
-exports.onGridUnloaded = onGridUnloaded;
diff --git a/app/ns-framework-modules-category/application/application-events/application-events-page.xml b/app/ns-framework-modules-category/application/application-events/application-events-page.xml
index 7933902..ac62b84 100644
--- a/app/ns-framework-modules-category/application/application-events/application-events-page.xml
+++ b/app/ns-framework-modules-category/application/application-events/application-events-page.xml
@@ -4,10 +4,10 @@
-
-
-
-
+
+
+
+
diff --git a/app/ns-framework-modules-category/application/application-events/application-events-ts-page.ts b/app/ns-framework-modules-category/application/application-events/application-events-ts-page.ts
index c4b492a..cef9583 100644
--- a/app/ns-framework-modules-category/application/application-events/application-events-ts-page.ts
+++ b/app/ns-framework-modules-category/application/application-events/application-events-ts-page.ts
@@ -1,8 +1,7 @@
// >> application-import-ts
-import * as applicationModule from "tns-core-modules/application";
+import { Application, Enums } from "@nativescript/core";
// << application-import-ts
-import { Observable } from "tns-core-modules/data/observable";
-import * as enums from "tns-core-modules/ui/enums";
+import { Observable } from "@nativescript/core";
let vm;
let launchListener;
let suspendListener;
@@ -18,20 +17,20 @@ export const onNavigatingTo = (navigatedData) => {
vm = new Observable();
vm.set("actionBarTitle", navigatedData.context.actionBarTitle);
vm.set("info", "Refer to the code-behind files \nfor Application Events snippets");
- if (applicationModule.android) {
- const activity = applicationModule.android.foregroundActivity;
+ if (Application.android) {
+ const activity = Application.android.foregroundActivity;
const orientationEnum = activity.getResources().getConfiguration().orientation;
vm.set(
"orientation",
orientationEnum === 1
- ? enums.DeviceOrientation.portrait
- : enums.DeviceOrientation.landscape
+ ? Enums.DeviceOrientation.portrait
+ : Enums.DeviceOrientation.landscape
);
vm.set("resumeEvent", "");
vm.set("resumeEvent", "");
vm.set("launchEvent", "");
vm.set("displayedEvent", "");
- } else if (applicationModule.ios) {
+ } else if (Application.ios) {
vm.set("orientation", "portrait");
}
page.bindingContext = vm;
@@ -47,7 +46,7 @@ export const onGridLoaded = (eventData) => {
console.log("The appication was launched!");
vm.set("resumeEvent", "The appication was launched!");
};
- applicationModule.on(applicationModule.launchEvent, launchListener);
+ Application.on(Application.launchEvent, launchListener);
// << application-events-launch-ts
// >> application-events-suspend-ts
@@ -55,7 +54,7 @@ export const onGridLoaded = (eventData) => {
console.log("The appication was suspended!");
vm.set("suspendEvent", "The appication was suspended!");
};
- applicationModule.on(applicationModule.suspendEvent, suspendListener);
+ Application.on(Application.suspendEvent, suspendListener);
// << application-events-suspend-ts
// >> application-events-resume-ts
@@ -63,14 +62,14 @@ export const onGridLoaded = (eventData) => {
console.log("The appication was resumed!");
vm.set("resumeEvent", "The appication was resumed!");
};
- applicationModule.on(applicationModule.resumeEvent, resumeListener);
+ Application.on(Application.resumeEvent, resumeListener);
// << application-events-resume-ts
// >> application-events-exit-ts
exitListener = (args) => {
console.log("The appication was closed!");
};
- applicationModule.on(applicationModule.exitEvent, exitListener);
+ Application.on(Application.exitEvent, exitListener);
// << application-events-exit-ts
// >> application-events-displayed-ts
@@ -78,7 +77,7 @@ export const onGridLoaded = (eventData) => {
console.log("NativeScript displayedEvent!");
vm.set("displayedEvent", "The appication is displayed!");
};
- applicationModule.on(applicationModule.displayedEvent, displayedListener);
+ Application.on(Application.displayedEvent, displayedListener);
// << application-events-displayed-ts
// >> application-events-low-memory-ts
@@ -86,7 +85,7 @@ export const onGridLoaded = (eventData) => {
// the instance that has raidsed the event
console.log("Instance: ", args.object);
};
- applicationModule.on(applicationModule.lowMemoryEvent, lowMemoryListener);
+ Application.on(Application.lowMemoryEvent, lowMemoryListener);
// << application-events-low-memory-ts
// >> application-events-orientation-ts
@@ -95,7 +94,7 @@ export const onGridLoaded = (eventData) => {
console.log("Orientation: ", args.newValue);
vm.set("orientation", args.newValue);
};
- applicationModule.on(applicationModule.orientationChangedEvent, orientationChangedListener);
+ Application.on(Application.orientationChangedEvent, orientationChangedListener);
// << application-events-orientation-ts
// >> application-events-error-ts
@@ -103,20 +102,20 @@ export const onGridLoaded = (eventData) => {
// UnhandledErrorEventData.error: NativeScriptError
console.log("NativeScript Error: ", args.error);
};
- applicationModule.on(applicationModule.uncaughtErrorEvent, uncaughtErrorListener);
+ Application.on(Application.uncaughtErrorEvent, uncaughtErrorListener);
// << application-events-error-ts
};
export const onGridUnloaded = () => {
// >> application-events-off-ts
- applicationModule.off(applicationModule.launchEvent, launchListener);
- applicationModule.off(applicationModule.resumeEvent, resumeListener);
- applicationModule.off(applicationModule.suspendEvent, suspendListener);
- applicationModule.off(applicationModule.exitEvent, exitListener);
- applicationModule.off(applicationModule.displayedEvent, displayedListener);
- applicationModule.off(applicationModule.lowMemoryEvent, lowMemoryListener);
- applicationModule.off(applicationModule.orientationChangedEvent, orientationChangedListener);
- applicationModule.off(applicationModule.uncaughtErrorEvent, uncaughtErrorListener);
+ Application.off(Application.launchEvent, launchListener);
+ Application.off(Application.resumeEvent, resumeListener);
+ Application.off(Application.suspendEvent, suspendListener);
+ Application.off(Application.exitEvent, exitListener);
+ Application.off(Application.displayedEvent, displayedListener);
+ Application.off(Application.lowMemoryEvent, lowMemoryListener);
+ Application.off(Application.orientationChangedEvent, orientationChangedListener);
+ Application.off(Application.uncaughtErrorEvent, uncaughtErrorListener);
// << application-events-off-ts
};
diff --git a/app/ns-framework-modules-category/application/application-events/application-events-ts-page.xml b/app/ns-framework-modules-category/application/application-events/application-events-ts-page.xml
index 7933902..ac62b84 100644
--- a/app/ns-framework-modules-category/application/application-events/application-events-ts-page.xml
+++ b/app/ns-framework-modules-category/application/application-events/application-events-ts-page.xml
@@ -4,10 +4,10 @@
-
-
-
-
+
+
+
+
diff --git a/app/ns-framework-modules-category/application/application-page.js b/app/ns-framework-modules-category/application/application-page.js
index ab75fd5..1bfac23 100644
--- a/app/ns-framework-modules-category/application/application-page.js
+++ b/app/ns-framework-modules-category/application/application-page.js
@@ -1,50 +1,51 @@
-const ListViewLinksModel = require("../../links-view-model");
-const link = require("../../link");
-const platformModule = require("tns-core-modules/platform");
+import ListViewLinksModel from "../../links-view-model";
+import Link from "../../link";
+import { isIOS, isAndroid } from "@nativescript/core";
+
const navigationLinks = [
- new link(
+ new Link(
"Check Platform",
"ns-framework-modules-category/application/check-platform/check-platform-page"
),
- new link(
+ new Link(
"Application Events",
"ns-framework-modules-category/application/application-events/application-events-page"
)
];
const navigationLinksTsc = [
- new link(
+ new Link(
"Check Platform",
"ns-framework-modules-category/application/check-platform/check-platform-ts-page"
),
- new link(
+ new Link(
"Application Events",
"ns-framework-modules-category/application/application-events/application-events-ts-page"
)
];
-function onNavigatingTo(args) {
+export function onNavigatingTo(args) {
const page = args.object;
- if (platformModule.isIOS && navigationLinks.filter((e) => e.title === "iOS Notification Observer").length < 1) {
+ if (isIOS && navigationLinks.filter((e) => e.title === "iOS Notification Observer").length < 1) {
navigationLinks.push(
- new link(
+ new Link(
"iOS Notification Observer",
- "/application/ios-notification-observer/ios-notification-observer-page"
+ "ns-framework-modules-category/application/ios-notification-observer/ios-notification-observer-page"
)
);
navigationLinksTsc.push(
- new link(
+ new Link(
"iOS Notification Observer",
- "/application/ios-notification-observer/ios-notification-observer-ts-page"
+ "ns-framework-modules-category/application/ios-notification-observer/ios-notification-observer-ts-page"
)
);
- } else if (platformModule.isAndroid && navigationLinks.filter((e) => e.title === "Android Broadcast Receiver").length < 1) {
+ } else if (isAndroid && navigationLinks.filter((e) => e.title === "Android Broadcast Receiver").length < 1) {
navigationLinks.push(
- new link(
+ new Link(
"Android Broadcast Receiver",
"ns-framework-modules-category/application/android-broadcast-receiver/android-broadcast-receiver-page"
)
);
navigationLinksTsc.push(
- new link(
+ new Link(
"Android Broadcast Receiver",
"ns-framework-modules-category/application/android-broadcast-receiver/android-broadcast-receiver-ts-page"
)
@@ -57,4 +58,4 @@ function onNavigatingTo(args) {
tsclinks: navigationLinksTsc
});
}
-exports.onNavigatingTo = onNavigatingTo;
+
diff --git a/app/ns-framework-modules-category/application/check-platform/check-platform-page.js b/app/ns-framework-modules-category/application/check-platform/check-platform-page.js
index 869d845..16343c9 100644
--- a/app/ns-framework-modules-category/application/check-platform/check-platform-page.js
+++ b/app/ns-framework-modules-category/application/check-platform/check-platform-page.js
@@ -1,10 +1,10 @@
-const application = require("tns-core-modules/application");
+import { Application } from "@nativescript/core";
-function onGridLoaded(args) {
+export function onGridLoaded(args) {
const grid = args.object;
const lbl = grid.getViewById("lbl");
const iconLabel = grid.getViewById("iconLabel");
- iconLabel.className = "fa";
+ iconLabel.className = "far";
iconLabel.textAlignment = "center";
iconLabel.verticalAlignment = "middle";
iconLabel.fontSize = 40;
@@ -12,13 +12,13 @@ function onGridLoaded(args) {
lbl.verticalAlignment = "middle";
lbl.fontSize = 24;
// >> application-platform-js
- if (application.android) {
+ if (Application.android) {
console.log("We are running on Android device!");
// >> (hide)
iconLabel.text = String.fromCharCode(0xff17b);
lbl.text = "Android Applicaiton";
// << (hide)
- } else if (application.ios) {
+ } else if (Application.ios) {
console.log("We are running on iOS device");
// >> (hide)
iconLabel.text = String.fromCharCode(0xf179);
@@ -27,9 +27,8 @@ function onGridLoaded(args) {
}
// << application-platform-js
}
-exports.onGridLoaded = onGridLoaded;
-function onNavigatingTo(args) {
+export function onNavigatingTo(args) {
const page = args.object;
page.actionBar.title = args.context.title;
}
-exports.onNavigatingTo = onNavigatingTo;
+
diff --git a/app/ns-framework-modules-category/application/check-platform/check-platform-ts-page.ts b/app/ns-framework-modules-category/application/check-platform/check-platform-ts-page.ts
index c5752b4..dfdad76 100644
--- a/app/ns-framework-modules-category/application/check-platform/check-platform-ts-page.ts
+++ b/app/ns-framework-modules-category/application/check-platform/check-platform-ts-page.ts
@@ -1,14 +1,10 @@
-import { EventData } from "tns-core-modules/data/observable";
-import { NavigatedData, Page } from "tns-core-modules/ui/page";
-import { GridLayout } from "tns-core-modules/ui/layouts/grid-layout";
-import { Label } from "tns-core-modules/ui/label";
-import * as application from "tns-core-modules/application";
+import { Application, EventData, GridLayout, Label, NavigatedData, Page } from "@nativescript/core";
export function onGridLoaded(args: EventData) {
const grid = args.object;
const lbl =
-
\ No newline at end of file
+
diff --git a/app/ns-framework-modules-category/xml-parser/basics/basics-ts-page.ts b/app/ns-framework-modules-category/xml-parser/basics/basics-ts-page.ts
index ae7c39a..327b6df 100644
--- a/app/ns-framework-modules-category/xml-parser/basics/basics-ts-page.ts
+++ b/app/ns-framework-modules-category/xml-parser/basics/basics-ts-page.ts
@@ -1,14 +1,12 @@
-import { Observable } from "tns-core-modules/data/observable";
-import { ObservableArray } from "tns-core-modules/data/observable-array";
-import { Page } from "tns-core-modules/ui/page";
+import { Observable, ObservableArray, Page} from "@nativescript/core";
// >> import-xml-module
-import * as xmlModule from "tns-core-modules/xml";
+import { ParserEventType, XmlParser } from "@nativescript/core";
// << import-xml-module
const source = new ObservableArray();
// >> parser-event-ts
const onEventCallback = (event) => {
switch (event.eventType) {
- case xmlModule.ParserEventType.StartElement:
+ case ParserEventType.StartElement:
if (event.attributes) {
for (const attributeName in event.attributes) {
if (event.attributes.hasOwnProperty(attributeName)) {
@@ -31,7 +29,7 @@ const onEventCallback = (event) => {
});
}
break;
- case xmlModule.ParserEventType.EndElement:
+ case ParserEventType.EndElement:
source.push({
eventType: event.eventType,
elementName: event.elementName,
@@ -41,7 +39,7 @@ const onEventCallback = (event) => {
});
break;
- case xmlModule.ParserEventType.Text:
+ case ParserEventType.Text:
const significantText = event.data.trim();
if (significantText !== "") {
@@ -64,7 +62,7 @@ const onErrorCallback = (error) => {
};
// << parser-event-ts
// >> parse-method-ts
-const xmlParser = new xmlModule.XmlParser(onEventCallback, onErrorCallback);
+const xmlParser = new XmlParser(onEventCallback, onErrorCallback);
// >> (hide)
export function onNavigatingTo(args) {
const page: Page = args.object;
diff --git a/app/ns-framework-modules-category/xml-parser/basics/basics-ts-page.xml b/app/ns-framework-modules-category/xml-parser/basics/basics-ts-page.xml
index a550acf..cce1a8d 100644
--- a/app/ns-framework-modules-category/xml-parser/basics/basics-ts-page.xml
+++ b/app/ns-framework-modules-category/xml-parser/basics/basics-ts-page.xml
@@ -27,4 +27,4 @@
-
\ No newline at end of file
+
diff --git a/app/ns-framework-modules-category/xml-parser/xml-parser-page.js b/app/ns-framework-modules-category/xml-parser/xml-parser-page.js
index 2fddf96..82eae7c 100644
--- a/app/ns-framework-modules-category/xml-parser/xml-parser-page.js
+++ b/app/ns-framework-modules-category/xml-parser/xml-parser-page.js
@@ -1,12 +1,12 @@
-const ListViewLinksModel = require("../../links-view-model");
-const link = require("../../link");
+import ListViewLinksModel from "../../links-view-model";
+import Link from "../../link";
const navigationLinks = [
- new link("Basics", "ns-framework-modules-category/xml-parser/basics/basics-page")
+ new Link("Basics", "ns-framework-modules-category/xml-parser/basics/basics-page")
];
const navigationLinksTsc = [
- new link("Basics", "ns-framework-modules-category/xml-parser/basics/basics-ts-page")
+ new Link("Basics", "ns-framework-modules-category/xml-parser/basics/basics-ts-page")
];
-function onNavigatingTo(args) {
+export function onNavigatingTo(args) {
const page = args.object;
page.bindingContext = new ListViewLinksModel({
links: navigationLinks,
@@ -15,4 +15,4 @@ function onNavigatingTo(args) {
tsclinks: navigationLinksTsc
});
}
-exports.onNavigatingTo = onNavigatingTo;
+
diff --git a/app/ns-ui-category/icon-fonts/basics/article.md b/app/ns-ui-category/icon-fonts/basics/article.md
deleted file mode 100644
index 4b751ff..0000000
--- a/app/ns-ui-category/icon-fonts/basics/article.md
+++ /dev/null
@@ -1,5 +0,0 @@
-
-The example demonstrates, how to use setup the `font-family` property via CSS and how to define the needed icons via XML.
-
-
-
diff --git a/app/ns-ui-category/icon-fonts/icon-fonts-page.js b/app/ns-ui-category/icon-fonts/icon-fonts-page.js
index ab55f4a..8057a31 100644
--- a/app/ns-ui-category/icon-fonts/icon-fonts-page.js
+++ b/app/ns-ui-category/icon-fonts/icon-fonts-page.js
@@ -1,13 +1,13 @@
-const ListViewLinksModel = require("../../links-view-model");
-const link = require("../../link");
+import ListViewLinksModel from "../../links-view-model";
+import Link from "../../link";
const navigationLinks = [
- new link("Basics", "ns-ui-category/icon-fonts/basics/basics-page"),
- new link("Code Behind", "ns-ui-category/icon-fonts/code-behind/code-behind-page")
+ new Link("Usage", "ns-ui-category/icon-fonts/usage/usage-page"),
+ new Link("Tips & Tricks", "ns-ui-category/icon-fonts/tips-and-tricks/tips-and-tricks-page")
];
const navigationLinksTsc = [
- new link("Code Behind", "ns-ui-category/icon-fonts/code-behind/code-behind-ts-page")
+ new Link("Tips & Tricks", "ns-ui-category/icon-fonts/tips-and-tricks/tips-and-tricks-ts-page")
];
-function onNavigatingTo(args) {
+export function onNavigatingTo(args) {
const page = args.object;
page.bindingContext = new ListViewLinksModel({
links: navigationLinks,
@@ -16,4 +16,4 @@ function onNavigatingTo(args) {
tsclinks: navigationLinksTsc
});
}
-exports.onNavigatingTo = onNavigatingTo;
+
diff --git a/app/ns-ui-category/icon-fonts/metadata.md b/app/ns-ui-category/icon-fonts/metadata.md
index 241a708..5130071 100644
--- a/app/ns-ui-category/icon-fonts/metadata.md
+++ b/app/ns-ui-category/icon-fonts/metadata.md
@@ -5,3 +5,4 @@ position: 265
slug: icon-fonts
previous_url: /icon-fonts
---
+example-order: usage, tips-and-tricks
\ No newline at end of file
diff --git a/app/ns-ui-category/icon-fonts/code-behind/article.md b/app/ns-ui-category/icon-fonts/tips-and-tricks/article.md
similarity index 50%
rename from app/ns-ui-category/icon-fonts/code-behind/article.md
rename to app/ns-ui-category/icon-fonts/tips-and-tricks/article.md
index bc52b6b..0ca262b 100644
--- a/app/ns-ui-category/icon-fonts/code-behind/article.md
+++ b/app/ns-ui-category/icon-fonts/tips-and-tricks/article.md
@@ -5,15 +5,3 @@ The example shows, how to use setup the `font-family` property via CSS and how t
-
-And the result is:
-
-
-
-Example for icon font glyphs:
-
-
-
-Example for icon font folder location:
-
-
\ No newline at end of file
diff --git a/app/ns-ui-category/icon-fonts/code-behind/code-behind-page.css b/app/ns-ui-category/icon-fonts/tips-and-tricks/tips-and-tricks-page.css
similarity index 100%
rename from app/ns-ui-category/icon-fonts/code-behind/code-behind-page.css
rename to app/ns-ui-category/icon-fonts/tips-and-tricks/tips-and-tricks-page.css
diff --git a/app/ns-ui-category/icon-fonts/code-behind/code-behind-page.js b/app/ns-ui-category/icon-fonts/tips-and-tricks/tips-and-tricks-page.js
similarity index 78%
rename from app/ns-ui-category/icon-fonts/code-behind/code-behind-page.js
rename to app/ns-ui-category/icon-fonts/tips-and-tricks/tips-and-tricks-page.js
index bb204cd..e41d537 100644
--- a/app/ns-ui-category/icon-fonts/code-behind/code-behind-page.js
+++ b/app/ns-ui-category/icon-fonts/tips-and-tricks/tips-and-tricks-page.js
@@ -1,6 +1,6 @@
// >> icon-font-code-behind-code
-const Observable = require("tns-core-modules/data/observable").Observable;
-function pageLoaded(args) {
+import { Observable } from "@nativescript/core";
+export function pageLoaded(args) {
const page = args.object;
const viewModel = new Observable();
@@ -15,5 +15,4 @@ function pageLoaded(args) {
page.bindingContext = viewModel;
}
-exports.pageLoaded = pageLoaded;
// << icon-font-code-behind-code
diff --git a/app/ns-ui-category/icon-fonts/code-behind/code-behind-page.xml b/app/ns-ui-category/icon-fonts/tips-and-tricks/tips-and-tricks-page.xml
similarity index 100%
rename from app/ns-ui-category/icon-fonts/code-behind/code-behind-page.xml
rename to app/ns-ui-category/icon-fonts/tips-and-tricks/tips-and-tricks-page.xml
diff --git a/app/ns-ui-category/icon-fonts/code-behind/code-behind-ts-page.css b/app/ns-ui-category/icon-fonts/tips-and-tricks/tips-and-tricks-ts-page.css
similarity index 100%
rename from app/ns-ui-category/icon-fonts/code-behind/code-behind-ts-page.css
rename to app/ns-ui-category/icon-fonts/tips-and-tricks/tips-and-tricks-ts-page.css
diff --git a/app/ns-ui-category/icon-fonts/code-behind/code-behind-ts-page.ts b/app/ns-ui-category/icon-fonts/tips-and-tricks/tips-and-tricks-ts-page.ts
similarity index 82%
rename from app/ns-ui-category/icon-fonts/code-behind/code-behind-ts-page.ts
rename to app/ns-ui-category/icon-fonts/tips-and-tricks/tips-and-tricks-ts-page.ts
index 55090b2..bd6a0e8 100644
--- a/app/ns-ui-category/icon-fonts/code-behind/code-behind-ts-page.ts
+++ b/app/ns-ui-category/icon-fonts/tips-and-tricks/tips-and-tricks-ts-page.ts
@@ -1,6 +1,5 @@
// >> icon-font-code-behind-code-ts
-import { Observable, EventData } from "tns-core-modules/data/observable";
-import { Page } from "tns-core-modules/ui/page";
+import { EventData, Observable, Page } from "@nativescript/core";
export function pageLoaded(args: EventData) {
const page = args.object;
diff --git a/app/ns-ui-category/icon-fonts/code-behind/code-behind-ts-page.xml b/app/ns-ui-category/icon-fonts/tips-and-tricks/tips-and-tricks-ts-page.xml
similarity index 100%
rename from app/ns-ui-category/icon-fonts/code-behind/code-behind-ts-page.xml
rename to app/ns-ui-category/icon-fonts/tips-and-tricks/tips-and-tricks-ts-page.xml
diff --git a/app/ns-ui-category/icon-fonts/usage/article.md b/app/ns-ui-category/icon-fonts/usage/article.md
new file mode 100644
index 0000000..b3948dc
--- /dev/null
+++ b/app/ns-ui-category/icon-fonts/usage/article.md
@@ -0,0 +1,12 @@
+
+The example demonstrates, how to use setup the `font-family` property via CSS and how to define the needed icons via XML.
+
+
+
+
+WIth NativeScript 6 and above, we can use icon fonts with `Image` elements. For that purpose the `font://` prefix is needed to set the icon font code.
+
+
+
+
+> **Note:** Images have specific stretch options (`none`, `aspectFit`, `aspectFill`). At the same time the icon fonts are having `font-size` which can control the size of our font. If you want to set the size of your icon through the `font-size` property then set `stretch` property to `none`. Any other values of the stretch property (including the default one) will cause the icon to be streched by measuring the image (or if there is no sizes set, the parent layout in whcih the image is nested).
diff --git a/app/ns-ui-category/icon-fonts/basics/basics-page.css b/app/ns-ui-category/icon-fonts/usage/usage-page.css
similarity index 100%
rename from app/ns-ui-category/icon-fonts/basics/basics-page.css
rename to app/ns-ui-category/icon-fonts/usage/usage-page.css
diff --git a/app/ns-ui-category/icon-fonts/basics/basics-page.js b/app/ns-ui-category/icon-fonts/usage/usage-page.js
similarity index 100%
rename from app/ns-ui-category/icon-fonts/basics/basics-page.js
rename to app/ns-ui-category/icon-fonts/usage/usage-page.js
diff --git a/app/ns-ui-category/icon-fonts/basics/basics-page.xml b/app/ns-ui-category/icon-fonts/usage/usage-page.xml
similarity index 58%
rename from app/ns-ui-category/icon-fonts/basics/basics-page.xml
rename to app/ns-ui-category/icon-fonts/usage/usage-page.xml
index 4c1f8b8..24acba5 100644
--- a/app/ns-ui-category/icon-fonts/basics/basics-page.xml
+++ b/app/ns-ui-category/icon-fonts/usage/usage-page.xml
@@ -23,5 +23,19 @@
+
+
+
+
+
+
+
+
diff --git a/app/ns-ui-category/modal-view/basics/basics-page.js b/app/ns-ui-category/modal-view/basics/basics-page.js
index a1c0584..c73a2e0 100644
--- a/app/ns-ui-category/modal-view/basics/basics-page.js
+++ b/app/ns-ui-category/modal-view/basics/basics-page.js
@@ -1,10 +1,11 @@
// >> main-view-js
const modalViewModule = "ns-ui-category/modal-view/basics/modal-view-page";
-function openModal(args) {
+export function openModal(args) {
const mainView = args.object;
const option = {
- context: { username: "test_username", password: "test" },
+ context: { username: "test_username",
+password: "test" },
closeCallback: (username, password) => {
// Receive data from the modal view. e.g. username & password
alert(`Username: ${username} : Password: ${password}`);
@@ -14,5 +15,4 @@ function openModal(args) {
mainView.showModal(modalViewModule, option);
}
-exports.openModal = openModal;
// << main-view-js
diff --git a/app/ns-ui-category/modal-view/basics/basics-ts-page.ts b/app/ns-ui-category/modal-view/basics/basics-ts-page.ts
index f62f94e..ebde20a 100644
--- a/app/ns-ui-category/modal-view/basics/basics-ts-page.ts
+++ b/app/ns-ui-category/modal-view/basics/basics-ts-page.ts
@@ -1,6 +1,6 @@
// >> main-view-ts
-import { Button } from "tns-core-modules/ui/button";
-import { ShowModalOptions } from "tns-core-modules/ui/core/view";
+import { Button, ShowModalOptions } from "@nativescript/core";
+
const modalViewModulets = "ns-ui-category/modal-view/basics/modal-ts-view-page";
export function openModal(args) {
diff --git a/app/ns-ui-category/modal-view/basics/modal-ts-view-page.ts b/app/ns-ui-category/modal-view/basics/modal-ts-view-page.ts
index bb8971f..f2f8ed3 100644
--- a/app/ns-ui-category/modal-view/basics/modal-ts-view-page.ts
+++ b/app/ns-ui-category/modal-view/basics/modal-ts-view-page.ts
@@ -1,6 +1,6 @@
// >> modal-view-ts
-import { fromObject } from "tns-core-modules/data/observable";
-import { Page } from "tns-core-modules/ui/page";
+import { fromObject, Page } from "@nativescript/core";
+
let closeCallback;
export function onShownModally(args) {
diff --git a/app/ns-ui-category/modal-view/basics/modal-view-page.js b/app/ns-ui-category/modal-view/basics/modal-view-page.js
index b2f459f..6a88aaa 100644
--- a/app/ns-ui-category/modal-view/basics/modal-view-page.js
+++ b/app/ns-ui-category/modal-view/basics/modal-view-page.js
@@ -1,21 +1,19 @@
// >> modal-view-js
-const observableModule = require("tns-core-modules/data/observable");
+import { fromObject } from "@nativescript/core";
let closeCallback;
-function onShownModally(args) {
+export function onShownModally(args) {
const context = args.context;
closeCallback = args.closeCallback;
const page = args.object;
- page.bindingContext = observableModule.fromObject(context);
+ page.bindingContext = fromObject(context);
}
-exports.onShownModally = onShownModally;
-function onLoginButtonTap(args) {
+export function onLoginButtonTap(args) {
const page = args.object.page;
const bindingContext = page.bindingContext;
const username = bindingContext.get("username");
const password = bindingContext.get("password");
closeCallback(username, password);
}
-exports.onLoginButtonTap = onLoginButtonTap;
// << modal-view-js
diff --git a/app/ns-ui-category/modal-view/custom-actionbar/main-page.js b/app/ns-ui-category/modal-view/custom-actionbar/main-page.js
index 377ca7a..1323c7f 100644
--- a/app/ns-ui-category/modal-view/custom-actionbar/main-page.js
+++ b/app/ns-ui-category/modal-view/custom-actionbar/main-page.js
@@ -1,7 +1,7 @@
// >> main-page-js-action-bar
const modalView = "ns-ui-category/modal-view/custom-actionbar/modal-root";
-function openModal(args) {
+export function openModal(args) {
const mainpage = args.object.page;
const option = {
context: "some context",
@@ -10,5 +10,5 @@ function openModal(args) {
};
mainpage.showModal(modalView, option);
}
-exports.openModal = openModal;
+
// << main-page-js-action-bar
diff --git a/app/ns-ui-category/modal-view/custom-actionbar/main-ts-page.ts b/app/ns-ui-category/modal-view/custom-actionbar/main-ts-page.ts
index dd8794e..2fee7fb 100644
--- a/app/ns-ui-category/modal-view/custom-actionbar/main-ts-page.ts
+++ b/app/ns-ui-category/modal-view/custom-actionbar/main-ts-page.ts
@@ -1,6 +1,6 @@
// >> main-page-ts-action-bar
-import { Page } from "tns-core-modules/ui/page";
-import { ShowModalOptions } from "tns-core-modules/ui/core/view";
+import { Page, ShowModalOptions } from "@nativescript/core";
+
const modalView = "ns-ui-category/modal-view/custom-actionbar/modal-ts-root";
export function openModal(args) {
diff --git a/app/ns-ui-category/modal-view/custom-actionbar/modal-view-page.js b/app/ns-ui-category/modal-view/custom-actionbar/modal-view-page.js
index c389d10..9c6595f 100644
--- a/app/ns-ui-category/modal-view/custom-actionbar/modal-view-page.js
+++ b/app/ns-ui-category/modal-view/custom-actionbar/modal-view-page.js
@@ -1,11 +1,9 @@
// >> modal-view-js-action-bar
-function onShowingModally(args) {
+export function onShowingModally(args) {
console.log("onShowingModally");
}
-exports.onShowingModally = onShowingModally;
-function onCloseModal(args) {
+export function onCloseModal(args) {
args.object.closeModal();
}
-exports.onCloseModal = onCloseModal;
// << modal-view-js-action-bar
diff --git a/app/ns-ui-category/modal-view/modal-navigation/first-modal-ts-view-page.ts b/app/ns-ui-category/modal-view/modal-navigation/first-modal-ts-view-page.ts
index 9f6c60f..7b6c94e 100644
--- a/app/ns-ui-category/modal-view/modal-navigation/first-modal-ts-view-page.ts
+++ b/app/ns-ui-category/modal-view/modal-navigation/first-modal-ts-view-page.ts
@@ -1,5 +1,5 @@
// >> first-modal-view-ts-navigation
-import { Page } from "tns-core-modules/ui/page";
+import { Page } from "@nativescript/core";
export function onNavigate(args) {
const view = args.object;
const page: Page = view.page;
diff --git a/app/ns-ui-category/modal-view/modal-navigation/first-modal-view-page.js b/app/ns-ui-category/modal-view/modal-navigation/first-modal-view-page.js
index 0808712..bf9fe0e 100644
--- a/app/ns-ui-category/modal-view/modal-navigation/first-modal-view-page.js
+++ b/app/ns-ui-category/modal-view/modal-navigation/first-modal-view-page.js
@@ -1,18 +1,15 @@
// >> first-modal-view-js-navigation
-function onNavigate(args) {
+export function onNavigate(args) {
const view = args.object;
const page = view.page;
page.frame.navigate("ns-ui-category/modal-view/modal-navigation/second-modal-view-page");
}
-exports.onNavigate = onNavigate;
-function onPageLoaded(args) {
+export function onPageLoaded(args) {
console.log("onPageLoaded");
}
-exports.onPageLoaded = onPageLoaded;
-function onCloseModal(args) {
+export function onCloseModal(args) {
args.object.closeModal();
}
-exports.onCloseModal = onCloseModal;
// << first-modal-view-js-navigation
diff --git a/app/ns-ui-category/modal-view/modal-navigation/main-page.js b/app/ns-ui-category/modal-view/modal-navigation/main-page.js
index 5b23e30..394a15d 100644
--- a/app/ns-ui-category/modal-view/modal-navigation/main-page.js
+++ b/app/ns-ui-category/modal-view/modal-navigation/main-page.js
@@ -1,7 +1,7 @@
// >> main-page-js-navigation
const modalView = "ns-ui-category/modal-view/modal-navigation/modal-root";
-function openModal(args) {
+export function openModal(args) {
const mainpage = args.object.page;
const options = {
context: "some context",
@@ -11,5 +11,5 @@ function openModal(args) {
};
mainpage.showModal(modalView, options);
}
-exports.openModal = openModal;
+
// << main-page-js-navigation
diff --git a/app/ns-ui-category/modal-view/modal-navigation/main-ts-page.ts b/app/ns-ui-category/modal-view/modal-navigation/main-ts-page.ts
index db18861..0d5540b 100644
--- a/app/ns-ui-category/modal-view/modal-navigation/main-ts-page.ts
+++ b/app/ns-ui-category/modal-view/modal-navigation/main-ts-page.ts
@@ -1,8 +1,8 @@
// >> main-page-ts-navigation
-import { ShowModalOptions } from "tns-core-modules/ui/core/view";
+import { ShowModalOptions } from "@nativescript/core";
const modalView = "ns-ui-category/modal-view/modal-navigation/modal-root";
-function openModal(args) {
+export function openModal(args) {
const mainpage = args.object.page;
const options: ShowModalOptions = {
context: "some context",
@@ -11,5 +11,5 @@ function openModal(args) {
};
mainpage.showModal(modalView, options);
}
-exports.openModal = openModal;
+
// << main-page-ts-navigation
diff --git a/app/ns-ui-category/modal-view/modal-navigation/modal-root.js b/app/ns-ui-category/modal-view/modal-navigation/modal-root.js
index 0b5d0fd..a774eff 100644
--- a/app/ns-ui-category/modal-view/modal-navigation/modal-root.js
+++ b/app/ns-ui-category/modal-view/modal-navigation/modal-root.js
@@ -1,12 +1,12 @@
-exports.onShowingModally = (args) => {
+export function onShowingModally(args) {
// args is of type ShownModallyData
console.log(`${args.eventName}`); // showingModally
-};
+}
-exports.onShownModally = (args) => {
+export function onShownModally(args) {
// args is of type ShownModallyData
console.log(` ${args.context}`);
console.log(` ${args.eventName}`); // shownModally
console.log(` ${args.object}`);
-};
+}
diff --git a/app/ns-ui-category/modal-view/modal-navigation/modal-ts-root.ts b/app/ns-ui-category/modal-view/modal-navigation/modal-ts-root.ts
index 55412e5..cac4e86 100644
--- a/app/ns-ui-category/modal-view/modal-navigation/modal-ts-root.ts
+++ b/app/ns-ui-category/modal-view/modal-navigation/modal-ts-root.ts
@@ -1,4 +1,4 @@
-import { ShownModallyData } from "tns-core-modules/ui/page";
+import { ShownModallyData } from "@nativescript/core";
export function onShowingModally(args: ShownModallyData) {
// args is of type ShownModallyData
diff --git a/app/ns-ui-category/modal-view/modal-navigation/second-modal-ts-view-page.ts b/app/ns-ui-category/modal-view/modal-navigation/second-modal-ts-view-page.ts
index 9d4fcf5..26d664c 100644
--- a/app/ns-ui-category/modal-view/modal-navigation/second-modal-ts-view-page.ts
+++ b/app/ns-ui-category/modal-view/modal-navigation/second-modal-ts-view-page.ts
@@ -1,5 +1,5 @@
// >> second-modal-view-ts-navigation
-import { Page } from "tns-core-modules/ui/page";
+import { Page } from "@nativescript/core";
export function onGoBack(args) {
const view = args.object;
diff --git a/app/ns-ui-category/modal-view/modal-navigation/second-modal-view-page.js b/app/ns-ui-category/modal-view/modal-navigation/second-modal-view-page.js
index daa6703..fc31989 100644
--- a/app/ns-ui-category/modal-view/modal-navigation/second-modal-view-page.js
+++ b/app/ns-ui-category/modal-view/modal-navigation/second-modal-view-page.js
@@ -1,14 +1,12 @@
// >> second-modal-view-js-navigation
-function onGoBack(args) {
+export function onGoBack(args) {
const view = args.object;
const page = view.page;
page.frame.goBack();
}
-exports.onGoBack = onGoBack;
-function onCloseModal(args) {
+export function onCloseModal(args) {
args.object.closeModal();
}
-exports.onCloseModal = onCloseModal;
// << second-modal-view-js-navigation
diff --git a/app/ns-ui-category/modal-view/modal-view-examples-page.js b/app/ns-ui-category/modal-view/modal-view-examples-page.js
index ae55c16..61abc41 100644
--- a/app/ns-ui-category/modal-view/modal-view-examples-page.js
+++ b/app/ns-ui-category/modal-view/modal-view-examples-page.js
@@ -1,16 +1,16 @@
-const ListViewLinksModel = require("../../links-view-model");
-const link = require("../../link");
+import ListViewLinksModel from "../../links-view-model";
+import Link from "../../link";
const navigationLinks = [
- new link("Basics", "ns-ui-category/modal-view/basics/basics-page"),
- new link("Modal view navigation", "ns-ui-category/modal-view/modal-navigation/main-page"),
- new link("Modal view with ActionBar", "ns-ui-category/modal-view/custom-actionbar/main-page")
+ new Link("Basics", "ns-ui-category/modal-view/basics/basics-page"),
+ new Link("Modal view navigation", "ns-ui-category/modal-view/modal-navigation/main-page"),
+ new Link("Modal view with ActionBar", "ns-ui-category/modal-view/custom-actionbar/main-page")
];
const navigationLinksTsc = [
- new link("Basics", "ns-ui-category/modal-view/basics/basics-ts-page"),
- new link("Modal page navigation", "ns-ui-category/modal-view/modal-navigation/main-ts-page"),
- new link("Modal page with ActionBar", "ns-ui-category/modal-view/custom-actionbar/main-ts-page")
+ new Link("Basics", "ns-ui-category/modal-view/basics/basics-ts-page"),
+ new Link("Modal page navigation", "ns-ui-category/modal-view/modal-navigation/main-ts-page"),
+ new Link("Modal page with ActionBar", "ns-ui-category/modal-view/custom-actionbar/main-ts-page")
];
-function onNavigatingTo(args) {
+export function onNavigatingTo(args) {
const page = args.object;
page.bindingContext = new ListViewLinksModel({
links: navigationLinks,
@@ -19,4 +19,4 @@ function onNavigatingTo(args) {
tsclinks: navigationLinksTsc
});
}
-exports.onNavigatingTo = onNavigatingTo;
+
diff --git a/app/ns-ui-widgets-category/action-bar/action-bar-page.js b/app/ns-ui-widgets-category/action-bar/action-bar-page.js
index 34118e0..f4a7b5d 100644
--- a/app/ns-ui-widgets-category/action-bar/action-bar-page.js
+++ b/app/ns-ui-widgets-category/action-bar/action-bar-page.js
@@ -1,66 +1,59 @@
-const ListViewLinksModel = require("../../links-view-model");
-const link = require("../../link");
+import ListViewLinksModel from "../../links-view-model";
+import Link from "../../link";
const navigationLinks = [
- new link("Basics", "ns-ui-widgets-category/action-bar/basics/basics-page"),
- new link(
+ new Link("Usage", "ns-ui-widgets-category/action-bar/usage/usage-page"),
+ new Link(
"Code-Behind",
"ns-ui-widgets-category/action-bar/code-behind/code-behind-page"
),
- new link(
+ new Link(
"Cutom title view",
"ns-ui-widgets-category/action-bar/custom-title-view/custom-title-view-page"
),
- new link(
+ new Link(
"Setting app icon Android",
"ns-ui-widgets-category/action-bar/setting-app-icon-android/setting-app-icon-android-page"
),
- new link(
- "Navigation button",
- "ns-ui-widgets-category/action-bar/navigation-button/navigation-button-page"
- ),
- new link(
+ new Link(
"Items",
"ns-ui-widgets-category/action-bar/items-actionbar/items-actionbar-page"
),
- new link(
+ new Link(
"Hide/Show ActionBar",
"ns-ui-widgets-category/action-bar/hide-show-actionbar/hide-show-actionbar-page"
),
- new link(
+ new Link(
"Hiding ActionItems",
"ns-ui-widgets-category/action-bar/hiding-action-items/hiding-action-items-page"
),
- new link("Styling", "ns-ui-widgets-category/action-bar/styling/styling-page"),
- new link(
+ new Link("Styling", "ns-ui-widgets-category/action-bar/styling/styling-page"),
+ new Link(
"Creating SideDrawer button",
"ns-ui-widgets-category/action-bar/creating-sidedrawer-button/creating-sidedrawer-button-page"
)
];
const navigationLinksTsc = [
- new link(
+ new Link("Usage", "ns-ui-widgets-category/action-bar/usage/usage-ts-page"),
+ new Link(
"Code-Behind",
"ns-ui-widgets-category/action-bar/code-behind/code-behind-ts-page"
),
- new link(
+ new Link(
"Hide/Show ActionBar",
"ns-ui-widgets-category/action-bar/hide-show-actionbar/hide-show-actionbar-ts-page"
),
- new link(
+ new Link(
"Hiding ActionItems",
"ns-ui-widgets-category/action-bar/hiding-action-items/hiding-action-items-ts-page"
),
- new link(
+ new Link(
"Items",
"ns-ui-widgets-category/action-bar/items-actionbar/items-actionbar-ts-page"
- ),
- new link(
- "Navigation button",
- "ns-ui-widgets-category/action-bar/navigation-button/navigation-button-ts-page"
)
];
-function onNavigatingTo(args) {
+export function onNavigatingTo(args) {
const page = args.object;
page.bindingContext = new ListViewLinksModel({
links: navigationLinks,
@@ -69,4 +62,4 @@ function onNavigatingTo(args) {
tsclinks: navigationLinksTsc
});
}
-exports.onNavigatingTo = onNavigatingTo;
+
diff --git a/app/ns-ui-widgets-category/action-bar/basics/article.md b/app/ns-ui-widgets-category/action-bar/basics/article.md
deleted file mode 100644
index 3761ad7..0000000
--- a/app/ns-ui-widgets-category/action-bar/basics/article.md
+++ /dev/null
@@ -1,9 +0,0 @@
-The title of the ActionBar can be easily set by its corresponding property - `title`.
-We can additionally set an icon to use in your ActionBar on Android with the `icon` property.
-
-Here’s what a basic usage of the `title` and `icon` properties looks like:
-
-
-> Note: The icon can only be set in Android platform. It is hidden by default, but you can explicitly control its visibility with the `android.iconVisibility' property.
-
-Furthermore, the title can be customized by placing a content component (button, label, layout-components, etc.) directly in the ActionBar.
diff --git a/app/ns-ui-widgets-category/action-bar/basics/basics-page.css b/app/ns-ui-widgets-category/action-bar/basics/basics-page.css
deleted file mode 100644
index 1d8430c..0000000
--- a/app/ns-ui-widgets-category/action-bar/basics/basics-page.css
+++ /dev/null
@@ -1,6 +0,0 @@
-Label {
- background-color: orangered;
- color: white;
- margin:8;
- padding: 16;
-}
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/action-bar/basics/basics-page.js b/app/ns-ui-widgets-category/action-bar/basics/basics-page.js
deleted file mode 100644
index 5628053..0000000
--- a/app/ns-ui-widgets-category/action-bar/basics/basics-page.js
+++ /dev/null
@@ -1,9 +0,0 @@
-const Observable = require("tns-core-modules/data/observable").Observable;
-function onNavigatingTo(args) {
- const page = args.object;
- const vm = new Observable();
- vm.set("title", "Getting Started \nAction Bar Example");
- vm.set("snippet", "");
- page.bindingContext = vm;
-}
-exports.onNavigatingTo = onNavigatingTo;
diff --git a/app/ns-ui-widgets-category/action-bar/basics/basics-page.xml b/app/ns-ui-widgets-category/action-bar/basics/basics-page.xml
deleted file mode 100644
index 1ee297b..0000000
--- a/app/ns-ui-widgets-category/action-bar/basics/basics-page.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/action-bar/code-behind/article.md b/app/ns-ui-widgets-category/action-bar/code-behind/article.md
deleted file mode 100644
index 4eeae51..0000000
--- a/app/ns-ui-widgets-category/action-bar/code-behind/article.md
+++ /dev/null
@@ -1,10 +0,0 @@
-The `ActionBar` can be dynamically created and controlled.
-The property `navigationButton` allows us to overwrite the default navigation button (if one is present).
-To explicitly show/hide an action bar on your page, use the `actionBarHidden` property of the current page.
-
-
-
-> iOS Specifics: The default text of the button is the title of the previous page; you can change it by setting the `text` property as shown in the example [Setting the Text Title](#setting-the-title-text).
-In iOS, the back button is used explicitly for navigation. It navigates to the previous page and you cannot handle the `tap` event to override this behavior. If you want to place a button on the left side of the `ActionBar` and handle the tap event (e.g., show slide-out), you can use `ActionItem` with `ios.position="left"`.
-
-> Android Specifics: In Android, you cannot set text inside the navigation button. You can use the `icon` property to set an image (e.g., `~\images\nav-image.png` or `res:\\ic_nav`). You can use `android.systemIcon` to set one of the system icons available in Android. In this case, there is no default behaviour for NavigationButton's `tap` event, and we should define manually the callback function, which will be executed.
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/action-bar/code-behind/code-behind-page.css b/app/ns-ui-widgets-category/action-bar/code-behind/code-behind-page.css
deleted file mode 100644
index 1d8430c..0000000
--- a/app/ns-ui-widgets-category/action-bar/code-behind/code-behind-page.css
+++ /dev/null
@@ -1,6 +0,0 @@
-Label {
- background-color: orangered;
- color: white;
- margin:8;
- padding: 16;
-}
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/action-bar/code-behind/code-behind-page.js b/app/ns-ui-widgets-category/action-bar/code-behind/code-behind-page.js
index 94340dd..2b76da3 100644
--- a/app/ns-ui-widgets-category/action-bar/code-behind/code-behind-page.js
+++ b/app/ns-ui-widgets-category/action-bar/code-behind/code-behind-page.js
@@ -1,8 +1,7 @@
// >> actionbar-code-behind
-const ActionBar = require("tns-core-modules/ui/action-bar").ActionBar;
-const NavigationButton = require("tns-core-modules/ui/action-bar").NavigationButton;
+import { ActionBar, NavigationButton, isAndroid } from "@nativescript/core";
-function onLoaded(args) {
+export function onLoaded(args) {
const page = args.object;
const newActionBar = new ActionBar();
@@ -11,12 +10,13 @@ function onLoaded(args) {
// for ios
newNavigaitonButton.text = "Go Back";
// for android
- newNavigaitonButton.android.systemIcon = "ic_menu_back";
+ if (isAndroid) {
+ newNavigaitonButton.android.systemIcon = "ic_menu_back";
+ }
// or newNavigaitonButton.icon = "~\images\nav-image.png";
newActionBar.navigationButton = newNavigaitonButton;
page.actionBar = newActionBar;
page.actionBarHidden = false;
}
-exports.onLoaded = onLoaded;
// << actionbar-code-behind
diff --git a/app/ns-ui-widgets-category/action-bar/code-behind/code-behind-page.xml b/app/ns-ui-widgets-category/action-bar/code-behind/code-behind-page.xml
index 03d8dc6..e3b5873 100644
--- a/app/ns-ui-widgets-category/action-bar/code-behind/code-behind-page.xml
+++ b/app/ns-ui-widgets-category/action-bar/code-behind/code-behind-page.xml
@@ -1,5 +1,3 @@
-
-
-
+
diff --git a/app/ns-ui-widgets-category/action-bar/code-behind/code-behind-ts-page.css b/app/ns-ui-widgets-category/action-bar/code-behind/code-behind-ts-page.css
deleted file mode 100644
index 1d8430c..0000000
--- a/app/ns-ui-widgets-category/action-bar/code-behind/code-behind-ts-page.css
+++ /dev/null
@@ -1,6 +0,0 @@
-Label {
- background-color: orangered;
- color: white;
- margin:8;
- padding: 16;
-}
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/action-bar/code-behind/code-behind-ts-page.ts b/app/ns-ui-widgets-category/action-bar/code-behind/code-behind-ts-page.ts
index 6ca6133..42ff68a 100644
--- a/app/ns-ui-widgets-category/action-bar/code-behind/code-behind-ts-page.ts
+++ b/app/ns-ui-widgets-category/action-bar/code-behind/code-behind-ts-page.ts
@@ -1,16 +1,14 @@
// >> actionbar-code-behind-ts
-import { EventData } from "tns-core-modules/data/observable";
-import { ActionBar, NavigationButton } from "tns-core-modules/ui/action-bar";
-import { Page } from "tns-core-modules/ui/page";
+import { ActionBar, EventData, NavigationButton, Page } from "@nativescript/core";
export function onLoaded(args: EventData) {
const page = args.object;
const newActionBar = new ActionBar();
newActionBar.title = "Code-Behind ActionBar";
- const newNavigaitonButton = new NavigationButton();
- newNavigaitonButton.text = "Go Back";
- newActionBar.navigationButton = newNavigaitonButton;
+ const newNavigationButton = new NavigationButton();
+ newNavigationButton.text = "Go Back";
+ newActionBar.navigationButton = newNavigationButton;
page.actionBar = newActionBar;
page.actionBarHidden = false;
diff --git a/app/ns-ui-widgets-category/action-bar/code-behind/code-behind-ts-page.xml b/app/ns-ui-widgets-category/action-bar/code-behind/code-behind-ts-page.xml
index 03d8dc6..7e91187 100644
--- a/app/ns-ui-widgets-category/action-bar/code-behind/code-behind-ts-page.xml
+++ b/app/ns-ui-widgets-category/action-bar/code-behind/code-behind-ts-page.xml
@@ -1,5 +1,3 @@
-
-
-
+
diff --git a/app/ns-ui-widgets-category/action-bar/creating-sidedrawer-button/article.md b/app/ns-ui-widgets-category/action-bar/creating-sidedrawer-button/article.md
deleted file mode 100644
index 68ba065..0000000
--- a/app/ns-ui-widgets-category/action-bar/creating-sidedrawer-button/article.md
+++ /dev/null
@@ -1,12 +0,0 @@
-This example shows how to implement a "show side-drawer button" functionality.
-
-
-
-For Android, this example uses the `NavigationButton` because `ActionItems` are shown on the right side of the `ActionBar`.
-
-For iOS, this code adds a regular `ActionItem` with `position` set to `left`. Using the `NavigationButton` as a side-drawer button in iOS is not possible, because its function is to always navigate back in the application.
-
->Note: The `` and `` tags are used inside the XML to define platform-specific elements.
->Important: The platform specific tags (`` and ``) will work only in non-Angular based project.
-
-
diff --git a/app/ns-ui-widgets-category/action-bar/creating-sidedrawer-button/creating-sidedrawer-button-page.css b/app/ns-ui-widgets-category/action-bar/creating-sidedrawer-button/creating-sidedrawer-button-page.css
deleted file mode 100644
index a0c851b..0000000
--- a/app/ns-ui-widgets-category/action-bar/creating-sidedrawer-button/creating-sidedrawer-button-page.css
+++ /dev/null
@@ -1,10 +0,0 @@
-ActionBar {
- background-color: #3C5AFD;
- color: white;
-}
-Label{
- background-color: orangered;
- color: white;
- margin:8;
- padding: 16;
-}
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/action-bar/creating-sidedrawer-button/creating-sidedrawer-button-page.js b/app/ns-ui-widgets-category/action-bar/creating-sidedrawer-button/creating-sidedrawer-button-page.js
index f75abad..a402747 100644
--- a/app/ns-ui-widgets-category/action-bar/creating-sidedrawer-button/creating-sidedrawer-button-page.js
+++ b/app/ns-ui-widgets-category/action-bar/creating-sidedrawer-button/creating-sidedrawer-button-page.js
@@ -1,15 +1,4 @@
-const Observable = require("tns-core-modules/data/observable").Observable;
-
-function onNavigatingTo(args) {
- const page = args.object;
- const vm = new Observable();
- vm.set("title", "Creating SideDrawer Button \nAction Bar Example");
- page.bindingContext = vm;
-}
-exports.onNavigatingTo = onNavigatingTo;
-
-function showSideDrawer(args) {
+export function showSideDrawer(args) {
console.log("Show SideDrawer tapped.");
// Show sidedrawer ...
}
-exports.showSideDrawer = showSideDrawer;
diff --git a/app/ns-ui-widgets-category/action-bar/creating-sidedrawer-button/creating-sidedrawer-button-page.xml b/app/ns-ui-widgets-category/action-bar/creating-sidedrawer-button/creating-sidedrawer-button-page.xml
index b29ecee..f43fa38 100644
--- a/app/ns-ui-widgets-category/action-bar/creating-sidedrawer-button/creating-sidedrawer-button-page.xml
+++ b/app/ns-ui-widgets-category/action-bar/creating-sidedrawer-button/creating-sidedrawer-button-page.xml
@@ -11,8 +11,4 @@
-
-
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/action-bar/custom-title-view/article.md b/app/ns-ui-widgets-category/action-bar/custom-title-view/article.md
deleted file mode 100644
index 07730ce..0000000
--- a/app/ns-ui-widgets-category/action-bar/custom-title-view/article.md
+++ /dev/null
@@ -1,3 +0,0 @@
-You could set a custom view, which will be rendered instead of the ActionItem text. The example below demonstrates, how to load to separate labels inside the item.
-
-
diff --git a/app/ns-ui-widgets-category/action-bar/custom-title-view/custom-title-view-page.js b/app/ns-ui-widgets-category/action-bar/custom-title-view/custom-title-view-page.js
deleted file mode 100644
index 4f9b7b7..0000000
--- a/app/ns-ui-widgets-category/action-bar/custom-title-view/custom-title-view-page.js
+++ /dev/null
@@ -1,9 +0,0 @@
-const Observable = require("tns-core-modules/data/observable").Observable;
-
-function onNavigatingTo(args) {
- const page = args.object;
- const vm = new Observable();
- vm.set("title", "Custom title view \nAction Bar Example");
- page.bindingContext = vm;
-}
-exports.onNavigatingTo = onNavigatingTo;
diff --git a/app/ns-ui-widgets-category/action-bar/custom-title-view/custom-title-view-page.xml b/app/ns-ui-widgets-category/action-bar/custom-title-view/custom-title-view-page.xml
index 4025082..e795c74 100644
--- a/app/ns-ui-widgets-category/action-bar/custom-title-view/custom-title-view-page.xml
+++ b/app/ns-ui-widgets-category/action-bar/custom-title-view/custom-title-view-page.xml
@@ -1,4 +1,4 @@
-
+
@@ -11,8 +11,4 @@
-
-
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/action-bar/end.md b/app/ns-ui-widgets-category/action-bar/end.md
index a59012f..2a1e7ce 100644
--- a/app/ns-ui-widgets-category/action-bar/end.md
+++ b/app/ns-ui-widgets-category/action-bar/end.md
@@ -1,8 +1,118 @@
-**API Reference for the** [ActionBar Class](http://docs.nativescript.org/api-reference/modules/_ui_action_bar_.html)
-**API Reference for the** [Known Colors](https://docs.nativescript.org/api-reference/modules/_color_known_colors_)
+## Tips And Tricks
-**Native Component**
+### Setting App Icon For Android
+
+You can set the application icon only for Android. By default, the application icon is hidden. You can show it by setting the android.iconVisibility property to always.
+
+
+
+### Hiding Action Items
+
+You can use the `visibility` property of the `ActionItem` to dynamically hide and show items. You can also use binding for the visibility.
+
+Here is an example of showing different action items when the app is in "editing" mode:
+
+
+
+
+
+### Hide Show ActionBar
+
+You can explicitly control the visibility of the `ActionBar` by setting the `actionBarHidden` property of the `Page`or setting the `Frame`'s [`actionBarVisibility`]({% slug frame %}) property.
+
+
+
+
+
+In **Android**, the application bar is visible by default and shows the name of the application as title. The navigation button is visible only when it is explicitly defined in the application.
+
+In **iOS**, if the application bar is empty (e.g., no title or action items are defined), it is hidden on the first page and automatically shown after navigation to host the navigation button. If the ActionBar is not empty (e.g., there is a title or action items defined) it will be shown on first page, too.
+
+### Custom Title View
+
+You could set a custom view, which will be rendered instead of the ActionItem text. The example below demonstrates, how to load to separate labels inside the item.
+
+
+
+### Creating SideDrawer Button
+
+This example shows how to implement a "show side-drawer button" functionality.
+
+
+
+For Android, this example uses the `NavigationButton` because `ActionItems` are shown on the right side of the `ActionBar`.
+
+For iOS, this code adds a regular `ActionItem` with `position` set to `left`. Using the `NavigationButton` as a side-drawer button in iOS is not possible, because its function is to always navigate back in the application.
+
+>Note: The `` and `` tags are used inside the XML to define platform-specific elements.
+>Important: The platform specific tags (`` and ``) will work only in non-Angular based project.
+
+
+### Creating ActionBar via Code-Behind
+
+The `ActionBar` can be dynamically created and controlled.
+The property `navigationButton` allows us to overwrite the default navigation button (if one is present).
+To explicitly show/hide an action bar on your page, use the `actionBarHidden` property of the current page.
+
+
+
+> iOS Specifics: The default text of the button is the title of the previous page; you can change it by setting the `text` property as shown in the example [Setting the Text Title](#setting-the-title-text).
+In iOS, the back button is used explicitly for navigation. It navigates to the previous page and you cannot handle the `tap` event to override this behavior. If you want to place a button on the left side of the `ActionBar` and handle the tap event (e.g., show slide-out), you can use `ActionItem` with `ios.position="left"`.
+
+> Android Specifics: In Android, you cannot set text inside the navigation button. You can use the `icon` property to set an image (e.g., `~\images\nav-image.png` or `res:\\ic_nav`). You can use `android.systemIcon` to set one of the system icons available in Android. In this case, there is no default behaviour for NavigationButton's `tap` event, and we should define manually the callback function, which will be executed.
+
+## Properties
+
+### ActionBar Properties
+
+| Name | Type | Description |
+|:----------|:---------|:---------------|
+| `title` | `string` | Gets or sets the action bar title. |
+| `titleView` | [View](https://docs.nativescript.org/api-reference/classes/_ui_core_view_.view) | Gets or sets the title view. When set - replaces the title with a custom view. |
+
+### ActionItem Properties
+| Name | Type | Description |
+|:---------|:---------|:---------------|
+| `text` | `string` | Gets or sets the text of the action item. |
+| `icon` | `string` | Gets or sets the icon of the action item. Supports local images (`~/`), resources (`res://`) and icon fonts (`fonts://`)|
+| `ios.position` | `enum`: _"left"_, _"right"_ | Sets the position of the item (default value is `left`). |
+| `android.position` | `enum`: _"actionBar"_, _"popup"_, _"actionBarIfRoom"_ | Sets the position of the item (default value is `actionBar`). |
+| `ios.systemIcon` | `number` | **iOS only** Sets the icon of the action item while using [UIBarButtonSystemIcon](https://developer.apple.com/documentation/uikit/uibarbuttonsystemitem) enumeration. |
+| `android.systemIcon` | `string` | **Android only** Sets a path to a resource icon ( see the [list of Android system drawables](https://developer.android.com/reference/android/R.drawable)) |
+
+
+### NavigationButton Properties
+
+| Name | Type | Description |
+|:---------|:---------|:---------------|
+| `text` | `string` | Gets or sets the text of the action item. |
+| `icon` | `string` | Gets or sets the icon of the action item. |
+
+## Events
+
+| Name | Description |
+|:------------|:---------------|
+| `loaded` | Emitted when the view is loaded. |
+| `unloaded` | Emitted when the view is unloaded. |
+| `layoutChanged` | Emitted when the layout bounds of a view changes due to layout processing. |
+
+## API References
+
+| Name | Type |
+|:-------------------|:---------|
+| [ActionBar](https://docs.nativescript.org/api-reference/modules/_ui_action_bar_) | `Module` |
+| [ActionBar](https://docs.nativescript.org/api-reference/classes/_ui_action_bar_.actionbar) | `Class` |
+| [ActionItem](https://docs.nativescript.org/api-reference/classes/_ui_action_bar_.actionitem ) | `Class` |
+| [ActionItems](https://docs.nativescript.org/api-reference/classes/_ui_action_bar_.actionitems) | `Class` |
+| [NavigationButton](https://docs.nativescript.org/api-reference/classes/_ui_action_bar_.navigationbutton) | `Class` |
+
+## Native Component
| Android | iOS |
|:-----------------------|:---------|
-| [android.widget.Toolbar](https://developer.android.com/reference/android/widget/Toolbar.html) | [UIView](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIView_Class/) |
\ No newline at end of file
+| [android.widget.Toolbar](https://developer.android.com/reference/android/widget/Toolbar.html) | [UIView](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIView_Class/) |
+
+
+## See Also
+
+[Detailed documentation article about `ActionBar` functionalities.](https://docs.nativescript.org/ui/action-bar)
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/action-bar/hide-show-actionbar/article.md b/app/ns-ui-widgets-category/action-bar/hide-show-actionbar/article.md
deleted file mode 100644
index 089918c..0000000
--- a/app/ns-ui-widgets-category/action-bar/hide-show-actionbar/article.md
+++ /dev/null
@@ -1,9 +0,0 @@
-You can explicitly control the visibility of the `ActionBar` by setting the `actionBarHidden` property of the `Page`or setting the `Frame`'s [`actionBarVisibility`]({% slug frame %}) property.
-
-
-
-
-
-In **Android**, the application bar is visible by default and shows the name of the application as title. The navigation button is visible only when it is explicitly defined in the application.
-
-In **iOS**, if the application bar is empty (e.g., no title or action items are defined), it is hidden on the first page and automatically shown after navigation to host the navigation button. If the ActionBar is not empty (e.g., there is a title or action items defined) it will be shown on first page, too.
diff --git a/app/ns-ui-widgets-category/action-bar/hide-show-actionbar/hide-show-actionbar-page.css b/app/ns-ui-widgets-category/action-bar/hide-show-actionbar/hide-show-actionbar-page.css
deleted file mode 100644
index 1d8430c..0000000
--- a/app/ns-ui-widgets-category/action-bar/hide-show-actionbar/hide-show-actionbar-page.css
+++ /dev/null
@@ -1,6 +0,0 @@
-Label {
- background-color: orangered;
- color: white;
- margin:8;
- padding: 16;
-}
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/action-bar/hide-show-actionbar/hide-show-actionbar-page.js b/app/ns-ui-widgets-category/action-bar/hide-show-actionbar/hide-show-actionbar-page.js
index 53298d2..ed8e12f 100644
--- a/app/ns-ui-widgets-category/action-bar/hide-show-actionbar/hide-show-actionbar-page.js
+++ b/app/ns-ui-widgets-category/action-bar/hide-show-actionbar/hide-show-actionbar-page.js
@@ -1,20 +1,19 @@
// >> action-bar-hide-show-js
-const Observable = require("tns-core-modules/data/observable").Observable;
+import { Observable } from "@nativescript/core";
let value = false;
-function onNavigatingTo(args) {
+export function onNavigatingTo(args) {
const page = args.object;
const vm = new Observable();
vm.set("abHidden", value);
page.bindingContext = vm;
}
-exports.onNavigatingTo = onNavigatingTo;
-function onTap(args) {
+
+export function onTap(args) {
const page = args.object.page;
const vm = page.bindingContext;
value = !value;
vm.set("abHidden", value);
}
-exports.onTap = onTap;
// << action-bar-hide-show-js
diff --git a/app/ns-ui-widgets-category/action-bar/hide-show-actionbar/hide-show-actionbar-page.xml b/app/ns-ui-widgets-category/action-bar/hide-show-actionbar/hide-show-actionbar-page.xml
index f180932..f116ef3 100644
--- a/app/ns-ui-widgets-category/action-bar/hide-show-actionbar/hide-show-actionbar-page.xml
+++ b/app/ns-ui-widgets-category/action-bar/hide-show-actionbar/hide-show-actionbar-page.xml
@@ -3,9 +3,5 @@
-
-
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/action-bar/hide-show-actionbar/hide-show-actionbar-ts-page.css b/app/ns-ui-widgets-category/action-bar/hide-show-actionbar/hide-show-actionbar-ts-page.css
deleted file mode 100644
index 1d8430c..0000000
--- a/app/ns-ui-widgets-category/action-bar/hide-show-actionbar/hide-show-actionbar-ts-page.css
+++ /dev/null
@@ -1,6 +0,0 @@
-Label {
- background-color: orangered;
- color: white;
- margin:8;
- padding: 16;
-}
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/action-bar/hide-show-actionbar/hide-show-actionbar-ts-page.ts b/app/ns-ui-widgets-category/action-bar/hide-show-actionbar/hide-show-actionbar-ts-page.ts
index 92288c9..7b05640 100644
--- a/app/ns-ui-widgets-category/action-bar/hide-show-actionbar/hide-show-actionbar-ts-page.ts
+++ b/app/ns-ui-widgets-category/action-bar/hide-show-actionbar/hide-show-actionbar-ts-page.ts
@@ -1,8 +1,5 @@
// >> action-bar-hide-show-ts
-import { EventData, Observable } from "tns-core-modules/data/observable";
-import { Button } from "tns-core-modules/ui/button";
-import { Page } from "tns-core-modules/ui/page";
-import { GestureEventData } from "tns-core-modules/ui/gestures";
+import { Button, EventData, GestureEventData, Observable, Page } from "@nativescript/core";
let value: boolean = false;
diff --git a/app/ns-ui-widgets-category/action-bar/hide-show-actionbar/hide-show-actionbar-ts-page.xml b/app/ns-ui-widgets-category/action-bar/hide-show-actionbar/hide-show-actionbar-ts-page.xml
index be88a1f..ba5c0f5 100644
--- a/app/ns-ui-widgets-category/action-bar/hide-show-actionbar/hide-show-actionbar-ts-page.xml
+++ b/app/ns-ui-widgets-category/action-bar/hide-show-actionbar/hide-show-actionbar-ts-page.xml
@@ -2,8 +2,4 @@
-
-
-
-
diff --git a/app/ns-ui-widgets-category/action-bar/hiding-action-items/article.md b/app/ns-ui-widgets-category/action-bar/hiding-action-items/article.md
deleted file mode 100644
index 23dd46d..0000000
--- a/app/ns-ui-widgets-category/action-bar/hiding-action-items/article.md
+++ /dev/null
@@ -1,7 +0,0 @@
-You can use the `visibility` property of the `ActionItem` to dynamically hide and show items. You can also use binding for the visibility.
-
-Here is an example of showing different action items when the app is in "editing" mode:
-
-
-
-
diff --git a/app/ns-ui-widgets-category/action-bar/hiding-action-items/hiding-action-items-page.css b/app/ns-ui-widgets-category/action-bar/hiding-action-items/hiding-action-items-page.css
deleted file mode 100644
index 1d8430c..0000000
--- a/app/ns-ui-widgets-category/action-bar/hiding-action-items/hiding-action-items-page.css
+++ /dev/null
@@ -1,6 +0,0 @@
-Label {
- background-color: orangered;
- color: white;
- margin:8;
- padding: 16;
-}
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/action-bar/hiding-action-items/hiding-action-items-page.js b/app/ns-ui-widgets-category/action-bar/hiding-action-items/hiding-action-items-page.js
index d057ba4..d3ae5d8 100644
--- a/app/ns-ui-widgets-category/action-bar/hiding-action-items/hiding-action-items-page.js
+++ b/app/ns-ui-widgets-category/action-bar/hiding-action-items/hiding-action-items-page.js
@@ -1,30 +1,26 @@
// >> action-bar-hiding-action-items-js
-const fromObject = require("tns-core-modules/data/observable").fromObject;
+import { fromObject } from "@nativescript/core";
-function onNavigatingTo(args) {
+export function onNavigatingTo(args) {
const page = args.object;
page.bindingContext = fromObject({
- isEditing: false,
- title: "Hiding Action Items"
+ isEditing: false
});
}
-exports.onNavigatingTo = onNavigatingTo;
-function onEdit(args) {
+
+export function onEdit(args) {
const page = args.object.page;
page.bindingContext.set("isEditing", true);
}
-exports.onEdit = onEdit;
-function onSave(args) {
+export function onSave(args) {
const page = args.object.page;
page.bindingContext.set("isEditing", false);
}
-exports.onSave = onSave;
-function onCancel(args) {
+export function onCancel(args) {
const page = args.object.page;
page.bindingContext.set("isEditing", false);
}
-exports.onCancel = onCancel;
// << action-bar-hiding-action-items-js
diff --git a/app/ns-ui-widgets-category/action-bar/hiding-action-items/hiding-action-items-page.xml b/app/ns-ui-widgets-category/action-bar/hiding-action-items/hiding-action-items-page.xml
index 0b88d42..fd95da8 100644
--- a/app/ns-ui-widgets-category/action-bar/hiding-action-items/hiding-action-items-page.xml
+++ b/app/ns-ui-widgets-category/action-bar/hiding-action-items/hiding-action-items-page.xml
@@ -10,9 +10,5 @@
visibility="{{ isEditing ? 'visible' : 'collapse' }}"/>
-
-
-
-
diff --git a/app/ns-ui-widgets-category/action-bar/hiding-action-items/hiding-action-items-ts-page.css b/app/ns-ui-widgets-category/action-bar/hiding-action-items/hiding-action-items-ts-page.css
deleted file mode 100644
index 1d8430c..0000000
--- a/app/ns-ui-widgets-category/action-bar/hiding-action-items/hiding-action-items-ts-page.css
+++ /dev/null
@@ -1,6 +0,0 @@
-Label {
- background-color: orangered;
- color: white;
- margin:8;
- padding: 16;
-}
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/action-bar/hiding-action-items/hiding-action-items-ts-page.ts b/app/ns-ui-widgets-category/action-bar/hiding-action-items/hiding-action-items-ts-page.ts
index 857651d..898d27b 100644
--- a/app/ns-ui-widgets-category/action-bar/hiding-action-items/hiding-action-items-ts-page.ts
+++ b/app/ns-ui-widgets-category/action-bar/hiding-action-items/hiding-action-items-ts-page.ts
@@ -1,15 +1,11 @@
// >> action-bar-hiding-action-items-ts
-import { EventData, fromObject } from "tns-core-modules/data/observable";
-import { ActionItem } from "tns-core-modules/ui/action-bar";
-import { Page } from "tns-core-modules/ui/page";
-import { GestureEventData } from "tns-core-modules/ui/gestures";
+import { ActionItem, EventData, GestureEventData, Page, fromObject } from "@nativescript/core";
// >> (hide)
export function onNavigatingTo(args: EventData) {
const page = args.object;
page.bindingContext = fromObject({
- isEditing: false,
- title: "Hiding Action Items"
+ isEditing: false
});
}
// << (hide)
diff --git a/app/ns-ui-widgets-category/action-bar/hiding-action-items/hiding-action-items-ts-page.xml b/app/ns-ui-widgets-category/action-bar/hiding-action-items/hiding-action-items-ts-page.xml
index dcebe7e..9f83eec 100644
--- a/app/ns-ui-widgets-category/action-bar/hiding-action-items/hiding-action-items-ts-page.xml
+++ b/app/ns-ui-widgets-category/action-bar/hiding-action-items/hiding-action-items-ts-page.xml
@@ -9,8 +9,4 @@
visibility="{{ isEditing ? 'visible' : 'collapse' }}"/>
-
-
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/action-bar/items-actionbar/article.md b/app/ns-ui-widgets-category/action-bar/items-actionbar/article.md
deleted file mode 100644
index 734762a..0000000
--- a/app/ns-ui-widgets-category/action-bar/items-actionbar/article.md
+++ /dev/null
@@ -1,45 +0,0 @@
-You can define additional action buttons using the `actionItems` collection:
-
-
-
-
-
-### Positioning
-
-The following positioning options are available for iOS and Android.
-
-Android (set with `android.position`):
-
-* `actionBar`\[default\]: Puts the item in the ActionBar. Action item can be rendered both as text or icon.
-* `popup`: Puts the item in the options menu. Items will be rendered as text.
-* `actionBarIfRoom`: Puts the item in the ActionBar if there is room for it. Otherwise, puts it in the options menu.
-
-iOS (set with `ios.position`):
-
-* `left`\[default\]: Puts the item on the left side of the ActionBar.
-* `right`: Puts the item on the right side of the ActionBar.
-
-### Setting Icons
-
-You can use the `icon` property to set an image instead of text for the action item. You can use local image (e.g., `~/images/add.png`) or resource (e.g., `res://ic_add`). Because there is no way to explicitly set `width` and `height` for icons, the recommended approach is using resources.
-
-You can use the `android.systemIcon` and `ios.systemIcon` properties to show system icons. If you define a system icon, it will be used instead of `icon` and `text` properties.
-
-Values for `android.systemIcon` correspond to the resources names of the built-in Android system icons. For a full list of Android drawable names, you may visit [Android Developer Site](https://developer.android.com/reference/android/R.drawable.html).
-
-Values for `ios.systemIcon` are numbers from the [`UIBarButtonItem.SystemItem`](https://developer.apple.com/documentation/uikit/uibarbuttonitem/systemitem) enumeration:
-
-| Value | Icon | | Value | Icon |
-| ----- | -------------- | --- | ----- | ------------- |
-|0 | Done | |12 | Search |
-|1 | Cancel | |13 | Refresh |
-|2 | Edit | |14 | Stop |
-|3 | Save | |15 | Camera |
-|4 | Add | |16 | Trash |
-|5 | FlexibleSpace | |17 | Play |
-|6 | FixedSpace | |18 | Pause |
-|7 | Compose | |19 | Rewind |
-|8 | Reply | |20 | FastForward |
-|9 | Action | |21 | Undo |
-|10 | Organize | |22 | Redo |
-|11 | Bookmarks | |23 | PageCurl |
diff --git a/app/ns-ui-widgets-category/action-bar/items-actionbar/items-actionbar-page.css b/app/ns-ui-widgets-category/action-bar/items-actionbar/items-actionbar-page.css
deleted file mode 100644
index 1d8430c..0000000
--- a/app/ns-ui-widgets-category/action-bar/items-actionbar/items-actionbar-page.css
+++ /dev/null
@@ -1,6 +0,0 @@
-Label {
- background-color: orangered;
- color: white;
- margin:8;
- padding: 16;
-}
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/action-bar/items-actionbar/items-actionbar-page.js b/app/ns-ui-widgets-category/action-bar/items-actionbar/items-actionbar-page.js
index db0277f..f4d6b6f 100644
--- a/app/ns-ui-widgets-category/action-bar/items-actionbar/items-actionbar-page.js
+++ b/app/ns-ui-widgets-category/action-bar/items-actionbar/items-actionbar-page.js
@@ -1,18 +1,11 @@
// >> items-actionbar-js
-const fromObject = require("tns-core-modules/data/observable").fromObject;
+import { fromObject } from "@nativescript/core";
-exports.onNavigatingTo = function(args) {
- const page = args.object;
- page.bindingContext = fromObject({
- title: "Items \n\nDemonstrating action items properties and position"
- });
-};
-
-exports.onShare = function() {
+export function onShare() {
console.log("share tap");
-};
+}
-exports.onDelete = function() {
+export function onDelete() {
console.log("delete tap");
-};
+}
// << items-actionbar-js
diff --git a/app/ns-ui-widgets-category/action-bar/items-actionbar/items-actionbar-page.xml b/app/ns-ui-widgets-category/action-bar/items-actionbar/items-actionbar-page.xml
index cadc574..165770a 100644
--- a/app/ns-ui-widgets-category/action-bar/items-actionbar/items-actionbar-page.xml
+++ b/app/ns-ui-widgets-category/action-bar/items-actionbar/items-actionbar-page.xml
@@ -1,4 +1,4 @@
-
+
@@ -11,8 +11,4 @@
-
-
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/action-bar/items-actionbar/items-actionbar-ts-page.css b/app/ns-ui-widgets-category/action-bar/items-actionbar/items-actionbar-ts-page.css
deleted file mode 100644
index 1d8430c..0000000
--- a/app/ns-ui-widgets-category/action-bar/items-actionbar/items-actionbar-ts-page.css
+++ /dev/null
@@ -1,6 +0,0 @@
-Label {
- background-color: orangered;
- color: white;
- margin:8;
- padding: 16;
-}
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/action-bar/items-actionbar/items-actionbar-ts-page.ts b/app/ns-ui-widgets-category/action-bar/items-actionbar/items-actionbar-ts-page.ts
index c6b7dfb..0f54aa5 100644
--- a/app/ns-ui-widgets-category/action-bar/items-actionbar/items-actionbar-ts-page.ts
+++ b/app/ns-ui-widgets-category/action-bar/items-actionbar/items-actionbar-ts-page.ts
@@ -1,14 +1,5 @@
// >> items-actionbar-ts
-import { EventData, fromObject } from "tns-core-modules/data/observable";
-import { Page } from "tns-core-modules/ui/page";
-import { GestureEventData } from "tns-core-modules/ui/gestures";
-
-export function onNavigatingTo(args: EventData) {
- const page = args.object;
- page.bindingContext = fromObject({
- title: "Items \n\nDemonstrating action items properties and position"
- });
-}
+import { GestureEventData } from "@nativescript/core";
export function onShare(args: GestureEventData) {
console.log("Share tapped!");
diff --git a/app/ns-ui-widgets-category/action-bar/items-actionbar/items-actionbar-ts-page.xml b/app/ns-ui-widgets-category/action-bar/items-actionbar/items-actionbar-ts-page.xml
index 285c330..b915040 100644
--- a/app/ns-ui-widgets-category/action-bar/items-actionbar/items-actionbar-ts-page.xml
+++ b/app/ns-ui-widgets-category/action-bar/items-actionbar/items-actionbar-ts-page.xml
@@ -9,7 +9,4 @@
android.position="popup">
-
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/action-bar/metadata.md b/app/ns-ui-widgets-category/action-bar/metadata.md
index 3b7c668..6a23eb6 100644
--- a/app/ns-ui-widgets-category/action-bar/metadata.md
+++ b/app/ns-ui-widgets-category/action-bar/metadata.md
@@ -4,3 +4,4 @@ description: ActionBar UI widget, which is a common abstraction over Android's A
position: 160
slug: action-bar
---
+example-order: usage, styling, tips-and-tricks
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/action-bar/navigation-button/article.md b/app/ns-ui-widgets-category/action-bar/navigation-button/article.md
deleted file mode 100644
index ad3cdd4..0000000
--- a/app/ns-ui-widgets-category/action-bar/navigation-button/article.md
+++ /dev/null
@@ -1,16 +0,0 @@
-The `NavigationButton` component is a common abstraction over the iOS back button and the Android navigation button.
-
-
-
-
-
-### iOS Specifics
-
-The default text of the button is the title of the previous page; you can change it by setting the `text` property as shown in the example [Setting the Text Title](#setting-the-title-text).
-In iOS, the back button is used explicitly for navigation. It navigates to the previous page and you cannot handle the `tap` event to override this behavior.
-
-If you want to place a button on the left side of the `ActionBar` and handle the tap event (e.g., show slide-out), you can use `ActionItem` with `ios.position="left"`.
-
-### Android Specifics
-
-In Android, you cannot set text inside the navigation button. You can use the `icon` property to set an image (e.g., `~\images\nav-image.png` or `res:\\ic_nav`). You can use `android.systemIcon` to set one of the system icons available in Android. In this case, there is no default behaviour for NavigationButton's `tap` event, and we should define manually the callback function, which will be executed.
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/action-bar/navigation-button/navigation-button-page.css b/app/ns-ui-widgets-category/action-bar/navigation-button/navigation-button-page.css
deleted file mode 100644
index 1d8430c..0000000
--- a/app/ns-ui-widgets-category/action-bar/navigation-button/navigation-button-page.css
+++ /dev/null
@@ -1,6 +0,0 @@
-Label {
- background-color: orangered;
- color: white;
- margin:8;
- padding: 16;
-}
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/action-bar/navigation-button/navigation-button-page.js b/app/ns-ui-widgets-category/action-bar/navigation-button/navigation-button-page.js
deleted file mode 100644
index abaf1a1..0000000
--- a/app/ns-ui-widgets-category/action-bar/navigation-button/navigation-button-page.js
+++ /dev/null
@@ -1,19 +0,0 @@
-// >> action-bar-nav-btn-js
-const fromObject = require("tns-core-modules/data/observable").fromObject;
-
-exports.onNavigatingTo = function(args) {
- const page = args.object;
- page.bindingContext = fromObject({
- title: "ActionBar's Navigation Button demo"
- });
-};
-
-exports.onNavBtnTap = function(args) {
- // This code will be called only in Android.
- console.log("Navigation button tapped!");
-
- const navigationButton = args.object;
- const frame = navigationButton.page.frame;
- frame.goBack();
-};
-// << action-bar-nav-btn-js
diff --git a/app/ns-ui-widgets-category/action-bar/navigation-button/navigation-button-page.xml b/app/ns-ui-widgets-category/action-bar/navigation-button/navigation-button-page.xml
deleted file mode 100644
index 218140f..0000000
--- a/app/ns-ui-widgets-category/action-bar/navigation-button/navigation-button-page.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/action-bar/navigation-button/navigation-button-ts-page.css b/app/ns-ui-widgets-category/action-bar/navigation-button/navigation-button-ts-page.css
deleted file mode 100644
index 1d8430c..0000000
--- a/app/ns-ui-widgets-category/action-bar/navigation-button/navigation-button-ts-page.css
+++ /dev/null
@@ -1,6 +0,0 @@
-Label {
- background-color: orangered;
- color: white;
- margin:8;
- padding: 16;
-}
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/action-bar/navigation-button/navigation-button-ts-page.ts b/app/ns-ui-widgets-category/action-bar/navigation-button/navigation-button-ts-page.ts
deleted file mode 100644
index 62d42aa..0000000
--- a/app/ns-ui-widgets-category/action-bar/navigation-button/navigation-button-ts-page.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-// >> action-bar-nav-btn-ts
-import { EventData, fromObject } from "tns-core-modules/data/observable";
-import { NavigationButton } from "tns-core-modules/ui/action-bar";
-import { Frame } from "tns-core-modules/ui/frame";
-import { Page } from "tns-core-modules/ui/page";
-import { GestureEventData } from "tns-core-modules/ui/gestures";
-
-export function onNavigatingTo(args: EventData) {
- const page = args.object;
- page.bindingContext = fromObject({
- title: "ActionBar's Navigation Button demo"
- });
-}
-
-export function onNavBtnTap(args: GestureEventData) {
- // This code will be called only in Android.
- console.log("Navigation button tapped!");
-
- const navigationButton = args.object;
- const frame = navigationButton.page.frame;
- frame.goBack();
-}
-// << action-bar-nav-btn-ts
diff --git a/app/ns-ui-widgets-category/action-bar/navigation-button/navigation-button-ts-page.xml b/app/ns-ui-widgets-category/action-bar/navigation-button/navigation-button-ts-page.xml
deleted file mode 100644
index a9677fc..0000000
--- a/app/ns-ui-widgets-category/action-bar/navigation-button/navigation-button-ts-page.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/action-bar/setting-app-icon-android/article.md b/app/ns-ui-widgets-category/action-bar/setting-app-icon-android/article.md
deleted file mode 100644
index 521b5a7..0000000
--- a/app/ns-ui-widgets-category/action-bar/setting-app-icon-android/article.md
+++ /dev/null
@@ -1,3 +0,0 @@
-You can set the application icon only for Android. By default, the application icon is hidden. You can show it by setting the android.iconVisibility property to always.
-
-
diff --git a/app/ns-ui-widgets-category/action-bar/setting-app-icon-android/setting-app-icon-android-page.css b/app/ns-ui-widgets-category/action-bar/setting-app-icon-android/setting-app-icon-android-page.css
deleted file mode 100644
index 1d8430c..0000000
--- a/app/ns-ui-widgets-category/action-bar/setting-app-icon-android/setting-app-icon-android-page.css
+++ /dev/null
@@ -1,6 +0,0 @@
-Label {
- background-color: orangered;
- color: white;
- margin:8;
- padding: 16;
-}
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/action-bar/setting-app-icon-android/setting-app-icon-android-page.js b/app/ns-ui-widgets-category/action-bar/setting-app-icon-android/setting-app-icon-android-page.js
deleted file mode 100644
index 358d39c..0000000
--- a/app/ns-ui-widgets-category/action-bar/setting-app-icon-android/setting-app-icon-android-page.js
+++ /dev/null
@@ -1,9 +0,0 @@
-const Observable = require("tns-core-modules/data/observable").Observable;
-
-function onNavigatingTo(args) {
- const page = args.object;
- const vm = new Observable();
- vm.set("title", "Setting app Icon Android \nAction Bar Example");
- page.bindingContext = vm;
-}
-exports.onNavigatingTo = onNavigatingTo;
diff --git a/app/ns-ui-widgets-category/action-bar/setting-app-icon-android/setting-app-icon-android-page.xml b/app/ns-ui-widgets-category/action-bar/setting-app-icon-android/setting-app-icon-android-page.xml
index 8f99450..044ed63 100644
--- a/app/ns-ui-widgets-category/action-bar/setting-app-icon-android/setting-app-icon-android-page.xml
+++ b/app/ns-ui-widgets-category/action-bar/setting-app-icon-android/setting-app-icon-android-page.xml
@@ -1,11 +1,7 @@
-
+
-
-
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/action-bar/styling/article.md b/app/ns-ui-widgets-category/action-bar/styling/article.md
index e3215e4..29fad72 100644
--- a/app/ns-ui-widgets-category/action-bar/styling/article.md
+++ b/app/ns-ui-widgets-category/action-bar/styling/article.md
@@ -1,9 +1,5 @@
-The ActionBar has some CSS styling limitations. You can use only `background-color` and `color` properties. Here is an example:
+To style the `ActionBar`, you can use only `background-color` and `color` properties. Alternatively, you can use `nativescript-theme-core` and use the default styles for each different theme. The `icon` property of `ActionItem` can use Icon Fonts with the `font://` prefix. By setting up this prefix, a new image will be generated, which will be set as an ActionItem's `icon` resource. While using this functionality, we need to specify the `font-size`, which will calculate the size of the generated image base on the device's dpi.
-
-
+
-In iOS, the `color` property affects the color of the title and the action items.
-In Android, the `color` property affects only the title text. However, you can set the default color of the text in the action items by adding an `actionMenuTextColor` item in the Android theme (inside `App_Resources\Android\values\styles.xml`).
-
->Note: Setting other CSS properties (e.g., `font-family`) will only affect the views defined inside `titleView`.
+> **Note:** In iOS, the `color` property affects the color of the title and the action items. In Android, the `color` property affects only the title text. However, you can set the default color of the text in the action items by adding an `actionMenuTextColor` item in the Android theme (inside `App_Resources\Android\values\styles.xml`).
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/action-bar/styling/styling-page.css b/app/ns-ui-widgets-category/action-bar/styling/styling-page.css
deleted file mode 100644
index 739806d..0000000
--- a/app/ns-ui-widgets-category/action-bar/styling/styling-page.css
+++ /dev/null
@@ -1,12 +0,0 @@
-Label {
- background-color: orangered;
- color: white;
- margin:8;
- padding: 16;
-}
-/* >> action-bar-style-css */
-ActionBar {
- background-color: #3C5AFD;
- color: white;
-}
-/* << action-bar-style-css */
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/action-bar/styling/styling-page.js b/app/ns-ui-widgets-category/action-bar/styling/styling-page.js
index ece97ba..d910e47 100644
--- a/app/ns-ui-widgets-category/action-bar/styling/styling-page.js
+++ b/app/ns-ui-widgets-category/action-bar/styling/styling-page.js
@@ -1,10 +1,5 @@
-const Observable = require("tns-core-modules/data/observable").Observable;
+import { Frame } from "@nativescript/core";
-function onNavigatingTo(args) {
- const page = args.object;
- const vm = new Observable();
- vm.set("title", "Styling \nAction Bar Example");
- vm.set("snippet", "");
- page.bindingContext = vm;
+export function goBack() {
+ Frame.topmost().goBack();
}
-exports.onNavigatingTo = onNavigatingTo;
diff --git a/app/ns-ui-widgets-category/action-bar/styling/styling-page.xml b/app/ns-ui-widgets-category/action-bar/styling/styling-page.xml
index 8f23862..877edf7 100644
--- a/app/ns-ui-widgets-category/action-bar/styling/styling-page.xml
+++ b/app/ns-ui-widgets-category/action-bar/styling/styling-page.xml
@@ -1,14 +1,25 @@
-
-
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/action-bar/usage/article.md b/app/ns-ui-widgets-category/action-bar/usage/article.md
new file mode 100644
index 0000000..369334e
--- /dev/null
+++ b/app/ns-ui-widgets-category/action-bar/usage/article.md
@@ -0,0 +1,48 @@
+The `ActionBar` provides a `title` property and can be extended by using one or more `ActionItem` components and a single `NavigationButton`. The `ActionBar` also supports entirely custom views (see the [Tips and Tricks](#tips-and-tricks) section below).
+
+
+
+
+
+### ActionItem
+
+The `ActionItem` components are supporting the platform-specific `position` and `systemIcon` for iOS and Android.
+
+
+
+- **Android** sets position via **`android.position`**:
+
+ * **`actionBar`**: Puts the item in the `ActionBar`. Action item can be rendered both as text or icon.
+ * **`popup`**: Puts the item in the options menu. Items will be rendered as text.
+ * **`actionBarIfRoom`**: Puts the item in the `ActionBar` if there is room for it. Otherwise, puts it in the options menu.
+
+- **iOS** sets position via **`ios.position`**:
+
+ * **`left`**: Puts the item on the left side of the `ActionBar`.
+ * **`right`**: Puts the item on the right side of the `ActionBar`.
+
+### NavigationButton
+
+The `NavigationButton` component is a common abstraction over the iOS back button and the Android navigation button.
+
+> **iOS Specifics:** The default text of the navigation button is the title of the **previous** page. In iOS, the back button is used explicitly for navigation. It navigates to the previous page and you can't handle the tap event to override this behavior. If you want to place a button on the left side of the ActionBar and handle the tap event (e.g., show slide-out), you can use ActionItem with `ios.position="left"`. Values for `ios.systemIcon` are numbers from the [`UIBarButtonItem.SystemItem`](https://developer.apple.com/documentation/uikit/uibarbuttonitem/systemitem) enumeration:
+
+| Value | Icon | | Value | Icon |
+| ----- | -------------- | --- | ----- | ------------- |
+|0 | Done | |12 | Search |
+|1 | Cancel | |13 | Refresh |
+|2 | Edit | |14 | Stop |
+|3 | Save | |15 | Camera |
+|4 | Add | |16 | Trash |
+|5 | FlexibleSpace | |17 | Play |
+|6 | FixedSpace | |18 | Pause |
+|7 | Compose | |19 | Rewind |
+|8 | Reply | |20 | FastForward |
+|9 | Action | |21 | Undo |
+|10 | Organize | |22 | Redo |
+|11 | Bookmarks | |23 | PageCurl |
+
+> **Android Specifics:** In Android, you can't set text inside the navigation button. You can use the icon property to set an image (e.g., `~\images\nav-image.png` or `res:\\ic_nav`). You can use `android.systemIcon` to set one of the system icons available in Android. In this case, there is no default behaviour for `NavigationButton` tap event, and we should define manually the callback function, which will be executed. You can use the `android.systemIcon` and `ios.systemIcon` properties to show system icons. If you define a system icon, it will be used instead of `icon` and `text` properties. Values for `android.systemIcon` correspond to the resources names of the built-in Android system icons. For a full list of Android drawable names, you may visit [Android Developer Site](https://developer.android.com/reference/android/R.drawable.html).
+
+
+
diff --git a/app/ns-ui-widgets-category/action-bar/usage/usage-page.js b/app/ns-ui-widgets-category/action-bar/usage/usage-page.js
new file mode 100644
index 0000000..422777e
--- /dev/null
+++ b/app/ns-ui-widgets-category/action-bar/usage/usage-page.js
@@ -0,0 +1,10 @@
+// >> action-bar-basic-usage-sdk-js
+import { Frame } from "@nativescript/core";
+
+export function goBack() {
+ Frame.topmost().goBack();
+}
+export function openSettings() {
+ // implement the custom logic
+}
+// << action-bar-basic-usage-sdk-js
diff --git a/app/ns-ui-widgets-category/action-bar/usage/usage-page.xml b/app/ns-ui-widgets-category/action-bar/usage/usage-page.xml
new file mode 100644
index 0000000..986a0eb
--- /dev/null
+++ b/app/ns-ui-widgets-category/action-bar/usage/usage-page.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/action-bar/usage/usage-ts-page.ts b/app/ns-ui-widgets-category/action-bar/usage/usage-ts-page.ts
new file mode 100644
index 0000000..6d8a602
--- /dev/null
+++ b/app/ns-ui-widgets-category/action-bar/usage/usage-ts-page.ts
@@ -0,0 +1,10 @@
+// >> action-bar-basic-usage-sdk-ts
+import { Frame } from "@nativescript/core";
+
+export function goBack() {
+ Frame.topmost().goBack();
+}
+export function openSettings() {
+ // implement the custom logic
+}
+// << action-bar-basic-usage-sdk-ts
diff --git a/app/ns-ui-widgets-category/action-bar/usage/usage-ts-page.xml b/app/ns-ui-widgets-category/action-bar/usage/usage-ts-page.xml
new file mode 100644
index 0000000..5dfa8e3
--- /dev/null
+++ b/app/ns-ui-widgets-category/action-bar/usage/usage-ts-page.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/activity-indicator/activity-indicator-page.js b/app/ns-ui-widgets-category/activity-indicator/activity-indicator-page.js
index 5e98801..3b51a20 100644
--- a/app/ns-ui-widgets-category/activity-indicator/activity-indicator-page.js
+++ b/app/ns-ui-widgets-category/activity-indicator/activity-indicator-page.js
@@ -1,32 +1,34 @@
-const ListViewLinksModel = require("../../links-view-model");
-const link = require("../../link");
+import ListViewLinksModel from "../../links-view-model";
+import Link from "../../link";
const navigationLinks = [
- new link(
- "Basics",
- "ns-ui-widgets-category/activity-indicator/basics/basics-page"
+ new Link(
+ "Usage",
+ "ns-ui-widgets-category/activity-indicator/usage/usage-page"
),
- new link(
- "Styling",
- "ns-ui-widgets-category/activity-indicator/styling/styling-page"
- ),
- new link(
+ new Link(
"Code-Behind",
"ns-ui-widgets-category/activity-indicator/code-behind/code-behind-page"
+ ),
+ new Link("Tips & Tricks", "ns-ui-widgets-category/activity-indicator/tips-and-tricks/tips-and-tricks-page"),
+ new Link(
+ "Styling",
+ "ns-ui-widgets-category/activity-indicator/styling/styling-page"
)
];
const navigationLinksTsc = [
- new link(
- "Basics",
- "ns-ui-widgets-category/activity-indicator/basics/basics-ts-page"
+ new Link(
+ "Usage",
+ "ns-ui-widgets-category/activity-indicator/usage/usage-ts-page"
),
- new link(
+ new Link(
"Code-Behind",
"ns-ui-widgets-category/activity-indicator/code-behind/code-behind-ts-page"
- )
+ ),
+ new Link("Tips & Tricks", "ns-ui-widgets-category/activity-indicator/tips-and-tricks/tips-and-tricks-ts-page")
];
-function onNavigatingTo(args) {
+export function onNavigatingTo(args) {
const page = args.object;
page.bindingContext = new ListViewLinksModel({
links: navigationLinks,
@@ -35,4 +37,4 @@ function onNavigatingTo(args) {
tsclinks: navigationLinksTsc
});
}
-exports.onNavigatingTo = onNavigatingTo;
+
diff --git a/app/ns-ui-widgets-category/activity-indicator/basics/article.md b/app/ns-ui-widgets-category/activity-indicator/basics/article.md
deleted file mode 100644
index 98c278e..0000000
--- a/app/ns-ui-widgets-category/activity-indicator/basics/article.md
+++ /dev/null
@@ -1,10 +0,0 @@
-Using the activity indicator requires the `ActivityIndicator` module.
-
-
-
-You can work with its `busy` property and set it to `true` or `false`, thus displaying or hiding the control.
-
-Setting an activity indicator’s `busy` boolean property via binding:
-
-
-
diff --git a/app/ns-ui-widgets-category/activity-indicator/basics/basics-page.js b/app/ns-ui-widgets-category/activity-indicator/basics/basics-page.js
deleted file mode 100644
index 812f1e6..0000000
--- a/app/ns-ui-widgets-category/activity-indicator/basics/basics-page.js
+++ /dev/null
@@ -1,14 +0,0 @@
-const Observable = require("tns-core-modules/data/observable").Observable;
-
-function onNavigatingTo(args) {
- const page = args.object;
- // >> activity-indicator-setting-busy-code
- const vm = new Observable();
- vm.set("isLoading", true);
- // >> (hide)
- vm.set("snippet", "");
- // << (hide)
- page.bindingContext = vm;
- // << activity-indicator-setting-busy-code
-}
-exports.onNavigatingTo = onNavigatingTo;
diff --git a/app/ns-ui-widgets-category/activity-indicator/basics/basics-ts-page.ts b/app/ns-ui-widgets-category/activity-indicator/basics/basics-ts-page.ts
deleted file mode 100644
index 8750822..0000000
--- a/app/ns-ui-widgets-category/activity-indicator/basics/basics-ts-page.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-// >> activity-indicator-setting-busy-code-ts
-import { EventData, Observable } from "tns-core-modules/data/observable";
-import { View } from "tns-core-modules/ui/core/view";
-
-export function onNavigatingTo(args: EventData) {
- const view = args.object as View;
- const vm = new Observable();
-
- vm.set("isLoading", true);
- // >> (hide)
- vm.set("snippet", "");
- // << (hide)
- view.bindingContext = vm;
-}
-// << activity-indicator-setting-busy-code-ts
diff --git a/app/ns-ui-widgets-category/activity-indicator/code-behind/article.md b/app/ns-ui-widgets-category/activity-indicator/code-behind/article.md
deleted file mode 100644
index 7e8f031..0000000
--- a/app/ns-ui-widgets-category/activity-indicator/code-behind/article.md
+++ /dev/null
@@ -1,3 +0,0 @@
-Dynamic code-behind creation of `ActivityIndicator` and showing the indicator while image is loading.
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/activity-indicator/code-behind/code-behind-page.js b/app/ns-ui-widgets-category/activity-indicator/code-behind/code-behind-page.js
index ff17004..accb1e1 100644
--- a/app/ns-ui-widgets-category/activity-indicator/code-behind/code-behind-page.js
+++ b/app/ns-ui-widgets-category/activity-indicator/code-behind/code-behind-page.js
@@ -1,8 +1,8 @@
// >> activity-indicator-require
-const ActivityIndicator = require("tns-core-modules/ui/activity-indicator").ActivityIndicator;
+import { ActivityIndicator } from "@nativescript/core";
// << activity-indicator-require
-function onNavigatingTo(args) {
+export function onNavigatingTo(args) {
const page = args.object;
const myStack = page.getViewById("myStack");
@@ -20,4 +20,4 @@ function onNavigatingTo(args) {
myStack.addChild(indicator);
// << activity-indicator-code-behind
}
-exports.onNavigatingTo = onNavigatingTo;
+
diff --git a/app/ns-ui-widgets-category/activity-indicator/code-behind/code-behind-ts-page.ts b/app/ns-ui-widgets-category/activity-indicator/code-behind/code-behind-ts-page.ts
index 33a11d3..f2248cf 100644
--- a/app/ns-ui-widgets-category/activity-indicator/code-behind/code-behind-ts-page.ts
+++ b/app/ns-ui-widgets-category/activity-indicator/code-behind/code-behind-ts-page.ts
@@ -1,9 +1,7 @@
// >> activity-indicator-require-ts
-import { ActivityIndicator } from "tns-core-modules/ui/activity-indicator";
+import { ActivityIndicator } from "@nativescript/core";
// << activity-indicator-require-ts
-import { EventData } from "tns-core-modules/data/observable";
-import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout";
-import { Page } from "tns-core-modules/ui/page";
+import { EventData, Page, StackLayout } from "@nativescript/core";
export function onNavigatingTo(args: EventData) {
const page = args.object;
diff --git a/app/ns-ui-widgets-category/activity-indicator/end.md b/app/ns-ui-widgets-category/activity-indicator/end.md
index bad9b42..4b90b6c 100644
--- a/app/ns-ui-widgets-category/activity-indicator/end.md
+++ b/app/ns-ui-widgets-category/activity-indicator/end.md
@@ -1,7 +1,27 @@
+## Properties
-**API Reference for** [ActivityIndicator Class](http://docs.nativescript.org/api-reference/modules/_ui_activity_indicator_.html)
+| Name | Type | Description |
+|:---------|:---------|:---------------|
+| `busy` | `boolean` | Gets or sets a value indicating whether the widget is currently displaying progress. |
-**Native Component**
+## Events
+
+| Name | Description |
+|:------------|:---------------|
+| `busyChange`| Emitted when the ActivityIndicator busy property is changed.|
+| `loaded` | Emitted when the view is loaded. |
+| `unloaded` | Emitted when the view is unloaded. |
+| `layoutChanged` | Emitted when the layout bounds of a view changes due to layout processing. |
+
+## API References
+
+| Name | Type |
+|:-------------------|:---------|
+| [ActivityIndicator](http://docs.nativescript.org/api-reference/modules/_ui_activity_indicator_) | `Module` |
+| [ActivityIndicator](https://docs.nativescript.org/api-reference/classes/_ui_activity_indicator_.activityindicator) | `Class` |
+
+
+## Native Component
| Android | iOS |
|:-----------------------|:---------|
diff --git a/app/ns-ui-widgets-category/activity-indicator/metadata.md b/app/ns-ui-widgets-category/activity-indicator/metadata.md
index 3dbdc29..9744e51 100644
--- a/app/ns-ui-widgets-category/activity-indicator/metadata.md
+++ b/app/ns-ui-widgets-category/activity-indicator/metadata.md
@@ -4,3 +4,4 @@ description: ActivityIndicator is an abstraction over Android's ProgressBar and
position: 170
slug: activity-indicator
---
+example-order: usage, styling, tips-and-tricks
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/activity-indicator/styling/article.md b/app/ns-ui-widgets-category/activity-indicator/styling/article.md
index 0ba943d..6f46b7e 100644
--- a/app/ns-ui-widgets-category/activity-indicator/styling/article.md
+++ b/app/ns-ui-widgets-category/activity-indicator/styling/article.md
@@ -1,7 +1,7 @@
-The `ActivityIndicator` default color can be set using the `color` property.
+The `ActivityIndicator` supports styling the `color` (default value is `blue`) and `backgroundColor` (default value is `transparent`) properties.
+
-While on Android we can use `width` and `height` to set our Indicator's size on iOS we need access to the native API.
-Changing the default indicator size on iOS.
-
-
+| **nativescript-theme-core** CSS class | Description |
+|:---------------------------------------|:----------------|
+| `activity-indicator` | Styles the `color` of the indicator in sync with the main theme color. |
diff --git a/app/ns-ui-widgets-category/activity-indicator/styling/styling-page.js b/app/ns-ui-widgets-category/activity-indicator/styling/styling-page.js
deleted file mode 100644
index c833909..0000000
--- a/app/ns-ui-widgets-category/activity-indicator/styling/styling-page.js
+++ /dev/null
@@ -1,18 +0,0 @@
-const Observable = require("tns-core-modules/data/observable").Observable;
-const isIOS = require("tns-core-modules/platform").isIOS;
-
-function onNavigatingTo(args) {
- const page = args.object;
- const vm = new Observable();
- vm.set("isLoading", true);
-
- // >> large-ios-indicator
- if (isIOS) {
- const indicator = page.getViewById("myIndicator");
- // accessing the native iOS API https://developer.apple.com/documentation/uikit/uiactivityindicatorviewstyle
- indicator.ios.activityIndicatorViewStyle = UIActivityIndicatorViewStyle.White;
- }
- // << large-ios-indicator
- page.bindingContext = vm;
-}
-exports.onNavigatingTo = onNavigatingTo;
diff --git a/app/ns-ui-widgets-category/activity-indicator/styling/styling-page.xml b/app/ns-ui-widgets-category/activity-indicator/styling/styling-page.xml
index 63b142e..86d3c2d 100644
--- a/app/ns-ui-widgets-category/activity-indicator/styling/styling-page.xml
+++ b/app/ns-ui-widgets-category/activity-indicator/styling/styling-page.xml
@@ -1,16 +1,10 @@
-
+
-
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/activity-indicator/styling/styling-ts-page.ts b/app/ns-ui-widgets-category/activity-indicator/styling/styling-ts-page.ts
deleted file mode 100644
index a58ce02..0000000
--- a/app/ns-ui-widgets-category/activity-indicator/styling/styling-ts-page.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-const Observable = require("tns-core-modules/data/observable").Observable;
-const isIOS = require("tns-core-modules/platform").isIOS;
-
-function onNavigatingTo(args) {
- const page = args.object;
- const vm = new Observable();
- vm.set("isLoading", true);
-
- // >> large-ios-indicator-ts
- if (isIOS) {
- const indicator = page.getViewById("myIndicator");
- // accessing the native iOS API https://developer.apple.com/documentation/uikit/uiactivityindicatorviewstyle
- indicator.ios.activityIndicatorViewStyle = UIActivityIndicatorViewStyle.White;
- }
- // << large-ios-indicator-ts
- page.bindingContext = vm;
-}
-exports.onNavigatingTo = onNavigatingTo;
diff --git a/app/ns-ui-widgets-category/activity-indicator/styling/styling-ts-page.xml b/app/ns-ui-widgets-category/activity-indicator/styling/styling-ts-page.xml
deleted file mode 100644
index b8ac5d6..0000000
--- a/app/ns-ui-widgets-category/activity-indicator/styling/styling-ts-page.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/activity-indicator/tips-and-tricks/article.md b/app/ns-ui-widgets-category/activity-indicator/tips-and-tricks/article.md
new file mode 100644
index 0000000..193f125
--- /dev/null
+++ b/app/ns-ui-widgets-category/activity-indicator/tips-and-tricks/article.md
@@ -0,0 +1,12 @@
+
+### Change UIActivityIndicatorViewStyle for iOS
+
+
+
+
+
+### Creating ActivityIndicator via Code-Behind
+
+Dynamic code-behind creation of `ActivityIndicator` and showing the indicator while image is loading.
+
+
diff --git a/app/ns-ui-widgets-category/activity-indicator/tips-and-tricks/tips-and-tricks-page.js b/app/ns-ui-widgets-category/activity-indicator/tips-and-tricks/tips-and-tricks-page.js
new file mode 100644
index 0000000..165081e
--- /dev/null
+++ b/app/ns-ui-widgets-category/activity-indicator/tips-and-tricks/tips-and-tricks-page.js
@@ -0,0 +1,13 @@
+// >> large-ios-indicator
+import { isIOS } from "@nativescript/core";
+
+export function onLoaded(args) {
+ const view = args.object;
+
+ if (isIOS) {
+ // accessing the native iOS API https://developer.apple.com/documentation/uikit/uiactivityindicatorviewstyle
+ view.ios.activityIndicatorViewStyle = UIActivityIndicatorViewStyle.White;
+ }
+
+}
+// << large-ios-indicator
diff --git a/app/ns-ui-widgets-category/activity-indicator/tips-and-tricks/tips-and-tricks-page.xml b/app/ns-ui-widgets-category/activity-indicator/tips-and-tricks/tips-and-tricks-page.xml
new file mode 100644
index 0000000..b49b552
--- /dev/null
+++ b/app/ns-ui-widgets-category/activity-indicator/tips-and-tricks/tips-and-tricks-page.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/activity-indicator/tips-and-tricks/tips-and-tricks-ts-page.ts b/app/ns-ui-widgets-category/activity-indicator/tips-and-tricks/tips-and-tricks-ts-page.ts
new file mode 100644
index 0000000..b630638
--- /dev/null
+++ b/app/ns-ui-widgets-category/activity-indicator/tips-and-tricks/tips-and-tricks-ts-page.ts
@@ -0,0 +1,14 @@
+// >> large-ios-indicator-ts
+import { ActivityIndicator, isIOS } from "@nativescript/core";
+
+export function onLoaded(args) {
+ const view = args.object as ActivityIndicator;
+
+ if (isIOS) {
+ // accessing the native iOS API https://developer.apple.com/documentation/uikit/uiactivityindicatorviewstyle
+ view.ios.activityIndicatorViewStyle = UIActivityIndicatorViewStyle.White;
+ }
+
+}
+
+// << large-ios-indicator-ts
diff --git a/app/ns-ui-widgets-category/activity-indicator/tips-and-tricks/tips-and-tricks-ts-page.xml b/app/ns-ui-widgets-category/activity-indicator/tips-and-tricks/tips-and-tricks-ts-page.xml
new file mode 100644
index 0000000..6d497e6
--- /dev/null
+++ b/app/ns-ui-widgets-category/activity-indicator/tips-and-tricks/tips-and-tricks-ts-page.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/activity-indicator/usage/article.md b/app/ns-ui-widgets-category/activity-indicator/usage/article.md
new file mode 100644
index 0000000..3e940b4
--- /dev/null
+++ b/app/ns-ui-widgets-category/activity-indicator/usage/article.md
@@ -0,0 +1,5 @@
+You can work with its boolean `busy` property and set it to `true` or `false`, thus displaying or hiding the control.
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/activity-indicator/usage/usage-page.js b/app/ns-ui-widgets-category/activity-indicator/usage/usage-page.js
new file mode 100644
index 0000000..15240d5
--- /dev/null
+++ b/app/ns-ui-widgets-category/activity-indicator/usage/usage-page.js
@@ -0,0 +1,19 @@
+// >> activity-indicator-setting-busy-code
+import { Observable } from "@nativescript/core";
+
+export function onNavigatingTo(args) {
+ const page = args.object;
+
+ const vm = new Observable();
+ vm.set("isBusy", true);
+ page.bindingContext = vm;
+}
+
+export function indicatorLoaded(args) {
+ const activityIndicator = args.object;
+ activityIndicator.on("busyChange", (aiargs) => {
+ const indicator = aiargs.object;
+ console.log(`indicator.busy changed to: ${indicator.busy}`);
+ });
+}
+// << activity-indicator-setting-busy-code
diff --git a/app/ns-ui-widgets-category/activity-indicator/basics/basics-page.xml b/app/ns-ui-widgets-category/activity-indicator/usage/usage-page.xml
similarity index 82%
rename from app/ns-ui-widgets-category/activity-indicator/basics/basics-page.xml
rename to app/ns-ui-widgets-category/activity-indicator/usage/usage-page.xml
index cf4aabf..41aca93 100644
--- a/app/ns-ui-widgets-category/activity-indicator/basics/basics-page.xml
+++ b/app/ns-ui-widgets-category/activity-indicator/usage/usage-page.xml
@@ -4,7 +4,7 @@
-
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/activity-indicator/usage/usage-ts-page.ts b/app/ns-ui-widgets-category/activity-indicator/usage/usage-ts-page.ts
new file mode 100644
index 0000000..e12c5b7
--- /dev/null
+++ b/app/ns-ui-widgets-category/activity-indicator/usage/usage-ts-page.ts
@@ -0,0 +1,18 @@
+// >> activity-indicator-setting-busy-code-ts
+import { ActivityIndicator, EventData, Observable, Page } from "@nativescript/core";
+
+export function onNavigatingTo(args: EventData) {
+ const view = args.object as Page;
+ const vm = new Observable();
+ vm.set("isBusy", true);
+ view.bindingContext = vm;
+}
+
+export function indicatorLoaded(args: EventData) {
+ let activityIndicator = args.object as ActivityIndicator;
+ activityIndicator.on("busyChange", (aiargs: EventData) => {
+ let indicator = aiargs.object as ActivityIndicator;
+ console.log("indicator.busy changed to: " + indicator.busy);
+ });
+}
+// << activity-indicator-setting-busy-code-ts
diff --git a/app/ns-ui-widgets-category/activity-indicator/basics/basics-ts-page.xml b/app/ns-ui-widgets-category/activity-indicator/usage/usage-ts-page.xml
similarity index 76%
rename from app/ns-ui-widgets-category/activity-indicator/basics/basics-ts-page.xml
rename to app/ns-ui-widgets-category/activity-indicator/usage/usage-ts-page.xml
index e64d5b4..67f3499 100644
--- a/app/ns-ui-widgets-category/activity-indicator/basics/basics-ts-page.xml
+++ b/app/ns-ui-widgets-category/activity-indicator/usage/usage-ts-page.xml
@@ -3,6 +3,6 @@
-
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/animations/animating-properties/animating-properties-page.js b/app/ns-ui-widgets-category/animations/animating-properties/animating-properties-page.js
index 0afd3f3..474e2dc 100644
--- a/app/ns-ui-widgets-category/animations/animating-properties/animating-properties-page.js
+++ b/app/ns-ui-widgets-category/animations/animating-properties/animating-properties-page.js
@@ -1,19 +1,17 @@
// >> animation-curve-imports
// AnimationCurveEnum: ease, easeIn, easeInOut, easeOut, linear, spring
-const AnimationCurve = require("tns-core-modules/ui/enums").AnimationCurve;
+import { AnimationCurve } from "@nativescript/core/ui/enums";
+import { Animation, Color } from "@nativescript/core";
// << animation-curve-imports
-const Animation = require("tns-core-modules/ui/animation").Animation;
-const Color = require("tns-core-modules/color").Color;
let animation;
let myView;
-function onLoaded(args) {
+export function onLoaded(args) {
const page = args.object;
myView = page.getViewById("lbl");
}
-exports.onLoaded = onLoaded;
-function animate(args) {
+export function animate(args) {
// >> animation-properties
myView.animate({
backgroundColor: new Color("#414b7d"),
@@ -38,9 +36,8 @@ function animate(args) {
});
// << animation-properties
}
-exports.animate = animate;
-function animateTarget(args) {
+export function animateTarget(args) {
// >> animation-target
const myView = args.object;
@@ -68,7 +65,6 @@ function animateTarget(args) {
});
// << animation-target
}
-exports.animateTarget = animateTarget;
function cancelAnimation() {
// >> animation-cancel
diff --git a/app/ns-ui-widgets-category/animations/animating-properties/animating-properties-ts-page.ts b/app/ns-ui-widgets-category/animations/animating-properties/animating-properties-ts-page.ts
index fc0946e..20f837a 100644
--- a/app/ns-ui-widgets-category/animations/animating-properties/animating-properties-ts-page.ts
+++ b/app/ns-ui-widgets-category/animations/animating-properties/animating-properties-ts-page.ts
@@ -1,10 +1,8 @@
// >> animation-curve-imports-ts
// AnimationCurve enumeration: ease, easeIn, easeInOut, easeOut, linear, spring
-import { AnimationCurve } from "tns-core-modules/ui/enums";
-import { Animation, AnimationDefinition } from "tns-core-modules/ui/animation";
-import { Color } from "tns-core-modules/color";
+import { Animation, AnimationDefinition, Color, Enums } from "@nativescript/core";
// << animation-curve-imports-ts
-import { View } from "tns-core-modules/ui/core/view";
+import { View } from "@nativescript/core";
let animation: Animation;
export function animate(args) {
@@ -15,7 +13,7 @@ export function animate(args) {
// >> animation-properties-ts
view.animate({
backgroundColor: new Color("#414b7d"),
- curve: AnimationCurve.easeOut,
+ curve: Enums.AnimationCurve.easeOut,
delay: 300,
duration: 3000,
iterations: 3,
@@ -43,7 +41,7 @@ export function animateTarget(args) {
const animationDefinition: AnimationDefinition = {
target: view, // provide the view to animate
- curve: AnimationCurve.easeOut,
+ curve: Enums.AnimationCurve.easeOut,
duration: 1000,
scale: {
x: 0.2,
@@ -89,7 +87,7 @@ export function demonstrateSimpleAnimations(args) {
y: 100
},
duration: 1000,
- curve: AnimationCurve.easeIn
+ curve: Enums.AnimationCurve.easeIn
});
// << using-animation-curve-enum-ts
@@ -100,7 +98,7 @@ export function demonstrateSimpleAnimations(args) {
y: 100
},
duration: 1000,
- curve: AnimationCurve.cubicBezier(0.1, 0.1, 0.1, 1)
+ curve: Enums.AnimationCurve.cubicBezier(0.1, 0.1, 0.1, 1)
});
// << creating-cubic-bezier-ts
}
diff --git a/app/ns-ui-widgets-category/animations/animating-properties/article.md b/app/ns-ui-widgets-category/animations/animating-properties/article.md
index 5c41e31..bd80f7b 100644
--- a/app/ns-ui-widgets-category/animations/animating-properties/article.md
+++ b/app/ns-ui-widgets-category/animations/animating-properties/article.md
@@ -8,6 +8,7 @@ NativeScript lets you animate the following properties:
`translateX` and `translateY`
`scaleX` and `scaleY`
`rotate`
+`width` and `height`
In every animation, you can control the following properties:
@@ -29,6 +30,8 @@ Property values:
| `rotate` | Number value for degrees (0 - 360 degrees). |
| `scale` | Object value `{ x:1, y:2 }` (1 = Original scale). |
| `translate` | Object value `{ x:100, y:200 }` (Translate by given DIPs). |
+| `width` | Number value. |
+| `height` | Number value. |
The first example will change the background color of a `view` from "red" to "green".
diff --git a/app/ns-ui-widgets-category/animations/animations-page.js b/app/ns-ui-widgets-category/animations/animations-page.js
index e796963..2dcc63a 100644
--- a/app/ns-ui-widgets-category/animations/animations-page.js
+++ b/app/ns-ui-widgets-category/animations/animations-page.js
@@ -1,28 +1,30 @@
-const ListViewLinksModel = require("../../links-view-model");
-const link = require("../../link");
+import ListViewLinksModel from "../../links-view-model";
+import Link from "../../link";
const navigationLinks = [
- new link("Animated Properties", "ns-ui-widgets-category/animations/animating-properties/animating-properties-page"),
- new link("Chained Animations", "ns-ui-widgets-category/animations/chaining-animations/chaining-animations-page"),
- new link("Animating Multiple Views", "ns-ui-widgets-category/animations/multiple-views-animation/multiple-views-page"),
- new link("Properties originX and originY", "ns-ui-widgets-category/animations/origin-properties/property-origin-page")
+ new Link("Animated Properties", "ns-ui-widgets-category/animations/animating-properties/animating-properties-page"),
+ new Link("Chained Animations", "ns-ui-widgets-category/animations/chaining-animations/chaining-animations-page"),
+ new Link("Animating Multiple Views", "ns-ui-widgets-category/animations/multiple-views-animation/multiple-views-page"),
+ new Link("Properties originX and originY", "ns-ui-widgets-category/animations/origin-properties/property-origin-page"),
+ new Link("Properties width and height", "ns-ui-widgets-category/animations/width-height-properties/width-height-properties-page")
];
const navigationLinksTsc = [
- new link("Animated Properties", "ns-ui-widgets-category/animations/animating-properties/animating-properties-ts-page"),
- new link("Chained Animations", "ns-ui-widgets-category/animations/chaining-animations/chaining-animations-ts-page"),
- new link("Animating Multiple Views", "ns-ui-widgets-category/animations/multiple-views-animation/multiple-views-ts-page"),
- new link("Properties originX and originY", "ns-ui-widgets-category/animations/origin-properties/property-origin-ts-page")
+ new Link("Animated Properties", "ns-ui-widgets-category/animations/animating-properties/animating-properties-ts-page"),
+ new Link("Chained Animations", "ns-ui-widgets-category/animations/chaining-animations/chaining-animations-ts-page"),
+ new Link("Animating Multiple Views", "ns-ui-widgets-category/animations/multiple-views-animation/multiple-views-ts-page"),
+ new Link("Properties originX and originY", "ns-ui-widgets-category/animations/origin-properties/property-origin-ts-page"),
+ new Link("Properties width and height", "ns-ui-widgets-category/animations/width-height-properties/width-height-properties-ts-page")
];
// >> animations-imports
// Full list of animating properties at https://docs.nativescript.org/api-reference/interfaces/_ui_animation_.animationdefinition
-const AnimationDefinition = require("tns-core-modules/ui/animation").AnimationDefinition;
+import { AnimationDefinition } from "@nativescript/core";
// Defines a pair of values (horizontal and vertical) for translate and scale animations.
-const Pair = require("tns-core-modules/ui/animation").Pair;
+import Pair from "@nativescript/core/ui/animation";
// << animations-imports
-function onNavigatingTo(args) {
+export function onNavigatingTo(args) {
const page = args.object;
page.bindingContext = new ListViewLinksModel({
links: navigationLinks,
@@ -31,4 +33,4 @@ function onNavigatingTo(args) {
tsclinks: navigationLinksTsc
});
}
-exports.onNavigatingTo = onNavigatingTo;
+
diff --git a/app/ns-ui-widgets-category/animations/chaining-animations/chaining-animations-page.js b/app/ns-ui-widgets-category/animations/chaining-animations/chaining-animations-page.js
index f2295d5..c2a2aba 100644
--- a/app/ns-ui-widgets-category/animations/chaining-animations/chaining-animations-page.js
+++ b/app/ns-ui-widgets-category/animations/chaining-animations/chaining-animations-page.js
@@ -1,6 +1,6 @@
let myView;
-function onLoaded(args) {
+export function onLoaded(args) {
const page = args.object;
myView = page.getViewById("lbl");
// >> chaining-animations
@@ -50,4 +50,3 @@ function onLoaded(args) {
});
// << chaining-animations
}
-exports.onLoaded = onLoaded;
diff --git a/app/ns-ui-widgets-category/animations/chaining-animations/chaining-animations-ts-page.ts b/app/ns-ui-widgets-category/animations/chaining-animations/chaining-animations-ts-page.ts
index 1bb44fa..c053899 100644
--- a/app/ns-ui-widgets-category/animations/chaining-animations/chaining-animations-ts-page.ts
+++ b/app/ns-ui-widgets-category/animations/chaining-animations/chaining-animations-ts-page.ts
@@ -1,6 +1,4 @@
-import { EventData } from "tns-core-modules/data/observable";
-import { Page } from "tns-core-modules/ui/page";
-import { Label } from "tns-core-modules/ui/label";
+import { EventData, Label, Page } from "@nativescript/core";
export function onLoaded(args: EventData) {
const page = args.object;
diff --git a/app/ns-ui-widgets-category/animations/multiple-views-animation/multiple-views-page.js b/app/ns-ui-widgets-category/animations/multiple-views-animation/multiple-views-page.js
index e268ebb..7c91647 100644
--- a/app/ns-ui-widgets-category/animations/multiple-views-animation/multiple-views-page.js
+++ b/app/ns-ui-widgets-category/animations/multiple-views-animation/multiple-views-page.js
@@ -1,13 +1,13 @@
// >> animation-import
// Main Animation class
-const Animation = require("tns-core-modules/ui/animation").Animation;
+import { Animation } from "@nativescript/core";
// << animation-import
let view1;
let view2;
let view3;
let view4;
-function onLoaded(args) {
+export function onLoaded(args) {
const page = args.object;
view1 = page.getViewById("view1");
@@ -15,9 +15,8 @@ function onLoaded(args) {
view3 = page.getViewById("view3");
view4 = page.getViewById("view4");
}
-exports.onLoaded = onLoaded;
-function animate() {
+export function animate() {
// >> animate-multiple-views
const definitions = [];
@@ -72,9 +71,8 @@ function animate() {
// << animate-multiple-views
}
-exports.animate = animate;
-function reset() {
+export function reset() {
view1.translateX = 0;
view1.translateY = 0;
view2.translateX = 0;
@@ -84,4 +82,3 @@ function reset() {
view4.translateX = 0;
view4.translateY = 0;
}
-exports.reset = reset;
diff --git a/app/ns-ui-widgets-category/animations/multiple-views-animation/multiple-views-ts-page.ts b/app/ns-ui-widgets-category/animations/multiple-views-animation/multiple-views-ts-page.ts
index 7509af8..e020a8e 100644
--- a/app/ns-ui-widgets-category/animations/multiple-views-animation/multiple-views-ts-page.ts
+++ b/app/ns-ui-widgets-category/animations/multiple-views-animation/multiple-views-ts-page.ts
@@ -1,11 +1,7 @@
// >> animation-import-ts
// Main Animation class
// ALL animating properties at https://docs.nativescript.org/api-reference/interfaces/_ui_animation_.animationdefinition
-import {
- Animation,
- AnimationDefinition,
- Pair // Pair: Defines a pair of values (horizontal and vertical) for translate and scale animations.
-} from "tns-core-modules/ui/animation";
+import { Animation, AnimationDefinition } from "@nativescript/core";
// << animation-import-ts
let view1, view2, view3, view4;
diff --git a/app/ns-ui-widgets-category/animations/origin-properties/property-origin-page.js b/app/ns-ui-widgets-category/animations/origin-properties/property-origin-page.js
index f919b01..a2e9281 100644
--- a/app/ns-ui-widgets-category/animations/origin-properties/property-origin-page.js
+++ b/app/ns-ui-widgets-category/animations/origin-properties/property-origin-page.js
@@ -1,7 +1,11 @@
-const AnimationCurveEnum = require("tns-core-modules/ui/enums").AnimationCurve;
-let myView;
+import { AnimationCurve } from "@nativescript/core/ui/enums";
+let myFirstView;
+let mySecondView;
+let myThirdView;
+let myForthView;
+let myFifthView;
-function onLoaded(args) {
+export function onLoaded(args) {
const page = args.object;
myFirstView = page.getViewById("myFirstView");
mySecondView = page.getViewById("mySecondView");
@@ -9,9 +13,8 @@ function onLoaded(args) {
myForthView = page.getViewById("myForthView");
myFifthView = page.getViewById("myFifthView");
}
-exports.onLoaded = onLoaded;
// >> rotating-example
-function animate() {
+export function animate() {
// myFirstView.originX = 0.5; // Default value (center of the view's horizontal axis)
// myFirstView.originY = 0.5; // Default value (middle of the view's vertical axis)
myFirstView.animate({
@@ -63,5 +66,4 @@ function animate() {
console.log(e.message);
});
}
-exports.animate = animate;
// << rotating-example
diff --git a/app/ns-ui-widgets-category/animations/origin-properties/property-origin-ts-page.ts b/app/ns-ui-widgets-category/animations/origin-properties/property-origin-ts-page.ts
index e177944..6852afd 100644
--- a/app/ns-ui-widgets-category/animations/origin-properties/property-origin-ts-page.ts
+++ b/app/ns-ui-widgets-category/animations/origin-properties/property-origin-ts-page.ts
@@ -1,6 +1,9 @@
-import { EventData } from "tns-core-modules/data/observable";
-import { Page } from "tns-core-modules/ui/page";
-let myFirstView, mySecondView, myThirdView, myForthView, myFifthView;
+import { EventData, Page } from "@nativescript/core";
+let myFirstView;
+let mySecondView;
+let myThirdView;
+let myForthView;
+let myFifthView;
export function onLoaded(args: EventData) {
const page = args.object;
diff --git a/app/ns-ui-widgets-category/animations/width-height-properties/article.md b/app/ns-ui-widgets-category/animations/width-height-properties/article.md
new file mode 100644
index 0000000..bd77d7e
--- /dev/null
+++ b/app/ns-ui-widgets-category/animations/width-height-properties/article.md
@@ -0,0 +1,5 @@
+Since {N} 6.0, we can animate the `width` and `height` properties of views. On the snippets below are demonstrated, how to configure those animations:
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/animations/width-height-properties/width-height-properties-page.css b/app/ns-ui-widgets-category/animations/width-height-properties/width-height-properties-page.css
new file mode 100644
index 0000000..8b6a90b
--- /dev/null
+++ b/app/ns-ui-widgets-category/animations/width-height-properties/width-height-properties-page.css
@@ -0,0 +1,9 @@
+Label {
+ color: white;
+ background-color:blue;
+ border-radius: 20;
+ margin: 16;
+ padding: 8;
+ horizontal-align: center;
+ vertical-align: top;
+}
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/animations/width-height-properties/width-height-properties-page.js b/app/ns-ui-widgets-category/animations/width-height-properties/width-height-properties-page.js
new file mode 100644
index 0000000..6c02887
--- /dev/null
+++ b/app/ns-ui-widgets-category/animations/width-height-properties/width-height-properties-page.js
@@ -0,0 +1,27 @@
+// >> animation-properties-width-height
+import { AnimationCurve } from "@nativescript/core/ui/enums";
+
+export function animateWidth(args) {
+ const button = args.object;
+ const page = button.page;
+ const myView = page.getViewById("lbl");
+
+ myView.animate({
+ width:320,
+ duration: 1000,
+ curve: AnimationCurve.easeIn
+ });
+}
+
+export function animateHeight(args) {
+ const button = args.object;
+ const page = button.page;
+ const myView = page.getViewById("lbl");
+
+ myView.animate({
+ height:400,
+ duration: 1000,
+ curve: AnimationCurve.easeIn
+ });
+}
+// << animation-properties-width-height
diff --git a/app/ns-ui-widgets-category/animations/width-height-properties/width-height-properties-page.xml b/app/ns-ui-widgets-category/animations/width-height-properties/width-height-properties-page.xml
new file mode 100644
index 0000000..c31498d
--- /dev/null
+++ b/app/ns-ui-widgets-category/animations/width-height-properties/width-height-properties-page.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/ns-ui-widgets-category/animations/width-height-properties/width-height-properties-ts-page.css b/app/ns-ui-widgets-category/animations/width-height-properties/width-height-properties-ts-page.css
new file mode 100644
index 0000000..8b6a90b
--- /dev/null
+++ b/app/ns-ui-widgets-category/animations/width-height-properties/width-height-properties-ts-page.css
@@ -0,0 +1,9 @@
+Label {
+ color: white;
+ background-color:blue;
+ border-radius: 20;
+ margin: 16;
+ padding: 8;
+ horizontal-align: center;
+ vertical-align: top;
+}
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/animations/width-height-properties/width-height-properties-ts-page.ts b/app/ns-ui-widgets-category/animations/width-height-properties/width-height-properties-ts-page.ts
new file mode 100644
index 0000000..671391d
--- /dev/null
+++ b/app/ns-ui-widgets-category/animations/width-height-properties/width-height-properties-ts-page.ts
@@ -0,0 +1,27 @@
+// >> animation-properties-width-height-ts
+import { Enums, View } from "@nativescript/core";
+
+export function animateWidth(args) {
+ let button = args.object;
+ let page = button.page;
+ let view = page.getViewById("lbl");
+
+ view.animate({
+ width: 320,
+ duration: 1000,
+ curve: Enums.AnimationCurve.easeIn
+ });
+}
+
+export function animateHeight(args) {
+ let button = args.object;
+ let page = button.page;
+ let view = page.getViewById("lbl");
+
+ view.animate({
+ height: 400,
+ duration: 1000,
+ curve: Enums.AnimationCurve.easeIn
+ });
+}
+// << animation-properties-width-height-ts
diff --git a/app/ns-ui-widgets-category/animations/width-height-properties/width-height-properties-ts-page.xml b/app/ns-ui-widgets-category/animations/width-height-properties/width-height-properties-ts-page.xml
new file mode 100644
index 0000000..9ff50f4
--- /dev/null
+++ b/app/ns-ui-widgets-category/animations/width-height-properties/width-height-properties-ts-page.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/app/ns-ui-widgets-category/bottom-navigation/bottom-navigation-page.js b/app/ns-ui-widgets-category/bottom-navigation/bottom-navigation-page.js
new file mode 100644
index 0000000..a07a258
--- /dev/null
+++ b/app/ns-ui-widgets-category/bottom-navigation/bottom-navigation-page.js
@@ -0,0 +1,21 @@
+import ListViewLinksModel from "../../links-view-model";
+import Link from "../../link";
+const navigationLinks = [
+ new Link("Usage", "ns-ui-widgets-category/bottom-navigation/usage/usage-page"),
+ new Link("Styling", "ns-ui-widgets-category/bottom-navigation/styling/styling-page")
+];
+const navigationLinksTsc = [
+
+];
+
+export function onNavigatingTo(args) {
+ const page = args.object;
+
+ page.bindingContext = new ListViewLinksModel({
+ links: navigationLinks,
+ actionBarTitle: args.context.title,
+ showTypeScriptExamples: false,
+ tsclinks: navigationLinksTsc
+ });
+}
+
diff --git a/app/ns-ui-widgets-category/bottom-navigation/bottom-navigation-page.xml b/app/ns-ui-widgets-category/bottom-navigation/bottom-navigation-page.xml
new file mode 100644
index 0000000..a69b8be
--- /dev/null
+++ b/app/ns-ui-widgets-category/bottom-navigation/bottom-navigation-page.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
diff --git a/app/ns-ui-widgets-category/bottom-navigation/end.md b/app/ns-ui-widgets-category/bottom-navigation/end.md
new file mode 100644
index 0000000..4539bd0
--- /dev/null
+++ b/app/ns-ui-widgets-category/bottom-navigation/end.md
@@ -0,0 +1,71 @@
+## Properties
+
+### BottomNavigation Properties
+
+| Name | Type | Description |
+|:----------|:---------|:---------------|
+| `items` | `Array` | Gets or sets the items of the BottomNavigation. |
+| `selectedIndex` | `number` | Gets or sets the selectedIndex of the BottomNavigation. |
+| `tabStrip`| `TabStrip` | Gets or sets the tab strip of the BottomNavigation. |
+
+
+### TabStrip Properties
+
+| Name | Type | Description |
+|:---------|:---------|:---------------|
+| `iosIconRenderingMode` | _"automatic"_, _"alwaysOriginal"_, _"alwaysTemplate"_ | Gets or sets the icon rendering mode on iOS. |
+| `isIconSizeFixed` | `boolean` | When set to `true` the icon will have fixed size following the platform-specific design guidelines. Default value: `true`. |
+| `items` | `Array` | Gets or sets an array of strip items of the TabStrip. |
+
+
+
+### TabStripItem Properties
+
+| Name | Type | Description |
+|-----------|----------|------------------------------------------------|
+| `title` | `string` | Gets or sets the title of the tab strip entry. |
+| `iconSource` | `string` | Gets or sets the icon source of the tab strip entry. Supports local image paths (`~`), resource images (`res://`) and icon fonts (`font://`) |
+| `image` | `Image` | Gets or sets the image of the tab strip entry. |
+| `label` | `Label` | Gets or sets the label of the tab strip entry. |
+
+
+## Events
+
+### BottomNavigation Events
+
+| Name | Description |
+|:-----------------------|:------------------------------------------------------|
+| `selectedIndexChanged` | Emitted when the `selectedIndex` property is changed. |
+| `loaded` | Emitted when the view is loaded. |
+| `unloaded` | Emitted when the view is unloaded. |
+| `layoutChanged` | Emitted when the layout bounds of a view changes due to layout processing. |
+
+### TabStrip Events
+
+| Name | Description |
+|:-----------------------|:----------------------------|
+| `itemTap` | Emitted when a `TabStripItem` is tapped. |
+
+### TabStripItem Events
+
+| Name | Description |
+|:-----------------------|:------------------------|
+| `tap` | Emitted when a `TabStripItem` is tapped. |
+
+
+## API References
+
+| Name | Type |
+|----------|---------|
+| [BottomNavigation](https://docs.nativescript.org/api-reference/classes/_ui_tab_navigation_bottom_navigation_.bottomnavigation) | `Class` |
+| [TabStrip](https://docs.nativescript.org/api-reference/classes/_ui_tab_navigation_tab_strip_.tabstrip) | `Class` |
+| [TabStripItem](https://docs.nativescript.org/api-reference/classes/_ui_tab_navigation_tab_strip_item_.tabstripitem) | `Class` |
+| [TabContentItem](https://docs.nativescript.org/api-reference/classes/_ui_tab_navigation_tab_content_item_.tabcontentitem) | `Class` |
+
+
+## Native Component
+
+
+| Android | iOS |
+|:----------------------|:---------|
+| [FrameLayout](https://developer.android.com/reference/android/widget/FrameLayout) | [UITabViewController](https://developer.apple.com/documentation/uikit/uitabbarcontroller?language=objc) |
diff --git a/app/ns-ui-widgets-category/bottom-navigation/metadata.md b/app/ns-ui-widgets-category/bottom-navigation/metadata.md
new file mode 100644
index 0000000..877a767
--- /dev/null
+++ b/app/ns-ui-widgets-category/bottom-navigation/metadata.md
@@ -0,0 +1,7 @@
+---
+title: BottomNavigation
+description: The NativeScript's BottomNavigation component provides a simple way to navigate between different views while providing common UI for both iOS and Android platforms. The recommended scenario suitable for BottomNavigation is a high level navigaiton with 3 to 5 tabs each with separate function.
+position: 416
+slug: bottom-navigation
+---
+example-order: usage, styling, properties, events, tips-and-tricks
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/bottom-navigation/overview.md b/app/ns-ui-widgets-category/bottom-navigation/overview.md
new file mode 100644
index 0000000..6402aae
--- /dev/null
+++ b/app/ns-ui-widgets-category/bottom-navigation/overview.md
@@ -0,0 +1,15 @@
+The `BottomNavigation` component provides a simple way to navigate between different views while providing common UI for both iOS and Android platforms. The recommended scenario suitable for `BottomNavigation` is a high level navigation with 3 to 5 tabs each with separate function. For additional information and details about bottom navigation refer to [the Material Design guidelines](https://material.io/design/components/bottom-navigation.html#usage).
+
+> **Note:** NativeScript 6 introduced two new UI components called `BottomNavigation` and `Tabs`. The idea behind them is to provide more control when building tab based UI, while powering the CSS styling, the icon font support and other specific functionalities. Prior to NativeScript 6, we had the `TabView` component which had top and bottom implementations with different behavoirs for the different platofrms and some styling limitations. With `BottomNavigaiton` and `Tabs` coomponents available, the `TabView` can be considered obsolete.
+
+The `BottomNavigation` component roundup:
+
+Component Primary Objectives:
+- Used for High Level navigation.
+- Good for UX structure with 3 to 5 different options.
+- Greater control over styling (compared to `TabVIew`).
+
+Limitations
+- No navigation transitions.
+- No navigation gestures (e.g., swipe to navigate).
+- No content preloading.
diff --git a/app/ns-ui-widgets-category/bottom-navigation/styling/article.md b/app/ns-ui-widgets-category/bottom-navigation/styling/article.md
new file mode 100644
index 0000000..843cea3
--- /dev/null
+++ b/app/ns-ui-widgets-category/bottom-navigation/styling/article.md
@@ -0,0 +1,2 @@
+
+
diff --git a/app/ns-ui-widgets-category/bottom-navigation/styling/styling-page.css b/app/ns-ui-widgets-category/bottom-navigation/styling/styling-page.css
new file mode 100644
index 0000000..9e13c4a
--- /dev/null
+++ b/app/ns-ui-widgets-category/bottom-navigation/styling/styling-page.css
@@ -0,0 +1,29 @@
+/* >> bottom-nav-theming-css */
+TabStrip {
+ selected-item-color: blueviolet;
+ un-selected-item-color: brown;
+ highlight-color: gold;
+}
+
+TabContentItem.first-tabcontent {
+ background-color: seashell;
+ color: olive;
+}
+TabContentItem.second-tabcontent {
+ background-color: slategray;
+ color: aquamarine;
+}
+TabContentItem.third-tabcontent {
+ background-color: blueviolet;
+ color: antiquewhite;
+}
+
+.fas {
+ font-family: "Font Awesome 5 Free", "fa-solid-900";
+ font-weight: 900;
+}
+
+.t-36 {
+ font-size: 36;
+}
+/* << bottom-nav-theming-css */
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/bottom-navigation/styling/styling-page.xml b/app/ns-ui-widgets-category/bottom-navigation/styling/styling-page.xml
new file mode 100644
index 0000000..172ae45
--- /dev/null
+++ b/app/ns-ui-widgets-category/bottom-navigation/styling/styling-page.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/bottom-navigation/usage/article.md b/app/ns-ui-widgets-category/bottom-navigation/usage/article.md
new file mode 100644
index 0000000..ad0dc20
--- /dev/null
+++ b/app/ns-ui-widgets-category/bottom-navigation/usage/article.md
@@ -0,0 +1,7 @@
+The `BottomNavigation` component contains two sub-components:
+- The `TabStrip` which defines and rendres the bottom bar and its `TabStripItem` components.
+- Multiple `TabContentItem` components which total number should be equal to the number of the tabs (`TabStripItem` components). Each `TabContentItem` acts as a container for your tab content.
+
+
+
+> **Note:** The number of `TabStripItem` components must be equal to the number of `tabContentItem` components.
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/bottom-navigation/usage/usage-page.xml b/app/ns-ui-widgets-category/bottom-navigation/usage/usage-page.xml
new file mode 100644
index 0000000..4146d0a
--- /dev/null
+++ b/app/ns-ui-widgets-category/bottom-navigation/usage/usage-page.xml
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/bottom-navigation/usage/usage-ts-page.xml b/app/ns-ui-widgets-category/bottom-navigation/usage/usage-ts-page.xml
new file mode 100644
index 0000000..0e63f4c
--- /dev/null
+++ b/app/ns-ui-widgets-category/bottom-navigation/usage/usage-ts-page.xml
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/button/basics/article.md b/app/ns-ui-widgets-category/button/basics/article.md
deleted file mode 100644
index 8b0281f..0000000
--- a/app/ns-ui-widgets-category/button/basics/article.md
+++ /dev/null
@@ -1,5 +0,0 @@
-The `Button` widget comes with `text` property and a `tap` handler.
-The example demonstrates how to set a button in XML page and use the `tap` callback.
-
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/button/basics/basics-page.xml b/app/ns-ui-widgets-category/button/basics/basics-page.xml
deleted file mode 100644
index 43889b0..0000000
--- a/app/ns-ui-widgets-category/button/basics/basics-page.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/button/button-page.js b/app/ns-ui-widgets-category/button/button-page.js
index b3277db..ecd98e1 100644
--- a/app/ns-ui-widgets-category/button/button-page.js
+++ b/app/ns-ui-widgets-category/button/button-page.js
@@ -1,17 +1,17 @@
-const ListViewLinksModel = require("../../links-view-model");
-const link = require("../../link");
+import ListViewLinksModel from "../../links-view-model";
+import Link from "../../link";
const navigationLinks = [
- new link("Basics", "ns-ui-widgets-category/button/basics/basics-page"),
- new link("Styling", "ns-ui-widgets-category/button/styling/styling-page"),
- new link("Code-Behind", "ns-ui-widgets-category/button/code-behind/code-behind-page")
+ new Link("Usage", "ns-ui-widgets-category/button/usage/usage-page"),
+ new Link("Styling", "ns-ui-widgets-category/button/styling/styling-page"),
+ new Link("Code-Behind", "ns-ui-widgets-category/button/code-behind/code-behind-page")
];
const navigationLinksTsc = [
- new link("Basics", "ns-ui-widgets-category/button/basics/basics-ts-page"),
- new link("Code-Behind", "ns-ui-widgets-category/button/code-behind/code-behind-ts-page")
+ new Link("Usage", "ns-ui-widgets-category/button/usage/usage-ts-page"),
+ new Link("Code-Behind", "ns-ui-widgets-category/button/code-behind/code-behind-ts-page")
];
-function onNavigatingTo(args) {
+export function onNavigatingTo(args) {
const page = args.object;
page.bindingContext = new ListViewLinksModel({
links: navigationLinks,
@@ -20,4 +20,4 @@ function onNavigatingTo(args) {
tsclinks: navigationLinksTsc
});
}
-exports.onNavigatingTo = onNavigatingTo;
+
diff --git a/app/ns-ui-widgets-category/button/code-behind/article.md b/app/ns-ui-widgets-category/button/code-behind/article.md
deleted file mode 100644
index eadf599..0000000
--- a/app/ns-ui-widgets-category/button/code-behind/article.md
+++ /dev/null
@@ -1,3 +0,0 @@
-Creating a `Button` programmatically with `text` value and a `tap` callback.
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/button/code-behind/code-behind-page.js b/app/ns-ui-widgets-category/button/code-behind/code-behind-page.js
index 54420f7..f4428e5 100644
--- a/app/ns-ui-widgets-category/button/code-behind/code-behind-page.js
+++ b/app/ns-ui-widgets-category/button/code-behind/code-behind-page.js
@@ -1,7 +1,7 @@
// >> import-button-widget
-const Button = require("tns-core-modules/ui/button").Button;
+import { Button } from "@nativescript/core";
// << import-button-widget
-function onNavigatingTo(args) {
+export function onNavigatingTo(args) {
const page = args.object;
const container = page.getViewById("container");
@@ -17,4 +17,4 @@ function onNavigatingTo(args) {
container.addChild(myButton);
}
-exports.onNavigatingTo = onNavigatingTo;
+
diff --git a/app/ns-ui-widgets-category/button/code-behind/code-behind-page.xml b/app/ns-ui-widgets-category/button/code-behind/code-behind-page.xml
index dec6979..d56fceb 100644
--- a/app/ns-ui-widgets-category/button/code-behind/code-behind-page.xml
+++ b/app/ns-ui-widgets-category/button/code-behind/code-behind-page.xml
@@ -2,6 +2,7 @@
-
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/button/code-behind/code-behind-ts-page.ts b/app/ns-ui-widgets-category/button/code-behind/code-behind-ts-page.ts
index 38bd2fc..9566dd9 100644
--- a/app/ns-ui-widgets-category/button/code-behind/code-behind-ts-page.ts
+++ b/app/ns-ui-widgets-category/button/code-behind/code-behind-ts-page.ts
@@ -1,6 +1,6 @@
-import { GestureEventData } from "tns-core-modules/ui/gestures";
+import { GestureEventData } from "@nativescript/core";
// >> import-button-widget-ts
-import { Button } from "tns-core-modules/ui/button";
+import { Button } from "@nativescript/core";
// << import-button-widget-ts
export function onNavigatingTo(args) {
const page = args.object;
diff --git a/app/ns-ui-widgets-category/button/end.md b/app/ns-ui-widgets-category/button/end.md
index 6480c5b..f2ce436 100644
--- a/app/ns-ui-widgets-category/button/end.md
+++ b/app/ns-ui-widgets-category/button/end.md
@@ -1,6 +1,34 @@
-**API Reference for the** [Button Class](http://docs.nativescript.org/api-reference/classes/_ui_button_.button.html)
+## Tips And Tricks
-**Native Component**
+### Creating Button via Code-Behind
+Creating a `Button` programmatically with `text` value and a `tap` callback.
+
+
+
+
+## Properties
+
+| Name | Type | Description |
+|----------|---------|----------------|
+| `text` | `string` | Gets or sets the label of the button. |
+
+## Events
+
+| Name | Description |
+|----------|----------------|
+| `tap` | Emitted when the button is tapped.|
+| `loaded` | Emitted when the view is loaded. |
+| `unloaded` | Emitted when the view is unloaded. |
+| `layoutChanged` | Emitted when the layout bounds of a view changes due to layout processing. |
+
+## API References
+
+| Name | Type |
+|----------|---------|
+| [tns-core-modules/ui/button](https://docs.nativescript.org/api-reference/modules/_ui_button_) | `Module` |
+| [Button](http://docs.nativescript.org/api-reference/classes/_ui_button_.button.html) | `Class` |
+
+## Native Component
| Android | iOS |
|:----------------------|:---------|
diff --git a/app/ns-ui-widgets-category/button/metadata.md b/app/ns-ui-widgets-category/button/metadata.md
index eb36f93..8db5cb7 100644
--- a/app/ns-ui-widgets-category/button/metadata.md
+++ b/app/ns-ui-widgets-category/button/metadata.md
@@ -4,3 +4,4 @@ description: The Button provides abstraction over Android's widget.Button and iO
position: 200
slug: button
---
+example-order: usage, styling
diff --git a/app/ns-ui-widgets-category/button/overview.md b/app/ns-ui-widgets-category/button/overview.md
index d208115..fc2d582 100644
--- a/app/ns-ui-widgets-category/button/overview.md
+++ b/app/ns-ui-widgets-category/button/overview.md
@@ -1,3 +1 @@
-The `Button` widget provides a standard button widget that reacts to a `tap` event.
-
-
\ No newline at end of file
+A `Button` component provides an easy-to-use way for interacting through the application and invoking custom logic in response to that. Once the user taps it, the button performs any actions attached to it.
diff --git a/app/ns-ui-widgets-category/button/styling/article.md b/app/ns-ui-widgets-category/button/styling/article.md
index dd4dfba..f5fc856 100644
--- a/app/ns-ui-widgets-category/button/styling/article.md
+++ b/app/ns-ui-widgets-category/button/styling/article.md
@@ -1,8 +1,11 @@
-To style and customize the `Button` widget use the conventional CSS properties and Icon Fonts.
-The widget also supports the CSS pseudo-selector `active`, which is triggered while the button is being pressed.
-The example below shows a button with icon (using icon font), several CSS properties and with an `active` state styling.
+The `Button` component can be styled using CSS or corresponding properties.
-`Note:` To disable a button use the [`isEnabled`](https://docs.nativescript.org/api-reference/classes/_ui_button_.button#isenabled) attribute set to `"false"` in your markup instead of the usual `disabled` attribute.
-
-
+
+
+### Specific Styling Properties
+
+| Name | CSS Name | Type | Description |
+|----------|---------|---------|----------------|
+| `androidElevation` | `android-elevation` | number | (Android only) Gets or sets the elevation of the android view. |
+| `androidDynamicElevationOffset` | `android-dynamic-elevation-offset` | number | (Android only) Gets or sets the dynamic elevation offset of the android view. |
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/button/styling/styling-page.css b/app/ns-ui-widgets-category/button/styling/styling-page.css
index 2480555..960b0b7 100644
--- a/app/ns-ui-widgets-category/button/styling/styling-page.css
+++ b/app/ns-ui-widgets-category/button/styling/styling-page.css
@@ -1,16 +1,23 @@
/* >> button-css-styles */
.my-button {
- background-color: orangered;
- border-radius: 5;
- color: white;
- font-family: FontAwesome;
- font-size: 24;
- vertical-align: middle;
- width: 80%;
+ android-elevation: 4;
+ background-color: lightseagreen;
+ border-color: darkolivegreen;
+ border-radius: 20;
+ border-width: 1;
+ color: whitesmoke;
+ font-size: 18;
+ font-weight: bold;
}
.my-button:active {
- background-color: lightslategray;
- color:white;
+ android-elevation: 8;
+ background-color: whitesmoke;
+ border-color: darkolivegreen;
+ border-radius: 20;
+ border-width: 1;
+ color: lightseagreen;
+ font-size: 18;
+ font-weight: bold;
}
/* << button-css-styles */
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/button/styling/styling-page.js b/app/ns-ui-widgets-category/button/styling/styling-page.js
deleted file mode 100644
index 78fc5e9..0000000
--- a/app/ns-ui-widgets-category/button/styling/styling-page.js
+++ /dev/null
@@ -1,5 +0,0 @@
-function onTap(args) {
- const button = args.object;
- console.log("Button tapped", button);
-}
-exports.onTap = onTap;
diff --git a/app/ns-ui-widgets-category/button/styling/styling-page.xml b/app/ns-ui-widgets-category/button/styling/styling-page.xml
index a66def8..80ef453 100644
--- a/app/ns-ui-widgets-category/button/styling/styling-page.xml
+++ b/app/ns-ui-widgets-category/button/styling/styling-page.xml
@@ -4,13 +4,28 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/button/usage/article.md b/app/ns-ui-widgets-category/button/usage/article.md
new file mode 100644
index 0000000..5225f63
--- /dev/null
+++ b/app/ns-ui-widgets-category/button/usage/article.md
@@ -0,0 +1,5 @@
+A `Button` component can execute custom logic via its `tap` event. Handling the event is as easy as using `(tap)` in HTML, and implementing a tap handler in your component.
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/button/basics/basics-page.js b/app/ns-ui-widgets-category/button/usage/usage-page.js
similarity index 50%
rename from app/ns-ui-widgets-category/button/basics/basics-page.js
rename to app/ns-ui-widgets-category/button/usage/usage-page.js
index 9cc3ed7..f79f9c5 100644
--- a/app/ns-ui-widgets-category/button/basics/basics-page.js
+++ b/app/ns-ui-widgets-category/button/usage/usage-page.js
@@ -1,21 +1,20 @@
-const Observable = require("tns-core-modules/data/observable").Observable;
+import { Observable } from "@nativescript/core";
const vm = new Observable();
-function onNavigatingTo(args) {
+export function onNavigatingTo(args) {
const page = args.object;
vm.set("counter", 0);
- page.bindingContext = vm;
}
-exports.onNavigatingTo = onNavigatingTo;
+
// >> button-tap-event
-function onTap(args) {
+export function onTap(args) {
const button = args.object;
// >> (hide)
let count = vm.get("counter");
vm.set("counter", ++count);
// << (hide)
- button.text = `Tapped ${count} times`;
+ alert(`Tapped ${count} times!`);
}
-exports.onTap = onTap;
+
// << button-tap-event
diff --git a/app/ns-ui-widgets-category/button/usage/usage-page.xml b/app/ns-ui-widgets-category/button/usage/usage-page.xml
new file mode 100644
index 0000000..7da3051
--- /dev/null
+++ b/app/ns-ui-widgets-category/button/usage/usage-page.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/button/basics/basics-ts-page.ts b/app/ns-ui-widgets-category/button/usage/usage-ts-page.ts
similarity index 72%
rename from app/ns-ui-widgets-category/button/basics/basics-ts-page.ts
rename to app/ns-ui-widgets-category/button/usage/usage-ts-page.ts
index 0ab25c9..b0c8080 100644
--- a/app/ns-ui-widgets-category/button/basics/basics-ts-page.ts
+++ b/app/ns-ui-widgets-category/button/usage/usage-ts-page.ts
@@ -1,5 +1,4 @@
-import { EventData, Observable } from "tns-core-modules/data/observable";
-import { Button } from "tns-core-modules/ui/button";
+import { Button, EventData, Observable } from "@nativescript/core";
export function onNavigatingTo(args) {
const page = args.object;
@@ -16,6 +15,6 @@ export function onTap(args: EventData) {
let count = vm.get("counter");
vm.set("counter", ++count);
// << (hide)
- button.text = `Tapped ${count} times`;
+ alert("Tapped " + count + " times!");
}
// << button-tap-event-ts
diff --git a/app/ns-ui-widgets-category/button/usage/usage-ts-page.xml b/app/ns-ui-widgets-category/button/usage/usage-ts-page.xml
new file mode 100644
index 0000000..7da3051
--- /dev/null
+++ b/app/ns-ui-widgets-category/button/usage/usage-ts-page.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/date-picker/basics/article.md b/app/ns-ui-widgets-category/date-picker/basics/article.md
deleted file mode 100644
index d6eb0b2..0000000
--- a/app/ns-ui-widgets-category/date-picker/basics/article.md
+++ /dev/null
@@ -1,8 +0,0 @@
-The date picker element can accept JavaScript `Date` object for `date`, `minDate`, and `maxDate` properties.
-Emitting the properties `minDate` and `maxDate` will set default year range from 1900 AD to 2100 AD.
-
-
-
-
-The control can also accept number values for `day`, `month`, and `year` properties.
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/date-picker/basics/basics-page.xml b/app/ns-ui-widgets-category/date-picker/basics/basics-page.xml
deleted file mode 100644
index 62dabf4..0000000
--- a/app/ns-ui-widgets-category/date-picker/basics/basics-page.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/date-picker/basics/basics-ts-page.xml b/app/ns-ui-widgets-category/date-picker/basics/basics-ts-page.xml
deleted file mode 100644
index 3d1ba04..0000000
--- a/app/ns-ui-widgets-category/date-picker/basics/basics-ts-page.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/date-picker/code-behind/article.md b/app/ns-ui-widgets-category/date-picker/code-behind/article.md
deleted file mode 100644
index 8591656..0000000
--- a/app/ns-ui-widgets-category/date-picker/code-behind/article.md
+++ /dev/null
@@ -1,7 +0,0 @@
-Using a `DatePicker` in code-behind files requires the `tns-core-modules/ui/date-picker` module.
-
-
-
-Creating and controlling `DatePicker` programmatically.
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/date-picker/code-behind/code-behind-page.js b/app/ns-ui-widgets-category/date-picker/code-behind/code-behind-page.js
index 227aa36..f6982e0 100644
--- a/app/ns-ui-widgets-category/date-picker/code-behind/code-behind-page.js
+++ b/app/ns-ui-widgets-category/date-picker/code-behind/code-behind-page.js
@@ -1,8 +1,8 @@
// >> date-picker-require
-const DatePicker = require("tns-core-modules/ui/date-picker").DatePicker;
+import { DatePicker } from "@nativescript/core";
// << date-picker-require
-exports.onStackLoaded = function(args) {
+export function onStackLoaded(args) {
const stack = args.object;
// >> date-picker-code-behind
@@ -17,4 +17,4 @@ exports.onStackLoaded = function(args) {
// << date-picker-code-behind
stack.addChild(datePicker);
-};
+}
diff --git a/app/ns-ui-widgets-category/date-picker/code-behind/code-behind-ts-page.ts b/app/ns-ui-widgets-category/date-picker/code-behind/code-behind-ts-page.ts
index 64bd496..6707324 100644
--- a/app/ns-ui-widgets-category/date-picker/code-behind/code-behind-ts-page.ts
+++ b/app/ns-ui-widgets-category/date-picker/code-behind/code-behind-ts-page.ts
@@ -1,8 +1,7 @@
// >> date-picker-require-ts
-import { DatePicker } from "tns-core-modules/ui/date-picker";
+import { DatePicker } from "@nativescript/core";
// << date-picker-require-ts
-import { EventData } from "tns-core-modules/data/observable";
-import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout";
+import { EventData, StackLayout } from "@nativescript/core";
export function onStackLoaded(args: EventData) {
const stack = args.object;
diff --git a/app/ns-ui-widgets-category/date-picker/date-picker-page.js b/app/ns-ui-widgets-category/date-picker/date-picker-page.js
index b6a51b1..4a9e5e1 100644
--- a/app/ns-ui-widgets-category/date-picker/date-picker-page.js
+++ b/app/ns-ui-widgets-category/date-picker/date-picker-page.js
@@ -1,15 +1,15 @@
-const ListViewLinksModel = require("../../links-view-model");
-const link = require("../../link");
+import ListViewLinksModel from "../../links-view-model";
+import Link from "../../link";
const navigationLinks = [
- new link("Basics", "ns-ui-widgets-category/date-picker/basics/basics-page"),
- new link("Code-Behind", "ns-ui-widgets-category/date-picker/code-behind/code-behind-page"),
- new link("Styling", "ns-ui-widgets-category/date-picker/styling/styling-page")
+ new Link("Usage", "ns-ui-widgets-category/date-picker/usage/usage-page"),
+ new Link("Code-Behind", "ns-ui-widgets-category/date-picker/code-behind/code-behind-page"),
+ new Link("Styling", "ns-ui-widgets-category/date-picker/styling/styling-page")
];
const navigationLinksTsc = [
- new link("Basics", "ns-ui-widgets-category/date-picker/basics/basics-ts-page"),
- new link("Code-Behind", "ns-ui-widgets-category/date-picker/code-behind/code-behind-ts-page")
+ new Link("Usage", "ns-ui-widgets-category/date-picker/usage/usage-ts-page"),
+ new Link("Code-Behind", "ns-ui-widgets-category/date-picker/code-behind/code-behind-ts-page")
];
-function onNavigatingTo(args) {
+export function onNavigatingTo(args) {
const page = args.object;
page.bindingContext = new ListViewLinksModel({
links: navigationLinks,
@@ -18,4 +18,4 @@ function onNavigatingTo(args) {
tsclinks: navigationLinksTsc
});
}
-exports.onNavigatingTo = onNavigatingTo;
+
diff --git a/app/ns-ui-widgets-category/date-picker/end.md b/app/ns-ui-widgets-category/date-picker/end.md
index 8e0b0cc..4f19daa 100644
--- a/app/ns-ui-widgets-category/date-picker/end.md
+++ b/app/ns-ui-widgets-category/date-picker/end.md
@@ -1,7 +1,45 @@
-**API Reference for** [DatePicker Class](http://docs.nativescript.org/api-reference/modules/_ui_date_picker_.html)
+## Tips And Tricks
-**Native Component**
+### Creating DatePicker via Code-Behind
+Using a `DatePicker` in code-behind files requires the `tns-core-modules/ui/date-picker` module.
+
+
+
+Creating and controlling `DatePicker` programmatically.
+
+
+
+
+## Properties
+
+| Name | Type | Description |
+|----------|----------|----------------|
+| `date` | `Date` | Gets or sets the entire date as `Date` object. |
+| `minDate`| `Date` | Gets or sets the min date |
+| `maxDate`| `Date` | Gets or sets the max date |
+| `day` | `number` | Gets or sets the day. The days start from 1. |
+| `month` | `number` | Gets or sets the month. The months start from 1. |
+| `year` | `number` | Gets or sets the year. |
+
+## Events
+
+| Name | Description |
+|----------|----------------|
+| `dateChange` | Emitted when the `date` property is changed. |
+| `dayChange` | Emitted when the `day` property is changed. |
+| `monthChange` | Emitted when the `month` property is changed. |
+| `yearChange` | Emitted when the `year` property is changed. |
+
+## API References
+
+| Name | Type |
+|----------|---------|
+| [tns-core-modules/ui/date-picker](https://docs.nativescript.org/api-reference/modules/_ui_date_picker_ ) | `Module` |
+| [DatePicker](https://docs.nativescript.org/api-reference/classes/_ui_date_picker_.datepicker) | `Class` |
+
+## Native Component
+
+| Android | iOS |
+|:----------------------|:---------|
+| [android.widget.DatePicker](http://developer.android.com/reference/android/widget/DatePicker.html) | [UIDatePicker](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIDatePicker_Class/index.html) |
-| Android | iOS |
-|:-----------------------|:---------|
-| [android.widget.DatePicker](http://developer.android.com/reference/android/widget/DatePicker.html) | [UIDatePicker](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIDatePicker_Class/index.html) |
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/date-picker/metadata.md b/app/ns-ui-widgets-category/date-picker/metadata.md
index 6560e67..fc37f10 100644
--- a/app/ns-ui-widgets-category/date-picker/metadata.md
+++ b/app/ns-ui-widgets-category/date-picker/metadata.md
@@ -4,3 +4,4 @@ description: DatePicker is UI control, which allows choosing a date from a ready
position: 210
slug: date-picker
---
+example-order: usage, styling
diff --git a/app/ns-ui-widgets-category/date-picker/overview.md b/app/ns-ui-widgets-category/date-picker/overview.md
index 76776c4..e91920e 100644
--- a/app/ns-ui-widgets-category/date-picker/overview.md
+++ b/app/ns-ui-widgets-category/date-picker/overview.md
@@ -1,2 +1 @@
-NativeScript provides a `DatePicker` control that enables the user to choose a date as a ready-to-use dialog.
-Every date part can be picked separately by its corresponding section of the control - for day, month and year.
+`DatePicker` control enables the user to choose a date as a ready-to-use dialog. Every date part can be picked separately by its corresponding section of the control - for day, month and year.
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/date-picker/styling/styling-page.css b/app/ns-ui-widgets-category/date-picker/styling/styling-page.css
index b78020e..1077a64 100644
--- a/app/ns-ui-widgets-category/date-picker/styling/styling-page.css
+++ b/app/ns-ui-widgets-category/date-picker/styling/styling-page.css
@@ -1,8 +1,10 @@
/* >> date-picker-styles */
.date-picker {
- background-color: lightgray;
- border-radius: 20;
- color: orangered; /* iOS only*/
- width: 80%;
+ background-color: olivedrab;
+ border-color: burlywood;
+ border-width: 2;
+ border-radius: 10;
+ color: whitesmoke;
+ vertical-align: middle;
}
/* << date-picker-styles */
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/date-picker/styling/styling-page.xml b/app/ns-ui-widgets-category/date-picker/styling/styling-page.xml
index abad7d8..11d7edd 100644
--- a/app/ns-ui-widgets-category/date-picker/styling/styling-page.xml
+++ b/app/ns-ui-widgets-category/date-picker/styling/styling-page.xml
@@ -3,8 +3,8 @@
-
-
-
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/date-picker/usage/article.md b/app/ns-ui-widgets-category/date-picker/usage/article.md
new file mode 100644
index 0000000..523c3ad
--- /dev/null
+++ b/app/ns-ui-widgets-category/date-picker/usage/article.md
@@ -0,0 +1,5 @@
+Using `DatePicker` is as straightforward as setting `year`, `month`, and `day`. Alternatively, you can set the `date` property (accepts a `Date` object). If required you can also set `minDate` and `maxDate`.
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/date-picker/basics/basics-page.js b/app/ns-ui-widgets-category/date-picker/usage/usage-page.js
similarity index 79%
rename from app/ns-ui-widgets-category/date-picker/basics/basics-page.js
rename to app/ns-ui-widgets-category/date-picker/usage/usage-page.js
index 3402474..9107944 100644
--- a/app/ns-ui-widgets-category/date-picker/basics/basics-page.js
+++ b/app/ns-ui-widgets-category/date-picker/usage/usage-page.js
@@ -1,6 +1,6 @@
-const Observable = require("tns-core-modules/data/observable").Observable;
+import { Observable } from "@nativescript/core";
// >> date-picker-dates
-function onNavigatingTo(args) {
+export function onNavigatingTo(args) {
const page = args.object;
const vm = new Observable();
@@ -12,9 +12,9 @@ function onNavigatingTo(args) {
page.bindingContext = vm;
}
-exports.onNavigatingTo = onNavigatingTo;
-function onDatePickerLoaded(args) {
+
+export function onDatePickerLoaded(args) {
const datePicker = args.object;
datePicker.on("dateChange", (args) => {
console.dir(args);
@@ -29,5 +29,4 @@ function onDatePickerLoaded(args) {
console.dir(args);
});
}
-exports.onDatePickerLoaded = onDatePickerLoaded;
// << date-picker-dates
diff --git a/app/ns-ui-widgets-category/date-picker/usage/usage-page.xml b/app/ns-ui-widgets-category/date-picker/usage/usage-page.xml
new file mode 100644
index 0000000..33989b9
--- /dev/null
+++ b/app/ns-ui-widgets-category/date-picker/usage/usage-page.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/date-picker/basics/basics-ts-page.ts b/app/ns-ui-widgets-category/date-picker/usage/usage-ts-page.ts
similarity index 75%
rename from app/ns-ui-widgets-category/date-picker/basics/basics-ts-page.ts
rename to app/ns-ui-widgets-category/date-picker/usage/usage-ts-page.ts
index e9c0fd5..cf6eb7f 100644
--- a/app/ns-ui-widgets-category/date-picker/basics/basics-ts-page.ts
+++ b/app/ns-ui-widgets-category/date-picker/usage/usage-ts-page.ts
@@ -1,15 +1,11 @@
// >> date-picker-dates-ts
-import { EventData, Observable } from "tns-core-modules/data/observable";
-import { DatePicker } from "tns-core-modules/ui/date-picker";
-import { Page } from "tns-core-modules/ui/page";
+import { DatePicker, EventData, Observable, Page } from "@nativescript/core";
export function onNavigatingTo(args: EventData) {
const page = args.object;
const vm = new Observable();
// in the following example the DatePicker properties are binded via Observableproperties
- const TODAY = new Date();
- vm.set("date", TODAY); // the binded date property accepts Date object
vm.set("minDate", new Date(1975, 0, 29)); // the binded minDate property accepts Date object
vm.set("maxDate", new Date(2045, 4, 12)); // the binded maxDate property accepts Date object
diff --git a/app/ns-framework-modules-category/application-settings/native-access/native-access-page.xml b/app/ns-ui-widgets-category/date-picker/usage/usage-ts-page.xml
similarity index 51%
rename from app/ns-framework-modules-category/application-settings/native-access/native-access-page.xml
rename to app/ns-ui-widgets-category/date-picker/usage/usage-ts-page.xml
index a043377..0e507ff 100644
--- a/app/ns-framework-modules-category/application-settings/native-access/native-access-page.xml
+++ b/app/ns-ui-widgets-category/date-picker/usage/usage-ts-page.xml
@@ -3,6 +3,6 @@
-
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/dialogs/action-dialog/action-page.js b/app/ns-ui-widgets-category/dialogs/action-dialog/action-page.js
new file mode 100644
index 0000000..3402b61
--- /dev/null
+++ b/app/ns-ui-widgets-category/dialogs/action-dialog/action-page.js
@@ -0,0 +1,15 @@
+// >> dialog-action
+export function showActionDialog() {
+ const actionOptions = {
+ title: "Race selection",
+ message: "Choose your race",
+ cancelButtonText: "Cancel",
+ actions: ["Human", "Elf", "Dwarf", "Orc", "Unicorn"],
+ cancelable: true // Android only
+ };
+
+ action(actionOptions).then((result) => {
+ console.log(result);
+ });
+}
+// << dialog-action
diff --git a/app/ns-ui-widgets-category/dialogs/action/action-page.xml b/app/ns-ui-widgets-category/dialogs/action-dialog/action-page.xml
similarity index 71%
rename from app/ns-ui-widgets-category/dialogs/action/action-page.xml
rename to app/ns-ui-widgets-category/dialogs/action-dialog/action-page.xml
index 1b4ac53..ba0779f 100644
--- a/app/ns-ui-widgets-category/dialogs/action/action-page.xml
+++ b/app/ns-ui-widgets-category/dialogs/action-dialog/action-page.xml
@@ -1,4 +1,4 @@
-
+
diff --git a/app/ns-ui-widgets-category/dialogs/action-dialog/action-ts-page.ts b/app/ns-ui-widgets-category/dialogs/action-dialog/action-ts-page.ts
new file mode 100644
index 0000000..b1c5e9a
--- /dev/null
+++ b/app/ns-ui-widgets-category/dialogs/action-dialog/action-ts-page.ts
@@ -0,0 +1,23 @@
+// >> dialog-action-ts
+import { action, ActionOptions } from "@nativescript/core";
+
+export function showActionDialog() {
+
+ const actionOptions: ActionOptions = {
+ title: "Race selection",
+ message: "Choose your race",
+ cancelButtonText: "Cancel",
+ actions: ["Human", "Elf", "Dwarf", "Orc", "Unicorn"],
+ cancelable: true // Android only
+ };
+
+ action(actionOptions).then((result) => {
+ console.log("Dialog result: ", result);
+ if (result === "Options1") {
+ // Do action 1
+ } else if (result === "Option2") {
+ // Do action 2
+ }
+ });
+}
+// << dialog-action-ts
diff --git a/app/ns-ui-widgets-category/dialogs/action/action-ts-page.xml b/app/ns-ui-widgets-category/dialogs/action-dialog/action-ts-page.xml
similarity index 100%
rename from app/ns-ui-widgets-category/dialogs/action/action-ts-page.xml
rename to app/ns-ui-widgets-category/dialogs/action-dialog/action-ts-page.xml
diff --git a/app/ns-ui-widgets-category/dialogs/action/article.md b/app/ns-ui-widgets-category/dialogs/action-dialog/article.md
similarity index 100%
rename from app/ns-ui-widgets-category/dialogs/action/article.md
rename to app/ns-ui-widgets-category/dialogs/action-dialog/article.md
diff --git a/app/ns-ui-widgets-category/dialogs/action/action-page.js b/app/ns-ui-widgets-category/dialogs/action/action-page.js
deleted file mode 100644
index 363eaaf..0000000
--- a/app/ns-ui-widgets-category/dialogs/action/action-page.js
+++ /dev/null
@@ -1,38 +0,0 @@
-exports.onNavigatedTo = function (args) {
- /*
- // >> dialog-action-web
- action("Your message", "Cancel", ["Option1", "Option2"]).then((result) => {
- console.log("Dialog result: " + result);
- if(result === "Options1") {
- // Do action1
- } else if(result === "Option2") {
- // Do action2
- }
- });
- // << dialog-action-web
- */
-
- showActionDialog();
-};
-
-function showActionDialog() {
- // >> dialog-action
- const actionOptions = {
- title: "Your Title",
- message: "Your message",
- cancelButtonText: "Cancel",
- actions: ["Option1", "Option2"],
- cancelable: true // Android only
- };
-
- action(actionOptions).then((result) => {
- console.log("Dialog result: ", result);
- if (result === "Options1") {
- // Do action 1
- } else if (result === "Option2") {
- // Do action 2
- }
- });
- // << dialog-action
-}
-exports.showActionDialog = showActionDialog;
diff --git a/app/ns-ui-widgets-category/dialogs/action/action-ts-page.ts b/app/ns-ui-widgets-category/dialogs/action/action-ts-page.ts
deleted file mode 100644
index badb6ea..0000000
--- a/app/ns-ui-widgets-category/dialogs/action/action-ts-page.ts
+++ /dev/null
@@ -1,40 +0,0 @@
-import { action, ActionOptions } from "tns-core-modules/ui/dialogs";
-
-export function onNavigatedTo(args) {
- /*
- // >> dialog-action-web-ts
- action("Your message", "Cancel", ["Option1", "Option2"]).then((result) => {
- console.log("Dialog result: " + result);
- if(result === "Options1") {
- // Do action1
- } else if(result === "Option2") {
- // Do action2
- }
- });
- // << dialog-action-web-ts
- */
-
- showActionDialog();
-}
-
-export function showActionDialog() {
- // >> dialog-action-ts
- // import { action, ActionOptions } from "tns-core-modules/ui/dialogs";
- const actionOptions: ActionOptions = {
- title: "Your Title",
- message: "Your message",
- cancelButtonText: "Cancel",
- actions: ["Option1", "Option2"],
- cancelable: true // Android only
- };
-
- action(actionOptions).then((result) => {
- console.log("Dialog result: ", result);
- if (result === "Options1") {
- // Do action 1
- } else if (result === "Option2") {
- // Do action 2
- }
- });
- // << dialog-action-ts
-}
diff --git a/app/ns-ui-widgets-category/dialogs/alert-dialog/alert-page.js b/app/ns-ui-widgets-category/dialogs/alert-dialog/alert-page.js
new file mode 100644
index 0000000..82c2fa7
--- /dev/null
+++ b/app/ns-ui-widgets-category/dialogs/alert-dialog/alert-page.js
@@ -0,0 +1,16 @@
+
+
+export function showAlertDialog() {
+ // >> dialog-alert
+ const alertOptions = {
+ title: "Race selection",
+ message: "Race chosen: Unicorn",
+ okButtonText: "OK",
+ cancelable: false // [Android only] Gets or sets if the dialog can be canceled by taping outside of the dialog.
+ };
+
+ alert(alertOptions).then(() => {
+ console.log("Race chosen!");
+ });
+ // << dialog-alert
+}
diff --git a/app/ns-ui-widgets-category/dialogs/alert/alert-page.xml b/app/ns-ui-widgets-category/dialogs/alert-dialog/alert-page.xml
similarity index 71%
rename from app/ns-ui-widgets-category/dialogs/alert/alert-page.xml
rename to app/ns-ui-widgets-category/dialogs/alert-dialog/alert-page.xml
index d3f5572..db84cc5 100644
--- a/app/ns-ui-widgets-category/dialogs/alert/alert-page.xml
+++ b/app/ns-ui-widgets-category/dialogs/alert-dialog/alert-page.xml
@@ -1,4 +1,4 @@
-
+
diff --git a/app/ns-ui-widgets-category/dialogs/alert-dialog/alert-ts-page.ts b/app/ns-ui-widgets-category/dialogs/alert-dialog/alert-ts-page.ts
new file mode 100644
index 0000000..dfd00b8
--- /dev/null
+++ b/app/ns-ui-widgets-category/dialogs/alert-dialog/alert-ts-page.ts
@@ -0,0 +1,18 @@
+// >> dialog-alert-ts
+import { alert, AlertOptions } from "@nativescript/core";
+
+export function showAlertDialog() {
+
+ const alertOptions: AlertOptions = {
+ title: "Race selection",
+ message: "Race chosen: Unicorn",
+ okButtonText: "OK",
+ cancelable: false // [Android only] Gets or sets if the dialog can be canceled by taping outside of the dialog.
+ };
+
+ alert(alertOptions).then(() => {
+ console.log("Race chosen!");
+ });
+
+}
+// << dialog-alert-ts
diff --git a/app/ns-ui-widgets-category/dialogs/alert/alert-ts-page.xml b/app/ns-ui-widgets-category/dialogs/alert-dialog/alert-ts-page.xml
similarity index 100%
rename from app/ns-ui-widgets-category/dialogs/alert/alert-ts-page.xml
rename to app/ns-ui-widgets-category/dialogs/alert-dialog/alert-ts-page.xml
diff --git a/app/ns-ui-widgets-category/dialogs/alert-dialog/article.md b/app/ns-ui-widgets-category/dialogs/alert-dialog/article.md
new file mode 100644
index 0000000..0924821
--- /dev/null
+++ b/app/ns-ui-widgets-category/dialogs/alert-dialog/article.md
@@ -0,0 +1,3 @@
+An Alert Dialog will notify the user for an action that has happened. It can be defined as:
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/dialogs/alert/alert-page.js b/app/ns-ui-widgets-category/dialogs/alert/alert-page.js
deleted file mode 100644
index 1b575a5..0000000
--- a/app/ns-ui-widgets-category/dialogs/alert/alert-page.js
+++ /dev/null
@@ -1,27 +0,0 @@
-exports.onNavigatedTo = function (args) {
- /*
- // >> dialog-alert-web
- alert("Your message").then(() => {
- console.log("Dialog closed!");
- });
- // << dialog-alert-web
- */
-
- showAlertDialog();
-};
-
-function showAlertDialog() {
- // >> dialog-alert
- const alertOptions = {
- title: "Your Title",
- message: "Your message",
- okButtonText: "OK",
- cancelable: false // [Android only] Gets or sets if the dialog can be canceled by taping outside of the dialog.
- };
-
- alert(alertOptions).then(() => {
- console.log("Dialog closed!");
- });
- // << dialog-alert
-}
-exports.showAlertDialog = showAlertDialog;
diff --git a/app/ns-ui-widgets-category/dialogs/alert/alert-ts-page.ts b/app/ns-ui-widgets-category/dialogs/alert/alert-ts-page.ts
deleted file mode 100644
index c2a889e..0000000
--- a/app/ns-ui-widgets-category/dialogs/alert/alert-ts-page.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import { alert, AlertOptions } from "tns-core-modules/ui/dialogs";
-
-export function onNavigatedTo(args) {
- /*
- // >> dialog-alert-web-ts
- alert("Your message").then(() => {
- console.log("Dialog closed!");
- });
- // << dialog-alert-web-ts
- */
-
- showAlertDialog();
-}
-
-export function showAlertDialog() {
- // >> dialog-alert-ts
- // import { AlertOptions } from "tns-core-modules/ui/dialogs";
- const alertOptions: AlertOptions = {
- title: "Your Title",
- message: "Your message",
- okButtonText: "OK",
- cancelable: false // [Android only] Gets or sets if the dialog can be canceled by taping outside of the dialog.
- };
-
- alert(alertOptions).then(() => {
- console.log("Dialog closed!");
- });
- // << dialog-alert-ts
-}
diff --git a/app/ns-ui-widgets-category/dialogs/alert/article.md b/app/ns-ui-widgets-category/dialogs/alert/article.md
deleted file mode 100644
index 07a7a15..0000000
--- a/app/ns-ui-widgets-category/dialogs/alert/article.md
+++ /dev/null
@@ -1,11 +0,0 @@
-An Alert Dialog will notify the user for an action that has happened.
-The `alert` method accepts string value to be displayed as the alert message or `AlertOptions` object
-with keys `title`, `message`, `okBUttonText`, and `cancelable`(Android only property).
-
-Alert with string message (Web browser style).
-
-
-
-Alert with `AlertOptions` object.
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/dialogs/confirm-dialog/article.md b/app/ns-ui-widgets-category/dialogs/confirm-dialog/article.md
new file mode 100644
index 0000000..e47c730
--- /dev/null
+++ b/app/ns-ui-widgets-category/dialogs/confirm-dialog/article.md
@@ -0,0 +1,3 @@
+A Confirm Dialog will expect the user to accept or reject the action that is about the happen. For example:
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/dialogs/confirm-dialog/confirm-page.js b/app/ns-ui-widgets-category/dialogs/confirm-dialog/confirm-page.js
new file mode 100644
index 0000000..d740553
--- /dev/null
+++ b/app/ns-ui-widgets-category/dialogs/confirm-dialog/confirm-page.js
@@ -0,0 +1,17 @@
+// >> dialog-confirm
+export function showConfirmDialog() {
+
+ const confirmOptions = {
+ title: "Race selection",
+ message: "Are you sure you want to be a Unicorn?",
+ okButtonText: "Yes",
+ cancelButtonText: "No",
+ neutralButtonText: "Cancel"
+ };
+ confirm(confirmOptions)
+ .then((result) => {
+ console.log(result);
+ });
+
+}
+// << dialog-confirm
diff --git a/app/ns-ui-widgets-category/dialogs/confirm/confirm-page.xml b/app/ns-ui-widgets-category/dialogs/confirm-dialog/confirm-page.xml
similarity index 71%
rename from app/ns-ui-widgets-category/dialogs/confirm/confirm-page.xml
rename to app/ns-ui-widgets-category/dialogs/confirm-dialog/confirm-page.xml
index 2e2eaf2..81b28e9 100644
--- a/app/ns-ui-widgets-category/dialogs/confirm/confirm-page.xml
+++ b/app/ns-ui-widgets-category/dialogs/confirm-dialog/confirm-page.xml
@@ -1,4 +1,4 @@
-
+
diff --git a/app/ns-ui-widgets-category/dialogs/confirm-dialog/confirm-ts-page.ts b/app/ns-ui-widgets-category/dialogs/confirm-dialog/confirm-ts-page.ts
new file mode 100644
index 0000000..e4c494a
--- /dev/null
+++ b/app/ns-ui-widgets-category/dialogs/confirm-dialog/confirm-ts-page.ts
@@ -0,0 +1,19 @@
+// >> dialog-confirm-ts
+import { confirm, ConfirmOptions } from "@nativescript/core";
+
+export function showConfirmDialog() {
+
+ const confirmOptions: ConfirmOptions = {
+ title: "Race selection",
+ message: "Are you sure you want to be a Unicorn?",
+ okButtonText: "Yes",
+ cancelButtonText: "No",
+ neutralButtonText: "Cancel"
+ };
+ confirm(confirmOptions)
+ .then((result) => {
+ console.log(result);
+ });
+
+}
+// << dialog-confirm-ts
diff --git a/app/ns-ui-widgets-category/dialogs/confirm/confirm-ts-page.xml b/app/ns-ui-widgets-category/dialogs/confirm-dialog/confirm-ts-page.xml
similarity index 71%
rename from app/ns-ui-widgets-category/dialogs/confirm/confirm-ts-page.xml
rename to app/ns-ui-widgets-category/dialogs/confirm-dialog/confirm-ts-page.xml
index 2e2eaf2..9afe5a7 100644
--- a/app/ns-ui-widgets-category/dialogs/confirm/confirm-ts-page.xml
+++ b/app/ns-ui-widgets-category/dialogs/confirm-dialog/confirm-ts-page.xml
@@ -1,4 +1,4 @@
-
+
diff --git a/app/ns-ui-widgets-category/dialogs/confirm/article.md b/app/ns-ui-widgets-category/dialogs/confirm/article.md
deleted file mode 100644
index 1277c37..0000000
--- a/app/ns-ui-widgets-category/dialogs/confirm/article.md
+++ /dev/null
@@ -1,9 +0,0 @@
-A Confirm Dialog will expect the user to accept or reject the action that is about the happen.
-
-Confirm with parameters (Web browser style).
-
-
-
-Confirm with `ConfirmOptions` object.
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/dialogs/confirm/confirm-page.js b/app/ns-ui-widgets-category/dialogs/confirm/confirm-page.js
deleted file mode 100644
index fb1b80b..0000000
--- a/app/ns-ui-widgets-category/dialogs/confirm/confirm-page.js
+++ /dev/null
@@ -1,29 +0,0 @@
-exports.onNavigatedTo = function (args) {
- /*
- // >> dialog-confirm-web
- confirm("Your message").then((result) => {
- console.log("Dialog result: ", result);
- });
- // << dialog-confirm-web
- */
-
- showConfirmDialog();
-};
-
-function showConfirmDialog() {
- // >> dialog-confirm
- const confirmOptions = {
- title: "Your title",
- message: "Your message",
- okButtonText: "Ok",
- cancelButtonText: "Cancel",
- neutralButtonText: "Neutral"
- };
- confirm(confirmOptions)
- .then((result) => {
- // result can be true/false/undefined
- console.log(result);
- });
- // << dialog-confirm
-}
-exports.showConfirmDialog = showConfirmDialog;
diff --git a/app/ns-ui-widgets-category/dialogs/confirm/confirm-ts-page.ts b/app/ns-ui-widgets-category/dialogs/confirm/confirm-ts-page.ts
deleted file mode 100644
index 44c5661..0000000
--- a/app/ns-ui-widgets-category/dialogs/confirm/confirm-ts-page.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import { confirm, ConfirmOptions } from "tns-core-modules/ui/dialogs";
-
-export function onNavigatedTo(args) {
- /*
- // >> dialog-confirm-web-ts
- confirm("Your message").then((result) => {
- console.log("Dialog result: ", result);
- });
- // << dialog-confirm-web-ts
- */
-
- showConfirmDialog();
-}
-
-export function showConfirmDialog() {
- // >> dialog-confirm-ts
- // import { confirm, ConfirmOptions } from "tns-core-modules/ui/dialogs";
- const confirmOptions: ConfirmOptions = {
- title: "Your title",
- message: "Your message",
- okButtonText: "Ok",
- cancelButtonText: "Cancel",
- neutralButtonText: "Neutral"
- };
- confirm(confirmOptions)
- .then((result) => {
- // result can be true/false/undefined
- console.log(result);
- });
- // << dialog-confirm-ts
-}
diff --git a/app/ns-ui-widgets-category/dialogs/dialogs-page.js b/app/ns-ui-widgets-category/dialogs/dialogs-page.js
index ee24ac5..842248d 100644
--- a/app/ns-ui-widgets-category/dialogs/dialogs-page.js
+++ b/app/ns-ui-widgets-category/dialogs/dialogs-page.js
@@ -1,21 +1,21 @@
-const ListViewLinksModel = require("../../links-view-model");
-const link = require("../../link");
+import ListViewLinksModel from "../../links-view-model";
+import Link from "../../link";
const navigationLinks = [
- new link("Alert", "ns-ui-widgets-category/dialogs/alert/alert-page"),
- new link("Action", "ns-ui-widgets-category/dialogs/action/action-page"),
- new link("Confirm", "ns-ui-widgets-category/dialogs/confirm/confirm-page"),
- new link("Login", "ns-ui-widgets-category/dialogs/login/login-page"),
- new link("Prompt", "ns-ui-widgets-category/dialogs/prompt/prompt-page")
+ new Link("Alert", "ns-ui-widgets-category/dialogs/alert-dialog/alert-page"),
+ new Link("Action", "ns-ui-widgets-category/dialogs/action-dialog/action-page"),
+ new Link("Confirm", "ns-ui-widgets-category/dialogs/confirm-dialog/confirm-page"),
+ new Link("Login", "ns-ui-widgets-category/dialogs/login-dialog/login-page"),
+ new Link("Prompt", "ns-ui-widgets-category/dialogs/prompt-dialog/prompt-page")
];
const navigationLinksTsc = [
- new link("Alert", "ns-ui-widgets-category/dialogs/alert/alert-ts-page"),
- new link("Action", "ns-ui-widgets-category/dialogs/action/action-ts-page"),
- new link("Confirm", "ns-ui-widgets-category/dialogs/confirm/confirm-ts-page"),
- new link("Login", "ns-ui-widgets-category/dialogs/login/login-ts-page"),
- new link("Prompt", "ns-ui-widgets-category/dialogs/prompt/prompt-ts-page")
+ new Link("Alert", "ns-ui-widgets-category/dialogs/alert-dialog/alert-ts-page"),
+ new Link("Action", "ns-ui-widgets-category/dialogs/action-dialog/action-ts-page"),
+ new Link("Confirm", "ns-ui-widgets-category/dialogs/confirm-dialog/confirm-ts-page"),
+ new Link("Login", "ns-ui-widgets-category/dialogs/login-dialog/login-ts-page"),
+ new Link("Prompt", "ns-ui-widgets-category/dialogs/prompt-dialog/prompt-ts-page")
];
-function onNavigatingTo(args) {
+export function onNavigatingTo(args) {
const page = args.object;
page.bindingContext = new ListViewLinksModel({
links: navigationLinks,
@@ -24,4 +24,4 @@ function onNavigatingTo(args) {
tsclinks: navigationLinksTsc
});
}
-exports.onNavigatingTo = onNavigatingTo;
+
diff --git a/app/ns-ui-widgets-category/dialogs/end.md b/app/ns-ui-widgets-category/dialogs/end.md
index 3b21a34..b081630 100644
--- a/app/ns-ui-widgets-category/dialogs/end.md
+++ b/app/ns-ui-widgets-category/dialogs/end.md
@@ -1,12 +1,108 @@
+## Properties
-**API Reference for the** [Dialogs module](https://docs.nativescript.org/api-reference/modules/_ui_dialogs_)
+### Action Dialog Propeties
-**API Reference for the** [ActionOptions interface](https://docs.nativescript.org/api-reference/interfaces/_ui_dialogs_.actionoptions)
+| Name | Type | Description |
+|----------|-----------|----------------|
+| `title` | `string` | Gets or sets the dialog title. |
+| `message`| `string` | Gets or sets the dialog message. |
+| `cancelable`| `boolean` | *_[Android only]_* Gets or sets if the dialog can be canceled by taping outside of the dialog. |
+| `actions` | `Array` | Gets or sets the list of available actions. |
+| `cancelButtonText`| `string` | Gets or sets the Cancel button text. |
-**API Reference for the** [AlertOptions interface](https://docs.nativescript.org/api-reference/interfaces/_ui_dialogs_.alertoptions)
+### Alert Dialog Properties
-**API Reference for the** [ConfirmOptions interface](https://docs.nativescript.org/api-reference/interfaces/_ui_dialogs_.confirmoptions)
+| Name | Type | Description |
+|----------|-----------|----------------|
+| `title` | `string` | Gets or sets the dialog title. |
+| `message`| `string` | Gets or sets the dialog message. |
+| `cancelable`| `boolean` | *_[Android only]_* Gets or sets if the dialog can be canceled by taping outside of the dialog. |
+| `okButtonText` | `string` | Gets or sets the OK button text. |
-**API Reference for the** [LoginOptions interface](https://docs.nativescript.org/api-reference/interfaces/_ui_dialogs_.loginoptions)
+### Confirm Dialog Properties
+
+| Name | Type | Description |
+|----------|-----------|----------------|
+| `title` | `string` | Gets or sets the dialog title. |
+| `message`| `string` | Gets or sets the dialog message. |
+| `cancelable`| `boolean` | *_[Android only]_* Gets or sets if the dialog can be canceled by taping outside of the dialog. |
+| `cancelButtonText`| `string` | Gets or sets the Cancel button text. |
+| `okButtonText` | `string` | Gets or sets the OK button text. |
+| `neutralButtonText` | `string` | Gets or sets the neutral button text.|
+
+
+### Login Dialog Properties
+
+| Name | Type | Description |
+|----------|-----------|----------------|
+| `title` | `string` | Gets or sets the dialog title. |
+| `message`| `string` | Gets or sets the dialog message. |
+| `cancelable`| `boolean` | *_[Android only]_* Gets or sets if the dialog can be canceled by taping outside of the dialog. |
+| `cancelButtonText`| `string` | Gets or sets the Cancel button text. |
+| `okButtonText` | `string` | Gets or sets the OK button text. |
+| `neutralButtonText` | `string` | Gets or sets the neutral button text.|
+| `userName`| `string` | Gets or sets the default text to display in the username input box. |
+| `userNameHint`| `string` | Gets or sets the default text to display as hint in the username input box. |
+| `password`| `string` | Gets or sets the default text to display in the password input box. |
+| `passwordHint`| `string` | Gets or sets the default text to display as hint in the password input box. |
+
+### Login Dialog Result Properties
+
+The result are received in the dialog resolved promise after the user closes or dismisses the dialog.
+
+| Name | Type | Description |
+|----------|-----------|----------------|
+| `userName`| `string` | Gets the username entered in the login dialog. |
+| `password`| `string` | Gets the password entered in the login dialog. |
+| `result` | `boolean` | Returns `false` when the dialog is dismissed. Otherwise returns `true` |
+
+### Prompt Dialog Properties
+
+| Name | Type | Description |
+|----------|-----------|----------------|
+| `title` | `string` | Gets or sets the dialog title. |
+| `message`| `string` | Gets or sets the dialog message. |
+| `cancelable`| `boolean` | *_[Android only]_* Gets or sets if the dialog can be canceled by taping outside of the dialog. |
+| `cancelButtonText`| `string` | Gets or sets the Cancel button text. |
+| `okButtonText` | `string` | Gets or sets the OK button text. |
+| `neutralButtonText` | `string` | Gets or sets the neutral button text.|
+| `defaultText`| `string` | Gets or sets the default text to display in the input box. |
+| `capitalizationType` | `string` | Gets or sets the prompt capitalizationType (none, all, sentences, or words). |
+| `inputType` | `string` | Gets or sets the prompt input type (plain text, password, or email). |
+
+### Prompt Dialog Result Properties
+
+The result are received in the dialog resolved promise after the user closes or dismisses the dialog.
+
+| Name | Type | Description |
+|----------|-----------|----------------|
+| `text`| `string` | Gets the text entered in the prompt dialog input field. |
+| `result` | `boolean` | Returns `false` when the dialog is dismissed. Otherwise returns `true` |
+
+## Events
+
+No applicable events are present. The dialogs are using promises to return results.
+
+## API References
+
+| Name | Type | API Reference Link |
+|----------|---------|--------------------|
+| [tns-core-modules/ui/dialogs](https://docs.nativescript.org/api-reference/modules/_ui_dialogs_) | `Module` |
+| [action](https://docs.nativescript.org/api-reference/modules/_ui_dialogs_#action) | `function` |
+| [ActionOptions](https://docs.nativescript.org/api-reference/interfaces/_ui_dialogs_.actionoptions) | `interface` |
+| [alert](https://docs.nativescript.org/api-reference/modules/_ui_dialogs_#alert) | `function` |
+| [AlertOptions](https://docs.nativescript.org/api-reference/interfaces/_ui_dialogs_.alertoptions) | `interface` |
+| [confirm](https://docs.nativescript.org/api-reference/modules/_ui_dialogs_#confirm) | `function` |
+| [ConfirmOptions](https://docs.nativescript.org/api-reference/interfaces/_ui_dialogs_.confirmoptions) | `interface` |
+| [login](https://docs.nativescript.org/api-reference/modules/_ui_dialogs_#login) | `function` |
+| [LoginOptions](https://docs.nativescript.org/api-reference/interfaces/_ui_dialogs_.loginoptions) | `interface` |
+| [LoginResults](https://docs.nativescript.org/api-reference/interfaces/_ui_dialogs_.loginresult) | `interface` |
+| [prompt](https://docs.nativescript.org/api-reference/modules/_ui_dialogs_#prompt) | `function` |
+| [PromptOptions](https://docs.nativescript.org/api-reference/interfaces/_ui_dialogs_.promptoptions) | `interface` |
+
+## Native Component
+
+| Android | iOS |
+|:----------------------|:---------|
+| [android.app.AlertDialog.Builder](https://developer.android.com/reference/android/app/AlertDialog.Builder) | [UIAlertController](https://developer.apple.com/documentation/uikit/uialertcontroller) |
-**API Reference for the** [PromptOptions interface](https://docs.nativescript.org/api-reference/interfaces/_ui_dialogs_.promptoptions)
diff --git a/app/ns-ui-widgets-category/dialogs/login-dialog/article.md b/app/ns-ui-widgets-category/dialogs/login-dialog/article.md
new file mode 100644
index 0000000..6127735
--- /dev/null
+++ b/app/ns-ui-widgets-category/dialogs/login-dialog/article.md
@@ -0,0 +1,3 @@
+A Login Dialog will wait for the user to input their credentials:
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/dialogs/login-dialog/login-page.js b/app/ns-ui-widgets-category/dialogs/login-dialog/login-page.js
new file mode 100644
index 0000000..4201c06
--- /dev/null
+++ b/app/ns-ui-widgets-category/dialogs/login-dialog/login-page.js
@@ -0,0 +1,20 @@
+// >> dialog-login
+export function showLoginDialog() {
+
+ const loginOptions = {
+ title: "Login Form",
+ message: "Enter your credentials",
+ okButtonText: "Login",
+ cancelButtonText: "Cancel",
+ neutralButtonText: "Neutral",
+ userNameHint: "Enter your username",
+ passwordHint: "Enter your password",
+ userName: "john_doe",
+ password: "123456"
+ };
+ login(loginOptions).then((loginResult) => {
+ console.log(loginResult.result);
+ });
+
+}
+// << dialog-login
diff --git a/app/ns-ui-widgets-category/dialogs/login/login-page.xml b/app/ns-ui-widgets-category/dialogs/login-dialog/login-page.xml
similarity index 71%
rename from app/ns-ui-widgets-category/dialogs/login/login-page.xml
rename to app/ns-ui-widgets-category/dialogs/login-dialog/login-page.xml
index fc1e7bf..3fc2f73 100644
--- a/app/ns-ui-widgets-category/dialogs/login/login-page.xml
+++ b/app/ns-ui-widgets-category/dialogs/login-dialog/login-page.xml
@@ -1,4 +1,4 @@
-
+
diff --git a/app/ns-ui-widgets-category/dialogs/login-dialog/login-ts-page.ts b/app/ns-ui-widgets-category/dialogs/login-dialog/login-ts-page.ts
new file mode 100644
index 0000000..c1fa799
--- /dev/null
+++ b/app/ns-ui-widgets-category/dialogs/login-dialog/login-ts-page.ts
@@ -0,0 +1,22 @@
+// >> dialog-login-ts
+import { login, LoginOptions, LoginResult } from "@nativescript/core";
+
+export function showLoginDialog() {
+
+ const loginOptions: LoginOptions = {
+ title: "Login Form",
+ message: "Enter your credentials",
+ okButtonText: "Login",
+ cancelButtonText: "Cancel",
+ neutralButtonText: "Neutral",
+ userNameHint: "Enter your username",
+ passwordHint: "Enter your password",
+ userName: "john_doe",
+ password: "123456"
+ };
+ login(loginOptions).then((loginResult: LoginResult) => {
+ console.log(loginResult.result);
+ });
+
+}
+// << dialog-login-ts
diff --git a/app/ns-ui-widgets-category/dialogs/login/login-ts-page.xml b/app/ns-ui-widgets-category/dialogs/login-dialog/login-ts-page.xml
similarity index 71%
rename from app/ns-ui-widgets-category/dialogs/login/login-ts-page.xml
rename to app/ns-ui-widgets-category/dialogs/login-dialog/login-ts-page.xml
index fc1e7bf..3fc2f73 100644
--- a/app/ns-ui-widgets-category/dialogs/login/login-ts-page.xml
+++ b/app/ns-ui-widgets-category/dialogs/login-dialog/login-ts-page.xml
@@ -1,4 +1,4 @@
-
+
diff --git a/app/ns-ui-widgets-category/dialogs/login/article.md b/app/ns-ui-widgets-category/dialogs/login/article.md
deleted file mode 100644
index f16c4a3..0000000
--- a/app/ns-ui-widgets-category/dialogs/login/article.md
+++ /dev/null
@@ -1,9 +0,0 @@
-A Login Dialog will wait for the user to input their credentials.
-
-login with parameters (Web browser style).
-
-
-
-login with `ConfirmOptions` object.
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/dialogs/login/login-page.js b/app/ns-ui-widgets-category/dialogs/login/login-page.js
deleted file mode 100644
index 5305392..0000000
--- a/app/ns-ui-widgets-category/dialogs/login/login-page.js
+++ /dev/null
@@ -1,33 +0,0 @@
-exports.onNavigatedTo = function (args) {
- /*
- // >> dialog-login-web
- login("Your message", "Username", "Password").then((r) => {
- console.log("Dialog result: ", r.result);
- console.log(`User: ${r.userName} Password: ${r.password}`, r.userName, r.password);
- });
- // << dialog-login-web
- */
-
- showLoginDialog();
-};
-
-function showLoginDialog() {
- // >> dialog-login
- const loginOptions = {
- title: "Your title",
- message: "Your message",
- okButtonText: "Login",
- cancelButtonText: "Cancel",
- neutralButtonText: "Neutral",
- userNameHint: "Enter your username",
- passwordHint: "Enter your password",
- userName: "Username",
- password: "Password"
- };
- login(loginOptions).then((r) => {
- console.log("Dialog result: ", r.result);
- console.log(`User: ${r.userName} Password: ${r.password}`, r.userName, r.password);
- });
- // << dialog-login
-}
-exports.showLoginDialog = showLoginDialog;
diff --git a/app/ns-ui-widgets-category/dialogs/login/login-ts-page.ts b/app/ns-ui-widgets-category/dialogs/login/login-ts-page.ts
deleted file mode 100644
index 10a8c45..0000000
--- a/app/ns-ui-widgets-category/dialogs/login/login-ts-page.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-import { EventData } from "tns-core-modules/data/observable";
-import { login, LoginOptions } from "tns-core-modules/ui/dialogs";
-
-export function onNavigatedTo(args) {
- /*
- // >> dialog-login-web-ts
- login("Your message", "Username", "Password").then((r) => {
- console.log("Dialog result: ", r.result);
- console.log(`User: ${r.userName} Password: ${r.password}`, r.userName, r.password);
- });
- // << dialog-login-web-ts
- */
-
- showLoginDialog();
-}
-
-export function showLoginDialog() {
- // >> dialog-login-ts
- // import { login, LoginOptions } from "tns-core-modules/ui/dialogs";
- const loginOptions: LoginOptions = {
- title: "Your title",
- message: "Your message",
- okButtonText: "Login",
- cancelButtonText: "Cancel",
- neutralButtonText: "Neutral",
- userNameHint: "Enter your username",
- passwordHint: "Enter your password",
- userName: "Username",
- password: "Password"
- };
- login(loginOptions).then((r) => {
- console.log("Dialog result: ", r.result);
- console.log(`User: ${r.userName} Password: ${r.password}`, r.userName, r.password);
- });
- // << dialog-login-ts
-}
diff --git a/app/ns-ui-widgets-category/dialogs/metadata.md b/app/ns-ui-widgets-category/dialogs/metadata.md
index be4b3dc..a693509 100644
--- a/app/ns-ui-widgets-category/dialogs/metadata.md
+++ b/app/ns-ui-widgets-category/dialogs/metadata.md
@@ -4,3 +4,4 @@ description: The Dialog module provides a functionality, which allows creating d
position: 220
slug: dialogs
---
+example-order: alert-dialog, action-dialog, confirm-dialog, login-dialog, prompt-dialog
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/dialogs/overview.md b/app/ns-ui-widgets-category/dialogs/overview.md
index b5802c5..8b96a11 100644
--- a/app/ns-ui-widgets-category/dialogs/overview.md
+++ b/app/ns-ui-widgets-category/dialogs/overview.md
@@ -1,8 +1,2 @@
-NativeScript lets us create dialogs in your app in a manner similar to the web browser.
-We can create alerts, confirmations, prompts, logins and dialogs that require action.
-The module `tns-core-modules/ui/dialogs` is loaded globally in every NativeScript application so
-there is no need for explicit require/import of the module.
-
-> **NOTE**: You can call dialog functions with parameters similar to the web browser API or the `options` object. All dialog functions return a `Promise` object. **In both iOS and Android, dialogs will not block your code execution!**
-
-> **TIP**: You can try [this NativeScript Playground project](https://play.nativescript.org/?template=play-ng&id=dWQhV7) to see all of this article’s examples in action on your device.
\ No newline at end of file
+NativeScript lets you create dialogs in your app in a manner similar to the web browser.
+You can create alerts, confirmations, prompts, logins and dialogs that require action.
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/dialogs/prompt-dialog/article.md b/app/ns-ui-widgets-category/dialogs/prompt-dialog/article.md
new file mode 100644
index 0000000..1be93c5
--- /dev/null
+++ b/app/ns-ui-widgets-category/dialogs/prompt-dialog/article.md
@@ -0,0 +1,3 @@
+A Prompt Dialog will request for an input. A basic definition might be:
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/dialogs/prompt-dialog/prompt-page.js b/app/ns-ui-widgets-category/dialogs/prompt-dialog/prompt-page.js
new file mode 100644
index 0000000..10ce205
--- /dev/null
+++ b/app/ns-ui-widgets-category/dialogs/prompt-dialog/prompt-page.js
@@ -0,0 +1,20 @@
+// >> dialog-prompt
+export function showPromptDialog() {
+
+ const promptOptions = {
+ title: "Hey There",
+ defaultText: " Enter your mood ",
+ message: "How you doin'",
+ okButtonText: "OK",
+ cancelButtonText: "Cancel",
+ neutralButtonText: "Neutral",
+ cancelable: true,
+ inputType: "text", // email, number, text, password, or email
+ capitalizationType: "sentences" // all, none, sentences or words
+ };
+ prompt(promptOptions).then((result) => {
+ console.log(`Hello, ${result.text}`);
+ });
+
+}
+// << dialog-prompt
diff --git a/app/ns-ui-widgets-category/dialogs/prompt/prompt-page.xml b/app/ns-ui-widgets-category/dialogs/prompt-dialog/prompt-page.xml
similarity index 71%
rename from app/ns-ui-widgets-category/dialogs/prompt/prompt-page.xml
rename to app/ns-ui-widgets-category/dialogs/prompt-dialog/prompt-page.xml
index 739489a..e8261b2 100644
--- a/app/ns-ui-widgets-category/dialogs/prompt/prompt-page.xml
+++ b/app/ns-ui-widgets-category/dialogs/prompt-dialog/prompt-page.xml
@@ -1,4 +1,4 @@
-
+
diff --git a/app/ns-ui-widgets-category/dialogs/prompt-dialog/prompt-ts-page.ts b/app/ns-ui-widgets-category/dialogs/prompt-dialog/prompt-ts-page.ts
new file mode 100644
index 0000000..cc31f2b
--- /dev/null
+++ b/app/ns-ui-widgets-category/dialogs/prompt-dialog/prompt-ts-page.ts
@@ -0,0 +1,22 @@
+// >> dialog-prompt-ts
+import { prompt, PromptOptions, PromptResult, capitalizationType, inputType } from "@nativescript/core";
+
+export function showPromptDialog() {
+
+ const promptOptions: PromptOptions = {
+ title: "Hey There",
+ defaultText: " Enter your mood ",
+ message: "How you doin'",
+ okButtonText: "OK",
+ cancelButtonText: "Cancel",
+ neutralButtonText: "Neutral",
+ cancelable: true,
+ inputType: inputType.text, // email, number, text, password, or email
+ capitalizationType: capitalizationType.sentences // all. none, sentences or words
+ };
+ prompt(promptOptions).then((result: PromptResult) => {
+ console.log("Hello, " + result.text);
+ });
+
+}
+// << dialog-prompt-ts
diff --git a/app/ns-ui-widgets-category/dialogs/prompt/prompt-ts-page.xml b/app/ns-ui-widgets-category/dialogs/prompt-dialog/prompt-ts-page.xml
similarity index 71%
rename from app/ns-ui-widgets-category/dialogs/prompt/prompt-ts-page.xml
rename to app/ns-ui-widgets-category/dialogs/prompt-dialog/prompt-ts-page.xml
index 739489a..cf28a13 100644
--- a/app/ns-ui-widgets-category/dialogs/prompt/prompt-ts-page.xml
+++ b/app/ns-ui-widgets-category/dialogs/prompt-dialog/prompt-ts-page.xml
@@ -1,4 +1,4 @@
-
+
diff --git a/app/ns-ui-widgets-category/dialogs/prompt/article.md b/app/ns-ui-widgets-category/dialogs/prompt/article.md
deleted file mode 100644
index 3150cf6..0000000
--- a/app/ns-ui-widgets-category/dialogs/prompt/article.md
+++ /dev/null
@@ -1,9 +0,0 @@
-A Prompt Dialog will request for an input.
-
-Prompt with parameters (Web browser style).
-
-
-
-Prompt with `ConfirmOptions` object.
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/dialogs/prompt/prompt-page.js b/app/ns-ui-widgets-category/dialogs/prompt/prompt-page.js
deleted file mode 100644
index 3444391..0000000
--- a/app/ns-ui-widgets-category/dialogs/prompt/prompt-page.js
+++ /dev/null
@@ -1,32 +0,0 @@
-exports.onNavigatedTo = function (args) {
- /*
- // >> dialog-prompt-web
- prompt("Your message", "Default text").then((r) => {
- console.log("Dialog result: ", r.result);
- console.log("Text: ", r.text);
- });
- // << dialog-prompt-web
- */
-
- showPromptDialog();
-};
-
-function showPromptDialog() {
- // >> dialog-prompt
- const promptOptions = {
- title: "Your title",
- message: "Your message",
- okButtonText: "Ok",
- cancelButtonText: "Cancel",
- neutralButtonText: "Neutral",
- defaultText: "Default",
- inputType: "text", // email, number, text, password, or email
- capitalizationType: "sentences" // all, none, sentences or words
- };
- prompt(promptOptions).then((r) => {
- console.log("Dialog result: ", r.result);
- console.log("Text: ", r.text);
- });
- // << dialog-prompt
-}
-exports.showPromptDialog = showPromptDialog;
diff --git a/app/ns-ui-widgets-category/dialogs/prompt/prompt-ts-page.ts b/app/ns-ui-widgets-category/dialogs/prompt/prompt-ts-page.ts
deleted file mode 100644
index ec27055..0000000
--- a/app/ns-ui-widgets-category/dialogs/prompt/prompt-ts-page.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-import { prompt, PromptOptions, PromptResult, capitalizationType, inputType } from "tns-core-modules/ui/dialogs";
-export function onNavigatedTo(args) {
- /*
- // >> dialog-prompt-web-ts
- prompt("Your message", "Default text").then((r) => {
- console.log("Dialog result: ", r.result);
- console.log("Text: ", r.text);
- });
- // << dialog-prompt-web-ts
- */
-
- showPromptDialog();
-}
-
-export function showPromptDialog() {
- // >> dialog-prompt-ts
- // import { prompt, PromptOptions, PromptResult, capitalizationType, inputType } from "tns-core-modules/ui/dialogs";
- const promptOptions: PromptOptions = {
- title: "Your title",
- message: "Your message",
- okButtonText: "Ok",
- cancelButtonText: "Cancel",
- neutralButtonText: "Neutral",
- defaultText: "Default",
- inputType: inputType.text, // email, number, text, password, or email
- capitalizationType: capitalizationType.sentences // all. none, sentences or words
- };
- prompt(promptOptions).then((r: PromptResult) => {
- console.log("Dialog result: ", r.result);
- console.log("Text: ", r.text);
- });
- // << dialog-prompt-ts
-}
diff --git a/app/ns-ui-widgets-category/formatted-string/basics/article.md b/app/ns-ui-widgets-category/formatted-string/basics/article.md
deleted file mode 100644
index 9d234ef..0000000
--- a/app/ns-ui-widgets-category/formatted-string/basics/article.md
+++ /dev/null
@@ -1,13 +0,0 @@
-NativeScript has a special class called [FormattedString](http://docs.nativescript.org/api-reference/classes/_text_formatted_string_.formattedstring.html) to support various text transformations and decorations. The `FormattedString` class can be used with all text-related components like Label, TextView, TextField and even Button.
-
-Label with formatted string
-
-
-TextField with formatted string
-
-
-TextView with formatted string
-
-
-Button with formatted string
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/formatted-string/basics/basics-page.xml b/app/ns-ui-widgets-category/formatted-string/basics/basics-page.xml
deleted file mode 100644
index 6664b11..0000000
--- a/app/ns-ui-widgets-category/formatted-string/basics/basics-page.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/formatted-string/code-behind/article.md b/app/ns-ui-widgets-category/formatted-string/code-behind/article.md
deleted file mode 100644
index a478f9e..0000000
--- a/app/ns-ui-widgets-category/formatted-string/code-behind/article.md
+++ /dev/null
@@ -1,17 +0,0 @@
-`FormattedString`s could also be defined via code-behind.
-
-Label with formatted string
-
-
-
-TextField with formatted string
-
-
-
-TextView with formatted string
-
-
-
-Button with formatted string
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/formatted-string/code-behind/code-behind-page.js b/app/ns-ui-widgets-category/formatted-string/code-behind/code-behind-page.js
index 7aab7d0..acd13c6 100644
--- a/app/ns-ui-widgets-category/formatted-string/code-behind/code-behind-page.js
+++ b/app/ns-ui-widgets-category/formatted-string/code-behind/code-behind-page.js
@@ -1,12 +1,8 @@
-const Label = require("tns-core-modules/ui/label").Label;
-const Button = require("tns-core-modules/ui/button").Button;
-const TextField = require("tns-core-modules/ui/text-field").TextField;
-const TextView = require("tns-core-modules/ui/text-view").TextView;
+import { Button, Label, TextField, TextView } from "@nativescript/core";
// >> formatted-string-require
-const FormattedString = require("tns-core-modules/text/formatted-string").FormattedString;
-const Span = require("tns-core-modules/text/span").Span;
+import { FormattedString, Span } from "@nativescript/core";
// << formatted-string-require
-function onNavigatingTo(args) {
+export function onNavigatingTo(args) {
const page = args.object;
const container = page.getViewById("container");
// >> formatted-string-label-code
@@ -75,4 +71,4 @@ function onNavigatingTo(args) {
container.addChild(textField);
container.addChild(textView);
}
-exports.onNavigatingTo = onNavigatingTo;
+
diff --git a/app/ns-ui-widgets-category/formatted-string/code-behind/code-behind-ts-page.ts b/app/ns-ui-widgets-category/formatted-string/code-behind/code-behind-ts-page.ts
index 42a4436..035b03b 100644
--- a/app/ns-ui-widgets-category/formatted-string/code-behind/code-behind-ts-page.ts
+++ b/app/ns-ui-widgets-category/formatted-string/code-behind/code-behind-ts-page.ts
@@ -1,14 +1,14 @@
-import { EventData } from "tns-core-modules/data/observable";
-import { Button } from "tns-core-modules/ui/button";
-import { Label } from "tns-core-modules/ui/label";
-import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout";
-import { Page} from "tns-core-modules/ui/page";
-import { TextField } from "tns-core-modules/ui/text-field";
-import { TextView } from "tns-core-modules/ui/text-view";
-
+import {
+ Button,
+ EventData,
+ Label,
+ Page,
+ StackLayout,
+ TextField,
+ TextView
+} from "@nativescript/core";
// >> formatted-string-require-ts
-import { FormattedString, Span } from "tns-core-modules/text/formatted-string";
-// import { Span } from "tns-core-modules/text/span";
+import { FormattedString, Span } from "@nativescript/core";
// << formatted-string-require-ts
export function onNavigatingTo(args: EventData) {
const page = args.object;
diff --git a/app/ns-ui-widgets-category/formatted-string/end.md b/app/ns-ui-widgets-category/formatted-string/end.md
index 2cc2c41..3733010 100644
--- a/app/ns-ui-widgets-category/formatted-string/end.md
+++ b/app/ns-ui-widgets-category/formatted-string/end.md
@@ -1,2 +1,36 @@
+## Tips And Tricks
+
+### Creating Button via Code-Behind
+`FormattedString`s could also be defined via code-behind.
+
+Label with formatted string
+
+
+
+TextField with formatted string
+
+
+
+TextView with formatted string
+
+
+
+Button with formatted string
+
+
+
+## Properties
+
+| Name | Type | Description |
+|----------|---------|----------------|
+| `spans` | `ObservableArray` | An observable collection of Span objects used to define common text properties. |
+
+
+## API References
+
+| Name | Type | API Reference Link |
+|----------|---------|--------------------|
+| [tns-core-modules/text/formatted-string](http://docs.nativescript.org/api-reference/modules/_text_formatted_string_.html) | `Module` |
+| [Span](https://docs.nativescript.org/api-reference/modules/_ui_text_base_span_) | `Module` |
+| [ViewBase](https://docs.nativescript.org/api-reference/classes/_ui_core_view_base_.viewbase) | `Class` |
-**API Reference for the** [Formatted String](http://docs.nativescript.org/api-reference/modules/_text_formatted_string_.html)
diff --git a/app/ns-ui-widgets-category/formatted-string/formatted-string-page.js b/app/ns-ui-widgets-category/formatted-string/formatted-string-page.js
index e825b63..a2853fc 100644
--- a/app/ns-ui-widgets-category/formatted-string/formatted-string-page.js
+++ b/app/ns-ui-widgets-category/formatted-string/formatted-string-page.js
@@ -1,13 +1,13 @@
-const ListViewLinksModel = require("../../links-view-model");
-const link = require("../../link");
+import ListViewLinksModel from "../../links-view-model";
+import Link from "../../link";
const navigationLinks = [
- new link("Basics", "ns-ui-widgets-category/formatted-string/basics/basics-page"),
- new link("Code-Behind", "ns-ui-widgets-category/formatted-string/code-behind/code-behind-page")
+ new Link("Usage", "ns-ui-widgets-category/formatted-string/usage/usage-page"),
+ new Link("Code-Behind", "ns-ui-widgets-category/formatted-string/code-behind/code-behind-page")
];
const navigationLinksTsc = [
- new link("Code-Behind", "ns-ui-widgets-category/formatted-string/code-behind/code-behind-ts-page")
+ new Link("Code-Behind", "ns-ui-widgets-category/formatted-string/code-behind/code-behind-ts-page")
];
-function onNavigatingTo(args) {
+export function onNavigatingTo(args) {
const page = args.object;
page.bindingContext = new ListViewLinksModel({
links: navigationLinks,
@@ -16,4 +16,4 @@ function onNavigatingTo(args) {
tsclinks: navigationLinksTsc
});
}
-exports.onNavigatingTo = onNavigatingTo;
+
diff --git a/app/ns-ui-widgets-category/formatted-string/overview.md b/app/ns-ui-widgets-category/formatted-string/overview.md
index 1256384..5d6ad84 100644
--- a/app/ns-ui-widgets-category/formatted-string/overview.md
+++ b/app/ns-ui-widgets-category/formatted-string/overview.md
@@ -1,5 +1 @@
-
-NativeScript has a special class called FormattedString to support various text transformations and decorations. The FormattedString class can be used with all text-related components like Label, TextView, TextField and even Button.
-
-
-
\ No newline at end of file
+NativeScript has a special class called `FormattedString` to support various text transformations and decorations. The `FormattedString` class can be used with all text-related components like `Label`, `TextView`, `TextField` and even `Button`.
diff --git a/app/ns-ui-widgets-category/formatted-string/usage/article.md b/app/ns-ui-widgets-category/formatted-string/usage/article.md
new file mode 100644
index 0000000..9c99d85
--- /dev/null
+++ b/app/ns-ui-widgets-category/formatted-string/usage/article.md
@@ -0,0 +1,13 @@
+NativeScript has a special class called `FormattedString` to support various text transformations and decorations. The `FormattedString` class can be used with all text-related components like Label, TextView, TextField and even Button.
+
+Label with formatted string
+
+
+TextField with formatted string
+
+
+TextView with formatted string
+
+
+Button with formatted string
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/formatted-string/usage/usage-page.xml b/app/ns-ui-widgets-category/formatted-string/usage/usage-page.xml
new file mode 100644
index 0000000..a3af3c8
--- /dev/null
+++ b/app/ns-ui-widgets-category/formatted-string/usage/usage-page.xml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/ns-ui-widgets-category/frame/basic-navigation/article.md b/app/ns-ui-widgets-category/frame/basic-navigation/article.md
index 2fdbc03..ab06b12 100644
--- a/app/ns-ui-widgets-category/frame/basic-navigation/article.md
+++ b/app/ns-ui-widgets-category/frame/basic-navigation/article.md
@@ -1,6 +1,6 @@
### Default page
To load a default (initial) page in your application use the `defaultPage` property of the `Frame` element.
-With the example below the applicaiton will load a page located in `/app/home/first-page.xml`
+With the example below the application will load a page located in `/app/home/first-page.xml`
### Navigate by page name
@@ -13,7 +13,7 @@ The `navigate` method accepst [`NavigationEntry`](https://docs.nativescript.org/
-Full list of the NavigaitonEntry properties. Note that all of them are optional. Even the `moduleName` is optional, as alternatively you can pass a dynamically created page via `create`.
+Full list of the NavigationEntry properties. Note that all of them are optional. Even the `moduleName` is optional, as alternatively you can pass a dynamically created page via `create`.
- [animated](https://docs.nativescript.org/api-reference/interfaces/_ui_frame_.navigationentry#animated) - True to navigate to the new Page using animated transitions, false otherwise.
- [backstackVisible](https://docs.nativescript.org/api-reference/interfaces/_ui_frame_.navigationentry#backstackVisible) - True to record the navigation in the backstack, false otherwise. If the parameter is set to false then the Page will be displayed but once navigated from it will not be able to be navigated back to.
@@ -109,7 +109,7 @@ _custom-transition.ios.js/ts_
Each frame tracks the pages the user has visited in a navigation stack. To go back to a previous page,
you need to use the [`goBack`](https://docs.nativescript.org/api-reference/classes/_ui_frame_.frame#goback) method of the current frame instance.
-To veify that back navigation is possible, you can use the [`canGoBack`](https://docs.nativescript.org/api-reference/classes/_ui_frame_.frame#cangoback) boolean property.
+To verify that back navigation is possible, you can use the [`canGoBack`](https://docs.nativescript.org/api-reference/classes/_ui_frame_.frame#cangoback) boolean property.
-
\ No newline at end of file
+
diff --git a/app/ns-ui-widgets-category/frame/basic-navigation/navigation-page.xml b/app/ns-ui-widgets-category/frame/basic-navigation/navigation-page.xml
index 6d4f56b..fa4bdce 100644
--- a/app/ns-ui-widgets-category/frame/basic-navigation/navigation-page.xml
+++ b/app/ns-ui-widgets-category/frame/basic-navigation/navigation-page.xml
@@ -4,4 +4,6 @@
-
\ No newline at end of file
+
+
+
diff --git a/app/ns-ui-widgets-category/frame/basic-navigation/navigation-ts-page.xml b/app/ns-ui-widgets-category/frame/basic-navigation/navigation-ts-page.xml
index 83b739a..766950b 100644
--- a/app/ns-ui-widgets-category/frame/basic-navigation/navigation-ts-page.xml
+++ b/app/ns-ui-widgets-category/frame/basic-navigation/navigation-ts-page.xml
@@ -4,4 +4,6 @@
-
\ No newline at end of file
+
+
+
diff --git a/app/ns-ui-widgets-category/frame/dynamic-navigation/dynamic-navigation-page.js b/app/ns-ui-widgets-category/frame/dynamic-navigation/dynamic-navigation-page.js
index 0d0f1eb..35838b6 100644
--- a/app/ns-ui-widgets-category/frame/dynamic-navigation/dynamic-navigation-page.js
+++ b/app/ns-ui-widgets-category/frame/dynamic-navigation/dynamic-navigation-page.js
@@ -1,12 +1,8 @@
-const Page = require("tns-core-modules/ui/page").Page;
-const StackLayout = require("tns-core-modules/ui/layouts/stack-layout")
- .StackLayout;
-const Label = require("tns-core-modules/ui/label").Label;
-const getFrameById = require("tns-core-modules/ui/frame").getFrameById;
+import { Frame, Label, Page, StackLayout } from "@nativescript/core";
-exports.onLoaded = function() {
+export function onLoaded() {
// >> frame-nav-dynamic-page-code
- const frame = getFrameById("my-frame-id");
+ const frame = Frame.getFrameById("my-frame-id");
frame.navigate({
create: () => {
const stack = new StackLayout();
@@ -21,4 +17,4 @@ exports.onLoaded = function() {
}
});
// << frame-nav-dynamic-page-code
-};
+}
diff --git a/app/ns-ui-widgets-category/frame/dynamic-navigation/dynamic-navigation-page.xml b/app/ns-ui-widgets-category/frame/dynamic-navigation/dynamic-navigation-page.xml
index 9c6a84d..19b512e 100644
--- a/app/ns-ui-widgets-category/frame/dynamic-navigation/dynamic-navigation-page.xml
+++ b/app/ns-ui-widgets-category/frame/dynamic-navigation/dynamic-navigation-page.xml
@@ -2,4 +2,4 @@
-
\ No newline at end of file
+
diff --git a/app/ns-ui-widgets-category/frame/dynamic-navigation/dynamic-navigation-ts-page.ts b/app/ns-ui-widgets-category/frame/dynamic-navigation/dynamic-navigation-ts-page.ts
index 2cfe629..b2aeee7 100644
--- a/app/ns-ui-widgets-category/frame/dynamic-navigation/dynamic-navigation-ts-page.ts
+++ b/app/ns-ui-widgets-category/frame/dynamic-navigation/dynamic-navigation-ts-page.ts
@@ -1,11 +1,8 @@
-import { Page } from "tns-core-modules/ui/page";
-import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout";
-import { Label } from "tns-core-modules/ui/label";
-import { getFrameById } from "tns-core-modules/ui/frame";
+import { Frame, Label, Page, StackLayout } from "@nativescript/core";
export function onLoaded() {
// >> frame-nav-dynamic-page-ts-code
- const frame = getFrameById("my-frame-id");
+ const frame = Frame.getFrameById("my-frame-id");
frame.navigate({
create: () => {
diff --git a/app/ns-ui-widgets-category/frame/dynamic-navigation/dynamic-navigation-ts-page.xml b/app/ns-ui-widgets-category/frame/dynamic-navigation/dynamic-navigation-ts-page.xml
index 8768b04..ba1c3eb 100644
--- a/app/ns-ui-widgets-category/frame/dynamic-navigation/dynamic-navigation-ts-page.xml
+++ b/app/ns-ui-widgets-category/frame/dynamic-navigation/dynamic-navigation-ts-page.xml
@@ -2,4 +2,6 @@
-
\ No newline at end of file
+
+
+
diff --git a/app/ns-ui-widgets-category/frame/frame-page.js b/app/ns-ui-widgets-category/frame/frame-page.js
index f93e99c..84416b8 100644
--- a/app/ns-ui-widgets-category/frame/frame-page.js
+++ b/app/ns-ui-widgets-category/frame/frame-page.js
@@ -1,21 +1,21 @@
-const ListViewLinksModel = require("../../links-view-model");
-const link = require("../../link");
+import ListViewLinksModel from "../../links-view-model";
+import Link from "../../link";
const navigationLinks = [
- new link("Page Creation", "ns-ui-widgets-category/frame/frame-creation/frame-creation-page"),
- new link("Page Reference", "ns-ui-widgets-category/frame/frame-reference/frame-reference-page"),
- new link("Basic Navigation", "ns-ui-widgets-category/frame/basic-navigation/navigation-page"),
- new link("Dynamic Navigation", "ns-ui-widgets-category/frame/dynamic-navigation/dynamic-navigation-page"),
- new link("Navigation Context", "ns-ui-widgets-category/frame/navigation-context/navigation-context-page"),
- new link("ActionBar visibility", "ns-ui-widgets-category/frame/action-bar-visibility/actionbar-visibility-page")
+ new Link("Page Creation", "ns-ui-widgets-category/frame/frame-creation/frame-creation-page"),
+ new Link("Page Reference", "ns-ui-widgets-category/frame/frame-reference/frame-reference-page"),
+ new Link("Basic Navigation", "ns-ui-widgets-category/frame/basic-navigation/navigation-page"),
+ new Link("Dynamic Navigation", "ns-ui-widgets-category/frame/dynamic-navigation/dynamic-navigation-page"),
+ new Link("Navigation Context", "ns-ui-widgets-category/frame/navigation-context/navigation-context-page"),
+ new Link("ActionBar visibility", "ns-ui-widgets-category/frame/action-bar-visibility/actionbar-visibility-page")
];
const navigationLinksTsc = [
- new link("Page Creation", "ns-ui-widgets-category/frame/frame-creation/frame-creation-ts-page"),
- new link("Page Reference", "ns-ui-widgets-category/frame/frame-reference/frame-reference-ts-page"),
- new link("Basic Navigation", "ns-ui-widgets-category/frame/basic-navigation/navigation-ts-page"),
- new link("Dynamic Navigation", "ns-ui-widgets-category/frame/dynamic-navigation/dynamic-navigation-ts-page"),
- new link("Navigation Context", "ns-ui-widgets-category/frame/navigation-context/navigation-ts-context-page")
+ new Link("Page Creation", "ns-ui-widgets-category/frame/frame-creation/frame-creation-ts-page"),
+ new Link("Page Reference", "ns-ui-widgets-category/frame/frame-reference/frame-reference-ts-page"),
+ new Link("Basic Navigation", "ns-ui-widgets-category/frame/basic-navigation/navigation-ts-page"),
+ new Link("Dynamic Navigation", "ns-ui-widgets-category/frame/dynamic-navigation/dynamic-navigation-ts-page"),
+ new Link("Navigation Context", "ns-ui-widgets-category/frame/navigation-context/navigation-ts-context-page")
];
-function onNavigatingTo(args) {
+export function onNavigatingTo(args) {
const page = args.object;
page.bindingContext = new ListViewLinksModel({
links: navigationLinks,
@@ -24,4 +24,4 @@ function onNavigatingTo(args) {
tsclinks: navigationLinksTsc
});
}
-exports.onNavigatingTo = onNavigatingTo;
+
diff --git a/app/ns-ui-widgets-category/frame/frame-reference/frame-reference-page.js b/app/ns-ui-widgets-category/frame/frame-reference/frame-reference-page.js
index d9e13eb..afed0b8 100644
--- a/app/ns-ui-widgets-category/frame/frame-reference/frame-reference-page.js
+++ b/app/ns-ui-widgets-category/frame/frame-reference/frame-reference-page.js
@@ -1,22 +1,20 @@
// >> frame-reference-topmost
-const topmost = require("tns-core-modules/ui/frame").topmost;
+import { Frame } from "@nativescript/core";
-const topmostFrame = topmost();
+const topmostFrame = Frame.topmost();
// << frame-reference-topmost
// >> frame-reference-get-id
-const getFrameById = require("tns-core-modules/ui/frame").getFrameById;
-const currentFrame = getFrameById("root-frame");
+const currentFrame = Frame.getFrameById("root-frame");
// << frame-reference-get-id
// >> frame-reference-via-frame-prop
-function onTap(args) {
+export function onTap(args) {
const button = args.object;
const page = button.page;
const myFrame = page.frame;
myFrame.navigate("secondary-page");
}
-exports.onTap = onTap;
// << frame-reference-via-frame-prop
diff --git a/app/ns-ui-widgets-category/frame/frame-reference/frame-reference-ts-page.ts b/app/ns-ui-widgets-category/frame/frame-reference/frame-reference-ts-page.ts
index 0ae2737..04b56ae 100644
--- a/app/ns-ui-widgets-category/frame/frame-reference/frame-reference-ts-page.ts
+++ b/app/ns-ui-widgets-category/frame/frame-reference/frame-reference-ts-page.ts
@@ -1,18 +1,16 @@
// >> frame-reference-topmost-ts
-import { Frame, topmost } from "tns-core-modules/ui/frame";
+import { Frame } from "@nativescript/core";
-const topmostFrame: Frame = topmost();
+const topmostFrame: Frame = Frame.topmost();
// << frame-reference-topmost-ts
// >> frame-reference-get-id-ts
-import { getFrameById } from "tns-core-modules/ui/frame";
-const currentFrame: Frame = getFrameById("root-frame");
+const currentFrame: Frame = Frame.getFrameById("root-frame");
// << frame-reference-get-id-ts
// >> frame-reference-via-frame-prop-ts
-import { Button } from "tns-core-modules/ui/button";
-import { Page } from "tns-core-modules/ui/page";
+import { Button, Page } from "@nativescript/core";
export function onTap(args) {
const button: Button = args.object;
diff --git a/app/ns-ui-widgets-category/frame/navigation-context/navigation-context-page.js b/app/ns-ui-widgets-category/frame/navigation-context/navigation-context-page.js
index e70fe4b..a89ab5d 100644
--- a/app/ns-ui-widgets-category/frame/navigation-context/navigation-context-page.js
+++ b/app/ns-ui-widgets-category/frame/navigation-context/navigation-context-page.js
@@ -1,5 +1,5 @@
// >> nav-context-pass
-exports.onNavigate = function(args) {
+export function onNavigate(args) {
const button = args.object;
const page = button.page;
const frame = page.frame;
@@ -14,7 +14,7 @@ exports.onNavigate = function(args) {
};
frame.navigate(navEntryWithContext);
-};
+}
// << nav-context-pass
// >> nav-context-pass-binding
const navEntryWithBindingContext = {
diff --git a/app/ns-ui-widgets-category/frame/navigation-context/navigation-ts-context-page.ts b/app/ns-ui-widgets-category/frame/navigation-context/navigation-ts-context-page.ts
index ff7a172..da8afe5 100644
--- a/app/ns-ui-widgets-category/frame/navigation-context/navigation-ts-context-page.ts
+++ b/app/ns-ui-widgets-category/frame/navigation-context/navigation-ts-context-page.ts
@@ -1,8 +1,5 @@
// >> nav-context-pass-ts
-import { EventData } from "tns-core-modules/data/observable";
-import { Button } from "tns-core-modules/ui/button";
-import { Page } from "tns-core-modules/ui/page";
-import { Frame, NavigationEntry } from "tns-core-modules/ui/frame";
+import { Button, EventData, Frame, NavigationEntry, Page } from "@nativescript/core";
export function onNavigate(args: EventData) {
let button =
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/gestures/double-tap/double-tap-ts-page.css b/app/ns-ui-widgets-category/gestures/double-tap/double-tap-ts-page.css
deleted file mode 100644
index 03617ee..0000000
--- a/app/ns-ui-widgets-category/gestures/double-tap/double-tap-ts-page.css
+++ /dev/null
@@ -1,8 +0,0 @@
-Label {
- border-color: lightslategray;
- border-width:1;
- border-radius: 20;
- font-size: 26;
- horizontal-align: center;
- padding: 15;
-}
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/gestures/double-tap/double-tap-ts-page.ts b/app/ns-ui-widgets-category/gestures/double-tap/double-tap-ts-page.ts
index 49f54b8..42495cd 100644
--- a/app/ns-ui-widgets-category/gestures/double-tap/double-tap-ts-page.ts
+++ b/app/ns-ui-widgets-category/gestures/double-tap/double-tap-ts-page.ts
@@ -1,8 +1,18 @@
+import { GridLayout } from "@nativescript/core";
// >> gest-double-tap-ts
-import { GestureEventData } from "tns-core-modules/ui/gestures";
+import { GestureEventData } from "@nativescript/core";
export function onDoubleTap(args: GestureEventData) {
- // args is of type GesturesEventDatae
- alert(`${args.eventName} event triggered for ${args.view}`);
+ console.log("Object that triggered the event: " + args.object);
+ console.log("View that triggered the event: " + args.view);
+ console.log("Event name: " + args.eventName);
+ // >> (hide)
+ let grid = args.object;
+ grid.rotate = 0;
+ grid.animate({
+ rotate: 360,
+ duration: 2000
+ });
+ // << (hide)
}
// << gest-double-tap-ts
diff --git a/app/ns-ui-widgets-category/gestures/double-tap/double-tap-ts-page.xml b/app/ns-ui-widgets-category/gestures/double-tap/double-tap-ts-page.xml
index 234bca3..6232f56 100644
--- a/app/ns-ui-widgets-category/gestures/double-tap/double-tap-ts-page.xml
+++ b/app/ns-ui-widgets-category/gestures/double-tap/double-tap-ts-page.xml
@@ -3,7 +3,10 @@
-
-
+
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/gestures/end.md b/app/ns-ui-widgets-category/gestures/end.md
index 37d23a8..a6e7046 100644
--- a/app/ns-ui-widgets-category/gestures/end.md
+++ b/app/ns-ui-widgets-category/gestures/end.md
@@ -1,18 +1,36 @@
- **API References**
+## Events
- * [Gestures Module](https://docs.nativescript.org/api-reference/modules/_ui_gestures_)
- * [GesturesTypes Enumaration](https://docs.nativescript.org/api-reference/enums/_ui_gestures_.gesturetypes)
- * [GestureStateTypes Enumaration](https://docs.nativescript.org/api-reference/enums/_ui_gestures_.gesturestatetypes)
- * [SwipeDirection Enumaration](https://docs.nativescript.org/api-reference/enums/_ui_gestures_.swipedirection)
- * [GesturesEventData Interface](https://docs.nativescript.org/api-reference/interfaces/_ui_gestures_.gestureeventdata)
- * [PinchGestureEventData Interface](https://docs.nativescript.org/api-reference/interfaces/_ui_gestures_.pinchgestureeventdata)
- * [SwipeGestureEventData Interface](https://docs.nativescript.org/api-reference/interfaces/_ui_gestures_.swipegestureeventdata)
- * [GestureEventDataWithState Interface](https://docs.nativescript.org/api-reference/interfaces/_ui_gestures_.gestureeventdatawithstate)
- * [TouchGestureEventData Interface](https://docs.nativescript.org/api-reference/interfaces/_ui_gestures_.touchgestureeventdata)
- * [PanGestureEventData Interface](https://docs.nativescript.org/api-reference/interfaces/_ui_gestures_.pangestureeventdata)
- * [RotationGestureEventData Interface](https://docs.nativescript.org/api-reference/interfaces/_ui_gestures_.rotationgestureeventdata)
- * [Pointer Interface](https://docs.nativescript.org/api-reference/interfaces/_ui_gestures_.pointer)
- * [GesturesEventData Interface](https://docs.nativescript.org/api-reference/interfaces/_ui_gestures_.gestureeventdata)
+Each interactive view in NativeScript can access the gesture events it will raise on user interaction.
- **See Also**
-[Implementation of Zoom using `pinch` and Dran'n'Drop using `pan` gestures](https://github.com/NickIliev/nativescript-zoom-and-drag)
+| Name | Description |
+|----------|----------------|
+| `tap` | Emitted when the view is tapped.|
+| `doubleTap` | Emitted when the view is double tapped.|
+| `touch` | Emitted when the view is touched. Returns action state from [`TouchGestureEventData`](https://docs.nativescript.org/api-reference/interfaces/_ui_gestures_.touchgestureeventdata) |
+| `longPress` | Emitted when the view is tapped and hold. Returns `state`. |
+| `pan` | Emitted when the view is paned. Rewturns `deltaX` and `deltaY` coordinates as numbers. |
+| `pinch` | Emitted when the view is pinched. Returns `scale` |
+| `swipe` | Emitted when the view is swiped left/right. Returns `direction` as [`SwipeDirection`](https://docs.nativescript.org/api-reference/enums/_ui_gestures_.swipedirection) |
+
+## API References
+
+| Name | Type | API Reference Link |
+|----------|---------|--------------------|
+| `tns-core-modules/ui/gestures` | `Module` | https://docs.nativescript.org/api-reference/modules/_ui_gestures_ |
+| `GestureTypes` | `enum` | https://docs.nativescript.org/api-reference/enums/_ui_gestures_.gesturetypes |
+| `GestureStateTypes` | `enum` | https://docs.nativescript.org/api-reference/modules/_ui_gestures_ |
+| `SwipeDirection` | `enum` | https://docs.nativescript.org/api-reference/modules/_ui_gestures_ |
+| `GestureEventData` | `interface` | https://docs.nativescript.org/api-reference/interfaces/_ui_gestures_.gestureeventdata |
+| `GestureEventDataWithState` | `interface` | https://docs.nativescript.org/api-reference/interfaces/_ui_gestures_.gestureeventdatawithstate |
+| `PanGestureEventData` | `interface` | https://docs.nativescript.org/api-reference/interfaces/_ui_gestures_.pangestureeventdata |
+| `PinchGestureEventData` | `interface` | https://docs.nativescript.org/api-reference/interfaces/_ui_gestures_.pinchgestureeventdata |
+| `RotationGestureEventData` | `interface` | https://docs.nativescript.org/api-reference/interfaces/_ui_gestures_.rotationgestureeventdata |
+| `SwipeGestureEventData` | `interface` | https://docs.nativescript.org/api-reference/interfaces/_ui_gestures_.swipegestureeventdata |
+| `TouchGestureEventData` | `interface` | https://docs.nativescript.org/api-reference/interfaces/_ui_gestures_.touchgestureeventdata |
+| `Pointer` | `interface` | https://docs.nativescript.org/api-reference/interfaces/_ui_gestures_.pointer |
+
+## Native Component
+
+| Android | iOS |
+|:----------------------|:---------|
+| [android.widget.Button](http://developer.android.com/reference/android/widget/Button.html) | [UIButton](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIButton_Class/) |
diff --git a/app/ns-ui-widgets-category/gestures/gestures-page.js b/app/ns-ui-widgets-category/gestures/gestures-page.js
index dea4148..36adb45 100644
--- a/app/ns-ui-widgets-category/gestures/gestures-page.js
+++ b/app/ns-ui-widgets-category/gestures/gestures-page.js
@@ -1,26 +1,26 @@
-const ListViewLinksModel = require("../../links-view-model");
-const link = require("../../link");
+import ListViewLinksModel from "../../links-view-model";
+import Link from "../../link";
const navigationLinks = [
- new link("Tap", "ns-ui-widgets-category/gestures/tap/tap-page"),
- new link("Double Tap", "ns-ui-widgets-category/gestures/double-tap/double-tap-page"),
- new link("Long Press", "ns-ui-widgets-category/gestures/long-press/long-press-page"),
- new link("Swipe", "ns-ui-widgets-category/gestures/swipe/swipe-page"),
- new link("Rotation", "ns-ui-widgets-category/gestures/rotation/rotation-page"),
- new link("Pan", "ns-ui-widgets-category/gestures/pan/pan-page"),
- new link("Pinch", "ns-ui-widgets-category/gestures/pinch/pinch-page"),
- new link("Touch", "ns-ui-widgets-category/gestures/touch/touch-page")
+ new Link("Tap", "ns-ui-widgets-category/gestures/tap/tap-page"),
+ new Link("Double Tap", "ns-ui-widgets-category/gestures/double-tap/double-tap-page"),
+ new Link("Long Press", "ns-ui-widgets-category/gestures/long-press/long-press-page"),
+ new Link("Swipe", "ns-ui-widgets-category/gestures/swipe/swipe-page"),
+ new Link("Rotation", "ns-ui-widgets-category/gestures/rotation/rotation-page"),
+ new Link("Pan", "ns-ui-widgets-category/gestures/pan/pan-page"),
+ new Link("Pinch", "ns-ui-widgets-category/gestures/pinch/pinch-page"),
+ new Link("Touch", "ns-ui-widgets-category/gestures/touch/touch-page")
];
const navigationLinksTsc = [
- new link("Tap", "ns-ui-widgets-category/gestures/tap/tap-ts-page"),
- new link("Double Tap", "ns-ui-widgets-category/gestures/double-tap/double-tap-ts-page"),
- new link("Long Press", "ns-ui-widgets-category/gestures/long-press/long-press-ts-page"),
- new link("Swipe", "ns-ui-widgets-category/gestures/swipe/swipe-ts-page"),
- new link("Rotation", "ns-ui-widgets-category/gestures/rotation/rotation-ts-page"),
- new link("Pan", "ns-ui-widgets-category/gestures/pan/pan-ts-page"),
- new link("Pinch", "ns-ui-widgets-category/gestures/pinch/pinch-ts-page"),
- new link("Touch", "ns-ui-widgets-category/gestures/touch/touch-ts-page")
+ new Link("Tap", "ns-ui-widgets-category/gestures/tap/tap-ts-page"),
+ new Link("Double Tap", "ns-ui-widgets-category/gestures/double-tap/double-tap-ts-page"),
+ new Link("Long Press", "ns-ui-widgets-category/gestures/long-press/long-press-ts-page"),
+ new Link("Swipe", "ns-ui-widgets-category/gestures/swipe/swipe-ts-page"),
+ new Link("Rotation", "ns-ui-widgets-category/gestures/rotation/rotation-ts-page"),
+ new Link("Pan", "ns-ui-widgets-category/gestures/pan/pan-ts-page"),
+ new Link("Pinch", "ns-ui-widgets-category/gestures/pinch/pinch-ts-page"),
+ new Link("Touch", "ns-ui-widgets-category/gestures/touch/touch-ts-page")
];
-function onNavigatingTo(args) {
+export function onNavigatingTo(args) {
const page = args.object;
page.bindingContext = new ListViewLinksModel({
links: navigationLinks,
@@ -29,4 +29,4 @@ function onNavigatingTo(args) {
tsclinks: navigationLinksTsc
});
}
-exports.onNavigatingTo = onNavigatingTo;
+
diff --git a/app/ns-ui-widgets-category/gestures/long-press/article.md b/app/ns-ui-widgets-category/gestures/long-press/article.md
index 5291518..8788f99 100644
--- a/app/ns-ui-widgets-category/gestures/long-press/article.md
+++ b/app/ns-ui-widgets-category/gestures/long-press/article.md
@@ -2,9 +2,3 @@ Action: Press your finger against the screen for a few moments.
-
-Possible implementation for `longPress` gesture:
- - Select one or more items in a view and act upon the data using a contextual action bar.
- - Enter data selection mode.
-
-> Tip: Avoid using long press for displaying contextual menus.
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/gestures/long-press/long-press-page.css b/app/ns-ui-widgets-category/gestures/long-press/long-press-page.css
deleted file mode 100644
index 03617ee..0000000
--- a/app/ns-ui-widgets-category/gestures/long-press/long-press-page.css
+++ /dev/null
@@ -1,8 +0,0 @@
-Label {
- border-color: lightslategray;
- border-width:1;
- border-radius: 20;
- font-size: 26;
- horizontal-align: center;
- padding: 15;
-}
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/gestures/long-press/long-press-page.js b/app/ns-ui-widgets-category/gestures/long-press/long-press-page.js
index 719e9ea..e351cc7 100644
--- a/app/ns-ui-widgets-category/gestures/long-press/long-press-page.js
+++ b/app/ns-ui-widgets-category/gestures/long-press/long-press-page.js
@@ -1,7 +1,15 @@
// >> gest-long-press
-function onLongPress(args) {
- // args is of type GesturesEventData
- alert(`${args.eventName} gesture event triggered for ${args.view}`);
+export function onLongPress(args) {
+ console.log(`Object that triggered the event: ${args.object}`);
+ console.log(`View that triggered the event: ${args.view}`);
+ console.log(`Event name: ${args.eventName}`);
+ // >> (hide)
+ const grid = args.object;
+ grid.rotate = 0;
+ grid.animate({
+ rotate: 360,
+ duration: 2000
+ });
+ // << (hide)
}
-exports.onLongPress = onLongPress;
// << gest-long-press
diff --git a/app/ns-ui-widgets-category/gestures/long-press/long-press-page.xml b/app/ns-ui-widgets-category/gestures/long-press/long-press-page.xml
index c3fb1a1..7f802db 100644
--- a/app/ns-ui-widgets-category/gestures/long-press/long-press-page.xml
+++ b/app/ns-ui-widgets-category/gestures/long-press/long-press-page.xml
@@ -3,9 +3,14 @@
-
+
+
-
+
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/gestures/long-press/long-press-ts-page.css b/app/ns-ui-widgets-category/gestures/long-press/long-press-ts-page.css
deleted file mode 100644
index 03617ee..0000000
--- a/app/ns-ui-widgets-category/gestures/long-press/long-press-ts-page.css
+++ /dev/null
@@ -1,8 +0,0 @@
-Label {
- border-color: lightslategray;
- border-width:1;
- border-radius: 20;
- font-size: 26;
- horizontal-align: center;
- padding: 15;
-}
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/gestures/long-press/long-press-ts-page.ts b/app/ns-ui-widgets-category/gestures/long-press/long-press-ts-page.ts
index 30ad960..fb84f64 100644
--- a/app/ns-ui-widgets-category/gestures/long-press/long-press-ts-page.ts
+++ b/app/ns-ui-widgets-category/gestures/long-press/long-press-ts-page.ts
@@ -1,8 +1,18 @@
+import { GridLayout } from "@nativescript/core";
// >> gest-long-press-ts
-import { GestureEventData } from "tns-core-modules/ui/gestures";
+import { GestureEventData } from "@nativescript/core";
export function onLongPress(args: GestureEventData) {
- // args is of type GesturesEventData
- alert(`${args.eventName} gesture event triggered for ${args.view}`);
+ console.log("Object that triggered the event: " + args.object);
+ console.log("View that triggered the event: " + args.view);
+ console.log("Event name: " + args.eventName);
+ // >> (hide)
+ let grid = args.object;
+ grid.rotate = 0;
+ grid.animate({
+ rotate: 360,
+ duration: 2000
+ });
+ // << (hide)
}
// << gest-long-press-ts
diff --git a/app/ns-ui-widgets-category/gestures/long-press/long-press-ts-page.xml b/app/ns-ui-widgets-category/gestures/long-press/long-press-ts-page.xml
index c75562c..1f1a64e 100644
--- a/app/ns-ui-widgets-category/gestures/long-press/long-press-ts-page.xml
+++ b/app/ns-ui-widgets-category/gestures/long-press/long-press-ts-page.xml
@@ -3,7 +3,12 @@
-
-
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/gestures/metadata.md b/app/ns-ui-widgets-category/gestures/metadata.md
index e14eb97..d39f9e4 100644
--- a/app/ns-ui-widgets-category/gestures/metadata.md
+++ b/app/ns-ui-widgets-category/gestures/metadata.md
@@ -4,3 +4,4 @@ description: The Gesture class provides functionality, which allows interaction
position: 240
slug: gestures
---
+example-order: tap, double-tap, touch, swipe, long-press, pan, pinch, rotation
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/gestures/overview.md b/app/ns-ui-widgets-category/gestures/overview.md
index f520700..d798bdc 100644
--- a/app/ns-ui-widgets-category/gestures/overview.md
+++ b/app/ns-ui-widgets-category/gestures/overview.md
@@ -1,45 +1,18 @@
-This module allows users to interact with an app via a set of different gestures.
-NativeScript provides a variety of APIs to help you create gestures.
+Gestures, such as tap, slide and pinch, allow users to interact with your app by manipulating UI elements on the screen.
-## Overview
+In NativeScript, View—the base class for all NativeScript UI elements—has on and off methods
+that let you subscribe or unsubscribe to all events and gestures recognized by the UI element.
-Gestures, such as `tap`, `slide` and `pinch`, allow users to interact with your app by manipulating UI elements on the screen.
-In NativeScript, `View` (the base class for all NativeScript UI elements) has `on` and `off` methods that let you subscribe or unsubscribe to all events and gestures recognized by the UI element.
-As the first parameter, you pass an on or off method and the type of gesture you want to track. The second parameter is a function that is called each time the specified gesture is recognized.
-The function arguments contain additional information about the gesture, if applicable.
-
-- **on(** type _Number_ | name _String_ | names Comma separated _String_, callback _Function_... **)
- - **type** - _Number_ | **name** - _String_ | **names** - Comma separated _String_
- - **callback** - _Function_(args _GestureEventData_)
-
-- **off(** type _Number_ | name _String_ | names Comma separated _String_, callback _Function_... **)
- - **type** - _Number_ | **name** - _String_ | **names** - Comma separated _String_
- - **callback** - _Function_(args _GestureEventData_)
-
-Example
-```JavaScript
-myView.on("tap", () => {
- console.log("myView tapped!");
-})
-```
-```TypeScript
-myView.on("tap", () => {
- console.log("myView tapped!");
-})
-```
-
-Gestures events can also be implemented directly in the XML layout by providing the callback method.
-```XML
-
-```
-```JavaScript
-exports.onTap = function(args) {
- console.log("Label tapped!");
-};
-```
-```TypeScript
-export function onTap(args) {
- console.log("Label tapped!");
-};
-```
+As the first parameter, you pass an on or off method and the type of gesture you want to track.
+The second parameter is a function that is called each time the specified gesture is recognized.
+The function arguments contain additional information about the gesture, if applicable.
+List of supported gestures in NativeScript:
+ - [Tap](#tap)
+ - [Double Tap](#double-tap)
+ - [Long Press](#long-press)
+ - [Swipe](#swipe)
+ - [Pan](#pan)
+ - [Pinch](#pinch)
+ - [Rotation](#rotation)
+ - [Touch](#touch)
diff --git a/app/ns-ui-widgets-category/gestures/pan/article.md b/app/ns-ui-widgets-category/gestures/pan/article.md
index 04662ee..9d312a4 100644
--- a/app/ns-ui-widgets-category/gestures/pan/article.md
+++ b/app/ns-ui-widgets-category/gestures/pan/article.md
@@ -1,8 +1,5 @@
Action: Press your finger down and immediately start moving it around.
-Pans are executed more slowly and allow for more precision, and the screen stops responding as soon as the finger is lifted off it.
-
+Pans are executed more slowly and allow for more precision and the screen stops responding as soon as the finger is lifted off it.
+
-
-Possible implementations for `pan` gesture:
-- Drag'n'Drop functionality
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/gestures/pan/pan-page.css b/app/ns-ui-widgets-category/gestures/pan/pan-page.css
deleted file mode 100644
index 3f31b52..0000000
--- a/app/ns-ui-widgets-category/gestures/pan/pan-page.css
+++ /dev/null
@@ -1,11 +0,0 @@
-Label {
- border-color: lightslategray;
- border-width:1;
- border-radius: 20;
- font-size: 26;
- horizontal-align: center;
- vertical-align: middle;
- text-align: center;
- padding: 15;
- margin: 10;
-}
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/gestures/pan/pan-page.js b/app/ns-ui-widgets-category/gestures/pan/pan-page.js
index 45b7726..ca00c9e 100644
--- a/app/ns-ui-widgets-category/gestures/pan/pan-page.js
+++ b/app/ns-ui-widgets-category/gestures/pan/pan-page.js
@@ -1,26 +1,26 @@
-const Observable = require("tns-core-modules/data/observable").Observable;
+import { Observable } from "@nativescript/core";
// >> gest-pan
-function onPan(args) {
+export function onPan(args) {
// args is of type PanGestureEventData
- console.log(`${args.eventName} event triggered for ${args.view}`);
- console.log(`deltaX: ${args.deltaX}`);
- console.log(`deltaY: ${args.deltaY}`);
- console.log(`state: ${args.state}`);
+ console.log(`Object that triggered the event: ${args.object}`);
+ console.log(`View that triggered the event: ${args.view}`);
+ console.log(`Event name: ${args.eventName}`);
+ console.log(`Pan delta: [ ${args.deltaX}, ${args.deltaY} ] state: ${args.state}`);
// >> (hide)
const page = args.object.page;
const vm = page.bindingContext;
vm.set("deltaX", args.deltaX);
vm.set("deltaY", args.deltaY);
+ vm.set("state", args.state);
// << (hide)
}
-exports.onPan = onPan;
// << gest-pan
-function onPageLoaded(args) {
+export function onPageLoaded(args) {
const page = args.object;
const vm = new Observable();
page.bindingContext = vm;
}
-exports.onPageLoaded = onPageLoaded;
+
diff --git a/app/ns-ui-widgets-category/gestures/pan/pan-page.xml b/app/ns-ui-widgets-category/gestures/pan/pan-page.xml
index 5fd47b0..f93431d 100644
--- a/app/ns-ui-widgets-category/gestures/pan/pan-page.xml
+++ b/app/ns-ui-widgets-category/gestures/pan/pan-page.xml
@@ -5,11 +5,13 @@
-
-
-
-
-
-
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/gestures/pan/pan-ts-page.css b/app/ns-ui-widgets-category/gestures/pan/pan-ts-page.css
deleted file mode 100644
index 03617ee..0000000
--- a/app/ns-ui-widgets-category/gestures/pan/pan-ts-page.css
+++ /dev/null
@@ -1,8 +0,0 @@
-Label {
- border-color: lightslategray;
- border-width:1;
- border-radius: 20;
- font-size: 26;
- horizontal-align: center;
- padding: 15;
-}
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/gestures/pan/pan-ts-page.ts b/app/ns-ui-widgets-category/gestures/pan/pan-ts-page.ts
index 9f4c800..db8284a 100644
--- a/app/ns-ui-widgets-category/gestures/pan/pan-ts-page.ts
+++ b/app/ns-ui-widgets-category/gestures/pan/pan-ts-page.ts
@@ -1,27 +1,26 @@
-import { Observable } from "tns-core-modules/data/observable";
-import { Label } from "tns-core-modules/ui/label";
-import { Page } from "tns-core-modules/ui/page";
+import { Label, Observable, Page } from "@nativescript/core";
// >> gest-pan-ts
-import { PanGestureEventData } from "tns-core-modules/ui/gestures";
+import { PanGestureEventData } from "@nativescript/core";
export function onPan(args: PanGestureEventData) {
// args is of type PanGestureEventData
- console.log(`${args.eventName} event triggered for ${args.view}`);
- console.log(`deltaX: ${args.deltaX}`);
- console.log(`deltaY: ${args.deltaY}`);
- console.log(`state: ${args.state}`);
+ console.log("Object that triggered the event: " + args.object);
+ console.log("View that triggered the event: " + args.view);
+ console.log("Event name: " + args.eventName);
+ console.log("Pan delta: [" + args.deltaX + ", " + args.deltaY + "] state: " + args.state);
// >> (hide)
const page = (args.object).page;
const vm = page.bindingContext;
vm.set("deltaX", args.deltaX);
vm.set("deltaY", args.deltaY);
+ vm.set("state", args.state);
// << (hide)
}
// << gest-pan-ts
export function onPageLoaded(args) {
- const page = args.object;
+ const page: Page = args.object;
const vm = new Observable();
page.bindingContext = vm;
}
diff --git a/app/ns-ui-widgets-category/gestures/pan/pan-ts-page.xml b/app/ns-ui-widgets-category/gestures/pan/pan-ts-page.xml
index 1ef56ae..160a99e 100644
--- a/app/ns-ui-widgets-category/gestures/pan/pan-ts-page.xml
+++ b/app/ns-ui-widgets-category/gestures/pan/pan-ts-page.xml
@@ -3,9 +3,13 @@
-
-
-
-
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/gestures/pinch/article.md b/app/ns-ui-widgets-category/gestures/pinch/article.md
index 934929a..f6b4577 100644
--- a/app/ns-ui-widgets-category/gestures/pinch/article.md
+++ b/app/ns-ui-widgets-category/gestures/pinch/article.md
@@ -1,8 +1,4 @@
Action: Touch the screen using two of your fingers, then move them towards each other or away from each other.
-
+
-
-Possible implementations for `pinch` gesture:
- - Zoom into content or out of content.
-
diff --git a/app/ns-ui-widgets-category/gestures/pinch/pinch-page.css b/app/ns-ui-widgets-category/gestures/pinch/pinch-page.css
deleted file mode 100644
index ff6d9ab..0000000
--- a/app/ns-ui-widgets-category/gestures/pinch/pinch-page.css
+++ /dev/null
@@ -1,7 +0,0 @@
-Label {
- border-color: lightslategray;
- border-radius: 20;
- font-size: 26;
- horizontal-align: center;
- padding: 15;
-}
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/gestures/pinch/pinch-page.js b/app/ns-ui-widgets-category/gestures/pinch/pinch-page.js
index 3dc44f7..e689b34 100644
--- a/app/ns-ui-widgets-category/gestures/pinch/pinch-page.js
+++ b/app/ns-ui-widgets-category/gestures/pinch/pinch-page.js
@@ -1,10 +1,28 @@
+import { Observable } from "@nativescript/core";
+export function onPageLoaded(args) {
+ const page = args.object;
+ const vm = new Observable();
+ page.bindingContext = vm;
+}
+
+const startScale = 1;
// >> gest-pinch
-function onPinch(args) {
- // args is of type PinchGestureEventData
- console.log(`scale: ${args.scale}`);
- console.log(`tate: ${args.state}`);
- console.log(`getFocusX(): ${args.getFocusX()}`);
- console.log(`getFocusY(): ${args.getFocusY()}`);
+export function onPinch(args) {
+ console.log(`Object that triggered the event: ${args.object}`);
+ console.log(`View that triggered the event: ${args.view}`);
+ console.log(`Event name: ${args.eventName}`);
+ console.log(`Pinch scale: ${args.scale} state: ${args.state}`);
+ // >> (hide)
+ const grid = args.object;
+ const page = grid.page;
+ const vm = page.bindingContext;
+ vm.set("scale", args.scale);
+ vm.set("state", args.state);
+ if (args.scale && args.scale !== 1) {
+ const newScale = startScale * args.scale;
+ grid.scaleX = newScale;
+ grid.scaleY = newScale;
+ }
+ // << (hide)
}
-exports.onPinch = onPinch;
// << gest-pinch
diff --git a/app/ns-ui-widgets-category/gestures/pinch/pinch-page.xml b/app/ns-ui-widgets-category/gestures/pinch/pinch-page.xml
index 7db9076..47c14b7 100644
--- a/app/ns-ui-widgets-category/gestures/pinch/pinch-page.xml
+++ b/app/ns-ui-widgets-category/gestures/pinch/pinch-page.xml
@@ -1,11 +1,14 @@
-
+
-
-
-
-
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/gestures/pinch/pinch-ts-page.css b/app/ns-ui-widgets-category/gestures/pinch/pinch-ts-page.css
deleted file mode 100644
index ff6d9ab..0000000
--- a/app/ns-ui-widgets-category/gestures/pinch/pinch-ts-page.css
+++ /dev/null
@@ -1,7 +0,0 @@
-Label {
- border-color: lightslategray;
- border-radius: 20;
- font-size: 26;
- horizontal-align: center;
- padding: 15;
-}
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/gestures/pinch/pinch-ts-page.ts b/app/ns-ui-widgets-category/gestures/pinch/pinch-ts-page.ts
index 1179763..1d6c438 100644
--- a/app/ns-ui-widgets-category/gestures/pinch/pinch-ts-page.ts
+++ b/app/ns-ui-widgets-category/gestures/pinch/pinch-ts-page.ts
@@ -1,11 +1,32 @@
+import { GridLayout, Observable, Page } from "@nativescript/core";
+let startScale = 1;
// >> gest-pinch-ts
-import { PinchGestureEventData } from "tns-core-modules/ui/gestures";
+import { PinchGestureEventData } from "@nativescript/core";
export function onPinch(args: PinchGestureEventData) {
- // args is of type PinchGestureEventData
- console.log(`scale: ${args.scale}`);
- console.log(`tate: ${args.state}`);
- console.log(`getFocusX(): ${args.getFocusX()}`);
- console.log(`getFocusY(): ${args.getFocusY()}`);
+ console.log("Object that triggered the event: " + args.object);
+ console.log("View that triggered the event: " + args.view);
+ console.log("Event name: " + args.eventName);
+ console.log("Pinch scale: " + args.scale + " state: " + args.state);
+ // >> (hide)
+ let scale = 0;
+ let state = 0;
+ let grid = args.object;
+ const page = grid.page;
+ const vm = page.bindingContext;
+ vm.set("scale", args.scale);
+ vm.set("state", args.state);
+
+ if (args.scale && args.scale !== 1) {
+ let newScale = startScale * args.scale;
+ grid.scaleX = newScale;
+ grid.scaleY = newScale;
+ }
+ // << (hide)
}
// << gest-pinch-ts
+export function onPageLoaded(args) {
+ const page: Page = args.object;
+ const vm = new Observable();
+ page.bindingContext = vm;
+}
diff --git a/app/ns-ui-widgets-category/gestures/pinch/pinch-ts-page.xml b/app/ns-ui-widgets-category/gestures/pinch/pinch-ts-page.xml
index dbc66c4..07cf09d 100644
--- a/app/ns-ui-widgets-category/gestures/pinch/pinch-ts-page.xml
+++ b/app/ns-ui-widgets-category/gestures/pinch/pinch-ts-page.xml
@@ -1,9 +1,14 @@
-
+
-
-
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/gestures/rotation/article.md b/app/ns-ui-widgets-category/gestures/rotation/article.md
index 5599ead..b606026 100644
--- a/app/ns-ui-widgets-category/gestures/rotation/article.md
+++ b/app/ns-ui-widgets-category/gestures/rotation/article.md
@@ -1,4 +1,4 @@
Action: Touch the screen using two of your fingers, then rotate them simultaneously left or right.
-
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/gestures/rotation/rotation-page.css b/app/ns-ui-widgets-category/gestures/rotation/rotation-page.css
deleted file mode 100644
index ff6d9ab..0000000
--- a/app/ns-ui-widgets-category/gestures/rotation/rotation-page.css
+++ /dev/null
@@ -1,7 +0,0 @@
-Label {
- border-color: lightslategray;
- border-radius: 20;
- font-size: 26;
- horizontal-align: center;
- padding: 15;
-}
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/gestures/rotation/rotation-page.js b/app/ns-ui-widgets-category/gestures/rotation/rotation-page.js
index ca2a339..251afe2 100644
--- a/app/ns-ui-widgets-category/gestures/rotation/rotation-page.js
+++ b/app/ns-ui-widgets-category/gestures/rotation/rotation-page.js
@@ -1,9 +1,31 @@
+import { Observable } from "@nativescript/core";
+export function onPageLoaded(args) {
+ const page = args.object;
+ const vm = new Observable();
+ page.bindingContext = vm;
+}
+
// >> gest-rotation
-function onRotation(args) {
- // args is of type RotationGestureEventData
- console.log(`${args.eventName} event triggered for ${args.view}`);
- console.log(`rotation: ${args.rotation}`);
- console.log(`state: ${args.state}`);
+export function onRotation(args) {
+ console.log(`Object that triggered the event: ${args.object}`);
+ console.log(`View that triggered the event: ${args.view}`);
+ console.log(`Event name: ${args.eventName}`);
+ console.log(`Rotate angle: ${args.rotation} state: ${args.state}`);
+ // >> (hide)
+ const grid = args.object;
+ const page = grid.page;
+ const vm = page.bindingContext;
+ vm.set("angle", args.rotation);
+ vm.set("state", args.state);
+
+ if (args.state === 3) {
+ const layout = args.object;
+ layout.rotate = 0;
+ layout.animate({
+ rotate: args.rotation,
+ duration: 200
+ });
+ }
+ // << (hide)
}
-exports.onRotation = onRotation;
// << gest-rotation
diff --git a/app/ns-ui-widgets-category/gestures/rotation/rotation-page.xml b/app/ns-ui-widgets-category/gestures/rotation/rotation-page.xml
index 2133646..d5843d7 100644
--- a/app/ns-ui-widgets-category/gestures/rotation/rotation-page.xml
+++ b/app/ns-ui-widgets-category/gestures/rotation/rotation-page.xml
@@ -1,11 +1,14 @@
-
+
-
-
-
-
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/gestures/rotation/rotation-ts-page.css b/app/ns-ui-widgets-category/gestures/rotation/rotation-ts-page.css
deleted file mode 100644
index ff6d9ab..0000000
--- a/app/ns-ui-widgets-category/gestures/rotation/rotation-ts-page.css
+++ /dev/null
@@ -1,7 +0,0 @@
-Label {
- border-color: lightslategray;
- border-radius: 20;
- font-size: 26;
- horizontal-align: center;
- padding: 15;
-}
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/gestures/rotation/rotation-ts-page.ts b/app/ns-ui-widgets-category/gestures/rotation/rotation-ts-page.ts
index abe9a8a..11f3831 100644
--- a/app/ns-ui-widgets-category/gestures/rotation/rotation-ts-page.ts
+++ b/app/ns-ui-widgets-category/gestures/rotation/rotation-ts-page.ts
@@ -1,10 +1,32 @@
+import { GridLayout, Observable, Page } from "@nativescript/core";
// >> gest-rotation-ts
-import { RotationGestureEventData } from "tns-core-modules/ui/gestures";
+import { RotationGestureEventData } from "@nativescript/core";
export function onRotation(args: RotationGestureEventData) {
- // args is of type RotationGestureEventData
- console.log(`${args.eventName} event triggered for ${args.view}`);
- console.log(`rotation: ${args.rotation}`);
- console.log(`state: ${args.state}`);
+ console.log("Object that triggered the event: " + args.object);
+ console.log("View that triggered the event: " + args.view);
+ console.log("Event name: " + args.eventName);
+ console.log("Rotate angle: " + args.rotation + " state: " + args.state);
+ // >> (hide)
+ let grid = args.object;
+ const page = grid.page;
+ const vm = page.bindingContext;
+ vm.set("angle", args.rotation);
+ vm.set("state", args.state);
+
+ if (this.state === 3) {
+ let layout = args.object;
+ layout.rotate = 0;
+ layout.animate({
+ rotate: args.rotation,
+ duration: 200
+ });
+ }
+ // << (hide)
}
// << gest-rotation-ts
+export function onPageLoaded(args) {
+ const page: Page = args.object;
+ const vm = new Observable();
+ page.bindingContext = vm;
+}
diff --git a/app/ns-ui-widgets-category/gestures/rotation/rotation-ts-page.xml b/app/ns-ui-widgets-category/gestures/rotation/rotation-ts-page.xml
index 4633991..d5843d7 100644
--- a/app/ns-ui-widgets-category/gestures/rotation/rotation-ts-page.xml
+++ b/app/ns-ui-widgets-category/gestures/rotation/rotation-ts-page.xml
@@ -1,9 +1,14 @@
-
+
-
-
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/gestures/swipe/article.md b/app/ns-ui-widgets-category/gestures/swipe/article.md
index 2a04c76..900dd59 100644
--- a/app/ns-ui-widgets-category/gestures/swipe/article.md
+++ b/app/ns-ui-widgets-category/gestures/swipe/article.md
@@ -1,8 +1,5 @@
-Action: Swiftly slide your finger across the screen.
-Swipes are quick and affect the screen even after the finger is lifted off the screen.
-
+Action: Swiftly slide your finger across the screen. Swipes are quick and affect the screen even after the finger is lifted off the screen.
+
+
-
-Possible implementation for `swipe` gesture:
- - Navigate between views in the same hierarchy.
diff --git a/app/ns-ui-widgets-category/gestures/swipe/swipe-page.css b/app/ns-ui-widgets-category/gestures/swipe/swipe-page.css
deleted file mode 100644
index ff6d9ab..0000000
--- a/app/ns-ui-widgets-category/gestures/swipe/swipe-page.css
+++ /dev/null
@@ -1,7 +0,0 @@
-Label {
- border-color: lightslategray;
- border-radius: 20;
- font-size: 26;
- horizontal-align: center;
- padding: 15;
-}
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/gestures/swipe/swipe-page.js b/app/ns-ui-widgets-category/gestures/swipe/swipe-page.js
index fa369ee..8738db3 100644
--- a/app/ns-ui-widgets-category/gestures/swipe/swipe-page.js
+++ b/app/ns-ui-widgets-category/gestures/swipe/swipe-page.js
@@ -1,8 +1,23 @@
+import { Observable } from "@nativescript/core";
+export function onPageLoaded(args) {
+ const page = args.object;
+ const vm = new Observable();
+ page.bindingContext = vm;
+}
+
// >> gest-swipe
-function onSwipe(args) {
- // args is of type SwipeGestureEventData
- alert(`${args.eventName} event triggered for ${args.view}`);
- console.log(`direction ${args.direction}`); // SwipeDirection enumeration: up, down, left, right
+export function onSwipe(args) {
+ console.log("Swipe!");
+ console.log(`Object that triggered the event: ${args.object}`);
+ console.log(`View that triggered the event: ${args.view}`);
+ console.log(`Event name: ${args.eventName}`);
+ console.log(`Swipe Direction: ${args.direction}`);
+ // >> (hide)
+ const grid = args.object;
+ const page = grid.page;
+ const vm = page.bindingContext;
+ vm.set("direction", args.direction);
+ // << (hide)
}
-exports.onSwipe = onSwipe;
+
// << gest-swipe
diff --git a/app/ns-ui-widgets-category/gestures/swipe/swipe-page.xml b/app/ns-ui-widgets-category/gestures/swipe/swipe-page.xml
index 2b197ce..59e7e95 100644
--- a/app/ns-ui-widgets-category/gestures/swipe/swipe-page.xml
+++ b/app/ns-ui-widgets-category/gestures/swipe/swipe-page.xml
@@ -1,11 +1,13 @@
-
+
-
-
-
-
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/gestures/swipe/swipe-ts-page.css b/app/ns-ui-widgets-category/gestures/swipe/swipe-ts-page.css
deleted file mode 100644
index ff6d9ab..0000000
--- a/app/ns-ui-widgets-category/gestures/swipe/swipe-ts-page.css
+++ /dev/null
@@ -1,7 +0,0 @@
-Label {
- border-color: lightslategray;
- border-radius: 20;
- font-size: 26;
- horizontal-align: center;
- padding: 15;
-}
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/gestures/swipe/swipe-ts-page.ts b/app/ns-ui-widgets-category/gestures/swipe/swipe-ts-page.ts
index 255e7a1..effa93a 100644
--- a/app/ns-ui-widgets-category/gestures/swipe/swipe-ts-page.ts
+++ b/app/ns-ui-widgets-category/gestures/swipe/swipe-ts-page.ts
@@ -1,11 +1,23 @@
+import { GridLayout, Observable, Page } from "@nativescript/core";
// >> gest-swipe-ts
-import { SwipeDirection, SwipeGestureEventData } from "tns-core-modules/ui/gestures";
+import { SwipeGestureEventData } from "@nativescript/core";
export function onSwipe(args: SwipeGestureEventData) {
-
- alert(`${args.eventName} event triggered for ${args.view}`);
-
- let direction: SwipeDirection = args.direction;
- console.log(`direction ${direction}`); // SwipeDirection enumeration: up, down, left, right
+ console.log("Swipe!");
+ console.log("Object that triggered the event: " + args.object);
+ console.log("View that triggered the event: " + args.view);
+ console.log("Event name: " + args.eventName);
+ console.log("Swipe Direction: " + args.direction);
+ // >> (hide)
+ let grid = args.object;
+ const page = grid.page;
+ const vm = page.bindingContext;
+ vm.set("direction", args.direction);
+ // << (hide)
}
// << gest-swipe-ts
+export function onPageLoaded(args) {
+ const page: Page = args.object;
+ const vm = new Observable();
+ page.bindingContext = vm;
+}
diff --git a/app/ns-ui-widgets-category/gestures/swipe/swipe-ts-page.xml b/app/ns-ui-widgets-category/gestures/swipe/swipe-ts-page.xml
index 399b547..d702886 100644
--- a/app/ns-ui-widgets-category/gestures/swipe/swipe-ts-page.xml
+++ b/app/ns-ui-widgets-category/gestures/swipe/swipe-ts-page.xml
@@ -1,9 +1,11 @@
-
+
-
-
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/gestures/tap/article.md b/app/ns-ui-widgets-category/gestures/tap/article.md
index 241918a..c198942 100644
--- a/app/ns-ui-widgets-category/gestures/tap/article.md
+++ b/app/ns-ui-widgets-category/gestures/tap/article.md
@@ -1,4 +1,4 @@
Action: Briefly touch the screen.
-
+
diff --git a/app/ns-ui-widgets-category/gestures/tap/tap-page.css b/app/ns-ui-widgets-category/gestures/tap/tap-page.css
deleted file mode 100644
index ff6d9ab..0000000
--- a/app/ns-ui-widgets-category/gestures/tap/tap-page.css
+++ /dev/null
@@ -1,7 +0,0 @@
-Label {
- border-color: lightslategray;
- border-radius: 20;
- font-size: 26;
- horizontal-align: center;
- padding: 15;
-}
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/gestures/tap/tap-page.js b/app/ns-ui-widgets-category/gestures/tap/tap-page.js
index a60a6a0..342fcb6 100644
--- a/app/ns-ui-widgets-category/gestures/tap/tap-page.js
+++ b/app/ns-ui-widgets-category/gestures/tap/tap-page.js
@@ -1,7 +1,17 @@
// >> gest-tap
-function onTap(args) {
- // args is of type GestureEventData
- alert(`${args.eventName} event triggered for ${args.view}`);
+export function onTap(args) {
+ console.log("Tap!");
+ console.log(`Object that triggered the event: ${args.object}`);
+ console.log(`View that triggered the event: ${args.view}`);
+ console.log(`Event name: ${args.eventName}`);
+ // >> (hide)
+ const grid = args.object;
+ grid.rotate = 0;
+ grid.animate({
+ rotate: 360,
+ duration: 2000
+ });
+ // << (hide)
}
-exports.onTap = onTap;
+
// << gest-tap
diff --git a/app/ns-ui-widgets-category/gestures/tap/tap-page.xml b/app/ns-ui-widgets-category/gestures/tap/tap-page.xml
index 2009d3e..a139099 100644
--- a/app/ns-ui-widgets-category/gestures/tap/tap-page.xml
+++ b/app/ns-ui-widgets-category/gestures/tap/tap-page.xml
@@ -3,9 +3,14 @@
-
-
-
-
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/gestures/tap/tap-ts-page.css b/app/ns-ui-widgets-category/gestures/tap/tap-ts-page.css
deleted file mode 100644
index ff6d9ab..0000000
--- a/app/ns-ui-widgets-category/gestures/tap/tap-ts-page.css
+++ /dev/null
@@ -1,7 +0,0 @@
-Label {
- border-color: lightslategray;
- border-radius: 20;
- font-size: 26;
- horizontal-align: center;
- padding: 15;
-}
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/gestures/tap/tap-ts-page.ts b/app/ns-ui-widgets-category/gestures/tap/tap-ts-page.ts
index 004f2cc..8281b44 100644
--- a/app/ns-ui-widgets-category/gestures/tap/tap-ts-page.ts
+++ b/app/ns-ui-widgets-category/gestures/tap/tap-ts-page.ts
@@ -1,9 +1,19 @@
-import { alert } from "tns-core-modules/ui/dialogs";
+import { GridLayout } from "@nativescript/core";
// >> gest-tap-ts
-import { GestureEventData } from "tns-core-modules/ui/gestures";
+import { GestureEventData } from "@nativescript/core";
export function onTap(args: GestureEventData) {
- console.log(`${args.eventName} event triggered for ${args.view}`);
- alert(`${args.eventName} event triggered for ${args.view}`);
+ console.log("Tap!");
+ console.log("Object that triggered the event: " + args.object);
+ console.log("View that triggered the event: " + args.view);
+ console.log("Event name: " + args.eventName);
+ // >> (hide)
+ let grid = args.object;
+ grid.rotate = 0;
+ grid.animate({
+ rotate: 360,
+ duration: 2000
+ });
+ // << (hide)
}
// << gest-tap-ts
diff --git a/app/ns-ui-widgets-category/gestures/tap/tap-ts-page.xml b/app/ns-ui-widgets-category/gestures/tap/tap-ts-page.xml
index 6754db1..180bf24 100644
--- a/app/ns-ui-widgets-category/gestures/tap/tap-ts-page.xml
+++ b/app/ns-ui-widgets-category/gestures/tap/tap-ts-page.xml
@@ -1,9 +1,12 @@
-
+
-
-
+
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/gestures/touch/article.md b/app/ns-ui-widgets-category/gestures/touch/article.md
index c75c9de..e9a0bee 100644
--- a/app/ns-ui-widgets-category/gestures/touch/article.md
+++ b/app/ns-ui-widgets-category/gestures/touch/article.md
@@ -1,9 +1,5 @@
Action: A finger action was performed.
-This is a general purpose gesture that is triggered whenever a pointer (usually a finger)
- has performed a touch action (up, down, move or cancel).
- `TouchGestureEventData` provides information about all the pointers currently on the screen and their position inside the view that triggered the event.
-
-
+
diff --git a/app/ns-ui-widgets-category/gestures/touch/touch-page.css b/app/ns-ui-widgets-category/gestures/touch/touch-page.css
deleted file mode 100644
index ff6d9ab..0000000
--- a/app/ns-ui-widgets-category/gestures/touch/touch-page.css
+++ /dev/null
@@ -1,7 +0,0 @@
-Label {
- border-color: lightslategray;
- border-radius: 20;
- font-size: 26;
- horizontal-align: center;
- padding: 15;
-}
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/gestures/touch/touch-page.js b/app/ns-ui-widgets-category/gestures/touch/touch-page.js
index b409f33..56cb4ca 100644
--- a/app/ns-ui-widgets-category/gestures/touch/touch-page.js
+++ b/app/ns-ui-widgets-category/gestures/touch/touch-page.js
@@ -1,10 +1,24 @@
+import { Observable } from "@nativescript/core";
+export function onPageLoaded(args) {
+ const page = args.object;
+ const vm = new Observable();
+ page.bindingContext = vm;
+}
+
// >> gest-touch
-function onTouch(args) {
- // args is of type TouchGestureEventData
- console.log(`${args.eventName} event triggered for ${args.view}`);
- console.log(args.action); // action: "up" | "move" | "down" | "cancel"
- console.log("getX(): ", args.getX());
- console.log("getY(): ", args.getY());
+export function onTouch(args) {
+ console.log(`Object that triggered the event: ${args.object}`);
+ console.log(`View that triggered the event: ${args.view}`);
+ console.log(`Event name: ${args.eventName}`);
+ console.log(`Touch action (up, down, cancel or move) ${args.action}`);
+ console.log(`Touch point: [ ${args.getX()} , ${args.getY()} ]`);
+ console.log(`activePointers: ${args.getActivePointers().length}`);
+ // >> (hide)
+ const grid = args.object;
+ const page = grid.page;
+ const vm = page.bindingContext;
+ vm.set("coordX", args.getX());
+ vm.set("coordY", args.getY());
+ // << (hide)
}
-exports.onTouch = onTouch;
// << gest-touch
diff --git a/app/ns-ui-widgets-category/gestures/touch/touch-page.xml b/app/ns-ui-widgets-category/gestures/touch/touch-page.xml
index e7f3873..1784d53 100644
--- a/app/ns-ui-widgets-category/gestures/touch/touch-page.xml
+++ b/app/ns-ui-widgets-category/gestures/touch/touch-page.xml
@@ -1,11 +1,14 @@
-
+
-
-
-
-
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/gestures/touch/touch-ts-page.css b/app/ns-ui-widgets-category/gestures/touch/touch-ts-page.css
deleted file mode 100644
index ff6d9ab..0000000
--- a/app/ns-ui-widgets-category/gestures/touch/touch-ts-page.css
+++ /dev/null
@@ -1,7 +0,0 @@
-Label {
- border-color: lightslategray;
- border-radius: 20;
- font-size: 26;
- horizontal-align: center;
- padding: 15;
-}
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/gestures/touch/touch-ts-page.ts b/app/ns-ui-widgets-category/gestures/touch/touch-ts-page.ts
index a66a8e6..e553062 100644
--- a/app/ns-ui-widgets-category/gestures/touch/touch-ts-page.ts
+++ b/app/ns-ui-widgets-category/gestures/touch/touch-ts-page.ts
@@ -1,29 +1,27 @@
+import { GridLayout, Observable, Page } from "@nativescript/core";
// >> gest-touch-ts
import {
- TouchAction,
TouchGestureEventData
-} from "tns-core-modules/ui/gestures";
+} from "@nativescript/core";
export function onTouch(args: TouchGestureEventData) {
- console.log(`${args.eventName} event triggered for ${args.view}`);
- let action = args.action;
- switch (action) {
- case TouchAction.cancel:
- console.log("canceled");
- break;
- case TouchAction.down:
- console.log("Down!");
- break;
- case TouchAction.up:
- console.log("Up!");
- break;
- case TouchAction.move:
- console.log("Moving");
- break;
- default:
- break;
- }
- console.log("getX(): ", args.getX());
- console.log("getY(): ", args.getY());
+ console.log("Object that triggered the event: " + args.object);
+ console.log("View that triggered the event: " + args.view);
+ console.log("Event name: " + args.eventName);
+ console.log("Touch action (up, down, cancel or move)" + args.action);
+ console.log("Touch point: [" + args.getX() + ", " + args.getY() + "]");
+ console.log("activePointers: " + args.getActivePointers().length);
+ // >> (hide)
+ let grid = args.object;
+ const page = grid.page;
+ const vm = page.bindingContext;
+ vm.set("coordX", args.getX());
+ vm.set("coordY", args.getY());
+ // << (hide)
}
// << gest-touch-ts
+export function onPageLoaded(args) {
+ const page: Page = args.object;
+ const vm = new Observable();
+ page.bindingContext = vm;
+}
diff --git a/app/ns-ui-widgets-category/gestures/touch/touch-ts-page.xml b/app/ns-ui-widgets-category/gestures/touch/touch-ts-page.xml
index 4707dfc..a48aae1 100644
--- a/app/ns-ui-widgets-category/gestures/touch/touch-ts-page.xml
+++ b/app/ns-ui-widgets-category/gestures/touch/touch-ts-page.xml
@@ -1,9 +1,12 @@
-
+
-
-
+
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/html-view/end.md b/app/ns-ui-widgets-category/html-view/end.md
index 92134a7..0bfc8d9 100644
--- a/app/ns-ui-widgets-category/html-view/end.md
+++ b/app/ns-ui-widgets-category/html-view/end.md
@@ -1,7 +1,26 @@
-**API Reference for the** [HtmlView Class](http://docs.nativescript.org/api-reference/modules/_ui_html_view_.html)
+## Properties
-**Native Component**
+| Name | Type | Description |
+|----------|---------|----------------|
+| `html` | `string` | Gets or sets the HTML string. Limited HTML support - for extended support use `WebView` |
-| Android | iOS |
-|:-----------------------|:---------|
+## Events
+
+| Name | Description |
+|----------|----------------|
+| `layoutChangedEvent` | String value used when hooking to layoutChanged event. |
+| `loaded` | String value used when hooking to loaded event. |
+
+## API References
+
+| Name | Type | API Reference Link |
+|----------|---------|--------------------|
+| [HtmlView](https://docs.nativescript.org/api-reference/modules/_ui_html_view_) | `Module` |
+| [HtmlView](https://docs.nativescript.org/api-reference/classes/_ui_html_view_.htmlview) | `Class` |
+
+
+## Native Component
+
+| Android | iOS |
+|:----------------------|:---------|
| [android.widget.TextView](http://developer.android.com/reference/android/widget/TextView.html) | [UILabel](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UILabel_Class/) |
diff --git a/app/ns-ui-widgets-category/html-view/html-view-page.js b/app/ns-ui-widgets-category/html-view/html-view-page.js
index 915f7c8..b771b7c 100644
--- a/app/ns-ui-widgets-category/html-view/html-view-page.js
+++ b/app/ns-ui-widgets-category/html-view/html-view-page.js
@@ -1,12 +1,12 @@
-const ListViewLinksModel = require("../../links-view-model");
-const link = require("../../link");
+import ListViewLinksModel from "../../links-view-model";
+import Link from "../../link";
const navigationLinks = [
- new link("Basics", "ns-ui-widgets-category/html-view/basics/basics-page")
+ new Link("Usage", "ns-ui-widgets-category/html-view/usage/usage-page")
];
const navigationLinksTsc = [
- new link("Basics", "ns-ui-widgets-category/html-view/basics/basics-ts-page")
+ new Link("Usage", "ns-ui-widgets-category/html-view/usage/usage-ts-page")
];
-function onNavigatingTo(args) {
+export function onNavigatingTo(args) {
const page = args.object;
page.bindingContext = new ListViewLinksModel({
links: navigationLinks,
@@ -15,4 +15,4 @@ function onNavigatingTo(args) {
tsclinks: navigationLinksTsc
});
}
-exports.onNavigatingTo = onNavigatingTo;
+
diff --git a/app/ns-ui-widgets-category/html-view/overview.md b/app/ns-ui-widgets-category/html-view/overview.md
index fffda5c..7b6fd0c 100644
--- a/app/ns-ui-widgets-category/html-view/overview.md
+++ b/app/ns-ui-widgets-category/html-view/overview.md
@@ -1,3 +1 @@
-The `HtmlView` control represents a view with HTML content.
-Use this component when you want to show static HTML content.
-For more advanced scenarios and for dynamic content use `WebView`.
+The `HtmlView` represents a view with HTML content. Use this component instead of a `WebView` when you want to show static HTML content with base HTML support.
diff --git a/app/ns-ui-widgets-category/html-view/basics/article.md b/app/ns-ui-widgets-category/html-view/usage/article.md
similarity index 50%
rename from app/ns-ui-widgets-category/html-view/basics/article.md
rename to app/ns-ui-widgets-category/html-view/usage/article.md
index bbc0b92..70bcce1 100644
--- a/app/ns-ui-widgets-category/html-view/basics/article.md
+++ b/app/ns-ui-widgets-category/html-view/usage/article.md
@@ -1,14 +1,5 @@
-
-The `HtmlView` module is imported fron `tns-core-modules/html-view`;
-
-
-
-Creating a `HtmlView` in XML.
-
-Creating a `HtmlView` element via code-behind files.
> Note: The `HtmlView` component has limited styling capabilities. For more complex scenarios use the `WebView` component.
-
diff --git a/app/ns-ui-widgets-category/html-view/basics/basics-page.js b/app/ns-ui-widgets-category/html-view/usage/usage-page.js
similarity index 67%
rename from app/ns-ui-widgets-category/html-view/basics/basics-page.js
rename to app/ns-ui-widgets-category/html-view/usage/usage-page.js
index 598c2ba..9585c2d 100644
--- a/app/ns-ui-widgets-category/html-view/basics/basics-page.js
+++ b/app/ns-ui-widgets-category/html-view/usage/usage-page.js
@@ -1,9 +1,9 @@
-const Observable = require("tns-core-modules/data/observable").Observable;
-// >> html-view-require
-const HtmlView = require("tns-core-modules/ui/html-view").HtmlView;
-// << html-view-require
+import { Observable } from "@nativescript/core";
+// >> html-view-code-behind
+import { HtmlView } from "@nativescript/core";
+// >> (hide)
-function onPageLoaded(args) {
+export function onPageLoaded(args) {
const page = args.object;
const container = page.getViewById("container");
const vm = new Observable();
@@ -16,13 +16,13 @@ function onPageLoaded(args) {
container.removeChildren();
container.addChild(createHtmlView());
}
-exports.onPageLoaded = onPageLoaded;
+// << (hide)
function createHtmlView() {
- // >> html-view-code-behind
+
const myHtmlView = new HtmlView();
myHtmlView.html = "NativeScript HtmlView
This component accept simple HTML strings
";
- // << html-view-code-behind
return myHtmlView;
}
+// << html-view-code-behind
diff --git a/app/ns-ui-widgets-category/html-view/basics/basics-page.xml b/app/ns-ui-widgets-category/html-view/usage/usage-page.xml
similarity index 100%
rename from app/ns-ui-widgets-category/html-view/basics/basics-page.xml
rename to app/ns-ui-widgets-category/html-view/usage/usage-page.xml
diff --git a/app/ns-ui-widgets-category/html-view/basics/basics-ts-page.ts b/app/ns-ui-widgets-category/html-view/usage/usage-ts-page.ts
similarity index 58%
rename from app/ns-ui-widgets-category/html-view/basics/basics-ts-page.ts
rename to app/ns-ui-widgets-category/html-view/usage/usage-ts-page.ts
index 0cf33f2..6c9f7d7 100644
--- a/app/ns-ui-widgets-category/html-view/basics/basics-ts-page.ts
+++ b/app/ns-ui-widgets-category/html-view/usage/usage-ts-page.ts
@@ -1,9 +1,7 @@
-import { EventData, Observable } from "tns-core-modules/data/observable";
-import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout";
-import { Page } from "tns-core-modules/ui/page";
-// >> html-view-require-ts
-import { HtmlView } from "tns-core-modules/ui/html-view";
-// << html-view-require-ts
+import { EventData, Observable, Page, StackLayout } from "@nativescript/core";
+// >> html-view-code-behind-ts
+import { HtmlView } from "@nativescript/core";
+// >> (hide)
function onPageLoaded(args: EventData) {
const page = args.object;
@@ -20,17 +18,15 @@ function onPageLoaded(args: EventData) {
container.removeChildren();
container.addChild(createHtmlView());
}
-exports.onPageLoaded = onPageLoaded;
+// << (hide)
function createHtmlView() {
- // >> html-view-code-behind-ts
const myHtmlView = new HtmlView();
myHtmlView.html = `
NativeScript HtmlView
- This component accept simple HTML strings
- `;
- // << html-view-code-behind-ts
+ This component accept simple HTML strings
`;
return myHtmlView;
}
+// << html-view-code-behind-ts
diff --git a/app/ns-ui-widgets-category/html-view/basics/basics-ts-page.xml b/app/ns-ui-widgets-category/html-view/usage/usage-ts-page.xml
similarity index 100%
rename from app/ns-ui-widgets-category/html-view/basics/basics-ts-page.xml
rename to app/ns-ui-widgets-category/html-view/usage/usage-ts-page.xml
diff --git a/app/ns-ui-widgets-category/image-cache/basics/basics-page.js b/app/ns-ui-widgets-category/image-cache/basics/basics-page.js
index ad0c945..3d02204 100644
--- a/app/ns-ui-widgets-category/image-cache/basics/basics-page.js
+++ b/app/ns-ui-widgets-category/image-cache/basics/basics-page.js
@@ -1,12 +1,8 @@
// >> image-cache-require
-const Cache = require("tns-core-modules/ui/image-cache").Cache;
+import { Cache } from "@nativescript/core/ui/image-cache";
// << image-cache-require
-const fromNativeSource = require("image-source").fromNativeSource;
-const fromFile = require("image-source").fromFile;
-
-const Observable = require("tns-core-modules/data/observable").Observable;
-
-function onLoaded(args) {
+import { ImageSource, Observable } from "@nativescript/core";
+export function onLoaded(args) {
const page = args.object;
const vm = new Observable();
@@ -14,12 +10,11 @@ function onLoaded(args) {
page.bindingContext = vm;
}
-exports.onLoaded = onLoaded;
function cacheImage(viewModel) {
// >> image-cache-code
const cache = new Cache();
- cache.placeholder = fromFile("~/images/logo.png");
+ cache.placeholder = ImageSource.fromFileSync("~/images/logo.png");
cache.maxRequests = 5;
// set the placeholder while the desired image is downloaded
@@ -35,7 +30,7 @@ function cacheImage(viewModel) {
if (image) {
// If present -- use it.
- cachedImageSource = imageSource.fromNativeSource(image);
+ cachedImageSource = new ImageSource(image);
viewModel.set("imageSource", cachedImageSource);
} else {
// If not present -- request its download + put it in the cache.
@@ -44,7 +39,7 @@ function cacheImage(viewModel) {
url: url,
completed: (image, key) => {
if (url === key) {
- cachedImageSource = fromNativeSource(image);
+ cachedImageSource = new ImageSource(image);
viewModel.set("imageSource", cachedImageSource); // set the downloaded image
}
}
diff --git a/app/ns-ui-widgets-category/image-cache/basics/basics-ts-page.ts b/app/ns-ui-widgets-category/image-cache/basics/basics-ts-page.ts
index d2f6761..1ff93af 100644
--- a/app/ns-ui-widgets-category/image-cache/basics/basics-ts-page.ts
+++ b/app/ns-ui-widgets-category/image-cache/basics/basics-ts-page.ts
@@ -1,9 +1,7 @@
// >> image-cache-require-ts
-import { Cache } from "tns-core-modules/ui/image-cache";
+import { ImageCache } from "@nativescript/core";
// << image-cache-require-ts
-import { EventData, Observable } from "tns-core-modules/data/observable";
-import { fromFile, fromNativeSource } from "tns-core-modules/image-source";
-import { Page } from "tns-core-modules/ui/page";
+import { EventData, ImageSource, Observable, Page } from "@nativescript/core";
export function onLoaded(args: EventData) {
const page = args.object;
@@ -16,8 +14,8 @@ export function onLoaded(args: EventData) {
function cacheImage(viewModel) {
// >> image-cache-code-ts
- const cache = new Cache();
- cache.placeholder = fromFile("~/images/logo.png");
+ const cache = new ImageCache();
+ cache.placeholder = ImageSource.fromFileSync("~/images/logo.png");
cache.maxRequests = 5;
// set the placeholder while the desired image is donwloaded
@@ -33,7 +31,7 @@ function cacheImage(viewModel) {
if (myImage) {
// If present -- use it.
- cachedImageSource = fromNativeSource(myImage);
+ cachedImageSource = new ImageSource(myImage);
viewModel.set("imageSource", cachedImageSource);
} else {
// If not present -- request its download + put it in the cache.
@@ -42,7 +40,7 @@ function cacheImage(viewModel) {
url: url,
completed: (image, key) => {
if (url === key) {
- cachedImageSource = fromNativeSource(image);
+ cachedImageSource = new ImageSource(image);
viewModel.set("imageSource", cachedImageSource); // set the downloaded iamge
}
}
diff --git a/app/ns-ui-widgets-category/image-cache/image-cache-page.js b/app/ns-ui-widgets-category/image-cache/image-cache-page.js
index adc7df4..690f1de 100644
--- a/app/ns-ui-widgets-category/image-cache/image-cache-page.js
+++ b/app/ns-ui-widgets-category/image-cache/image-cache-page.js
@@ -1,12 +1,12 @@
-const ListViewLinksModel = require("../../links-view-model");
-const link = require("../../link");
+import ListViewLinksModel from "../../links-view-model";
+import Link from "../../link";
const navigationLinks = [
- new link("Basics", "ns-ui-widgets-category/image-cache/basics/basics-page")
+ new Link("Basics", "ns-ui-widgets-category/image-cache/basics/basics-page")
];
const navigationLinksTsc = [
- new link("Basics", "ns-ui-widgets-category/image-cache/basics/basics-ts-page")
+ new Link("Basics", "ns-ui-widgets-category/image-cache/basics/basics-ts-page")
];
-function onNavigatingTo(args) {
+export function onNavigatingTo(args) {
const page = args.object;
page.bindingContext = new ListViewLinksModel({
links: navigationLinks,
@@ -15,4 +15,4 @@ function onNavigatingTo(args) {
tsclinks: navigationLinksTsc
});
}
-exports.onNavigatingTo = onNavigatingTo;
+
diff --git a/app/ns-ui-widgets-category/image/basics/article.md b/app/ns-ui-widgets-category/image/basics/article.md
deleted file mode 100644
index 895768f..0000000
--- a/app/ns-ui-widgets-category/image/basics/article.md
+++ /dev/null
@@ -1,27 +0,0 @@
-The prefix of the `src` value specifies where the image will be loaded form.
-The possible options are:
-
-### Using Resources
-
-Using the `res://` prefix you can load a resource image. This is the suggested approach, as it uses the native methods for loading the best image for the current device screen density and resolution.
-
-Loading an image from application resources (in `App_Resources/`).
-
-
-Loading an image from application resources (in `App_Resources/`) via code-behind.
-
-
-
-### Using Local Files
-
-Using the `~/` prefix, you can load images relative to the App folder inside your project.
-
-Loading an image from the local file system. In the example below the full path of the image is `/app/images/logo.png`
-
-
-### Using Online Resources
-
-Web images have an http:// or https:// prefix. When such an image is loaded, an asynchronous http request will be sent and the image will be shown if the request is successful.
-
-Loading an image from URL. For large images use `loadMode` property to avoid blocking of the UI (see the [best practices](https://docs.nativescript.org/best-practices/images-optimisations) article for more information)
-
diff --git a/app/ns-ui-widgets-category/image/basics/basics-page.css b/app/ns-ui-widgets-category/image/basics/basics-page.css
deleted file mode 100644
index f9d6690..0000000
--- a/app/ns-ui-widgets-category/image/basics/basics-page.css
+++ /dev/null
@@ -1,5 +0,0 @@
-Image {
- height: 60;
- margin: 16;
- width: 60;
-}
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/image/basics/basics-page.js b/app/ns-ui-widgets-category/image/basics/basics-page.js
deleted file mode 100644
index 011d142..0000000
--- a/app/ns-ui-widgets-category/image/basics/basics-page.js
+++ /dev/null
@@ -1,12 +0,0 @@
-const Image = require("tns-core-modules/ui/image").Image;
-
-function containerLoaded(args) {
- const container = args.object;
- // >> image-code-behdnd
- const newImage = new Image();
- newImage.src = "res://icon";
- newImage.stretch = "aspectFill";
- // << image-code-behdnd
- container.addChild(newImage);
-}
-exports.containerLoaded = containerLoaded;
diff --git a/app/ns-ui-widgets-category/image/basics/basics-ts-page.css b/app/ns-ui-widgets-category/image/basics/basics-ts-page.css
deleted file mode 100644
index f9d6690..0000000
--- a/app/ns-ui-widgets-category/image/basics/basics-ts-page.css
+++ /dev/null
@@ -1,5 +0,0 @@
-Image {
- height: 60;
- margin: 16;
- width: 60;
-}
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/image/basics/basics-ts-page.ts b/app/ns-ui-widgets-category/image/basics/basics-ts-page.ts
deleted file mode 100644
index 3dedb1b..0000000
--- a/app/ns-ui-widgets-category/image/basics/basics-ts-page.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-import { EventData } from "tns-core-modules/data/observable";
-import { Image } from "tns-core-modules/ui/image";
-import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout";
-
-export function containerLoaded(args: EventData) {
- const container = args.object;
- // >> image-code-behdnd-ts
- const newImage = new Image();
- newImage.src = "res://icon";
- newImage.stretch = "aspectFill";
-
- // << image-code-behdnd-ts
- container.addChild(newImage);
-}
diff --git a/app/ns-ui-widgets-category/image/binding/article.md b/app/ns-ui-widgets-category/image/binding/article.md
deleted file mode 100644
index dc24233..0000000
--- a/app/ns-ui-widgets-category/image/binding/article.md
+++ /dev/null
@@ -1,7 +0,0 @@
-
-Common scenario would be to bind the `src` property to a dynamically received value.
-
-Loading an image with `src` property binding.
-
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/image/binding/binding-page.js b/app/ns-ui-widgets-category/image/binding/binding-page.js
deleted file mode 100644
index 594905e..0000000
--- a/app/ns-ui-widgets-category/image/binding/binding-page.js
+++ /dev/null
@@ -1,11 +0,0 @@
-const Observable = require("tns-core-modules/data/observable").Observable;
-
-function onNavigatingTo(args) {
- const view = args.object;
- // >> image-binding-code
- const vm = new Observable();
- vm.set("imageUri", "~/images/logo.png");
- view.bindingContext = vm;
- // << image-binding-code
-}
-exports.onNavigatingTo = onNavigatingTo;
diff --git a/app/ns-ui-widgets-category/image/binding/binding-page.xml b/app/ns-ui-widgets-category/image/binding/binding-page.xml
deleted file mode 100644
index 90deeaf..0000000
--- a/app/ns-ui-widgets-category/image/binding/binding-page.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/image/binding/binding-ts-page.xml b/app/ns-ui-widgets-category/image/binding/binding-ts-page.xml
deleted file mode 100644
index 32cd0a3..0000000
--- a/app/ns-ui-widgets-category/image/binding/binding-ts-page.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/image/end.md b/app/ns-ui-widgets-category/image/end.md
index 2941c2e..579d422 100644
--- a/app/ns-ui-widgets-category/image/end.md
+++ b/app/ns-ui-widgets-category/image/end.md
@@ -1,12 +1,26 @@
-**API Reference for**
- * [Image module](http://docs.nativescript.org/api-reference/modules/_ui_image_.html)
- * [ImageSource module](https://docs.nativescript.org/api-reference/classes/_image_source_.imagesource)
+## Properties
+| Name | Type | Description |
+|----------|---------|----------------|
+| `decodeHeight` | `Length` | [**Android only**] Gets or sets the desired decode height of the image. |
+| `decodeWidth` | `Lengt` | [**Android only**] Gets or sets the desired decode width of the image. |
+| `isLoaded` | `boolean` | Gets a value indicating if the image is loaded. |
+| `isLoading` | `boolean` | Gets a value indicating if the image is currently loading. |
+| `loadMode` | **_"sync"_**, **_"async"_** | Gets or sets the loading strategy for images on the local file system.|
+| `src` | `string` | Gets or sets the source of the Image. This can be either an URL string or a native image instance. |
+| `stretch` | `Stretch` | Gets or sets the image stretch mode. |
+| `tintColor` | `Color` | A color used to tint template images. |
-**Native Component**
-| Android | iOS |
-|:-----------------------|:---------|
-| [android.widget.ImageView](http://developer.android.com/reference/android/widget/ImageView.html) | [UIImageView](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIImageView_Class/) |
+## API References
+
+| Name | Type |
+|----------|---------|
+| [tns-core-modules/ui/image](http://docs.nativescript.org/api-reference/modules/_ui_image_.html) | `Module` |
+| [Image](https://docs.nativescript.org/api-reference/classes/_ui_image_.image) | `Class` |
-**See Also** [Android Image Optimization](https://docs.nativescript.org/best-practices/images-optimisations)
+## Native Component
+
+| Android | iOS |
+|:----------------------|:---------|
+| [android.widget.ImageView](http://developer.android.com/reference/android/widget/ImageView.html) | [UIImageView](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIImageView_Class/) |
diff --git a/app/ns-ui-widgets-category/image/image-page.js b/app/ns-ui-widgets-category/image/image-page.js
index 1a69714..4a540d0 100644
--- a/app/ns-ui-widgets-category/image/image-page.js
+++ b/app/ns-ui-widgets-category/image/image-page.js
@@ -1,17 +1,14 @@
-const ListViewLinksModel = require("../../links-view-model");
-const link = require("../../link");
+import ListViewLinksModel from "../../links-view-model";
+import Link from "../../link";
const navigationLinks = [
- new link("Basics", "ns-ui-widgets-category/image/basics/basics-page"),
- new link("Binding", "ns-ui-widgets-category/image/binding/binding-page"),
- new link("Image Source", "ns-ui-widgets-category/image/image-source/image-source-page"),
- new link("Stretching", "ns-ui-widgets-category/image/stretching/stretching-page")
+ new Link("Usage", "ns-ui-widgets-category/image/usage/usage-page"),
+ new Link("Styling", "ns-ui-widgets-category/image/styling/styling-page")
];
const navigationLinksTsc = [
- new link("Basics", "ns-ui-widgets-category/image/basics/basics-ts-page"),
- new link("Binding", "ns-ui-widgets-category/image/binding/binding-ts-page"),
- new link("Image Source", "ns-ui-widgets-category/image/image-source/image-source-ts-page")
+ new Link("Usage", "ns-ui-widgets-category/image/usage/usage-ts-page"),
+ new Link("Styling", "ns-ui-widgets-category/image/styling/styling-ts-page")
];
-function onNavigatingTo(args) {
+export function onNavigatingTo(args) {
const page = args.object;
page.bindingContext = new ListViewLinksModel({
links: navigationLinks,
@@ -20,4 +17,4 @@ function onNavigatingTo(args) {
tsclinks: navigationLinksTsc
});
}
-exports.onNavigatingTo = onNavigatingTo;
+
diff --git a/app/ns-ui-widgets-category/image/image-source/article.md b/app/ns-ui-widgets-category/image/image-source/article.md
deleted file mode 100644
index 2e98073..0000000
--- a/app/ns-ui-widgets-category/image/image-source/article.md
+++ /dev/null
@@ -1,8 +0,0 @@
-We can use the `image-source` module to create an image source and manually set it to the image.
-
-
-
-Common scenario when working with images is to convert them to and from Base64 encoded string.
-In NativeScript converting is achieved by using `toBase64String` and `fromBase64` methods from `image-source` module. Then create an `ImageSource` instance and bind it to the source property of Image.
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/image/image-source/image-source-page.js b/app/ns-ui-widgets-category/image/image-source/image-source-page.js
deleted file mode 100644
index 6c6f0e1..0000000
--- a/app/ns-ui-widgets-category/image/image-source/image-source-page.js
+++ /dev/null
@@ -1,45 +0,0 @@
-const imageSourceModule = require("tns-core-modules/image-source");
-const Image = require("tns-core-modules/ui/image").Image;
-const Label = require("tns-core-modules/ui/label").Label;
-
-exports.onStackLoaded = function (args) {
- const stack = args.object;
- // >> image-image-source
- const image = new Image();
- const imageSource = imageSourceModule.fromResource("icon");
- image.imageSource = imageSource;
- image.height = 100;
- image.stretch = "aspectFit";
- // << image-image-source
-
- const lbl = new Label();
- lbl.text = "Image created via fromResource() method";
- lbl.css = "margin-top: 20; margin-left: 20;";
-
- const imageFromBase64 = new Image();
- const myImageSource = usingBase64Strings();
- imageFromBase64.imageSource = myImageSource;
- imageFromBase64.height = 100;
- imageFromBase64.stretch = "aspectFit";
-
- const lbl2 = new Label();
- lbl2.text = "Image created via base64 string";
- lbl2.css = "margin-top: 120; margin-left: 20;";
-
- stack.addChild(lbl);
- stack.addChild(image);
-
- stack.addChild(lbl2);
- stack.addChild(imageFromBase64);
-};
-
-function usingBase64Strings() {
- // >> using-base64-strings
- // const imageSourceModule = require("image-source");
- const myImageSource = imageSourceModule.fromResource("icon");
- const imageAsBase64String = myImageSource.toBase64String("png", 100); // base64 string; default max image quality;
- const base64ImageSource = imageSourceModule.fromBase64(imageAsBase64String);
- // << using-base64-strings
-
- return base64ImageSource;
-}
diff --git a/app/ns-ui-widgets-category/image/image-source/image-source-page.xml b/app/ns-ui-widgets-category/image/image-source/image-source-page.xml
deleted file mode 100644
index 8bfe13f..0000000
--- a/app/ns-ui-widgets-category/image/image-source/image-source-page.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/image/image-source/image-source-ts-page.ts b/app/ns-ui-widgets-category/image/image-source/image-source-ts-page.ts
deleted file mode 100644
index 9e850e3..0000000
--- a/app/ns-ui-widgets-category/image/image-source/image-source-ts-page.ts
+++ /dev/null
@@ -1,47 +0,0 @@
-import { fromBase64, fromResource } from "tns-core-modules/image-source";
-import { Image } from "tns-core-modules/ui/image";
-import { Label } from "tns-core-modules/ui/label";
-
-export function onStackLoaded(args) {
- const stack = args.object;
- // >> image-image-source-ts
- // import { fromResource } from "tns-core-modules/image-source";
- // import { Image } from "tns-core-modules/ui/image";
- const image = new Image();
- const imageSource = fromResource("icon");
- image.imageSource = imageSource;
- image.height = 100;
- image.stretch = "aspectFit";
- // << image-image-source-ts
-
- const lbl = new Label();
- lbl.text = "Image created via fromResource() method";
- lbl.css = "margin-top: 20; margin-left: 20;";
-
- const imageFromBase64 = new Image();
- const myImageSource = usingBase64Strings();
- imageFromBase64.imageSource = myImageSource;
- imageFromBase64.height = 100;
- imageFromBase64.stretch = "aspectFit";
-
- const lbl2 = new Label();
- lbl2.text = "Image created via base64 string";
- lbl2.css = "margin-top: 120; margin-left: 20;";
-
- stack.addChild(lbl);
- stack.addChild(image);
-
- stack.addChild(lbl2);
- stack.addChild(imageFromBase64);
-}
-
-function usingBase64Strings() {
- // >> using-base64-strings-ts
- // import { fromBase64, fromResource } from "tns-core-modules/image-source";
- const myImageSource = fromResource("icon");
- const imageAsBase64String = myImageSource.toBase64String("png", 100); // base64 string; default max image quality;
- const base64ImageSource = fromBase64(imageAsBase64String);
- // << using-base64-strings-ts
-
- return base64ImageSource;
-}
diff --git a/app/ns-ui-widgets-category/image/image-source/image-source-ts-page.xml b/app/ns-ui-widgets-category/image/image-source/image-source-ts-page.xml
deleted file mode 100644
index 8bfe13f..0000000
--- a/app/ns-ui-widgets-category/image/image-source/image-source-ts-page.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/image/metadata.md b/app/ns-ui-widgets-category/image/metadata.md
index 4c25f57..b290bc3 100644
--- a/app/ns-ui-widgets-category/image/metadata.md
+++ b/app/ns-ui-widgets-category/image/metadata.md
@@ -4,3 +4,4 @@ description: The Image is UI widget, which is a common abstraction over iOS's UI
position: 270
slug: image
---
+example-order: usage, styling
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/image/overview.md b/app/ns-ui-widgets-category/image/overview.md
index 2ea5dc1..1f16551 100644
--- a/app/ns-ui-widgets-category/image/overview.md
+++ b/app/ns-ui-widgets-category/image/overview.md
@@ -1,6 +1,4 @@
The `Image` widget shows an image in your mobile application.
-In a NativeScript application images are added to an application either declaratively (XML) or with code. We can load the image from an `ImageSource` or a URL using the `src` property.
-Behind the `Image` module stands `UIImage` on iOS and `android.widget.ImageView` on Android.
-As working with images is an essential part of each mobile application following [the best practices](https://docs.nativescript.org/best-practices/images-optimisations) is a must.
-> **Note:** NativeScript supports images encoded as `PNG` or `JPG` files.
+> **Note:** When working with images following [the best practices](https://docs.nativescript.org/best-practices/images-optimisations) is a must.
+
diff --git a/app/ns-ui-widgets-category/image/stretching/article.md b/app/ns-ui-widgets-category/image/stretching/article.md
deleted file mode 100644
index 0dd0be4..0000000
--- a/app/ns-ui-widgets-category/image/stretching/article.md
+++ /dev/null
@@ -1,12 +0,0 @@
-The stretch functionality allows us to describe how content is resized to fill its allocated space. The available options for this property are as follow:
-
-* `none` - The image preserves its original size
-
-* `fill` - The image is resized to fill the destination dimensions. In this case, the aspect ratio is not preserved.
-
-* `aspectFit` - The image is resized to fit the destination dimensions while it preserves its native aspect ratio.
-
-* `aspectFill` - 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 will be clipped to fit in the destination.
-
-
-> **Note:** The default value for this property is `aspectFit`.
diff --git a/app/ns-ui-widgets-category/image/stretching/stretching-page.css b/app/ns-ui-widgets-category/image/stretching/stretching-page.css
deleted file mode 100644
index de8e0cc..0000000
--- a/app/ns-ui-widgets-category/image/stretching/stretching-page.css
+++ /dev/null
@@ -1,4 +0,0 @@
-StackLayout {
- border-color: blue;
- border-width: 1;
-}
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/image/stretching/stretching-page.xml b/app/ns-ui-widgets-category/image/stretching/stretching-page.xml
deleted file mode 100644
index 63cdecf..0000000
--- a/app/ns-ui-widgets-category/image/stretching/stretching-page.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/image/styling/article.md b/app/ns-ui-widgets-category/image/styling/article.md
new file mode 100644
index 0000000..e742690
--- /dev/null
+++ b/app/ns-ui-widgets-category/image/styling/article.md
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/image/styling/styling-page.css b/app/ns-ui-widgets-category/image/styling/styling-page.css
new file mode 100644
index 0000000..9c34294
--- /dev/null
+++ b/app/ns-ui-widgets-category/image/styling/styling-page.css
@@ -0,0 +1,16 @@
+/* >> image-icon-fonts-css */
+Image {
+ width: 100;
+ height: 100;
+}
+
+.fas {
+ font-family: "Font Awesome 5 Free", "fa-regular-400";
+ font-weight: 900;
+}
+
+.t-36 {
+ font-size: 36;
+}
+
+/* << image-icon-fonts-css */
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/image/styling/styling-page.js b/app/ns-ui-widgets-category/image/styling/styling-page.js
new file mode 100644
index 0000000..a9d81c3
--- /dev/null
+++ b/app/ns-ui-widgets-category/image/styling/styling-page.js
@@ -0,0 +1,15 @@
+// >> image-icon-fonts-js
+import { Image } from "@nativescript/core";
+export function containerLoaded(args) {
+ const container = args.object;
+
+ const newImage = new Image();
+ const imageString = String.fromCharCode(0xF2b9);
+ newImage.src = `font://${imageString}`;
+ newImage.className = "font-awesome font-size";
+ newImage.width = 49;
+ newImage.height = 49;
+
+ container.addChild(newImage);
+}
+// << image-icon-fonts-js
diff --git a/app/ns-ui-widgets-category/image/styling/styling-page.xml b/app/ns-ui-widgets-category/image/styling/styling-page.xml
new file mode 100644
index 0000000..f18c497
--- /dev/null
+++ b/app/ns-ui-widgets-category/image/styling/styling-page.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/image/styling/styling-ts-page.css b/app/ns-ui-widgets-category/image/styling/styling-ts-page.css
new file mode 100644
index 0000000..c3ad1f6
--- /dev/null
+++ b/app/ns-ui-widgets-category/image/styling/styling-ts-page.css
@@ -0,0 +1,13 @@
+Image {
+ width: 100;
+ height: 100;
+}
+
+.fas {
+ font-family: "Font Awesome 5 Free", "fa-regular-400";
+ font-weight: 900;
+}
+
+.t-36 {
+ font-size: 36;
+}
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/image/styling/styling-ts-page.ts b/app/ns-ui-widgets-category/image/styling/styling-ts-page.ts
new file mode 100644
index 0000000..6dd6eec
--- /dev/null
+++ b/app/ns-ui-widgets-category/image/styling/styling-ts-page.ts
@@ -0,0 +1,16 @@
+// >> image-icon-fonts-ts
+import { EventData, Image, StackLayout } from "@nativescript/core";
+
+export function containerLoaded(args: EventData) {
+ const container = args.object;
+
+ const newImage = new Image();
+ const imageString = String.fromCharCode(0xF2b9);
+ newImage.src = "font://" + imageString;
+ newImage.className = "font-awesome font-size";
+ newImage.width = 49;
+ newImage.height = 49;
+
+ container.addChild(newImage);
+}
+// << image-icon-fonts-ts
diff --git a/app/ns-ui-widgets-category/image/styling/styling-ts-page.xml b/app/ns-ui-widgets-category/image/styling/styling-ts-page.xml
new file mode 100644
index 0000000..1b3b1ce
--- /dev/null
+++ b/app/ns-ui-widgets-category/image/styling/styling-ts-page.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/image/usage/article.md b/app/ns-ui-widgets-category/image/usage/article.md
new file mode 100644
index 0000000..c18fb2e
--- /dev/null
+++ b/app/ns-ui-widgets-category/image/usage/article.md
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/app/ns-ui-widgets-category/image/usage/usage-page.css b/app/ns-ui-widgets-category/image/usage/usage-page.css
new file mode 100644
index 0000000..7f66cb6
--- /dev/null
+++ b/app/ns-ui-widgets-category/image/usage/usage-page.css
@@ -0,0 +1,15 @@
+/* >> image-usage-css-js */
+Image {
+ width: 50;
+ height: 50;
+}
+
+.fas {
+ font-family: "Font Awesome 5 Free", "fa-solid-900";
+ font-weight: 900;
+}
+
+.t-36 {
+ font-size: 36;
+}
+/* << image-usage-css-js */
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/image/usage/usage-page.js b/app/ns-ui-widgets-category/image/usage/usage-page.js
new file mode 100644
index 0000000..ff9ddab
--- /dev/null
+++ b/app/ns-ui-widgets-category/image/usage/usage-page.js
@@ -0,0 +1,13 @@
+// >> image-binding-code
+import { Observable } from "@nativescript/core";
+
+export function onNavigatingTo(args) {
+ const view = args.object;
+
+ const vm = new Observable();
+ vm.set("imageUri", "~/images/logo.png");
+ view.bindingContext = vm;
+
+}
+
+// << image-binding-code
diff --git a/app/ns-ui-widgets-category/image/basics/basics-page.xml b/app/ns-ui-widgets-category/image/usage/usage-page.xml
similarity index 57%
rename from app/ns-ui-widgets-category/image/basics/basics-page.xml
rename to app/ns-ui-widgets-category/image/usage/usage-page.xml
index 503a1c0..288812e 100644
--- a/app/ns-ui-widgets-category/image/basics/basics-page.xml
+++ b/app/ns-ui-widgets-category/image/usage/usage-page.xml
@@ -1,19 +1,19 @@
-
+
-
+
-
+
-
-
+
-
-
+
-
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/image/usage/usage-ts-page.css b/app/ns-ui-widgets-category/image/usage/usage-ts-page.css
new file mode 100644
index 0000000..3328e45
--- /dev/null
+++ b/app/ns-ui-widgets-category/image/usage/usage-ts-page.css
@@ -0,0 +1,13 @@
+Image {
+ width: 50;
+ height: 50;
+}
+
+.fas {
+ font-family: "Font Awesome 5 Free", "fa-solid-900";
+ font-weight: 900;
+}
+
+.t-36 {
+ font-size: 36;
+}
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/image/binding/binding-ts-page.ts b/app/ns-ui-widgets-category/image/usage/usage-ts-page.ts
similarity index 50%
rename from app/ns-ui-widgets-category/image/binding/binding-ts-page.ts
rename to app/ns-ui-widgets-category/image/usage/usage-ts-page.ts
index 35e519c..e74a141 100644
--- a/app/ns-ui-widgets-category/image/binding/binding-ts-page.ts
+++ b/app/ns-ui-widgets-category/image/usage/usage-ts-page.ts
@@ -1,11 +1,12 @@
-import { EventData, Observable } from "tns-core-modules/data/observable";
-import { View } from "tns-core-modules/ui/core/view";
+// >> image-binding-code-ts
+import { EventData, Observable, View } from "@nativescript/core";
export function onNavigatingTo(args: EventData) {
const view = args.object;
- // >> image-binding-code-ts
+
const vm = new Observable();
vm.set("imageUri", "~/images/logo.png");
view.bindingContext = vm;
- // << image-binding-code-ts
+
}
+// << image-binding-code-ts
diff --git a/app/ns-ui-widgets-category/image/basics/basics-ts-page.xml b/app/ns-ui-widgets-category/image/usage/usage-ts-page.xml
similarity index 73%
rename from app/ns-ui-widgets-category/image/basics/basics-ts-page.xml
rename to app/ns-ui-widgets-category/image/usage/usage-ts-page.xml
index 0952e15..f4b7fa9 100644
--- a/app/ns-ui-widgets-category/image/basics/basics-ts-page.xml
+++ b/app/ns-ui-widgets-category/image/usage/usage-ts-page.xml
@@ -1,4 +1,4 @@
-
+
@@ -7,6 +7,7 @@
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/label/basics/article.md b/app/ns-ui-widgets-category/label/basics/article.md
deleted file mode 100644
index 420e29a..0000000
--- a/app/ns-ui-widgets-category/label/basics/article.md
+++ /dev/null
@@ -1,10 +0,0 @@
-The `Label` widget comes with `text` property.
-
-Setting a label in XML page and how to bind its text property.
-
-
-
-
-Accessing a label and modifying its properties.
-
-
diff --git a/app/ns-ui-widgets-category/label/basics/basics-page.css b/app/ns-ui-widgets-category/label/basics/basics-page.css
deleted file mode 100644
index 5eaaa2f..0000000
--- a/app/ns-ui-widgets-category/label/basics/basics-page.css
+++ /dev/null
@@ -1,5 +0,0 @@
-Label {
- color: blue;
- font-size:24;
- margin: 50;
-}
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/label/basics/basics-page.js b/app/ns-ui-widgets-category/label/basics/basics-page.js
deleted file mode 100644
index c479c9d..0000000
--- a/app/ns-ui-widgets-category/label/basics/basics-page.js
+++ /dev/null
@@ -1,18 +0,0 @@
-const Observable = require("tns-core-modules/data/observable").Observable;
-
-function onNavigatingTo(args) {
- // >> label-text-binding
- const page = args.object;
- const vm = new Observable();
- vm.set("title", "NativeScript is Awesome");
- page.bindingContext = vm;
- // << label-text-binding
-
- // >> label-accessing-text
- const label = page.getViewById("lbl");
- label.text = "NativeScript is Awesome";
- label.textWrap = true;
- label.textAlignment = "center";
- // << label-accessing-text
-}
-exports.onNavigatingTo = onNavigatingTo;
diff --git a/app/ns-ui-widgets-category/label/basics/basics-ts-page.css b/app/ns-ui-widgets-category/label/basics/basics-ts-page.css
deleted file mode 100644
index 5eaaa2f..0000000
--- a/app/ns-ui-widgets-category/label/basics/basics-ts-page.css
+++ /dev/null
@@ -1,5 +0,0 @@
-Label {
- color: blue;
- font-size:24;
- margin: 50;
-}
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/label/basics/basics-ts-page.ts b/app/ns-ui-widgets-category/label/basics/basics-ts-page.ts
deleted file mode 100644
index 294f602..0000000
--- a/app/ns-ui-widgets-category/label/basics/basics-ts-page.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { EventData, Observable } from "tns-core-modules/data/observable";
-import { Label } from "tns-core-modules/ui/label";
-import { Page } from "tns-core-modules/ui/page";
-
-export function onNavigatingTo(args: EventData) {
- // >> label-text-binding-ts
- const page = args.object;
- const vm = new Observable();
- vm.set("title", "NativeScript is Awesome");
- page.bindingContext = vm;
- // << label-text-binding-ts
-
- // >> label-accessing-text-ts
- const label = page.getViewById("lbl");
- label.text = "NativeScript is Awesome";
- label.textWrap = true;
- label.textAlignment = "center";
- // << label-accessing-text-ts
-}
diff --git a/app/ns-ui-widgets-category/label/code-behind/article.md b/app/ns-ui-widgets-category/label/code-behind/article.md
deleted file mode 100644
index 3bca029..0000000
--- a/app/ns-ui-widgets-category/label/code-behind/article.md
+++ /dev/null
@@ -1,3 +0,0 @@
-Creating a `Label` programmatically with `text`.
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/label/code-behind/code-behind-page.js b/app/ns-ui-widgets-category/label/code-behind/code-behind-page.js
index 93ac468..1392d8d 100644
--- a/app/ns-ui-widgets-category/label/code-behind/code-behind-page.js
+++ b/app/ns-ui-widgets-category/label/code-behind/code-behind-page.js
@@ -1,27 +1,26 @@
-const observableModule = require("tns-core-modules/data/observable");
-// >> require-label
- const labelModule = require("tns-core-modules/ui/label");
-// << require-label
-function onNavigatingTo(args) {
+import { Observable } from "@nativescript/core";
+// >> label-code-create
+import { Label } from "@nativescript/core";
+
+export function onNavigatingTo(args) {
const page = args.object;
const container = page.getViewById("container");
- const vm = new observableModule.Observable();
- // >> label-code-create
+ const vm = new Observable();
- const myLabel = new labelModule.Label();
+ const myLabel = new Label();
myLabel.text = "The quick brown fox jumps over the lazy dog.";
// Styling a label via css type
myLabel.text = "The quick brown fox jumps over the lazy dog.";
let pageCSS = "label {background-color: #C6C6C6; color: #bc7474; font-size: 14; padding:10;} ";
- const mySecondLabel = new labelModule.Label();
+ const mySecondLabel = new Label();
mySecondLabel.text = "The quick brown fox jumps over the lazy dog.";
// Styling a label via css class
mySecondLabel.className = "title";
pageCSS += ".title {background-color: #7974bc; color: #54ff5f; font-size: 20; padding:10;} ";
- const myThirdLabel = new labelModule.Label();
+ const myThirdLabel = new Label();
myThirdLabel.text = "The quick brown fox jumps over the lazy dog.";
// Turning on text wrapping for a label
myThirdLabel.textWrap = true;
@@ -30,7 +29,7 @@ function onNavigatingTo(args) {
pageCSS += "#testLabel {background-color: #bc7474; color: whitesmoke; font-size: 25; padding:10;}";
// Binding text property of a label to an observable model
- const myFourthlabel = new labelModule.Label();
+ const myFourthlabel = new Label();
myFourthlabel.textAlignment = "center";
myFourthlabel.fontSize = 24;
const expValue = "Expected Value";
@@ -42,7 +41,6 @@ function onNavigatingTo(args) {
vm.set("sourceProperty", expValue);
// set to the page css property the CSS style defined in the pageCSS
page.css = pageCSS;
- // << label-code-create
container.addChild(myLabel);
container.addChild(mySecondLabel);
@@ -50,4 +48,5 @@ function onNavigatingTo(args) {
container.addChild(myFourthlabel);
page.bindingContext = vm;
}
-exports.onNavigatingTo = onNavigatingTo;
+
+// << label-code-create
diff --git a/app/ns-ui-widgets-category/label/code-behind/code-behind-ts-page.ts b/app/ns-ui-widgets-category/label/code-behind/code-behind-ts-page.ts
index b518443..872bb9c 100644
--- a/app/ns-ui-widgets-category/label/code-behind/code-behind-ts-page.ts
+++ b/app/ns-ui-widgets-category/label/code-behind/code-behind-ts-page.ts
@@ -1,15 +1,11 @@
-import { EventData, Observable } from "tns-core-modules/data/observable";
-import { Page } from "tns-core-modules/ui/page";
-import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout";
-// >> require-label-ts
-import { Label } from "tns-core-modules/ui/label";
-// << require-label-ts
+import { EventData, Observable, Page, StackLayout } from "@nativescript/core";
+// >> label-code-create-ts
+import { Label } from "@nativescript/core";
export function onNavigatingTo(args: EventData) {
const page = args.object;
const container = page.getViewById("container");
const vm = new Observable();
- // >> label-code-create-ts
const myLabel = new Label();
myLabel.text = "The quick brown fox jumps over the lazy dog.";
@@ -44,7 +40,6 @@ export function onNavigatingTo(args: EventData) {
vm.set("sourceProperty", expValue);
// set to the page css property the CSS style defined in the pageCSS
page.css = pageCSS;
- // << label-code-create-ts
container.addChild(myLabel);
container.addChild(mySecondLabel);
@@ -52,3 +47,4 @@ export function onNavigatingTo(args: EventData) {
container.addChild(myFourthlabel);
page.bindingContext = vm;
}
+// << label-code-create-ts
diff --git a/app/ns-ui-widgets-category/label/end.md b/app/ns-ui-widgets-category/label/end.md
index 2e909ee..b839635 100644
--- a/app/ns-ui-widgets-category/label/end.md
+++ b/app/ns-ui-widgets-category/label/end.md
@@ -1,7 +1,37 @@
+## Tips And Tricks
-**API Reference for** [Label Class](http://docs.nativescript.org/api-reference/modules/_ui_label_.html)
+### Creating Label via Code-Behind
+Creating a `Label` programmatically with `text`.
+
+
-**Native Component**
+## Properties
+
+| Name | Type | Description |
+|----------|---------|----------------|
+| `letterSpacing` | `number` | Gets or sets letterSpace style property. |
+| `lineHeight` | `number` | Gets or sets lineHeight style property. |
+| `text` | `string` | Gets or sets the Label text. |
+| `textAlignment` | **_"initial"_**, **_"left"_**, **_"center"_**, **_"right"_** | Gets or sets text-alignment style property. |
+| `textDecoration` | **_"none"_**, **_"underline"_**, **_"line-through"_** | Gets or sets text swcoration style property. |
+| `textTransform` | **_"initial"_**, **_"none"_**, **_"capitalize"_**, **_"uppercase"_**, **_"lowercase"_** | Gets or sets text transform style property. |
+| `textWrap` | `boolean` | Gets or sets whether the Label wraps text or not. |
+| `whiteSpace` | **_"initial"_**, **_"normal"_**, **_"nowrap"_** | Gets or sets the white space style. |
+
+## Events
+
+| Name | Description |
+|----------|----------------|
+| `textChange` | Emitted when the label text is changed.|
+
+## API References
+
+| Name | Type |
+|----------|---------|
+| [tns-core-modules/ui/label](http://docs.nativescript.org/api-reference/modules/_ui_label_.html) | `Module` |
+| [Label](https://docs.nativescript.org/api-reference/classes/_ui_label_.label) | `Class` |
+
+## Native Component
| Android | iOS |
|:----------------------|:---------|
diff --git a/app/ns-ui-widgets-category/label/label-page.js b/app/ns-ui-widgets-category/label/label-page.js
index 1f52072..9831bff 100644
--- a/app/ns-ui-widgets-category/label/label-page.js
+++ b/app/ns-ui-widgets-category/label/label-page.js
@@ -1,15 +1,14 @@
-const ListViewLinksModel = require("../../links-view-model");
-const link = require("../../link");
+import ListViewLinksModel from "../../links-view-model";
+import Link from "../../link";
const navigationLinks = [
- new link("Basics", "ns-ui-widgets-category/label/basics/basics-page"),
- new link("Code-Behind", "ns-ui-widgets-category/label/code-behind/code-behind-page"),
- new link("Styling", "ns-ui-widgets-category/label/styling/styling-page")
+ new Link("Usage", "ns-ui-widgets-category/label/usage/usage-page"),
+ new Link("Code-Behind", "ns-ui-widgets-category/label/code-behind/code-behind-page")
];
const navigationLinksTsc = [
- new link("Basics", "ns-ui-widgets-category/label/basics/basics-ts-page"),
- new link("Code-Behind", "ns-ui-widgets-category/label/code-behind/code-behind-ts-page")
+ new Link("Usage", "ns-ui-widgets-category/label/usage/usage-ts-page"),
+ new Link("Code-Behind", "ns-ui-widgets-category/label/code-behind/code-behind-ts-page")
];
-function onNavigatingTo(args) {
+export function onNavigatingTo(args) {
const page = args.object;
page.bindingContext = new ListViewLinksModel({
links: navigationLinks,
@@ -18,4 +17,4 @@ function onNavigatingTo(args) {
tsclinks: navigationLinksTsc
});
}
-exports.onNavigatingTo = onNavigatingTo;
+
diff --git a/app/ns-ui-widgets-category/label/metadata.md b/app/ns-ui-widgets-category/label/metadata.md
index f3eb504..f1dc1f3 100644
--- a/app/ns-ui-widgets-category/label/metadata.md
+++ b/app/ns-ui-widgets-category/label/metadata.md
@@ -4,3 +4,4 @@ description: The Label in NativeScript is an abstraction over Android's widget.T
position: 290
slug: label
---
+example-order: usage, styling
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/label/overview.md b/app/ns-ui-widgets-category/label/overview.md
index 76a0a2f..5cdac72 100644
--- a/app/ns-ui-widgets-category/label/overview.md
+++ b/app/ns-ui-widgets-category/label/overview.md
@@ -1,3 +1 @@
-The Label widget provides a text label that shows read-only text.
-
-
\ No newline at end of file
+The `Label` widget provides a text label that shows read-only text.
diff --git a/app/ns-ui-widgets-category/label/styling/article.md b/app/ns-ui-widgets-category/label/styling/article.md
deleted file mode 100644
index afa87a5..0000000
--- a/app/ns-ui-widgets-category/label/styling/article.md
+++ /dev/null
@@ -1,5 +0,0 @@
-To style and customize the `Label` widget use the conventional CSS properties and Icon Fonts.
-The example below shows a label with icon (using icon font), several CSS properties.
-
-
-
diff --git a/app/ns-ui-widgets-category/label/styling/styling-page.css b/app/ns-ui-widgets-category/label/styling/styling-page.css
deleted file mode 100644
index ac3999a..0000000
--- a/app/ns-ui-widgets-category/label/styling/styling-page.css
+++ /dev/null
@@ -1,16 +0,0 @@
-/* >> label-css-styles */
-.my-label {
- background-color: #bc7474;
- color: whitesmoke;
- font-size: 24;
- padding: 8;
- text-align: center;
- vertical-align: middle;
- width: 90%;
-}
-.border {
- border-color: darkred;
- border-radius: 10;
- border-width: 2;
-}
-/* << label-css-styles */
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/label/styling/styling-page.js b/app/ns-ui-widgets-category/label/styling/styling-page.js
deleted file mode 100644
index e69de29..0000000
diff --git a/app/ns-ui-widgets-category/label/styling/styling-page.xml b/app/ns-ui-widgets-category/label/styling/styling-page.xml
deleted file mode 100644
index 78c8535..0000000
--- a/app/ns-ui-widgets-category/label/styling/styling-page.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/label/usage/article.md b/app/ns-ui-widgets-category/label/usage/article.md
new file mode 100644
index 0000000..df5b29e
--- /dev/null
+++ b/app/ns-ui-widgets-category/label/usage/article.md
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/label/usage/usage-page.js b/app/ns-ui-widgets-category/label/usage/usage-page.js
new file mode 100644
index 0000000..927ccc9
--- /dev/null
+++ b/app/ns-ui-widgets-category/label/usage/usage-page.js
@@ -0,0 +1,13 @@
+// >> label-text-binding
+import { Observable } from "@nativescript/core";
+
+export function onNavigatingTo(args) {
+
+ const page = args.object;
+ const vm = new Observable();
+ vm.set("title", "NativeScript is Awesome");
+ page.bindingContext = vm;
+
+}
+
+// << label-text-binding
diff --git a/app/ns-ui-widgets-category/label/basics/basics-page.xml b/app/ns-ui-widgets-category/label/usage/usage-page.xml
similarity index 54%
rename from app/ns-ui-widgets-category/label/basics/basics-page.xml
rename to app/ns-ui-widgets-category/label/usage/usage-page.xml
index bad8c01..679f72c 100644
--- a/app/ns-ui-widgets-category/label/basics/basics-page.xml
+++ b/app/ns-ui-widgets-category/label/usage/usage-page.xml
@@ -1,11 +1,12 @@
-
+
-
+
-
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/label/usage/usage-ts-page.ts b/app/ns-ui-widgets-category/label/usage/usage-ts-page.ts
new file mode 100644
index 0000000..5f2f20d
--- /dev/null
+++ b/app/ns-ui-widgets-category/label/usage/usage-ts-page.ts
@@ -0,0 +1,12 @@
+// >> label-text-binding-ts
+import { EventData, Observable, Page } from "@nativescript/core";
+
+export function onNavigatingTo(args: EventData) {
+
+ const page = args.object;
+ const vm = new Observable();
+ vm.set("title", "NativeScript is Awesome");
+ page.bindingContext = vm;
+
+}
+// << label-text-binding-ts
diff --git a/app/ns-ui-widgets-category/label/usage/usage-ts-page.xml b/app/ns-ui-widgets-category/label/usage/usage-ts-page.xml
new file mode 100644
index 0000000..3b663fb
--- /dev/null
+++ b/app/ns-ui-widgets-category/label/usage/usage-ts-page.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/layouts/absolute-layout/absolute-layout-page.js b/app/ns-ui-widgets-category/layouts/absolute-layout/absolute-layout-page.js
index 081cb91..f00bc83 100644
--- a/app/ns-ui-widgets-category/layouts/absolute-layout/absolute-layout-page.js
+++ b/app/ns-ui-widgets-category/layouts/absolute-layout/absolute-layout-page.js
@@ -1,10 +1,9 @@
// >> absolute-layout-import
-const AbsoluteLayout = require("tns-core-modules/ui/layouts/absolute-layout").AbsoluteLayout;
+import { AbsoluteLayout } from "@nativescript/core";
// << absolute-layout-import
-const Button = require("tns-core-modules/ui/button/").Button;
-const Color = require("tns-core-modules/color/").Color;
+import { Button, Color } from "@nativescript/core";
// TODO: This should be in "pageNavigatingTo" but that method is defined in the Page base class
-exports.onNavigatingTo = function(args) {
+export function onNavigatingTo(args) {
const page = args.object;
const stack = page.getViewById("stack");
@@ -43,4 +42,4 @@ exports.onNavigatingTo = function(args) {
stack.removeChildren();
stack.addChild(absoluteLayout);
-};
+}
diff --git a/app/ns-ui-widgets-category/layouts/absolute-layout/absolute-layout-ts-page.ts b/app/ns-ui-widgets-category/layouts/absolute-layout/absolute-layout-ts-page.ts
index 5ea66dc..6800a03 100644
--- a/app/ns-ui-widgets-category/layouts/absolute-layout/absolute-layout-ts-page.ts
+++ b/app/ns-ui-widgets-category/layouts/absolute-layout/absolute-layout-ts-page.ts
@@ -1,8 +1,7 @@
// >> absolute-layout-import-ts
-import { AbsoluteLayout } from "tns-core-modules/ui/layouts/absolute-layout";
+import { AbsoluteLayout } from "@nativescript/core";
// << absolute-layout-import-ts
-import { Button } from "tns-core-modules/ui/button/";
-import { Color } from "tns-core-modules/color/";
+import { Button, Color } from "@nativescript/core";
// TODO: This should be in "pageNavigatingTo" but that method is defined in the Page base class
export function onNavigatingTo(args) {
const page = args.object;
diff --git a/app/ns-ui-widgets-category/layouts/dock-layout/dock-layout-page.js b/app/ns-ui-widgets-category/layouts/dock-layout/dock-layout-page.js
index 3be4cd7..fdc45f5 100644
--- a/app/ns-ui-widgets-category/layouts/dock-layout/dock-layout-page.js
+++ b/app/ns-ui-widgets-category/layouts/dock-layout/dock-layout-page.js
@@ -1,9 +1,9 @@
// >> dock-layout-import
-const DockLayout = require("tns-core-modules/ui/layouts/dock-layout").DockLayout;
+import { DockLayout } from "@nativescript/core";
// << dock-layout-import
-const Button = require("tns-core-modules/ui/button/").Button;
+import { Button } from "@nativescript/core";
-exports.onNavigatingTo = function(args) {
+export function onNavigatingTo(args) {
const page = args.object;
const grid = page.getViewById("grid");
@@ -34,7 +34,7 @@ exports.onNavigatingTo = function(args) {
myDockLayout.addChild(button5);
myDockLayout.stretchLastChild = true;
- // const DockLayout = require("tns-core-modules/ui/layouts/dock-layout").DockLayout;
+ // import { DockLayout } from "@nativescript/core";
DockLayout.setDock(button1, "left");
DockLayout.setDock(button2, "right");
DockLayout.setDock(button3, "top");
@@ -44,4 +44,4 @@ exports.onNavigatingTo = function(args) {
grid.removeChildren();
grid.addChild(myDockLayout);
-};
+}
diff --git a/app/ns-ui-widgets-category/layouts/dock-layout/dock-layout-ts-page.ts b/app/ns-ui-widgets-category/layouts/dock-layout/dock-layout-ts-page.ts
index 86387c5..091072b 100644
--- a/app/ns-ui-widgets-category/layouts/dock-layout/dock-layout-ts-page.ts
+++ b/app/ns-ui-widgets-category/layouts/dock-layout/dock-layout-ts-page.ts
@@ -1,8 +1,7 @@
// >> dock-layout-import-ts
-import { DockLayout } from "tns-core-modules/ui/layouts/dock-layout";
+import { DockLayout } from "@nativescript/core";
// << dock-layout-import-ts
-import { Button } from "tns-core-modules/ui/button/";
-import { Color } from "tns-core-modules/color/";
+import { Color, Button } from "@nativescript/core";
export function onNavigatingTo(args) {
const page = args.object;
diff --git a/app/ns-ui-widgets-category/layouts/grid-layout/grid-layout-page.js b/app/ns-ui-widgets-category/layouts/grid-layout/grid-layout-page.js
index 08f7343..d790baa 100644
--- a/app/ns-ui-widgets-category/layouts/grid-layout/grid-layout-page.js
+++ b/app/ns-ui-widgets-category/layouts/grid-layout/grid-layout-page.js
@@ -1,8 +1,5 @@
-const GridLayout = require("tns-core-modules/ui/layouts/grid-layout").GridLayout;
-const ItemSpec = require("tns-core-modules/ui/layouts/grid-layout").ItemSpec;
-const Button = require("tns-core-modules/ui/button/").Button;
-
-exports.onNavigatingTo = function (args) {
+import { Button, GridLayout, ItemSpec } from "@nativescript/core";
+export function onNavigatingTo(args) {
const page = args.object;
// >> grid-layout-code
const myGrid = new GridLayout();
@@ -76,4 +73,4 @@ exports.onNavigatingTo = function (args) {
// << grid-layout-code
page.content = myGrid;
-};
+}
diff --git a/app/ns-ui-widgets-category/layouts/grid-layout/grid-layout-ts-page.ts b/app/ns-ui-widgets-category/layouts/grid-layout/grid-layout-ts-page.ts
index 58e036e..9abc0af 100644
--- a/app/ns-ui-widgets-category/layouts/grid-layout/grid-layout-ts-page.ts
+++ b/app/ns-ui-widgets-category/layouts/grid-layout/grid-layout-ts-page.ts
@@ -1,7 +1,6 @@
-import { Button } from "tns-core-modules/ui/button";
-import { Page } from "tns-core-modules/ui/page";
+import { Button, Page } from "@nativescript/core";
// >> grid-layout-import-ts
-import { GridLayout, ItemSpec } from "tns-core-modules/ui/layouts/grid-layout";
+import { GridLayout, ItemSpec } from "@nativescript/core";
// << grid-layout-import-ts
export function onNavigatingTo(args) {
diff --git a/app/ns-ui-widgets-category/layouts/layouts-page.js b/app/ns-ui-widgets-category/layouts/layouts-page.js
index 7669c97..6292c3a 100644
--- a/app/ns-ui-widgets-category/layouts/layouts-page.js
+++ b/app/ns-ui-widgets-category/layouts/layouts-page.js
@@ -1,26 +1,26 @@
-const ListViewLinksModel = require("../../links-view-model");
-const link = require("../../link");
+import ListViewLinksModel from "../../links-view-model";
+import Link from "../../link";
const navigationLinks = [
- new link("AbsoluteLayout", "ns-ui-widgets-category/layouts/absolute-layout/absolute-layout-page"),
- new link("DockLayout", "ns-ui-widgets-category/layouts/dock-layout/dock-layout-page"),
- new link("FlexboxLayout (flexDirection)", "ns-ui-widgets-category/layouts/flexbox-layout/flexbox-layout-page"),
- new link("FlexboxLayout (order, flexGrow and flexShrink)", "ns-ui-widgets-category/layouts/flexbox-layout-two/flexbox-layout-page"),
- new link("FlexboxLayout (flexWrap, justifyContent)", "ns-ui-widgets-category/layouts/flexbox-layout-three/flexbox-layout-page"),
- new link("GridLayout", "ns-ui-widgets-category/layouts/grid-layout/grid-layout-page"),
- new link("StackLayout", "ns-ui-widgets-category/layouts/stack-layout/stack-layout-page"),
- new link("WrapLayout", "ns-ui-widgets-category/layouts/wrap-layout/wrap-layout-page")
+ new Link("AbsoluteLayout", "ns-ui-widgets-category/layouts/absolute-layout/absolute-layout-page"),
+ new Link("DockLayout", "ns-ui-widgets-category/layouts/dock-layout/dock-layout-page"),
+ new Link("FlexboxLayout (flexDirection)", "ns-ui-widgets-category/layouts/flexbox-layout/flexbox-layout-page"),
+ new Link("FlexboxLayout (order, flexGrow and flexShrink)", "ns-ui-widgets-category/layouts/flexbox-layout-two/flexbox-layout-page"),
+ new Link("FlexboxLayout (flexWrap, justifyContent)", "ns-ui-widgets-category/layouts/flexbox-layout-three/flexbox-layout-page"),
+ new Link("GridLayout", "ns-ui-widgets-category/layouts/grid-layout/grid-layout-page"),
+ new Link("StackLayout", "ns-ui-widgets-category/layouts/stack-layout/stack-layout-page"),
+ new Link("WrapLayout", "ns-ui-widgets-category/layouts/wrap-layout/wrap-layout-page")
];
const navigationLinksTsc = [
- new link("AbsoluteLayout", "ns-ui-widgets-category/layouts/absolute-layout/absolute-layout-ts-page"),
- new link("DockLayout", "ns-ui-widgets-category/layouts/dock-layout/dock-layout-ts-page"),
- new link("FlexboxLayout (flexDirection)", "ns-ui-widgets-category/layouts/flexbox-layout/flexbox-layout-page"),
- new link("FlexboxLayout (order, flexGrow and flexShrink)", "ns-ui-widgets-category/layouts/flexbox-layout-two/flexbox-layout-page"),
- new link("FlexboxLayout (flexWrap, justifyContent)", "ns-ui-widgets-category/layouts/flexbox-layout-three/flexbox-layout-page"),
- new link("GridLayout", "ns-ui-widgets-category/layouts/grid-layout/grid-layout-ts-page"),
- new link("StackLayout", "ns-ui-widgets-category/layouts/stack-layout/stack-layout-ts-page"),
- new link("WrapLayout", "ns-ui-widgets-category/layouts/wrap-layout/wrap-layout-ts-page")
+ new Link("AbsoluteLayout", "ns-ui-widgets-category/layouts/absolute-layout/absolute-layout-ts-page"),
+ new Link("DockLayout", "ns-ui-widgets-category/layouts/dock-layout/dock-layout-ts-page"),
+ new Link("FlexboxLayout (flexDirection)", "ns-ui-widgets-category/layouts/flexbox-layout/flexbox-layout-page"),
+ new Link("FlexboxLayout (order, flexGrow and flexShrink)", "ns-ui-widgets-category/layouts/flexbox-layout-two/flexbox-layout-page"),
+ new Link("FlexboxLayout (flexWrap, justifyContent)", "ns-ui-widgets-category/layouts/flexbox-layout-three/flexbox-layout-page"),
+ new Link("GridLayout", "ns-ui-widgets-category/layouts/grid-layout/grid-layout-ts-page"),
+ new Link("StackLayout", "ns-ui-widgets-category/layouts/stack-layout/stack-layout-ts-page"),
+ new Link("WrapLayout", "ns-ui-widgets-category/layouts/wrap-layout/wrap-layout-ts-page")
];
-function onNavigatingTo(args) {
+export function onNavigatingTo(args) {
const page = args.object;
page.bindingContext = new ListViewLinksModel({
links: navigationLinks,
@@ -29,4 +29,4 @@ function onNavigatingTo(args) {
tsclinks: navigationLinksTsc
});
}
-exports.onNavigatingTo = onNavigatingTo;
+
diff --git a/app/ns-ui-widgets-category/layouts/stack-layout/stack-layout-page.js b/app/ns-ui-widgets-category/layouts/stack-layout/stack-layout-page.js
index 8543f86..cbdf7d5 100644
--- a/app/ns-ui-widgets-category/layouts/stack-layout/stack-layout-page.js
+++ b/app/ns-ui-widgets-category/layouts/stack-layout/stack-layout-page.js
@@ -1,9 +1,9 @@
// >> stack-layout-import
-const StackLayout = require("tns-core-modules/ui/layouts/stack-layout").StackLayout;
+import { StackLayout } from "@nativescript/core";
// << stack-layout-import
-const Button = require("tns-core-modules/ui/button/").Button;
+import { Button } from "@nativescript/core";
-exports.onNavigatingTo = function (args) {
+export function onNavigatingTo(args) {
const page = args.object;
// >> stack-layout-code-behind
const myStack = new StackLayout();
@@ -31,4 +31,4 @@ exports.onNavigatingTo = function (args) {
// << stack-layout-code-behind
page.content = myStack;
-};
+}
diff --git a/app/ns-ui-widgets-category/layouts/stack-layout/stack-layout-ts-page.ts b/app/ns-ui-widgets-category/layouts/stack-layout/stack-layout-ts-page.ts
index b3b89e5..3e8411c 100644
--- a/app/ns-ui-widgets-category/layouts/stack-layout/stack-layout-ts-page.ts
+++ b/app/ns-ui-widgets-category/layouts/stack-layout/stack-layout-ts-page.ts
@@ -1,8 +1,6 @@
-import { EventData } from "tns-core-modules/data/observable/";
-import { Button } from "tns-core-modules/ui/button/";
-import { Page } from "tns-core-modules/ui/page/";
+import { Button, EventData, Page } from "@nativescript/core";
// >> stack-layout-import-ts
-import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout";
+import { StackLayout } from "@nativescript/core";
// << stack-layout-import-ts
export function onNavigatingTo(args: EventData) {
diff --git a/app/ns-ui-widgets-category/layouts/wrap-layout/wrap-layout-page.js b/app/ns-ui-widgets-category/layouts/wrap-layout/wrap-layout-page.js
index bf1ab12..b3d94ff 100644
--- a/app/ns-ui-widgets-category/layouts/wrap-layout/wrap-layout-page.js
+++ b/app/ns-ui-widgets-category/layouts/wrap-layout/wrap-layout-page.js
@@ -1,9 +1,9 @@
// >> wrap-layout-import
-const WrapLayout = require("tns-core-modules/ui/layouts/wrap-layout").WrapLayout;
+import { WrapLayout } from "@nativescript/core";
// << wrap-layout-import
-const Button = require("tns-core-modules/ui/button/").Button;
+import { Button } from "@nativescript/core";
-exports.onNavigatingTo = function (args) {
+export function onNavigatingTo(args) {
const page = args.object;
// >> wrap-layout-code-behind
const myWrap = new WrapLayout();
@@ -48,4 +48,4 @@ exports.onNavigatingTo = function (args) {
// << wrap-layout-code-behind
page.content = myWrap;
-};
+}
diff --git a/app/ns-ui-widgets-category/layouts/wrap-layout/wrap-layout-ts-page.ts b/app/ns-ui-widgets-category/layouts/wrap-layout/wrap-layout-ts-page.ts
index 51a644e..e6902e5 100644
--- a/app/ns-ui-widgets-category/layouts/wrap-layout/wrap-layout-ts-page.ts
+++ b/app/ns-ui-widgets-category/layouts/wrap-layout/wrap-layout-ts-page.ts
@@ -1,8 +1,6 @@
-import { EventData } from "tns-core-modules/data/observable";
-import { Button } from "tns-core-modules/ui/button";
-import { Page } from "tns-core-modules/ui/page";
+import { Button, EventData, Page } from "@nativescript/core";
// >> wrap-layout-import-ts
-import { WrapLayout } from "tns-core-modules/ui/layouts/wrap-layout";
+import { WrapLayout } from "@nativescript/core";
// << wrap-layout-import-ts
export function onNavigatingTo(args: EventData) {
diff --git a/app/ns-ui-widgets-category/list-picker/basics/basics-page.js b/app/ns-ui-widgets-category/list-picker/basics/basics-page.js
deleted file mode 100644
index 1f96820..0000000
--- a/app/ns-ui-widgets-category/list-picker/basics/basics-page.js
+++ /dev/null
@@ -1,38 +0,0 @@
-const fromObject = require("tns-core-modules/data/observable").fromObject;
-
-function onNavigatingTo(args) {
- // >> list-picker-code-behind
- const pokemonList = ["Bulbasaur", "Parasect", "Venonat", "Venomoth", "Diglett",
- "Dugtrio", "Meowth", "Persian", "Psyduck", "Arcanine", "Poliwrath", "Machoke"];
-
- const page = args.object;
- const vm = fromObject({
- pickerItems: pokemonList,
- index: 2
- });
- page.bindingContext = vm;
- // << list-picker-code-behind
-}
-exports.onNavigatingTo = onNavigatingTo;
-
-function onSliderLoaded(args) {
- const sliderComponent = args.object;
- sliderComponent.on("valueChange", (sargs) => {
- const page = sargs.object.page;
- const vm = page.bindingContext;
- console.log(`slider index: ${sargs.object.value}`);
- vm.set("index", sargs.object.value);
- });
-}
-exports.onSliderLoaded = onSliderLoaded;
-
-function onListPickerLoaded(args) {
- const listPickerComponent = args.object;
- const vm = listPickerComponent.page.bindingContext;
- listPickerComponent.on("selectedIndexChange", (lpargs) => {
- const listPicker = lpargs.object;
- vm.set("index", listPicker.selectedIndex);
- console.log(`ListPicker selected index: ${listPicker.selectedIndex}`);
- });
-}
-exports.onListPickerLoaded = onListPickerLoaded;
diff --git a/app/ns-ui-widgets-category/list-picker/basics/basics-page.xml b/app/ns-ui-widgets-category/list-picker/basics/basics-page.xml
deleted file mode 100644
index 17f7039..0000000
--- a/app/ns-ui-widgets-category/list-picker/basics/basics-page.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/list-picker/basics/basics-ts-page.ts b/app/ns-ui-widgets-category/list-picker/basics/basics-ts-page.ts
deleted file mode 100644
index 37cd3ec..0000000
--- a/app/ns-ui-widgets-category/list-picker/basics/basics-ts-page.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-import { EventData, fromObject } from "tns-core-modules/data/observable";
-import { Page } from "tns-core-modules/ui/page";
-
-export function onNavigatingTo(args: EventData) {
- // >> list-picker-code-behind-ts
- const pokemonList = ["Bulbasaur", "Parasect", "Venonat", "Venomoth", "Diglett",
- "Dugtrio", "Meowth", "Persian", "Psyduck", "Arcanine", "Poliwrath", "Machoke"];
-
- const page = args.object;
- const vm = fromObject({
- pickerItems: pokemonList,
- index: 2
- });
- page.bindingContext = vm;
- // << list-picker-code-behind-ts
-}
-
-export function onSliderLoaded(args) {
- const sliderComponent = args.object;
- sliderComponent.on("valueChange", (sargs) => {
- const page = sargs.object.page;
- const vm = page.bindingContext;
- console.log(`slider index: ${sargs.object.value}`);
- vm.set("index", sargs.object.value);
- });
-}
-
-export function onListPickerLoaded(args) {
- const listPickerComponent = args.object;
- const vm = listPickerComponent.page.bindingContext;
- listPickerComponent.on("selectedIndexChange", (lpargs) => {
- const listPicker = lpargs.object;
- vm.set("index", listPicker.selectedIndex);
- console.log(`ListPicker selected index: ${listPicker.selectedIndex}`);
- });
-}
diff --git a/app/ns-ui-widgets-category/list-picker/basics/basics-ts-page.xml b/app/ns-ui-widgets-category/list-picker/basics/basics-ts-page.xml
deleted file mode 100644
index 0cc9ae4..0000000
--- a/app/ns-ui-widgets-category/list-picker/basics/basics-ts-page.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/list-picker/code-behind/article.md b/app/ns-ui-widgets-category/list-picker/code-behind/article.md
deleted file mode 100644
index 37febfa..0000000
--- a/app/ns-ui-widgets-category/list-picker/code-behind/article.md
+++ /dev/null
@@ -1,3 +0,0 @@
-Creating a `ListPicker` programmatically while setting items source and default selected index.
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/list-picker/code-behind/code-behind-page.js b/app/ns-ui-widgets-category/list-picker/code-behind/code-behind-page.js
index bf773f0..3c35b7e 100644
--- a/app/ns-ui-widgets-category/list-picker/code-behind/code-behind-page.js
+++ b/app/ns-ui-widgets-category/list-picker/code-behind/code-behind-page.js
@@ -1,11 +1,11 @@
-// >> require-list-picker
-const ListPicker = require("tns-core-modules/ui/list-picker").ListPicker;
-// << require-list-picker
+// >> create-list-picker-code
+import { ListPicker } from "@nativescript/core";
-function onNavigatingTo(args) {
+
+export function onNavigatingTo(args) {
const page = args.object;
const container = page.getViewById("container");
- // >> create-list-picker-code
+
const listPicker = new ListPicker();
listPicker.items = [
"NativeScript Core - JavaScript",
@@ -16,7 +16,8 @@ function onNavigatingTo(args) {
"NativeScript Sidekick"
];
listPicker.selectedIndex = 0;
- // << create-list-picker-code
+
container.addChild(listPicker);
}
-exports.onNavigatingTo = onNavigatingTo;
+
+// << create-list-picker-code
diff --git a/app/ns-ui-widgets-category/list-picker/code-behind/code-behind-ts-page.ts b/app/ns-ui-widgets-category/list-picker/code-behind/code-behind-ts-page.ts
index 592fc33..5c01027 100644
--- a/app/ns-ui-widgets-category/list-picker/code-behind/code-behind-ts-page.ts
+++ b/app/ns-ui-widgets-category/list-picker/code-behind/code-behind-ts-page.ts
@@ -1,14 +1,10 @@
-import { EventData } from "tns-core-modules/data/observable";
-import { Page } from "tns-core-modules/ui/page";
-import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout";
-// >> require-list-picker-ts
-import { ListPicker } from "tns-core-modules/ui/list-picker";
-// << require-list-picker-ts
+// >> create-list-picker-code-ts
+import { EventData, ListPicker, Page, StackLayout } from "@nativescript/core";
export function onNavigatingTo(args: EventData) {
const page = args.object;
const container = page.getViewById("container");
- // >> create-list-picker-code-ts
+
const listPicker = new ListPicker();
listPicker.items = [
"NativeScript Core - JavaScript",
@@ -19,6 +15,6 @@ export function onNavigatingTo(args: EventData) {
"NativeScript Sidekick"
];
listPicker.selectedIndex = 1;
- // << create-list-picker-code-ts
container.addChild(listPicker);
}
+// << create-list-picker-code-ts
diff --git a/app/ns-ui-widgets-category/list-picker/end.md b/app/ns-ui-widgets-category/list-picker/end.md
index 0939798..d400cf3 100644
--- a/app/ns-ui-widgets-category/list-picker/end.md
+++ b/app/ns-ui-widgets-category/list-picker/end.md
@@ -1,7 +1,26 @@
-**API Reference for** [ListPicker Class](http://docs.nativescript.org/api-reference/modules/_ui_list_picker_.html)
-**Native Component**
+## Properties
-| Android | iOS |
-|:-----------------------|:---------|
-| [android.widget.NumberPicker](http://developer.android.com/reference/android/widget/NumberPicker.html) | [UIPickerView](https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UIPickerView_Class/index.html) |
\ No newline at end of file
+| Name | Type | Description |
+|----------|---------|----------------|
+| `items` | `Array` | Gets or set the items collection of the ListPicker. The items property can be set to an array or an object defining length and getItem(index) method. |
+| `selectedIndex` | `number` | Gets or set the items collection of the ListPicker. The items property can be set to an array or an object defining length and getItem(index) method. |
+
+## Events
+
+| Name | Description |
+|----------|----------------|
+| `selectedIndexChange` | Emitted when the `selectedIndex` is changed.|
+
+## API References
+
+| Name | Type |
+|----------|---------|
+| [tns-core-modules/ui/list-picker](http://docs.nativescript.org/api-reference/modules/_ui_list_picker_.html) | `Module` |
+| [ListPicker](https://docs.nativescript.org/api-reference/classes/_ui_list_picker_.listpicker) | `Class` |
+
+## Native Component
+
+| Android | iOS |
+|:----------------------|:---------|
+| [android.widget.NumberPicker](http://developer.android.com/reference/android/widget/NumberPicker.html) | [UIPickerView](https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UIPickerView_Class/index.html) |
diff --git a/app/ns-ui-widgets-category/list-picker/key-value-pairs/key-value-pairs-page.js b/app/ns-ui-widgets-category/list-picker/key-value-pairs/key-value-pairs-page.js
deleted file mode 100644
index d05a958..0000000
--- a/app/ns-ui-widgets-category/list-picker/key-value-pairs/key-value-pairs-page.js
+++ /dev/null
@@ -1,30 +0,0 @@
-const fromObject = require("tns-core-modules/data/observable").fromObject;
-
-// >> list-picker-key-value-pairs-code-behind
-function onNavigatingTo(args) {
-
- const page = args.object;
- const vm = fromObject({
- items: [
- { id: 1, name: "Ter Stegen", role: "Goalkeeper" },
- { id: 3, name: "Piqué", role: "Defender" },
- { id: 4, name: "I. Rakitic", role: "Midfielder" }
- ],
- index: 2,
- selectedItem: ""
- });
- page.bindingContext = vm;
-}
-exports.onNavigatingTo = onNavigatingTo;
-
-function onListPickerLoaded(args) {
- const listPicker = args.object;
- const vm = listPicker.page.bindingContext;
- listPicker.on("selectedIndexChange", (lpargs) => {
- vm.set("index", listPicker.selectedIndex);
- console.log(`ListPicker selected value: ${listPicker.selectedValue}`);
- console.log(`ListPicker selected index: ${listPicker.selectedIndex}`);
- });
-}
-exports.onListPickerLoaded = onListPickerLoaded;
-// << list-picker-key-value-pairs-code-behind
diff --git a/app/ns-ui-widgets-category/list-picker/key-value-pairs/key-value-pairs-page.xml b/app/ns-ui-widgets-category/list-picker/key-value-pairs/key-value-pairs-page.xml
deleted file mode 100644
index b1710c1..0000000
--- a/app/ns-ui-widgets-category/list-picker/key-value-pairs/key-value-pairs-page.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/list-picker/key-value-pairs/key-value-pairs-ts-page.xml b/app/ns-ui-widgets-category/list-picker/key-value-pairs/key-value-pairs-ts-page.xml
deleted file mode 100644
index 4497763..0000000
--- a/app/ns-ui-widgets-category/list-picker/key-value-pairs/key-value-pairs-ts-page.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/list-picker/list-picker-page.js b/app/ns-ui-widgets-category/list-picker/list-picker-page.js
index 29d2260..75bc615 100644
--- a/app/ns-ui-widgets-category/list-picker/list-picker-page.js
+++ b/app/ns-ui-widgets-category/list-picker/list-picker-page.js
@@ -1,16 +1,16 @@
-const ListViewLinksModel = require("../../links-view-model");
-const link = require("../../link");
+import ListViewLinksModel from "../../links-view-model";
+import Link from "../../link";
const navigationLinks = [
- new link("Basics", "ns-ui-widgets-category/list-picker/basics/basics-page"),
- new link("Code-Behind", "ns-ui-widgets-category/list-picker/code-behind/code-behind-page"),
- new link("Key-Value Pairs", "ns-ui-widgets-category/list-picker/key-value-pairs/key-value-pairs-page")
+ new Link("Usage", "ns-ui-widgets-category/list-picker/usage/usage-page"),
+ new Link("Code-Behind", "ns-ui-widgets-category/list-picker/code-behind/code-behind-page"),
+ new Link("Tips and Tricks", "ns-ui-widgets-category/list-picker/tips-and-tricks/tips-and-tricks-page")
];
const navigationLinksTsc = [
- new link("Basics", "ns-ui-widgets-category/list-picker/basics/basics-ts-page"),
- new link("Code-Behind", "ns-ui-widgets-category/list-picker/code-behind/code-behind-ts-page"),
- new link("Key-Value Pairs", "ns-ui-widgets-category/list-picker/key-value-pairs/key-value-pairs-ts-page")
+ new Link("Usage", "ns-ui-widgets-category/list-picker/usage/usage-ts-page"),
+ new Link("Code-Behind", "ns-ui-widgets-category/list-picker/code-behind/code-behind-ts-page"),
+ new Link("Tips and Tricks", "ns-ui-widgets-category/list-picker/tips-and-tricks/tips-and-tricks-ts-page")
];
-function onNavigatingTo(args) {
+export function onNavigatingTo(args) {
const page = args.object;
page.bindingContext = new ListViewLinksModel({
links: navigationLinks,
@@ -19,4 +19,4 @@ function onNavigatingTo(args) {
tsclinks: navigationLinksTsc
});
}
-exports.onNavigatingTo = onNavigatingTo;
+
diff --git a/app/ns-ui-widgets-category/list-picker/metadata.md b/app/ns-ui-widgets-category/list-picker/metadata.md
index 77503ff..ea24787 100644
--- a/app/ns-ui-widgets-category/list-picker/metadata.md
+++ b/app/ns-ui-widgets-category/list-picker/metadata.md
@@ -4,3 +4,4 @@ description: ListPicker is UI spinner type widget, which allows displaying a lis
position: 310
slug: list-picker
---
+example-order: usage, styling, tips-and-tricks
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/list-picker/overview.md b/app/ns-ui-widgets-category/list-picker/overview.md
index ebbcd5a..c9074a1 100644
--- a/app/ns-ui-widgets-category/list-picker/overview.md
+++ b/app/ns-ui-widgets-category/list-picker/overview.md
@@ -1,5 +1 @@
-Spinner type module with listed options.
-Using a [ListPicker]() requires the `tns-core-modules/ui/list-picker` module.
-
-
-
\ No newline at end of file
+The `ListPicker` is a spinner type component for listing options.
diff --git a/app/ns-ui-widgets-category/list-picker/styling/article.md b/app/ns-ui-widgets-category/list-picker/styling/article.md
new file mode 100644
index 0000000..36d1803
--- /dev/null
+++ b/app/ns-ui-widgets-category/list-picker/styling/article.md
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/list-picker/styling/styling-page.css b/app/ns-ui-widgets-category/list-picker/styling/styling-page.css
new file mode 100644
index 0000000..5da3fb6
--- /dev/null
+++ b/app/ns-ui-widgets-category/list-picker/styling/styling-page.css
@@ -0,0 +1,12 @@
+/* >> picker-styling-css-js */
+.picker {
+ background-color: blanchedalmond;
+ color: red;
+ border-color: brown;
+ border-radius: 20;
+ border-width: 2;
+ width: 200;
+ height: 100;
+ vertical-align: middle;
+}
+/* << picker-styling-css-js */
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/list-picker/styling/styling-page.js b/app/ns-ui-widgets-category/list-picker/styling/styling-page.js
new file mode 100644
index 0000000..15c0bdc
--- /dev/null
+++ b/app/ns-ui-widgets-category/list-picker/styling/styling-page.js
@@ -0,0 +1,17 @@
+// >> picker-styling-code-behind
+import { fromObject } from "@nativescript/core";
+
+export function onNavigatingTo(args) {
+
+ const items = ["Batman", "Joker", "Bane"];
+
+ const page = args.object;
+ const vm = fromObject({
+ items: items
+ });
+ page.bindingContext = vm;
+
+}
+
+
+// << picker-styling-code-behind
diff --git a/app/ns-ui-widgets-category/label/basics/basics-ts-page.xml b/app/ns-ui-widgets-category/list-picker/styling/styling-page.xml
similarity index 55%
rename from app/ns-ui-widgets-category/label/basics/basics-ts-page.xml
rename to app/ns-ui-widgets-category/list-picker/styling/styling-page.xml
index fd82034..1925ea7 100644
--- a/app/ns-ui-widgets-category/label/basics/basics-ts-page.xml
+++ b/app/ns-ui-widgets-category/list-picker/styling/styling-page.xml
@@ -3,7 +3,9 @@
-
-
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/list-picker/styling/styling-ts-page.css b/app/ns-ui-widgets-category/list-picker/styling/styling-ts-page.css
new file mode 100644
index 0000000..eacd51c
--- /dev/null
+++ b/app/ns-ui-widgets-category/list-picker/styling/styling-ts-page.css
@@ -0,0 +1,10 @@
+.picker {
+ background-color: blanchedalmond;
+ color: red;
+ border-color: brown;
+ border-radius: 20;
+ border-width: 2;
+ width: 200;
+ height: 100;
+ vertical-align: middle;
+}
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/list-picker/styling/styling-ts-page.ts b/app/ns-ui-widgets-category/list-picker/styling/styling-ts-page.ts
new file mode 100644
index 0000000..fdcd063
--- /dev/null
+++ b/app/ns-ui-widgets-category/list-picker/styling/styling-ts-page.ts
@@ -0,0 +1,16 @@
+// >> picker-styling-code-behind-ts
+import { EventData, Page, fromObject } from "@nativescript/core";
+
+export function onNavigatingTo(args: EventData) {
+
+ const items = ["Batman", "Joker", "Bane"];
+
+ const page = args.object;
+ const vm = fromObject({
+ items: items
+ });
+ page.bindingContext = vm;
+
+}
+
+// << picker-styling-code-behind-ts
diff --git a/app/ns-ui-widgets-category/button/basics/basics-ts-page.xml b/app/ns-ui-widgets-category/list-picker/styling/styling-ts-page.xml
similarity index 52%
rename from app/ns-ui-widgets-category/button/basics/basics-ts-page.xml
rename to app/ns-ui-widgets-category/list-picker/styling/styling-ts-page.xml
index 3af32f5..5c16f74 100644
--- a/app/ns-ui-widgets-category/button/basics/basics-ts-page.xml
+++ b/app/ns-ui-widgets-category/list-picker/styling/styling-ts-page.xml
@@ -3,7 +3,7 @@
-
-
-
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/list-picker/key-value-pairs/article.md b/app/ns-ui-widgets-category/list-picker/tips-and-tricks/article.md
similarity index 72%
rename from app/ns-ui-widgets-category/list-picker/key-value-pairs/article.md
rename to app/ns-ui-widgets-category/list-picker/tips-and-tricks/article.md
index 7c110ed..e07a533 100644
--- a/app/ns-ui-widgets-category/list-picker/key-value-pairs/article.md
+++ b/app/ns-ui-widgets-category/list-picker/tips-and-tricks/article.md
@@ -1,5 +1,12 @@
+### Using key-value pairs
This functionality provides a simple way to specify the text field, which will be displayed in the ListPicker and the value field which will be returned as a result. In this scenario, when we are setting JSON object to the ListPicker's source, we should set up the `textField` and `valueField` properties, which will specify the displayed and result values. In the example below we are setting `textField` to `name` and `valueField` to `role`. This means that all properties marked as `name` will be displayed in the component and as a result, we will receive their corresponding `role`. We are receiving the selected value via `selectedValue` property, which can also be accessed via code-behind.
-
\ No newline at end of file
+
+
+### Creating ListPicker via Code-Behind
+
+Creating a `ListPicker` programmatically while setting items source and default selected index.
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/list-picker/tips-and-tricks/tips-and-tricks-page.js b/app/ns-ui-widgets-category/list-picker/tips-and-tricks/tips-and-tricks-page.js
new file mode 100644
index 0000000..d25b7d9
--- /dev/null
+++ b/app/ns-ui-widgets-category/list-picker/tips-and-tricks/tips-and-tricks-page.js
@@ -0,0 +1,33 @@
+import { fromObject } from "@nativescript/core";
+
+// >> list-picker-key-value-pairs-code-behind
+export function onNavigatingTo(args) {
+
+ const page = args.object;
+ const vm = fromObject({
+ items: [
+ { id: 1,
+name: "Ter Stegen",
+role: "Goalkeeper" },
+ { id: 3,
+name: "Piqué",
+role: "Defender" },
+ { id: 4,
+name: "I. Rakitic",
+role: "Midfielder" }
+ ],
+ index: 2,
+ selectedItem: ""
+ });
+ page.bindingContext = vm;
+}
+
+
+export function onListPickerLoaded(args) {
+ const listPicker = args.object;
+ listPicker.on("selectedIndexChange", (lpargs) => {
+ const picker = lpargs.object;
+ console.log(`ListPicker selected value: ${picker.selectedValue} ListPicker selected index: ${picker.selectedIndex}`);
+ });
+}
+// << list-picker-key-value-pairs-code-behind
diff --git a/app/ns-ui-widgets-category/list-picker/tips-and-tricks/tips-and-tricks-page.xml b/app/ns-ui-widgets-category/list-picker/tips-and-tricks/tips-and-tricks-page.xml
new file mode 100644
index 0000000..e003b52
--- /dev/null
+++ b/app/ns-ui-widgets-category/list-picker/tips-and-tricks/tips-and-tricks-page.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/list-picker/key-value-pairs/key-value-pairs-ts-page.ts b/app/ns-ui-widgets-category/list-picker/tips-and-tricks/tips-and-tricks-ts-page.ts
similarity index 60%
rename from app/ns-ui-widgets-category/list-picker/key-value-pairs/key-value-pairs-ts-page.ts
rename to app/ns-ui-widgets-category/list-picker/tips-and-tricks/tips-and-tricks-ts-page.ts
index 1948ec6..0f14c55 100644
--- a/app/ns-ui-widgets-category/list-picker/key-value-pairs/key-value-pairs-ts-page.ts
+++ b/app/ns-ui-widgets-category/list-picker/tips-and-tricks/tips-and-tricks-ts-page.ts
@@ -1,7 +1,5 @@
// >> list-picker-key-value-pairs-code-behind-ts
-import { EventData, fromObject } from "tns-core-modules/data/observable";
-import { ListPicker } from "tns-core-modules/ui/list-picker";
-import { Page } from "tns-core-modules/ui/page";
+import { EventData, ListPicker, Page, fromObject } from "@nativescript/core";
export function onNavigatingTo(args: EventData) {
const page = args.object;
@@ -19,11 +17,10 @@ export function onNavigatingTo(args: EventData) {
export function onListPickerLoaded(args: EventData) {
const listPicker = args.object;
- const vm = listPicker.page.bindingContext;
listPicker.on("selectedIndexChange", (lpargs) => {
- vm.set("index", listPicker.selectedIndex);
- console.log(`ListPicker selected value: ${(listPicker).selectedValue}`);
- console.log(`ListPicker selected index: ${listPicker.selectedIndex}`);
+ const picker = lpargs.object;
+ console.log(`ListPicker selected value: ${(picker).selectedValue}`);
+ console.log(`ListPicker selected index: ${picker.selectedIndex}`);
});
}
// << list-picker-key-value-pairs-code-behind-ts
diff --git a/app/ns-ui-widgets-category/list-picker/tips-and-tricks/tips-and-tricks-ts-page.xml b/app/ns-ui-widgets-category/list-picker/tips-and-tricks/tips-and-tricks-ts-page.xml
new file mode 100644
index 0000000..902ad7d
--- /dev/null
+++ b/app/ns-ui-widgets-category/list-picker/tips-and-tricks/tips-and-tricks-ts-page.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/list-picker/basics/article.md b/app/ns-ui-widgets-category/list-picker/usage/article.md
similarity index 100%
rename from app/ns-ui-widgets-category/list-picker/basics/article.md
rename to app/ns-ui-widgets-category/list-picker/usage/article.md
diff --git a/app/ns-ui-widgets-category/list-picker/usage/usage-page.js b/app/ns-ui-widgets-category/list-picker/usage/usage-page.js
new file mode 100644
index 0000000..4296120
--- /dev/null
+++ b/app/ns-ui-widgets-category/list-picker/usage/usage-page.js
@@ -0,0 +1,21 @@
+// >> list-picker-code-behind
+import { fromObject } from "@nativescript/core";
+const years = [1980, 1990, 2000, 2010, 2020];
+export function onNavigatingTo(args) {
+ const page = args.object;
+ const vm = fromObject({
+ years: years
+ });
+ page.bindingContext = vm;
+
+}
+
+
+export function onListPickerLoaded(fargs) {
+ const listPickerComponent = fargs.object;
+ listPickerComponent.on("selectedIndexChange", (args) => {
+ const picker = args.object;
+ console.log(`index: ${picker.selectedIndex}; item" ${years[picker.selectedIndex]}`);
+ });
+}
+// << list-picker-code-behind
diff --git a/app/ns-ui-widgets-category/list-picker/usage/usage-page.xml b/app/ns-ui-widgets-category/list-picker/usage/usage-page.xml
new file mode 100644
index 0000000..32d52bb
--- /dev/null
+++ b/app/ns-ui-widgets-category/list-picker/usage/usage-page.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/list-picker/usage/usage-ts-page.ts b/app/ns-ui-widgets-category/list-picker/usage/usage-ts-page.ts
new file mode 100644
index 0000000..95787f1
--- /dev/null
+++ b/app/ns-ui-widgets-category/list-picker/usage/usage-ts-page.ts
@@ -0,0 +1,22 @@
+// >> list-picker-code-behind-ts
+import { EventData, fromObject, ListPicker, Page } from "@nativescript/core";
+
+const years = [1980, 1990, 2000, 2010, 2020];
+export function onNavigatingTo(args: EventData) {
+
+ const page = args.object;
+ const vm = fromObject({
+ years: years
+ });
+ page.bindingContext = vm;
+
+}
+
+export function onListPickerLoaded(fargs) {
+ const listPickerComponent = fargs.object;
+ listPickerComponent.on("selectedIndexChange", (args: EventData) => {
+ const picker = args.object;
+ console.log(`index: ${picker.selectedIndex}; item" ${years[picker.selectedIndex]}`);
+ });
+}
+// << list-picker-code-behind-ts
diff --git a/app/ns-ui-widgets-category/list-picker/usage/usage-ts-page.xml b/app/ns-ui-widgets-category/list-picker/usage/usage-ts-page.xml
new file mode 100644
index 0000000..5c16f74
--- /dev/null
+++ b/app/ns-ui-widgets-category/list-picker/usage/usage-ts-page.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/list-view/basics/article.md b/app/ns-ui-widgets-category/list-view/basics/article.md
index 8ee3e28..db31d1b 100644
--- a/app/ns-ui-widgets-category/list-view/basics/article.md
+++ b/app/ns-ui-widgets-category/list-view/basics/article.md
@@ -12,7 +12,7 @@ In the example above, the items source property (`myTitles`) is an array and its
> **Tip:** Instead of manually triggering the UI update with the help of ListView's `refresh` method, NativeScript provides the `ObservableArray`. Using an `ObservableArray` for your listview's items surce will make its members an observable objects and adding/removing an array item will automatically update the UI.
```TypeScript
-const ObservableArray = require("tns-core-modules/data/observable-array").ObservableArray;
+import { ObservableArray } from "@nativescript/core";
// Change the items source from Array to the NativeScript's ObservableArray
const titlesArray = new ObservableArray([
{ title: "The Da Vinci Code" },
diff --git a/app/ns-ui-widgets-category/list-view/basics/basics-page.js b/app/ns-ui-widgets-category/list-view/basics/basics-page.js
index 20f7d98..25e3081 100644
--- a/app/ns-ui-widgets-category/list-view/basics/basics-page.js
+++ b/app/ns-ui-widgets-category/list-view/basics/basics-page.js
@@ -1,7 +1,7 @@
// >> list-view-create-code
-const fromObject = require("tns-core-modules/data/observable").fromObject;
+import { fromObject } from "@nativescript/core";
-function onNavigatingTo(args) {
+export function onNavigatingTo(args) {
const page = args.object;
const vm = fromObject({
// Setting the listview binding source
@@ -16,21 +16,19 @@ function onNavigatingTo(args) {
});
page.bindingContext = vm;
}
-exports.onNavigatingTo = onNavigatingTo;
-function onListViewLoaded(args) {
+
+export function onListViewLoaded(args) {
const listView = args.object;
}
-exports.onListViewLoaded = onListViewLoaded;
-function onItemTap(args) {
+export function onItemTap(args) {
const index = args.index;
console.log(`Second ListView item tap ${index}`);
}
-exports.onItemTap = onItemTap;
// << list-view-create-code
-function onTap(args) {
+export function onTap(args) {
const page = args.object.page;
// >> list-view-refresh
const listView = page.getViewById("listView");
@@ -40,5 +38,4 @@ function onTap(args) {
// << list-view-refresh
}
-exports.onTap = onTap;
diff --git a/app/ns-ui-widgets-category/list-view/basics/basics-ts-page.ts b/app/ns-ui-widgets-category/list-view/basics/basics-ts-page.ts
index d7e82bb..26163a0 100644
--- a/app/ns-ui-widgets-category/list-view/basics/basics-ts-page.ts
+++ b/app/ns-ui-widgets-category/list-view/basics/basics-ts-page.ts
@@ -1,7 +1,5 @@
// >> list-view-create-code-ts
-import { EventData, fromObject } from "tns-core-modules/data/observable";
-import { ListView, ItemEventData } from "tns-core-modules/ui/list-view";
-import { Page } from "tns-core-modules/ui/page";
+import { EventData, fromObject, ItemEventData, ListView, Page } from "@nativescript/core";
export function onNavigatingTo(args: EventData) {
const page = args.object;
diff --git a/app/ns-ui-widgets-category/list-view/code-behind/code-behind-page.js b/app/ns-ui-widgets-category/list-view/code-behind/code-behind-page.js
index 56a3635..a25d1da 100644
--- a/app/ns-ui-widgets-category/list-view/code-behind/code-behind-page.js
+++ b/app/ns-ui-widgets-category/list-view/code-behind/code-behind-page.js
@@ -1,10 +1,7 @@
// >> require-list-view
-const listViewModule = require("tns-core-modules/ui/list-view");
+import { ListView } from "@nativescript/core";
// << require-list-view
-const dialogs = require("tns-core-modules/ui/dialogs");
-const Label = require("tns-core-modules/ui/label").Label;
-const ObservableArray = require("tns-core-modules/data/observable-array").ObservableArray;
-
+import { Dialogs, Label, ObservableArray } from "@nativescript/core";
const listViewArray = new ObservableArray([
{ title: "The Da Vinci Code" },
{ title: "Harry Potter and the Chamber of Secrets" },
@@ -14,16 +11,16 @@ const listViewArray = new ObservableArray([
{ title: "The Hobbit" }
]);
-function onNavigatingTo(args) {
+export function onNavigatingTo(args) {
const page = args.object;
// >> create-list-view-code
const container = page.getViewById("container");
- const listView = new listViewModule.ListView();
+ const listView = new ListView();
listView.className = "list-group";
listView.items = listViewArray;
// The itemLoading event is used to create the UI for each item that is shown in the ListView.
- listView.on(listViewModule.ListView.itemLoadingEvent, (args) => {
+ listView.on(ListView.itemLoadingEvent, (args) => {
if (!args.view) {
// Create label if it is not already created.
args.view = new Label();
@@ -32,10 +29,10 @@ function onNavigatingTo(args) {
(args.view).text = listViewArray.getItem(args.index).title;
});
- listView.on(listViewModule.ListView.itemTapEvent, (args) => {
+ listView.on(ListView.itemTapEvent, (args) => {
const tappedItemIndex = args.index;
const tappedItemView = args.view;
- dialogs.alert(`Index: ${tappedItemIndex} View: ${tappedItemView}`)
+ Dialogs.alert(`Index: ${tappedItemIndex} View: ${tappedItemView}`)
.then(() => {
console.log("Dialog closed!");
});
@@ -44,4 +41,4 @@ function onNavigatingTo(args) {
container.addChild(listView);
// << create-list-view-code
}
-exports.onNavigatingTo = onNavigatingTo;
+
diff --git a/app/ns-ui-widgets-category/list-view/code-behind/code-behind-ts-page.ts b/app/ns-ui-widgets-category/list-view/code-behind/code-behind-ts-page.ts
index 86317a4..2f9309a 100644
--- a/app/ns-ui-widgets-category/list-view/code-behind/code-behind-ts-page.ts
+++ b/app/ns-ui-widgets-category/list-view/code-behind/code-behind-ts-page.ts
@@ -1,9 +1,7 @@
// >> require-list-view-ts
-import { ItemEventData, ListView } from "tns-core-modules/ui/list-view";
+import { ItemEventData, ListView } from "@nativescript/core";
// << require-list-view-ts
-import { alert } from "tns-core-modules/ui/dialogs";
-import { Label } from "tns-core-modules/ui/label";
-import { ObservableArray } from "tns-core-modules/data/observable-array";
+import { Label, ObservableArray, alert } from "@nativescript/core";
const listViewArray = new ObservableArray([
{ title: "The Da Vinci Code" },
diff --git a/app/ns-ui-widgets-category/list-view/events/events-page.js b/app/ns-ui-widgets-category/list-view/events/events-page.js
index 3555b2d..f7eaa1d 100644
--- a/app/ns-ui-widgets-category/list-view/events/events-page.js
+++ b/app/ns-ui-widgets-category/list-view/events/events-page.js
@@ -1,6 +1,4 @@
-const Observable = require("tns-core-modules/data/observable").Observable;
-const ObservableArray = require("tns-core-modules/data/observable-array").ObservableArray;
-const dialogs = require("tns-core-modules/ui/dialogs");
+import { Dialogs, Observable, ObservableArray } from "@nativescript/core";
const listArray = new ObservableArray([
{
@@ -44,7 +42,7 @@ const moreListItems = new ObservableArray([
]);
let loadMore = true;
-function onNavigatingTo(args) {
+export function onNavigatingTo(args) {
const page = args.object;
const vm = new Observable();
@@ -52,19 +50,18 @@ function onNavigatingTo(args) {
page.bindingContext = vm;
}
-exports.onNavigatingTo = onNavigatingTo;
+
// >> list-view-events
// The event will be raise when an item inside the ListView is tapped.
-function onItemTap(args) {
+export function onItemTap(args) {
const index = args.index;
- dialogs.alert(`ListView item tap ${index}`).then(() => {
+ Dialogs.alert(`ListView item tap ${index}`).then(() => {
console.log("Dialog closed!");
});
}
-exports.onItemTap = onItemTap;
// The event will be raised when the ListView is scrolled so that the last item is visible. This even is intended to be used to add additional data in the ListView.
-function onLoadMoreItems(args) {
+export function onLoadMoreItems(args) {
if (loadMore) {
console.log("ListView -> LoadMoreItemsEvent");
setTimeout(() => {
@@ -98,5 +95,4 @@ function onLoadMoreItems(args) {
loadMore = false;
}
}
-exports.onLoadMoreItems = onLoadMoreItems;
// << list-view-events
diff --git a/app/ns-ui-widgets-category/list-view/events/events-ts-page.ts b/app/ns-ui-widgets-category/list-view/events/events-ts-page.ts
index 6605c76..f12896a 100644
--- a/app/ns-ui-widgets-category/list-view/events/events-ts-page.ts
+++ b/app/ns-ui-widgets-category/list-view/events/events-ts-page.ts
@@ -1,7 +1,4 @@
-import { Observable } from "tns-core-modules/data/observable";
-import { ObservableArray } from "tns-core-modules/data/observable-array";
-import { alert } from "tns-core-modules/ui/dialogs";
-import { ItemEventData } from "tns-core-modules/ui/list-view";
+import { alert, ItemEventData, Observable, ObservableArray } from "@nativescript/core";
const listArray = new ObservableArray([
{
diff --git a/app/ns-ui-widgets-category/list-view/list-view-page.js b/app/ns-ui-widgets-category/list-view/list-view-page.js
index 0e8ee82..4dc0503 100644
--- a/app/ns-ui-widgets-category/list-view/list-view-page.js
+++ b/app/ns-ui-widgets-category/list-view/list-view-page.js
@@ -1,19 +1,19 @@
-const ListViewLinksModel = require("../../links-view-model");
-const link = require("../../link");
+import ListViewLinksModel from "../../links-view-model";
+import Link from "../../link";
const navigationLinks = [
- new link("Basics", "ns-ui-widgets-category/list-view/basics/basics-page"),
- new link("Code Behind", "ns-ui-widgets-category/list-view/code-behind/code-behind-page"),
- new link("Events", "ns-ui-widgets-category/list-view/events/events-page"),
- new link("Multiple Templates", "ns-ui-widgets-category/list-view/multiple-templates/multiple-templates-page"),
- new link("Multiple Templates Selector Function", "ns-ui-widgets-category/list-view/multiple-templates-selector-function/multiple-templates-selector-function-page")
+ new Link("Basics", "ns-ui-widgets-category/list-view/basics/basics-page"),
+ new Link("Code Behind", "ns-ui-widgets-category/list-view/code-behind/code-behind-page"),
+ new Link("Events", "ns-ui-widgets-category/list-view/events/events-page"),
+ new Link("Multiple Templates", "ns-ui-widgets-category/list-view/multiple-templates/multiple-templates-page"),
+ new Link("Multiple Templates Selector Function", "ns-ui-widgets-category/list-view/multiple-templates-selector-function/multiple-templates-selector-function-page")
];
const navigationLinksTsc = [
- new link("Basics", "ns-ui-widgets-category/list-view/basics/basics-ts-page"),
- new link("Code Behind", "ns-ui-widgets-category/list-view/code-behind/code-behind-ts-page"),
- new link("Events", "ns-ui-widgets-category/list-view/events/events-ts-page"),
- new link("Multiple Templates Selector Function", "ns-ui-widgets-category/list-view/multiple-templates-selector-function/multiple-templates-selector-function-ts-page")
+ new Link("Basics", "ns-ui-widgets-category/list-view/basics/basics-ts-page"),
+ new Link("Code Behind", "ns-ui-widgets-category/list-view/code-behind/code-behind-ts-page"),
+ new Link("Events", "ns-ui-widgets-category/list-view/events/events-ts-page"),
+ new Link("Multiple Templates Selector Function", "ns-ui-widgets-category/list-view/multiple-templates-selector-function/multiple-templates-selector-function-ts-page")
];
-function onNavigatingTo(args) {
+export function onNavigatingTo(args) {
const page = args.object;
page.bindingContext = new ListViewLinksModel({
links: navigationLinks,
@@ -22,4 +22,4 @@ function onNavigatingTo(args) {
tsclinks: navigationLinksTsc
});
}
-exports.onNavigatingTo = onNavigatingTo;
+
diff --git a/app/ns-ui-widgets-category/list-view/multiple-templates-selector-function/multiple-templates-selector-function-page.js b/app/ns-ui-widgets-category/list-view/multiple-templates-selector-function/multiple-templates-selector-function-page.js
index 6c5d217..3545567 100644
--- a/app/ns-ui-widgets-category/list-view/multiple-templates-selector-function/multiple-templates-selector-function-page.js
+++ b/app/ns-ui-widgets-category/list-view/multiple-templates-selector-function/multiple-templates-selector-function-page.js
@@ -1,97 +1,96 @@
-const observableModule = require("tns-core-modules/data/observable");
-const observableArrayModule = require("tns-core-modules/data/observable-array");
+import { Observable, ObservableArray, fromObject } from "@nativescript/core";
-const listArray = new observableArrayModule.ObservableArray(
+const listArray = new ObservableArray(
[
- observableModule.fromObject({
+ fromObject({
name:"Joyce Dean",
age: 20
}),
- observableModule.fromObject({
+ fromObject({
name:"Joel Robertson",
age: 15
}),
- observableModule.fromObject({
+ fromObject({
name:"Sherman Martin",
age: 35
}),
- observableModule.fromObject({
+ fromObject({
name:"Lela Richardson",
age: 40
}),
- observableModule.fromObject({
+ fromObject({
name:"Jackie Maldonado",
age: 17
}),
- observableModule.fromObject({
+ fromObject({
name:"Kathryn Byrd",
age:18
}),
- observableModule.fromObject({
+ fromObject({
name:"Ervin Powers",
age: 50
}),
- observableModule.fromObject({
+ fromObject({
name:"Leland Warner",
age: 12
}),
- observableModule.fromObject({
+ fromObject({
name:"Nicholas Bowers",
age: 45
}),
- observableModule.fromObject({
+ fromObject({
name:"Alex Soto",
age: 46
}),
- observableModule.fromObject({
+ fromObject({
name:"Naomi Carson",
age: 11
}),
- observableModule.fromObject({
+ fromObject({
name:"Rufus Edwards",
age: 65
}),
- observableModule.fromObject({
+ fromObject({
name:"Ian Ellis",
age: 17
}),
- observableModule.fromObject({
+ fromObject({
name:"Pat Vasquez",
age: 20
}),
- observableModule.fromObject({
+ fromObject({
name:"Chelsea Burton",
age: 30
}),
- observableModule.fromObject({
+ fromObject({
name:"Karl Bates",
age: 20
}),
- observableModule.fromObject({
+ fromObject({
name:"Evan Rivera",
age: 40
}),
- observableModule.fromObject({
+ fromObject({
name:"Tony Lawson",
age: 16
}),
- observableModule.fromObject({
+ fromObject({
name:"Wallace Little",
age: 20
}),
- observableModule.fromObject({
+ fromObject({
name:"Carrie Tran",
age: 23
}),
- observableModule.fromObject({
+ fromObject({
name:"Tyler Washington",
age: 18
})
]
);
-function onNavigatingTo(args) {
+export function onNavigatingTo(args) {
const page = args.object;
- const vm = new observableModule.Observable();
+ const vm = new Observable();
vm.set("listArray", listArray);
@@ -99,16 +98,14 @@ function onNavigatingTo(args) {
}
// >> list-view-multy-template-code
-function selectItemTemplateAge(item, index, items) {
+export function selectItemTemplateAge(item, index, items) {
return item.age > 18 ? "green" : "red";
}
// << list-view-multy-template-code
// >> listview-create-selector-function-code
-function selectItemTemplate(item, index, items) {
+export function selectItemTemplate(item, index, items) {
return index % 2 === 0 ? "even" : "odd";
}
// << listview-create-selector-function-code
-exports.onNavigatingTo = onNavigatingTo;
-exports.selectItemTemplateAge = selectItemTemplateAge;
-exports.selectItemTemplate = selectItemTemplate;
+
diff --git a/app/ns-ui-widgets-category/list-view/multiple-templates-selector-function/multiple-templates-selector-function-ts-page.ts b/app/ns-ui-widgets-category/list-view/multiple-templates-selector-function/multiple-templates-selector-function-ts-page.ts
index 063641b..090cfd8 100644
--- a/app/ns-ui-widgets-category/list-view/multiple-templates-selector-function/multiple-templates-selector-function-ts-page.ts
+++ b/app/ns-ui-widgets-category/list-view/multiple-templates-selector-function/multiple-templates-selector-function-ts-page.ts
@@ -1,5 +1,4 @@
-import { Observable, fromObject } from "tns-core-modules/data/observable";
-import { ObservableArray } from "tns-core-modules/data/observable-array";
+import { fromObject, Observable, ObservableArray } from "@nativescript/core";
const listArray = new ObservableArray(
[
diff --git a/app/ns-ui-widgets-category/list-view/multiple-templates/multiple-templates-page.js b/app/ns-ui-widgets-category/list-view/multiple-templates/multiple-templates-page.js
index ae31b3f..2be7b3a 100644
--- a/app/ns-ui-widgets-category/list-view/multiple-templates/multiple-templates-page.js
+++ b/app/ns-ui-widgets-category/list-view/multiple-templates/multiple-templates-page.js
@@ -1,102 +1,101 @@
-const observableModule = require("tns-core-modules/data/observable");
-const observableArrayModule = require("tns-core-modules/data/observable-array");
+import { Observable, ObservableArray, fromObject } from "@nativescript/core";
-const listArray = new observableArrayModule.ObservableArray(
+const listArray = new ObservableArray(
[
- observableModule.fromObject({
+ fromObject({
name:"Joyce Dean",
age: 20
}),
- observableModule.fromObject({
+ fromObject({
name:"Joel Robertson",
age: 15
}),
- observableModule.fromObject({
+ fromObject({
name:"Sherman Martin",
age: 35
}),
- observableModule.fromObject({
+ fromObject({
name:"Lela Richardson",
age: 40
}),
- observableModule.fromObject({
+ fromObject({
name:"Jackie Maldonado",
age: 17
}),
- observableModule.fromObject({
+ fromObject({
name:"Kathryn Byrd",
age:18
}),
- observableModule.fromObject({
+ fromObject({
name:"Ervin Powers",
age: 50
}),
- observableModule.fromObject({
+ fromObject({
name:"Leland Warner",
age: 12
}),
- observableModule.fromObject({
+ fromObject({
name:"Nicholas Bowers",
age: 45
}),
- observableModule.fromObject({
+ fromObject({
name:"Alex Soto",
age: 46
}),
- observableModule.fromObject({
+ fromObject({
name:"Naomi Carson",
age: 11
}),
- observableModule.fromObject({
+ fromObject({
name:"Rufus Edwards",
age: 65
}),
- observableModule.fromObject({
+ fromObject({
name:"Ian Ellis",
age: 17
}),
- observableModule.fromObject({
+ fromObject({
name:"Pat Vasquez",
age: 20
}),
- observableModule.fromObject({
+ fromObject({
name:"Chelsea Burton",
age: 30
}),
- observableModule.fromObject({
+ fromObject({
name:"Karl Bates",
age: 20
}),
- observableModule.fromObject({
+ fromObject({
name:"Evan Rivera",
age: 40
}),
- observableModule.fromObject({
+ fromObject({
name:"Tony Lawson",
age: 16
}),
- observableModule.fromObject({
+ fromObject({
name:"Wallace Little",
age: 20
}),
- observableModule.fromObject({
+ fromObject({
name:"Carrie Tran",
age: 23
}),
- observableModule.fromObject({
+ fromObject({
name:"Tyler Washington",
age: 18
})
]
);
-function onNavigatingTo(args) {
+export function onNavigatingTo(args) {
const page = args.object;
- const vm = new observableModule.Observable();
+ const vm = new Observable();
vm.set("listArray", listArray);
page.bindingContext = vm;
}
-exports.onNavigatingTo = onNavigatingTo;
+
diff --git a/app/ns-ui-widgets-category/page/page-creation/page-creation-page.js b/app/ns-ui-widgets-category/page/page-creation/page-creation-page.js
index b0de123..5f02286 100644
--- a/app/ns-ui-widgets-category/page/page-creation/page-creation-page.js
+++ b/app/ns-ui-widgets-category/page/page-creation/page-creation-page.js
@@ -1,18 +1,16 @@
// >> page-creation-js
-function onPageLoaded(args) {
+export function onPageLoaded(args) {
console.log("Page Loaded");
const page = args.object;
}
-exports.onPageLoaded = onPageLoaded;
+
// << page-creation-js
/*
// >> page-code-create-js
-const Page = require("tns-core-modules/ui/page").Page;
-const Label = require("tns-core-modules/ui/label").Label;
-const StackLayout = require("tns-core-modules/ui/layouts/stack-layout").StackLayout;
+import { Label, StackLayout, Page } from "@nativescript/core";
-function createPage() {
+export function createPage() {
// Creating of the page content
const stack = new StackLayout();
const label = new Label();
@@ -25,6 +23,5 @@ function createPage() {
return page;
}
-exports.createPage = createPage;
// << page-code-create-js
*/
diff --git a/app/ns-ui-widgets-category/page/page-creation/page-creation-ts-page.ts b/app/ns-ui-widgets-category/page/page-creation/page-creation-ts-page.ts
index 997b6e6..2eceb1d 100644
--- a/app/ns-ui-widgets-category/page/page-creation/page-creation-ts-page.ts
+++ b/app/ns-ui-widgets-category/page/page-creation/page-creation-ts-page.ts
@@ -1,8 +1,6 @@
/*
// >> page-code-create-ts
-import { Page } from "tns-core-modules/ui/page";
-import { Label } from "tns-core-modules/ui/label";
-import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout";
+import { Label, Page, StackLayout } from "@nativescript/core";
export function createPage(): Page {
const stack = new StackLayout();
@@ -20,8 +18,7 @@ export function createPage(): Page {
// >> page-creation-ts
// main-page.ts
-import { EventData } from "tns-core-modules/data/observable";
-import { Page } from "tns-core-modules/ui/page";
+import { EventData, Page } from "@nativescript/core";
export function onPageLoaded(args: EventData): void {
console.log("Page Loaded");
diff --git a/app/ns-ui-widgets-category/page/page-events/page-events-page.js b/app/ns-ui-widgets-category/page/page-events/page-events-page.js
index 4ad300f..cf7ae16 100644
--- a/app/ns-ui-widgets-category/page/page-events/page-events-page.js
+++ b/app/ns-ui-widgets-category/page/page-events/page-events-page.js
@@ -1,51 +1,46 @@
// >> page-events
-function onNavigatingTo(args) {
+export function onNavigatingTo(args) {
console.log(args.eventName);
console.log(args.object);
console.log(args.context);
console.log(args.isBackNavigation);
}
-exports.onNavigatingTo = onNavigatingTo;
-function onPageLoaded(args) {
+
+export function onPageLoaded(args) {
console.log(args.eventName);
console.log(args.object);
}
-exports.onPageLoaded = onPageLoaded;
-function onLayoutChanged(args) {
+
+export function onLayoutChanged(args) {
console.log(args.eventName);
console.log(args.object);
}
-exports.onLayoutChanged = onLayoutChanged;
-function onNavigatedTo(args) {
+export function onNavigatedTo(args) {
console.log(args.eventName);
console.log(args.object);
console.log(args.context);
console.log(args.isBackNavigation);
}
-exports.onNavigatedTo = onNavigatedTo;
-function onNavigatingFrom(args) {
+export function onNavigatingFrom(args) {
console.log(args.eventName);
console.log(args.object);
console.log(args.context);
console.log(args.isBackNavigation);
}
-exports.onNavigatingFrom = onNavigatingFrom;
-function onUnloaded(args) {
+export function onUnloaded(args) {
console.log(args.eventName);
console.log(args.object);
}
-exports.onUnloaded = onUnloaded;
-function onNavigatedFrom(args) {
+export function onNavigatedFrom(args) {
console.log(args.eventName);
console.log(args.object);
console.log(args.context);
console.log(args.isBackNavigation);
}
-exports.onNavigatedFrom = onNavigatedFrom;
// << page-events
diff --git a/app/ns-ui-widgets-category/page/page-events/page-events-ts-page.ts b/app/ns-ui-widgets-category/page/page-events/page-events-ts-page.ts
index 77a9573..e9c0bc4 100644
--- a/app/ns-ui-widgets-category/page/page-events/page-events-ts-page.ts
+++ b/app/ns-ui-widgets-category/page/page-events/page-events-ts-page.ts
@@ -1,6 +1,5 @@
// >> page-events-ts
-import { EventData } from "tns-core-modules/data/observable";
-import { NavigatedData } from "tns-core-modules/ui/page";
+import { EventData, NavigatedData } from "@nativescript/core";
export function onNavigatingTo(args: NavigatedData) {
console.log(args.eventName);
diff --git a/app/ns-ui-widgets-category/page/page-page.js b/app/ns-ui-widgets-category/page/page-page.js
index 1311425..cf1f0ac 100644
--- a/app/ns-ui-widgets-category/page/page-page.js
+++ b/app/ns-ui-widgets-category/page/page-page.js
@@ -1,16 +1,16 @@
-const ListViewLinksModel = require("../../links-view-model");
-const link = require("../../link");
+import ListViewLinksModel from "../../links-view-model";
+import Link from "../../link";
const navigationLinks = [
- new link("Page Creation", "ns-ui-widgets-category/page/page-creation/page-creation-page"),
- new link("Page Reference", "ns-ui-widgets-category/page/page-reference/page-reference-page"),
- new link("Page Events", "ns-ui-widgets-category/page/page-events/page-events-page")
+ new Link("Page Creation", "ns-ui-widgets-category/page/page-creation/page-creation-page"),
+ new Link("Page Reference", "ns-ui-widgets-category/page/page-reference/page-reference-page"),
+ new Link("Page Events", "ns-ui-widgets-category/page/page-events/page-events-page")
];
const navigationLinksTsc = [
- new link("Page Creation", "ns-ui-widgets-category/page/page-creation/page-creation-ts-page"),
- new link("Page Reference", "ns-ui-widgets-category/page/page-reference/page-reference-ts-page"),
- new link("Page Events", "ns-ui-widgets-category/page/page-events/page-events-ts-page")
+ new Link("Page Creation", "ns-ui-widgets-category/page/page-creation/page-creation-ts-page"),
+ new Link("Page Reference", "ns-ui-widgets-category/page/page-reference/page-reference-ts-page"),
+ new Link("Page Events", "ns-ui-widgets-category/page/page-events/page-events-ts-page")
];
-function onNavigatingTo(args) {
+export function onNavigatingTo(args) {
const page = args.object;
page.bindingContext = new ListViewLinksModel({
links: navigationLinks,
@@ -19,4 +19,4 @@ function onNavigatingTo(args) {
tsclinks: navigationLinksTsc
});
}
-exports.onNavigatingTo = onNavigatingTo;
+
diff --git a/app/ns-ui-widgets-category/page/page-reference/page-reference-page.js b/app/ns-ui-widgets-category/page/page-reference/page-reference-page.js
index ca5112f..3699cfd 100644
--- a/app/ns-ui-widgets-category/page/page-reference/page-reference-page.js
+++ b/app/ns-ui-widgets-category/page/page-reference/page-reference-page.js
@@ -1,45 +1,43 @@
// >> page-reference-via-event
-function onPageLoaded(args) {
+export function onPageLoaded(args) {
console.log("Page Loaded!");
const page = args.object;
console.log("Page reference from loaded event: ", page);
}
-exports.onPageLoaded = onPageLoaded;
-function onNavigatedTo(args) {
+export function onNavigatedTo(args) {
console.log("Page onNavigatedTo!");
const page = args.object;
console.log("Page reference from navigatedTo event: ", page);
}
-exports.onNavigatedTo = onNavigatedTo;
+
// << page-reference-via-event
// >> page-reference-via-page-prop
-function onStackLoaded(args) {
+export function onStackLoaded(args) {
console.log("Root StackLayout Loaded!");
const stack = args.object;
const page = stack.page;
console.log("Page reference from page child element: ", page);
}
-exports.onStackLoaded = onStackLoaded;
-function onButtonTapped(args) {
+
+export function onButtonTapped(args) {
console.log("Button Tapped!");
const button = args.object;
const page = button.page;
console.log("Page reference from button tap event: ", page);
}
-exports.onButtonTapped = onButtonTapped;
// << page-reference-via-page-prop
// >> page-reference-via-currrent-page-prop
-const getFrameById = require("tns-core-modules/ui/frame").getFrameById;
+import { Frame } from "@nativescript/core";
-function onNavigatingTo(args) {
+export function onNavigatingTo(args) {
console.log("Page navigatingTo");
- const rootFrame = getFrameById("root-frame");
+ const rootFrame = Frame.getFrameById("root-frame");
const page = rootFrame.currentPage;
console.log("Page reference from currentPage property of Frame: ", page);
}
-exports.onNavigatingTo = onNavigatingTo;
+
// << page-reference-via-currrent-page-prop
diff --git a/app/ns-ui-widgets-category/page/page-reference/page-reference-ts-page.ts b/app/ns-ui-widgets-category/page/page-reference/page-reference-ts-page.ts
index f80b172..3f3f087 100644
--- a/app/ns-ui-widgets-category/page/page-reference/page-reference-ts-page.ts
+++ b/app/ns-ui-widgets-category/page/page-reference/page-reference-ts-page.ts
@@ -1,6 +1,5 @@
// >> page-reference-via-event-ts
-import { EventData } from "tns-core-modules/data/observable";
-import { Page, NavigatedData } from "tns-core-modules/ui/page";
+import { EventData, NavigatedData, Page} from "@nativescript/core";
export function onPageLoaded(args: EventData) {
console.log("Page loaded");
@@ -16,8 +15,7 @@ export function onNavigatedTo(args: NavigatedData) {
// << page-reference-via-event-ts
// >> page-reference-via-page-prop-ts
-import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout";
-import { Button } from "tns-core-modules/ui/button";
+import { Button, StackLayout } from "@nativescript/core";
export function onStackLoaded(args: EventData) {
console.log("Root StackLayout loaded");
@@ -35,11 +33,11 @@ export function onButtonTapped(args: EventData) {
// << page-reference-via-page-prop-ts
// >> page-reference-via-currrent-page-prop-ts
-import { getFrameById } from "tns-core-modules/ui/frame";
+import { Frame } from "@nativescript/core";
export function onNavigatingTo(args: EventData) {
console.log("Page navigatingTo");
- const rootFrame = getFrameById("root-frame");
+ const rootFrame = Frame.getFrameById("root-frame");
const page = rootFrame.currentPage;
console.log("Page reference from currentPage property of Frame: ", page);
}
diff --git a/app/ns-ui-widgets-category/placeholder/basics/basics-page.js b/app/ns-ui-widgets-category/placeholder/basics/basics-page.js
index 64bf345..20036aa 100644
--- a/app/ns-ui-widgets-category/placeholder/basics/basics-page.js
+++ b/app/ns-ui-widgets-category/placeholder/basics/basics-page.js
@@ -1,20 +1,18 @@
// >> placeholder-require
-const placeholderModule = require("tns-core-modules/ui/placeholder");
+import { Placeholder } from "@nativescript/core";
// << placeholder-require
-const platformModule = require("tns-core-modules/platform");
-const utils = require("tns-core-modules/utils/utils");
+import { Utils, isAndroid, isIOS } from "@nativescript/core";
// >> placeholder-code
-function creatingView(args) {
+export function creatingView(args) {
let nativeView;
- if (platformModule.isIOS) {
+ if (isIOS) {
nativeView = UITextView.new();
nativeView.text = "Native View (iOS)";
- } else if (platformModule.isAndroid) {
- nativeView = new android.widget.TextView(utils.ad.getApplicationContext());
+ } else if (isAndroid) {
+ nativeView = new android.widget.TextView(Utils.ad.getApplicationContext());
nativeView.setText("Native View (Android)");
}
args.view = nativeView;
}
-exports.creatingView = creatingView;
// << placeholder-code
diff --git a/app/ns-ui-widgets-category/placeholder/basics/basics-ts-page.ts b/app/ns-ui-widgets-category/placeholder/basics/basics-ts-page.ts
index 4dab8c0..c405776 100644
--- a/app/ns-ui-widgets-category/placeholder/basics/basics-ts-page.ts
+++ b/app/ns-ui-widgets-category/placeholder/basics/basics-ts-page.ts
@@ -1,8 +1,7 @@
// >> placeholder-import
-import { Placeholder } from "tns-core-modules/ui/placeholder";
+import { Placeholder } from "@nativescript/core";
// << placeholder-import
-import { isIOS, isAndroid } from "tns-core-modules/platform";
-import { ad } from "tns-core-modules/utils/utils";
+import { Utils, isIOS, isAndroid } from "@nativescript/core";
// >> placeholder-code-ts
export function creatingView(args) {
let nativeView;
@@ -10,7 +9,7 @@ export function creatingView(args) {
nativeView = UITextView.new();
nativeView.text = "Native View (iOS)";
} else if (isAndroid) {
- nativeView = new android.widget.TextView(ad.getApplicationContext());
+ nativeView = new android.widget.TextView(Utils.ad.getApplicationContext());
nativeView.setText("Native View (Android)");
}
diff --git a/app/ns-ui-widgets-category/placeholder/code-behind/code-behind-page.js b/app/ns-ui-widgets-category/placeholder/code-behind/code-behind-page.js
index 8c8af99..84236a9 100644
--- a/app/ns-ui-widgets-category/placeholder/code-behind/code-behind-page.js
+++ b/app/ns-ui-widgets-category/placeholder/code-behind/code-behind-page.js
@@ -1,17 +1,15 @@
-const placeholderModule = require("tns-core-modules/ui/placeholder");
-const platformModule = require("tns-core-modules/platform");
-const utils = require("tns-core-modules/utils/utils");
+import { Placeholder, Utils, isAndroid, isIOS } from "@nativescript/core";
// >> code-behind-placeholder-code
-function onLayoutLoaded (ltargs) {
+export function onLayoutLoaded (ltargs) {
const layout = ltargs.object;
- const placeholder = new placeholderModule.Placeholder();
+ const placeholder = new Placeholder();
placeholder.on("creatingView", (args) => {
let nativeView;
- if (platformModule.isIOS) {
+ if (isIOS) {
nativeView = UITextView.new();
nativeView.text = "Native View (iOS)";
- } else if (platformModule.isAndroid) {
- nativeView = new android.widget.TextView(utils.ad.getApplicationContext());
+ } else if (isAndroid) {
+ nativeView = new android.widget.TextView(Utils.ad.getApplicationContext());
nativeView.setText("Native View (Android)");
}
@@ -19,5 +17,4 @@ function onLayoutLoaded (ltargs) {
});
layout.addChild(placeholder);
}
-exports.onLayoutLoaded = onLayoutLoaded;
// << code-behind-placeholder-code
diff --git a/app/ns-ui-widgets-category/placeholder/code-behind/code-behind-ts-page.ts b/app/ns-ui-widgets-category/placeholder/code-behind/code-behind-ts-page.ts
index 52a6307..0e4fe27 100644
--- a/app/ns-ui-widgets-category/placeholder/code-behind/code-behind-ts-page.ts
+++ b/app/ns-ui-widgets-category/placeholder/code-behind/code-behind-ts-page.ts
@@ -1,7 +1,4 @@
-import { Placeholder } from "tns-core-modules/ui/placeholder";
-import { isIOS, isAndroid } from "tns-core-modules/platform";
-import { ad } from "tns-core-modules/utils/utils";
-import {StackLayout} from "tns-core-modules/ui/layouts/stack-layout";
+import { Placeholder, StackLayout, Utils, isIOS, isAndroid } from "@nativescript/core";
// >> code-behind-placeholder-code-ts
export function onLayoutLoaded (ltargs) {
let layout: StackLayout = ltargs.object;
@@ -12,7 +9,7 @@ export function onLayoutLoaded (ltargs) {
nativeView = UITextView.new();
nativeView.text = "Native View (iOS)";
} else if (isAndroid) {
- nativeView = new android.widget.TextView(ad.getApplicationContext());
+ nativeView = new android.widget.TextView(Utils.ad.getApplicationContext());
nativeView.setText("Native View (Android)");
}
diff --git a/app/ns-ui-widgets-category/placeholder/placeholder-page.js b/app/ns-ui-widgets-category/placeholder/placeholder-page.js
index 2e128af..27d435b 100644
--- a/app/ns-ui-widgets-category/placeholder/placeholder-page.js
+++ b/app/ns-ui-widgets-category/placeholder/placeholder-page.js
@@ -1,16 +1,16 @@
-const ListViewLinksModel = require("../../links-view-model");
-const link = require("../../link");
+import ListViewLinksModel from "../../links-view-model";
+import Link from "../../link";
const navigationLinks = [
- new link("Basics", "ns-ui-widgets-category/placeholder/basics/basics-page"),
- new link("Platform files", "ns-ui-widgets-category/placeholder/platform-files/platform-files-page"),
- new link("Code-behind", "ns-ui-widgets-category/placeholder/code-behind/code-behind-page")
+ new Link("Basics", "ns-ui-widgets-category/placeholder/basics/basics-page"),
+ new Link("Platform files", "ns-ui-widgets-category/placeholder/platform-files/platform-files-page"),
+ new Link("Code-behind", "ns-ui-widgets-category/placeholder/code-behind/code-behind-page")
];
const navigationLinksTsc = [
- new link("Basics", "ns-ui-widgets-category/placeholder/basics/basics-ts-page"),
- new link("Platform files", "ns-ui-widgets-category/placeholder/platform-files/platform-files-ts-page"),
- new link("Code-behind", "ns-ui-widgets-category/placeholder/code-behind/code-behind-ts-page")
+ new Link("Basics", "ns-ui-widgets-category/placeholder/basics/basics-ts-page"),
+ new Link("Platform files", "ns-ui-widgets-category/placeholder/platform-files/platform-files-ts-page"),
+ new Link("Code-behind", "ns-ui-widgets-category/placeholder/code-behind/code-behind-ts-page")
];
-function onNavigatingTo(args) {
+export function onNavigatingTo(args) {
const page = args.object;
page.bindingContext = new ListViewLinksModel({
links: navigationLinks,
@@ -19,4 +19,4 @@ function onNavigatingTo(args) {
tsclinks: navigationLinksTsc
});
}
-exports.onNavigatingTo = onNavigatingTo;
+
diff --git a/app/ns-ui-widgets-category/placeholder/platform-files/platform-files-page.android.js b/app/ns-ui-widgets-category/placeholder/platform-files/platform-files-page.android.js
index 44fa478..2d3f20d 100644
--- a/app/ns-ui-widgets-category/placeholder/platform-files/platform-files-page.android.js
+++ b/app/ns-ui-widgets-category/placeholder/platform-files/platform-files-page.android.js
@@ -1,10 +1,10 @@
// >> placeholder-code-android
-function creatingView(args) {
+export function creatingView(args) {
const nativeView = new android.widget.TextView(args.context);
nativeView.setSingleLine(true);
nativeView.setEllipsize(android.text.TextUtils.TruncateAt.END);
nativeView.setText("Native View - Android");
args.view = nativeView;
}
-exports.creatingView = creatingView;
+
// << placeholder-code-android
diff --git a/app/ns-ui-widgets-category/placeholder/platform-files/platform-files-page.ios.js b/app/ns-ui-widgets-category/placeholder/platform-files/platform-files-page.ios.js
index f214017..9fa8ac5 100644
--- a/app/ns-ui-widgets-category/placeholder/platform-files/platform-files-page.ios.js
+++ b/app/ns-ui-widgets-category/placeholder/platform-files/platform-files-page.ios.js
@@ -1,8 +1,8 @@
// >> placeholder-code-ios
-function creatingView(args) {
+export function creatingView(args) {
const nativeView = new UILabel();
nativeView.text = "Native View - iOS";
args.view = nativeView;
}
-exports.creatingView = creatingView;
+
// << placeholder-code-ios
diff --git a/app/ns-ui-widgets-category/progress/basics/article.md b/app/ns-ui-widgets-category/progress/basics/article.md
deleted file mode 100644
index 4f57d4f..0000000
--- a/app/ns-ui-widgets-category/progress/basics/article.md
+++ /dev/null
@@ -1,5 +0,0 @@
-The example shows how to create basic progress component as well as, how to change its value property via code-behind.
-
-
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/progress/basics/basics-page.css b/app/ns-ui-widgets-category/progress/basics/basics-page.css
deleted file mode 100644
index 896a8a1..0000000
--- a/app/ns-ui-widgets-category/progress/basics/basics-page.css
+++ /dev/null
@@ -1,14 +0,0 @@
-button, label, stack-layout {
- horizontal-align: center;
-}
-
-.icon {
- font-family: 'icomoon';
-}
-
-GridLayout {
- padding: 0;
- margin-left: 0;
- margin-top: 10;
- margin-bottom: 10;
-}
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/progress/basics/basics-page.js b/app/ns-ui-widgets-category/progress/basics/basics-page.js
deleted file mode 100644
index 53630a2..0000000
--- a/app/ns-ui-widgets-category/progress/basics/basics-page.js
+++ /dev/null
@@ -1,26 +0,0 @@
-const observableModule = require("tns-core-modules/data/observable");
-// >> progress-value-change-event
-function onNavigatingTo(args) {
- const page = args.object;
- // set up the initial values for the progress components
- const vm = new observableModule.Observable();
- vm.set("progressValue", 10);
- vm.set("progressMaxValue", 100);
- setInterval(() => {
- const value = vm.get("progressValue");
- vm.set("progressValue", value + 2);
- }, 300);
- page.bindingContext = vm;
-}
-// handle value change
-function onProgressLoaded(args) {
- const sliderComponent = args.object;
- sliderComponent.on("valueChange", (pargs) => {
- console.log(`Old Value: ${pargs.oldValue}`);
- console.log(`New Value: ${pargs.value}`);
- });
-}
-
-exports.onProgressLoaded = onProgressLoaded;
-exports.onNavigatingTo = onNavigatingTo;
-// << progress-value-change-event
diff --git a/app/ns-ui-widgets-category/progress/basics/basics-ts-page.css b/app/ns-ui-widgets-category/progress/basics/basics-ts-page.css
deleted file mode 100644
index 896a8a1..0000000
--- a/app/ns-ui-widgets-category/progress/basics/basics-ts-page.css
+++ /dev/null
@@ -1,14 +0,0 @@
-button, label, stack-layout {
- horizontal-align: center;
-}
-
-.icon {
- font-family: 'icomoon';
-}
-
-GridLayout {
- padding: 0;
- margin-left: 0;
- margin-top: 10;
- margin-bottom: 10;
-}
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/progress/code-behind/article.md b/app/ns-ui-widgets-category/progress/code-behind/article.md
deleted file mode 100644
index d921af5..0000000
--- a/app/ns-ui-widgets-category/progress/code-behind/article.md
+++ /dev/null
@@ -1,6 +0,0 @@
-In the following example is shown, how to create Progress via Code-behind
-
-
-
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/progress/code-behind/code-behind-page.js b/app/ns-ui-widgets-category/progress/code-behind/code-behind-page.js
index 5557b96..358e291 100644
--- a/app/ns-ui-widgets-category/progress/code-behind/code-behind-page.js
+++ b/app/ns-ui-widgets-category/progress/code-behind/code-behind-page.js
@@ -1,16 +1,16 @@
-const observableModule = require("tns-core-modules/data/observable");
+import { Observable } from "@nativescript/core";
// >> progress-require
-const progressModule = require("tns-core-modules/ui/progress");
+import { Progress } from "@nativescript/core";
// << progress-require
// >> creating-progress-code
-function onPageLoaded(args) {
+export function onPageLoaded(args) {
const page = args.object;
- const vm = new observableModule.Observable();
+ const vm = new Observable();
const stackLayout = page.getViewById("stackLayoutId");
vm.set("prResult", 0);
// creating new Switch and binding the value property
- const progress = new progressModule.Progress();
+ const progress = new Progress();
progress.value = 0;
setInterval(() => {
progress.value += 2;
@@ -25,5 +25,5 @@ function onPageLoaded(args) {
page.bindingContext = vm;
}
-exports.onPageLoaded = onPageLoaded;
+
// << creating-progress-code
diff --git a/app/ns-ui-widgets-category/progress/code-behind/code-behind-ts-page.ts b/app/ns-ui-widgets-category/progress/code-behind/code-behind-ts-page.ts
index 42c7c43..cd38c05 100644
--- a/app/ns-ui-widgets-category/progress/code-behind/code-behind-ts-page.ts
+++ b/app/ns-ui-widgets-category/progress/code-behind/code-behind-ts-page.ts
@@ -1,8 +1,6 @@
-import { Observable } from "tns-core-modules/data/observable";
-import { Page } from "tns-core-modules/ui/page";
-import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout";
+import { Observable, Page, StackLayout } from "@nativescript/core";
// >> progress-import
-import { Progress } from "tns-core-modules/ui/progress";
+import { Progress } from "@nativescript/core";
// << progress-import
// >> creating-progress-code-ts
export function onPageLoaded(args) {
diff --git a/app/ns-ui-widgets-category/progress/end.md b/app/ns-ui-widgets-category/progress/end.md
index 68ed9ee..81d28fb 100644
--- a/app/ns-ui-widgets-category/progress/end.md
+++ b/app/ns-ui-widgets-category/progress/end.md
@@ -1,8 +1,20 @@
-**API Reference for** [Progress Class](http://docs.nativescript.org/api-reference/modules/_ui_progress_.html)
+## Properties
-**Native Component**
+| Name | Type | Description |
+|----------|---------|----------------|
+| `value` | `number` | Gets or sets a progress current value. |
+| `maxValue` | `number` | Gets or sets a progress max value. |
-| Android | iOS |
-|:-----------------------|:---------|
-| [android.widget.ProgressBar](http://developer.android.com/reference/android/widget/ProgressBar.html) (indeterminate = false) | [UIProgressView](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIProgressView_Class/) |
+## API References
+
+| Name | Type |
+|----------|---------|
+| [tns-core-modules/ui/progress](http://docs.nativescript.org/api-reference/modules/_ui_progress_.html) | `Module` |
+| [Progress](https://docs.nativescript.org/api-reference/classes/_ui_progress_.progress) | `Class` |
+
+## Native Component
+
+| Android | iOS |
+|:----------------------|:---------|
+| [android.widget.ProgressBar](http://developer.android.com/reference/android/widget/ProgressBar.html) | [UIProgressView](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIProgressView_Class/) |
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/progress/metadata.md b/app/ns-ui-widgets-category/progress/metadata.md
index f4245d3..d535c04 100644
--- a/app/ns-ui-widgets-category/progress/metadata.md
+++ b/app/ns-ui-widgets-category/progress/metadata.md
@@ -4,3 +4,4 @@ description: The Progress class provides an abstraction over the iOS's UIProgres
position: 340
slug: progress
---
+example-order: usage, styling, tips-and-tricks
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/progress/overview.md b/app/ns-ui-widgets-category/progress/overview.md
index 34dab43..63e8ce8 100644
--- a/app/ns-ui-widgets-category/progress/overview.md
+++ b/app/ns-ui-widgets-category/progress/overview.md
@@ -1,5 +1,2 @@
-The Progress widget is a visual bar indicator of a progress in a operation.
-It shows a bar representing the current progress of the operation.
-
-
-
\ No newline at end of file
+The `Progress` widget is a visual bar indicator of a progress in a operation.
+It shows a bar representing the current progress of the operation.
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/progress/progress-page.js b/app/ns-ui-widgets-category/progress/progress-page.js
index 1d2dd6b..47e833f 100644
--- a/app/ns-ui-widgets-category/progress/progress-page.js
+++ b/app/ns-ui-widgets-category/progress/progress-page.js
@@ -1,15 +1,17 @@
-const ListViewLinksModel = require("../../links-view-model");
-const link = require("../../link");
+import ListViewLinksModel from "../../links-view-model";
+import Link from "../../link";
const navigationLinks = [
- new link("Basics", "ns-ui-widgets-category/progress/basics/basics-page"),
- new link("Code Behind", "ns-ui-widgets-category/progress/code-behind/code-behind-page"),
- new link("Style", "ns-ui-widgets-category/progress/style/style-page")
+ new Link("Usage", "ns-ui-widgets-category/progress/usage/usage-page"),
+ new Link("Tips and tricks", "ns-ui-widgets-category/progress/tips-and-tricks/tips-and-tricks-page"),
+ new Link("Code Behind", "ns-ui-widgets-category/progress/code-behind/code-behind-page"),
+ new Link("Style", "ns-ui-widgets-category/progress/styling/styling-page")
];
const navigationLinksTsc = [
- new link("Basics", "ns-ui-widgets-category/progress/basics/basics-ts-page"),
- new link("Code Behind", "ns-ui-widgets-category/progress/code-behind/code-behind-ts-page")
+ new Link("Usage", "ns-ui-widgets-category/progress/usage/usage-ts-page"),
+ new Link("Tips and tricks", "ns-ui-widgets-category/progress/tips-and-tricks/tips-and-tricks-ts-page"),
+ new Link("Code Behind", "ns-ui-widgets-category/progress/code-behind/code-behind-ts-page")
];
-function onNavigatingTo(args) {
+export function onNavigatingTo(args) {
const page = args.object;
page.bindingContext = new ListViewLinksModel({
links: navigationLinks,
@@ -18,4 +20,4 @@ function onNavigatingTo(args) {
tsclinks: navigationLinksTsc
});
}
-exports.onNavigatingTo = onNavigatingTo;
+
diff --git a/app/ns-ui-widgets-category/progress/style/article.md b/app/ns-ui-widgets-category/progress/style/article.md
deleted file mode 100644
index d6aa613..0000000
--- a/app/ns-ui-widgets-category/progress/style/article.md
+++ /dev/null
@@ -1,4 +0,0 @@
-The example shows how to style progress component.
-
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/progress/style/style-page.css b/app/ns-ui-widgets-category/progress/style/style-page.css
deleted file mode 100644
index 5ac556b..0000000
--- a/app/ns-ui-widgets-category/progress/style/style-page.css
+++ /dev/null
@@ -1,21 +0,0 @@
-button, label, stack-layout {
- horizontal-align: center;
-}
-
-.icon {
- font-family: 'icomoon';
-}
-
-GridLayout {
- padding: 0;
- margin-left: 0;
- margin-top: 10;
- margin-bottom: 10;
-}
-/* >> progress-style-css */
-Progress{
- color: cyan;
- background-color: green;
-
-}
-/* << progress-style-css */
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/progress/style/style-page.js b/app/ns-ui-widgets-category/progress/style/style-page.js
deleted file mode 100644
index 01c2d29..0000000
--- a/app/ns-ui-widgets-category/progress/style/style-page.js
+++ /dev/null
@@ -1,23 +0,0 @@
-const observableModule = require("tns-core-modules/data/observable");
-function onNavigatingTo(args) {
- const page = args.object;
- const vm = new observableModule.Observable();
- vm.set("progressValue", 10);
- vm.set("progressMaxValue", 100);
- setInterval(() => {
- const value = vm.get("progressValue");
- vm.set("progressValue", value + 2);
- }, 300);
- page.bindingContext = vm;
-}
-
-function onProgressLoaded(args) {
- const sliderComponent = args.object;
- sliderComponent.on("valueChange", (pargs) => {
- console.log(`Old Value: ${pargs.oldValue}`);
- console.log(`New Value: ${pargs.value}`);
- });
-}
-
-exports.onProgressLoaded = onProgressLoaded;
-exports.onNavigatingTo = onNavigatingTo;
diff --git a/app/ns-ui-widgets-category/progress/style/style-page.xml b/app/ns-ui-widgets-category/progress/style/style-page.xml
deleted file mode 100644
index 2a1c554..0000000
--- a/app/ns-ui-widgets-category/progress/style/style-page.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/formatted-string/basics/basics-page.js b/app/ns-ui-widgets-category/progress/styling/article.md
similarity index 100%
rename from app/ns-ui-widgets-category/formatted-string/basics/basics-page.js
rename to app/ns-ui-widgets-category/progress/styling/article.md
diff --git a/app/ns-ui-widgets-category/progress/styling/styling-page.css b/app/ns-ui-widgets-category/progress/styling/styling-page.css
new file mode 100644
index 0000000..d41fee9
--- /dev/null
+++ b/app/ns-ui-widgets-category/progress/styling/styling-page.css
@@ -0,0 +1,7 @@
+/* >> progress-style-css */
+Progress{
+ color: cyan;
+ background-color: green;
+
+}
+/* << progress-style-css */
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/progress/styling/styling-page.xml b/app/ns-ui-widgets-category/progress/styling/styling-page.xml
new file mode 100644
index 0000000..abb53bf
--- /dev/null
+++ b/app/ns-ui-widgets-category/progress/styling/styling-page.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/progress/tips-and-tricks/article.md b/app/ns-ui-widgets-category/progress/tips-and-tricks/article.md
new file mode 100644
index 0000000..3b94464
--- /dev/null
+++ b/app/ns-ui-widgets-category/progress/tips-and-tricks/article.md
@@ -0,0 +1,8 @@
+
+
+
+
+### Creating Progress component via Code-Behind
+
+
+
\ No newline at end of file
diff --git a/app/ns-ui-widgets-category/progress/tips-and-tricks/tips-and-tricks-page.js b/app/ns-ui-widgets-category/progress/tips-and-tricks/tips-and-tricks-page.js
new file mode 100644
index 0000000..3dc1b35
--- /dev/null
+++ b/app/ns-ui-widgets-category/progress/tips-and-tricks/tips-and-tricks-page.js
@@ -0,0 +1,26 @@
+// >> progress-value-change-event
+import { Observable } from "@nativescript/core";
+
+export function onNavigatingTo(args) {
+ const page = args.object;
+ const vm = new Observable();
+ vm.set("progressValue", 10); // Initial value
+ vm.set("progressMaxValue", 100); // Maximum value
+ // Forcing progress value change (for demonstration)
+ setInterval(() => {
+ const value = vm.get("progressValue");
+ vm.set("progressValue", value + 2);
+ }, 300);
+ page.bindingContext = vm;
+}
+export function onProgressLoaded(args) {
+ const myProgressBar = args.object;
+ myProgressBar.on("valueChange", (pargs) => {
+ // TIP: args (for valueChange of Progress) is extending EventData with oldValue & value parameters
+ console.log(`Old Value: ${pargs.oldValue}`);
+ console.log(`New Value: ${pargs.value}`);
+ });
+}
+
+
+// << progress-value-change-event
diff --git a/app/ns-ui-widgets-category/progress/basics/basics-page.xml b/app/ns-ui-widgets-category/progress/tips-and-tricks/tips-and-tricks-page.xml
similarity index 73%
rename from app/ns-ui-widgets-category/progress/basics/basics-page.xml
rename to app/ns-ui-widgets-category/progress/tips-and-tricks/tips-and-tricks-page.xml
index 85d28ef..ede6997 100644
--- a/app/ns-ui-widgets-category/progress/basics/basics-page.xml
+++ b/app/ns-ui-widgets-category/progress/tips-and-tricks/tips-and-tricks-page.xml
@@ -4,8 +4,8 @@
-
-
+
+
diff --git a/app/ns-ui-widgets-category/progress/basics/basics-ts-page.ts b/app/ns-ui-widgets-category/progress/tips-and-tricks/tips-and-tricks-ts-page.ts
similarity index 51%
rename from app/ns-ui-widgets-category/progress/basics/basics-ts-page.ts
rename to app/ns-ui-widgets-category/progress/tips-and-tricks/tips-and-tricks-ts-page.ts
index 2695246..be11990 100644
--- a/app/ns-ui-widgets-category/progress/basics/basics-ts-page.ts
+++ b/app/ns-ui-widgets-category/progress/tips-and-tricks/tips-and-tricks-ts-page.ts
@@ -1,23 +1,22 @@
-import { Observable, PropertyChangeData } from "tns-core-modules/data/observable";
-import { Page } from "tns-core-modules/ui/page";
-import { Progress } from "tns-core-modules/ui/progress";
// >> progress-value-change-event-ts
+import { Observable, Page, Progress, PropertyChangeData } from "@nativescript/core";
+
export function onNavigatingTo(args) {
const page: Page = args.object;
- // set up the initial values for the progress components
const vm = new Observable();
- vm.set("progressValue", 10);
- vm.set("progressMaxValue", 100);
+ vm.set("progressValue", 10); // Initial value
+ vm.set("progressMaxValue", 100); // Maximum value
+ // Forcing progress value change (for demonstration)
setInterval(() => {
const value = vm.get("progressValue");
vm.set("progressValue", value + 2);
}, 300);
page.bindingContext = vm;
}
-// handle value change
export function onProgressLoaded(args) {
- const sliderComponent: Progress =