[splash-screen] setup resizeMode by resource instead of code (#14061)# Why save config-plugin to use dangerous mod for modifying some splash screen styles like `resizeMode` # How based on
[splash-screen] setup resizeMode by resource instead of code (#14061)# Why save config-plugin to use dangerous mod for modifying some splash screen styles like `resizeMode` # How based on #13457 we had the in-module `show` for splash screen. this pr additionally moves `resizeMode` and `statusBarTranslucent` into resource. with the help of gradle system, application could easily override the library default value. bare-expo changes in this pr is an example of that. # Migration Guide for expo-splash-screen < 0.12.0 The changes in the pr are backward compatible, the code for `expo-splash-screen` will still work as it used to be. However, if you are going to migrate as new style API, here are the steps: 1. Migrate your project from react-native-unimodules to expo-modules-core 2. Remove expo-splash-screen code from MainActivity ```diff --- a/android/app/src/main/java/com/helloworld/MainActivity.java +++ b/android/app/src/main/java/com/helloworld/MainActivity.java import com.facebook.react.ReactRootView; import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView; -import expo.modules.splashscreen.singletons.SplashScreen; -import expo.modules.splashscreen.SplashScreenImageResizeMode; - public class MainActivity extends ReactActivity { @Override protected void onCreate(Bundle savedInstanceState) { // This is required for expo-splash-screen. setTheme(R.style.AppTheme); super.onCreate(null); - // SplashScreen.show(...) has to be called after super.onCreate(...) - // Below line is handled by '@expo/configure-splash-screen' command and it's discouraged to modify it manually - SplashScreen.show(this, SplashScreenImageResizeMode.CONTAIN, ReactRootView.class, false); } ``` 3. Override default `resizeMode` and `statusBarTranslucent` in stings.xml ```diff --- a/android/app/src/main/res/values/strings.xml +++ b/android/app/src/main/res/values/strings.xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <resources> <string name="app_name">sdk42</string> + <string name="expo_splash_screen_resize_mode">contain</string> + <string name="expo_splash_screen_status_bar_translucent">false</string> </resources> ``` # Test Plan check bare-expo android app to show the same splash screen before and after. # Checklist - [x] Documentation is up to date to reflect these changes (eg: https://docs.expo.io and README.md). - [x] Update configure-splash-screen https://github.com/expo/expo-cli/pull/3774 - [x] This diff will work correctly for `expo build` (eg: updated `@expo/xdl`). - [x] This diff will work correctly for `expo prebuild` & EAS Build (eg: updated a module plugin): https://github.com/expo/expo-cli/pull/3784
show more ...
[splash-screen][bare][iOS][Android] Create expo-splash-screen (#7066)* [splash-screen][bare][Android] Create splash screen mechanism Unimodule features on Android: - SplashScreen is mounted un
[splash-screen][bare][iOS][Android] Create expo-splash-screen (#7066)* [splash-screen][bare][Android] Create splash screen mechanism Unimodule features on Android: - SplashScreen is mounted under ContentView - SplashScreen's image & backgroundColor are configurable - SplashScreen would automatically hide when view hierarchy is mounted in located RootView - SplashScreen would appear again when RootView has no children again ('reload' behaviour from react-native) * [splash-screnn][bare][iOS][Android] Create unimodule from template * [splash-screen][bare][iOS] Create splash screen mechanism Unimodule features on iOS: - SplashScreen is mounted per ViewController - SplashScreen's image & backgroundColor are configurable via .sotryboard file - SplashScreen would automatically hide when ContentDidAppear notification is published - SplashScreen would appear again when bridge is reloaded ('reload' behaviour from react-native) * [splash-screen][Android] Adjust PR according to comments * [splash-screen][Android][docs] Adjust PR according to comments and concerns & provide documentation for Android * [splash-screen][iOS] Adjust PR according to comments * [splash-screen][iOS][docs] Provide installation and configuration instructions * [splash-screen][iOS] Restore unintetionally deleted SplashScreenView creation * [splash-screen][iOS][Android][docs] Apply PR suggestions * [splash-screen][iOS][Android] Make 'preventAutoHide' and 'hide' methods idempotent * [splash-screen][Android] Exclude from Expoview * [splash-screen][docs] Adjust docs according to PR suggestions * [splash-screen][bare-expo] Ignore splash-screen package in bare-expo * [splash-screen] Change version to 0.1.0