Skip to content

Commit b4d350a

Browse files
committed
Begin Frame -> Page setup
1 parent 11a9a63 commit b4d350a

File tree

4 files changed

+65
-1
lines changed

4 files changed

+65
-1
lines changed

demo-react/src/app.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@ purpose of the file is to pass control to the app’s first module.
1010
*/
1111

1212
import * as ReactNativeScript from 'react-nativescript';
13-
import { ExampleTabs as AppContainer } from './components/HomeScreen';
1413
import { registerTabs } from '@nativescript-community/ui-material-tabs/react';
14+
import { registerBottomNavigation } from '@nativescript-community/ui-material-bottom-navigation/react';
15+
import { AppContainer } from './components/AppContainer';
16+
// import { ExampleTabs as AppContainer } from './components/TabsScreen';
17+
// import { ExampleBottomNavigation as AppContainer } from './components/BottomNavigationScreen';
1518

1619
registerTabs({ enableDebugLogging: true });
20+
registerBottomNavigation({ enableDebugLogging: true });
1721
ReactNativeScript.start(React.createElement(AppContainer, {}, null));
1822

1923
/*
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import * as React from 'react';
2+
import { ListView } from 'react-nativescript';
3+
4+
export function AppContainer() {
5+
return (
6+
<frame>
7+
<page>
8+
<label>Hello</label>
9+
</page>
10+
</frame>
11+
);
12+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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://&#xf015;" className="fas" />
19+
</tabStripItem>
20+
<tabStripItem nodeRole="items">
21+
<label nodeRole="label">Account</label>
22+
<image nodeRole="image" src="font://&#xf007;" className="fas" />
23+
</tabStripItem>
24+
<tabStripItem nodeRole="items">
25+
<label nodeRole="label">Search</label>
26+
<image nodeRole="image" src="font://&#xf00e;" 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

Comments
 (0)