Skip to content

Commit

Permalink
Merge pull request #1 from siddsarkar/fix_splash
Browse files Browse the repository at this point in the history
fix splashscreen
  • Loading branch information
siddsarkar authored Sep 28, 2021
2 parents 81527f4 + 97624a5 commit 2288291
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 9 deletions.
3 changes: 1 addition & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def jscFlavor = 'org.webkit:android-jsc:+'
* on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
* and the benefits of using Hermes will therefore be sharply reduced.
*/
def enableHermes = project.ext.react.get("enableHermes", false);
def enableHermes = project.ext.react.get("enableHermes", false)

android {
ndkVersion rootProject.ext.ndkVersion
Expand Down Expand Up @@ -190,7 +190,6 @@ 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"

debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
Expand Down
21 changes: 15 additions & 6 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,25 @@
android:icon="@mipmap/ic_launcher"
android:allowBackup="false"
android:theme="@style/AppTheme">

<activity
android:name=".SplashActivity"
android:theme="@style/SplashTheme"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:screenOrientation="portrait"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
android:windowSoftInputMode="adjustResize"
android:exported="true"
/>
</application>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ protected List<ReactPackage> getPackages() {
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
new SplashScreenReactPackage();
return packages;
}

Expand Down
17 changes: 17 additions & 0 deletions android/app/src/main/java/com/sociquote/SplashActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.sociquote;

import android.content.Intent;
import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;

public class SplashActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
finish();
}
}
7 changes: 7 additions & 0 deletions android/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,11 @@
<item name="colorPrimaryDark">@color/background</item>
<item name="android:windowLightStatusBar">false</item>
</style>
<style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:background">@drawable/background_splash</item>
<item name="android:statusBarColor">@color/background</item>
<!-- Add the following line to set the default status bar text color for all the app
to be a light color (false) or a dark color (true) -->
<item name="android:windowLightStatusBar">false</item>
</style>
</resources>
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"private": true,
"scripts": {
"build:android": "cd android && ./gradlew assembleRelease",
"android": "react-native run-android",
"clean:android": "cd android && ./gradlew clean",
"start:android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
Expand Down

0 comments on commit 2288291

Please sign in to comment.