react-native-slideshow icon indicating copy to clipboard operation
react-native-slideshow copied to clipboard

Set image resizeMode

Open ardynugraha opened this issue 7 years ago • 1 comments

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

ardynugraha avatar Aug 06 '18 04:08 ardynugraha

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.

hungga1711 avatar Sep 16 '18 06:09 hungga1711