React Native Fundamentals for Web Developers — The Translation Guide
Lesson opener
In one line: Every web HTML/CSS concept mapped to React Native.
Why it matters: This shows up at work when you need to every web HTML/CSS concept mapped to React Native.
Before this lesson: HTML/CSS/JS; React useState helpful
Before you start
| Resource | Link |
|---|---|
| Previous | Android ecosystem |
| Next | Navigation |
| Prerequisites | HTML/CSS/JS; React useState helpful |
| Time | ~50 minutes |
| What you need | MyFirstApp project from android1 |
What you will learn
- Every web HTML/CSS concept mapped to React Native
- Why styles are JavaScript objects — not CSS files
- The
<Text>rule — the mistake every web dev makes once - Flexbox on mobile (column default, not row)
- A complete Hello World with styling and expected output
Section 1 — Web to mobile translation table
This lesson exists specifically to bridge the mental model gap.
| Web (what you know) | React Native (what it maps to) |
|---|---|
<div> | <View> |
<p>, <span> | <Text> — ALL text must be in Text |
<img> | <Image> |
<button> | <TouchableOpacity> or <Pressable> |
<input> | <TextInput> |
<ul> / <li> | <FlatList> |
| CSS file | StyleSheet.create() |
px, em, rem | Density-independent points (no units in code) |
| Flexbox | Flexbox — column by default, not row |
window.alert() | Alert.alert() |
localStorage | AsyncStorage (async — see android4) |
fetch() | fetch() — same API |
React useState | React useState — same hook |
Section 2 — The biggest mental model shifts
In React Native:
- There is no CSS file — styles are JavaScript objects
- ALL text must be inside a
<Text>component (not directly inside<View>)- Dimensions are in points, not pixels — the OS scales for screen density
- Default flex direction is COLUMN, not row (opposite of many web defaults)
- There is no DOM — no
document.getElementById, no CSS selectors
Plain English: You are still writing React components — but the browser is replaced by native widgets. Think "native UI kit" not "website in a WebView."
Section 3 — Hello World with styling
Replace the contents of App.js in your Expo project:
import { View, Text, StyleSheet } from 'react-native';
export default function App() {
return (
<View style={styles.container}>
<Text style={styles.heading}>
Welcome to My First App
</Text>
<Text style={styles.body}>
Built with React Native and Expo
</Text>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#ffffff',
alignItems: 'center',
justifyContent: 'center',
padding: 20,
},
heading: {
fontSize: 24,
fontWeight: 'bold',
color: '#1e3a5f',
marginBottom: 12,
},
body: {
fontSize: 16,
color: '#64748b',
textAlign: 'center',
},
});Breaking it down:
| Piece | Plain English |
|---|---|
View | Container — like a <div> |
Text | Required wrapper for any visible text |
StyleSheet.create() | Defines styles once; validates keys |
flex: 1 | Fill available screen height |
alignItems / justifyContent | Flexbox centering — same concepts as CSS |
fontSize: 24 | Number only — no px suffix |
Use this when: every new screen — start with View + Text + StyleSheet.
Expected output
Section 4 — Common web-dev mistakes
// WRONG — text directly in View (red screen / error)
<View>
Hello world
</View>
// RIGHT
<View>
<Text>Hello world</Text>
</View>// WRONG — CSS string syntax
<View style="flex: 1; padding: 20">
// RIGHT — JavaScript object
<View style={{ flex: 1, padding: 20 }}>Practice
Do this now: Change heading color to your brand hex, add a third Text line with your name. Shake the phone → reload in Expo Go to see changes.
Checklist
- [ ] Can you map
<div>,<p>,<button>to RN components? - [ ] Do you know why text must live inside
<Text>? - [ ] Can you explain column-default flexbox?
- [ ] Did Hello World render centered on your device?
What's next
Navigation — screens as a stack, not URLs.