Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Philipye314/imp 2 qr code scanner #3

Merged
merged 63 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
498625c
no progress
philipye314 Sep 28, 2023
abd51a9
wip
philipye314 Sep 28, 2023
93e502f
made no progress
philipye314 Sep 28, 2023
b044d9a
wip
philipye314 Oct 1, 2023
51218dc
??????
philipye314 Oct 1, 2023
1126b65
made no progress
philipye314 Sep 28, 2023
009b5c0
no progress
philipye314 Sep 28, 2023
42cb962
wip
philipye314 Sep 28, 2023
88d49a7
made no progress
philipye314 Sep 28, 2023
431f744
wip
philipye314 Oct 1, 2023
58a5b4b
??????
philipye314 Oct 1, 2023
9fd1e6e
wip
philipye314 Sep 28, 2023
0217228
made no progress
philipye314 Sep 28, 2023
243119f
fixed dependencies?
philipye314 Oct 5, 2023
1eaa208
fixing package issues
philipye314 Oct 5, 2023
8f58980
HELPPP
philipye314 Oct 6, 2023
db747ee
did branch
philipye314 Oct 8, 2023
26bb1be
Folasade/imp 5 supabase client (#6)
foloye Oct 11, 2023
8448bde
fix import
stephaniewong2 Oct 11, 2023
772194b
pull request changes fixed
philipye314 Oct 11, 2023
ef5453c
fixed some changes
philipye314 Oct 12, 2023
d21dcfe
no progress
philipye314 Sep 28, 2023
cc3fc42
weird
philipye314 Oct 12, 2023
e6c59bd
made no progress
philipye314 Sep 28, 2023
55abf19
wip
philipye314 Oct 1, 2023
7ed9c09
??????
philipye314 Oct 1, 2023
5067eac
made no progress
philipye314 Sep 28, 2023
4696a9b
no progress
philipye314 Sep 28, 2023
fab2e6b
wip
philipye314 Sep 28, 2023
b7690be
made no progress
philipye314 Sep 28, 2023
12ec543
wip
philipye314 Oct 1, 2023
111a1f4
??????
philipye314 Oct 1, 2023
093d80e
wip
philipye314 Sep 28, 2023
557818c
made no progress
philipye314 Sep 28, 2023
18629c3
fixed dependencies?
philipye314 Oct 5, 2023
48954c7
bruh
philipye314 Oct 12, 2023
ca77498
broo
philipye314 Oct 12, 2023
ef918a8
did branch
philipye314 Oct 8, 2023
e153bde
pull request changes fixed
philipye314 Oct 11, 2023
552fab9
fixed some changes
philipye314 Oct 12, 2023
aa4b77f
whaaat
philipye314 Oct 12, 2023
4c73ab0
no progress
philipye314 Sep 28, 2023
99b50d1
1/?
philipye314 Oct 13, 2023
d78fef9
made no progress
philipye314 Sep 28, 2023
83d6637
wip
philipye314 Oct 1, 2023
164ffea
??????
philipye314 Oct 1, 2023
25d6b74
made no progress
philipye314 Sep 28, 2023
e4d76c5
no progress
philipye314 Sep 28, 2023
507c473
wip
philipye314 Sep 28, 2023
819ac01
made no progress
philipye314 Sep 28, 2023
6144c59
wip
philipye314 Oct 1, 2023
58d3e3d
??????
philipye314 Oct 1, 2023
a716e09
wip
philipye314 Sep 28, 2023
152d01a
made no progress
philipye314 Sep 28, 2023
c7261d2
fixed dependencies?
philipye314 Oct 5, 2023
bfce92e
AHHHH
philipye314 Oct 13, 2023
80ae71e
brauhheheheh
philipye314 Oct 13, 2023
b84837b
bruhhahaha
philipye314 Oct 13, 2023
72db58f
pull request changes fixed
philipye314 Oct 11, 2023
efc88c6
fixed some changes
philipye314 Oct 12, 2023
c94cd78
fixing
philipye314 Oct 13, 2023
7382b39
package fix hopefully
philipye314 Oct 13, 2023
c8832f4
installed autofill
philipye314 Oct 13, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,15 @@
"web": {
"favicon": "./assets/favicon.png"
},
"plugins": ["expo-router"],
"plugins": [
"expo-router",
[
"expo-barcode-scanner",
{
"cameraPermission": "Allow $(PRODUCT_NAME) to access camera."
}
]
],
"scheme": "your-app-scheme"
}
}
17,714 changes: 1,665 additions & 16,049 deletions package-lock.json

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,22 @@
"expo": "~49.0.11",
"expo-status-bar": "~1.6.0",
"react": "18.2.0",
"react-native": "0.72.4",
"react-native": "0.72.5",
"react-native-safe-area-context": "4.6.3",
"react-native-screens": "~3.22.0",
"expo-router": "^2.0.0",
"expo-linking": "~5.0.2",
"expo-constants": "~14.4.2",
"react-native-gesture-handler": "~2.12.0"
"react-native-gesture-handler": "~2.12.0",
"expo-barcode-scanner": "~12.5.3",
"expo-camera": "~13.4.4"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"@calblueprint/eslint-config-react": "^0.0.3",
"@calblueprint/prettier-config": "^0.0.1",
"@types/react": "~18.2.14",
"@types/react-native": "^0.72.3",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"eslint": "^8.50.0",
Expand Down
stephaniewong2 marked this conversation as resolved.
Show resolved Hide resolved
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 47 additions & 3 deletions src/app/(BottomTabNavigation)/Cases/QRCodeScanner/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,55 @@
import React from 'react';
import { Text, View } from 'react-native';
import { BarCodeScanner, BarCodeScannerResult } from 'expo-barcode-scanner';
import { router } from 'expo-router';
import React, { useEffect, useState } from 'react';
import { Image, Text, View } from 'react-native';
import { TouchableOpacity } from 'react-native-gesture-handler';
import styles from './styles';
stephaniewong2 marked this conversation as resolved.
Show resolved Hide resolved

