<?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: Princewill Iroka</title>
    <description>The latest articles on DEV Community by Princewill Iroka (@princewilliroka).</description>
    <link>https://dev.to/princewilliroka</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%2F151325%2F2782ba04-224a-4318-b30b-3ab30b62b3d0.jpg</url>
      <title>DEV Community: Princewill Iroka</title>
      <link>https://dev.to/princewilliroka</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/princewilliroka"/>
    <language>en</language>
    <item>
      <title>How to bundle/export a git repo as a single file without losing the git history</title>
      <dc:creator>Princewill Iroka</dc:creator>
      <pubDate>Sat, 22 May 2021 13:54:28 +0000</pubDate>
      <link>https://dev.to/princewilliroka/how-to-bundle-export-a-git-repo-as-a-single-file-without-losing-the-git-history-3111</link>
      <guid>https://dev.to/princewilliroka/how-to-bundle-export-a-git-repo-as-a-single-file-without-losing-the-git-history-3111</guid>
      <description>&lt;p&gt;Sometimes, you need to export and send a git repository to someone for code review. &lt;br&gt;
In such cases, you may not have the option of adding the person to the repository as a collaborator on Github, Gitlab, Bitbucket or any other git-based version control platform.&lt;br&gt;
You can use these steps to export the git repo as a single file:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Clone the repo if you haven't already done so:
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;git clone reponame&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Inside the root directory of the project, bundle the repo by running this from the command line:
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;git bundle create reponame.bundle --all&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note: This will bundle all the branches in the repo in a repo.bundle file that can be easily sent to someone.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use this to bundle only the main branch:
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;git bundle create reponame.bundle main&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When the person receives the file, the person can unbundle it using this command:
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;git clone reponame.bundle&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; &lt;em&gt;Ensure to delete the node_modules folder before bundling your repo&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;For more info on bundling Git repos, read this &lt;a href="https://stackoverflow.com/questions/11792671/how-to-git-bundle-a-complete-repo"&gt;Stackoverflow question&lt;/a&gt; or the official &lt;a href="https://git-scm.com/docs/git-bundle"&gt;Git docs&lt;/a&gt;&lt;/p&gt;

</description>
      <category>git</category>
      <category>github</category>
    </item>
    <item>
      <title>How to add SplashScreen to a ReactNative app with react-native-bootsplash</title>
      <dc:creator>Princewill Iroka</dc:creator>
      <pubDate>Sat, 05 Dec 2020 20:30:30 +0000</pubDate>
      <link>https://dev.to/princewilliroka/how-to-add-splashscreen-to-a-reactnative-app-with-react-native-bootsplash-22oj</link>
      <guid>https://dev.to/princewilliroka/how-to-add-splashscreen-to-a-reactnative-app-with-react-native-bootsplash-22oj</guid>
      <description>&lt;p&gt;In this article, I'll show you how to easily add a splash screen to a react-native app using &lt;a href="https://github.com/zoontek/react-native-bootsplash"&gt;react-native-bootsplash&lt;/a&gt; library. As at the time of writing this, I found it to be a better option than &lt;a href="https://github.com/crazycodeboy/react-native-splash-screen"&gt;react-native-splash-screen&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Firstly, if you don't have a running ReactNative app, you can create one by simply running this command &lt;code&gt;npx react-native init MyTestApp&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;After creating your project, open the terminal and install the library with any of these commands:&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 --save react-native-bootsplash
# --- or ---
$ yarn add react-native-bootsplash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I assume you're using React Native 0.60.0+, so I'm not going to talk about Manual linking or Pod linking here. &lt;/p&gt;

&lt;p&gt;Next step is to add a logo(image) that will be displayed on the splash screen.&lt;/p&gt;

&lt;p&gt;In the root folder, you can create an assets folder where you'll keep your logo and other images too.&lt;/p&gt;

&lt;p&gt;Use this command to generate the necessary Android &amp;amp; iOS assets from your logo.&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 generate-bootsplash ./path-to-your-logo-in-assets-folder
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;iOS&lt;/strong&gt;&lt;br&gt;
Edit the ios/YourProjectName/AppDelegate.m file:&lt;/p&gt;

