Onboarding
Last updated
Last updated
Here's a guide on how to add an onboarding screen to the onboarding flow. All of the components are already defined for you. Just duplicate one of the examples to get started.
This example will walk you through adding a form step that askss for the user's age
In OnboardingProvider.tsx
, there's a type called OnboardingInfo
. Add the field you want to collact data for. In this case, age.
In the same file, set the initial value of age. It could be an empty string, or some initial value
Create your onboarding form screen by copying one of the existing ones
All the examples are located in components/pages/onboarding.
Duplicate the file based on the instructions below. In this example, we'll use TextInput, but the same steps apply for any form step
Duplicate the file and name it something appropriate. In this case, I'll name it ExampleAge.tsx
Also, rename the component in the new file
Open the file app/content/onboarding/index.tsx
. This is where the onboarding form is located. Add your component to the steps
variable.
Go back to your component (components/pages/onboarding/ExampleAge.tsx
) and change the values as needed
First, update the key variable to the field you created in step 1. This tells us which field in the onboarding data this screen is targeting
Next, update the title and subtitle as needed
Optionally, you can add validation to the input if needed
Now , you can access your onboarding data using the hook
You can also create your own custom onboarding compoennts if the included ones don't meet your needs
To reset the onboarding information, you can reset the local storage through a buttin in the settings page of the app.
Or run this line of code: and refresh the app