react-native-splash-screen: undefined is not an object (evaluating '_reactNativeSplashScreen2.default.hide')
I have already configure my code just like the instruction to use the splash screen but when I compile it using my Redmi Note 3 it returns error like this:

in line of code:
class Main extends Component {
constructor(props) {
super(props);
this._onPressLogo = this._onPressLogo.bind(this);
componentDidMount() {
SplashScreen.hide(); //ERROR here
}
_onPressLogo() {
//this
Actions.about();
}
render() {
return (
<Image style={{ flex: 1, width: null }} source={bg}>
{/* <AndroidBackButton /> */}
<StatusBar backgroundColor="#114D44" />
<View style={{ flex: 1, padding: 15 }}>
<View style={{ flex: 2, justifyContent: 'center', alignItems: 'center' }}>
{/* <TouchableHighlight onPress={this._onPressLogo} > */}
<Image source={logo} />
{/* //</TouchableHighlight>*/}
</View>
</View>
</Image>
);
}
}
react-native: “0.48.4” react-native-splash-screen: “^3.0.1” node: v6.11.2 npm: 5.3.0
please tell me how to handle this case.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 8
- Comments: 19
Make sure you add below lines in MainApplication.java
This will fix the issue!!!
Also make sure you have imported the below package
import org.devio.rn.splashscreen.SplashScreenReactPackage;You are missing some java code either in MainActivity.java or MainApplication.java.
Make sure you have
new SplashScreenReactPackage()inside the MainApplication.java otherwise SplashScreen will not be exposed to react code.
I had the same issue adding
new SplashScreenReactPackage()fixed it.Same issue with iOS 13.1, RN 0.61.5 and this package using 3.2.0. @anhdevit and @someoneNameGrey answers sadly didn’t help 🙁 Is this package still maintains ?
@khadkaPratik The fix I mentioned was for Android.
#import "SplashScreen.h"to./ios/<AppName>/AppDelegate.mif not existsProbably, it will be fix.