WhatsApp clone is created using React Native framework. It connects to the PostgreSQL database using Hasura Data API's. It demonstrates a full-fledged mobile app that works exactly like WhatsApp Android version. In this app, the frontend is developed using React and backend part is developed using Hasura API's which can be easily replaced by Node.js endpoints.
Screenshots of WhatsApp app -
This is the default tab of the mobile app that gets displayed by default when we open the WhatsApp. This tab shows the history of chats with our contacts sorted according to the date.
- js/Chats.js :
- In this file, we created Chats as view component that needs to be rendered as part of Chats tab.
- In componentDidMount() lifecycle method of Chats component, we retrieved chats data from the database using fetch(URL, requestOptions) method.
- If fetch() retrieves data successfully, we parsed the result into ListView component of React Native
- In render(), we displayed ListView component with each row from ChatRow component.
- js/ChatsRow.js :
- This component represents each row in the chats list.
- Each chat row is fetched from the database by filtering it userId and corresponding msgId.
- Then we displayed each row with corresponding user profile picture, message first line and also timestamp of the message.
This tab shows the history of calls with user contacts sorted according to the date.
- js/Calls.js :
- In this file, we created Calls as view component that needs to be rendered as part of Calls tab.
- In componentDidMount() lifecycle method of Calls component, we retrieved chats data from the database using fetch(URL, requestOptions) method.
- If fetch() retrieves data successfully, we parsed the result into ListView component of React Native
- In render(), we displayed ListView component with each row from ChatRow component.
- js/CallsRow.js :
- This component represents each row in the calls list.
- Each call row is fetched from the database by filtering it userId and corresponding msgId.
- Then we displayed each row with corresponding user profile picture, call status(incoming/outgoing/missed call) and also timestamp of the call.