Skip to content

Commit

Permalink
rearrenged detected Barcodes in Result View
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas committed Apr 15, 2019
1 parent 6e23208 commit 4b753da
Showing 1 changed file with 51 additions and 34 deletions.
85 changes: 51 additions & 34 deletions example/RNExampleApp/src/Result.js
Original file line number Diff line number Diff line change
@@ -1,52 +1,62 @@
import React from 'react';
import {Button, Image, ScrollView, StyleSheet, Text, View, Dimensions} from 'react-native';
import { Button, Image, ScrollView, StyleSheet, Text, View, Dimensions } from 'react-native';

export default function Result({
result,
imagePath,
fullImagePath,
emptyResult,
currentScanMode,
}) {
let fullImage = (<View/>);
let fullImageText = (<View/>);
result,
imagePath,
fullImagePath,
emptyResult,
currentScanMode,
}) {
let fullImage = (<View />);
let fullImageText = (<View />);
if (fullImagePath && fullImagePath != '') {
fullImage = (
<Image
style={styles.image}
resizeMode={'contain'}
source={{uri: `file://${fullImagePath}`}}
/>);
<Image
style={styles.image}
resizeMode={'contain'}
source={{ uri: `file://${fullImagePath}` }}
/>);
fullImageText = (
<Text style={styles.text}>Full Image:</Text>
<Text style={styles.text}>Full Image:</Text>
);
}

return (
<View style={styles.container}>
<ScrollView contentContainerStyle={styles.scrollContainer} >
<View style={styles.container}>
<ScrollView contentContainerStyle={styles.scrollContainer} >

{fullImageText}
{fullImage}
{fullImageText}
{fullImage}

<Text style={styles.text}>Cutout:</Text>
<Image
style={styles.image}
resizeMode={'contain'}
source={{uri: `file://${imagePath}`}}
/>
{Object.keys(result).map((value, key) => {
return (<Text style={styles.text} key={`Result_Text_${key}`}>
<Text style={styles.text}>Cutout:</Text>
<Image
style={styles.image}
resizeMode={'contain'}
source={{ uri: `file://${imagePath}` }}
/>
{Object.keys(result).map((value, key) => {
return (value === 'detectedBarcodes') ? (
<View>
<Text style={styles.headline}>Detected Barcodes</Text>
{result[value].map((valueBar, keyBar) =>
(<View key={`Result_Text_${keyBar}`}>
<Text style={styles.text} >Format: {valueBar.format}</Text>
<Text style={styles.text} >Value: {valueBar.value}</Text>
</View>))}
</View>)
:
(<Text style={styles.text} key={`Result_Text_${key}`}>
{(value !== 'confidence' || result[value] > 0) &&
`${value}: ${result[value]}`
`${value}: ${result[value]}`
}
</Text>);
})}
<View style={styles.backButton}>
<Button title={'Back'} onPress={emptyResult}/>
</View>
</ScrollView>
</View>
})}
<View style={styles.backButton}>
<Button title={'Back'} onPress={emptyResult} />
</View>
</ScrollView>
</View>
);
}

Expand All @@ -65,6 +75,13 @@ const styles = StyleSheet.create({
marginBottom: 50,
marginTop: 50,
},
headline: {
fontWeight: "bold",
color: "white",
marginTop: 20,
fontSize: 15,
justifyContent: 'center',
},
text: {
color: "white",
justifyContent: 'space-around',
Expand Down

0 comments on commit 4b753da

Please sign in to comment.