Skip to content

Commit 7a54a0e

Browse files
authored
Merge branch 'master' into master
2 parents c078edf + 4216dc9 commit 7a54a0e

File tree

6 files changed

+39
-32
lines changed

6 files changed

+39
-32
lines changed

README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ For React Native >= 0.47.0 use [v3.+](https://github.com/crazycodeboy/react-nati
2525
## Examples
2626
* [Examples](https://github.com/crazycodeboy/react-native-splash-screen/tree/master/examples)
2727

28-
![react-native-splash-screen-Android](https://raw.githubusercontent.com/crazycodeboy/react-native-splash-screen/master/examples/Screenshots/react-native-splash-screen-Android.gif)
29-
![react-native-splash-screen-iOS](https://raw.githubusercontent.com/crazycodeboy/react-native-splash-screen/master/examples/Screenshots/react-native-splash-screen-iOS.gif)
28+
![react-native-splash-screen-Android](https://raw.githubusercontent.com/crazycodeboy/react-native-splash-screen/v3.0.0/examples/Screenshots/react-native-splash-screen-Android.gif)
29+
![react-native-splash-screen-iOS](https://raw.githubusercontent.com/crazycodeboy/react-native-splash-screen/v3.0.0/examples/Screenshots/react-native-splash-screen-iOS.gif)
3030

3131

3232

@@ -45,7 +45,7 @@ Run `npm i react-native-splash-screen --save`
4545

4646
**Android:**
4747

48-
1. In your android/settings.gradle file, make the following additions:
48+
1. In your `android/settings.gradle` file, make the following additions:
4949
```java
5050
include ':react-native-splash-screen'
5151
project(':react-native-splash-screen').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-splash-screen/android')
@@ -134,9 +134,10 @@ Update `AppDelegate.m` with the following additions:
134134

135135

136136
```obj-c
137-
138137
#import "AppDelegate.h"
139-
#import "RCTRootView.h"
138+
139+
#import <React/RCTBundleURLProvider.h>
140+
#import <React/RCTRootView.h>
140141
#import "SplashScreen.h" // here
141142

142143
@implementation AppDelegate
@@ -181,7 +182,7 @@ You can create splash screens in the following folders:
181182
* `drawable-xxhdpi`
182183
* `drawable-xxxhdpi`
183184

184-
To modify the status bar color, you can add a color called primary_dark in color.xml
185+
Add a color called `primary_dark` in `app/src/main/res/values/color.xml`
185186

186187
```
187188
<?xml version="1.0" encoding="utf-8"?>
@@ -233,12 +234,12 @@ Create a style definition for this in `android/app/src/main/res/values/colors.xm
233234

234235
Change your `show` method to include your custom style:
235236
```java
236-
SplashScreen.show(this, false, R.style.SplashScreenTheme);
237+
SplashScreen.show(this, R.style.SplashScreenTheme);
237238
```
238239

239240
### iOS
240241

241-
Customize your splash screen via LaunchImage or LaunchScreen.xib,
242+
Customize your splash screen via `LaunchImage` or `LaunchScreen.xib`,
242243

243244
**Learn more to see [examples](https://github.com/crazycodeboy/react-native-splash-screen/tree/master/examples)**
244245

@@ -275,4 +276,4 @@ Pull requests are welcome. If you want to change the API or do something big it
275276

276277
---
277278

278-
**MIT Licensed**
279+
**[MIT Licensed](https://github.com/crazycodeboy/react-native-splash-screen/blob/master/LICENSE)**

README.zh.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ React Native启动屏,解决iOS,Android启动白屏问题,支持Android和
2323
## 演示
2424
* [Examples](https://github.com/crazycodeboy/react-native-splash-screen/tree/master/examples)
2525

26-
![react-native-splash-screen-Android](https://raw.githubusercontent.com/crazycodeboy/react-native-splash-screen/master/examples/Screenshots/react-native-splash-screen-Android.gif)
27-
![react-native-splash-screen-iOS](https://raw.githubusercontent.com/crazycodeboy/react-native-splash-screen/master/examples/Screenshots/react-native-splash-screen-iOS.gif)
26+
![react-native-splash-screen-Android](https://raw.githubusercontent.com/crazycodeboy/react-native-splash-screen/v3.0.0/examples/Screenshots/react-native-splash-screen-Android.gif)
27+
![react-native-splash-screen-iOS](https://raw.githubusercontent.com/crazycodeboy/react-native-splash-screen/v3.0.0/examples/Screenshots/react-native-splash-screen-iOS.gif)
2828

2929

3030
## 改变
@@ -134,10 +134,11 @@ public class MainActivity extends ReactActivity {
134134

135135

136136
```obj-c
137-
138137
#import "AppDelegate.h"
139-
#import "RCTRootView.h"
140-
#import "SplashScreen.h" // here
138+
139+
#import <React/RCTBundleURLProvider.h>
140+
#import <React/RCTRootView.h>
141+
#import "SplashScreen.h" // 添加这一句
141142

142143
@implementation AppDelegate
143144

android/src/main/AndroidManifest.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
package="org.devio.rn.splashscreen">
33

44
<application
5-
android:allowBackup="true"
6-
android:label="@string/app_name"
7-
android:supportsRtl="true">
5+
android:label="@string/app_name">
86

97
</application>
108

android/src/main/java/org/devio/rn/splashscreen/SplashScreen.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,20 @@
1414
* Email:crazycodeboy@gmail.com
1515
*/
1616
public class SplashScreen {
17-
private static int NULL_ID = 0;
1817
private static Dialog mSplashDialog;
1918
private static WeakReference<Activity> mActivity;
2019

2120
/**
2221
* 打开启动屏
2322
*/
24-
public static void show(final Activity activity, final boolean fullScreen, final int themeResId) {
23+
public static void show(final Activity activity, final int themeResId) {
2524
if (activity == null) return;
2625
mActivity = new WeakReference<Activity>(activity);
2726
activity.runOnUiThread(new Runnable() {
2827
@Override
2928
public void run() {
3029
if (!activity.isFinishing()) {
31-
32-
mSplashDialog = new Dialog(
33-
activity,
34-
themeResId != NULL_ID ? themeResId
35-
: fullScreen ? R.style.SplashScreen_Fullscreen
36-
: R.style.SplashScreen_SplashTheme
37-
);
30+
mSplashDialog = new Dialog(activity, themeResId);
3831
mSplashDialog.setContentView(R.layout.launch_screen);
3932
mSplashDialog.setCancelable(false);
4033

@@ -50,7 +43,9 @@ public void run() {
5043
* 打开启动屏
5144
*/
5245
public static void show(final Activity activity, final boolean fullScreen) {
53-
show(activity, fullScreen, 0);
46+
int resourceId = fullScreen ? R.style.SplashScreen_Fullscreen : R.style.SplashScreen_SplashTheme;
47+
48+
show(activity, resourceId);
5449
}
5550

5651
/**
Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3-
android:orientation="vertical" android:layout_width="match_parent"
4-
android:layout_height="match_parent"
5-
android:background="@drawable/launch_screen">
62

7-
</LinearLayout>
3+
<RelativeLayout
4+
xmlns:android="http://schemas.android.com/apk/res/android"
5+
android:layout_width="fill_parent"
6+
android:layout_height="fill_parent"
7+
android:background="@android:color/black">
8+
9+
<LinearLayout
10+
android:layout_width="350dip"
11+
android:layout_height="450dip"
12+
android:layout_centerInParent="true"
13+
android:background="@drawable/launch_screen"
14+
android:orientation="vertical"
15+
android:padding="30dip"
16+
>
17+
</LinearLayout>
18+
</RelativeLayout>

index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
declare module "react-native-splash-screen" {
22
export default class SplashScreen {
33
static hide(): void;
4+
static show(): void;
45
}
56
}

0 commit comments

Comments
 (0)