Open dev04Hexa opened 6 months ago
+1
+1
@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) }
@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?
@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
Warning: Activity not started, intent has been delivered to currently running top-most instance. And animation playing endlessly
It seems to work now, another issue gives that error
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