Skip to content

manishbsta/react-native-managed-template

Repository files navigation

React Native Managed Template

A production-ready React Native Expo starter template with authentication flow, navigation, state management, and modern development tools pre-configured.

✨ Features

Core Features

  • πŸš€ Expo SDK 54 - Latest Expo framework with managed workflow
  • πŸ“± Expo Router - File-based routing with native navigation
  • 🎨 Unistyles v3 - Universal styling system with theme support
  • πŸ—„οΈ Zustand - Lightweight state management
  • 🌐 Axios - HTTP client with interceptors pre-configured
  • πŸ” Expo Secure Store - Secure storage for sensitive data
  • 🎭 Dark/Light Theme - Built-in theme switching with context

Authentication & Navigation

  • βœ… Pre-built authentication flow
  • πŸ”’ Protected routes with auth guards
  • πŸ“ Deep linking support
  • 🎯 Type-safe navigation with TypeScript

Development Experience

  • πŸ’… ESLint & Prettier - Code quality and formatting
  • πŸ“ TypeScript - Full type safety
  • 🎨 Custom Fonts - Pre-configured font loading
  • 🧩 VS Code Snippets - Speed up development
  • 🍞 Toast Notifications - User feedback system
  • ⌨️ Keyboard Controller - Enhanced keyboard handling
  • 🎬 Reanimated - Smooth animations

Build & Deployment

  • πŸ—οΈ EAS Build - Production-ready build profiles
  • πŸ”§ Development Client - Custom dev builds
  • πŸ“¦ Prebuild - Native project generation

πŸ“‹ Prerequisites

  • Node.js (v18 or newer)
  • npm or yarn
  • Expo CLI
  • For iOS development: macOS with Xcode
  • For Android development: Android Studio

πŸš€ Getting Started

1. Clone or use this template

# Clone the repository
git clone <repository-url>
cd react-native-managed-template

# Or use as template in GitHub

2. Install dependencies

npm install
# or
yarn install

3. Start development server

npm start
# or
expo start

4. Run on device/simulator

# Run on iOS simulator
npm run ios

# Run on Android emulator
npm run android

# Or scan QR code with Expo Go app

πŸ“ Project Structure

react-native-managed-template/
β”œβ”€β”€ app/                          # Expo Router pages
β”‚   β”œβ”€β”€ _layout.tsx              # Root layout
β”‚   β”œβ”€β”€ sign-in.tsx              # Sign in screen
β”‚   └── (protected)/             # Protected routes group
β”‚       β”œβ”€β”€ _layout.tsx
β”‚       β”œβ”€β”€ index.tsx            # Home screen
β”‚       └── profile.tsx          # Profile screen
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/              # Reusable components
β”‚   β”‚   β”œβ”€β”€ styled/             # Styled UI components
β”‚   β”‚   └── Profile/            # Feature-specific components
β”‚   β”œβ”€β”€ contexts/               # React contexts
β”‚   β”‚   β”œβ”€β”€ auth.context.tsx   # Authentication context
β”‚   β”‚   └── theme.context.tsx  # Theme management
β”‚   β”œβ”€β”€ hooks/                  # Custom React hooks
β”‚   β”œβ”€β”€ lib/                    # Utilities and configs
β”‚   β”‚   β”œβ”€β”€ axios.ts           # Axios instance & interceptors
β”‚   β”‚   β”œβ”€β”€ secure-store.ts    # Secure storage wrapper
β”‚   β”‚   └── date-time.ts       # Date utilities
β”‚   β”œβ”€β”€ store/                  # Zustand stores
β”‚   β”œβ”€β”€ unistyles/             # Theme tokens & styles
β”‚   └── constants/             # App constants
β”œβ”€β”€ assets/                     # Static assets
β”‚   β”œβ”€β”€ fonts/
β”‚   β”œβ”€β”€ icons/
β”‚   └── images/
β”œβ”€β”€ android/                    # Android native code
β”œβ”€β”€ ios/                        # iOS native code
└── app.config.ts              # Expo app configuration

