Android interpolate color - Attempt to invoke virtual method 'int java.lang.Double.intValue()' on a null object reference
See original GitHub issueDescription
I’m attempting to combine useAnimatedProps and interpolateColor with react-native-linear-gradient, everything works fine on iOS, however on Android I seem to get an exception.
I don’t think this is a react-native-linear-gradient issue to be clear, it looks like setProps sends null values even though the JS thread reports them as not being null;
// JS
11-18 09:46:50.445 12090 12298 I ReactNativeJS: { colors: [ -16763747, -14621774, -14024762 ] }
Native @ReactProp(name=PROP_COLORS)
11-18 09:46:50.469 12090 12090 I System.out: [null,null,null]
Working version on iOS

Attempt to invoke virtual method 'int java.lang.Double.intValue()' on a null object reference
11-18 09:10:52.905 7892 7892 E unknown:ReactNative: at com.facebook.react.bridge.ReadableNativeArray.getInt(ReadableNativeArray.java:97)
11-18 09:10:52.905 7892 7892 E unknown:ReactNative: at com.BV.LinearGradient.LinearGradientView.setColors(LinearGradientView.java:51)
11-18 09:10:52.905 7892 7892 E unknown:ReactNative: at com.BV.LinearGradient.LinearGradientManager.setColors(LinearGradientManager.java:35)
11-18 09:10:52.905 7892 7892 E unknown:ReactNative: ... 23 more
Steps To Reproduce
Expected behavior
Animation works.
Actual behavior
App crashes with above exception. It looks like however reanimated v2 sets props on android, it results in sending [null,null,null].
Package versions
"react-native": "0.63.3",
"react-native-linear-gradient": "^2.5.6",
"react-native-reanimated": "^2.0.0-alpha.9",
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (8 by maintainers)
Top Results From Across the Web
Attempt to invoke virtual method 'int.java.lang.Integer.intValue ...
writeInteger() method, you're going to have to record whether or not id is null in a separate write. Something like: if (id ==...
Read more >Canvas - Android Developers
Usage with a hardware accelerated canvas requires an internal copy of color buffer contents every time this method is called. Using a Bitmap...
Read more >attempt to invoke virtual method react native - You.com
The error clearly mentions that android.database.Cursor android.database.sqlite.SQLiteDatabase.query(java.lang.String, java.lang.String[], java.lang.
Read more >resource leak in java Code Example - Code Grepper
Resource leak: 'Object' is never closed Type Object = new Type(); Object.doSomething(); Object.close() //This is to ensure that the object is clossed to ......
Read more >Groovy Language Documentation
Groovy lets you instantiate java.lang.String objects, as well as GStrings ( groovy.lang.GString ) which are also called interpolated strings in other ...
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

If you have your doubts, you can open a new issue with the question about what bothers you. Here we wanted to find out why the app crashes.
Thanks for cooperation and quick replies, best regards ✌️
Ok sure I guess this can be closed, I think I’m still a bit confused as to why I had to run Android prop updates via state / runOnJS (essentially an infinite loop as you say) rather than useAnimatedProps but I guess this could be react-native-linear-gradient side rather than reanimated.
Ok will just do some more figuring out, thanks.