<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Hemanshu </title>
    <description>The latest articles on DEV Community by Hemanshu  (@hemanshum).</description>
    <link>https://dev.to/hemanshum</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F353488%2Fad0dd596-97a9-47bd-94cd-0fab9bad8797.png</url>
      <title>DEV Community: Hemanshu </title>
      <link>https://dev.to/hemanshum</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hemanshum"/>
    <language>en</language>
    <item>
      <title>The Ultimate Guide to Custom Theming with React Native Paper, Expo and Expo Router</title>
      <dc:creator>Hemanshu </dc:creator>
      <pubDate>Wed, 17 Jul 2024 04:29:40 +0000</pubDate>
      <link>https://dev.to/hemanshum/the-ultimate-guide-to-custom-theming-with-react-native-paper-expo-and-expo-router-3hjl</link>
      <guid>https://dev.to/hemanshum/the-ultimate-guide-to-custom-theming-with-react-native-paper-expo-and-expo-router-3hjl</guid>
      <description>&lt;p&gt;React Native Paper is an excellent and user-friendly UI library for React Native, especially for customizing dark and light themes with its &lt;a href="https://callstack.github.io/react-native-paper/docs/guides/theming/#creating-dynamic-theme-colors" rel="noopener noreferrer"&gt;Dynamic Theme Colors Tool&lt;/a&gt;. However, configuring it with Expo and Expo Router can be tricky. Additionally, creating a toggle button for theme switching without a central state management system can be challenging. Expo Router can help with this.&lt;br&gt;
In this article, we will learn how to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create custom light and dark themes.&lt;/li&gt;
&lt;li&gt;Configure these themes for use with React Native Paper, Expo and Expo Router.&lt;/li&gt;
&lt;li&gt;Implement a toggle button to switch between light and dark modes within the app.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you like to watch this tutorial you can check out the video tutorial here: &lt;iframe width="710" height="399" src="https://www.youtube.com/embed/JkepeUIrwUs"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Setup a Expo Project&lt;/strong&gt;&lt;br&gt;
Open your terminal and type:&lt;br&gt;
&lt;code&gt;npx create-expo-app@latest&lt;/code&gt;&lt;br&gt;
It will ask for a project name, in my case I gave “rnpPractice”.&lt;/p&gt;

&lt;p&gt;After Installation go into project directory and open your code editor in it and run.&lt;br&gt;
Now it’s install React Native Paper and required dependency packages in the project folder.&lt;br&gt;
&lt;code&gt;npm install react-native-paper react-native-safe-area-context&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Open babel.config.js in you code editor and change the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;module.exports = function(api) {
   api.cache(true);
   return {
       presets: ['babel-preset-expo'],
//ADD CODE START
       env: { 
         production: {
           plugins: ['react-native-paper/babel'],
         },
       },
//ADD CODE END
     };
  };
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let’s reset the project so we can remove the unnecessary files, run the following to reset our project:&lt;br&gt;
&lt;code&gt;npm run reset-project&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;We will create a new folder in the root of our project called ‘ src ’ and move following folders in it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;app&lt;/li&gt;
&lt;li&gt;components&lt;/li&gt;
&lt;li&gt;constants&lt;/li&gt;
&lt;li&gt;hooks
It will look the following screenshot:
&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fehjkyb0u2nmzpzgah1dv.png" alt="Image description" width="257" height="524"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now in app folder let’s create a folder name (tabs), you must create a folder with parenthesis around the word tabs, that how we can create a bottom tab navigation in Expo Router. We will move our index.js file from app (the parent folder) to (tabs) (the child folder) and now create two more files in the (tabs) folder. one is “_layout.js” and 2nd settings.js. Now you app folder should look like the following screenshot:&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhulitnfl8eyqm3a4kqqs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhulitnfl8eyqm3a4kqqs.png" alt="Image description" width="387" height="384"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let’s fill settings.js with some boiler plate code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { StyleSheet, View, Text } from "react-native";

const Settings = () =&amp;gt; {
  return (
    &amp;lt;View&amp;gt;
      &amp;lt;Text&amp;gt;Settings&amp;lt;/Text&amp;gt;
    &amp;lt;/View&amp;gt;
  );
};

