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.

Unable to show "real" app, after pressing done.

See original GitHub issue

Hi, thanks for the amazing repo. My doubt may not exactly be an issue as such but I’m finding it hard to open a component once done is pressed. Any help will be highly appreciated. Code:

import StartApp from ‘./StartApp’

Trial 1:

  render() {
    return (
       <AppIntroSlider slides={slides} onDone={() => <StartApp/>}/>
       );
  }

Trial 2:

_onDone = () => {
   // User finished the introduction. Show "real" app   
    <StartApp/>
 }
  render() {
    return (
       <AppIntroSlider slides={slides} onDone={this._onDone}/>
       );
  }

None of the above two open the StartApp component which I imported.

Thanking in advance.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
Jacsecommented, Jan 16, 2018

Hi @shibbyy,

You’re really close, but what you are getting wrong is how React works. You can’t return a component from a random function and expect it to be rendered, so currently nothing happens with the StartApp-component. What you’d probably want to do (if you’re don’t want to use your navigation library) is something like this:

  constructor(props) {
    super(props);

    this.state = {
      showRealApp: false
    }
  }

  _onDone = () => {
    this.setState({ showRealApp: true });
  }
  render() {
    if (this.state.showRealApp) {
      return <StartApp />;
    } else {
      return <AppIntroSlider slides={slides} onDone={this._onDone}/>;
    }
  }

Notice how we use state to keep track of when the user has finished the introduction and how we use the render-function to return a component. I’ll close since this is not actionable, but please let me know if the approach above does not work for you!

1reaction
shibbyycommented, Jan 16, 2018

Hi @Jacse ,

Thank you so much for taking out some time to explain me this, works like a dream! Cheers!

Read more comments on GitHub >

github_iconTop Results From Across the Web

If an app on your iPhone or iPad stops responding, closes ...
Force the app to close. Then open the app to see if it works as expected. Restart your device. Restart your iPhone or...
Read more >
How to Fix Apps That Will Not Open on an iPhone
Open the App Store and tap "Updates" to see if there are newer versions of problematic apps. Tap the "Update All" if updates...
Read more >
My iPhone Apps Won't Open! Here's The Real Fix.
Your iPhone apps won't open because your iPhone has a software problem. When an app crashes, it usually doesn't take the whole iPhone...
Read more >
No apps connected. Sending "reload" to all React Native apps ...
It happens on Real device connection. When I work with IOS simulator, there is not problem. NOTE: My phone and macbook on SAME...
Read more >
Fix problems downloading apps from the Play Store
More troubleshooting steps · Close & reopen the Play Store · Uninstall & reinstall Play Store updates · Restart your device · Clear...
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