react-native-splash-screen: not work at react-native 0.61.4
Run react-native info in your project and share the content.
React Native Environment Info:
System:
OS: Windows 10
CPU: (20) x64 Intel® Xeon® CPU E5-2660 v2 @ 2.20GHz
Memory: 3.98 GB / 15.93 GB
Binaries:
Yarn: 1.19.1 - C:\Users\Administrator.SC-201910230934\AppData\Roaming\npm\yarn.CMD
npm: 6.12.0 - C:\Program Files\nodejs\npm.CMD
What react-native-splash-screen version are you using?
3.2.0
What platform does your issue occur on? (Android/iOS/Both)
Android
Describe your issue as precisely as possible :
The react-native 0.61.4 migrates onCreate function to MainApplication.java。
Show us the code you are using?
MainApplication.java:
import org.devio.rn.splashscreen.SplashScreenReactPackage; //<–添加这一句 import org.devio.rn.splashscreen.SplashScreen;//<–添加这一句 import android.os.Bundle; // <–添加这一句 @Override protected List<ReactPackage> getPackages() { @SuppressWarnings(“UnnecessaryLocalVariable”) List<ReactPackage> packages = new PackageList(this).getPackages(); packages.add(new SplashScreenReactPackage());//<–添加这一句
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return packages;
}
@Override public void onCreate() { super.onCreate(); SplashScreen.show(this);//<–添加这一句 SoLoader.init(this, false); initializeFlipper(this); // Remove this line if you don’t want Flipper enabled }
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 6
- Comments: 16
Use this package, way better, just saying to increment its visibility (it’s not mine) because I believe that the good work, and the effort that it requires, must be paid off somehow 😃
https://github.com/zoontek/react-native-bootsplash
oh good, so instead of promoting the right one, we should keep using the broken ones. Clearly I didn’t know that in 0.61.4 it’s still working considering that the last commit was in April and that a lot of people (the author of this and the other 4 guys that liked the first comment plus many other issues) reported the packages as broken.
react-native-splashscreenworks for me with 0.61.4.You have to follow the readme:
onCreate()method toMainActivity.javaSplashScreen.hide()somewhere in yourcomponentDidMount()and thats itthis issue is to solve a problem with this package, not promoting other packages
He is right though. This package seems to be dead.
Edit: and the recommended package works like a charm. Recommended +1
Wow two downvotes… people, I ask, do you wanna solve problems or do you want just to rage against someone who is just trying to help? Bootsplash works for me on rn 0.61.4. @TrueTiem When you say that something don’t works, say why and at this point I’d say to report it directly on that repo
I adviced that packages for other reasons that brought me to believe that it’s better than this one
@edy sorry, did I say something wrong advising another package instead of this one that seems abandoned?
For those suffering from androidX migration. I’ve been there and here’s how I made it work. First convert the
android.supportto itsandroidxequivalent inSplashActivity.java.import androidx.appcompat.app.AppCompatActivity;instead of :import android.support.v7.app.AppCompatActivity;and remove the
linkfrom the following files:‘MainApplication.java’,
‘setting.gradle’
‘app/build.gradle’.
Hope this will help you as well. Cheers Btw I’m using
"react-native": "^0.62.0-rc.1",one more tip. if you have done all configuration on iOS and you still see the old splash screen, remove the app on the simulator and build again.