&lt;p&gt;To import your header, add this line&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;#import "RNBootSplash.h"&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
 immediately after the&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;#import &amp;lt;React/RCTRootView.h&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Then, inside the &lt;em&gt;didFinishLaunchingWithOptions&lt;/em&gt; block, add this line:&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;[RNBootSplash initWithStoryboard:@"BootSplash" rootView:rootView];&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
 before the&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;return YES;&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
 statement to do the initialization using the storyboard file name.&lt;/p&gt;

&lt;p&gt;Lastly, ensure to set the BootSplash.storyboard as launch screen file.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Android&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Step 1&lt;/strong&gt;&lt;br&gt;
Edit the android/app/src/main/java/com/yourprojectname/MainActivity.java file:&lt;/p&gt;

&lt;p&gt;Firstly, immediately after the &lt;em&gt;package&lt;/em&gt; declaration add this line:&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;import android.os.Bundle;&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Next is to import RNBootSplash, immediately after importing &lt;em&gt;React&lt;/em&gt;&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;import com.zoontek.rnbootsplash.RNBootSplash;&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Then, add the onCreate method, where we'll display the generated bootsplash.xml drawable over the MainActivity:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    RNBootSplash.init(R.drawable.bootsplash, MainActivity.this);
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 2&lt;/strong&gt;&lt;br&gt;
Edit the android/app/src/main/res/values/styles.xml file:&lt;br&gt;
Set the generated bootsplash.xml drawable as activity background&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;style name="BootTheme" parent="AppTheme"&amp;gt;
    &amp;lt;item name="android:background"&amp;gt;@drawable/bootsplash&amp;lt;/item&amp;gt;
&amp;lt;/style&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 3&lt;/strong&gt;&lt;br&gt;
Edit the android/app/src/main/AndroidManifest.xml file:&lt;br&gt;
Remove the &lt;em&gt;intent-filter&lt;/em&gt; tag from .MainActivity and use the .RNBootSplashActivity theme you created.&lt;br&gt;
That means, you'll have this inside &lt;em&gt;application&lt;/em&gt; tag:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;activity android:name=".MainActivity" 
  android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize"&amp;gt;&amp;lt;/activity&amp;gt;
&amp;lt;activity android:name="SomeOtherActivity&amp;gt;&amp;lt;/activity&amp;gt;
&amp;lt;activity
  android:name="com.zoontek.rnbootsplash.RNBootSplashActivity"
  android:theme="@style/BootTheme"
  android:launchMode="singleTask"&amp;gt;
  &amp;lt;intent-filter&amp;gt;
    &amp;lt;action android:name="android.intent.action.MAIN" /&amp;gt;
    &amp;lt;category 
      android:name="android.intent.category.LAUNCHER"/&amp;gt;
  &amp;lt;/intent-filter&amp;gt;
&amp;lt;/activity&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt;&lt;br&gt;
On Android, if you get an error like this &lt;strong&gt;Security exception: Permission Denial: starting Intent { com.app_name/.MainActivity....&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You should go back to your AndroidManifest.xml file and add &lt;em&gt;android:exported="true"&lt;/em&gt; as one of the parameters to your .MainActivity tag. &lt;br&gt;
Then delete the &lt;em&gt;.gradle&lt;/em&gt; folder inside android folder, open your terminal, run&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;cd android&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
 and&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;gradlew clean&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4&lt;/strong&gt;&lt;br&gt;
Go to your App.js and&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;import RNBootSplash from 'react-native-bootsplash';&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Then if you're using functional components, your &lt;em&gt;useEffect&lt;/em&gt; hook may look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;useEffect(() =&amp;gt; {
    // Hide SplashScreen after 3secs or Make an async task
    setTimeout(() =&amp;gt; {
      RNBootSplash.hide({ fade: true });
    }, 3000);
  }, []);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 5&lt;/strong&gt;&lt;br&gt;
Enjoy your splash screen. 😄&lt;/p&gt;

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