Skip to content

Commit a99254c

Browse files
committed
Initial v5 commit
1 parent 77a8594 commit a99254c

File tree

67 files changed

+3190
-2364
lines changed

Some content is hidden

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

67 files changed

+3190
-2364
lines changed

.eslintignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
example/
2+
dist/
3+
react-native.config.js
4+
.eslintrc.js

.eslintrc.js

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
const path = require("path");
2+
3+
module.exports = {
4+
parser: "@typescript-eslint/parser",
5+
plugins: ["@typescript-eslint", "react-hooks"],
6+
7+
extends: [
8+
"eslint:recommended",
9+
"plugin:@typescript-eslint/eslint-recommended",
10+
"plugin:@typescript-eslint/recommended",
11+
"plugin:@typescript-eslint/recommended-requiring-type-checking",
12+
],
13+
14+
parserOptions: {
15+
project: path.join(__dirname, "tsconfig.json"),
16+
},
17+
18+
env: {
19+
es2022: true,
20+
},
21+
22+
rules: {
23+
"react-hooks/rules-of-hooks": "error",
24+
"react-hooks/exhaustive-deps": "warn",
25+
26+
"@typescript-eslint/ban-ts-comment": [
27+
"error",
28+
{ "ts-check": true, "ts-expect-error": false },
29+
],
30+
"@typescript-eslint/no-unused-vars": [
31+
"error",
32+
{ argsIgnorePattern: "^_", ignoreRestSiblings: true },
33+
],
34+
35+
"@typescript-eslint/no-base-to-string": "error",
36+
"@typescript-eslint/no-explicit-any": "error",
37+
"@typescript-eslint/no-non-null-assertion": "error",
38+
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "error",
39+
"@typescript-eslint/no-unnecessary-condition": "error",
40+
"@typescript-eslint/no-unnecessary-qualifier": "error",
41+
"@typescript-eslint/no-unnecessary-type-arguments": "error",
42+
"@typescript-eslint/prefer-nullish-coalescing": "error",
43+
"@typescript-eslint/prefer-optional-chain": "error",
44+
"@typescript-eslint/strict-boolean-expressions": "error",
45+
},
46+
};

.gitignore

+2-6
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,5 @@ example/vendor/bundle/
7272
# Bob
7373
dist/
7474

75-
# OCaml / Reason
76-
**/.merlin
77-
**/lib/bs
78-
**/lib/ocaml
79-
*.bs.js
80-
.bsb.lock
75+
# CLI paid options
76+
src/cli/addon.ts

MIGRATION.md

+5-136
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,13 @@
1-
# Migration from v3
1+
# Migration from v4
22

33
## What's new
44

