|
| 1 | +import * as React from 'react'; |
| 2 | + |
| 3 | +export function ExampleBottomNavigation() { |
| 4 | + const [selectedIndex, setSelectedIndex] = React.useState(0); |
| 5 | + |
| 6 | + return ( |
| 7 | + <bottomNavigation |
| 8 | + selectedIndex={selectedIndex} |
| 9 | + onSelectedIndexChanged={(args) => { |
| 10 | + setSelectedIndex(args.newIndex); |
| 11 | + }} |
| 12 | + style={{ backgroundColor: 'orange' }} |
| 13 | + > |
| 14 | + {/* The bottomTab UI is created via tabStrip (the container) and tabStripItem (for each tab) */} |
| 15 | + <tabStrip nodeRole="tabStrip" style={{ backgroundColor: 'red' }}> |
| 16 | + <tabStripItem nodeRole="items"> |
| 17 | + <label nodeRole="label">Home</label> |
| 18 | + <image nodeRole="image" src="font://" className="fas" /> |
| 19 | + </tabStripItem> |
| 20 | + <tabStripItem nodeRole="items"> |
| 21 | + <label nodeRole="label">Account</label> |
| 22 | + <image nodeRole="image" src="font://" className="fas" /> |
| 23 | + </tabStripItem> |
| 24 | + <tabStripItem nodeRole="items"> |
| 25 | + <label nodeRole="label">Search</label> |
| 26 | + <image nodeRole="image" src="font://" className="fas" /> |
| 27 | + </tabStripItem> |
| 28 | + </tabStrip> |
| 29 | + |
| 30 | + {/* The number of tabContentItem components should corespond to the number of TabStripItem components */} |
| 31 | + <tabContentItem nodeRole="items"> |
| 32 | + <gridLayout style={{ backgroundColor: 'blue' }}> |
| 33 | + <label style={{ color: 'white' }}>Home Page</label> |
| 34 | + </gridLayout> |
| 35 | + </tabContentItem> |
| 36 | + <tabContentItem nodeRole="items"> |
| 37 | + <gridLayout style={{ backgroundColor: 'cyan' }}> |
| 38 | + <label style={{ color: 'black' }}>Account Page</label> |
| 39 | + </gridLayout> |
| 40 | + </tabContentItem> |
| 41 | + <tabContentItem nodeRole="items"> |
| 42 | + <gridLayout style={{ backgroundColor: 'magenta' }}> |
| 43 | + <label style={{ color: 'black' }}>Search Page</label> |
| 44 | + </gridLayout> |
| 45 | + </tabContentItem> |
| 46 | + </bottomNavigation> |
| 47 | + ); |
| 48 | +} |
0 commit comments