From a316e53d547b1de797e6b7cd36fb07d1f37d2482 Mon Sep 17 00:00:00 2001 From: Nikolay Tsonev Date: Thu, 5 Apr 2018 17:35:37 +0300 Subject: [PATCH] new tabview examples (#5628) * new tabview exmples * tabs limit example * minor code snippet edits --- tests/app/ui/tab-view/tab-view.md | 129 ++++++++++++++++++++---------- 1 file changed, 88 insertions(+), 41 deletions(-) diff --git a/tests/app/ui/tab-view/tab-view.md b/tests/app/ui/tab-view/tab-view.md index e2e829955..f21ab1292 100644 --- a/tests/app/ui/tab-view/tab-view.md +++ b/tests/app/ui/tab-view/tab-view.md @@ -6,22 +6,27 @@ description: "Examples for using TabView" previous_url: /ApiReference/ui/tab-view/HOW-TO --- # TabView +The TabView is a component, which allows to navigate between different views. The general behaviour of the TabView component is to load its items on demand. This means that every TabViewItem view will be loaded when it is shown and will be unloaded when it disappears. Respectively loaded and unloaded events will be fired while showing or hiding each view. However, there are some specifics for each platform(iOS and Android), which are described in the notes below. + +> Note (iOS specific): `UITabBarController` is used in the implementation, which means that only one `TabViewItem` can be shown at a given time and only one needs to be loaded. When the user selects a new `TabViewItem`, we load the new item and unload the previous one. + +> Note (Android specific): In the Android implementation is used `ViewPager` controller, which allows using the `swipe` gesture to navigate to the next or previous tab. This means that only one `TabViewItem` can be shown, but multiple `TabViewItems` need to be loaded. Otherwise, after left or right swipe, you will not see the `TabViewItem`'s contents, after the swiping. By default, the ViewPager controller will pre-load one `TabViewItem` on the left and on on the right. Regarding that, if one of the items is already pre-loaded, it will not be loaded again. In the Android, we have exposed a property called `androidOffscreenTabLimit`, which allow specifying, how many components should be pre-load on the left and right (if you are setting up `androidOffscreenTabLimit` to 0, the Android TabView will match to the iOS TabView). + +The iOS and Android UX guidelines regarding the Tab controls differ greatly. The difference is described in the below points: + +* The iOS tabs have their tab bar, which will be displayed always on the bottom and does not allow swipe gesture for changing tabs. +* The Android tabs are on top and will enable the swipe navigation between the tabs. +* For Android we have `androidTabsPosition` property which has two options `top`(default value) and `bottom`. Setting up this property to `bottom` allows mimicking Bottom Tab Navigation control(provided by android support library v25 release). Setting the Tabs at the bottom will disable the swipe navigation and the items preloading functionality. + ### Declaring the TabView in xml. ``` XML - - - - + // ... - - + // ... - ``` @@ -37,11 +42,9 @@ Using a TabView requires the "ui/tab-view" module. {%snippet article-tabview-selectedIndexChanged%} ### Using selectedIndexChanged event from xml ```XML - - - ... - - + + ... + ``` ```TypeScript export function onSelectedIndexChanged(args) {...} @@ -57,37 +60,81 @@ For the TabView component could be set three different styling properties * `textTransform` (coresponding CSS property `text-transform`) - setting up textTransform individual for every `TabViewItem`. Value options: `capitalize`, `lowercase`, `none`, `uppercase`. ```XML - - - - - - - - - - - + + + + + + ``` * `androidSelectedTabHighlightColor`android specific property (coresponding CSS property `android-selected-tab-highlight-color`) - setup underline color of the `Tab`s in Android. ```XML - - - - - - - - - - - -``` \ No newline at end of file + + + + + +``` + +## Tabs Limit Android Secific + +Setting up the limit of the tabs, which should be pre-loaded on the left and right sides in Android. +```XML + + + + + + + + + + + +``` + +--- + +## Tabs Position Android Secific + +Setting up the bottom Tabs position for Android. +```XML + + + + + + + + + + + + +```