For users to delete expenses from any month, we need to do the following things:
- Add a method to
storageMethods
to update anexpenses
object. It should accept the month, year, and array of expenses. Then, it should override the array of expenses for that specific month and year combination inAsyncStorage
with this new array, and recalculate the amount spent. - Wrap a
TouchabbleHighlight
component around each row that, when long pressed, opens an alert that asks the user whether they wish to delete the item. - If the user confirms that they would like to delete the item, then we should delete it. A new array of expenses for the current month should be created without the deleted item, and it should be saved using the
storageMethods
function we made. - When an expense is deleted, we should update the current view to reflect the item being deleted and the updated spent amount.
- If the user cancels, the alert should close and no changes should be made.
Take some time to build this feature...