Last active
March 24, 2020 09:22
-
-
Save t1amat9409/80813882d4859df8e6f42e7618c88bb6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Tabs, TabStrip, TabStripItem, TabContentItem } from '@nativescript/core/ui/tabs'; //Import | |
class AppContainer extends React.Component<Props, State> { | |
private readonly pageRef: React.RefObject<Page> = React.createRef<Page>(); | |
private readonly tabs = new Tabs(); | |
componentDidMount() { | |
const frame: Frame = this.mainFrame.current!; | |
frame.navigate({ | |
create: () => { | |
const page: Page = this.pageRef.current!; | |
const {tabs} = this; | |
const tabStrip = new TabStrip(); | |
//TabStipItems | |
const tabStripItem1 = new TabStripItem(); | |
tabStripItem1.title = "Timeline"; | |
const tabStripItem2 = new TabStripItem(); | |
tabStripItem2.title = "Videos"; | |
const tabStripItem3 = new TabStripItem(); | |
tabStripItem3.title = "Photos"; | |
tabStrip.items = [tabStripItem1, tabStripItem2, tabStripItem3]; | |
//Tab Contents | |
const tabContentItem1 = new TabContentItem(); | |
const tabContentItem1Content = new StackLayout(); | |
tabContentItem1.content = tabContentItem2Content; | |
const tabContentItem2 = new TabContentItem(); | |
const tabContentItem2Content = new StackLayout(); | |
tabContentItem2.content = tabContentItem2Content; | |
const tabContentItem3 = new TabContentItem(); | |
const tabContentItem3Content = new StackLayout(); | |
tabContentItem3.content = tabContentItem2Content; | |
tabs.items = [ | |
tabContentItem1, | |
tabContentItem2, | |
tabContentItem3 | |
]; | |
tabs.tabStrip = tabStrip; | |
tabs.id = 'tabs'; | |
page.content = tabs; | |
tabs.selectedIndex = 0; | |
return page; | |
} | |
}); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment