1

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
}`

Irene_MJ
  • 11
  • 1

2 Answers2

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.

0

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

Irene_MJ
  • 11
  • 1