Showing customer spinner for 5 seconds after which show content

I am developing a react-native project. I have a spinner as a custom component:

const MySpinner = ({hide = false}) => {
   ...
   if (hide) {
    return null;
  } else {
    return (
      <View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
        <Animated.View>
          <MyIcon />
        </Animated.View>
      </View>
    );
  }
} 

As you can see above, there is a hide property which decides whether I show MySpinner or not in parent component.

In MyScreen, I would like to show MySpinner for 5 seconds, after which show the actual content (No networking callback involved). I try to use setTimeOut function to achieve it.

This is what I tried:

const MyScreen = () {
   ...

   return (
      <View style={styles.container}>
        {setTimeout(() => { <MySpinner hide={true}/>}, 3000)}
        <ActualContent />
     </View>
   )

}

At runtime, I got error Error: Text strings must be rendered within a <Text> component.

Also, the above code doesn’t show actual content after MySpinner disappear.

So, how can I achieve what I need? That’s showing MySpinner at first for 5 seconds after that show the actual content.

111 thoughts on “Showing customer spinner for 5 seconds after which show content”

  1. I have to express some appreciation to you just for bailing me out of this type of predicament. After searching throughout the online world and meeting ways that were not pleasant, I assumed my life was done. Existing devoid of the approaches to the problems you have solved by way of the article content is a critical case, as well as the ones that could have adversely damaged my career if I had not discovered your web page. The know-how and kindness in touching the whole lot was important. I’m not sure what I would’ve done if I hadn’t come upon such a stuff like this. It’s possible to at this moment relish my future. Thanks for your time very much for this reliable and sensible guide. I will not be reluctant to recommend your blog post to any person who ought to have guide on this subject.

    Reply
  2. Pingback: cipla tadalafil
  3. It is appropriate time to make a few plans for the long run and it’s time to be happy.
    I’ve read this publish and if I may just I wish to recommend you few interesting issues or advice.
    Perhaps you can write next articles referring to this article.
    I desire to learn even more things about it!

    Reply
  4. Hi there! I know this is kinda off topic however
    I’d figured I’d ask. Would you be interested in trading links or maybe guest writing a blog post or vice-versa?

    My blog covers a lot of the same topics as yours and I
    believe we could greatly benefit from each other.
    If you happen to be interested feel free to
    send me an email. I look forward to hearing from you!
    Wonderful blog by the way!

    Reply
  5. Its like you learn my mind! You seem to understand a lot approximately this, such as you
    wrote the guide in it or something. I think that you just can do with a few p.c.

    to power the message house a little bit, but other than that, this is excellent blog.
    A great read. I will certainly be back.

    Reply
  6. We’re a bunch of volunteers and starting a brand new scheme in our community. Your web site provided us with valuable info to paintings on. You’ve performed a formidable task and our whole neighborhood will likely be grateful to you.

    Reply
  7. Howdy! This article couldn’t be written much better!

    Going through this article reminds me of my previous roommate!
    He always kept talking about this. I’ll forward this post to him.
    Pretty sure he will have a great read. Thanks for sharing!

    Reply
  8. It’s perfect time to make some plans for the future and it is time to be happy.
    I’ve read this post and if I could I want to suggest you some interesting
    things or tips. Maybe you could write next articles referring to this article.
    I wish to read more things about it!

    Reply
  9. Woah! I’m really enjoying the template/theme of this site.
    It’s simple, yet effective. A lot of times it’s tough to
    get that “perfect balance” between usability and visual appearance.
    I must say you’ve done a excellent job with this.
    Additionally, the blog loads super fast for me on Opera.

    Superb Blog!

    Reply
  10. I think this is one of the most significant info
    for me. And i am glad reading your article. But want to
    remark on few general things, The web site style is
    perfect, the articles is really nice : D. Good job, cheers

    Reply
  11. Howdy would you mind stating which blog platform you’re
    working with? I’m planning to start my own blog in the near future but I’m having a
    tough time selecting between BlogEngine/Wordpress/B2evolution and Drupal.
    The reason I ask is because your layout seems
    different then most blogs and I’m looking for something completely unique.
    P.S Apologies for getting off-topic but I had to ask!

    Reply
  12. Hi there! This article couldn’t be written much better! Going through this article reminds
    me of my previous roommate! He always kept preaching about this.
    I will send this post to him. Fairly certain he will have a very good read.
    Thank you for sharing!

    Reply
  13. I will immediately clutch your rss feed as I can not in finding your e-mail
    subscription link or newsletter service. Do you have
    any? Kindly let me recognize so that I may just subscribe.
    Thanks.

    Reply
  14. Hey would you mind stating which blog platform you’re working
    with? I’m looking to start my own blog soon but I’m having a difficult time deciding between BlogEngine/Wordpress/B2evolution and Drupal.

    The reason I ask is because your layout seems different
    then most blogs and I’m looking for something completely unique.
    P.S Sorry for getting off-topic but I had to ask!

    Reply
  15. It’s appropriate time to make some plans for the future and it’s time to be happy.
    I’ve read this post and if I could I wish to suggest you some interesting things or tips.

    Perhaps you can write next articles referring to this
    article. I desire to read even more things about it!

    Reply
  16. I have been surfing online more than three hours these days,
    yet I never discovered any attention-grabbing article like yours.
    It is lovely worth sufficient for me. In my opinion, if
    all site owners and bloggers made good content as you probably did, the internet might be much more useful than ever before.

    Reply
  17. I will right away grasp your rss as I can’t in finding your email subscription hyperlink or newsletter service.
    Do you’ve any? Kindly allow me understand in order that I may
    subscribe. Thanks.

    Reply
  18. Thanks for your posting. I would like to comment that the first thing you will need to carry out is find out if you really need fixing credit. To do that you must get your hands on a copy of your credit file. That should never be difficult, because government necessitates that you are allowed to receive one no cost copy of your actual credit report each year. You just have to request that from the right people. You can either find out from the website for your Federal Trade Commission as well as contact one of the main credit agencies instantly.

    Reply
  19. I’ve been surfing online more than 2 hours today, yet I
    never found any interesting article like yours. It is pretty worth enough for me.
    In my opinion, if all webmasters and bloggers made good content
    as you did, the web will be much more useful than ever before.

    Reply
  20. I blog quite often and I seriously appreciate your information. This article
    has truly peaked my interest. I am going to take a note of your website and keep checking for new details about once per week.
    I subscribed to your Feed too.

    Reply
  21. It is appropriate time to make some plans for the future and it is time to be
    happy. I have read this post and if I could I wish to
    suggest you few interesting things or tips. Perhaps you can write next articles referring to this article.
    I want to read even more things about it!

    Reply
  22. Hey would you mind sharing which blog platform you’re
    using? I’m planning to start my own blog soon but I’m having a
    difficult time deciding between BlogEngine/Wordpress/B2evolution and Drupal.
    The reason I ask is because your layout seems different then most
    blogs and I’m looking for something unique.
    P.S My apologies for getting off-topic but I had to ask!

    Reply
  23. Its such as you learn my thoughts! You seem to know a lot about this, such as you
    wrote the guide in it or something. I think that you simply could do with
    a few % to force the message home a bit, but instead of that,
    that is fantastic blog. A great read. I will definitely be back.

    Reply
  24. I will immediately grab your rss as I can not to find your email subscription link
    or e-newsletter service. Do you’ve any?
    Kindly permit me realize so that I may just subscribe.

    Thanks.

    Reply
  25. It’s the best time to make some plans for the longer term and
    it is time to be happy. I have read this post and if I may
    I wish to suggest you some interesting issues or suggestions.

    Maybe you could write next articles referring to this article.
    I desire to learn more issues about it!

    Reply
  26. I absolutely love your website.. Great colors & theme.
    Did you make this site yourself? Please
    reply back as I’m trying to create my very
    own blog and would like to learn where you got this from or exactly what the
    theme is named. Thank you!

    Reply
  27. It is appropriate time to make some plans for the future
    and it is time to be happy. I’ve read this post and if
    I could I desire to suggest you few interesting things or tips.
    Maybe you could write next articles referring to this article.

    I wish to read more things about it!

    Reply

Leave a Comment