Employee Directory: Sample Application with React Native and Node.js

Over the past few years, I’ve built many versions of the Employee Directory application as a way to explore new languages and frameworks. In this post I’ll share a version of the Employee Directory sample app built with React Native.

React Native is a framework for building native mobile applications using JavaScript. It uses the same programming model as React, with one key difference: instead of rendering DOM elements in a browser window, a React Native application renders native components in your mobile platform UI system (i.e. UIKit on iOS). In other words:

  • In React, you render your components using React components like <div> and <ul> which are wrappers around DOM elements.
  • In React Native, you render your components using React Native components like <View> and <ListView> which are wrappers around native components.

The Sample Application

The Employee Directory application allows you to search for employees by name, view the details of an employee, call, text, or email an employee, and navigate up and down the org chart.

Watch the Video:

Highlights:

Employee Directory uses the following React Native features:

Installing the Application

  1. Follow the React Native getting started instructions to install React Native. Make sure you select your Mobile OS and Development OS, for the right instructions. The instructions below assume ios.
  2. Create a new React Native app named EmployeeDirectory:
    react-native init EmployeeDirectory
    cd EmployeeDirectory
    react-native run-ios
    
  3. Clone the sample app repository:
    git clone https://github.com/ccoenraets/employee-directory-react-native
    
  4. Copy the app folder from employee-directory-react-native into your EmployeeDirectory project folder
  5. Open index.ios.js. Delete the existing content and replace it with:
    import {AppRegistry} from 'react-native';
    
    import EmployeeDirectoryApp from './app/EmployeeDirectoryApp';
    
    AppRegistry.registerComponent('EmployeeDirectory', () => EmployeeDirectoryApp);
    
  6. Hit Cmd + R to refresh the app in the emulator

Mock and REST Services

The app comes with two interchangeable implementations of the data service:

  • The Mock service implementation (employee-service-mock.js) uses in-memory data and is used for prototyping or testing purpose.
  • The REST service implementation (employee-service-rest.js) uses fetch to access Node.js-based REST services hosted on Heroku. You can find the source code for the Nodes.js services in this GitHub repository.

The application uses the mock service by default. To use the REST service instead, open EmployeeList.js and EmployeeDetails.js, and replace:

import * as employeeService from './services/employee-service-mock';

with:

import * as employeeService from './services/employee-service-rest';

Source Code

The source code for the React Native application is available in this GitHub repository.
The source code for the REST services is available in this GitHub repository.

Additional Resources

If you are new to React or ECMAScript 6, check out my React and ECMAScript 6 tutorials:

