react image background example

Example 1: react background image

style={{  
  backgroundImage: "url(" + "https://images.pexels.com/photos/34153/pexels-photo.jpg?auto=compress&cs=tinysrgb&h=350" + ")",
  backgroundPosition: 'center',
  backgroundSize: 'cover',
  backgroundRepeat: 'no-repeat'
}}

Example 2: react native background image

return (
  <ImageBackground source={...} style={{width: '100%', height: '100%'}}>
    <Text>Inside</Text>
  </ImageBackground>
);

Example 3: add background image react native

return (
  <ImageBackground source={...} style={{width: '100%', height: '100%'}}>
    ......All Children tags
  </ImageBackground>
);

Tags:

Css Example