Add resizeMode and other options
See original GitHub issueCould we pass other image attributes through to the image, things like resizeMode
.
https://facebook.github.io/react-native/docs/image.html
<ImageSlider
images={this.state.imageMap}
position={this.state.imagePosition}
onPositionChanged={(imagePosition) => this.imagePositionChanged(imagePosition)}
height={150}
resizeMode="contain" // ! <--- Like this
/>
something like this? - Is there a better way to pass only the props we need, I tried spreading all the props, but this causes issues.
This works here:
https://github.com/PaulBGD/react-native-image-slider/blob/master/ImageSlider.js#L150
resizeMode={this.props.resizeMode}
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Understanding “resizeMode” in React Native | by Mehran Khan
There are different options in Image “reiszeMode” ('cover', 'contain', 'stretch', 'repeat', 'center'). It can be tricky which one to use if you does...
Read more >How to put ImageBackground with resizeMode set to "contain ...
My issue is that the image is vertical aligned at the center with the code I shown above while I would like it...
Read more >Image - React Native
A React component for displaying different types of images, including network images, static resources, temporary local images, and images ...
Read more >Some styles props React Native ex: resize-mode #221 - GitHub
I have a warn with resize-mode in Native: Unknown property: 'resize-mode' Thanks.
Read more >react-native-video - npm
Will support more formats in the future through options; Will support custom directory and file name through options. Platforms: iOS ...
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
I went ahead and made some tweaks to the file in the node_modules…
It requires react-native-fit-image (https://github.com/huiseoul/react-native-fit-image)
It also removes the bullets if you only have one image to display… therefore it’s a good option for a global header plugin…
If you go in and replace the current content of your ImageSlider.js file within node_modules/react-native-image-slider/ with:
In the last update I add support of custom slides, so you basically can customize your image any way you want. I believe this fixes the issue. Closing it for now.