leecade / leecade/react-native-practice
slash screen implement
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 8
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
ref: https://github.com/mehcode/rn-splash-screen
Usage
import SplashScreen from 'rn-splash-screen'
// Hide the active splash screen
SplashScreen.hide()
Android step
-
Add a slash image in
[project_name]/android/app/src/main/res/drawable/slash.pngexample:

-
Add the image as a windowBackground in
[project_name]/android/app/src/main/res/values/styles.xml<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> <item name="android:windowBackground">@drawable/splash</item> </style> -
Override the
onCreateto show the splash screen in[project_name]/android/app/src/main/java/com/[project_name]/MainActivity.java// [...] import com.mehcode.reactnative.splashscreen.SplashScreen; public class MainActivity extends ReactActivity { // [...] @Override protected void onCreate(Bundle savedInstanceState) { // Show the js-controlled splash screen SplashScreen.show(this); // After react is initialized; set our background color (override splash screen theme) getReactNativeHost().getReactInstanceManager().addReactInstanceEventListener(new ReactInstanceManager.ReactInstanceEventListener() { @Override public void onReactContextInitialized(ReactContext context) { // Hide the native splash screen getWindow().getDecorView().setBackgroundColor(Color.WHITE); } }); super.onCreate(savedInstanceState); // [...] } // [...] }
iOS step
-
Remove the default
LaunchScreen.xib -
Create
LaunchImage
-
Prepare images
- Default@2x.png (640x960)
- Default-568h@2x.png (640x1136)
- Default-667h@2x.png (750x1334)
- Default-Portrait-736h@3x.png (1242x2208)
- Default-Landscape-736h@3x.png (2208x1242)
ios/[project name]/Images.xcassets └── LaunchImage.launchimage ├── Contents.json ├── Default-568h@2x.png ├── Default-667h@2x.png ├── Default-Landscape-736h@3x.png ├── Default-Portrait-736h@3x.png ├── Default-Portrait.png └── Default@2x.pngContents.json{ "images": [ { "extent": "full-screen", "idiom": "iphone", "filename": "Default-568h@2x.png", "minimum-system-version": "7.0", "orientation": "portrait", "scale": "2x", "subtype": "retina4" }, { "extent": "full-screen", "idiom": "iphone", "filename": "Default-667h@2x.png", "minimum-system-version": "8.0", "orientation": "portrait", "scale": "2x", "subtype": "667h" }, { "extent": "full-screen", "idiom": "iphone", "filename": "Default-Landscape-736h@3x.png", "minimum-system-version": "8.0", "orientation": "landscape", "scale": "3x", "subtype": "736h" }, { "extent": "full-screen", "idiom": "iphone", "filename": "Default-Portrait-736h@3x.png", "minimum-system-version": "8.0", "orientation": "portrait", "scale": "3x", "subtype": "736h" }, { "extent": "full-screen", "idiom": "iphone", "filename": "Default@2x.png", "minimum-system-version": "7.0", "orientation": "portrait", "scale": "2x" } ], "info": { "version": 1, "author": "xcode" } } -
In project settings, tap Use Asset Catalog for Launch Images under App Icons and Launch Images and have it use the newly created LaunchImage.

-
Show the splash screen after
rootViewcreated in[project_name]/ios/[project_name]/AppDelegate.m// [...] #import "RCTSplashScreen.h" - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // [...] RCTRootView *rootView = // [...] // Show splash screen (rn-splash-screen) [RCTSplashScreen show:rootView]; // [...] }
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the Android paths under android/app/src/main/res and android/app/src/main/java/[project_name]/MainActivity.java, then the iOS assets and ios/[project_name]/AppDelegate.m described in the issue. Use the rn-splash-screen reference to understand the platform setup. Done means the splash screen is configured for Android and iOS and can be hidden after initialization.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, javascript, objective-c, react
- Domain
- mobile
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100