<?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: Parjanya Aditya Shukla</title>
    <description>The latest articles on DEV Community by Parjanya Aditya Shukla (@parjanyaacoder).</description>
    <link>https://dev.to/parjanyaacoder</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%2F531180%2Ff7764ea8-9c0b-449b-815f-ac08c294746e.jpeg</url>
      <title>DEV Community: Parjanya Aditya Shukla</title>
      <link>https://dev.to/parjanyaacoder</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/parjanyaacoder"/>
    <language>en</language>
    <item>
      <title>Open Source in the Web 3.0 world ~ Gitopia</title>
      <dc:creator>Parjanya Aditya Shukla</dc:creator>
      <pubDate>Wed, 09 Nov 2022 16:34:43 +0000</pubDate>
      <link>https://dev.to/playfulprogramming/open-source-in-the-web-30-world-gitopia-1a9h</link>
      <guid>https://dev.to/playfulprogramming/open-source-in-the-web-30-world-gitopia-1a9h</guid>
      <description>&lt;p&gt;Hey folks, &lt;br&gt;
&lt;a href="https://i.giphy.com/media/nfl59PMPNLKuK8v5LT/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/nfl59PMPNLKuK8v5LT/giphy.gif" width="393" height="393"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;This article covers key insights from the &lt;strong&gt;Whitepaper&lt;/strong&gt; of &lt;strong&gt;Gitopia&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The open source platforms like Github, Gitlab, BitBucket and many more, are Web2 centric. &lt;strong&gt;Gitopia&lt;/strong&gt; reminds me of &lt;strong&gt;Zootopia&lt;/strong&gt; (Anime movie) and the memes like - &lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/4URfklUToxk6A/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/4URfklUToxk6A/giphy.gif" width="480" height="270"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Gitopia&lt;/strong&gt; is a &lt;strong&gt;de-centralized code hosting and collaboration platform&lt;/strong&gt;, that seems to redefine code sharing platforms, the Web3 way. &lt;/p&gt;

&lt;p&gt;Github and other Web 2.0 open source platforms, have the following shortcomings that prevent moving into the de-centralized world of Web 3.0 &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The platforms have a monopoly as a large number of developers and Open source collaborators are using these platforms. &lt;/li&gt;
&lt;li&gt;These platforms are a Single point of failure as, if they suffer a catastrophic event, all developers will lose their access to their repositories and projects. &lt;/li&gt;
&lt;li&gt;These platforms have their own set of policies to which the communities have no direct say or influence. &lt;/li&gt;
&lt;li&gt;These platforms often censor the projects available on the platform under the influence of a Government organisation. &lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Features
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Gitopia&lt;/strong&gt; solves these issues by leveraging the blockchain technology. It has the following features -: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Decentralized - Open Source communities and collaborators will have the right to decide the polices and future of Gitopia. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;No central authority to censor the data or projects available on the platform. The power will be in the hands of the users through a voting system. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;No Single point of failure with the usage of a decentralized network. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Gitopia will provide permanent storage with the use of Blockchain. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Repositories on Gitopia will be secured by public-key cryptography. &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Technical insights
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Gitopia main chain is built using &lt;strong&gt;Cosmos-SDK&lt;/strong&gt;. &lt;/li&gt;
&lt;li&gt;Gitopia chain will run on &lt;strong&gt;delegated-Proof-of-Stake based Byzantine Fault Tolerant(BFT) Tendermint&lt;/strong&gt; consensus engine. &lt;/li&gt;
&lt;li&gt;Gitopia will be integrated with &lt;strong&gt;Cosmos Inter Blockchain Communication (IBC)&lt;/strong&gt; layer to provide interoperability with other chains. &lt;/li&gt;
&lt;li&gt;The native Gitopia token is &lt;strong&gt;$LORE&lt;/strong&gt; and the testnet token is &lt;strong&gt;$TLORE&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Redundant data storage&lt;/strong&gt; will be provided using &lt;strong&gt;Arweave&lt;/strong&gt; to the users. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Gitopia also incentivises Open Source using the $LORE token and provides actionable Open Source Licenses.  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Gitopia Whitepaper&lt;/strong&gt; is available on the website &lt;a href="https://gitopia.com/" rel="noopener noreferrer"&gt;&lt;strong&gt;Gitopia&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;That's all folks, Thanks for reading till here. Stay tuned for more learnings. &lt;/p&gt;