And/or check out my React sample apps:

  • Pingback: Employee Directory: Sample Application with React Native and Node.js - ReactJS News()

  • Gayathri

    Explanations shared here is very useful

    By,
    Hope Tutors

  • Navjeet Chabbewal

    Downloaded and checked out the app. Loved the way it is coded. It was a good example to lear navigation in react native and I really liked the way you abstracted mock v/s RESTful service to get employee data.

  • Oktay Seo

    İyi hafta sonları değerli takipçilerimiz. Haftanın tüm yorgunluğunu üzerinizden atabileceğiniz ruhunuzu ferahlatacak bir çok aktivite bulunmaktadır. Bu aktivitelerden ruhu ferahlatan, ufkunuzu geliştiren resim kursu ve bahçeşehir bale kursu eğitimleride bunlar arasında yer almaktadır.

    7 ile 15 yaş arası çocukların deneme sürecinde her hangi bir ücret talep etmemek ile beraber çocukları sanata yönlendirmek ve geliştirmek hiç şüphe yok ki gelecekleri adına atmış olacakları adımlar için oldukça ideal bir seçim olacaktır.

    Bahçeşehir bale kursu eğitimlerini vermekten olan eğitmenimizin pozitif enerjisini sizde yüreğinize hissedecek sanatın her alanından ayrı bir tat alacaksınız.

    http://ruyaavcisi.com/bale-ve-modern-dans-gelisim-atolyesi/

    bahçeşehir bale, bahçeşehir bale kursu, bale kursu, bale kursu bahçeşehir,

  • Oktay Seo

    İstanbul’un en gözde semtlerinden biri olan bahçeşehir de bahçeşehir bale kursu eğitimi almak istiyorsanız en ideal adres olan rüya avcısı sanat merkezi ile tanışmanızı tavsiye ederiz. geniş kadrosu ve eğitici kadrosu ile özellikle çocuk ve gençlerin gelişimine olumlu katkı sağlamaktayız. Sizde çocuklarınızı güvenli ve sanata aşık olan bu kuruma teslim edebilirsiniz.

    Avcılar’ da bulunan resim kursu ile birlikte bahçeşehirde bulunan resim kursunun yanı sıra bale eğitimlerinede hız kesmeden devam etmekteyiz.

    http://ruyaavcisi.com/bale-ve-modern-dans-gelisim-atolyesi/

  • Pingback: Sample Application with React Native and the Salesforce Mobile SDK | Christophe Coenraets()

  • Ayşe Gül

    Resim Akademi Güzel Sanatlara Hazırlık Kursu ile sınavlara hazırlanan, yetenekli öğrencilerimiz, ülkemizdeki güzel sanatlar liselerinde eğitim almaya başlayarak kariyerlerine adım atabilirler. Güzel Sanatlar Liselerinin yetenek sınavlarına hazırlanan öğrenciler için Türkiye’de bulunan liseler ve kontenjanları… Devamı için, http://www.guzelsanatlarahazirlikkursu.com.tr/

  • Chandrakanth Bairy

    Can I know how to run this example in Android device? I tried the same changes in index.android.js and copied app folder from employee-directory-react-native to EmployeeDirectory. I reloaded the app in Android emulator but I end up getting error like,
    Could not connect to the development server

  • Oktay Seo

    İstanbul’un en gözde ve en işlem mekanı olan kadıköy ‘ de osmanlının yüzyıllardır süre gelen kına organizasyonlarına bağdat kaftan aracılığı ile ulaşabileceksiniz.
    Kadıköy kaftan kiralama olarak yüzlerce çeşit ürünü farklı renk ve tarzda sizlere sunmaktadır. Asalet , Hurrem Bordosu , Sultani Yeşil , Gece Büyüsü , Pembe İncili kaftan çeşitlerini magazamızda bulabilirsiniz.
    Bağdat Caddesinde bulunan mağazamız web sitemiz üzerinden sipariş alınmaktadır.
    Bizi Takipte kalınız…

    http://bagdatkaftan.com/

  • Which language of coding you advise for novice programmer. That would be either easy and effective.

  • janki gandhi

    how to install this app in android device?

  • divp

    thanks for sharing very well explained

  • Anh Minh Multimedia

    I have error message about “Navigator” . I’m using the react-native: 0.45.1

    • sudhir

      in node_modules
      npm install react-native-deprecated-custom-components

      in EmployeeDirectoryApp.js add
      import { Navigator } from ‘react-native-deprecated-custom-components’;

      and remove Navigator from line 2

  • Abhishek

    I am also facing issue with Navigator.

  • nuru deen

    get Naija Mp3
    Download and Naija news

  • Damny
  • ABDQUDUS DAMILARE
  • Thanks Christophe!! An awesome way to describe a react native sample app, it would be very helpful for our team. We offer development services as well: https://www.alphalogicinc.com/services/mobile-app-development/

  • CIIT Noida

    Nice looking sites and great work. Pretty nice information. it has a better understanding. thanks for spending time on it.

    Hadoop Training Institute in Noida

    Best Hadoop Training in Noida

  • Jay

    Nice! I remember your stuff from the good old days of PhoneGap and Cordova :)

  • Dinesh Kumar

    This article has covered so many
    topics that are helpful for mobile app development, visit mobile app
    development
    for more new
    ideas, we are thankful for this article.

  • lindatovar

    Great post! I didn’t know about several of these resources and I’m going to go check them out now! fanfiction

  • Superb explanation & it’s too clear to understand the concept as well, keep sharing admin with some updated information with right examples.Keep update more posts.java training

  • A curative post and very informative in a sense that everyone would learn from it so great work by author.

  • I love your tutorials, I would love to share with my audience.

    Thanks on behalf of Team TechnoBrains (www.technobrains.net)

  • Deepika Analy

    Thanks for making me this article. You have done a great job by sharing this content in here. Keep writing article like this.

    Node JS Training in Chennai
    Node JS Training

  • medypharma01

    Buy Avana 100mg Online containing the active ingredient avanafil. avana 100 in india from your most reliable Trusted online pharmacy Medypharma. Avail best price in USA, by your doorsteps. super avana review

  • medypharma01

    Buy Filagra Double 200mg Online is a medication that has been made for sexual dysfunctional problems. buy filagra online from your most reliable Trusted pharmacy Medypharma. Avail best price in USA, by your doorsteps.cheap filagra double , sildenafil citrate 200mg .

  • medypharma01

    Buy Tadarise oral Jelly Online is FDA Approved Medication use to Men with erectile dysfunction. Tadarise 20 Oral jelly manufactured by Sunrise Remedies in india. cheap tadalafil oral jelly buy at online trusted pharmacy Medypharma. Tadarise Oral jelly reviews

  • medypharma01

    Buy Sildisoft 100mg Online is used when treating erectile dysfunction (impotence) in same way as original Viagra. buy sildisoft 100 mg online from your most reliable Trusted online pharmacy Medypharma. Avail best price in USA, by your doorsteps. sildisoft review,

  • medypharma01

    Buy Malegra Pro 100mg Online is contain of Sildenafil Citrate. Know about malegra pro 100 uses , Price, How to take, Side Effect, How to use malegra pro 100. Avail best price in USA, by Doorsteps, order now ! cheap Malegra pro 100 , malegra pro 100 for sale

  • medypharma01

    Buy Tadarise 2.5mg Online (generic Cialis) are used to treat erectile dysfunction (impotence) in men. tadarise 2.5 mg online from your most reliable Trusted online pharmacy Medypharma. Avail best price in USA. cheap tadarise 2.5 mg , Tadarise review.

  • medypharma01

    Buy Tadasoft 20mg Online in the same way as Viagra but remains effective for a longer period of time. buy Tadalafil 20 mg Tablet at Medypharma. Lowest Price in USA. Generic Tadalafil tablet. Order Now.

  • medypharma01

    Buy Tadasoft 40mg Online works same way as Viagra but remains effective for a longer period of time. Tadasoft 40 mg contain of Tadalafil it’s manufactured by Sunrise Remedies. Buy generic viagra from this Trusted online pharmacy Medypharma

  • Buy Fildena 120mg Online is used for Enlarged prostate gland in male, Increased blood pressure in lungs and other conditions. Know about the uses, side effects, price, composition, substitutes, How it works, Lowest Price Online Fildena 120mg Online buy with lowest Price Ever Online Pharmacy. Fildena 120mg Review

  • Buy P Force Fort 150mg Online is used for Penis erection, High blood pressure and other conditions. P Force Fort 150mg Tablet may also be used for purposes not listed in this medication guide. Order P Force Fort 150mg Online From Trusted Online Pharmacy Medypharma .

  • Buy Super P Force Online is used for Penis erection, High blood pressure and other conditions. Super P Force Tablet may also be used for purposes not listed in this medication guide. Order Super P Force Online From Trusted Online Pharmacy Medypharma . Best Price In USA

  • Buy Tadarise 10mg Online is a name for generic Cialis, an erectile dysfunction medication based on Tadalafil. Know about tadarise 10 mg uses , Price , How to take , Side Effect , How to use .cheap Tadarise 10 avail in USA. Tadarise Review by Online Trusted Pharmacy Medypharma. Order Tadarise Now

  • Buy Tadarise 40mg Online is a name for generic Cialis, an erectile dysfunction medication based on Tadalafil. Know about tadarise 40 mg Reviews, uses, dosage, Price , How to take , Side Effect , How to use. cheap Tadarise 40 sunrise. Tadarise 40 for sale Online . Order Tadarise 40 Now

  • Buy Kamagra Oral Jelly Online made by Ajanta. cheap kamagra oral jelly in USA from trusted Online Pharmacy Medypharma. kamagra oral jelly for sale , kamagra oral jelly price in india , kamagra oral jelly review. Order Now

  • Robert

    Take into consideration focusing long acceptable to check out; lots much less make this manage of post. You have actually beaten your self with this surface area. that is spotless substance online journals to motivate the blog writers to understand that they’ve acquainted something efficient with the broad internet! lawyer personal injury

  • Robert

    This was an excellent difficulty and also in an ideal world, I will certainly go to the selecting one. It progressed towards becoming a great deal of fun which I unmistakably valued myself. To an amazing degree incredible blog. I valued separating your posts. this is very an impressive record for me. best decking services

  • Robert

    Thankful to you for sharing the communicate. papa and mom are cosmos beguiling character in each presentation of an individual. they call for or should certainly be powerful to maintain necessities of the float of relatives. Visit us

css.php