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

this setup is for java now the android file is converted to kotlin, can anyone share the setup for kotlin #639

Open
nawazokz opened this issue Feb 23, 2024 · 11 comments

Comments

@nawazokz
Copy link

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

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

What platform does your issue occur on? (Android/iOS/Both)

Describe your issue as precisely as possible :

  1. Steps to reproduce the issue or to explain in which case you get the issue
  2. Interesting logs

Join a screenshot or video of the problem on the simulator or device?

Show us the code you are using?

@soadtechdev
Copy link

@nawazokz I recommend you to use BootSplash it currently supports the new react native architecture.

@AkilUnik
Copy link

package com.turtlebuddy
import android.os.Bundle;
import com.facebook.react.ReactActivity
import com.facebook.react.ReactActivityDelegate
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
import com.facebook.react.defaults.DefaultReactActivityDelegate
// react-native-splash-screen >= 0.3.1

import org.devio.rn.splashscreen.SplashScreen;

class MainActivity : ReactActivity() {

/**

  • Returns the name of the main component registered from JavaScript. This is used to schedule
  • rendering of the component.
    */
    override fun onCreate(savedInstanceState: Bundle?) {
    SplashScreen.show(this);
    super.onCreate(null)
    }

override fun getMainComponentName(): String = "turtleBuddy"

/**

  • 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)
    }

@muhammadalizkhan
Copy link

Facing the Same Issue, the Splash Screen [react-native-splash-screen] is not Working, Just because of kotlin Issue,

@bkvaiude
Copy link

bkvaiude commented Mar 26, 2024

Check the following comment, it solved the issue and the example provided for Kotlin

#638 (comment)

@Netovitu
Copy link

Does anyone have an idea how to solve it? I need this fix

@nawazokz
Copy link
Author

#639 (comment)
try this solution it work for me

@nawazokz
Copy link
Author

#639 (comment)
try this solution it work for me
just paste these line of code under
class MainActivity : ReactActivity()
the line is
override fun onCreate(savedInstanceState: Bundle?) {
SplashScreen.show(this); // add this
super.onCreate(null)
}

@huyvu23
Copy link

huyvu23 commented Apr 13, 2024

#639 (comment) try this solution it work for me

i build success but it crash when open app on android 8

@Cheizr
Copy link

Cheizr commented Jul 12, 2024

The readme docs needs to be updated please

@tdammy92
Copy link

tdammy92 commented Jan 2, 2025

@nawazokz @bkvaiude
This doesnt work on android

"react-native": "0.76.2",

@bkvaiude
Copy link

bkvaiude commented Jan 3, 2025

@tdammy92 Please post error details

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

9 participants