Setup
- Create a new Expo project
- Install eslint and prettier
- Run the app on your phone
- Try to run your app on a simulator
Exercise 1 : Forms and Validation
Objective: To understand and implement forms with validation in React Native with Expo. You'll be creating a form with several fields and their respective validations.
Create a form with the following fields:
- Name - Text input (required, should contain only characters, with a minimum of 3 characters)
- Date of Birth - Date picker (required, should not be a future date) - You can use
@react-native-community/datetimepicker - Age - This field should be automatically calculated based on the Date of Birth input - Should be a disabled input
- Number of Pets - A number input field (should contain only digits) - Optional
- I'm a great React Native developer (Yes/No) - Implement this using a Switch component
- I understand the rules of the project and I'll do my best - Implement this using a Checkbox component
expo-checkbox- This should be checked before the form can be submitted
Add a button at the bottom of the screen. The button should be disabled if the required information is not provided.
On submit, the info should be displayed through an Alert component.
Exercise 2 : Context
Create a new screen called DetailsScreen. On submit of the form, you should navigate to this new screen and, without passing route parameters, display the info of the form.
Exercise 3 : useReducer
Refactor your code using useReducer as seen in the course https://react.dev/learn/scaling-up-with-reducer-and-context