Giter Club home page Giter Club logo

pokedex's Introduction

Pokedex

This repository contains a React Native project that aims to provide a usage example of React Native and the PokeAPI API.

Getting Started

Note: Make sure you have completed the React Native - Environment Setup instructions till "Creating a new application" step and that you are using the latest nodejs LTS version (v18.16.x) before proceeding.

Step 1

Clone this repository to your local machine using the following command:

git clone https://github.com/cccaballero/pokedex.git

Step 2

Navigate to the project directory:

cd pokedex

Step 3

Install the project dependencies:

npm install

Step 4

Rename (copy and rename) the file env.template to .env

cp env.template .env

Step 5: Start the Metro Server

First, you will need to start Metro, the JavaScript bundler that ships with React Native.

To start Metro, run the following command from the root of your React Native project:

npm start

Step 6: Start the Application

Let Metro Bundler run in its own terminal. Open a new terminal from the root of your React Native project. Run the following command to start the Android app:

npm run android

Folder Structure

  • /App: Contains the source code of the React Native application.
    • /components: Includes reusable UI components.
    • /redux: Includes redux store.
    • /routing: Handles app navigation and routing.
    • /screens: Contains individual screens or views.
    • /services: Includes calls to APIs or services.
    • /utils: App utilities and reusable functions.

Comments

  • Followed Mobile Pokedex App design exploration. Not pixel perfect, I only have a reference image and I would need to include more data, so I would take more time.
  • Used Redux Toolkit and Thunk for async operations.
  • The app looks for the environment variable BASE_URL as the base URL for api requests, this is useful for setting different environments as production, stage, development, etc.
  • The app uses a styled components approach, with styles defined for each component. In a bigger app using a global approach for styles can be useful for reusing styles between different components.
  • A couple of types definitions are missing like routing or Thunk actions.
  • The PokeAPI API does not provides id values in its pokemon endpoint, only provides names and a URL. To avoid making extra requests to be able to show the images on the list, I decided to obtain the ID parsing the URL that it provides. Normally it is not necessary to resort to this type of hack because the API provides an identifier.
  • The PokeAPI API does not have an endpoint to perform searches, it would be possible to implement a search using the pokemon/pokemon_name endpoint to search for exact matches in the name of the Pokemon, or even, taking into account that there are little more than 1000 records, it is possible to obtain them all and filter.
  • React Native doesn't handle image sizes properly when loaded from URL. To allow images to have the correct width depending on the mobile screen size, I get the width from the parent component and apply it to the images. This action is expensive and can cause glitches as the size of the list increases, so for the list with infinite scroll I use a fixed width. The latter can be done because by increasing the size of the screen, the size of the cards does not increase considerably, but more cards are added.

pokedex's People

Contributors

cccaballero avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.