Skip to content

Commit

Permalink
Splash screen on android (#1554)
Browse files Browse the repository at this point in the history
* splash screen installed and working on android

* ios comment for more details

* Update Podfile.lock

* Fix no new line
  • Loading branch information
andrepimenta authored Jun 3, 2020
1 parent a0fff81 commit 8518d63
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 0 deletions.
3 changes: 3 additions & 0 deletions android/app/src/main/java/io/metamask/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

import androidx.annotation.NonNull;

import org.devio.rn.splashscreen.SplashScreen;

public class MainActivity extends ReactFragmentActivity {

/**
Expand Down Expand Up @@ -44,6 +46,7 @@ protected void onStart() {

@Override
protected void onCreate(Bundle savedInstanceState) {
SplashScreen.show(this);
super.onCreate(null);
}
@Override
Expand Down
Binary file added android/app/src/main/res/drawable/diamond.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions android/app/src/main/res/layout/launch_screen.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?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" android:background="#ffffffff">
<ImageView android:layout_width="match_parent" android:layout_height="match_parent" android:src="@drawable/diamond" android:scaleType="center" />
</RelativeLayout>
2 changes: 2 additions & 0 deletions app/components/Views/Entry/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { colors } from '../../../styles/common';
import DeeplinkManager from '../../../core/DeeplinkManager';
import Logger from '../../../util/Logger';
import Device from '../../../util/Device';
import SplashScreen from 'react-native-splash-screen';

/**
* Entry Screen that decides which screen to show
Expand Down Expand Up @@ -90,6 +91,7 @@ class Entry extends PureComponent {
async componentDidMount() {
DeeplinkManager.init(this.props.navigation);
this.unsubscribeFromBranch = Branch.subscribe(this.handleDeeplinks);
SplashScreen.hide();
const existingUser = await AsyncStorage.getItem('@MetaMask:existingUser');
if (existingUser !== null) {
await this.unlockKeychain();
Expand Down
3 changes: 3 additions & 0 deletions ios/MetaMask/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
launchScreenView.frame = self.window.bounds;
rootView.loadingView = launchScreenView;

//Uncomment the following line to enable the splashscreen on ios
//[RNSplashScreen show];

return YES;
}

Expand Down
6 changes: 6 additions & 0 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ PODS:
- React
- react-native-randombytes (3.5.3):
- React
- react-native-splash-screen (3.2.0):
- React
- react-native-view-shot (3.1.2):
- React
- react-native-viewpager (3.3.0):
Expand Down Expand Up @@ -422,6 +424,7 @@ DEPENDENCIES:
- react-native-camera (from `../node_modules/react-native-camera`)
- "react-native-netinfo (from `../node_modules/@react-native-community/netinfo`)"
- react-native-randombytes (from `../node_modules/react-native-randombytes`)
- react-native-splash-screen (from `../node_modules/react-native-splash-screen`)
- react-native-view-shot (from `../node_modules/react-native-view-shot`)
- "react-native-viewpager (from `../node_modules/@react-native-community/viewpager`)"
- react-native-webview (from `../node_modules/react-native-webview`)
Expand Down Expand Up @@ -516,6 +519,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/@react-native-community/netinfo"
react-native-randombytes:
:path: "../node_modules/react-native-randombytes"
react-native-splash-screen:
:path: "../node_modules/react-native-splash-screen"
react-native-view-shot:
:path: "../node_modules/react-native-view-shot"
react-native-viewpager:
Expand Down Expand Up @@ -614,6 +619,7 @@ SPEC CHECKSUMS:
react-native-camera: 5d4ee26d19ac5aa9a8d8663b50f53b1c1250597c
react-native-netinfo: 0e563248a4b9a99c33ec29bd03c2d50767db22a6
react-native-randombytes: 3638d24759d67c68f6ccba60c52a7a8a8faa6a23
react-native-splash-screen: 200d11d188e2e78cea3ad319964f6142b6384865
react-native-view-shot: 4475fde003fe8a210053d1f98fb9e06c1d834e1c
react-native-viewpager: a7b438ca32c57b2614ece2a123e7fe116f743131
react-native-webview: 174e0f8f1bf547224a134215607c75c4bb0312b7
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
"react-native-scrollable-tab-view": "^1.0.0",
"react-native-search-api": "ombori/react-native-search-api#8/head",
"react-native-sensors": "5.3.0",
"react-native-splash-screen": "git+ssh://git@github.com/MetaMask/react-native-splash-screen.git",
"react-native-share": "^3.2.0",
"react-native-svg": "9.13.3",
"react-native-swipe-gestures": "1.0.3",
Expand Down
4 changes: 4 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10535,6 +10535,10 @@ react-native-share@^3.2.0:
resolved "https://registry.yarnpkg.com/react-native-share/-/react-native-share-3.3.2.tgz#06d1d3f14ba8eeb95e7e94e4db6a286e9902bd29"
integrity sha512-Pvkr62TiCX511RMPL+wvy9Fofre4HQnvUT5zzgPPN3vszP/C8lUb7cmFu/8x5U14t3JQg+xW/svNK5eKNebJKw==

"react-native-splash-screen@git+ssh://git@github.com/MetaMask/react-native-splash-screen.git":
version "3.2.0"
resolved "git+ssh://git@github.com/MetaMask/react-native-splash-screen.git#1f45c08c0824cd94fdc6fb699529688a73614fee"

react-native-svg@9.13.3:
version "9.13.3"
resolved "https://registry.yarnpkg.com/react-native-svg/-/react-native-svg-9.13.3.tgz#6414b337d55af169ac2487ab70f3108404434446"
Expand Down

0 comments on commit 8518d63

Please sign in to comment.