enum permissions {
UNDETERMINED,
DENIED,
GRANTED,
}

function QRCodeScannerScreen() {
const [hasPermission, setHasPermission] = useState(permissions.UNDETERMINED);
const [scanned, setScanned] = useState<boolean>(false);
const [data, setData] = useState('NOTHING');

useEffect(() => {
const getBarCodeScannerPermissions = async () => {
const { status } = await BarCodeScanner.requestPermissionsAsync();
setHasPermission(
status === 'granted' ? permissions.GRANTED : permissions.DENIED,
);
};
getBarCodeScannerPermissions();
}, []);

const handleBarCodeScanned = async (result: BarCodeScannerResult) => {
if (!scanned) {
setScanned(true);
setData(result.data);
}
};

if (hasPermission === permissions.DENIED) {
return <Text>CANNOT ACCESS CAMERA!</Text>;
}

return (
<View style={styles.container}>
<Text>This is the QR Code Scanner screen!</Text>
<Text>Add a new case</Text>
<BarCodeScanner
onBarCodeScanned={handleBarCodeScanned}
style={[styles.scanner]} // StyleSheet.absoluteFillObject,
/>
stephaniewong2 marked this conversation as resolved.
Show resolved Hide resolved
<Image style={styles.crosshair} source={require('./img/crosshair.png')} />

stephaniewong2 marked this conversation as resolved.
Show resolved Hide resolved
<Text>Current Scanning: {data}</Text>
<TouchableOpacity onPress={() => router.back()} style={styles.button}>
<Text>Go Back</Text>
</TouchableOpacity>
</View>
);
}
Expand Down
22 changes: 22 additions & 0 deletions src/app/(BottomTabNavigation)/Cases/QRCodeScanner/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,26 @@ export default StyleSheet.create({
alignItems: 'center',
justifyContent: 'center',
},

scanner: {
height: 300,
width: 300,
border: 'solid',
borderWidth: 3,
},

button: {
margin: 10,
alignItems: 'center',
backgroundColor: '#339FFF',
padding: 10,
},

crosshair: {
stephaniewong2 marked this conversation as resolved.
Show resolved Hide resolved
position: 'absolute',
top: 120,
left: -90,
height: 600,
width: 600,
},
});
13 changes: 0 additions & 13 deletions src/app/(BottomTabNavigation)/Cases/index.tsx

This file was deleted.

5 changes: 5 additions & 0 deletions src/app/(BottomTabNavigation)/Cases/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,9 @@ export default StyleSheet.create({
alignItems: 'center',
justifyContent: 'center',
},

scanner: {
stephaniewong2 marked this conversation as resolved.
Show resolved Hide resolved
overflow: 'hidden',
borderRadius: 10,
},
});
2 changes: 1 addition & 1 deletion src/app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function StartScreen() {
<Text>Welcome Screen</Text>
</TouchableOpacity>
</Link>
<Link href="/Cases" asChild>
<Link href="/Cases/QRCodeScanner" asChild>
<TouchableOpacity style={styles.button}>
<Text>Cases Screen</Text>
</TouchableOpacity>
Expand Down
50 changes: 50 additions & 0 deletions src/screens/QRCodeScanner/QRCodeScanner.tsx
stephaniewong2 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { BarCodeScanner, BarCodeScannerResult } from 'expo-barcode-scanner';
import React, { useEffect, useState } from 'react';
import { StyleSheet, Text, View } from 'react-native';
import styles from '../../app/styles';

enum permissions {
UNDETERMINED,
DENIED,
GRANTED,
}

function QRCodeScannerScreen() {
const [hasPermission, setHasPermission] = useState(permissions.UNDETERMINED);
const [scanned, setScanned] = useState<boolean>(false);
const [data, setData] = useState('NO INFO YET!');

useEffect(() => {
const getBarCodeScannerPermissions = async () => {
const { status } = await BarCodeScanner.requestPermissionsAsync();
setHasPermission(
status === 'granted' ? permissions.GRANTED : permissions.DENIED,
);
};
getBarCodeScannerPermissions();
}, []);

const handleBarCodeScanned = async (result: BarCodeScannerResult) => {
if (!scanned) {
setScanned(true);
setData(result.data);
}
};

if (hasPermission === permissions.DENIED) {
return <Text>CANNOT ACCESS CAMERA!</Text>;
}

return (
<View style={styles.container}>
<Text>This buhis the QR Code Scanner screen!</Text>
<BarCodeScanner
onBarCodeScanned={handleBarCodeScanned}
style={[StyleSheet.absoluteFillObject, styles.scanner]}
/>
<Text>{data}</Text>
</View>
);
}

export default QRCodeScannerScreen;
Loading