This document provides an overview of building mobile applications with React Native. It discusses that React Native allows building native mobile apps using JavaScript and reusable React components. It also covers setting up the React Native environment, important concepts like state, props, and styling, and how to configure the layout of components with flexbox. The document demonstrates how to run React Native apps for both iOS and Android and lists some common React Native components and APIs.
2. REACT NATIVE - OVERVIEW
• React Native is a JavaScript framework for building native mobile
apps. It uses the React framework and offers large amount of inbuilt
components and APIs.
• React Native lets you build mobile apps using only JavaScript. It uses
the same design as React, letting you compose a rich mobile UI from
declarative components.
• With React Native, you don't build a mobile web app, an HTML5 app,
or a hybrid app; you build a real mobile app that's indistinguishable
from an app built using Objective-C or Java
4. CORE CONCEPTS
• State
• Props
• Styling
• Height and Width
• Layout with Flexbox
• Running IOS
• Running Android
• …
5. REACT NATIVE - STATE
• We can understand it as a model of a Component
• State can be updated in the future
• Example: class Home extends Component {
state = {
myState: 'Ready'
}
}
6. REACT NATIVE - PROPS
• Most components can be customized when they are created,
with different parameters. These creation parameters are called
props.
• We can understand it as properties of a Component
• Props can’t be updated
• Example:
8. REACT NATIVE - STYLING
• There are a couple of ways to style your elements in React
Native.
• You can use the style property to add the styles inline.
However, this is not the best practice because it can be hard to
read the code.
• You can use this to make styles "cascade" other way do in CSS.
10. REACT NATIVE - HEIGHT AND WIDTH
• A component's height and width determine its size on the screen.
• Fixed Dimensions
• The simplest way to set the dimensions of a component is by adding a fixed
width and height to style.
• style={{width: 50, height: 50, backgroundColor: 'powderblue'}}
• Flex Dimensions
• Use flex in a component's style to have the component expand and shrink
dynamically based on available space
• style={{flex: 1, backgroundColor: 'powderblue’}}
• style={{flex: 2, backgroundColor: 'powderblue'}}
11. REACT NATIVE - LAYOUT WITH FLEXBOX
• A component can specify the layout of its children using the flexbox
algorithm. Flexbox is designed to provide a consistent layout on
different screen sizes.
• Flex Direction
• row/ column: default column
• Justify Content (Y)
• flex-start, center, flex-end, space-around, space-between and space-
evenly.
• Align Items (X)
• flex-start, center, flex-end, and stretch.