const styles = StyleSheet.create({});

export default Settings;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now for Expo router to work properly we need to update the “_layout.js” files in app and (tabs) folder:&lt;br&gt;
Update _layout.js in app folder with following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import {Stack} from 'expo-router';

export default function RootLayout() {
  return (
    &amp;lt;Stack&amp;gt;
      &amp;lt;Stack.Screen
            name="(tabs)"
            options={{
              headerShown: false,
            }}
          /&amp;gt;
    &amp;lt;/Stack&amp;gt;
  )
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and in (tabs) folder _layout.js file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Tabs } from "expo-router";
import { Feather } from "@expo/vector-icons";

export default function TabLayout() {
  return (
    &amp;lt;Tabs&amp;gt;
      &amp;lt;Tabs.Screen
        name="index"
        options={{
          title: "Home",
          tabBarIcon: ({ color }) =&amp;gt; (
            &amp;lt;Feather name="home" size={24} color={color} /&amp;gt;
          ),
        }}
      /&amp;gt;
      &amp;lt;Tabs.Screen
        name="settings"
        options={{
          title: "Setting",
          tabBarIcon: ({ color }) =&amp;gt; (
            &amp;lt;Feather name="settings" size={24} color={color} /&amp;gt;
          ),
        }}
      /&amp;gt;
    &amp;lt;/Tabs&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now let’s run the app and see everything is running ok.&lt;br&gt;
&lt;code&gt;npm run start&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now your project will start, you can run your project on emulator or simulator or on you phone by scanning the QR code and install Expo Go App on your phone.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyaf2gia5xyfw0x4silnc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyaf2gia5xyfw0x4silnc.png" alt="Image description" width="335" height="248"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create and Configure the React Native Paper Theme&lt;/strong&gt;&lt;br&gt;
Let’s create our custom dark &amp;amp; light theme first, for that &lt;a href="https://callstack.github.io/react-native-paper/docs/guides/theming/#creating-dynamic-theme-colors" rel="noopener noreferrer"&gt;follow the link&lt;/a&gt;. Here you just have to select the colors Primary, Secondary and Tertiary and it will create you a light and dark theme.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj5ba8fz39x22kqezoqym.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj5ba8fz39x22kqezoqym.png" alt="Image description" width="720" height="994"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now rename your Colors.ts file to Colors.js if you are using JavaScript and not TypeScript, then open that file. Copy the light theme colors object from website and paste it in light colors object in Colors.js file and do same for the Dark theme and your file will look likes this:&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk1r9xbiy09o20auqrzj4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk1r9xbiy09o20auqrzj4.png" alt="Image description" width="191" height="160"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export const Colors = {
  light: {
    primary: "rgb(176, 46, 0)",
    onPrimary: "rgb(255, 255, 255)",
    primaryContainer: "rgb(255, 219, 209)",
    onPrimaryContainer: "rgb(59, 9, 0)",
    secondary: "rgb(0, 99, 154)",
    onSecondary: "rgb(255, 255, 255)",
    secondaryContainer: "rgb(206, 229, 255)",
    onSecondaryContainer: "rgb(0, 29, 50)",
    tertiary: "rgb(121, 89, 0)",
    onTertiary: "rgb(255, 255, 255)",
    tertiaryContainer: "rgb(255, 223, 160)",
    onTertiaryContainer: "rgb(38, 26, 0)",
    error: "rgb(186, 26, 26)",
    onError: "rgb(255, 255, 255)",
    errorContainer: "rgb(255, 218, 214)",
    onErrorContainer: "rgb(65, 0, 2)",
    background: "rgb(255, 251, 255)",
    onBackground: "rgb(32, 26, 24)",
    surface: "rgb(255, 251, 255)",
    onSurface: "rgb(32, 26, 24)",
    surfaceVariant: "rgb(245, 222, 216)",
    onSurfaceVariant: "rgb(83, 67, 63)",
    outline: "rgb(133, 115, 110)",
    outlineVariant: "rgb(216, 194, 188)",
    shadow: "rgb(0, 0, 0)",
    scrim: "rgb(0, 0, 0)",
    inverseSurface: "rgb(54, 47, 45)",
    inverseOnSurface: "rgb(251, 238, 235)",
    inversePrimary: "rgb(255, 181, 160)",
    elevation: {
      level0: "transparent",
      level1: "rgb(251, 241, 242)",
      level2: "rgb(249, 235, 235)",
      level3: "rgb(246, 229, 227)",
      level4: "rgb(246, 226, 224)",
      level5: "rgb(244, 222, 219)",
    },
    surfaceDisabled: "rgba(32, 26, 24, 0.12)",
    onSurfaceDisabled: "rgba(32, 26, 24, 0.38)",
    backdrop: "rgba(59, 45, 41, 0.4)",
  },
  dark: {
    primary: "rgb(255, 181, 160)",
    onPrimary: "rgb(96, 21, 0)",
    primaryContainer: "rgb(135, 33, 0)",
    onPrimaryContainer: "rgb(255, 219, 209)",
    secondary: "rgb(150, 204, 255)",
    onSecondary: "rgb(0, 51, 83)",
    secondaryContainer: "rgb(0, 74, 117)",
    onSecondaryContainer: "rgb(206, 229, 255)",
    tertiary: "rgb(248, 189, 42)",
    onTertiary: "rgb(64, 45, 0)",
    tertiaryContainer: "rgb(92, 67, 0)",
    onTertiaryContainer: "rgb(255, 223, 160)",
    error: "rgb(255, 180, 171)",
    onError: "rgb(105, 0, 5)",
    errorContainer: "rgb(147, 0, 10)",
    onErrorContainer: "rgb(255, 180, 171)",
    background: "rgb(32, 26, 24)",
    onBackground: "rgb(237, 224, 221)",
    surface: "rgb(32, 26, 24)",
    onSurface: "rgb(237, 224, 221)",
    surfaceVariant: "rgb(83, 67, 63)",
    onSurfaceVariant: "rgb(216, 194, 188)",
    outline: "rgb(160, 140, 135)",
    outlineVariant: "rgb(83, 67, 63)",
    shadow: "rgb(0, 0, 0)",
    scrim: "rgb(0, 0, 0)",
    inverseSurface: "rgb(237, 224, 221)",
    inverseOnSurface: "rgb(54, 47, 45)",
    inversePrimary: "rgb(176, 46, 0)",
    elevation: {
      level0: "transparent",
      level1: "rgb(43, 34, 31)",
      level2: "rgb(50, 38, 35)",
      level3: "rgb(57, 43, 39)",
      level4: "rgb(59, 45, 40)",
      level5: "rgb(63, 48, 43)",
    },
    surfaceDisabled: "rgba(237, 224, 221, 0.12)",
    onSurfaceDisabled: "rgba(237, 224, 221, 0.38)",
    backdrop: "rgba(59, 45, 41, 0.4)",
  },
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now let’s use our theme, for that open the _layout.js file in app folder and import:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import {Stack} from 'expo-router';
//Import the code Start
import {
  MD3DarkTheme,
  MD3LightTheme,
  PaperProvider,
} from "react-native-paper";
//Import the code End

export default function RootLayout() {
  return (
    &amp;lt;Stack&amp;gt;
      &amp;lt;Stack.Screen
            name="(tabs)"
            options={{
              headerShown: false,
            }}
          /&amp;gt;
    &amp;lt;/Stack&amp;gt;
  )
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now let’s wrap our code in  in _layout.js file in app folder like the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import {Stack} from 'expo-router';
import {
  MD3DarkTheme,
  MD3LightTheme,
  PaperProvider,
} from "react-native-paper";

export default function RootLayout() {
  return (
    &amp;lt;PaperProvider&amp;gt; //Start there
      &amp;lt;Stack&amp;gt;
        &amp;lt;Stack.Screen
              name="(tabs)"
              options={{
                headerShown: false,
              }}
            /&amp;gt;
      &amp;lt;/Stack&amp;gt;
    &amp;lt;/PaperProvider&amp;gt; //End here
  )
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;👆 This will allow us to use React Native Paper components in our app.&lt;/p&gt;

&lt;p&gt;Now to apply our color theme we need to import Colors from the Colors.js file and merge it on the colors object in the current theme in React Native Paper. Confusing? 🤔&lt;br&gt;
Let write the code to understand 😁. Open _layout.js file in app folder:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import {Stack} from 'expo-router';
import {
  MD3DarkTheme,
  MD3LightTheme,
  PaperProvider,
} from "react-native-paper";

//1. Import Our Colors
import { Colors } from "../constants/Colors";

//2. Overwrite it on the current theme
const customDarkTheme = { ...MD3DarkTheme, colors: Colors.dark };
const customLightTheme = { ...MD3LightTheme, colors: Colors.light };


export default function RootLayout() {
  return (
    // 3.Use any theme you like for your app
    &amp;lt;PaperProvider theme={customDarkTheme}&amp;gt; 
      &amp;lt;Stack&amp;gt;
        &amp;lt;Stack.Screen
              name="(tabs)"
              options={{
                headerShown: false,
              }}
            /&amp;gt;
      &amp;lt;/Stack&amp;gt;
    &amp;lt;/PaperProvider&amp;gt;
  )
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let’s make our app decide which theme to use as per the users device. For that we are going to use a Hook provided by React Native called useColorScheme. The useColorScheme React hook provides and subscribes to color scheme preferred by the user’s device. &lt;a href="https://reactnative.dev/docs/usecolorscheme" rel="noopener noreferrer"&gt;Read More.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Open _layout.js file in app folder:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Stack } from 'expo-router';
//1. Import the useColorScheme hook
import { useColorScheme } from 'react-native';
import {
  MD3DarkTheme,
  MD3LightTheme,
  PaperProvider,
} from "react-native-paper";

import { Colors } from "../constants/Colors";


const customDarkTheme = { ...MD3DarkTheme, colors: Colors.dark };
const customLightTheme = { ...MD3LightTheme, colors: Colors.light };

export default function RootLayout() {
//2. Get the value in a const
const colorScheme = useColorScheme();

//3. Let's decide which theme to use
  const paperTheme =
    colorScheme === "dark" ? customDarkTheme : customLightTheme;

  return (
   //4. apply the theme
    &amp;lt;PaperProvider theme={paperTheme}&amp;gt; 
      &amp;lt;Stack&amp;gt;
        &amp;lt;Stack.Screen
              name="(tabs)"
              options={{
                headerShown: false,
              }}
            /&amp;gt;
      &amp;lt;/Stack&amp;gt;
    &amp;lt;/PaperProvider&amp;gt;
  )
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now it’s time to test, let’s go into (tabs) folder and open index.js and copy following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { View } from "react-native";
import { Avatar, Button, Card, Text } from "react-native-paper";

const LeftContent = (props) =&amp;gt; &amp;lt;Avatar.Icon {...props} icon="folder" /&amp;gt;;

export default function Index() {
  return (
    &amp;lt;View
      style={{
        flex: 1,
        margin: 16,
      }}
    &amp;gt;
      &amp;lt;Card&amp;gt;
        &amp;lt;Card.Cover source={{ uri: "https://picsum.photos/700" }} /&amp;gt;
        &amp;lt;Card.Title
          title="Card Title"
          subtitle="Card Subtitle"
          left={LeftContent}
        /&amp;gt;
        &amp;lt;Card.Content&amp;gt;
          &amp;lt;Text variant="bodyMedium"&amp;gt;
            Lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam
            tenetur odit eveniet inventore magnam officia quia nemo porro?
            Dolore sapiente quos illo distinctio nisi incidunt? Eaque officiis
            iusto exercitationem natus?
          &amp;lt;/Text&amp;gt;
        &amp;lt;/Card.Content&amp;gt;
        &amp;lt;Card.Actions&amp;gt;
          &amp;lt;Button&amp;gt;Open&amp;lt;/Button&amp;gt;
        &amp;lt;/Card.Actions&amp;gt;
      &amp;lt;/Card&amp;gt;
    &amp;lt;/View&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can see that your theme is applied but only on the card you imported from React Native Paper, your navigation is still using a default theme provided by Expo Router.&lt;/p&gt;

&lt;p&gt;Now let’s merge the Expo Router theme in React Native Paper theme and use the same theme for both. To achieve that let’s get back to _layout.js file in app folder and make the following changes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Stack } from 'expo-router';
import { useColorScheme } from 'react-native';
import {
  MD3DarkTheme,
  MD3LightTheme,
  PaperProvider,
  adaptNavigationTheme, //1. Import this package
} from "react-native-paper";

//2. Import Router Theme
import {
  DarkTheme as NavigationDarkTheme,
  DefaultTheme as NavigationDefaultTheme,
  ThemeProvider,
} from "@react-navigation/native";

//3. Install deepmerge first and import it
import merge from "deepmerge";

import { Colors } from "../constants/Colors";

const customDarkTheme = { ...MD3DarkTheme, colors: Colors.dark };
const customLightTheme = { ...MD3LightTheme, colors: Colors.light };

//4. The adaptNavigationTheme function takes an existing React Navigation 
// theme and returns a React Navigation theme using the colors from 
// Material Design 3.
const { LightTheme, DarkTheme } = adaptNavigationTheme({
  reactNavigationLight: NavigationDefaultTheme,
  reactNavigationDark: NavigationDarkTheme,
});

//5.We will merge React Native Paper Theme and Expo Router Theme 
// using deepmerge
const CombinedLightTheme = merge(LightTheme, customLightTheme);
const CombinedDarkTheme = merge(DarkTheme, customDarkTheme);

export default function RootLayout() {
    const colorScheme = useColorScheme();

  //6. Let's use the merged themes
    const paperTheme =
      colorScheme === "dark" ? CombinedDarkTheme : CombinedLightTheme;

    return (
      &amp;lt;PaperProvider theme={paperTheme}&amp;gt;
        //7.We need to use theme provider from react navigation 
        //to apply our theme on Navigation components
        &amp;lt;ThemeProvider value={paperTheme}&amp;gt;
          &amp;lt;Stack&amp;gt;
            &amp;lt;Stack.Screen
                  name="(tabs)"
                  options={{
                    headerShown: false,
                  }}
                /&amp;gt;
          &amp;lt;/Stack&amp;gt;
        &amp;lt;/ThemeProvider&amp;gt;
      &amp;lt;/PaperProvider&amp;gt;
  )
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it guys this should apply our theme to both React Native Paper Components and Navigation Components like Header Navigation or Bottom Tag Navigation.&lt;/p&gt;

&lt;p&gt;Find the source code here:&lt;br&gt;
&lt;a href="https://github.com/hemanshum/React-Native-Paper-Practic-App" rel="noopener noreferrer"&gt;https://github.com/hemanshum/React-Native-Paper-Practic-App&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Wrapping Up&lt;/strong&gt;&lt;br&gt;
We’ve covered a lot of ground in this blog post, from creating custom light and dark themes to configuring them for use with React Native Paper, Expo and Expo Router. By now, you should have a solid foundation for implementing theming in your Expo projects. For those looking to add a toggle button to switch between these themes within your app, I’ve created a detailed video tutorial. Check out the video, with a convenient timestamp for the relevant section, here: &lt;a href="https://youtu.be/JkepeUIrwUs" rel="noopener noreferrer"&gt;Video Tutorial.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy coding, and may your apps always look great — in light and in dark! 🌓✨&lt;/p&gt;

</description>
      <category>reactnative</category>
      <category>exporouter</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Open cohort base learning App for online learners</title>
      <dc:creator>Hemanshu </dc:creator>
      <pubDate>Wed, 07 Apr 2021 13:01:24 +0000</pubDate>
      <link>https://dev.to/hemanshum/open-cohort-base-learning-app-for-online-learners-107a</link>
      <guid>https://dev.to/hemanshum/open-cohort-base-learning-app-for-online-learners-107a</guid>
      <description>&lt;p&gt;I learned to program from online courses, but I always feel that I could become a developer earlier than this. Because many times I postponed or skip the course until it's absolutely necessary for me to learn it. I tried to be disciplined, set a learning routine, use productivity apps, and whatnot. I tried to find some app to help me with this, I try finding the reasons and came across an &lt;a href="https://www.edsurge.com/news/2019-06-06-moving-from-5-to-85-completion-rates-for-online-courses" rel="noopener noreferrer"&gt;article&lt;/a&gt;, which described that the average compilation rate of online courses is only 15%. &lt;/p&gt;

&lt;p&gt;So I tried to come up with an idea to solve this and created an app called &lt;a href="https://play.google.com/store/apps/details?id=online.peerup.peerup" rel="noopener noreferrer"&gt;PeerUp&lt;/a&gt;. In this App, learners will able to create a small group of peers, set learning commitment, and track the learning progress, so whenever somebody in the group makes progress it will notify everyone in the group, I hope this way peers will able to motivate each other and eventually they will able to complete the course.&lt;/p&gt;

&lt;p&gt;If you like to try it, please &lt;a href="https://play.google.com/store/apps/details?id=online.peerup.peerup" rel="noopener noreferrer"&gt;download&lt;/a&gt; the App or check the website &lt;a href="https://peerup.online" rel="noopener noreferrer"&gt;https://peerup.online&lt;/a&gt;, the waiting list is open now.&lt;/p&gt;

&lt;p&gt;I really appreciate it, if you can give me your feedback and suggestions. &lt;/p&gt;

&lt;p&gt;Thank You&lt;br&gt;
Hemanshu&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>tutorial</category>
      <category>webdev</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>How to Become a Mobile App Developer by the end of 2021</title>
      <dc:creator>Hemanshu </dc:creator>
      <pubDate>Sun, 04 Apr 2021 17:52:20 +0000</pubDate>
      <link>https://dev.to/hemanshum/how-to-become-a-mobile-app-developer-by-the-end-of-2021-ij4</link>
      <guid>https://dev.to/hemanshum/how-to-become-a-mobile-app-developer-by-the-end-of-2021-ij4</guid>
      <description>&lt;p&gt;By the end of this article, you will know a definite path, courses, techniques, and tools to become a mobile app developer. Today to become a mobile app developer there are multiple programming languages/frameworks available to learn. But in this article, I am going to focus on learning one programming language and its framework – JavaScript and React Native.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Path
&lt;/h3&gt;

&lt;p&gt;Let me introduce you to the technologies/programming language/framework need to learn to become a Mobile App Developer.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;JavaScript – Programming Language&lt;/li&gt;
&lt;li&gt;React Native – Mobile App Framework&lt;/li&gt;
&lt;li&gt;React Navigation – Routing, and navigation for your React Native apps&lt;/li&gt;
&lt;li&gt;React Hooks – Allow you to access state in functional components&lt;/li&gt;
&lt;li&gt;React Context APIs or Redux – State Management&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you already have experience in JavaScript, you can directly start to learn React Native Course(which I am going to suggest later in this post )&lt;/p&gt;

&lt;h3&gt;
  
  
  Courses
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://peerup.online/how-to-become-a-mobile-app-developer-by-the-end-of-2021/" rel="noopener noreferrer"&gt;Link to the complete blog post&lt;/a&gt;&lt;/p&gt;

</description>
      <category>reactnative</category>
      <category>mobile</category>
      <category>career</category>
      <category>onlinecourses</category>
    </item>
    <item>
      <title>COVID19 Updates</title>
      <dc:creator>Hemanshu </dc:creator>
      <pubDate>Sat, 21 Mar 2020 09:03:49 +0000</pubDate>
      <link>https://dev.to/hemanshum/covid19-updates-41oh</link>
      <guid>https://dev.to/hemanshum/covid19-updates-41oh</guid>
      <description>&lt;p&gt;Build a simple website using react and COVID19 APIs&lt;br&gt;
&lt;a href="https://coronainfo.netlify.com/" rel="noopener noreferrer"&gt;https://coronainfo.netlify.com/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
    </item>
  </channel>
</rss>
