[Image] Resizing image with Animation (with resizeMode="cover") is glitchy
See original GitHub issueYou can see the issue here:
Video of Issue (if gif is not clear): http://s.sk3vy.com/cCZ0
(you can see that it glitches a little bit as it resizes)
Code-wise, all I’m doing is doing:
Animated.parallel([
Animated.spring(
this.state.imageOverlay.position, {
toValue: { x: 0, y: 0 },
friction: 20,
tension: 220
}),
Animated.spring(
this.state.imageOverlay.size, {
toValue: { x: this.screenWidth, y: this.screenHeight },
friction: 20,
tension: 220
})
]).start();
Nothing out of the ordinary there.
In debugging this issue…it seems it may have something to do with this:
When I don’t reload the image (comment out line 175), it’s smooth as butter, as you might expect. Obviously that’s not a solution here, but I think it does give insight into the problem.
It seems like it would be good to somehow (perhaps optionally) defer the reloading and resampling of the image until after an animation has completed.
Issue Analytics
- State:
- Created 8 years ago
- Comments:20 (11 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 force an image to be full width and maintain aspect ...
My use was very similar in that I needed to display an image with full screen width but maintaining its aspect ratio. Based...
Read more >Resize image proportionally with CSS - GeeksforGeeks
The resize image property is used in responsive web where image is resizing automatically to fit the div container.
Read more >object-fit - CSS: Cascading Style Sheets - MDN Web Docs
object-fit: scale-down; ... cover. The replaced content is sized to maintain its aspect ratio while ... Setting object-fit for an image ...
Read more >react-native-fast-image - npm
FastImage, performant React Native image component. ... resizeMode.cover (Default) - Scale the image uniformly (maintain the image's aspect ...
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
awesometown population: nicklockwood
@nicklockwood new code works flawlessly with my use-case. It’ll make it into the next app store update. Thanks! 👍