-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add embedded stack example (#126)
- Loading branch information
1 parent
13c307c
commit 63fa844
Showing
5 changed files
with
125 additions
and
0 deletions.
There are no files selected for viewing
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
104 changes: 104 additions & 0 deletions
104
example/src/Examples/NativeBottomTabsEmbeddedStacks.tsx
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
import { Article } from '../Screens/Article'; | ||
import { Albums } from '../Screens/Albums'; | ||
import { Contacts } from '../Screens/Contacts'; | ||
import { Chat } from '../Screens/Chat'; | ||
import createNativeBottomTabNavigator from '../../../src/react-navigation/navigators/createNativeBottomTabNavigator'; | ||
import { createNativeStackNavigator } from '@react-navigation/native-stack'; | ||
|
||
const headerOptions = { | ||
headerShown: true, | ||
headerLargeTitle: true, | ||
}; | ||
|
||
const Tab = createNativeBottomTabNavigator(); | ||
|
||
const ArticleStack = createNativeStackNavigator(); | ||
const AlbumsStack = createNativeStackNavigator(); | ||
const ContactsStack = createNativeStackNavigator(); | ||
const ChatStack = createNativeStackNavigator(); | ||
|
||
function ArticleStackScreen() { | ||
return ( | ||
<ArticleStack.Navigator> | ||
<ArticleStack.Screen | ||
options={{ ...headerOptions }} | ||
name="ArticleScreen" | ||
component={Article} | ||
/> | ||
</ArticleStack.Navigator> | ||
); | ||
} | ||
|
||
function AlbumsStackScreen() { | ||
return ( | ||
<AlbumsStack.Navigator> | ||
<AlbumsStack.Screen | ||
options={{ ...headerOptions }} | ||
name="AlbumsScreen" | ||
component={Albums} | ||
/> | ||
</AlbumsStack.Navigator> | ||
); | ||
} | ||
|
||
function ContactsStackScreen() { | ||
return ( | ||
<ContactsStack.Navigator> | ||
<ContactsStack.Screen | ||
options={{ ...headerOptions }} | ||
name="ContactsScreen" | ||
component={Contacts} | ||
/> | ||
</ContactsStack.Navigator> | ||
); | ||
} | ||
|
||
function ChatStackScreen() { | ||
return ( | ||
<ChatStack.Navigator> | ||
<ChatStack.Screen | ||
options={{ ...headerOptions }} | ||
name="ChatScreen" | ||
component={Chat} | ||
/> | ||
</ChatStack.Navigator> | ||
); | ||
} | ||
|
||
function NativeBottomTabsEmbeddedStacks() { | ||
return ( | ||
<Tab.Navigator ignoresTopSafeArea> | ||
<Tab.Screen | ||
name="Article" | ||
component={ArticleStackScreen} | ||
options={{ | ||
tabBarBadge: '10', | ||
tabBarIcon: () => require('../../assets/icons/article_dark.png'), | ||
}} | ||
/> | ||
<Tab.Screen | ||
name="Albums" | ||
component={AlbumsStackScreen} | ||
options={{ | ||
tabBarIcon: () => require('../../assets/icons/grid_dark.png'), | ||
}} | ||
/> | ||
<Tab.Screen | ||
name="Contacts" | ||
component={ContactsStackScreen} | ||
options={{ | ||
tabBarIcon: () => require('../../assets/icons/person_dark.png'), | ||
}} | ||
/> | ||
<Tab.Screen | ||
name="Chat" | ||
component={ChatStackScreen} | ||
options={{ | ||
tabBarIcon: () => require('../../assets/icons/chat_dark.png'), | ||
}} | ||
/> | ||
</Tab.Navigator> | ||
); | ||
} | ||
|
||
export default NativeBottomTabsEmbeddedStacks; |
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
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
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