lottie-react-native: Android doesn't scale
If we have an asset, say, with 1080x1920 dimensions. This will be the max size of the animation. With ios we can scale using the style prop.
Shall we export from bodymovin ina different way?
Why isn’t a scale prop for lottie. Becuase, for Android it not possible right now. And for ios is very easy to break the aspect ratio using style.
Hope someone answers this time 😞
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 8
- Comments: 16
Yes, resizeMode=‘cover’ fixed the Android size issue for me as well. 🎉
For iOS, provide
widthandheightin the style obj. For android, addflexGrow: 1andaspectRatio: width / height(or in a way that does not mess up iOS). Good luck!@peal This does not seem solved for me. As soon as I set the width or height larger than the screen dimensions in Android (which works perfectly fine on iOS), the animation does not show up at all. I tried several
resizeModeconfigurations – but this did not help.The following works fine on iOS, but not on Android. Would be great if anybody has a hint.
I think the above will solve this. Feel free to reopen if it doesn’t.
@dvolland The sizes are dps on Android which means they’ll be ~2.6x the number of pixels on an average Android device. If your animation is that large, Android will try and allocate a backing buffer that’s 4800x30,000 pixels which is larger than it can and it will silently fail. It may log to logcat though so check that. can you make your animation smaller?
Using resizemode=“cover”, I’ve found a solution to not make it look blurry on Android. Increasing the size of the animation in the json file.
experiencing the same issue with blurry lottie view on Android