Skip to content

samclaridge/GitHub-GraphQL-API-Example

 
 

Repository files navigation

IssueReader

On September 14, 2016, GitHub announced a preview of their new GraphQL API. Read our recap of the news here!.

This is a small app to demonstrate how to load and paginate some issues and comments from a repository, using Apollo Client with React Native.

Running

  1. Copy config.default.js into a file called config.js, and replace xxx with your username and password
  2. Install dependencies with npm install
  3. Make sure you have React Native installed, then type react-native run-ios and wait for the iOS simulator to open

Current features

  1. Sending a login token to GitHub API by attaching an Authorization header to the request
  2. Navigating between two views and loading different queries, with caching built into Apollo Client
  3. Infinite scroll pagination using the GraphQL connections

Screenshot

The UI is pretty basic, with only the default styling. The first page is the list of issues for the Apollo Client repository, and if you tap you can see the comments for that issue on the second page. As you scroll down, the app eventually loads all of the issues and comments.

Contributing

Help make the app better! Some ideas:

  1. Add real login, ideally with OAuth
  2. Add markdown rendering for comments
  3. Add a mutation to add reactions to comments, or post a new comment

About

A simple React Native example app on top of GitHub's new GraphQL API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 72.0%
  • Objective-C 28.0%