I'm working with a React Native app and I'm trying to set a customize launch screen but I'm not able to.
React Native creates a LaunchScreen.xib by default, so I've created a LaunchImage inside Images.xcassets:
I've also read that I've to modify the "Launch Screen File" under "App Icons and Launch Images" in my options:
Once I've done that, my launch screen became totally black and when the app is loaded, there are both top and bottom black frames:
So I don't know what I have to do to set my launch screen in my React Native project.
I'll be grateful if someone can help me out with those troubles.
Thanks in advance.
Manually set a blank, single-color splash screen background on the native side. On iOS, set the background color of the React Native root view to that same color. As soon as React Native loads, add a View with the same color in React Native and fade in the app logo on it. Once the app loads, fade out the splash screen.
Show activity on this post. import React from 'react'; import './Splash. css' import img2 from '../../Assets/Header. png' import img8 from '../../Assets/hand.
Open the React Native project in Xcode and have your React Native project in your finder. In the iOS folder, drag and drop Bootsplash. storyboard into Xcode. You will get a prompt; click on “finish.”
I was be able to solve the issue, with the help of this thread: Launch Image not showing up in iOS application (using Images.xcassets)
So I'm gonna explain it deeply in case it can help someone else.
First, you need to create certain images. What I used for that was this template and this webpage with an automatic generator: TiCons
When I downloaded my images, I took the ones inside assets/iphone folder, I only took those ones:
Also you need this Contents.json file in the same folder, I got it from a friend:
{ "images": [ { "extent": "full-screen", "idiom": "iphone", "filename": "[email protected]", "minimum-system-version": "7.0", "orientation": "portrait", "scale": "2x", "subtype": "retina4" }, { "extent": "full-screen", "idiom": "iphone", "filename": "[email protected]", "minimum-system-version": "8.0", "orientation": "portrait", "scale": "2x", "subtype": "667h" }, { "extent": "full-screen", "idiom": "iphone", "filename": "[email protected]", "minimum-system-version": "8.0", "orientation": "landscape", "scale": "3x", "subtype": "736h" }, { "extent": "full-screen", "idiom": "iphone", "filename": "[email protected]", "minimum-system-version": "8.0", "orientation": "portrait", "scale": "3x", "subtype": "736h" }, { "extent": "full-screen", "idiom": "iphone", "filename": "[email protected]", "minimum-system-version": "7.0", "orientation": "portrait", "scale": "2x" } ], "info": { "version": 1, "author": "xcode" } }
So, at this point I created a folder called LaunchImage.launchimage inside Images.xcassets folder in my React Native project and save the images and the Contents.json file inside it:
Second, you have to open your project in Xcode and in "General" settings, below "App icons and Launch Images" we have to leave the option "Launch Screen File" empty (also we can delete the LaunchScreen.xib file inside our project), and click in "Use Asset Catalog" after that. A modal will open, we choose to Migrate the catalog Images
Now, in the "Launch Images Source" selector, we can choose the folder we created before, LaunchImage (the one with our images):
We pick this instead of Brand Assets and we can delete Brand Assets folder.
At this point, we'll be able to run our React Native application with our custom launch images:
I know it seems a little bit complex for an supposedly easy task, but after reading a lot about it this was the only way I could get my splash images working, so I wanted to share with the community.
Make sure to delete the app from the simulator. Then do a clean on your project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With