5-
- The drop of Android < 6 and iOS < 11 (Android 5 is _possible_ but only displays the background color)
6-
- A switch to [AndroidX splashscreen library](https://developer.android.com/jetpack/androidx/releases/core#core-splashscreen-1.0.0) to fully support Android 12
7-
- The removal of the `show` method
8-
- The `hide` method cannot reject anymore
9-
- The switch to `RCTRootView` only on iOS (removed usage of `UIViewController`)
10-
- An integration with [react-native-bars](https://github.com/zoontek/react-native-bars) for fully transparent system bars on Android
5+
- The removal of [AndroidX splashscreen library](https://developer.android.com/jetpack/androidx/releases/core#core-splashscreen-1.0.0) requirement
6+
- The drop of react-native < 0.70, iOS < 12.4
7+
- `getVisibilityStatus` has been replaced with a synchronous method: `BootSplash.isVisible()` (returns a `boolean`)
118

129
## Code modifications
1310

14-
For `android/build.gradle`:
15-
16-
```diff
17-
buildscript {
18-
ext {
19-
- buildToolsVersion = "30.0.2"
20-
- minSdkVersion = 21
21-
- compileSdkVersion = 30
22-
- targetSdkVersion = 30
23-
+ buildToolsVersion = "31.0.0"
24-
+ minSdkVersion = 23
25-
+ compileSdkVersion = 31
26-
+ targetSdkVersion = 31
27-
}
28-
29-
// …
30-
```
31-
3211
For `android/app/build.gradle`:
3312

3413
```diff
@@ -37,115 +16,5 @@ For `android/app/build.gradle`:
3716
dependencies {
3817
// The version of react-native is set by the React Native Gradle Plugin
3918
implementation("com.facebook.react:react-android")
40-
+ implementation("androidx.core:core-splashscreen:1.0.0")
41-
```
42-
43-
For `android/app/src/main/res/values/styles.xml`:
44-
45-
```diff
46-
<resources>
47-
48-
<!-- … -->
49-
50-
- <!-- BootTheme should inherit from AppTheme -->
51-
- <style name="BootTheme" parent="AppTheme">
52-
- <!-- set bootsplash.xml as background -->
53-
- <item name="android:background">@drawable/bootsplash</item>
54-
- </style>
55-
56-
+ <!-- BootTheme should inherit from Theme.SplashScreen -->
57-
+ <style name="BootTheme" parent="Theme.SplashScreen">
58-
+ <item name="windowSplashScreenBackground">@color/bootsplash_background</item>
59-
+ <item name="windowSplashScreenAnimatedIcon">@mipmap/bootsplash_logo</item>
60-
+ <item name="postSplashScreenTheme">@style/AppTheme</item>
61-
+ </style>
62-
63-
</resources>
64-
```
65-
66-
For `android/app/src/main/AndroidManifest.xml`:
67-
68-
```diff
69-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
70-
package="com.rnbootsplashexample">
71-
72-
<uses-permission android:name="android.permission.INTERNET" />
73-
74-
<application
75-
android:name=".MainApplication"
76-
android:label="@string/app_name"
77-
android:icon="@mipmap/ic_launcher"
78-
android:roundIcon="@mipmap/ic_launcher_round"
79-
android:allowBackup="false"
80-
- android:theme="@style/AppTheme">
81-
+ android:theme="@style/BootTheme">
82-
83-
<activity
84-
android:name=".MainActivity"
85-
android:label="@string/app_name"
86-
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
87-
android:launchMode="singleTask"
88-
android:windowSoftInputMode="adjustResize"
89-
android:exported="true">
90-
+ <intent-filter>
91-
+ <action android:name="android.intent.action.MAIN" />
92-
+ <category android:name="android.intent.category.LAUNCHER" />
93-
+ </intent-filter>
94-
</activity>
95-
96-
- <activity
97-
- android:name="com.zoontek.rnbootsplash.RNBootSplashActivity"
98-
- android:theme="@style/BootTheme"
99-
- android:launchMode="singleTask">
100-
- <intent-filter>
101-
- <action android:name="android.intent.action.MAIN" />
102-
- <category android:name="android.intent.category.LAUNCHER" />
103-
- </intent-filter>
104-
- </activity>
105-
</application>
106-
</manifest>
19+
- implementation("androidx.core:core-splashscreen:1.0.0")
10720
```
108-
109-
For `android/app/src/main/java/com/yourprojectname/MainActivity.java`:
110-
111-
```diff
112-
import android.os.Bundle;
113-
114-
import com.facebook.react.ReactActivity;
115-
import com.facebook.react.ReactActivityDelegate;
116-
import com.facebook.react.ReactRootView;
117-
import com.zoontek.rnbootsplash.RNBootSplash;
118-
119-
public class MainActivity extends ReactActivity {
120-
121-
// …
122-
123-
@Override
124-
protected void onCreate(Bundle savedInstanceState) {
125-
+ RNBootSplash.init(this);
126-
super.onCreate(savedInstanceState); // or super.onCreate(null) with react-native-screens
127-
- RNBootSplash.init(R.drawable.bootsplash, this);
128-
}
129-
130-
public static class MainActivityDelegate extends ReactActivityDelegate {
131-
public MainActivityDelegate(ReactActivity activity, String mainComponentName) {
132-
super(activity, mainComponentName);
133-
}
134-
135-
@Override
136-
protected ReactRootView createRootView() {
137-
ReactRootView reactRootView = new ReactRootView(getContext());
138-
// If you opted-in for the New Architecture, we enable the Fabric Renderer.
139-
reactRootView.setIsFabric(BuildConfig.IS_NEW_ARCHITECTURE_ENABLED);
140-
return reactRootView;
141-
}
142-
}
143-
}
144-
```
145-
146-
## Generated files
147-
148-
You **must** re-generate your assets.
149-
150-
- You can delete `android/app/src/main/res/drawable/bootsplash.xml` (now unused).
151-
- All Android related assets now include padding.

0 commit comments

Comments
 (0)