I have a case where I want to insert a List in the WritableArray and send it to React-Native but for some reason, it doesn't work, I don't receive anything back in RN:
public static List<Native_DataList> Native_Data = new ArrayList<>();
The reason why I am using WriteableArray is because that's the only way to transport data from Native to React-Native.
@ReactMethod
public void getData(Callback callback){
if(!Native_Data.isEmpty()){
WritableArray nativeArray = Arguments.fromList(Native_Data); //this doesnt work
callback.invoke(nativeArray);
}
}
It fails with this error: Unknown value type class com.myprojectname.KeepAliveService$Native_DataList
I am doing exactly the same thing in another case but I am using ArrayList instead and works:
public static ArrayList<String> jsonArray = new ArrayList<>();
And this is the function being called from React-Native:
@ReactMethod
public void getData(Callback callback) {
ArrayList<String> jsonArray = jsonArray ;
WritableArray nativeArray = Arguments.fromList(jsonArray);
callback.invoke(nativeArray);
}
Any suggestions?!