skip to Main Content

I’m having trouble with the react-native-splash-screen

React-native info

  • Node : 16.17.0
  • Yarn : 1.22.19
  • react : 18.1.0
  • react-native : 0.70.0

Error

MainActivityDelegate cannot be converted to Activity SplashScreen.show(this);

MainActivity.java

`

package com.ala.com.ala;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;

import com.facebook.react.ReactActivity;
import com.facebook.react.ReactActivityDelegate;
import com.facebook.react.ReactRootView;
import com.lockincomp.liappagent.LiappAgent;

import org.devio.rn.splashscreen.SplashScreen;

@Override
protected void onCreate(Bundle savedInstanceState) {

      SplashScreen.show(this);
    
     ...my other codes
    
      super.onCreate(null);

// super.onCreate(savedInstanceState); <- this also tried but not working
}

`

I don’t know why I’m having this kind of error. because of React Native 0.7 version error? or what…please help..

I also tried to use react-native-bootsplash but this library also having error in

`@Override
protected void onCreate(Bundle savedInstanceState) {

RNBootSplash.init(this); //this part having error in this
super.onCreate(savedInstanceState); // or super.onCreate(null) with react-native-screens
}`

2

Answers


  1. Chosen as BEST ANSWER

    If you guys have same issue on RN ver. 0.7 by using the react-native-splash-screen, please check this

    https://github.com/crazycodeboy/react-native-splash-screen/issues/591#issue-1424947030

    I fixed my issue


  2. @Override
    protected void onCreate(Bundle savedInstanceState) {
    
     ...my other codes
    
         super.onCreate(null);
       //super.onCreate(savedInstanceState); <- this also tried but not working
    
         SplashScreen.show(this);
    
         
      }
    

    try this, also remove other manual configuration from setting.gradle and app/build.gradle file for splash screen. Hope this will work.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search