&lt;p&gt;Follow me on &lt;a href="https://twitter.com/AdityaParjanya" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt; for more tech content on ReactNative, Flutter and Web3.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>App Shortcuts in React Native : Never let your app shortcuts open any random app 😂</title>
      <dc:creator>Parjanya Aditya Shukla</dc:creator>
      <pubDate>Fri, 05 Aug 2022 08:34:00 +0000</pubDate>
      <link>https://dev.to/playfulprogramming/app-shortcuts-in-react-native-never-let-your-app-shortcuts-open-any-random-app-4h0f</link>
      <guid>https://dev.to/playfulprogramming/app-shortcuts-in-react-native-never-let-your-app-shortcuts-open-any-random-app-4h0f</guid>
      <description>&lt;p&gt;Hey folks, &lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/nfl59PMPNLKuK8v5LT/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/nfl59PMPNLKuK8v5LT/giphy.gif" width="393" height="393"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this article we will be creating &lt;strong&gt;App Shortcuts&lt;/strong&gt; for &lt;strong&gt;React Native&lt;/strong&gt; apps as shown in the image. We will be creating this using the &lt;strong&gt;react-native-app-shortcuts&lt;/strong&gt; library. &lt;/p&gt;

&lt;p&gt;First things first !!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;node --version
 v16.14.1
npm --version
 8.5.0
java --version
 openjdk 11.0.11 2021-04-20
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Create a New React Native App using the following commands -
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx react-native init [YOUR_PROJECT_NAME] --version 0.68.2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note -&lt;/strong&gt; I am using 0.68 version of React Native. If you have upgraded React Native to the latest version you can create the app using the command -&amp;gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx react-native init [YOUR_PROJECT_NAME]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Let's install the dependencies
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/hL9q5k9dk9l0wGd4e0/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/hL9q5k9dk9l0wGd4e0/giphy.gif" width="480" height="318"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We will be installing navigation dependencies to support navigation between multiple screens in our app.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install @react-navigation/native @react-navigation/native-stack

npm install react-native-screens react-native-safe-area-context
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After the navigation dependencies we will be installing &lt;strong&gt;react-native-app-shortcuts&lt;/strong&gt; library in our app.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm i react-native-app-shortcuts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Final &lt;code&gt;package.json&lt;/code&gt; file should be similar to this -&amp;gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package.json

{
  "name": "RNAppShortcuts",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "@react-navigation/native": "^6.0.11",
    "@react-navigation/native-stack": "^6.7.0",
    "react": "17.0.2",
    "react-native": "0.68.2",
    "react-native-app-shortcuts": "^0.2.0",
    "react-native-safe-area-context": "^4.3.1",
    "react-native-screens": "^3.15.0"
  },
  "devDependencies": {
    "@babel/core": "^7.18.10",
    "@babel/runtime": "^7.18.9",
    "@react-native-community/eslint-config": "^3.1.0",
    "babel-jest": "^28.1.3",
    "eslint": "^8.21.0",
    "jest": "^28.1.3",
    "metro-react-native-babel-preset": "^0.72.0",
    "react-test-renderer": "17.0.2"
  },
  "jest": {
    "preset": "react-native"
  }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Let's begin the journey of Code -&amp;gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt; Remove the template code in &lt;code&gt;App.js&lt;/code&gt; and ensure &lt;code&gt;App.js&lt;/code&gt; looks like the following -
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;App.js

import React from 'react';
import {
  StyleSheet,
  Text,
  View,
} from 'react-native';

