question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot add launch_screen.png

See original GitHub issue

Run react-native info in your project and share the content. OS: macOS 11.4 CPU: (8) x64 Apple M1 Memory: 35.50 MB / 8.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 12.4.0 - ~/.nvm/versions/node/v12.4.0/bin/node Yarn: 1.22.10 - /usr/local/bin/yarn npm: 7.19.1 - ~/.nvm/versions/node/v12.4.0/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2 Android SDK: API Levels: 22, 23, 25, 26, 27, 28, 29, 30 Build Tools: 28.0.3, 29.0.1, 29.0.2, 29.0.3, 31.0.0 Android NDK: 17.2.4988734 IDEs: Android Studio: 4.1 AI-201.8743.12.41.7042882 Xcode: 12.4/12D4e - /usr/bin/xcodebuild npmPackages: react: 16.9.0 => 16.9.0 react-native:0.61.5 npmGlobalPackages: react-native-cli: 2.0.1 What react-native-splash-screen version are you using? The newest version. What platform does your issue occur on? (Android/iOS/Both) Android Describe your issue as precisely as possible I followed the guide customming lauch_screen.png but my app show white screen. "Customize your launch screen by creating a launch_screen.png-file and placing it in an appropriate drawable-folder. Android automatically scales drawable, so you do not necessarily need to provide images for all phone densities. You can create splash screens in the following folders:

drawable-ldpi drawable-mdpi drawable-hdpi drawable-xhdpi drawable-xxhdpi drawable-xxxhdpi"

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
Samwell1996commented, Dec 20, 2021

you also can add this for IOS if you add current code to Dynamic.swift file, to func createAnimationView

    UIGraphicsBeginImageContext(animationView.frame.size)
    UIImage(named: "Splash.png")?.draw(in: animationView.bounds)

    if let image = UIGraphicsGetImageFromCurrentImageContext(){
        UIGraphicsEndImageContext()
      animationView.backgroundColor = UIColor(patternImage: image)
    } else {
        UIGraphicsEndImageContext()
     }

for Android the right way you need add in launch_screen -

  android:background="@drawable/launch_screen"

in my code this looks like

     <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context=".MainActivity"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/launch_screen"
  >
    <com.airbnb.lottie.LottieAnimationView
        android:id="@+id/lottie"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:lottie_rawRes="@raw/splash"
        app:lottie_autoPlay="true"
        app:lottie_loop="false"
        />
</LinearLayout>
1reaction
LightKnight3rcommented, Sep 29, 2022

@LightKnight3r hi, sorry for my typo. My code was always @raw/loading . Repo says I need add both files - launch_screen.png and launch_screen.xml . What should I put in launch_screen.png ?

just changing android:background=“@color/white” to android:background=“@drawable/launch_screen” in your code. And add launch_screen.png to drawable folders

Read more comments on GitHub >

github_iconTop Results From Across the Web

Launch Screen storyboard not displaying image - ios
Launch Screen storyboard not displaying image · 1. make sure that your image is in proper png format. · 4. The fact that...
Read more >
Launch Storyboard not showing imag… - Apple Developer
I setup a Launch Screen Storyboard which has a logo for my app in .pdf vector. When I build the project image is...
Read more >
[Bug] iOS 14 Launch Screen is not working #9764 - GitHub
Description iOS 14 Launch Screen with image is not working. Works fine on iOS 13.7. If I remove image and set a background...
Read more >
Flutter - Splash Screen for Android and iOS - AppUnite
TIP 1: If you can't see changes to your splash screen, try to delete the app from the phone/simulator, restart the phone/simulator, go...
Read more >
Create a Splash Screen - Expo Documentation
Learn how to create a splash screen for the app and best practices. ... Export the image as a PNG and put it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found