Skip to content

Commit 97f3a2e

Browse files
committed
docs: article about BottomNavigation init
1 parent c9b4674 commit 97f3a2e

30 files changed

+83
-7
lines changed
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading

app/main-page.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ const navigationLinks = [
5050
new link("ImageSource", "ns-framework-modules-category/image-source/image-source-page"),
5151
new link("File System", "ns-framework-modules-category/file-system/file-system-page"),
5252
new link("Modal view", "ns-ui-category/modal-view/modal-view-examples-page"),
53-
new link("XML Parser", "ns-framework-modules-category/xml-parser/xml-parser-page")
53+
new link("XML Parser", "ns-framework-modules-category/xml-parser/xml-parser-page"),
54+
new link("BottomNavigation", "ns-ui-widgets-category/bottom-navigation/bottom-navigation-page")
5455
];
5556

5657
function onNavigatingTo(args) {
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
The `BottomNavigation` component contains two sub-components:
2+
- The `TabStrip` which defines and rendres the bottom bar and its `TabStripItem` components.
3+
- `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.
4+
5+
<snippet id='bottom-navigation-basics-xml'/>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
function onNavigatingTo(args) {
2+
const page = args.object;
3+
}
4+
exports.onNavigatingTo = onNavigatingTo;
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<Page>
2+
<!-- >> bottom-navigation-basics-xml -->
3+
<BottomNavigation selectedIndex="1">
4+
5+
<!-- The bottom tab UI is created via TabStrip (the containier) and TabStripItem (for each tab)-->
6+
<TabStrip>
7+
<TabStripItem title="Home" iconSource="res://baseline_home_black_18pt"></TabStripItem>
8+
<TabStripItem title="Account" iconSource="res://baseline_account_balance_black_18pt"></TabStripItem>
9+
<TabStripItem title="Search" iconSource="res://baseline_search_black_18pt"></TabStripItem>
10+
</TabStrip>
11+
12+
<!-- The number of TabContentItem components should corespond to the number of TabStripItem components -->
13+
<TabContentItem>
14+
<GridLayout>
15+
<Label text="Home Page" class="h2 text-center"></Label>
16+
</GridLayout>
17+
</TabContentItem>
18+
<TabContentItem>
19+
<GridLayout>
20+
<Label text="Account Page" class="h2 text-center"></Label>
21+
</GridLayout>
22+
</TabContentItem>
23+
<TabContentItem>
24+
<GridLayout>
25+
<Label text="Search Page" class="h2 text-center"></Label>
26+
</GridLayout>
27+
</TabContentItem>
28+
29+
</BottomNavigation>
30+
<!-- << bottom-navigation-basics-xml -->
31+
</Page>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export function onNavigatingTo(args) {
2+
const page = args.object;
3+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<Page>
2+
<BottomNavigation selectedIndex="1">
3+
4+
<!-- The bottom tab UI is created via TabStrip (the containier) and TabStripItem (for each tab)-->
5+
<TabStrip>
6+
<TabStripItem title="Home" iconSource="res://baseline_home_black_18pt"></TabStripItem>
7+
<TabStripItem title="Account" iconSource="res://baseline_account_balance_black_18pt"></TabStripItem>
8+
<TabStripItem title="Search" iconSource="res://baseline_search_black_18pt"></TabStripItem>
9+
</TabStrip>
10+
11+
<!-- The number of TabContentItem components should corespond to the number of TabStripItem components -->
12+
<TabContentItem>
13+
<GridLayout>
14+
<Label text="Home Page" class="h2 text-center"></Label>
15+
</GridLayout>
16+
</TabContentItem>
17+
<TabContentItem>
18+
<GridLayout>
19+
<Label text="Account Page" class="h2 text-center"></Label>
20+
</GridLayout>
21+
</TabContentItem>
22+
<TabContentItem>
23+
<GridLayout>
24+
<Label text="Search Page" class="h2 text-center"></Label>
25+
</GridLayout>
26+
</TabContentItem>
27+
28+
</BottomNavigation>
29+
</Page>

app/ns-ui-widgets-category/bottom-navigation/bottom-navigation-page.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const navigationLinks = [
88
// new link("Navigation", "ns-ui-widgets-category/tab-view/navigation/navigation")
99
];
1010
const navigationLinksTsc = [
11-
// new link("Code Behind", "ns-ui-widgets-category/tab-view/code-behind/code-behind-ts-page"),
11+
new link("Basics", "ns-ui-widgets-category/bottom-navigation/basics/basics-ts-page")
1212
// new link("Navigation", "ns-ui-widgets-category/tab-view/navigation/navigation-ts-page")
1313
];
1414
function onNavigatingTo(args) {
@@ -17,7 +17,7 @@ function onNavigatingTo(args) {
1717
page.bindingContext = new ListViewLinksModel({
1818
links: navigationLinks,
1919
actionBarTitle: args.context.title,
20-
showTypeScriptExamples:false,
20+
showTypeScriptExamples: false,
2121
tsclinks: navigationLinksTsc
2222
});
2323
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: BottomNavigation
33
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.
4-
position: 190
4+
position: 416
55
slug: bottom-navigation
66
---

app/ns-ui-widgets-category/bottom-navigation/overview.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11

2+
23
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 navigaiton 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).
34

5+
> **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.
6+
47
Component Primary Objectives:
58
- Used for High Level navigation.
6-
- Greater UX a structure with 3 to 5 different options.
9+
- Good for UX structure with 3 to 5 different options.
710

811
Limitations
9-
- No support for navigation transitions.
12+
- No navigation transitions.
1013
- No navigation gestures (e.g., swipe to navigate).
11-
- No support for content preloading.
14+
- No content preloading.
1215

1316

1417

0 commit comments

Comments
 (0)