Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration in React native 0.73 #89

Open
dev04Hexa opened this issue Mar 12, 2024 · 5 comments
Open

Integration in React native 0.73 #89

dev04Hexa opened this issue Mar 12, 2024 · 5 comments

Comments

@dev04Hexa
Copy link

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
Copy link

+1

1 similar comment
@diegoaxity
Copy link

+1

@UrbanoCeron
Copy link

UrbanoCeron commented Apr 18, 2024

@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
Copy link

ShubhamShingate-Futy commented Apr 18, 2024

@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
Copy link

erie-e9 commented Apr 20, 2024

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants