Commit eded323f authored by Malsha Jayakody's avatar Malsha Jayakody

new changes

parent fbc714d4
import React, { useState, useRef, useEffect } from 'react'; import React, {useState, useRef, useEffect} from 'react';
import { View, StyleSheet, Text, ScrollView, TouchableOpacity, ActivityIndicator, Image } from 'react-native'; import {
import { COLORS ,IMGS, ROUTES} from '../../../constants'; View,
StyleSheet,
Text,
ScrollView,
TouchableOpacity,
ActivityIndicator,
Image,
} from 'react-native';
import {COLORS, IMGS, ROUTES} from '../../../constants';
import CheckBox from '@react-native-community/checkbox'; // Make sure to install this package import CheckBox from '@react-native-community/checkbox'; // Make sure to install this package
import Video from 'react-native-video'; // Make sure to install this package import Video from 'react-native-video'; // Make sure to install this package
import Button from '../../../components/Button'; import Button from '../../../components/Button';
import { SafeAreaView } from 'react-native-safe-area-context'; import {SafeAreaView} from 'react-native-safe-area-context';
import { Dimensions } from 'react-native'; import {Dimensions} from 'react-native';
import { Linking } from 'react-native'; import {Linking} from 'react-native';
const AdditionalSymptomsScreen2 = ({navigation}) => {
const AdditionalSymptomsScreen2 = ({ navigation }) => {
const [selectedSymptoms, setSelectedSymptoms] = useState({ const [selectedSymptoms, setSelectedSymptoms] = useState({
symptom1: false, symptom2: false, symptom3: false, symptom4: false, symptom1: false,
symptom5: false, symptom6: false, symptom7: false, symptom8: false, symptom2: false,
symptom9: false, symptom10: false, symptom11: false, symptom12: false, symptom3: false,
symptom13: false, symptom14: false symptom4: false,
symptom5: false,
symptom6: false,
symptom7: false,
symptom8: false,
symptom9: false,
symptom10: false,
symptom11: false,
symptom12: false,
symptom13: false,
symptom14: false,
}); });
const [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
const [videoPaused, setVideoPaused] = useState(true); const [videoPaused, setVideoPaused] = useState(true);
...@@ -22,39 +39,37 @@ const AdditionalSymptomsScreen2 = ({ navigation }) => { ...@@ -22,39 +39,37 @@ const AdditionalSymptomsScreen2 = ({ navigation }) => {
const [controlsVisible, setControlsVisible] = useState(false); const [controlsVisible, setControlsVisible] = useState(false);
const hideTimer = useRef(null); const hideTimer = useRef(null);
const URL_link = "https://res.cloudinary.com/dl207ux6g/video/upload/v1715374532/3D/wfu4pr9phnadjqargex4.mp4"; const URL_link =
'https://res.cloudinary.com/dl207ux6g/video/upload/v1715374532/3D/wfu4pr9phnadjqargex4.mp4';
const videoRef = useRef(null); const videoRef = useRef(null);
const screenHeight = Dimensions.get('window').height; const screenHeight = Dimensions.get('window').height;
const imageHeight = screenHeight * 0.20; const imageHeight = screenHeight * 0.2;
const symptomsGroups = [ const symptomsGroups = [
[ [
{ key: 'symptom1', text: 'Headache | හිසරදය' }, {key: 'symptom1', text: 'Headache | හිසරදය'},
{ key: 'symptom2', text: 'Shoulder pain | උරහිස් වේදනාව' }, {key: 'symptom2', text: 'Shoulder pain | උරහිස් වේදනාව'},
{ key: 'symptom3', text: 'Upper Abdominal pain | ඉහළ උදරයේ වේදනාව' }, {key: 'symptom3', text: 'Upper Abdominal pain | ඉහළ උදරයේ වේදනාව'},
{ key: 'symptom4', text: 'Lower Abdomen pain | පහළ උදරයේ වේදනාව' }, {key: 'symptom4', text: 'Lower Abdomen pain | පහළ උදරයේ වේදනාව'},
], ],
[ [
{ key: 'symptom5', text: 'Swollen Ankle pain | ඉදිමුණු වළලුකර වේදනාව' }, {key: 'symptom5', text: 'Swollen Ankle pain | ඉදිමුණු වළලුකර වේදනාව'},
{ key: 'symptom6', text: 'Leg joint pain | පාදයේ සන්ධි වේදනාව' }, {key: 'symptom6', text: 'Leg joint pain | පාදයේ සන්ධි වේදනාව'},
{ key: 'symptom7', text: 'Thigh muscle pain | කලවා මාංශ පේශි වේදනාව' }, {key: 'symptom7', text: 'Thigh muscle pain | කලවා මාංශ පේශි වේදනාව'},
{ key: 'symptom8', text: 'Groin pain | ඉකිලි වේදනාව' }, {key: 'symptom8', text: 'Groin pain | ඉකිලි වේදනාව'},
{ key: 'symptom9', text: 'Breast Pain |පියයුරු වේදනාව'}, {key: 'symptom9', text: 'Breast Pain |පියයුරු වේදනාව'},
{ key: 'symptom10', text: 'Side muscle pain | පැත්තේ මාංශ පේශි වේදනාව'}, {key: 'symptom10', text: 'Side muscle pain | පැත්තේ මාංශ පේශි වේදනාව'},
], ],
[ [
{ key: 'symptom11', text: 'Upper arm pain | ඉහළ අතේ වේදනාව' }, {key: 'symptom11', text: 'Upper arm pain | ඉහළ අතේ වේදනාව'},
{ key: 'symptom12', text: 'Heart burn | හදවත දැවෙනවා' }, {key: 'symptom12', text: 'Heart burn | හදවත දැවෙනවා'},
{ key: 'symptom13', text: 'Mouth and Nose ulcer’s | මුඛයේ සහ නාසයේ වණ'}, {key: 'symptom13', text: 'Mouth and Nose ulcer’s | මුඛයේ සහ නාසයේ වණ'},
{ key: 'symptom14', text: 'Back Pain |පිටුපස මාංශ පේශි වේදනාව'}, {key: 'symptom14', text: 'Back Pain |පිටුපස මාංශ පේශි වේදනාව'},
], ],
// Add more groups as needed // Add more groups as needed
]; ];
const handleLoad = () => { const handleLoad = () => {
setLoading(false); setLoading(false);
}; };
...@@ -63,7 +78,7 @@ const AdditionalSymptomsScreen2 = ({ navigation }) => { ...@@ -63,7 +78,7 @@ const AdditionalSymptomsScreen2 = ({ navigation }) => {
setLoading(true); setLoading(true);
}; };
const toggleCheckbox = (symptom) => { const toggleCheckbox = symptom => {
setSelectedSymptoms(prevState => ({ setSelectedSymptoms(prevState => ({
...prevState, ...prevState,
[symptom]: !prevState[symptom], [symptom]: !prevState[symptom],
...@@ -72,12 +87,23 @@ const AdditionalSymptomsScreen2 = ({ navigation }) => { ...@@ -72,12 +87,23 @@ const AdditionalSymptomsScreen2 = ({ navigation }) => {
const handleSubmit = () => { const handleSubmit = () => {
// Checking for specific symptoms that lead to SKIN_RISK // Checking for specific symptoms that lead to SKIN_RISK
const skinRiskSymptoms = ['symptom12', 'symptom5', 'symptom4','symptom10', 'symptom8', 'symptom6']; const skinRiskSymptoms = [
const toSkinRisk = skinRiskSymptoms.some(symptom => selectedSymptoms[symptom]); 'symptom12',
'symptom5',
'symptom4',
'symptom10',
'symptom8',
'symptom6',
];
const toSkinRisk = skinRiskSymptoms.some(
symptom => selectedSymptoms[symptom],
);
// Navigate based on condition // Navigate based on condition
if (toSkinRisk) { if (toSkinRisk) {
navigation.navigate(ROUTES.SKIN_RISK, {origin: 'AdditionalSymptomsScreen2' }); navigation.navigate(ROUTES.SKIN_RISK, {
origin: 'AdditionalSymptomsScreen2',
});
} else { } else {
navigation.navigate(ROUTES.SKIN_INFO); navigation.navigate(ROUTES.SKIN_INFO);
} }
...@@ -119,7 +145,9 @@ const AdditionalSymptomsScreen2 = ({ navigation }) => { ...@@ -119,7 +145,9 @@ const AdditionalSymptomsScreen2 = ({ navigation }) => {
return ( return (
<SafeAreaView style={styles.container}> <SafeAreaView style={styles.container}>
<ScrollView style={styles.scrollContainer} contentContainerStyle={styles.contentContainer}> <ScrollView
style={styles.scrollContainer}
contentContainerStyle={styles.contentContainer}>
<View style={styles.topContainer}> <View style={styles.topContainer}>
<Text style={styles.topicText}>Discoid Additional Symptoms </Text> <Text style={styles.topicText}>Discoid Additional Symptoms </Text>
<View style={styles.qrCodeBox1}> <View style={styles.qrCodeBox1}>
...@@ -128,17 +156,28 @@ const AdditionalSymptomsScreen2 = ({ navigation }) => { ...@@ -128,17 +156,28 @@ const AdditionalSymptomsScreen2 = ({ navigation }) => {
style={styles.qrCodeImage1} style={styles.qrCodeImage1}
/> />
<Text style={styles.dscriptionText1}> <Text style={styles.dscriptionText1}>
මෙම පිටුවේ පහළ දක්වා ඇති රෝග ලක්ෂණ ඔබට තිබේදැයි පරික්ෂා කරන්න. සඳහා වීඩියෝවක් ලබා දී ඇත. මෙම පිටුවේ පහළ දක්වා ඇති රෝග ලක්ෂණ ඔබට තිබේදැයි පරික්ෂා කරන්න.
වීඩියෝව පැහැදිලි නොවේ නම්, පහත QR කේතය ස්කෑන් කර හෝ බොත්තම ක්ලික් කිරීමෙන් මෙම රෝග ලක්ෂණ සහිත 3D කාන්තාව නිරීක්ෂණය කරන්න. සඳහා වීඩියෝවක් ලබා දී ඇත. වීඩියෝව පැහැදිලි නොවේ නම්, පහත QR කේතය
ස්කෑන් කර හෝ බොත්තම ක්ලික් කිරීමෙන් මෙම රෝග ලක්ෂණ සහිත 3D කාන්තාව
නිරීක්ෂණය කරන්න.
</Text> </Text>
<Text style={styles.dscriptionText1}> <Text style={styles.dscriptionText1}>
Check if you have the symptoms listed below. Watch the video for guidance. Check if you have the symptoms listed below. Watch the video for
If the video is unclear, scan the QR code or click the button to view a 3D model of a woman displaying these symptoms. guidance. If the video is unclear, scan the QR code or click the
button to view a 3D model of a woman displaying these symptoms.
</Text> </Text>
</View> </View>
<Image source={IMGS.sk_25} <Image
style={{ width: '50%', height: imageHeight, alignSelf: 'center', resizeMode: 'contain', marginBottom: -45 ,marginTop:-24}} /> source={IMGS.sk_25}
style={{
width: '50%',
height: imageHeight,
alignSelf: 'center',
resizeMode: 'contain',
marginBottom: -45,
marginTop: -24,
}}
/>
<View style={styles.qrCodeBox}> <View style={styles.qrCodeBox}>
<Image <Image
...@@ -147,7 +186,9 @@ const AdditionalSymptomsScreen2 = ({ navigation }) => { ...@@ -147,7 +186,9 @@ const AdditionalSymptomsScreen2 = ({ navigation }) => {
/> />
<TouchableOpacity <TouchableOpacity
style={styles.orButton} style={styles.orButton}
onPress={() => Linking.openURL('https://mywebar.com/p/Project_0_ysb0ffrwxn')}> onPress={() =>
Linking.openURL('https://mywebar.com/p/Project_4_lpf4ury2jc')
}>
<Text style={styles.orButtonText}>OR Click This</Text> <Text style={styles.orButtonText}>OR Click This</Text>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
...@@ -157,18 +198,22 @@ const AdditionalSymptomsScreen2 = ({ navigation }) => { ...@@ -157,18 +198,22 @@ const AdditionalSymptomsScreen2 = ({ navigation }) => {
Self diagnose with the 3D Model Self diagnose with the 3D Model
</Text> </Text>
</View> </View>
<TouchableOpacity style={styles.videoContainer} onPress={showControlsTemporarily}> <TouchableOpacity
style={styles.videoContainer}
onPress={showControlsTemporarily}>
<Video <Video
// ref={videoRef} // ref={videoRef}
source={{ uri: URL_link }} // Replace with the path to your video file source={{uri: URL_link}} // Replace with the path to your video file
style={[styles.video, { height: fullscreen ? '100%' : 300 }]} style={[styles.video, {height: fullscreen ? '100%' : 300}]}
paused={videoPaused} paused={videoPaused}
resizeMode="contain" // This ensures the video fits within its container resizeMode="contain" // This ensures the video fits within its container
onLoad={() => setVideoPaused(false)} onLoad={() => setVideoPaused(false)}
onError={(error) => console.error('Video playback error:', error)} onError={error => console.error('Video playback error:', error)}
/> />
{controlsVisible && ( {controlsVisible && (
<TouchableOpacity style={styles.playPauseButton} onPress={togglePlayPause}> <TouchableOpacity
style={styles.playPauseButton}
onPress={togglePlayPause}>
<Image <Image
style={styles.playPauseIcon} style={styles.playPauseIcon}
source={videoPaused ? IMGS.sk_20 : IMGS.sk_19} source={videoPaused ? IMGS.sk_20 : IMGS.sk_19}
...@@ -177,13 +222,19 @@ const AdditionalSymptomsScreen2 = ({ navigation }) => { ...@@ -177,13 +222,19 @@ const AdditionalSymptomsScreen2 = ({ navigation }) => {
)} )}
</TouchableOpacity> </TouchableOpacity>
</View> </View>
<Text style={styles.checkboxLabel}>Check the symptom that you have </Text> <Text style={styles.checkboxLabel}>
<Text style={styles.checkboxLabel}>ඔබට ඇති රෝග ලක්ෂණය ඇතුල් කරන්න </Text> Check the symptom that you have{' '}
</Text>
<Text style={styles.checkboxLabel}>
ඔබට ඇති රෝග ලක්ෂණය ඇතුල් කරන්න{' '}
</Text>
<View style={styles.checkboxContainer}> <View style={styles.checkboxContainer}>
{symptomsGroups.map((group, index) => ( {symptomsGroups.map((group, index) => (
<View key={index}> <View key={index}>
{group.map(symptom => ( {group.map(symptom => (
<View style={styles.individualCheckboxContainer} key={symptom.key}> <View
style={styles.individualCheckboxContainer}
key={symptom.key}>
<CheckBox <CheckBox
value={selectedSymptoms[symptom.key]} value={selectedSymptoms[symptom.key]}
onValueChange={() => toggleCheckbox(symptom.key)} onValueChange={() => toggleCheckbox(symptom.key)}
...@@ -209,13 +260,11 @@ const AdditionalSymptomsScreen2 = ({ navigation }) => { ...@@ -209,13 +260,11 @@ const AdditionalSymptomsScreen2 = ({ navigation }) => {
); );
}; };
const styles = StyleSheet.create({ const styles = StyleSheet.create({
scrollContainer: { scrollContainer: {
flexGrow: 1, flexGrow: 1,
}, },
container: { container: {
flexGrow: 1, flexGrow: 1,
backgroundColor: COLORS.white, backgroundColor: COLORS.white,
...@@ -239,7 +288,7 @@ const styles = StyleSheet.create({ ...@@ -239,7 +288,7 @@ const styles = StyleSheet.create({
textAlign: 'center', textAlign: 'center',
marginHorizontal: 20, marginHorizontal: 20,
marginBottom: 20, marginBottom: 20,
color:COLORS.white, color: COLORS.white,
fontWeight: 'bold', fontWeight: 'bold',
}, },
separator: { separator: {
...@@ -248,8 +297,7 @@ const styles = StyleSheet.create({ ...@@ -248,8 +297,7 @@ const styles = StyleSheet.create({
marginVertical: 10, marginVertical: 10,
width: '90%', // Reduce width to see margins from container edges width: '90%', // Reduce width to see margins from container edges
alignSelf: 'center', alignSelf: 'center',
marginLeft:-197, marginLeft: -197,
}, },
checkboxContainer: { checkboxContainer: {
...@@ -258,17 +306,14 @@ const styles = StyleSheet.create({ ...@@ -258,17 +306,14 @@ const styles = StyleSheet.create({
width: '100%', // Ensure it's taking the full width of its parent width: '100%', // Ensure it's taking the full width of its parent
alignSelf: 'center', // This ensures it's centered relative to the parent alignSelf: 'center', // This ensures it's centered relative to the parent
paddingTop: 10, paddingTop: 10,
marginLeft:197, marginLeft: 197,
}, },
checkboxLabel: { checkboxLabel: {
fontSize: 16, fontSize: 16,
marginBottom: 10, marginBottom: 10,
alignSelf: 'center', alignSelf: 'center',
color:COLORS.black, color: COLORS.black,
}, },
checkboxRow: { checkboxRow: {
flexDirection: 'row', flexDirection: 'row',
...@@ -292,12 +337,11 @@ const styles = StyleSheet.create({ ...@@ -292,12 +337,11 @@ const styles = StyleSheet.create({
flex: 2, flex: 2,
justifyContent: 'flex-end', justifyContent: 'flex-end',
marginBottom: 2, marginBottom: 2,
marginTop:-20, marginTop: -20,
alignItems: 'center', alignItems: 'center',
backgroundColor: COLORS.blue, backgroundColor: COLORS.blue,
borderTopRightRadius: 85, borderTopRightRadius: 85,
borderTopLeftRadius: 85, borderTopLeftRadius: 85,
}, },
nextButton: { nextButton: {
width: '70%', width: '70%',
...@@ -306,14 +350,13 @@ const styles = StyleSheet.create({ ...@@ -306,14 +350,13 @@ const styles = StyleSheet.create({
backgroundColor: COLORS.white, backgroundColor: COLORS.white,
borderRadius: 20, borderRadius: 20,
alignSelf: 'center', alignSelf: 'center',
}, },
videoContainer: { videoContainer: {
width: '100%', width: '100%',
aspectRatio: 16 / 9, // You can adjust this aspect ratio as needed aspectRatio: 16 / 9, // You can adjust this aspect ratio as needed
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center',
backgroundColor: 'black' backgroundColor: 'black',
}, },
video: { video: {
width: '110%', width: '110%',
...@@ -329,10 +372,9 @@ const styles = StyleSheet.create({ ...@@ -329,10 +372,9 @@ const styles = StyleSheet.create({
alignItems: 'center', // Center align items vertically alignItems: 'center', // Center align items vertically
borderWidth: 0.6, // Optional border width borderWidth: 0.6, // Optional border width
width: '98%', // Width 100% to fill container width width: '98%', // Width 100% to fill container width
marginLeft:-95, marginLeft: -95,
elevation: 6, elevation: 6,
minHeight: 50, minHeight: 50,
}, },
fullscreenButton: { fullscreenButton: {
...@@ -355,7 +397,7 @@ const styles = StyleSheet.create({ ...@@ -355,7 +397,7 @@ const styles = StyleSheet.create({
width: '100%', // Adjust the width as necessary width: '100%', // Adjust the width as necessary
alignSelf: 'center', // Center the box within its container alignSelf: 'center', // Center the box within its container
// Add shadows for elevation effect (optional) // Add shadows for elevation effect (optional)
shadowColor: "#000", shadowColor: '#000',
shadowOffset: { shadowOffset: {
width: 0, width: 0,
height: 2, height: 2,
...@@ -365,13 +407,12 @@ const styles = StyleSheet.create({ ...@@ -365,13 +407,12 @@ const styles = StyleSheet.create({
elevation: 5, elevation: 5,
}, },
playPauseButton: { playPauseButton: {
position: 'absolute', position: 'absolute',
top: '50%', top: '50%',
left: '50%', left: '50%',
bottom:'30%', bottom: '30%',
transform: [{ translateX: -25 }, { translateY: -25 }], transform: [{translateX: -25}, {translateY: -25}],
width: 50, width: 50,
height: 50, height: 50,
justifyContent: 'center', justifyContent: 'center',
...@@ -392,7 +433,7 @@ const styles = StyleSheet.create({ ...@@ -392,7 +433,7 @@ const styles = StyleSheet.create({
padding: 20, padding: 20,
backgroundColor: COLORS.white, backgroundColor: COLORS.white,
marginBottom: 40, marginBottom: 40,
shadowColor: "#000", shadowColor: '#000',
borderColor: '#80BCBD', borderColor: '#80BCBD',
borderWidth: 2, borderWidth: 2,
borderRadius: 10, borderRadius: 10,
...@@ -403,7 +444,7 @@ const styles = StyleSheet.create({ ...@@ -403,7 +444,7 @@ const styles = StyleSheet.create({
shadowOpacity: 0.25, shadowOpacity: 0.25,
shadowRadius: 3.84, shadowRadius: 3.84,
elevation: 5, elevation: 5,
marginTop:16 marginTop: 16,
}, },
qrCodeImage: { qrCodeImage: {
width: 200, // Adjust size as needed width: 200, // Adjust size as needed
...@@ -429,7 +470,7 @@ const styles = StyleSheet.create({ ...@@ -429,7 +470,7 @@ const styles = StyleSheet.create({
padding: 30, padding: 30,
backgroundColor: COLORS.white, backgroundColor: COLORS.white,
marginBottom: 40, marginBottom: 40,
shadowColor: "#000", shadowColor: '#000',
borderColor: '#80BCBD', borderColor: '#80BCBD',
borderWidth: 2, borderWidth: 2,
borderRadius: 10, borderRadius: 10,
...@@ -440,10 +481,10 @@ const styles = StyleSheet.create({ ...@@ -440,10 +481,10 @@ const styles = StyleSheet.create({
shadowOpacity: 0.25, shadowOpacity: 0.25,
shadowRadius: 3.84, shadowRadius: 3.84,
elevation: 10, elevation: 10,
marginTop:10 marginTop: 10,
}, },
qrCodeImage1:{ qrCodeImage1: {
width: 210, // Adjust size as needed width: 210, // Adjust size as needed
height: 170, height: 170,
}, },
...@@ -453,9 +494,7 @@ const styles = StyleSheet.create({ ...@@ -453,9 +494,7 @@ const styles = StyleSheet.create({
color: COLORS.darkGray, color: COLORS.darkGray,
marginTop: 20, marginTop: 20,
marginBottom: 20, marginBottom: 20,
} },
// ... possibly other styles // ... possibly other styles
}); });
......
import React, { useState } from 'react'; import React, {useState} from 'react';
import { View, StyleSheet, Image, TouchableOpacity, PermissionsAndroid, Text, ScrollView } from 'react-native'; import {
import { launchCamera, launchImageLibrary } from 'react-native-image-picker'; View,
import { COLORS, IMGS, ROUTES } from '../../../constants'; StyleSheet,
Image,
TouchableOpacity,
PermissionsAndroid,
Text,
ScrollView,
ActivityIndicator,
} from 'react-native';
import {launchCamera, launchImageLibrary} from 'react-native-image-picker';
import {COLORS, IMGS, ROUTES} from '../../../constants';
import Button from '../../../components/Button'; import Button from '../../../components/Button';
import axios from 'axios'; // Import Axios import axios from 'axios'; // Import Axios
const Camera = ({ navigation }) => { const Camera = ({navigation}) => {
const [cameraPhoto, setCameraPhoto] = useState(); const [cameraPhoto, setCameraPhoto] = useState();
const [galleryPhoto, setGalleryPhoto] = useState(); const [galleryPhoto, setGalleryPhoto] = useState();
const REACT_APP_API_URL='https://us-central1-skin-condition-detection.cloudfunctions.net/predict'; const REACT_APP_API_URL =
'https://us-central1-skin-condition-detection.cloudfunctions.net/predict';
const [prediction, setPrediction] = useState(null); const [prediction, setPrediction] = useState(null);
const [loading, setLoading] = useState(false);
const [photo, setPhoto] = useState(null); const [photo, setPhoto] = useState(null);
let options = { let options = {
saveToPhotos: true, saveToPhotos: true,
mediaType: 'photo', mediaType: 'photo',
...@@ -41,7 +49,7 @@ const Camera = ({ navigation }) => { ...@@ -41,7 +49,7 @@ const Camera = ({ navigation }) => {
} }
}; };
const submitPhoto = async (photoUri) => { const submitPhoto = async photoUri => {
try { try {
const formData = new FormData(); const formData = new FormData();
formData.append('file', { formData.append('file', {
...@@ -66,7 +74,6 @@ const Camera = ({ navigation }) => { ...@@ -66,7 +74,6 @@ const Camera = ({ navigation }) => {
} }
}; };
const handleContinue = () => { const handleContinue = () => {
let route; // Variable to store the route name let route; // Variable to store the route name
...@@ -98,13 +105,11 @@ const Camera = ({ navigation }) => { ...@@ -98,13 +105,11 @@ const Camera = ({ navigation }) => {
} else { } else {
// Handle the scenario where prediction or prediction.class is undefined // Handle the scenario where prediction or prediction.class is undefined
// Maybe navigate to an error page or show an alert // Maybe navigate to an error page or show an alert
console.log("No valid prediction available."); console.log('No valid prediction available.');
// navigation.navigate(ROUTES.DEFAULT_ROUTE); // Example fallback // navigation.navigate(ROUTES.DEFAULT_ROUTE); // Example fallback
} }
}; };
return ( return (
<View style={styles.container}> <View style={styles.container}>
<View style={styles.topContainer}> <View style={styles.topContainer}>
...@@ -113,31 +118,49 @@ const Camera = ({ navigation }) => { ...@@ -113,31 +118,49 @@ const Camera = ({ navigation }) => {
<Image style={styles.babyImage} source={IMGS.sk_1} /> <Image style={styles.babyImage} source={IMGS.sk_1} />
<View style={styles.buttonContainer}> <View style={styles.buttonContainer}>
<TouchableOpacity onPress={openGallery} style={[styles.button, styles.buttonLeft]}> <TouchableOpacity
onPress={openGallery}
style={[styles.button, styles.buttonLeft]}>
<Image source={IMGS.sk_3} style={styles.buttonImage} /> <Image source={IMGS.sk_3} style={styles.buttonImage} />
</TouchableOpacity> </TouchableOpacity>
<TouchableOpacity onPress={openCamera} style={[styles.button, styles.buttonRight]}> <TouchableOpacity
onPress={openCamera}
style={[styles.button, styles.buttonRight]}>
<Image source={IMGS.sk_2} style={styles.buttonImage} /> <Image source={IMGS.sk_2} style={styles.buttonImage} />
</TouchableOpacity> </TouchableOpacity>
</View> </View>
{photo && ( {photo && (
<View style={styles.photoContainer}> <View style={styles.photoContainer}>
<Image source={{ uri: photo }} style={styles.photo} /> <Image source={{uri: photo}} style={styles.photo} />
</View> </View>
)} )}
</View> </View>
<Text style={styles.descriptionText}>'Use phone camera or select a photo from the gallery that clearly shows your skin.'</Text> <Text style={styles.descriptionText}>
'Use phone camera or select a photo from the gallery that clearly shows
your skin.'
</Text>
<View style={styles.bottomContainer}> <View style={styles.bottomContainer}>
{loading ? (
<View style={styles.loaderContainer}>
<ActivityIndicator size="large" color={COLORS.primary} />
</View>
) : (
<>
{!prediction && ( {!prediction && (
<> <>
<Text style={styles.resultsHeading}>Results will appear below</Text> <Text style={styles.resultsHeading}>
Results will appear below
</Text>
</> </>
)} )}
{prediction && ( {!loading && prediction && (
<View style={styles.predictionContainer}> <View style={styles.predictionContainer}>
<Text style={styles.predictionText}>Diagnosed Condition | හඳුනාගත් සමේ ආසාදනය: {prediction.class}</Text> <Text style={styles.predictionText}>
<Text style={styles.predictionText}>How sure are we | නිරවද්යතාව: {prediction.confidence}</Text> Diagnosed Condition | හඳුනාගත් සමේ ආසාදනය: {prediction.class}
</Text>
<Text style={styles.predictionText}>
How sure are we | නිරවද්යතාව: {prediction.confidence}
</Text>
</View> </View>
)} )}
<Button <Button
...@@ -145,6 +168,8 @@ const Camera = ({ navigation }) => { ...@@ -145,6 +168,8 @@ const Camera = ({ navigation }) => {
style={styles.nextButton} style={styles.nextButton}
onPress={handleContinue} onPress={handleContinue}
/> />
</>
)}
</View> </View>
</View> </View>
); );
...@@ -170,7 +195,6 @@ const styles = StyleSheet.create({ ...@@ -170,7 +195,6 @@ const styles = StyleSheet.create({
// This creates the curve effect for the background // This creates the curve effect for the background
}, },
buttonContainer: { buttonContainer: {
flexDirection: 'row', flexDirection: 'row',
marginTop: -26, marginTop: -26,
...@@ -225,18 +249,17 @@ const styles = StyleSheet.create({ ...@@ -225,18 +249,17 @@ const styles = StyleSheet.create({
textAlign: 'center', textAlign: 'center',
marginHorizontal: 10, marginHorizontal: 10,
marginBottom: -10, marginBottom: -10,
marginTop:-40 marginTop: -40,
}, },
bottomContainer: { bottomContainer: {
flex: 2, flex: 2,
justifyContent: 'flex-end', justifyContent: 'flex-end',
marginBottom: 2, marginBottom: 2,
marginTop:20, marginTop: 20,
alignItems: 'center', alignItems: 'center',
backgroundColor: COLORS.blue, backgroundColor: COLORS.blue,
borderTopRightRadius: 75, borderTopRightRadius: 75,
borderTopLeftRadius: 75, borderTopLeftRadius: 75,
}, },
nextButton: { nextButton: {
width: '90%', width: '90%',
...@@ -245,13 +268,12 @@ const styles = StyleSheet.create({ ...@@ -245,13 +268,12 @@ const styles = StyleSheet.create({
backgroundColor: COLORS.white, backgroundColor: COLORS.white,
borderRadius: 20, borderRadius: 20,
alignSelf: 'center', alignSelf: 'center',
}, },
photoContainer: { photoContainer: {
elevation: 4, // Android shadow elevation: 4, // Android shadow
shadowColor: '#000', // iOS shadow shadowColor: '#000', // iOS shadow
shadowOffset: { width: 0, height: 2 }, // iOS shadow shadowOffset: {width: 0, height: 2}, // iOS shadow
shadowOpacity: 0.1, // iOS shadow shadowOpacity: 0.1, // iOS shadow
shadowRadius: 2, // iOS shadow shadowRadius: 2, // iOS shadow
borderRadius: 10, borderRadius: 10,
...@@ -276,11 +298,11 @@ const styles = StyleSheet.create({ ...@@ -276,11 +298,11 @@ const styles = StyleSheet.create({
// Add shadows if you like for better visual separation // Add shadows if you like for better visual separation
elevation: 4, // Android shadow elevation: 4, // Android shadow
shadowColor: '#000', // iOS shadow shadowColor: '#000', // iOS shadow
shadowOffset: { width: 0, height: 2 }, // iOS shadow shadowOffset: {width: 0, height: 2}, // iOS shadow
shadowOpacity: 0.1, // iOS shadow shadowOpacity: 0.1, // iOS shadow
shadowRadius: 2, // iOS shadow shadowRadius: 2, // iOS shadow
bottom:75, bottom: 75,
top:-10 top: -10,
}, },
resultsHeading: { resultsHeading: {
fontSize: 16, fontSize: 16,
...@@ -289,18 +311,20 @@ const styles = StyleSheet.create({ ...@@ -289,18 +311,20 @@ const styles = StyleSheet.create({
padding: 10, padding: 10,
textAlign: 'center', textAlign: 'center',
marginBottom: 90, marginBottom: 90,
marginLeft:0 marginLeft: 0,
}, },
resultImage: { resultImage: {
width: 100, // Set your desired width width: 100, // Set your desired width
height: 100, // Set your desired height height: 100, // Set your desired height
alignSelf: 'center', alignSelf: 'center',
marginVertical: 20, // Adjust margin as needed marginVertical: 20, // Adjust margin as needed
}, },
loaderContainer: {
}); flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
});
export default Camera; export default Camera;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment