parent
5dc7b0d1bf
commit
95d927b727
25 changed files with 7216 additions and 375 deletions
@ -0,0 +1,54 @@ |
|||||||
|
import React from "react"; |
||||||
|
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs"; |
||||||
|
import Home from "../src/screens/Home"; |
||||||
|
import ShoppingCart from '../src/screens/ShoppingCart'; |
||||||
|
import Products from "../src/screens/Products"; |
||||||
|
import { Entypo, FontAwesome } from "@expo/vector-icons"; |
||||||
|
|
||||||
|
const Tab = createBottomTabNavigator(); |
||||||
|
|
||||||
|
const BottomTabNavigator = () => { |
||||||
|
return ( |
||||||
|
<Tab.Navigator |
||||||
|
initialRouteName="Home" |
||||||
|
screenOptions={{ |
||||||
|
headerShown: false, |
||||||
|
tabBarActiveTintColor: "white", |
||||||
|
tabBarInactiveTintColor: "grey", |
||||||
|
tabBarStyle: { |
||||||
|
backgroundColor: "#181818", |
||||||
|
}, |
||||||
|
}} |
||||||
|
> |
||||||
|
<Tab.Screen |
||||||
|
name="Home" |
||||||
|
component={Home} |
||||||
|
options={{ |
||||||
|
tabBarIcon: ({ focused, color }) => ( |
||||||
|
<Entypo name="home" size={focused ? 30 : 25} color={color} /> |
||||||
|
), |
||||||
|
}} |
||||||
|
/> |
||||||
|
<Tab.Screen |
||||||
|
name="Products" |
||||||
|
component={Products} |
||||||
|
options={{ |
||||||
|
tabBarIcon: ({ focused, color }) => ( |
||||||
|
<Entypo name="shop" size={focused ? 30 : 25} color={color} /> |
||||||
|
), |
||||||
|
}} |
||||||
|
/> |
||||||
|
<Tab.Screen |
||||||
|
name="ShoppingCart" |
||||||
|
component={ShoppingCart} |
||||||
|
options={{ |
||||||
|
tabBarIcon: ({ focused, color }) => ( |
||||||
|
<FontAwesome name="shopping-cart" size={focused ? 30 : 25} color={color} /> |
||||||
|
), |
||||||
|
}} |
||||||
|
/> |
||||||
|
</Tab.Navigator> |
||||||
|
); |
||||||
|
}; |
||||||
|
|
||||||
|
export default BottomTabNavigator; |
@ -0,0 +1,46 @@ |
|||||||
|
import React from "react"; |
||||||
|
import { NavigationContainer } from "@react-navigation/native"; |
||||||
|
import { createNativeStackNavigator } from "@react-navigation/native-stack"; |
||||||
|
import BottomTabNavigator from "./BottomNavigation"; |
||||||
|
import Splash from "../src/screens/Splash"; |
||||||
|
import Home from "../src/screens/Home"; |
||||||
|
import Login from "../src/screens/Login"; |
||||||
|
import Otp from "../src/screens/Otp"; |
||||||
|
import Product from "../src/screens/Product"; |
||||||
|
import QR from "../src/screens/QR/index"; |
||||||
|
import { connect } from "react-redux"; |
||||||
|
import i18n from "../src/services/i18n"; |
||||||
|
import { useTranslation } from "react-i18next"; |
||||||
|
import Profile from "../src/screens/Profile"; |
||||||
|
import Videos from "../src/screens/Videos"; |
||||||
|
import Exams from "../src/screens/Exams"; |
||||||
|
import OrderDetails from "../src/screens/OrderDetails"; |
||||||
|
|
||||||
|
const Stack = createNativeStackNavigator(); |
||||||
|
|
||||||
|
const Navigation = () => { |
||||||
|
return ( |
||||||
|
<NavigationContainer> |
||||||
|
<Stack.Navigator |
||||||
|
initialRouteName="Root" |
||||||
|
screenOptions={{ headerShown: false }} |
||||||
|
> |
||||||
|
<Stack.Screen name="Root" component={BottomTabNavigator} /> |
||||||
|
<Stack.Screen name="Product" component={Product} /> |
||||||
|
<Stack.Screen name="Login" component={Login} /> |
||||||
|
<Stack.Screen name="Otp" component={Otp} /> |
||||||
|
<Stack.Screen name="Splash" component={Splash} /> |
||||||
|
<Stack.Screen name="QR" component={QR} /> |
||||||
|
</Stack.Navigator> |
||||||
|
</NavigationContainer> |
||||||
|
); |
||||||
|
}; |
||||||
|
|
||||||
|
const mapStateToProps = (state) => { |
||||||
|
return { |
||||||
|
profile: state.profile, |
||||||
|
config: state.config, |
||||||
|
}; |
||||||
|
}; |
||||||
|
|
||||||
|
export default connect(mapStateToProps)(Navigation); |
@ -1,11 +1,37 @@ |
|||||||
import React from 'react' |
import React, { useState, useEffect } from 'react'; |
||||||
import { View, Text } from 'react-native' |
import { Text, View, StyleSheet, Button } from 'react-native'; |
||||||
import tw from 'tailwind-react-native-classnames'; |
import { BarCodeScanner } from 'expo-barcode-scanner'; |
||||||
|
|
||||||
|
export default function App() { |
||||||
|
const [hasPermission, setHasPermission] = useState(null); |
||||||
|
const [scanned, setScanned] = useState(false); |
||||||
|
|
||||||
|
useEffect(() => { |
||||||
|
(async () => { |
||||||
|
const { status } = await BarCodeScanner.requestPermissionsAsync(); |
||||||
|
setHasPermission(status === 'granted'); |
||||||
|
})(); |
||||||
|
}, []); |
||||||
|
|
||||||
|
const handleBarCodeScanned = ({ type, data }) => { |
||||||
|
setScanned(true); |
||||||
|
alert(`Bar code with type ${type} and data ${data} has been scanned!`); |
||||||
|
}; |
||||||
|
|
||||||
|
if (hasPermission === null) { |
||||||
|
return <Text>Requesting for camera permission</Text>; |
||||||
|
} |
||||||
|
if (hasPermission === false) { |
||||||
|
return <Text>No access to camera</Text>; |
||||||
|
} |
||||||
|
|
||||||
export default function Scanner() { |
|
||||||
return ( |
return ( |
||||||
<View> |
<View style={{width : '100%', position : 'relative'}}> |
||||||
<Text></Text> |
<BarCodeScanner |
||||||
|
onBarCodeScanned={scanned ? undefined : handleBarCodeScanned} |
||||||
|
style={{width : '100%', height : 300}} |
||||||
|
/> |
||||||
|
{scanned && <Button title={'Tap to Scan Again'} onPress={() => setScanned(false)} />} |
||||||
</View> |
</View> |
||||||
) |
); |
||||||
} |
} |
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue