Advertisement
Guest User

Untitled

a guest
Mar 29th, 2020
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import * as React from 'react';
  2. import { Text, View } from 'react-native';
  3. import { NavigationContainer } from '@react-navigation/native';
  4. import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
  5. import Icon from 'react-native-vector-icons/FontAwesome';
  6.  
  7. import Position from './src/components/Map';
  8. import MapView from 'react-native-maps';
  9.  
  10. const initialLocation = {
  11.   latitude: -7.288787,
  12.   longitude: 112.814824,
  13.   latitudeDelta: 0.00922,
  14.   longitudeDelta: 0.00421
  15. }
  16.  
  17. function Feed() {
  18.   return (
  19.     <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
  20.       <Text>Feed!</Text>
  21.     </View>
  22.   );
  23. }
  24.  
  25. function Profile() {
  26.   return (
  27.     <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
  28.       <Text>Profile!</Text>
  29.     </View>
  30.   );
  31. }
  32.  
  33. function Map() {
  34.   return (
  35.     <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
  36.       <MapView
  37.         initialRegion={initialLocation}
  38.       />
  39.     </View>
  40.   );
  41. }
  42.  
  43. function Transaction() {
  44.   return (
  45.     <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
  46.       <Text>Transaction!</Text>
  47.     </View>
  48.   )
  49. }
  50.  
  51. const Tab = createBottomTabNavigator();
  52.  
  53. function MyTabs() {
  54.   return (
  55.     <Tab.Navigator
  56.       initialRouteName="Feed"
  57.       tabBarOptions={{
  58.         activeTintColor: '#e91e63',
  59.       }}
  60.     >
  61.       <Tab.Screen
  62.         name="Feed"
  63.         component={Feed}
  64.         options={{
  65.           tabBarLabel: 'Home',
  66.           tabBarIcon: ({ color, size }) => (
  67.             <Icon name="home" color={color} size={size} />
  68.           ),
  69.         }}
  70.       />
  71.       <Tab.Screen
  72.         name="Map"
  73.         component={Map}
  74.         options={{
  75.           tabBarLabel: 'Park',
  76.           tabBarIcon: ({ color, size }) => (
  77.             <Icon name="map-marker" color={color} size={size} />
  78.           ),
  79.         }}
  80.       />
  81.       <Tab.Screen
  82.         name="Transaction"
  83.         component={Transaction}
  84.         options={{
  85.           tabBarLabel: 'Transaction',
  86.           tabBarIcon: ({ color, size }) => (
  87.             <Icon name="camera" color={color} size={size} />
  88.           ),
  89.         }}
  90.       />
  91.       <Tab.Screen
  92.         name="Profile"
  93.         component={Profile}
  94.         options={{
  95.           tabBarLabel: 'Profile',
  96.           tabBarIcon: ({ color, size }) => (
  97.             <Icon name="user" color={color} size={size} />
  98.           ),
  99.         }}
  100.       />
  101.     </Tab.Navigator>
  102.   );
  103. }
  104.  
  105. export default function App() {
  106.   return (
  107.     <NavigationContainer>
  108.       <MyTabs />
  109.     </NavigationContainer>
  110.   );
  111. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement