3.3 Task Create Screen
We also need a screen to create a new task.
Step 1: Create Route
Similar to the previous section, now we create our third route. Notice that I have now moved the routes array dedicated file, to keep to code readable.
export const routes = [
{
name: 'CreateTask',
screen: 'CreateTaskScreen',
path: 'create',
exact: true,
options: {
title: 'Create Task',
},
},
{
name: 'EditTask',
screen: 'EditTaskScreen',
path: 't/:taskId',
exact: true,
options: {
title: 'Edit Task',
},
},
{
name: 'TasksApp',
screen: 'PendingTasksScreen',
path: '',
exact: false,
options: {
title: 'My Tasks',
},
}];Import this array to your plugin file:
This should create the third route, which should be accessible via the following URL:
Step 2: Create a Button to Navigate
But we still need a way to navigate to this route in our UI. This time we will add an icon button in the header.
Create the following component:
Also, create an index file to export the component:
Step 3: Add Button in Header
To add our new TaskCreateButton to the screen, add the headerRight property in the route options like so:
That's it, run your app to test it out.


Last updated
Was this helpful?