Skip to content

Instantly share code, notes, and snippets.

@Falconiere
Last active March 8, 2020 18:41
Show Gist options
  • Save Falconiere/a2c9d06037d6c0ba4e9d59bfdf66c3c6 to your computer and use it in GitHub Desktop.
Save Falconiere/a2c9d06037d6c0ba4e9d59bfdf66c3c6 to your computer and use it in GitHub Desktop.
This my hello world with material bottom in ReactNative
// libraries
import React from 'react'
import { View, Text } from 'react-native'
import { NavigationContainer } from '@react-navigation/native'
import { createMaterialBottomTabNavigator } from '@react-navigation/material-bottom-tabs'
import Icon from 'react-native-vector-icons/FontAwesome5'
const Container = ({ children }) => (
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
{children}
</View>
)
const Home = () => (
<Container>
<Text>Home Page</Text>
</Container>
)
const Search = () => (
<Container>
<Text>Search Page</Text>
</Container>
)
const YourLibrary = () => (
<Container>
<Text>YourLibrary Page</Text>
</Container>
)
const { Navigator, Screen } = createMaterialBottomTabNavigator()
export default function App() {
return (
<NavigationContainer>
<Navigator barStyle={{ backgroundColor: '#222' }}>
<Screen
name="Home"
component={Home}
options={{
tabBarIcon: ({ color }) => (
<Icon name="home" color={color} size={20} />
)
}}
/>
<Screen
name="Search"
component={Search}
options={{
tabBarIcon: ({ color }) => (
<Icon name="search" color={color} size={20} />
)
}}
/>
<Screen
name="YourLibrary"
component={YourLibrary}
options={{
tabBarIcon: ({ color }) => (
<Icon name="book" color={color} size={20} />
)
}}
/>
</Navigator>
</NavigationContainer>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment