Today I officially started my React Native adventure. In this post, Iโm not just logging progressโIโll walk you through what I set up and how the code works, so you can follow along step-by-step.
โ What I Did Today
- Created a new Expo + TypeScript app:
npx create-expo-app my-first-app --template blank (TypeScript)
- Initialized a GitHub repo for version control.
- Built a simple HomeScreen to display a welcome message.
- Committed and pushed all code.
- Captured a screenshot of the app running on Android.
๐งฑ Code Breakdown โ My HomeScreen
import React from "react";
import { View, Text, StyleSheet } from "react-native";
export default function HomeScreen() {
return (
<View style={styles.container}>
<Text style={styles.title}>๐ Welcome to My First React Native App</Text>
<Text style={styles.subtitle}>Day 1 โ Getting Started ๐</Text>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: "center",
alignItems: "center",
padding: 20,
backgroundColor: "#f8f8ff",
},
title: {
fontSize: 24,
fontWeight: "bold",
marginBottom: 12,
},
subtitle: {
fontSize: 16,
color: "#666",
},
});
๐ง What This Code Does
- StyleSheet.create keeps styles clean and performant.
- container uses Flexbox to center content.
- backgroundColor, fontSize, and margin make the UI visually appealing and readable.
๐ Connecting the Screen in App.tsx
import React from "react";
import { SafeAreaView } from "react-native";
import HomeScreen from "./src/screens/HomeScreen";
export default function App() {
return (
<SafeAreaView style={{ flex: 1 }}>
<HomeScreen />
</SafeAreaView>
);
}
๐ง What This Code Does
- We wrap the app in SafeAreaView to handle notches and status bars.
- Flex styling ensures the screen fills the device display.
๐งฉ Putting It All Together
- HomeScreen uses React Native components like View, Text.
- StyleSheet defines reusable styles.
- App.tsx renders the screen within a safe layout.
Once saved, simply run:
npx expo start
Youโll see your welcome screen
๐ Repo
Check out todayโs code here:
๐ GitHub - My First React Native App
๐ผ Screenshot
๐ญ Day 2 Preview
Next up: adding React Navigationโweโll create a second screen and navigate between them using a stack navigator. Be ready for multi-screen flow!
Follow me if you want to join me on this full React Native journey. Iโll be posting daily progress and projects!
Top comments (0)