You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A splash screen for react-native, hide when application loaded ,it works on iOS and Android.
11
+
A splash screen API for react-native which can programatically hide and show the splash screen. Works on iOS and Android.
12
12
13
13
## Content
14
14
@@ -20,7 +20,7 @@ A splash screen for react-native, hide when application loaded ,it works on iOS
20
20
-[Changes](#changes)
21
21
22
22
## Changes
23
-
React Native>=4.0 to use [v2.+](https://github.com/crazycodeboy/react-native-splash-screen/releases) ,and React Native<4.0 to use [v1.0.9](https://github.com/crazycodeboy/react-native-splash-screen/releases/tag/v1.0.9)
23
+
For React Native >= 4.0 use [v2.+](https://github.com/crazycodeboy/react-native-splash-screen/releases), for React Native < 4.0 use [v1.0.9](https://github.com/crazycodeboy/react-native-splash-screen/releases/tag/v1.0.9)
@@ -104,12 +104,12 @@ public class MainApplication extends Application implements ReactApplication {
104
104
105
105
**Android:**
106
106
107
-
Update the MainActivity.java file to use `react-native-splash-screen` via the following changes:
107
+
Update the `MainActivity.java` to use `react-native-splash-screen` via the following changes:
108
108
109
109
```java
110
110
importandroid.os.Bundle;
111
111
importcom.facebook.react.ReactActivity;
112
-
importcom.cboy.rn.splashscreen.SplashScreen;
112
+
importcom.cboy.rn.splashscreen.SplashScreen;// here
113
113
114
114
publicclassMainActivityextendsReactActivity {
115
115
@Override
@@ -123,7 +123,7 @@ public class MainActivity extends ReactActivity {
123
123
124
124
**iOS:**
125
125
126
-
You should add following code to AppDelegate.m for keeping launch image:
126
+
Update `AppDelegate.m` with the following additions:
127
127
128
128
129
129
```obj-c
@@ -154,7 +154,7 @@ Import `react-native-splash-screen` in your JS file.
154
154
155
155
### Android:
156
156
157
-
Add a file called launch_screen.xml in the layout as the splash screen.
157
+
Create a file called `launch_screen.xml` in `app/src/main/res/layout` (create the `layout`-folder if it doesn't exist). The contents of the file should be the following:
158
158
159
159
```
160
160
<?xml version="1.0" encoding="utf-8"?>
@@ -165,41 +165,53 @@ Add a file called launch_screen.xml in the layout as the splash screen.
165
165
</LinearLayout>
166
166
```
167
167
168
+
Customize your launch screen by creating a `launch_screen.png`-file and placing it in an appropriate `drawable`-folder. Android automatically scales drawable, so you do not necessarily need to provide images for all phone densities.
169
+
You can create splash screens in the following folders:
170
+
* `drawable-ldpi`
171
+
* `drawable-mdpi`
172
+
* `drawable-hdpi`
173
+
* `drawable-xhdpi`
174
+
* `drawable-xxhdpi`
175
+
* `drawable-xxxhdpi`
176
+
168
177
**Optional steps:**
169
178
170
-
You can also via the following steps to set the window transparent.
179
+
If you want the splash screen to be transparent, follow these steps.
171
180
172
-
open `android/app/src/main/res/values/styles.xml`, to add `<item name="android:windowIsTranslucent">true</item>`,like this:
181
+
Open `android/app/src/main/res/values/styles.xml` and add `<item name="android:windowIsTranslucent">true</item>` to the file. It should look like this:
0 commit comments