const App = () =&amp;gt; {

  return (
    &amp;lt;View&amp;gt;

    &amp;lt;/View&amp;gt;
  );
};

const styles = StyleSheet.create({

});

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Remove the &lt;code&gt;styles&lt;/code&gt; constant and imports from &lt;strong&gt;'react-native'&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We will create a Navigation Container and a Stack Navigator that contains different screens for our app. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Import &lt;strong&gt;NavigationContainer&lt;/strong&gt; and &lt;strong&gt;createNativeStackNavigator()&lt;/strong&gt; from &lt;strong&gt;'react-navigation/native'&lt;/strong&gt; and &lt;strong&gt;'react-navigation/native-stack'&lt;/strong&gt; respectively.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import {NavigationContainer} from '@react-navigation/native';
import {createNativeStackNavigator} from '@react-navigation/native-stack';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Modify the return statement of &lt;code&gt;App.js&lt;/code&gt; file. Return a &lt;code&gt;NavigationContainer&lt;/code&gt; that encloses our &lt;code&gt;Stack.Navigator&lt;/code&gt; inside which all our screens are defined along with their names and components.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;return (
    &amp;lt;NavigationContainer&amp;gt;
      &amp;lt;Stack.Navigator&amp;gt;
        &amp;lt;Stack.Screen name="Home" component={HomeComponent} /&amp;gt;
        &amp;lt;Stack.Screen name="Notification" component={NotificationComponent} /&amp;gt;
        &amp;lt;Stack.Screen name="Chat" component={ChatComponent} /&amp;gt;
      &amp;lt;/Stack.Navigator&amp;gt;
    &amp;lt;/NavigationContainer&amp;gt;
  );
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Next we will be defining these components namely - 
&lt;code&gt;HomeComponent&lt;/code&gt; , &lt;code&gt;NotificationComponent&lt;/code&gt; and &lt;code&gt;ChatComponent&lt;/code&gt;. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the same &lt;code&gt;App.js&lt;/code&gt; file create three constants like -&amp;gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const NotificationComponent = ({navigation}) =&amp;gt; {
  return (
    &amp;lt;&amp;gt;
      &amp;lt;Notification navigation={navigation} /&amp;gt;
    &amp;lt;/&amp;gt;
  );
};

const ChatComponent = ({navigation}) =&amp;gt; {
  return (
    &amp;lt;&amp;gt;
      &amp;lt;Chat navigation={navigation} /&amp;gt;
    &amp;lt;/&amp;gt;
  );
};

