Morinne2 PDF
Morinne2 PDF
Morinne2 PDF
Created by
Morinne Kearns
Exploreum Enterprises
Beginner User Guide
2021.1
July 2021
React and React Native are registered trademarks of Facebook, Inc. JavaScript is a
registered trademark of Oracle Corporation.
iii
iv React Native Beginner User Guide
Chapter 1 - Overview
1.1 What is React Native?
React Native is an open-source framework for writing mobile apps using JavaScript. It
combines React, a JavaScript library for building user interfaces, with the native cap-
abilities of Android or iOS app platforms. It eliminates the need to know Kotlin or Java for
Android development or Swift or Objective-C for iOS. React Native allows you to create
the same user view as the native language without needing to know the native language.
l React - A JavaScript library for building user interfaces. When you are ready to start
developing your own apps, you should be familiar with the following React concepts:
Concept Description
Components Independent, reusable bits of code that
return HTML elements
JSX JavaScript XML that allows you to write
HTML in React
Props Properties that let you customize React
components
State An object that stores property values for
components that will change over time
1Knowledge of React concepts and JavaScript is not required to follow this user guide.
Chapter 1 - Overview 1
1.4 What is covered in this user guide?
This user guide will help you install a development environment for React Native and build
and modify a basic "Hello World" app that you can view on your phone.
If you run into any difficulties installing these programs, a link to troubleshooting help can
be found in "Troubleshooting" on page C.
1All images in this tutorial are for Windows installation. The process for other operating
systems will be similar but will look different.
2Links to detailed information about each program can be found in "Useful Links" on
page A
3. Read through the End-User License Agreement, check “I accept the terms in the
License Agreement,” and click “Next.”
5. Select the features you would like to install. Since we will only be using core features
for this tutorial, simply click “Next” to install the core version.
7. Click “Install” to complete installation. Depending on your system setup, you may
need to approve the installation on a separate pop-up screen.
9. When Node.js the Node.js Setup Wizard is complete, you will see this screen. Click
“Finish” to complete the installation.
1. To install Expo CLI, you need to open a Command Prompt1. On Windows, press the
Windows (ÿ) + R buttons together to open the "Run" box:
2. Type "cmd" and hit "Enter" or click "OK" to open the Command Prompt.
1Those new to using command prompts can find a basic introduction in Appendix A, "Com-
mand Prompt: What It Is and How to Use It" on page A
CONGRATULATIONS! You're now ready to start your first app! But first you need to
set up your phone so you can see your app in action.
1. Go to the app store on your phone to download the Expo Go app. On iPhones, the
app is called Expo Go and is found in the App Store:
OnAndroid phones, it is called Expo and is found in the Google Play Store:
In order for Node.js to be able to link to Expo Go, you need to be sure the computer run-
ning Node.js and the phone running Expo Go are both using the same wireless network.
If you don't know how to check your Wi-Fi network, see the following websites:
l iPhone
l Android phones
l Computer with Windows Operating System
l Mac Computer
1. Go back to your computer and the Command Prompt Window. If you had previously
closed this window, reopen it following steps 1 and 2 from Chapter 2, Section "2.1.2
Install Expo CLI" on page 8.
2. To initialize your new project, type "expo init HelloWorld" and hit "Enter." Note where
you are creating this project. In this example, my project will be saved in a folder
called "HelloWorld" on the C: drive inside other folders that can be found following
the path Users > mojok. Make sure you know where your project is being created
because you'll need to find and open it later.
3. You will see the following, where you are given a few options for templates. For this
project, we will use the blank template at the top, so simply hit "Enter." (You can
have fun exploring the other options in the future.)
5. To start our project using Expo and see it on our phone, we need to go into the dir-
ectory for the HelloWorld project. To do that type: cd HelloWorld
7. Now it's time to start expo by typing in "npm start" and hitting Enter.
The Command Prompt window will start Expo, open developer tools in your
browser, and create a QR code that you will need to open the project on your phone.
It will also give you a menu of options.
Notice the QR code below? You'll use that to view the app on your phone in the next
section.
On iPhones open your camera app and line up the QR code in the center of your
screen, as if you're going to take a picture of it. (But don't take a picture!) On Android
phones, open the Expo app for the QR scanner.
Congratulations! You just ran your first app! It is a very basic template. Next, we'll
open up and modify that JavaScript file.
Hopefully, you noted the location where you created your HelloWorld project. Here
is my project path in the Command Prompt window:
If you get to the correct folder and don't see the App.js file, be sure to display All
Files and not just Text Documents (*.txt):
2. Change the words between the <Text></Text> tags to "Hello, world!" and click
File>Save.
You can change the text to say whatever you want. Make the changes, save them,
and watch the magic.
Congratulations! You modified your first app! You're on your way to creating your
own app!
The React Native website has a variety of useful information about getting started includ-
ing React fundamentals, testing your app, using libraries, changing styles, and much
more.
You need an understanding of JavaScript fundamentals to work with React Native. Moz-
illa provides a thorough set of tutorials.
The React JavaScript library is used in React Native to build your app. The React website
has "Getting Started" information, as well as tutorials to learn more.
Node.js
https://nodejs.org/en/
The Node.js website has download links and documentation about the program.
Expo
https://docs.expo.io/
The Expo website houses excellent guides on a variety of topics related to Expo, including
getting started, fundamentals, and distributing your app.
If you've never used the Windows Command Prompt before, this short guide is a useful
introduction.
React Native has put together a list of commonly encountered issues that you may come
across while setting up React Native, including port errors, NPM locking errors, missing lib-
raries, and shell command problems.
Appendix B: Troubleshooting C
D React Native Beginner User Guide
the project server, view logs,
Glossary and open your app in a sim-
ulator
A J
app JavaScript
An application, usually down- A programming language that
loaded by a user on a mobile allows you to make web pages
device. interactive. It is the world's most
popular programming lan-
C guage.
Development Environment
N
A software application that
provides comprehensive util- Node.js
ities for programmers to An open-source, cross-platform
develop software. JavaScript runtime environment
that executes Javascript code
Directory outside a web browser.
A collection of files typically cre-
ated for organizational pur-
poses. Also known as a folder. O
Objective-C
E A general-purpose pro-
gramming language that can be
Expo CLI used to program apps for Apple
A command line app that allows
products.
you to create new projects, run
Glossary E
open-source S
Software for which the original
source code is made freely State
available and may be redis- An object in React that stores
tributed and modified. property values for components
that will change over time
P Swift
A programming language for
Pop-up
Apple app development.
A window that appears on a
computer or phone screen.
W
Props
Properties that let you cus- Wi-Fi Network
tomize React components Wireless Fidelity Network. See
Wireless Network.
Q Wireless Network
A computer network that uses
QR code
electromagnetic waves to con-
A machine-readable code made
nect stations or devices.
up of an array of black and
white squares, typically used for
storing web addresses or other
information for reading by the
camera on a smartphone.
React
A free and open-source
JavaScript library for building
user interfaces. It is maintained
by Facebook and a community
of individual developers and
companies.
React Native
An open-source, cross-platform
framework for writing mobile
apps using JavaScript.
Glossary F
Index
A
App
Creating 13-14, 16-17
Modifying 26-29
Viewing 18-21
E
Expo CLI 8-9
Expo Go 10
I
Installation
Computer 3
Development Environment 3
Expo CLI 8
Expo Go 10
Phone 10
J
JavaScript 1
N
Node.js 3-7
R
React 1
React Native 1
W
Wireless Network, connecting to 11
Index G
Index H