Skip to content

Commit 6adbc4c

Browse files
authored
Merge pull request #54 from Jacse/Jacse-update-readme
Improve README
2 parents 108a5d7 + ea764f8 commit 6adbc4c

File tree

1 file changed

+31
-19
lines changed

1 file changed

+31
-19
lines changed

README.md

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
[![License MIT](http://img.shields.io/badge/license-MIT-orange.svg?style=flat)](https://raw.githubusercontent.com/crazycodeboy/react-native-check-box/master/LICENSE)
99
[ ![原理 解析](https://img.shields.io/badge/原理-解析-brightgreen.svg)](https://github.com/crazycodeboy/RNStudyNotes/blob/master/React%20Native%20%E9%97%AE%E9%A2%98%E5%8F%8A%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88%E5%90%88%E9%9B%86/React%20Native%20%E5%90%AF%E5%8A%A8%E7%99%BD%E5%B1%8F%E9%97%AE%E9%A2%98%E8%A7%A3%E5%86%B3%E6%95%99%E7%A8%8B/React%20Native%20%E5%90%AF%E5%8A%A8%E7%99%BD%E5%B1%8F%E9%97%AE%E9%A2%98%E8%A7%A3%E5%86%B3%E6%95%99%E7%A8%8B.md)
1010

11-
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.
1212

1313
## Content
1414

@@ -20,7 +20,7 @@ A splash screen for react-native, hide when application loaded ,it works on iOS
2020
- [Changes](#changes)
2121

2222
## 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)
2424

2525
## Examples
2626
* [Examples](https://github.com/crazycodeboy/react-native-splash-screen/tree/master/examples)
@@ -45,13 +45,13 @@ 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
```
5050
include ':react-native-splash-screen'
5151
project(':react-native-splash-screen').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-splash-screen/android')
5252
```
5353

54-
2.In your android/app/build.gradle file, add the `:react-native-splash-screen` project as a compile-time dependency:
54+
2. In your android/app/build.gradle file, add the `:react-native-splash-screen` project as a compile-time dependency:
5555

5656
```
5757
...
@@ -61,7 +61,7 @@ dependencies {
6161
}
6262
```
6363

64-
3.Update the MainApplication.java file to use `react-native-splash-screen` via the following changes:
64+
3. Update the MainApplication.java file to use `react-native-splash-screen` via the following changes:
6565

6666
```java
6767
import com.cboy.rn.splashscreen.SplashScreenReactPackage;
@@ -104,12 +104,12 @@ public class MainApplication extends Application implements ReactApplication {
104104

105105
**Android:**
106106

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:
108108

109109
```java
110110
import android.os.Bundle;
111111
import com.facebook.react.ReactActivity;
112-
import com.cboy.rn.splashscreen.SplashScreen;
112+
import com.cboy.rn.splashscreen.SplashScreen; // here
113113

114114
public class MainActivity extends ReactActivity {
115115
@Override
@@ -123,7 +123,7 @@ public class MainActivity extends ReactActivity {
123123

124124
**iOS:**
125125

126-
You should add following code to AppDelegate.m for keeping launch image:
126+
Update `AppDelegate.m` with the following additions:
127127

128128

129129
```obj-c
@@ -154,7 +154,7 @@ Import `react-native-splash-screen` in your JS file.
154154
155155
### Android:
156156
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:
158158
159159
```
160160
<?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.
165165
</LinearLayout>
166166
```
167167
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+
168177
**Optional steps:**
169178
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.
171180
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:
173182
174183
```xml
175184
<resources>
176185
<!-- Base application theme. -->
177186
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
178187
<!-- Customize your theme here. -->
179188
<!--设置透明背景-->
180-
+ <item name="android:windowIsTranslucent">true</item>
189+
<item name="android:windowIsTranslucent">true</item>
181190
</style>
182191
</resources>
183192
```
184193

185-
**Learn more to see [Examples](https://github.com/crazycodeboy/react-native-splash-screen/tree/master/Examples)**
194+
**To learn more see [examples](https://github.com/crazycodeboy/react-native-splash-screen/tree/master/examples)**
186195

187196

188197
### iOS
189198

190-
iOS can be used to customize your startup screen via LaunchImage or LaunchScreen.xib.
199+
Customize your splash screen via LaunchImage or LaunchScreen.xib,
200+
201+
**Learn more to see [examples](https://github.com/crazycodeboy/react-native-splash-screen/tree/master/examples)**
191202

192-
**Learn more to see [Examples](https://github.com/crazycodeboy/react-native-splash-screen/tree/master/examples)**
203+
## Usage
193204

194-
Then you can use it like this:
205+
Use like so:
195206

196207
```JavaScript
197208
import SplashScreen from 'react-native-splash-screen'
198209

199210
export default class WelcomePage extends Component {
200211

201212
componentDidMount() {
202-
// do anything while splash screen keeps, use await to wait for an async task.
213+
// do stuff while splash screen is shown
214+
// After having done stuff (such as async tasks) hide the splash screen
203215
SplashScreen.hide();
204216
}
205217
}
@@ -215,9 +227,9 @@ hide() | function | false | Close splash screen
215227

216228
## Contribution
217229

218-
Issues are welcome. Please add a screenshot of bug and code snippet. Quickest way to solve issue is to reproduce it on one of the examples.
230+
Issues are welcome. Please add a screenshot of you bug and a code snippet. Quickest way to solve issue is to reproduce it in one of the examples.
219231

220-
Pull requests are welcome. If you want to change API or making something big better to create issue and discuss it first.
232+
Pull requests are welcome. If you want to change the API or do something big it is best to create an issue and discuss it first.
221233

222234
---
223235

0 commit comments

Comments
 (0)