Skip to content

Commit 76efcb0

Browse files
author
TomWq
committed
新版本提交,适配 react-native 0.84
1 parent b471976 commit 76efcb0

99 files changed

Lines changed: 3620 additions & 9262 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 74 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# react-native-splash-screen
22

33

4-
[![Download](https://img.shields.io/badge/Download-v3.3.0-ff69b4.svg) ](https://www.npmjs.com/package/react-native-splash-screen)
4+
[![Download](https://img.shields.io/badge/Download-v4.0.0-ff69b4.svg) ](https://www.npmjs.com/package/react-native-splash-screen)
55
[ ![PRs Welcome](https://img.shields.io/badge/PRs-Welcome-brightgreen.svg)](https://github.com/crazycodeboy/react-native-splash-screen/pulls)
66
[ ![react-native-splash-screen release](https://img.shields.io/github/release/crazycodeboy/react-native-splash-screen.svg?maxAge=2592000?style=flat-square)](https://github.com/crazycodeboy/GitHubPopular/releases)
77
[ ![语言 中文](https://img.shields.io/badge/语言-中文-feb252.svg)](https://github.com/crazycodeboy/react-native-splash-screen/blob/master/README.zh.md)
@@ -13,6 +13,7 @@ A splash screen API for react-native which can programatically hide and show the
1313

1414
## Content
1515

16+
- [v4 Quick Start (RN >= 0.84)](#v4-quick-start-rn--084)
1617
- [Changes](#changes)
1718
- [Installation](#installation)
1819
- [Examples](#examples)
@@ -22,9 +23,77 @@ A splash screen API for react-native which can programatically hide and show the
2223
- [Troubleshooting](#troubleshooting)
2324
- [Contribution](#contribution)
2425

26+
## v4 Quick Start (RN >= 0.84)
27+
28+
`4.x` is built for React Native New Architecture (TurboModule/Codegen) and supports `react-native >= 0.84.0`.
29+
30+
### 1. Install
31+
32+
```bash
33+
npm i react-native-splash-screen
34+
```
35+
36+
> No `react-native link`, and no manual edits to `settings.gradle` / `MainApplication` are required.
37+
38+
### 2. JS usage
39+
40+
```ts
41+
import SplashScreen from 'react-native-splash-screen';
42+
43+
SplashScreen.hide();
44+
```
45+
46+
### 3. Android (Kotlin)
47+
48+
Call before `super.onCreate` in `MainActivity.kt`:
49+
50+
```kotlin
51+
override fun onCreate(savedInstanceState: Bundle?) {
52+
SplashScreen.show(this, true)
53+
super.onCreate(savedInstanceState)
54+
}
55+
```
56+
57+
Create `android/app/src/main/res/layout/launch_screen.xml`:
58+
59+
```xml
60+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
61+
android:layout_width="match_parent"
62+
android:layout_height="match_parent"
63+
android:background="#000000">
64+
<ImageView
65+
android:layout_width="match_parent"
66+
android:layout_height="match_parent"
67+
android:scaleType="centerCrop"
68+
android:src="@mipmap/launch_screen" />
69+
</RelativeLayout>
70+
```
71+
72+
### 4. iOS (Swift)
73+
74+
Add in `AppDelegate.swift`:
75+
76+
```swift
77+
import react_native_splash_screen
78+
```
79+
80+
Then call:
81+
82+
```swift
83+
RNSplashScreen.show()
84+
```
85+
86+
Use `LaunchScreen.storyboard` + Assets.xcassets for your static launch image.
87+
88+
### 5. Android 12+ note
89+
90+
Android 12+ always shows a system splash phase first (often with app icon). This is platform behavior.
91+
This library controls your in-app custom splash show/hide behavior.
92+
2593

2694
## Changes
27-
For React Native >= 0.47.0 use [v3.+](https://github.com/crazycodeboy/react-native-splash-screen/releases), for React Native < 0.47.0 use [v2.1.0](https://github.com/crazycodeboy/react-native-splash-screen/releases/tag/v1.0.9)
95+
- `v4.x`: React Native `>= 0.84.0` (New Architecture / TurboModule / Codegen)
96+
- `v3.x`: legacy architecture
2897

2998
## Examples
3099
* [Examples](https://github.com/crazycodeboy/react-native-splash-screen/tree/master/examples)
@@ -36,6 +105,9 @@ For React Native >= 0.47.0 use [v3.+](https://github.com/crazycodeboy/react-nati
36105

37106
## Installation
38107

108+
> The "automatic/manual installation" steps below are mainly for legacy React Native projects.
109+
> For `react-native >= 0.84.0`, use the `v4 Quick Start` section above.
110+
39111
### First step(Download):
40112
Run `npm i react-native-splash-screen --save`
41113

README.zh.md

Lines changed: 74 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# react-native-splash-screen
22

3-
[![Download](https://img.shields.io/badge/Download-v3.1.1-ff69b4.svg) ](https://www.npmjs.com/package/react-native-splash-screen)
3+
[![Download](https://img.shields.io/badge/Download-v4.0.0-ff69b4.svg) ](https://www.npmjs.com/package/react-native-splash-screen)
44
[ ![PRs Welcome](https://img.shields.io/badge/PRs-Welcome-brightgreen.svg)](https://github.com/crazycodeboy/react-native-splash-screen/pulls)
55
[ ![react-native-splash-screen release](https://img.shields.io/github/release/crazycodeboy/react-native-splash-screen.svg?maxAge=2592000?style=flat-square)](https://github.com/crazycodeboy/GitHubPopular/releases)
66
[ ![language English](https://img.shields.io/badge/language-English-feb252.svg)](https://github.com/crazycodeboy/GitHubPopular/)
@@ -13,13 +13,81 @@ React Native启动屏,解决iOS,Android启动白屏问题,支持Android和
1313

1414
## 目录
1515

16+
- [v4 快速开始(RN >= 0.84)](#v4-快速开始rn--084)
1617
- [安装说明](#安装说明)
1718
- [演示](#演示)
1819
- [使用说明](#使用说明)
1920
- [API](#api)
2021
- [贡献](#贡献)
2122
- [改变](#改变)
2223

24+
## v4 快速开始(RN >= 0.84)
25+
26+
`4.x` 版本基于 React Native New Architecture(TurboModule/Codegen),并且只支持 `react-native >= 0.84.0`
27+
28+
### 1. 安装
29+
30+
```bash
31+
npm i react-native-splash-screen
32+
```
33+
34+
> 不再需要 `react-native link`,也不需要手动改 `settings.gradle``MainApplication`
35+
36+
### 2. JS 调用
37+
38+
```ts
39+
import SplashScreen from 'react-native-splash-screen';
40+
41+
SplashScreen.hide();
42+
```
43+
44+
### 3. Android(Kotlin)
45+
46+
`MainActivity.kt``onCreate` 里,`super.onCreate` 前调用:
47+
48+
```kotlin
49+
override fun onCreate(savedInstanceState: Bundle?) {
50+
SplashScreen.show(this, true)
51+
super.onCreate(savedInstanceState)
52+
}
53+
```
54+
55+
启动页布局文件:`android/app/src/main/res/layout/launch_screen.xml`,例如:
56+
57+
```xml
58+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
59+
android:layout_width="match_parent"
60+
android:layout_height="match_parent"
61+
android:background="#000000">
62+
<ImageView
63+
android:layout_width="match_parent"
64+
android:layout_height="match_parent"
65+
android:scaleType="centerCrop"
66+
android:src="@mipmap/launch_screen" />
67+
</RelativeLayout>
68+
```
69+
70+
### 4. iOS(Swift)
71+
72+
`AppDelegate.swift` 里添加:
73+
74+
```swift
75+
import react_native_splash_screen
76+
```
77+
78+
并在 React Native 启动后调用:
79+
80+
```swift
81+
RNSplashScreen.show()
82+
```
83+
84+
`LaunchScreen.storyboard` 使用 Assets.xcassets 里的静态图资源。
85+
86+
### 5. Android 12+ 说明
87+
88+
Android 12 及以上会先显示系统级启动阶段(常见为应用图标),这是系统行为;
89+
本库负责应用内可控的自定义启动页显示/隐藏。
90+
2391
## 演示
2492
* [Examples](https://github.com/crazycodeboy/react-native-splash-screen/tree/master/examples)
2593

@@ -29,11 +97,14 @@ React Native启动屏,解决iOS,Android启动白屏问题,支持Android和
2997

3098
## 改变
3199

32-
如果你项目的React Native>=0.47.请使用[v3.+](https://github.com/crazycodeboy/react-native-splash-screen/releases),
33-
如果<0.47.0请使用[v2.1.0](https://github.com/crazycodeboy/react-native-splash-screen/releases/tag/v1.0.9)
100+
- `v4.x`:支持 React Native `>= 0.84.0`(New Architecture / TurboModule / Codegen)。
101+
- `v3.x`:历史版本(旧架构)
34102

35103
## 安装说明
36104

105+
> 以下“自动安装/手动安装”步骤主要针对旧版本 React Native。
106+
> 如果你使用 `react-native >= 0.84.0`,请优先使用上面的「v4 快速开始」。
107+
37108
### 第一步(下载):
38109
在项目根目录打开终端运行 `npm i react-native-splash-screen --save`
39110

17 Bytes
Binary file not shown.

android/.gradle/8.9/dependencies-accessors/gc.properties

Whitespace-only changes.
1 Byte
Binary file not shown.
17 Bytes
Binary file not shown.

android/.gradle/8.9/gc.properties

Whitespace-only changes.
17 Bytes
Binary file not shown.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#Mon Mar 02 15:25:49 CST 2026
2+
gradle.version=8.9

android/.gradle/vcs-1/gc.properties

Whitespace-only changes.

0 commit comments

Comments
 (0)