Skip to content
This repository has been archived by the owner on May 29, 2020. It is now read-only.

Set image resizeMode #14

Open
ardynugraha opened this issue Aug 6, 2018 · 1 comment
Open

Set image resizeMode #14

ardynugraha opened this issue Aug 6, 2018 · 1 comment

Comments

@ardynugraha
Copy link

ardynugraha commented Aug 6, 2018

how to set image resizeMode? And also set container height to full screen but keep image width not overflow or cropped. thanks

@hungga1711
Copy link

hungga1711 commented Sep 16, 2018

I'm new in react-native. My English is very bad. I hope you understand me.
I insert resizeMode={this.props.resizeMode} into 2 Image tag on about line 210 in Slideshow.js.
It's worked for me.
About resizeMode, reference: https://facebook.github.io/react-native/docs/image#resizemode

This is my change in Slideshow.js :
const imageComponent = ( <View key={index}> <Image source={imageObject} style={{ height, width }} resizeMode={this.props.resizeMode} /> {textComponent} </View> ); const imageComponentWithOverlay = ( <View key={index} style={styles.containerImage}> <View style={styles.overlay}> <Image source={imageObject} style={{ height, width }} resizeMode={this.props.resizeMode} /> </View> {textComponent} </View> );

In my class, i called it:
<Slideshow dataSource={this.state.dataSource} position={this.state.position} onPositionChanged={position => this.setState({ position })} height={Dimensions.get("window").height} resizeMode="contain" />

Hope it useful to you.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants