React Native Reusable Component : Create a Reuseable TextInput with Validation Support using Formik

Adesina Mark
By -
0

 One of the benefits of ReactJs is the ability it gives developers to build and reuse components. In this article, I will walk you through how to build a reusable TextInput component with validation support using React Native Tailwind CSS, Formik, and Yup in React Native.


Creating React Native App

To create a react native app using expo, run the command below:

create-expo-app-react-native

Install Dependencies

We will be using a couple of dependencies in the article, let's install them once.

react-native-yup-formik-tailwind-css-install


I won't be covering how to configure react native tailwind CSS in this article, if you do not know how this can be done, I have an article that shows how this can be done here.


Creating the InputComponent and Login Screen

Create two folders at the root of the project namely components and screens, add a file within the component folder and name it CustomTextInput.jsx, and another file within the screens folder named Login.jsx. Modify the CustomTextInput component like below:

Post a Comment

0Comments

Post a Comment (0)