diff --git a/android/src/main/java/io/invertase/firebase/firestore/FirestoreSerialize.java b/android/src/main/java/io/invertase/firebase/firestore/FirestoreSerialize.java index d665ed6a..b4929ee5 100644 --- a/android/src/main/java/io/invertase/firebase/firestore/FirestoreSerialize.java +++ b/android/src/main/java/io/invertase/firebase/firestore/FirestoreSerialize.java @@ -7,6 +7,7 @@ import com.google.firebase.firestore.DocumentChange; import com.google.firebase.firestore.DocumentSnapshot; import com.google.firebase.firestore.QuerySnapshot; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -146,7 +147,7 @@ public class FirestoreSerialize { writableArray.pushMap((objectMapToWritable((Map) item))); } else if (itemClass == Arrays.class) { writableArray.pushArray(objectArrayToWritable((Object[]) item)); - } else if (itemClass == List.class) { + } else if (itemClass == List.class || itemClass == ArrayList.class) { List list = (List) item; Object[] listAsArray = list.toArray(new Object[list.size()]); writableArray.pushArray(objectArrayToWritable(listAsArray)); @@ -185,7 +186,7 @@ public class FirestoreSerialize { map.putMap(key, (objectMapToWritable((Map) value))); } else if (valueClass == Arrays.class) { map.putArray(key, objectArrayToWritable((Object[]) value)); - } else if (valueClass == List.class) { + } else if (valueClass == List.class || valueClass == ArrayList.class) { List list = (List) value; Object[] array = list.toArray(new Object[list.size()]); map.putArray(key, objectArrayToWritable(array)); diff --git a/tests/src/tests/firestore/documentReferenceTests.js b/tests/src/tests/firestore/documentReferenceTests.js index 11166366..e527c226 100644 --- a/tests/src/tests/firestore/documentReferenceTests.js +++ b/tests/src/tests/firestore/documentReferenceTests.js @@ -249,7 +249,7 @@ function collectionReferenceTests({ describe, it, context, firebase }) { it('should create Document', () => { return firebase.native.firestore() .doc('document-tests/doc2') - .set({ name: 'doc2' }) + .set({ name: 'doc2', testArray: [] }) .then(async () => { const doc = await firebase.native.firestore().doc('document-tests/doc2').get(); doc.data().name.should.equal('doc2');