Skip to content

gpessoni/Search-Github_Profile-React_Native

Repository files navigation

GITHUB PROFILE SEARCHER

This is a app for search GitHub Profiles. This projects are made with the GitHub api's, the documentation are avalible here You can download the APK from the project here

Prerequisites

Use Template button

Click the "Use this template" button above the file list, then use the Owner drop-down menu, and select the account you want to own the repository. Creating a repository from a template has the following advantages:

  • A repository created from a template starts with a single commit.
  • Commits to a repository created from a template do appear in your contribution graph.
  • Creating a repository from a template starts a new project quickly.

Folder structure

This template follows a very simple project structure:

  • src: This folder is the main container of all the code inside your application.
    • actions: This folder contains all actions that can be dispatched to redux.
    • assets: Asset folder to store all images, vectors, etc.
    • components: Folder to store any common component that you use through your app (such as a generic button)
    • constants: Folder to store any kind of constant that you have.
    • controllers: Folder to store all your network logic (you should have one controller per resource).
    • localization: Folder to store the languages files.
    • navigation: Folder to store the navigators.
    • reducers: This folder should have all your reducers, and expose the combined result using its index.js
    • screens: Folder that contains all your application screens/features.
      • Screen: Each screen should be stored inside its folder and inside it a file for its code and a separate one for the styles and tests.
        • Screen.js
        • Screen.styles.js
        • Screen.test.js
    • selectors: Folder to store your selectors for each reducer.
    • storage: Folder that contains the application storage logic.
    • store: Folder to put all redux middlewares and the store.
    • test-utils: Folder to store tests-related utilities and components.
    • theme: Folder to store all the styling concerns related to the application theme.
    • App.js: Main component that starts your whole app.
    • index.js: Entry point of your application as per React-Native standards.

Setup environments

Using scripts from console

The template already has scripts to execute the project calling a specific environment defined into the package.json file. Keep in mind that if you are going to create new envs you have to define the script to build the project properly.

To define which env you want to use, just keep the structure yarn [platform]: [environment]

DEV: yarn ios or yarn android

STG: yarn ios:staging or yarn android:staging

PROD: yarn ios:prod o yarn android:prod

Also, you can use npm following the same rule as before: npm run ios:staging

Modify the environment variables files in root folder (.env.development, .env.production and .env.staging)

Android

A map associating builds with env files is already defined in app/build.gradle you can modify or add environments if needed.

For multiple enviroments to work you would need to change -keep class [YOUR_PACKAGE_NAME].BuildConfig { *; } on proguard-rules.pro file.

iOS

The basic idea in iOS is to have one scheme per environment file, so you can easily alternate between them.

To create a new scheme:

  • In the Xcode menu, go to Product > Scheme > Edit Scheme

  • Click Duplicate Scheme on the bottom

  • Give it a proper name on the top left. For instance: "qa"

  • Then edit the newly created scheme to make it use a different env file. From the same "manage scheme" window:

    Expand the "Build" tab on the left menu

    • Click "Pre-actions", and under the plus sign select "New Run Script Action"
    • Where it says "Type a script or drag a script file", type: echo ".env.qa" > /tmp/envfile replacing .env.qa with your file.
  • Also, you will need to select the executable for the new schema:

    Expand the "Run" tab on the left menu

    • Under the "Executable" dropdown select the ".app" you would like to use for that schema

Generate production version

These are the steps to generate .apk, .aab and .ipa files

Android

  1. Generate an upload key
  2. Setting up gradle variables
  3. Go to the android folder
  4. Execute ./gradlew assemble[Env][BuildType]

Note: You have three options to execute the project assemble: Generates an apk that you can share with others. install: When you want to test a release build on a connected device. bundle: When you are uploading the app to the Play Store.

For more info please go to https://reactnative.dev/docs/signed-apk-android

iOS

  1. Go to the Xcode
  2. Select the schema
  3. Select 'Any iOS device' as target
  4. Product -> Archive

For more info please go to https://reactnative.dev/docs/publishing-to-app-store

Styleguide

For coding styling, we decided to go with ESLint and React Native community's styleguide.

How to use it

The idea of this section is to explain how the template composition is the best and easiest to use when you try to use well-formed, architectures, especially using redux flow.

The template follows a simple and convenient exporting pattern. The folder index exposes the resources, allowing to import all from the same path.

With that in mind, we are going to look at each folder to explain how to use it.

Components

Components are the basic blocks of a react native application, but since we​​ aim to minimize development complexity, all the components are at the same nesting level.

Another important thing is the use of propTypes to check the kind of data that your components need to work properly. If the component receives some data from others, the type of these props must be defined, and in case you need it the default value of the property too.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published