reza added qr activation

master
Reza_ashrafi 2 years ago
parent 0c0bd6e35f
commit df7e093737
  1. 6
      src/components/Navbar.js
  2. 1
      src/redux/reducers/user.js
  3. 1
      src/redux/reducers/userProduct.js
  4. 9
      src/screens/Activation/index.js
  5. 2
      src/screens/Otp/index.js
  6. 36
      src/screens/QR/layouts/Scan/index.js

@ -49,7 +49,7 @@ const Navbar = ({
).length;
}, [headerOptions, userFavoriteList]);
const Button = useCallback(({ icon, route }) => {
const Button = useCallback(({ icon, route, state }) => {
return (
<TouchableOpacity
style={[
@ -61,7 +61,7 @@ const Navbar = ({
marginLeft: route === "AR" ? 10 : 0,
},
]}
onPress={() => navigation.navigate(route)}
onPress={() => navigation.navigate(route, { page: state })}
>
{icon}
</TouchableOpacity>
@ -351,6 +351,7 @@ const Navbar = ({
</Svg>
}
route={"QR"}
state={"book"}
/>
<Button
icon={
@ -389,6 +390,7 @@ const Navbar = ({
</Svg>
}
route={"AR"}
state={"AR"}
/>
</>
)}

@ -27,7 +27,6 @@ const user = (state = initialState, action) => {
case "public/sendOTP":
return { ...state, loading: false, error: null };
case "user/getStatus":
console.log(data.status);
return { ...state, status: JSON.parse(data.status), error: null };
case "user/login":
case "user/otp/login":

@ -36,7 +36,6 @@ export default function userFactor(state = initialState, action) {
case "userProduct/update":
return { ...state, loading: false, error: null };
case "userProduct/add":
console.log(data);
return {
...state,
loading: false,

@ -11,9 +11,11 @@ import {
Dimensions,
} from "react-native";
import { connect } from "react-redux";
import { useNavigation } from "@react-navigation/native";
import Svg, { Image as Imagee } from "react-native-svg";
import { activation } from "../../redux/actions";
//components
import TopHeader from "../../components/Header";
import Navbar from "../../components/Navbar";
import CustomPressable from "../../components/Pressable";
@ -31,8 +33,10 @@ import bgQr from "./assets/QR.png";
const ios = Platform.OS === "ios";
const { height } = Dimensions.get("window");
function Activation({ add, mobile, theme }) {
function Activation({ add, mobile, theme, route }) {
const {data} = route.params;
const [value, setValue] = useState(null);
const navigation = useNavigation();
return (
<SafeAreaView
@ -99,6 +103,7 @@ function Activation({ add, mobile, theme }) {
fontFamily: "light",
},
]}
value={value || data}
onChange={(name, value) => setValue(value)}
/>
<CustomPressable
@ -116,7 +121,7 @@ function Activation({ add, mobile, theme }) {
color={"white"}
border={{ color: "#196EC0", width: 0 }}
width={"100%"}
onPress={() => {}}
onPress={() => navigation.push("QR", { page: "activation" })}
/>
</View>
</View>

@ -158,7 +158,7 @@ function Otp(props) {
useEffect(() => {
if (props.isLogin) {
// props.navigation.navigate("Root");
props.navigation.navigate("Root");
}
}, [props.isLogin]);

@ -1,4 +1,4 @@
import React, { useState, useEffect } from "react";
import React from "react";
import {
View,
Text,
@ -10,32 +10,40 @@ import {
import { useNavigation } from "@react-navigation/native";
import { BarCodeScanner } from "expo-barcode-scanner";
import { Entypo } from "@expo/vector-icons";
import {connect} from "react-redux";
import { connect } from "react-redux";
import tw from "tailwind-rn";
import Colors from "../../../constants/Colors";
import Colors from "../../../../constants/Colors";
const { width, height } = Dimensions.get("screen");
//assets
import laptopImage from "../assets/laptop.png";
function Scan({theme}) {
function Scan({ theme, route }) {
const { page } = route.params;
const navigation = useNavigation();
const [hasPermission, setHasPermission] = useState(null);
const [scanned, setScanned] = useState(false);
const [hasPermission, setHasPermission] = React.useState(null);
const [scanned, setScanned] = React.useState(false);
useEffect(() => {
React.useEffect(() => {
(async () => {
const { status } = await BarCodeScanner.requestPermissionsAsync();
setHasPermission(status === "granted");
})();
}, []);
const handleBarCodeScanned = ({ type, data }) => {
setScanned(true);
navigation.navigate("QRContent", { data });
};
const handleBarCodeScanned = React.useCallback(
({ type, data }) => {
setScanned(true);
if (page === "activation") {
navigation.push("QRContent", { data });
}else{
navigation.push("Activation", { data });
}
},
[route, scanned]
);
if (hasPermission === null) {
return <Text>Requesting for camera permission</Text>;
@ -98,7 +106,7 @@ function Scan({theme}) {
}
const mapStateToProps = (state) => ({
theme: state.publicApi.theme
})
theme: state.publicApi.theme,
});
export default connect(mapStateToProps)(Scan);
export default connect(mapStateToProps)(Scan);
Loading…
Cancel
Save