React Native User Registration With PHP MySQL Android iOS Tutorial

User registration is a simple process to register some particular user information on server, which will be used again when user trying to Log-in into application. Like User Name, Password, Email etc. So in this tutorial we would going to create an react native android and iOS application with complete user registration process on our online hosting server using PHP MySQL. This type of application also known as API.

Database used in this tutorial : MySQL

Server Side scripting Language used in this tutorial : PHP

Important Note : This code is working correctly in both Android and iOS devices. So feel free to create your own User Registration Authentication application for Android and iOS using my this tutorial .

Contents in this project React Native User Registration With PHP MySQL :

1. Create a Database + Table on your hosting server : 

Create a database on your MySQL server, then Create a fresh table inside the database. The table name should be UserRegistrationTable . Add 4 columns inside the table idnameemail, password.


2. Create PHP Script to insert user registration information received from App into MySQL database :

Create 2 PHP files DBConfig.php and user_registration.php .

DBConfig.php : This file contains the MySQL database hostname, database name, database password and database username.

user_registration.php : This file receive the user registration information and insert that info into MySQL database.

Code for DBConfig.php file :

Code for user_registration.php file :

3. Start a fresh React Native project. If you don’t know how then read my this tutorial.

4. Add AppRegistry, StyleSheet, TextInput, View, Alert, Button, Text component inside the import block.

5. Create constructor.

Create a constructor in your Main Class with props parameter. Now declare three variables UserName: ‘ ‘, UserEmail: ‘ ‘ and UserPassword: ‘ ‘ with empty values using this.state.

6. Create function named as UserRegistrationFunction() to send the Text Input data on server.

7. Create custom css class named as MainContainer and TextInputStyleClass just above the AppRegistry.registerComponent line.

8. Add View as parent view in render’s return block and Call the MainContainer class into View.

9. Add 3 Text Input and 1 Button and 1 Text component inside the View .

placeholder = Shows hint inside the Text Input.

onChangeText = Every time when user type anything in Text Input it will store the entered value in state variable.

underlineColorAndroid = Hide the Text Input base line.

style = Used to call css class.

onPress = Call the UserRegistrationFunction() function on button onPress.

10. Complete source code for index.android.js / index.ios.js file.

Screenshots in iOS device :

Screenshot in Android Device :

User Registration Screenshot of MySQL database table after user registration :