O'Reilly logo

React Native By Example by Richard Kho

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Saving expenses

The next step is to allow entries to be saved to the app. Let's modify AddExpensesModal again and add the following features; you will also need to add some methods into storageMethods as well as the AddExpenses component:

  • A button to save the expense, with the following conditions:
    • It should only be enabled if all the fields of the modal are filled out.
    • When pressed, the expense name, amount, and date should be saved into AsyncStorage.
    • The date should be formatted with Moment the same way we formatted it for the ExpandableCell title.
    • When this logic finishes, the modal should be closed and the information entered should be cleared. The closing of the modal should be passed in as a prop from the parent AddExpenses component ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required