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)