|
|
@ -21,7 +21,6 @@ const { width, height } = Dimensions.get("screen"); |
|
|
|
import laptopImage from "../../assets/laptop.png"; |
|
|
|
import laptopImage from "../../assets/laptop.png"; |
|
|
|
|
|
|
|
|
|
|
|
function Scan({ theme, route }) { |
|
|
|
function Scan({ theme, route }) { |
|
|
|
const { page } = route.params; |
|
|
|
|
|
|
|
const navigation = useNavigation(); |
|
|
|
const navigation = useNavigation(); |
|
|
|
const [hasPermission, setHasPermission] = React.useState(null); |
|
|
|
const [hasPermission, setHasPermission] = React.useState(null); |
|
|
|
const [scanned, setScanned] = React.useState(false); |
|
|
|
const [scanned, setScanned] = React.useState(false); |
|
|
@ -36,7 +35,7 @@ function Scan({ theme, route }) { |
|
|
|
const handleBarCodeScanned = React.useCallback( |
|
|
|
const handleBarCodeScanned = React.useCallback( |
|
|
|
({ type, data }) => { |
|
|
|
({ type, data }) => { |
|
|
|
setScanned(true); |
|
|
|
setScanned(true); |
|
|
|
if (page === "activation") { |
|
|
|
if (route?.params?.page === "activation") { |
|
|
|
navigation.push("QRContent", { data }); |
|
|
|
navigation.push("QRContent", { data }); |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
navigation.push("Activation", { data }); |
|
|
|
navigation.push("Activation", { data }); |
|
|
@ -45,13 +44,6 @@ function Scan({ theme, route }) { |
|
|
|
[route, scanned] |
|
|
|
[route, scanned] |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
if (hasPermission === null) { |
|
|
|
|
|
|
|
return <Text>Requesting for camera permission</Text>; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (hasPermission === false) { |
|
|
|
|
|
|
|
return <Text>No access to camera</Text>; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<ImageBackground |
|
|
|
<ImageBackground |
|
|
|
source={laptopImage} |
|
|
|
source={laptopImage} |
|
|
|