Italo Rodrigo
Italo Rodrigo

Reputation: 1785

View is not showing on screen

I have the code below:

<ImageBackground style={{flex:1, width: null, height: null}} source={require('../img/bg.png')}>

  <View style={{flex:1, backgroundColor:'red'}}>
  </View>

  <View style={{flex:1, backgroundColor:'yellow'}}>
    <Text style={{fontSize:40}}>RESULTADOS</Text>
  </View>

  <View style={{flex:6, backgroundColor:'red'}}>
    <ScrollView style={{flex:1, backgroundColor:'blue'}}>

      <View style={{flex:1, backgroundColor:'white'}}>
      //THIS NOT SHOW
      </View>

      <View style={{flex:1, backgroundColor:'green'}}>
      //THIS NOT SHOW
      </View>

    </ScrollView>
  </View>

</ImageBackground>

The View whit background color white and green is not showing on the screen.

Anybody help?

Upvotes: 0

Views: 522

Answers (1)

Rafael Motta
Rafael Motta

Reputation: 2537

TheScrollView component has a special prop to set style for the content. It's the contentContainerStyle

Instead of using

 <ScrollView style={{flex:1, backgroundColor:'blue'}}>

Just use

 <ScrollView contentContainerStyle={{flex:1, backgroundColor:'blue'}}>

Click here to get more details.

Upvotes: 1

Related Questions