Get the actual array of rows from SQL query with sqlite and Expo
As per the Expo document, the result.rows
has an _array
which returns all the items as array, you can try like
if (result && result.rows && result.rows._array) { /* do something with the items */ // result.rows._array holds all the results.}
Hope this will help!
TypeScript Solution to cast _array properly without using any ;)
tx.executeSql("SELECT * FROM ITEMS", [], (_, { rows }) => { const r = rows as unknown as { _array: MyItem[] }; result = r._array;});