how to use images in full background?
See original GitHub issuehow to set image in the background as a full image? I tried to use renderItem method for that, but it’s showing a blank screen.
------- Code ----------
import intro1 from '../../assets/images/intro1.png';
import intro2 from '../../assets/images/intro2.png';
import intro3 from '../../assets/images/intro3.png';
import intro4 from '../../assets/images/intro4.png';
import intro5 from '../../assets/images/intro5.png';
import logo from '../../assets/images/logo.png';
const styles = StyleSheet.create({
mainContent: {
flex: 1,
alignItems: 'center',
justifyContent: 'space-around',
},
image: {
width: 320,
height: 320,
},
text: {
color: 'rgba(255, 255, 255, 0.8)',
backgroundColor: 'transparent',
textAlign: 'center',
paddingHorizontal: 16,
},
title: {
fontSize: 22,
color: 'white',
backgroundColor: 'transparent',
textAlign: 'center',
marginBottom: 16,
},
});
const slides = [
{
key: 'somethun',
title: 'Quick setup, good defaults',
text:
'React-native-app-intro-slider is easy to setup with a small footprint and no dependencies. And it comes with good default layouts!',
icon: logo,
backgroundImage: intro1,
},
{
key: 'somethun1',
title: 'Super customizable',
text:
'The component is also super customizable, so you can adapt it to cover your needs and wants.',
icon: logo,
backgroundImage: intro2,
},
{
key: 'somethun2',
title: 'No need to buy me beer',
text: 'Usage is all free',
icon: logo,
backgroundImage: intro3,
},
];
export default class App extends React.Component {
_renderItem = props => (
<ImageBackground
style={[
styles.mainContent,
{
width:'100%',
height: '100%',
},
]}
source={props.backgroundImage}
>
<Image
source={props.icon}
style={styles.image}
/>
<View>
<Text style={styles.title}>{props.title}</Text>
<Text style={styles.text}>{props.text}</Text>
</View>
</ImageBackground>
);
render() {
return (
<AppIntroSlider
slides={slides}
renderItem={this._renderItem}
bottomButton />
);
}
}
Hmm… Render function is not empty, is not showing properly. Just updating the code of render function.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:18 (7 by maintainers)
Top Results From Across the Web
Perfect Full Page Background Image - CSS-Tricks
One rather simple way to handle this is to put an inline image on the page, fixed position it to the upper-left, and...
Read more >How To Create a Full Page Image - W3Schools
Learn how to create a full page background image with CSS. Full Page Image. Learn how to create a background image that covers...
Read more >CSS Background Image Size Tutorial – How to Code a Full ...
This tutorial will show you a simple way to code a full page background image using CSS. And you'll also learn how to...
Read more >CSS Make Background Image Full Screen - SoftAuthor
Add an image as a background of an HTML element then resizing and positioning the background image to make it full screen.
Read more >How to Make HTML Background Image Full Screen? - Scaler
The CSS background-size property has been used to make the HTML background image full-screen. · An element's background image is controlled by ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Whoops my bad. Try this:
Wow Awesome! It’s working now! Thank you so much, @Jacse Appreciated!