HwangTaehyun / react-native-lottie-splash-screen

⚡ Lottie splash screen for your react native app!
MIT License
218 stars 61 forks source link

Integration in React native 0.73 #89

Open dev04Hexa opened 6 months ago

dev04Hexa commented 6 months ago

I am working with React Native version 0.73, and i want to integrate lottie splash screen so i can play a gif video on splash screen.

The issue while integration is that the current steps show how to add changes in java files for android but in 0.73 version now there is Kotlin files. So what will be changes regarding the integration steps for Kotlin files in android

bradherman commented 5 months ago

+1

diegoaxity commented 5 months ago

+1

UrbanoCeron commented 4 months ago

@dev04Hexa, @bradherman, @diegoaxity In the file MainActivity.kt set import

import org.devio.rn.splashscreen.SplashScreen

and into class MainActivity add this method

init { SplashScreen.show(this,R.id.lottie) SplashScreen.setAnimationFinished(true) }

ShubhamShingate-Futy commented 4 months ago

@dev04Hexa, @bradherman, @diegoaxity In the file MainActivity.kt set import

import org.devio.rn.splashscreen.SplashScreen

and into class MainActivity add this method

init { SplashScreen.show(this,R.id.lottie) SplashScreen.setAnimationFinished(true) }

@UrbanoCeron This is my updated MainActivity.kt file

package com.demo

import com.facebook.react.ReactActivity
import com.facebook.react.ReactActivityDelegate
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
import com.facebook.react.defaults.DefaultReactActivityDelegate
import android.content.Intent
import org.devio.rn.splashscreen.SplashScreen // Import SplashScreen

class MainActivity : ReactActivity() {

  init { SplashScreen.show(this,R.id.lottie) SplashScreen.setAnimationFinished(true) }

  /**
   * Returns the name of the main component registered from JavaScript. This is used to schedule
   * rendering of the component.
   */
  override fun getMainComponentName(): String = "demo"

  override fun onNewIntent(intent: Intent) {
    super.onNewIntent(intent)
    setIntent(intent)
  }

  /**
   * Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
   * which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
   */
  override fun createReactActivityDelegate(): ReactActivityDelegate =
      DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
}

Is it right or have I done something wrong? Cause Task :app:compileDebugKotlin FAILED

Error is

e: file:///Users/test_user/Documents/code/mobile/android/app/src/main/java/com/demo/MainActivity.kt:12:58 Expecting an element
e: file:///Users/test_user/Documents/code/mobile/android/app/src/main/java/com/demo/MainActivity.kt:12:46 Unresolved reference: SplashScreen

What is the issue? Or there is something wrong?

erie-e9 commented 4 months ago

@ShubhamShingate-Futy a ";" is missing, try next: init { SplashScreen.show(this,R.id.lottie); SplashScreen.setAnimationFinished(true) }

then run app, let me know if you have more issues. I just can ran my project again iOS and android platforms

strelovidniy commented 1 month ago

Warning: Activity not started, intent has been delivered to currently running top-most instance. And animation playing endlessly

strelovidniy commented 1 month ago

It seems to work now, another issue gives that error