Commit b7cf4800 authored by Muhammad Ameen's avatar Muhammad Ameen 💻

Splash screen in progress

parent fbf4227d
import {View, Text} from 'react-native'; import {View, Text} from 'react-native';
import React from 'react'; import React, {useEffect} from 'react';
import {Provider} from 'react-redux'; import {Provider} from 'react-redux';
import store from './src/store/store'; import store from './src/store/store';
import Routes from './src/Routes/Routes'; import Routes from './src/Routes/Routes';
import SplashScreen from 'react-native-splash-screen';
const App = () => { const App = () => {
useEffect(() => {
SplashScreen.hide();
}, []);
return ( return (
<Provider store={store}> <Provider store={store}>
<Routes /> <Routes />
</Provider> </Provider>
); );
}; };
......
package com.baitussalam_app; package com.baitussalam_app;
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;
public class MainActivity extends ReactActivity { import org.devio.rn.splashscreen.SplashScreen;
public class MainActivity extends ReactActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
SplashScreen.show(this); // here
super.onCreate(savedInstanceState);
}
/** /**
* Returns the name of the main component registered from JavaScript. This is used to schedule * Returns the name of the main component registered from JavaScript. This is used to schedule
* rendering of the component. * rendering of the component.
......
...@@ -4,6 +4,7 @@ import android.app.Application; ...@@ -4,6 +4,7 @@ import android.app.Application;
import android.content.Context; import android.content.Context;
import com.facebook.react.PackageList; import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication; import com.facebook.react.ReactApplication;
import org.devio.rn.splashscreen.SplashScreenReactPackage;
import com.facebook.react.ReactInstanceManager; import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage; import com.facebook.react.ReactPackage;
......
<?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:src="@drawable/launch_screen" android:scaleType="centerCrop" /> -->
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="primary_dark">#000000</color>
<color name="status_bar_color">#000000</color>
</resources>
\ No newline at end of file
...@@ -5,5 +5,7 @@ ...@@ -5,5 +5,7 @@
<!-- Customize your theme here. --> <!-- Customize your theme here. -->
<item name="android:editTextBackground">@drawable/rn_edit_text_material</item> <item name="android:editTextBackground">@drawable/rn_edit_text_material</item>
</style> </style>
<style name="SplashScreenTheme" parent="SplashScreen_SplashTheme">
<item name="colorPrimaryDark">@color/status_bar_color</item>
</style>
</resources> </resources>
rootProject.name = 'baitussalam_app' rootProject.name = 'baitussalam_app'
include ':react-native-splash-screen'
project(':react-native-splash-screen').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-splash-screen/android')
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app' include ':app'
includeBuild('../node_modules/react-native-gradle-plugin') includeBuild('../node_modules/react-native-gradle-plugin')
......
...@@ -19,6 +19,8 @@ target 'baitussalam_app' do ...@@ -19,6 +19,8 @@ target 'baitussalam_app' do
:app_path => "#{Pod::Config.instance.installation_root}/.." :app_path => "#{Pod::Config.instance.installation_root}/.."
) )
pod 'react-native-splash-screen', :path => '../node_modules/react-native-splash-screen'
target 'baitussalam_appTests' do target 'baitussalam_appTests' do
inherit! :complete inherit! :complete
# Pods for testing # Pods for testing
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
"react-native": "0.68.2", "react-native": "0.68.2",
"react-native-safe-area-context": "^4.2.5", "react-native-safe-area-context": "^4.2.5",
"react-native-screens": "^3.13.1", "react-native-screens": "^3.13.1",
"react-native-splash-screen": "^3.3.0",
"react-redux": "^8.0.2" "react-redux": "^8.0.2"
}, },
"devDependencies": { "devDependencies": {
...@@ -10230,6 +10231,14 @@ ...@@ -10230,6 +10231,14 @@
"react-native": "*" "react-native": "*"
} }
}, },
"node_modules/react-native-splash-screen": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/react-native-splash-screen/-/react-native-splash-screen-3.3.0.tgz",
"integrity": "sha512-rGjt6HkoSXxMqH4SQUJ1gnPQlPJV8+J47+4yhgTIan4bVvAwJhEeJH7wWt9hXSdH4+VfwTS0GTaflj1Tw83IhA==",
"peerDependencies": {
"react-native": ">=0.57.0"
}
},
"node_modules/react-native/node_modules/ws": { "node_modules/react-native/node_modules/ws": {
"version": "6.2.2", "version": "6.2.2",
"resolved": "https://registry.npmjs.org/ws/-/ws-6.2.2.tgz", "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.2.tgz",
...@@ -19952,6 +19961,12 @@ ...@@ -19952,6 +19961,12 @@
"warn-once": "^0.1.0" "warn-once": "^0.1.0"
} }
}, },
"react-native-splash-screen": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/react-native-splash-screen/-/react-native-splash-screen-3.3.0.tgz",
"integrity": "sha512-rGjt6HkoSXxMqH4SQUJ1gnPQlPJV8+J47+4yhgTIan4bVvAwJhEeJH7wWt9hXSdH4+VfwTS0GTaflj1Tw83IhA==",
"requires": {}
},
"react-redux": { "react-redux": {
"version": "8.0.2", "version": "8.0.2",
"resolved": "https://registry.npmjs.org/react-redux/-/react-redux-8.0.2.tgz", "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-8.0.2.tgz",
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
"react-native": "0.68.2", "react-native": "0.68.2",
"react-native-safe-area-context": "^4.2.5", "react-native-safe-area-context": "^4.2.5",
"react-native-screens": "^3.13.1", "react-native-screens": "^3.13.1",
"react-native-splash-screen": "^3.3.0",
"react-redux": "^8.0.2" "react-redux": "^8.0.2"
}, },
"devDependencies": { "devDependencies": {
......
import { View, Text } from 'react-native' import {View, Text} from 'react-native';
import React from 'react' import React from 'react';
import SplashScreen from 'react-native-splash-screen'
import {useEffect} from 'react';
const SplashScreen = () => { const SplashScreenComp = () => {
return ( return (
<View> <View>
<Text>SplashScreen</Text> <Text>SplashScreen</Text>
</View> </View>
) );
} };
export default SplashScreen export default SplashScreenComp;
\ No newline at end of file
...@@ -2,7 +2,7 @@ import {View, Text} from 'react-native'; ...@@ -2,7 +2,7 @@ import {View, Text} from 'react-native';
import React from 'react'; import React from 'react';
import {NavigationContainer} from '@react-navigation/native'; import {NavigationContainer} from '@react-navigation/native';
import {createNativeStackNavigator} from '@react-navigation/native-stack'; import {createNativeStackNavigator} from '@react-navigation/native-stack';
import SplashScreen from '../Components/SplashScreen/SplashScreen'; import SplashScreenComp from '../Components/SplashScreen/SplashScreen';
const Stack = createNativeStackNavigator(); const Stack = createNativeStackNavigator();
...@@ -10,7 +10,11 @@ const Routes = () => { ...@@ -10,7 +10,11 @@ const Routes = () => {
return ( return (
<NavigationContainer> <NavigationContainer>
<Stack.Navigator> <Stack.Navigator>
<Stack.Screen name="Home" component={SplashScreen} /> <Stack.Screen
name="Home"
component={SplashScreenComp}
options={{headerShown: false}}
/>
</Stack.Navigator> </Stack.Navigator>
</NavigationContainer> </NavigationContainer>
); );
......
...@@ -5751,7 +5751,12 @@ ...@@ -5751,7 +5751,12 @@
"react-freeze" "^1.0.0" "react-freeze" "^1.0.0"
"warn-once" "^0.1.0" "warn-once" "^0.1.0"
"react-native@*", "react-native@>=0.59", "react-native@0.68.2": "react-native-splash-screen@^3.3.0":
"integrity" "sha512-rGjt6HkoSXxMqH4SQUJ1gnPQlPJV8+J47+4yhgTIan4bVvAwJhEeJH7wWt9hXSdH4+VfwTS0GTaflj1Tw83IhA=="
"resolved" "https://registry.npmjs.org/react-native-splash-screen/-/react-native-splash-screen-3.3.0.tgz"
"version" "3.3.0"
"react-native@*", "react-native@>=0.57.0", "react-native@>=0.59", "react-native@0.68.2":
"integrity" "sha512-qNMz+mdIirCEmlrhapAtAG+SWVx6MAiSfCbFNhfHqiqu1xw1OKXdzIrjaBEPihRC2pcORCoCHduHGQe/Pz9Yuw==" "integrity" "sha512-qNMz+mdIirCEmlrhapAtAG+SWVx6MAiSfCbFNhfHqiqu1xw1OKXdzIrjaBEPihRC2pcORCoCHduHGQe/Pz9Yuw=="
"resolved" "https://registry.npmjs.org/react-native/-/react-native-0.68.2.tgz" "resolved" "https://registry.npmjs.org/react-native/-/react-native-0.68.2.tgz"
"version" "0.68.2" "version" "0.68.2"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment