Problem
When building a React Native 0.80 project with lottie-react-native version 7.2.2, the build fails with the following Kotlin compilation errors:
> Task :lottie-react-native:compileDebugKotlin FAILED
e: file:///path/to/node_modules/lottie-react-native/android/src/main/java/com/airbnb/android/react/lottie/LottieAnimationViewPropertyManager.kt:249:26
Initializer type mismatch: expected 'Int', actual 'Int?'.
e: file:///path/to/node_modules/lottie-react-native/android/src/main/java/com/airbnb/android/react/lottie/LottieAnimationViewPropertyManager.kt:250:13
Type mismatch: inferred type is 'Int?', but 'Int' was expected.
Environment
- React Native: 0.80
- lottie-react-native: 7.2.2
- Platform: Android
- Build tool: Gradle/Kotlin
Root Cause
The issue occurs in the parseColorFilter method of LottieAnimationViewPropertyManager.kt. The problem is that ColorPropConverter.getColor() now returns a nullable Int? type, but the code expects a non-nullable Int.
This is due to React Native 0.80's updated APIs becoming more null-safe, while the lottie-react-native library hasn't been updated to handle the new type signatures.