🧩 VS Code Snippets

The template includes pre-built VS Code snippets to accelerate development. These snippets generate boilerplate code with best practices baked in.

Available Snippets

Component Snippet (rnbc)

Type rnbc to generate a new React Native component with:

  • Proper imports (StyledText, React, View)
  • Unistyles setup with theme tokens
  • Component structure with default styling
// Generated code structure:
import { StyledText } from '@/components/styled/StyledText';
import React from 'react';
import { View } from 'react-native';
import { StyleSheet } from 'react-native-unistyles';

const MyComponent = () => {
  return (
    <View style={styles.container}>
      <StyledText style={styles.text}>MyComponent</StyledText>
    </View>
  );
};

const styles = StyleSheet.create(({ spacings }) => ({
  container: {
    padding: spacings.sm,
  },
  text: {
    textDecorationLine: 'underline'
  },
}));

export default MyComponent;

Screen Snippet (rnbs)

Type rnbs to generate a new screen with:

  • ScrollView with keyboard handling
  • Expo Router integration
  • Safe area insets
  • Responsive padding using theme tokens
// Generated code structure:
import { StyledText } from '@/components/styled/StyledText';
import { useRouter } from 'expo-router';
import React from 'react';
import { ScrollView } from 'react-native';
import { StyleSheet } from 'react-native-unistyles';

const MyScreen = () => {
  const router = useRouter();

  return (
    <ScrollView
      keyboardShouldPersistTaps='handled'
      showsVerticalScrollIndicator={false}
      contentContainerStyle={styles.contentContainer}>
      <StyledText variant='title'>MyScreen</StyledText>
    </ScrollView>
  );
};

const styles = StyleSheet.create(({ spacings }, rt) => ({
  contentContainer: {
    flexGrow: 1,
    paddingHorizontal: spacings.base,
    paddingBottom: spacings.xxxl,
    paddingTop: rt.insets.top + spacings.base,
  },
}));

export default MyScreen;

How to Use Snippets

  1. Create a new .tsx file in your project
  2. Type the snippet prefix (rnbc or rnbs)
  3. Press Tab or Enter to expand
  4. The component/screen name will be auto-selected - just type your desired name
  5. Press Tab to move to the next placeholder (if any)

These snippets ensure consistency across your codebase and save time on repetitive boilerplate code.

πŸ” Authentication Flow

The template includes a complete authentication flow:

  1. Sign In Screen - Entry point for unauthenticated users
  2. Auth Context - Manages authentication state
  3. Protected Routes - Automatically guards routes requiring authentication
  4. Secure Storage - Persists tokens securely

πŸ“¦ Available Scripts

# Development
npm start              # Start Expo development server
npm run android        # Run on Android
npm run ios           # Run on iOS

# Code Quality
npm run lint          # Run ESLint with auto-fix

# Build
npm run prebuild      # Generate native projects
npm run build:dev     # Build development client locally
npm run build:prev    # Build preview build locally
npm run build:prod    # Build production build locally

πŸ› οΈ Built With

πŸ“ Configuration

App Configuration

Update app.config.ts with your app details:

export default {
  name: 'Your App Name',
  slug: 'your-app-slug',
  // ... other configurations
};

Environment Variables

Create a .env file for environment-specific variables (not included in repo):

API_BASE_URL=https://your-api.com

Navigation Theme

Customize navigation appearance in src/hooks/useNavigationTheme.ts

🚒 Deployment

Building for Production

  1. Configure EAS

    eas build:configure
  2. Build for Android/iOS

    eas build --platform android
    eas build --platform ios
  3. Submit to Stores

    eas submit --platform android
    eas submit --platform ios

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Expo team for the amazing framework
  • React Native community for the excellent libraries
  • All testers who help improve this template

πŸ“§ Support

If you have any questions or run into issues, please open an issue on GitHub.


Made with ❀️ for the React Native community

About

A React Native Expo starter template project with built-in navigation & ready to use state management.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published