Added android splash screen

This commit is contained in:
Arnaud Vergnet 2020-04-26 23:05:27 +02:00
parent 19d5663210
commit cb5fac940b
8 changed files with 34 additions and 10 deletions

2
App.js
View file

@ -17,6 +17,7 @@ import ConnectionManager from "./src/managers/ConnectionManager";
import URLHandler from "./src/utils/URLHandler"; import URLHandler from "./src/utils/URLHandler";
import {setSafeBounceHeight} from "react-navigation-collapsible"; import {setSafeBounceHeight} from "react-navigation-collapsible";
import {enableScreens} from 'react-native-screens'; import {enableScreens} from 'react-native-screens';
import SplashScreen from 'react-native-splash-screen'
// Native optimizations https://reactnavigation.org/docs/react-native-screens // Native optimizations https://reactnavigation.org/docs/react-native-screens
enableScreens(true); enableScreens(true);
@ -175,6 +176,7 @@ export default class App extends React.Component<Props, State> {
showUpdate: this.storageManager.preferences.updateNumber.current !== Update.number.toString(), showUpdate: this.storageManager.preferences.updateNumber.current !== Update.number.toString(),
showAprilFools: AprilFoolsManager.getInstance().isAprilFoolsEnabled() && this.storageManager.preferences.showAprilFoolsStart.current === '1', showAprilFools: AprilFoolsManager.getInstance().isAprilFoolsEnabled() && this.storageManager.preferences.showAprilFoolsStart.current === '1',
}); });
SplashScreen.hide();
} }
/** /**

View file

@ -1,5 +1,6 @@
package fr.amicaleinsat.application; package fr.amicaleinsat.application;
import android.os.Bundle;
import com.facebook.react.ReactActivity; import com.facebook.react.ReactActivity;
import com.facebook.react.ReactActivityDelegate; import com.facebook.react.ReactActivityDelegate;
import com.facebook.react.ReactRootView; import com.facebook.react.ReactRootView;
@ -7,6 +8,8 @@ import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
import android.content.Intent; import android.content.Intent;
import android.content.res.Configuration; import android.content.res.Configuration;
import org.devio.rn.splashscreen.SplashScreen;
public class MainActivity extends ReactActivity { public class MainActivity extends ReactActivity {
// Added automatically by Expo Config // Added automatically by Expo Config
@ -18,6 +21,11 @@ public class MainActivity extends ReactActivity {
sendBroadcast(intent); sendBroadcast(intent);
} }
@Override
protected void onCreate(Bundle savedInstanceState) {
SplashScreen.show(this);
super.onCreate(savedInstanceState);
}
/** /**
* Returns the name of the main component registered from JavaScript. * Returns the name of the main component registered from JavaScript.

View file

@ -21,7 +21,6 @@ public class BasePackageList {
new expo.modules.permissions.PermissionsPackage(), new expo.modules.permissions.PermissionsPackage(),
new expo.modules.securestore.SecureStorePackage(), new expo.modules.securestore.SecureStorePackage(),
new expo.modules.sqlite.SQLitePackage(), new expo.modules.sqlite.SQLitePackage(),
new expo.modules.updates.UpdatesPackage(),
new expo.modules.webbrowser.WebBrowserPackage() new expo.modules.webbrowser.WebBrowserPackage()
); );
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimary"
android:scaleType="fitCenter"
android:src="@drawable/launch_screen" />
</RelativeLayout>

View file

@ -4,4 +4,5 @@
<color name="navigationBarColor">#121212</color> <color name="navigationBarColor">#121212</color>
<color name="colorPrimaryDark">#be1522</color> <color name="colorPrimaryDark">#be1522</color>
<color name="colorPrimary">#be1522</color> <color name="colorPrimary">#be1522</color>
<color name="primary_dark">#be1522</color>
</resources> </resources>

View file

@ -43,4 +43,5 @@ target 'Campus' do
# react-native-cli autolinking # react-native-cli autolinking
use_native_modules! use_native_modules!
end end

View file

@ -18,21 +18,13 @@
] ]
}, },
"dependencies": { "dependencies": {
"expo": "^37.0.0",
"react": "~16.9.0",
"react-dom": "16.9.0",
"react-native": "~0.61.5",
"react-native-gesture-handler": "~1.6.0",
"react-native-reanimated": "~1.7.0",
"react-native-screens": "~2.2.0",
"react-native-unimodules": "~0.9.0",
"react-native-web": "~0.11.7",
"@expo/vector-icons": "^10.0.0", "@expo/vector-icons": "^10.0.0",
"@react-native-community/masked-view": "0.1.6", "@react-native-community/masked-view": "0.1.6",
"@react-navigation/bottom-tabs": "^5.1.1", "@react-navigation/bottom-tabs": "^5.1.1",
"@react-navigation/drawer": "^5.1.1", "@react-navigation/drawer": "^5.1.1",
"@react-navigation/native": "^5.0.9", "@react-navigation/native": "^5.0.9",
"@react-navigation/stack": "^5.1.1", "@react-navigation/stack": "^5.1.1",
"expo": "^37.0.0",
"expo-barcode-scanner": "~8.1.0", "expo-barcode-scanner": "~8.1.0",
"expo-camera": "latest", "expo-camera": "latest",
"expo-linear-gradient": "~8.1.0", "expo-linear-gradient": "~8.1.0",
@ -40,17 +32,26 @@
"expo-permissions": "~8.1.0", "expo-permissions": "~8.1.0",
"expo-secure-store": "~8.1.0", "expo-secure-store": "~8.1.0",
"i18n-js": "^3.3.0", "i18n-js": "^3.3.0",
"react": "~16.9.0",
"react-dom": "16.9.0",
"react-native": "~0.61.5",
"react-native-animatable": "^1.3.3", "react-native-animatable": "^1.3.3",
"react-native-app-intro-slider": "^4.0.0", "react-native-app-intro-slider": "^4.0.0",
"react-native-appearance": "~0.3.3", "react-native-appearance": "~0.3.3",
"react-native-autolink": "^3.0.0", "react-native-autolink": "^3.0.0",
"react-native-calendars": "^1.260.0", "react-native-calendars": "^1.260.0",
"react-native-collapsible": "^1.5.2", "react-native-collapsible": "^1.5.2",
"react-native-gesture-handler": "~1.6.0",
"react-native-image-modal": "^1.0.6", "react-native-image-modal": "^1.0.6",
"react-native-modalize": "^1.3.6", "react-native-modalize": "^1.3.6",
"react-native-paper": "^3.8.0", "react-native-paper": "^3.8.0",
"react-native-reanimated": "~1.7.0",
"react-native-render-html": "^4.1.2", "react-native-render-html": "^4.1.2",
"react-native-safe-area-context": "0.7.3", "react-native-safe-area-context": "0.7.3",
"react-native-screens": "~2.2.0",
"react-native-splash-screen": "^3.2.0",
"react-native-unimodules": "~0.9.0",
"react-native-web": "~0.11.7",
"react-native-webview": "8.1.1", "react-native-webview": "8.1.1",
"react-navigation-collapsible": "^5.5.0", "react-navigation-collapsible": "^5.5.0",
"react-navigation-header-buttons": "^3.0.5" "react-navigation-header-buttons": "^3.0.5"