Lecture#8 And9 ReactNative Basics
Lecture#8 And9 ReactNative Basics
Development
Kamran
Lecture 9
What is React Native
• an open source framework for building Android
and iOS applications using React and the app
platform’s native capabilities.
Components [1]
• React Native is like React, but it uses native
components instead of web components as
building blocks.
• Basic React concepts
– JSX
– Components
– State
– props
Basic React concepts [2]
• JSX
<View><Text>Hello world!</Text></View>
• Props
– short for properties
– Customize components
– Should not be modified
• State
– allows React components to change their output over time
– State changes in response to user Input, network response or
anything else.
Component(just
a function)
Basic
component
props
•View
•Text
•Image
•Button
•Touchables
•Alert
Cross platform working[2]
•
View
• basic building block of UI
• used to display text, images,
or respond to user input
• views can contain other views.
• Maps to UIView, <div>, android.view
Text
• Displays text
• supports nesting, styling, and touch handling.
• must wrap all the text nodes inside of a <Text>
component.
• Props
– numberOfLines
– onPress
Nested Text
<Text style={styles.baseText}>
I am bold and red
<Text style={styles.innerText}> and
red</Text>
</Text>
TextInput [3]
• foundational component for inputting text into
the app via a keyboard.
• Props:
– autoComplete
– autoCorrect
– Editable
– keyboardType
– onChangeText
Image [5]
• Display images both local and network
• Local Image:
– <Image source = {require(‘’)}/>
• Network Images:
– <Image source = {{uri:‘’}}
• Props
– blurRadius
– defaultSource
Buttons [4]
• render nicely on any platform.
• Required props
– onPress
– Title
– color
Touchables
• Wrapper to make views respond to touches
– TouchableHighlight
– TouchableOpacity
– TouchableWithoutFeedback
Directory Structure
References
[1] https://reactnative.dev/docs/tutorial
[2] https://reactnative.dev/docs/intro-react-native-
components
[3] https://reactnative.dev/docs/textinput
[4] https://reactnative.dev/docs/button
[5] https://reactnative.dev/docs/image