Skip to content

Instantly share code, notes, and snippets.

View parth-koshta's full-sized avatar
:electron:

Parth N Koshta parth-koshta

:electron:
View GitHub Profile
@parth-koshta
parth-koshta / build.gradle
Created January 24, 2022 15:58
android/app/build.gradle
android {
...
flavorDimensions "default"
productFlavors {
prod {
minSdkVersion rootProject.ext.minSdkVersion
applicationId 'com.rn_base'
targetSdkVersion rootProject.ext.targetSdkVersion
resValue "string", "build_config_package", "com.rn_base"
}
@parth-koshta
parth-koshta / styles.xml
Created January 8, 2022 19:38
Medium article - splash screen
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<!-- Customize your theme here. -->
</style>
<!-- BootTheme should inherit from Theme.SplashScreen -->
<style name="BootTheme" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">@color/bootsplash_background_dark</item>
@parth-koshta
parth-koshta / colors.xml
Last active January 8, 2022 19:38
Medium article - splash screen
<resources>
<color name="bootsplash_background">#FFF5E6</color>
<color name="bootsplash_background_dark">#020f25</color> // Add this line
</resources>
@parth-koshta
parth-koshta / MainActivity.java
Created January 8, 2022 18:55
Medium article - splash screen
package com.rn_base;
import com.facebook.react.ReactActivity;
import com.facebook.react.ReactActivityDelegate; // add this line
import com.zoontek.rnbootsplash.RNBootSplash; // add this line
public class MainActivity extends ReactActivity {
// ...
@parth-koshta
parth-koshta / AndroidManifest.xml
Created January 8, 2022 18:52
Medium article - splash screen
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.rn_base">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
@parth-koshta
parth-koshta / styles.xml
Created January 8, 2022 18:49
Medium article - splash screen
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<!-- Customize your theme here. -->
</style>
<!-- BootTheme should inherit from Theme.SplashScreen -->
<style name="BootTheme" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">@color/bootsplash_background</item>
@parth-koshta
parth-koshta / app_build.gradle
Created January 8, 2022 18:48
Medium article - splash screen
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
// ...
implementation "androidx.core:core-splashscreen:1.0.0-alpha02" // add this line
@parth-koshta
parth-koshta / build.gradle
Created January 8, 2022 18:45
Medium article - splash screen
buildscript {
ext {
buildToolsVersion = "30.0.2"
minSdkVersion = 23 // Change this
compileSdkVersion = 31 // Change this
targetSdkVersion = 31 // Change this
ndkVersion = "21.4.7075529"
}
// ...
@parth-koshta
parth-koshta / AppDelegate.h
Created January 8, 2022 18:35
Medium article - splash screen
#import "AppDelegate.h"
#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import "RNBootSplash.h" // add this line
// ...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
@parth-koshta
parth-koshta / Counter.js
Created December 26, 2021 16:40
Medium article - redux setup
import React from 'react';
import {View, Text, TouchableOpacity} from 'react-native';
import {useDispatch, useSelector} from 'react-redux';
import {
decrementCount,
incrementCount,
} from '../../redux/actions/CounterActions';
import {selectCounterValue} from '../../redux/selectors/CounterSelector';
import {persistor} from '../../redux/store';