Skip to content

Android Splash screen load twice at first launch. #103

Open
@ahsanmunyr

Description

Run react-native info in your project and share the content.

system:
OS: macOS 15.1.1
CPU: (10) arm64 Apple M1 Pro
Memory: 60.75 MB / 16.00 GB
Shell:
version: 3.2.57
path: /bin/bash
Binaries:
Node:
version: 23.1.0
path: /opt/homebrew/bin/node
Yarn: Not Found
npm:
version: 10.9.1
path: /opt/homebrew/bin/npm
Watchman:
version: 2024.10.28.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.16.2
path: /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 24.1
- iOS 18.1
- macOS 15.1
- tvOS 18.1
- visionOS 2.1
- watchOS 11.1
Android SDK: Not Found
IDEs:
Android Studio: 2024.2 AI-242.23339.11.2421.12550806
Xcode:
version: 16.1/16B40
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.10
path: /usr/bin/javac
Ruby:
version: 2.6.10
path: /usr/bin/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.73.10
wanted: ^0.73.10
react-native-macos: Not Found
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: true
newArchEnabled: false

What react-native-splash-screen version are you using?

"react-native-lottie-splash-screen": "^1.1.2",

What platform does your issue occur on?
Android
The only issue is Android. When I installed the app, I got two splash screens( when the first animation is completed, the same animation started again). After that, when I kill the app and open it again, it's fine.

Show us the code you are using?

MainActivity.kt
protected override fun onCreate(savedInstanceState: Bundle?) {

  SplashScreen.show(this, R.id.lottie); // here
  SplashScreen.setAnimationFinished(true); // If you want the animation dialog to be forced to close when hide is called, use this code
  super.onCreate(savedInstanceState);
  // If you want the animation dialog to be forced to close when hide is called, use this code
  // ...other code
  // On Android 12 and onwards, raise notification clicked event and get the click callback
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
      val cleverTapInstance = CleverTapAPI.getDefaultInstance(applicationContext)
      cleverTapInstance?.pushNotificationClickedEvent(intent?.extras)
  }

}

layout.xml

<androidx.constraintlayout.widget.ConstraintLayout
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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#E1E3E7"
tools:context=".MainActivity">

<com.airbnb.lottie.LottieAnimationView
    android:id="@+id/lottie"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    android:scaleType="fitXY"
    app:layout_constraintTop_toTopOf="parent"
    app:lottie_autoPlay="true"
    app:lottie_loop="false"
    app:lottie_rawRes="@raw/my_lottie" />

</androidx.constraintlayout.widget.ConstraintLayout>

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions