0

when I run the following code the result is a blank screen!

render() {
    let num = 0, Qs = [Q1, Q2, Q3, Q4, Q5, Q6];
    console.log('hey');
    return <View>
        {Qs.forEach(q => {
            console.log('hey there');
            return <View>
                <Text>asdf</Text>
            </View>})
        }
    </View>
}

but the console gets one 'hey' with 6 'hey there' following. weird!

P.S. previously this problem happened while using 'forEach' on an array, then I changed the 'forEach' to 'map' and it was solved.

P.S. 2: do you recommend me to issue a bug report on react-native at GitHub?

3
  • can you share AnswerCard Component? Commented Jul 30, 2017 at 10:41
  • the problem occurs even without the 'answerCard' component. Actually, I didn't want to post it in the question, so I change the question. Commented Jul 30, 2017 at 10:46
  • 1
    Possible duplicate of React js component, map works, foreach doesn't Commented Jul 30, 2017 at 13:16

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.