Join egghead, unlock knowledge.

Want more egghead?

This lesson is for members. Join us? Get access to all 3,000+ tutorials + a community with expert developers around the world.

Unlock This Lesson
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.


    React Native does not maintain NavigatorIOS

    Navigate to a React Native component

    react-nativeReact Native
    0.3 - 0.53
    0.14 - 16

    Now that we've created the React Native component for our repositories view, we still need to wire it into the routing so that we can visit its view.



    Become a Member to view code

    You must be a Pro Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson
    orLog In




    You'll remember earlier when we created our dashboard, we had a "Go to Profile" function, a "Go to Repos" function, and a "Go to Notes" function. Each of these were invoked when a user pressed on a certain button. Because we didn't have the repositories component finished, we just logged, "Go to," and it should be "repos."

    What we're going to do now is, instead of just logging that, let's actually take the user to the repositories component. The title, let's call it "Repos." The data we're going to pass in, in a repositories component, we're expecting to receive user info. We're also expecting to receive some repos, as well.

    When we made our API, we made this "Get Repos" method. All it did was it used "Fetched" to go and grab the user's GitHub repos. Then, it returns that promise.

    What we should be able to do now is, inside of our "Go to Repos" function, let's go ahead and first let's require API. We're in dashboard, so we're going to go back one, into utils, and get API. Now what we can do is api.getrepos, and we're going to pass it this.props.userinfo.login. This is going to be the username of the GitHub user that we're dealing with.

    Then, remember, that will return a promise. We're going to have a .then. We're going to use the sx fat arrow. We're going to get this response back from our promise.

    When all the data gets back, when it gets parsed to JSON, we're then going to call this function, which will go and change routes. We're going to pass it "User Info. We're also going to pass it "Our Repos." That'll be the response that we got.

    Now, let's verify that everything's working. If we come here, type any username, then go to "View Repos," it does not seem to be working. We forgot to require repositories. I'm going to require that right now. Now, if we go back, let's see if this works now. There we go. There's all the repositories.