Save button
In this section, we will create a button in the upper-right corner of the navigation bar that is labeled as Save
. When it is tapped on, the following two things must happen:
- The changes the user made to the to-do item (such as its name, completion status, and due date) must be saved to
AsyncStorage
, overwriting its previous details - The
TasksList
must be updated so that the user visually sees the changes they made right away
Rendering the Save
button is easy with React Native. The object that gets pushed to NavigatorIOS
needs to receive the following two key/value pairs:
rightButtonTitle
: This is a string that renders the text shown in that areaonRightButtonPress
: This is a callback that is fired when that button is pressed
At face value, this looks simple. However, we can't pass any information to the onRightButtonPress
method of NavigatorIOS
from a rendered child. Instead, we have to keep a copy of the changes we make inside our TasksList
component as well, and update them as the...