@nativescript-community/ui-bottom-navigation
v1.0.0
Published
BottomNavigation: tabs with a bottom bar and content. Material on Android, native UITabBarController on iOS.
Readme
| iOS | Android | | --- | --- | | | |
Table of Contents
| Android | iOS |
|---|---|
| NavigationBarView + ViewPager | UITabBarController |
Installation
npm install @nativescript-community/ui-bottom-navigationThe Android components use Material 3: see the repository README for the theme.
Usage
<BottomNavigation selectedIndex="0">
<TabStrip>
<TabStripItem><Label text="Home" /><Image src="sys://house" /></TabStripItem>
<TabStripItem><Label text="Search" /><Image src="sys://magnifyingglass" /></TabStripItem>
</TabStrip>
<TabContentItem><GridLayout><Label text="Home" /></GridLayout></TabContentItem>
<TabContentItem><GridLayout><Label text="Search" /></GridLayout></TabContentItem>
</BottomNavigation>API
Same API as the NativeScript BottomNavigation (selectedIndex, selectedIndexChanged, TabStrip, TabStripItem, TabContentItem).
TabStrip, TabStripItem and TabContentItem come from @nativescript-community/ui-core-tabs and must be registered too in svelte-native (uitabstrip, uitabstripitem, uitabcontentitem).
TabStripItem labels support spans (formattedText).
iOS 26 features
The tab bar of iOS 26 minimizes on scroll, can host an accessory and a search tab. They are ignored on Android and, for the accessory and the minimize behavior, before iOS 26.
<BottomNavigation minimizeBehavior="onScrollDown" searchTab="true" searchHint="Search" search="onSearch" searchSubmit="onSubmit">
<TabStrip>...</TabStrip>
<TabContentItem>...</TabContentItem>
<!-- the results of the search tab -->
<BottomSearchContent>
<StackLayout>...</StackLayout>
</BottomSearchContent>
<!-- a view above the tab bar (inline with it when it is minimized), any NativeScript view -->
<BottomAccessory>
<GridLayout columns="*,auto">...</GridLayout>
</BottomAccessory>
</BottomNavigation>| Property | |
|---|---|
| minimizeBehavior | automatic, never, onScrollDown, onScrollUp: the content must scroll (a ScrollView, a ListView, a CollectionView...) |
| accessory / <BottomAccessory> | a view above the tab bar. It stays interactive |
| searchTab, searchHint | iOS 18+: adds a search tab at the end. On iOS 26 it is a separate glass button which expands to a search field in the bar |
| <BottomSearchContent> | the content of the search tab (the results) |
| events search, searchSubmit (event.text) | the text changed, the keyboard search key |
In svelte-native register uibottomaccessory and uibottomsearchcontent (BottomAccessory and BottomSearchContent are exported by the package).
Demos and Development
Repo Setup
The repo uses submodules. If you did not clone with --recursive then you need to call
git submodule update --initThe package manager used to install and link dependencies must be pnpm or yarn. npm wont work.
To develop and test:
if you use yarn then run yarn
if you use pnpm then run pnpm i
Interactive Menu:
To start the interactive menu, run npm start (or yarn start or pnpm start). This will list all of the commonly used scripts.
Build
npm run build.allWARNING: it seems yarn build.all wont always work (not finding binaries in node_modules/.bin) which is why the doc explicitly uses npm run
Demos
npm run demo.[ng|react|svelte|vue].[ios|android]
npm run demo.svelte.ios # ExampleDemo setup is a bit special in the sense that if you want to modify/add demos you dont work directly in demo-[ng|react|svelte|vue]
Instead you work in demo-snippets/[ng|react|svelte|vue]
You can start from the install.ts of each flavor to see how to register new demos
Contributing
Update repo
You can update the repo files quite easily
First update the submodules
npm run updateThen commit the changes Then update common files
npm run syncThen you can run yarn|pnpm, commit changed files if any
Update readme
npm run readmeUpdate doc
npm run docPublish
The publishing is completely handled by lerna (you can add -- --bump major to force a major release)
Simply run
npm run publishmodifying submodules
The repo uses https:// for submodules which means you won't be able to push directly into the submodules.
One easy solution is t modify ~/.gitconfig and add
[url "ssh://[email protected]/"]
pushInsteadOf = https://github.com/Questions
If you have any questions/issues/comments please feel free to create an issue or start a conversation in the NativeScript Community Discord.
