Installation
Step 1: Install Package
Install @masumdev/rn-ui along with required peer dependencies using your preferred package manager:
npm i @masumdev/rn-ui react-native-reanimated react-native-gesture-handler react-native-worklets react-native-safe-area-contextpnpm add @masumdev/rn-ui react-native-reanimated react-native-gesture-handler react-native-worklets react-native-safe-area-contextyarn add @masumdev/rn-ui react-native-reanimated react-native-gesture-handler react-native-worklets react-native-safe-area-contextbun add @masumdev/rn-ui react-native-reanimated react-native-gesture-handler react-native-worklets react-native-safe-area-contextIf you plan to use BottomSheet, Calendar, or persistent theme storage (SecureStore), install optional dependencies:
npm i @gorhom/bottom-sheet react-native-calendars expo-secure-storepnpm add @gorhom/bottom-sheet react-native-calendars expo-secure-storeyarn add @gorhom/bottom-sheet react-native-calendars expo-secure-storebun add @gorhom/bottom-sheet react-native-calendars expo-secure-storeStep 2: Configure Babel Plugin
Add react-native-reanimated/plugin to babel.config.js:
module.exports = { presets: ['babel-preset-expo'], plugins: [ // Reanimated plugin must be listed last 'react-native-reanimated/plugin', ],};Step 3: Set Up Root Providers
Wrap your root navigation container with GestureHandlerRootView, ThemeProvider, and ToastProvider:
import React from 'react';import { GestureHandlerRootView } from 'react-native-gesture-handler';import { ThemeProvider, ToastProvider } from '@masumdev/rn-ui';import * as SecureStore from 'expo-secure-store';import { Stack } from 'expo-router';
const themeStorage = { getItem: (key: string) => SecureStore.getItemAsync(key), setItem: (key: string, value: string) => SecureStore.setItemAsync(key, value),};
export default function RootLayout() { return ( <GestureHandlerRootView style={{ flex: 1 }}> <ThemeProvider defaultColorScheme="system" storage={themeStorage} storageKey="app-color-scheme" > <ToastProvider placement="bottom"> <Stack screenOptions={{ headerShown: false }} /> </ToastProvider> </ThemeProvider> </GestureHandlerRootView> );}