const HomeComponent = ({navigation}) =&amp;gt; {
  return (
    &amp;lt;&amp;gt;
      &amp;lt;Home navigation={navigation} /&amp;gt;
    &amp;lt;/&amp;gt;
  );
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Import the Chat, Home, Notification screens like -&amp;gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import Notification from './src/Notification';
import Chat from './src/Chat';
import Home from './src/Home';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At this stage your &lt;code&gt;App.js&lt;/code&gt; would look like the following -&amp;gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;App.js 

import React from 'react';
import {NavigationContainer} from '@react-navigation/native';
import {createNativeStackNavigator} from '@react-navigation/native-stack';
import Notification from './src/Notification';
import Chat from './src/Chat';
import Home from './src/Home';

const Stack = createNativeStackNavigator();

const NotificationComponent = ({navigation}) =&amp;gt; {
  return (
    &amp;lt;&amp;gt;
      &amp;lt;Notification navigation={navigation} /&amp;gt;
    &amp;lt;/&amp;gt;
  );
};

const ChatComponent = ({navigation}) =&amp;gt; {
  return (
    &amp;lt;&amp;gt;
      &amp;lt;Chat navigation={navigation} /&amp;gt;
    &amp;lt;/&amp;gt;
  );
};

const HomeComponent = ({navigation}) =&amp;gt; {
  return (
    &amp;lt;&amp;gt;
      &amp;lt;Home navigation={navigation} /&amp;gt;
    &amp;lt;/&amp;gt;
  );
};

const App = () =&amp;gt; {
  return (
    &amp;lt;NavigationContainer&amp;gt;
      &amp;lt;Stack.Navigator&amp;gt;
        &amp;lt;Stack.Screen name="Home" component={HomeComponent} /&amp;gt;
        &amp;lt;Stack.Screen name="Notification" component={NotificationComponent} /&amp;gt;
        &amp;lt;Stack.Screen name="Chat" component={ChatComponent} /&amp;gt;
      &amp;lt;/Stack.Navigator&amp;gt;
    &amp;lt;/NavigationContainer&amp;gt;
  );
};

export default App;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;At this stage it might be showing you errors that Home, Notification and Chat screens does not exists and hence they cannot be imported. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Let's fix this next. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a folder &lt;strong&gt;src&lt;/strong&gt; at the level where &lt;br&gt;
&lt;code&gt;App.js&lt;/code&gt; file is located.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create 3 files inside the &lt;strong&gt;src&lt;/strong&gt; folder namely -&amp;gt; Home.js, Notification.js and Chat.js&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Also for icons download &lt;a href="https://icons8.com/icon/110472/notification" rel="noopener noreferrer"&gt;Notification icon&lt;/a&gt; and &lt;a href="https://icons8.com/icon/13724/chat" rel="noopener noreferrer"&gt;Chat icon&lt;/a&gt; from the respective links as .png images and add in the app project structure at the location&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;android/app/src/main/res/drawable
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Your folder structure for adding png files of Icons will be -&amp;gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0g341xa9aajzsric5jgz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0g341xa9aajzsric5jgz.png" alt="Icon Folder Structure" width="800" height="962"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Your folder structure should finally look like this -&amp;gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu2z1obqq6ykje71macbw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu2z1obqq6ykje71macbw.png" alt="Final Folder Structure" width="800" height="794"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  Steps for creating screens Home.js, Chat.js and Notification.js
&lt;/h3&gt;

&lt;h3&gt;
  
  
  Home.js
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Create a functional component named Home.js and export it as default from this file. &lt;br&gt;
 Make Sure each of the Screen Home.js, Chat.js and Notification.js accepts &lt;code&gt;notification&lt;/code&gt;  object as &lt;code&gt;props&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const Home = ({navigation}) =&amp;gt; {
  return (
  );
};

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

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Create a &lt;strong&gt;styles&lt;/strong&gt; constant and create homeStyle.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const styles = StyleSheet.create({
  homeStyle: {
    display: 'flex',
    flex: 1,
    justifyContent: 'center',
    alignSelf: 'center',
  },
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;homeStyle will be assigned to the single view in the Home Screen with the flex value as 1 so that it takes the entire space.&lt;br&gt;
&lt;code&gt;justifyContent&lt;/code&gt; and &lt;code&gt;alignSelf&lt;/code&gt; styles are used to align the Text component inside the View in the centre of the screen. &lt;/p&gt;

&lt;p&gt;Inside the return method of Home functional component return View with styles as homeStyle which contains a Text Component as "Home Screen"&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;return (
    &amp;lt;View style={styles.homeStyle}&amp;gt;
      &amp;lt;Text&amp;gt;{'Home Screen'}&amp;lt;/Text&amp;gt;
    &amp;lt;/View&amp;gt;
  );
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;Home.js&lt;/code&gt; at this stage will look like -&amp;gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Home.js 

import React from 'react';
import {Text, StyleSheet, View} from 'react-native';

const Home = ({navigation}) =&amp;gt; {
  return (
    &amp;lt;View style={styles.homeStyle}&amp;gt;
      &amp;lt;Text&amp;gt;{'Home Screen'}&amp;lt;/Text&amp;gt;
    &amp;lt;/View&amp;gt;
  );
};

const styles = StyleSheet.create({
  homeStyle: {
    display: 'flex',
    flex: 1,
    justifyContent: 'center',
    alignSelf: 'center',
  },
});

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

&lt;/div&gt;






&lt;h3&gt;
  
  
  Chat.js
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Similarly create a screen Chat.js with the following code -&amp;gt;&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
Chat.js 

import React from 'react';
import {StyleSheet, Text, TouchableOpacity} from 'react-native';

const Chat = ({navigation}) =&amp;gt; {
  return (
    &amp;lt;TouchableOpacity
      onPress={() =&amp;gt; {
        navigation.navigate('Notification');
      }}
      style={styles.cta1Style}&amp;gt;
      &amp;lt;Text style={styles.ctaTitleStyle}&amp;gt;{'Switch to Notifications'}&amp;lt;/Text&amp;gt;
    &amp;lt;/TouchableOpacity&amp;gt;
  );
};

const styles = StyleSheet.create({
  cta1Style: {
    backgroundColor: 'red',
    padding: 20,
  },
  ctaTitleStyle: {
    color: 'white',
  },
});

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

&lt;/div&gt;






&lt;h3&gt;
  
  
  Notification.js
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Similarly create a screen Notification.js with the following code -&amp;gt;&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

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

const Notification = ({navigation}) =&amp;gt; {
  return (
    &amp;lt;TouchableOpacity
      onPress={() =&amp;gt; {
        navigation.navigate('Chat');
      }}
      style={styles.cta2Style}&amp;gt;
      &amp;lt;Text style={styles.ctaTitleStyle}&amp;gt;{'Switch to Chat'}&amp;lt;/Text&amp;gt;
    &amp;lt;/TouchableOpacity&amp;gt;
  );
};

const styles = StyleSheet.create({
  cta2Style: {
    backgroundColor: 'blue',
    padding: 20,
  },
  ctaTitleStyle: {
    color: 'white',
  },
});

export default Notification;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And that's done... Now you might not be seeing any error if everything works perfectly... &lt;/p&gt;




&lt;h2&gt;
  
  
  Let's create the App Shortcuts for our app -&amp;gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Import &lt;code&gt;RNAppShortcuts&lt;/code&gt; from &lt;strong&gt;'react-native-app-shortcuts'&lt;/strong&gt; in &lt;code&gt;App.js&lt;/code&gt; file &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Inside the App functional component before the return statement create 2 actions using RNAppShortcuts.addShortcut({})&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;App.js

import React from 'react';
import {NavigationContainer} from '@react-navigation/native';
import {createNativeStackNavigator} from '@react-navigation/native-stack';
import Notification from './src/Notification';
import Chat from './src/Chat';
import Home from './src/Home';
import RNAppShortcuts from 'react-native-app-shortcuts';

const Stack = createNativeStackNavigator();

const NotificationComponent = ({navigation}) =&amp;gt; {
  return (
    &amp;lt;&amp;gt;
      &amp;lt;Notification navigation={navigation} /&amp;gt;
    &amp;lt;/&amp;gt;
  );
};

const ChatComponent = ({navigation}) =&amp;gt; {
  return (
    &amp;lt;&amp;gt;
      &amp;lt;Chat navigation={navigation} /&amp;gt;
    &amp;lt;/&amp;gt;
  );
};

const HomeComponent = ({navigation}) =&amp;gt; {
  return (
    &amp;lt;&amp;gt;
      &amp;lt;Home navigation={navigation} /&amp;gt;
    &amp;lt;/&amp;gt;
  );
};

const App = () =&amp;gt; {
  RNAppShortcuts.addShortcut({
    id: '1',
    shortLabel: 'Notify',
    longLabel: 'Open Notifications',
    iconFolderName: 'drawable',
    iconName: 'notification',
  });
  RNAppShortcuts.addShortcut({
    id: '2',
    shortLabel: 'Chat',
    longLabel: 'Open Chats',
    iconFolderName: 'drawable',
    iconName: 'chat',
  });
  return (
    &amp;lt;NavigationContainer&amp;gt;
      &amp;lt;Stack.Navigator&amp;gt;
        &amp;lt;Stack.Screen name="Home" component={HomeComponent} /&amp;gt;
        &amp;lt;Stack.Screen name="Notification" component={NotificationComponent} /&amp;gt;
        &amp;lt;Stack.Screen name="Chat" component={ChatComponent} /&amp;gt;
      &amp;lt;/Stack.Navigator&amp;gt;
    &amp;lt;/NavigationContainer&amp;gt;
  );
};

export default App;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Now we will create handlers which will activate when one of the app shortcut is clicked. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In &lt;code&gt;Home.js&lt;/code&gt; file import useEffect from React and create a useEffect() equivalent for ComponentWillMount() of class component for Home functional component. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Also import RNAppShortcuts from &lt;strong&gt;'react-native-app-shortcuts'&lt;/strong&gt; for defining app shortcuts handler.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This useEffect will be triggered every time this screen loads or mounts. Here we will define our App Shortcuts handler. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;App Shortcuts handler is created using &lt;code&gt;RNAppShortcuts.handleShortcut(id =&amp;gt; {});&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;At this stage &lt;code&gt;Home.js&lt;/code&gt; should look like -&amp;gt;&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Home.js 

import React, {useEffect} from 'react';
import {Text, StyleSheet, View} from 'react-native';
import RNAppShortcuts from 'react-native-app-shortcuts';

const Home = ({navigation}) =&amp;gt; {
  useEffect(() =&amp;gt; {
    RNAppShortcuts.handleShortcut(id =&amp;gt; {
      console.log(id);
      if (id === '1') {
        navigation.navigate('Notification');
      } else if (id === '2') {
        navigation.navigate('Chat');
      }
    });
  }, []);

  return (
    &amp;lt;View style={styles.homeStyle}&amp;gt;
      &amp;lt;Text&amp;gt;{'Home Screen'}&amp;lt;/Text&amp;gt;
    &amp;lt;/View&amp;gt;
  );
};

const styles = StyleSheet.create({
  homeStyle: {
    display: 'flex',
    flex: 1,
    justifyContent: 'center',
    alignSelf: 'center',
  },
});

export default Home;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Important Things to Note -
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;They are multiple libraries in React Native for creating App Shortcuts. &lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.npmjs.com/package/react-native-app-shortcuts" rel="noopener noreferrer"&gt;&lt;strong&gt;react-native-app-shortcuts&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.npmjs.com/package/react-native-quick-actions" rel="noopener noreferrer"&gt;&lt;strong&gt;react-native-quick-actions&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.npmjs.com/package/react-native-actions-shortcuts" rel="noopener noreferrer"&gt;&lt;strong&gt;react-native-actions-shortcuts&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Shortcuts are added using the following code which accepts parameters like id, shortLabel , longLabel, iconFolderName where the icon image is located, iconName which has some naming rules.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;RNAppShortcuts.addShortcut({
    id,
    shortLabel,
    longLabel,
    iconFolderName,
    iconName,
  });
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Icon Images should be added in native android and iOS folders at right locations. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We can add all shortcuts to the app in Splash Screen or we can add app shortcuts based on which part of the app, user has explored. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We can remove app shortcuts using &lt;br&gt;
&lt;code&gt;RNAppShortcuts.removeShortCut(id)&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We can remove all app shortcuts using &lt;br&gt;
&lt;code&gt;RNAppShortcuts.removeAllShortCuts()&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Static app shortcuts are shortcuts that are created at the app installation time. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;react-native-quick-actions&lt;/strong&gt; library support static app shortcuts for IOS devices. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;App shortcuts handler can be created using &lt;br&gt;
&lt;code&gt;RNAppShortcuts.handleShortcut(id =&amp;gt; {});&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The handler accepts id, using which we can perform different operations on different app shortcut click. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Voohooooooo!! We have complete the project. Cheers !!&lt;/p&gt;

&lt;p&gt;Follow me on &lt;a href="https://twitter.com/AdityaParjanya" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt; for more tech content on ReactNative and Flutter.&lt;/p&gt;

</description>
      <category>reactnative</category>
      <category>react</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
