question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

undefined is not an object (evaluating '_reactNativeSplashScreen2.default.hide')

See original GitHub issue

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:

image

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.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:8
  • Comments:19

github_iconTop GitHub Comments

10reactions
edgesinghkatariacommented, Mar 19, 2019

Make sure you add below lines in MainApplication.java

protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
            new MainReactPackage(),
            new SvgPackage(),
            new VectorIconsPackage(),
            new SplashScreenReactPackage() //here
          
      );
    }

This will fix the issue!!!

Also make sure you have imported the below package import org.devio.rn.splashscreen.SplashScreenReactPackage;

10reactions
creativeauracommented, Mar 12, 2018

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

reactjs - How to solve this error -> undefined is not an object ...
How to solve this error -> undefined is not an object (evaluating '_app.default.auth) ... I'm new to react native and I am using...
Read more >
Undefined is not an object (evaluating 'this._movie.play')
But when its going to start the experiment I receive the following error message: Type Error: Undefined is not an object (evaluating 'this._movie.play'....
Read more >
How to Fix TypeError: Null is Not an Object in JavaScript
The JavaScript error TypeError: null is not an object occurs when a property is accessed or a method is called on a null...
Read more >
Error "Undefined is not an object (evaluating 'e.default')"
I got an error like this (image), and how to solve it? Please help :( 0. 0.
Read more >
undefined is not an object (evaluating 'dataText[i].length')
TypeError : undefined is not an object (evaluating 'dataText[i].length') ... innerHTML = text.substring(0, i+1) +'<span aria-hidden="true"></span>'; ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found