expo-splash-screen 0.13.2 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/README.md +1 -1
- package/android/build.gradle +2 -2
- package/ios/EXSplashScreen/EXSplashScreenService.m +35 -9
- package/ios/EXSplashScreen.xcframework/ios-arm64/EXSplashScreen.framework/EXSplashScreen +0 -0
- package/ios/EXSplashScreen.xcframework/ios-arm64/EXSplashScreen.framework/Info.plist +0 -0
- package/ios/EXSplashScreen.xcframework/ios-arm64_x86_64-simulator/EXSplashScreen.framework/EXSplashScreen +0 -0
- package/ios/EXSplashScreen.xcframework/ios-arm64_x86_64-simulator/EXSplashScreen.framework/Info.plist +0 -0
- package/package.json +6 -4
- package/plugin/build/withSplashScreen.js +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,22 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 0.14.0 — 2021-12-03
|
|
14
|
+
|
|
15
|
+
### 🐛 Bug fixes
|
|
16
|
+
|
|
17
|
+
- Fix `Cannot remove an observer <EXSplashScreenService> for the key path "rootViewController"` exception if applcation keyWindow changed. ([#14982](https://github.com/expo/expo/pull/14982) by [@kudo](https://github.com/kudo))
|
|
18
|
+
|
|
19
|
+
## 0.13.4 — 2021-10-22
|
|
20
|
+
|
|
21
|
+
_This version does not introduce any user-facing changes._
|
|
22
|
+
|
|
23
|
+
## 0.13.3 — 2021-10-15
|
|
24
|
+
|
|
25
|
+
### 🐛 Bug fixes
|
|
26
|
+
|
|
27
|
+
- Fix `No native splash screen registered for given view controller` error happening when project is using both `expo-dev-client` and `expo-splash-screen` packages. ([#14745](https://github.com/expo/expo/pull/14745) by [@kudo](https://github.com/kudo))
|
|
28
|
+
|
|
13
29
|
## 0.13.2 — 2021-10-15
|
|
14
30
|
|
|
15
31
|
_This version does not introduce any user-facing changes._
|
package/README.md
CHANGED
|
@@ -233,7 +233,7 @@ Refer to [the SplashScreen section of the Expo documentation](https://docs.expo.
|
|
|
233
233
|
|
|
234
234
|
## 🖥 Installation in bare React Native projects
|
|
235
235
|
|
|
236
|
-
For bare React Native projects, you must ensure that you have [installed and configured the `
|
|
236
|
+
For bare React Native projects, you must ensure that you have [installed and configured the `expo` package](https://docs.expo.dev/bare/installing-expo-modules/) before continuing.
|
|
237
237
|
|
|
238
238
|
## Add the package to your dependencies
|
|
239
239
|
|
package/android/build.gradle
CHANGED
|
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
|
|
|
3
3
|
apply plugin: 'maven'
|
|
4
4
|
|
|
5
5
|
group = 'host.exp.exponent'
|
|
6
|
-
version = '0.
|
|
6
|
+
version = '0.14.0'
|
|
7
7
|
|
|
8
8
|
buildscript {
|
|
9
9
|
// Simple helper that allows the root project to override versions declared by this library.
|
|
@@ -57,7 +57,7 @@ android {
|
|
|
57
57
|
minSdkVersion safeExtGet('minSdkVersion', 21)
|
|
58
58
|
targetSdkVersion safeExtGet('targetSdkVersion', 30)
|
|
59
59
|
versionCode 17
|
|
60
|
-
versionName '0.
|
|
60
|
+
versionName '0.14.0'
|
|
61
61
|
}
|
|
62
62
|
lintOptions {
|
|
63
63
|
abortOnError false
|
|
@@ -4,12 +4,22 @@
|
|
|
4
4
|
#import <EXSplashScreen/EXSplashScreenViewNativeProvider.h>
|
|
5
5
|
#import <ExpoModulesCore/EXDefines.h>
|
|
6
6
|
|
|
7
|
-
static
|
|
7
|
+
static NSString * const kRootViewController = @"rootViewController";
|
|
8
|
+
static NSString * const kView = @"view";
|
|
8
9
|
|
|
9
10
|
@interface EXSplashScreenService ()
|
|
10
11
|
|
|
11
12
|
@property (nonatomic, strong) NSMapTable<UIViewController *, EXSplashScreenViewController *> *splashScreenControllers;
|
|
12
|
-
|
|
13
|
+
/**
|
|
14
|
+
* This module holds a reference to rootViewController acting as a flag to indicate KVO is enabled.
|
|
15
|
+
* When KVO is enabled, actually we are observing two targets and re-show splash screen if targets changed:
|
|
16
|
+
* - `keyWindow.rootViewController`: it is for expo-dev-client which replaced it in startup.
|
|
17
|
+
* - `rootViewController.rootView`: it is for expo-updates which replaced it in startup.
|
|
18
|
+
*
|
|
19
|
+
* If `rootViewController` is changed, we also need the old `rootViewController` to unregister rootView KVO.
|
|
20
|
+
* That's why we keep a weak reference here but not a boolean flag.
|
|
21
|
+
*/
|
|
22
|
+
@property (nonatomic, weak) UIViewController *observingRootViewController;
|
|
13
23
|
|
|
14
24
|
@end
|
|
15
25
|
|
|
@@ -21,7 +31,6 @@ EX_REGISTER_SINGLETON_MODULE(SplashScreen);
|
|
|
21
31
|
{
|
|
22
32
|
if (self = [super init]) {
|
|
23
33
|
_splashScreenControllers = [NSMapTable weakToStrongObjectsMapTable];
|
|
24
|
-
_isObservingRootViewController = NO;
|
|
25
34
|
}
|
|
26
35
|
return self;
|
|
27
36
|
}
|
|
@@ -141,23 +150,40 @@ EX_REGISTER_SINGLETON_MODULE(SplashScreen);
|
|
|
141
150
|
- (void)addRootViewControllerListener
|
|
142
151
|
{
|
|
143
152
|
NSAssert([NSThread isMainThread], @"Method must be called on main thread");
|
|
144
|
-
if (
|
|
145
|
-
|
|
146
|
-
|
|
153
|
+
if (self.observingRootViewController == nil) {
|
|
154
|
+
UIViewController *rootViewController = UIApplication.sharedApplication.keyWindow.rootViewController;
|
|
155
|
+
|
|
156
|
+
[UIApplication.sharedApplication.keyWindow addObserver:self
|
|
157
|
+
forKeyPath:kRootViewController
|
|
158
|
+
options:NSKeyValueObservingOptionNew
|
|
159
|
+
context:nil];
|
|
160
|
+
|
|
161
|
+
[rootViewController addObserver:self forKeyPath:kView options:NSKeyValueObservingOptionNew context:nil];
|
|
162
|
+
self.observingRootViewController = rootViewController;
|
|
147
163
|
}
|
|
148
164
|
}
|
|
149
165
|
|
|
150
166
|
- (void)removeRootViewControllerListener
|
|
151
167
|
{
|
|
152
168
|
NSAssert([NSThread isMainThread], @"Method must be called on main thread");
|
|
153
|
-
if (
|
|
154
|
-
|
|
155
|
-
|
|
169
|
+
if (self.observingRootViewController != nil) {
|
|
170
|
+
UIWindow *window = self.observingRootViewController.view.window;
|
|
171
|
+
[window removeObserver:self forKeyPath:kRootViewController context:nil];
|
|
172
|
+
[self.observingRootViewController removeObserver:self forKeyPath:kView context:nil];
|
|
173
|
+
self.observingRootViewController = nil;
|
|
156
174
|
}
|
|
157
175
|
}
|
|
158
176
|
|
|
159
177
|
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context
|
|
160
178
|
{
|
|
179
|
+
if (object == UIApplication.sharedApplication.keyWindow && [keyPath isEqualToString:kRootViewController]) {
|
|
180
|
+
UIViewController *newRootViewController = change[@"new"];
|
|
181
|
+
if (newRootViewController != nil) {
|
|
182
|
+
[self removeRootViewControllerListener];
|
|
183
|
+
[self showSplashScreenFor:newRootViewController];
|
|
184
|
+
[self addRootViewControllerListener];
|
|
185
|
+
}
|
|
186
|
+
}
|
|
161
187
|
if (object == UIApplication.sharedApplication.keyWindow.rootViewController && [keyPath isEqualToString:kView]) {
|
|
162
188
|
UIView *newView = change[@"new"];
|
|
163
189
|
if (newView != nil && [newView.nextResponder isKindOfClass:[UIViewController class]]) {
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-splash-screen",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "Provides a module to allow keeping the native Splash Screen visible until you choose to hide it.",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -38,11 +38,13 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@expo/configure-splash-screen": "^0.6.0",
|
|
41
|
-
"@expo/prebuild-config": "^3.0.
|
|
42
|
-
"expo-modules-core": "~0.4.3"
|
|
41
|
+
"@expo/prebuild-config": "^3.0.6"
|
|
43
42
|
},
|
|
44
43
|
"devDependencies": {
|
|
45
44
|
"expo-module-scripts": "^2.0.0"
|
|
46
45
|
},
|
|
47
|
-
"
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"expo": "*"
|
|
48
|
+
},
|
|
49
|
+
"gitHead": "2e5c6983b86d5ecfca028ba64002897d8adc2cc4"
|
|
48
50
|
}
|
|
@@ -7,8 +7,8 @@ const pkg = require('expo-splash-screen/package.json');
|
|
|
7
7
|
const withSplashScreen = (config) => {
|
|
8
8
|
// For simplicity, we'll version the unversioned code in expo-splash-screen.
|
|
9
9
|
// This adds more JS to the package overall, but the trade-off is less copying between expo-cli/expo.
|
|
10
|
-
config = withAndroidSplashScreen_1.withAndroidSplashScreen(config);
|
|
11
|
-
config = withIosSplashScreen_1.withIosSplashScreen(config);
|
|
10
|
+
config = (0, withAndroidSplashScreen_1.withAndroidSplashScreen)(config);
|
|
11
|
+
config = (0, withIosSplashScreen_1.withIosSplashScreen)(config);
|
|
12
12
|
return config;
|
|
13
13
|
};
|
|
14
|
-
exports.default = config_plugins_1.createRunOncePlugin(withSplashScreen, pkg.name, pkg.version);
|
|
14
|
+
exports.default = (0, config_plugins_1.createRunOncePlugin)(withSplashScreen, pkg.name, pkg.version);
|