Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/patrixr/demo-react-native

A demo application using the jsonplaceholder.typicode.com API
https://github.com/patrixr/demo-react-native

demo-app react-native swipe

Last synced: 14 days ago
JSON representation

A demo application using the jsonplaceholder.typicode.com API

Awesome Lists containing this project

README

        

# A React Native Sample

[![forthebadge](https://forthebadge.com/images/badges/check-it-out.svg)](https://forthebadge.com)
[![forthebadge](https://forthebadge.com/images/badges/made-with-javascript.svg)](https://forthebadge.com)
[![forthebadge](https://forthebadge.com/images/badges/uses-badges.svg)](https://forthebadge.com)

Here is my first react native app, it is a mini social app based on the [JSON Placeholder](https://jsonplaceholder.typicode.com) API

This project runs on the [Expo CLI](https://docs.expo.io/versions/latest/workflow/expo-cli/)

## Main Components

### Home page: Card Swipe (a la Tinder)

* Swiping **left** discards the profile
* Swiping **right** opens their profile page

Screenshot 2019-08-18 at 5 35 26 PM

### Profile Page

--> This page opens up when you swipe **right** on a card

It contains the following tabs:
- A TODO list
- The user's posts
- The users photos, categorized in albums

Screenshot 2019-08-18 at 5 36 53 PM

## Requirements

- `YARN`
- `NODE`

## Running the app

Install the dependencies:

`$> yarn install`

Run the app:

`$> yarn start`

This will run an expo live server that can be used to load the app on either a simulator or a phone

## Notes on testing

Given that the Swipe feature is pretty animation-heavy. I'd recommend testing on a phone, as the simulator can possibly get a bit sluggish.

Steps:

- Install the `Expo` app on your phone
- Ensure your phone and computer are on the same network
- Run the server using `yarn start`
- A QR Code will appear on the screen, scan it with the Expo app
- The app will load and start on your phone

## Notes on the code

- Wrote a post about this usage of hooks [here](https://dev.to/patrixr/react-writing-a-custom-api-hook-l16)
- Given it's a demo, the strings have not been stored in any localization file
- Despite the API returning static data, the pages were still written as if the data was susceptible to change. Meaning there is not a single preload at startup. The pages can still request data multiple time over the lifecycle of the application (although I added a cache to avoid pointless latency)