Skip to content
Snippets Groups Projects
Commit 2c6f197c authored by HARTZ HENRI's avatar HARTZ HENRI
Browse files

feat: allow image and text

parent 558c3f2f
Branches
2 merge requests!134Feature/122 answer with image,!132V4.0
import {TouchableOpacity, Text, StyleSheet, View} from "react-native";
import {TouchableOpacity, Text, StyleSheet, View, Image} from "react-native";
import {ButtonsStyles} from "../../styles/ButtonsStyles";
import {TextsStyles} from "../../styles/TextsStyles";
......@@ -23,10 +23,21 @@ export default function AnswerButton({text, handleButtonPressed, buttonStyle, bu
<TouchableOpacity onPress={handleButtonPressed} style={[styles.defaultButton,buttonStyle]}>
{indicator !== undefined && (
<View style={styles.indicator}>
<Text style={styles.indicatorText}>{indicator}</Text>
<Text style={styles.indicatorText}>{indicator}</Text>
</View>
)}
<Text style={[TextsStyles.defaultButtonText, buttonText]}>{text}</Text>
{
text.includes('data:image') ?
<Image
style={[styles.answerImage]}
source={{uri: text}}
/>
:
text.includes('data:sound') ?
''
:
<Text style={[TextsStyles.defaultButtonText, buttonText]}>{text}</Text>
}
</TouchableOpacity>
</View>
)
......@@ -63,5 +74,9 @@ const styles = StyleSheet.create({
display: 'flex',
alignItems: 'center',
justifyContent: 'center'
}
},
answerImage: {
width: '100%',
height: '100%',
},
})
\ No newline at end of file
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