My output of following code is blank. I am not able to figure it out why question is not printed or even answer buttons.
Tried checking various answers and changing call methods. No error is shown in code.
const datas = [
{
id: 1,
text: "Question 1",
ans: [
{
id: 1,
name: "Ans 1",
},
{
id: 2,
name: "Ans 2",
}
]
},
{
id: 2,
text: "Question 2",
ans: [
{
id: 1,
name: "Ans 1",
},
{
id: 2,
name: "Ans 2",
}
]
},
{
id: 3,
text: "Question 3",
ans: [
{
id: 1,
name: "Ans 1",
},
{
id: 2,
name: "Ans 2",
}
]
}
]
;
return (
<View style={styles.container}>
<Text> Question 1</Text>
<View style={styles.cardContainer}>
<View style={styles.card}>
{datas.map((data) => {
<Text style={styles.quesText}> {data.text} </ Text>
{ data.ans.map((answ) => {
<TouchableOpacity style={styles.choiceButton} onPress={ () => this.props.navigation.navigate('Quiz')}>
<Text style={styles.buttonText}>{answ.name}</Text>
</TouchableOpacity>
})}
})}
</View>
</View>
</View>
)
}}
It should show: Question 1
and two buttons with Ans 1 and Ans 2