title: How to use ImageBackground to set background image for screen in react-native
body: <p>When I use  in react-native it gives warning that using  with children is deprecated and will be error in future. User  instead.</p>
  
  <p>So,
  If I use  it doesn't give expected result which I was getting using </p>
  
  <p>Here is the code I wrote for using </p>
  
  <pre><code>&lt;ImageBackground source={require('../../img/splash/splash_bg.png')} style={styles.backgroundImage} &gt;
          &lt;/ImageBackground&gt;
  </code></pre>
  
  <p>And style code is </p>
  
  <pre><code>const styles = StyleSheet.create({
  backgroundImage: {
      flex: 1,
      // width: undefined,
      // height: undefined,
      // flexDirection: 'column',
      // backgroundColor:'transparent',
      // justifyContent: 'flex-start',
  
  
  },}
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/dgTPz.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/dgTPz.jpg" alt="Expected result: getting when using &lt;Image&gt;"></a>
  <a href="https://i.stack.imgur.com/XdEVZ.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/XdEVZ.jpg" alt="Result using &lt;ImageBackground&gt;"></a></p>