Giter Site home page Giter Site logo

myshop's Introduction

This starter is a collection of libraries and approaches needed for fast start and productive maintainance of Expo (React Native) App.

Getting Started

Quick start with cli-rn

npx cli-rn new app

In order to change app's name, please make necessary changes in app.json.

Manual setup
  1. Clone the repo
npx degit kanzitelli/expo-starter app
  1. Install packages
cd app && yarn
  1. Run it!
yarn start

What's inside

  • Expo SDK - a set of tools and services built around React Native and native platforms.
  • React Navigation (v6) - routing and navigation for React Native apps.
  • Navio - universal navigation library for React Native. Built on top of React Navigation.
  • RN UI lib - amazing Design System, UI toolset & components library for React Native. Dark Mode is implemented using this library.
  • Reanimated 2 - React Native's Animated library reimplemented.
  • MobX - simple, scalable state management, with mobx-persist-store for persisting your stores.
  • Flash List - a better list for React Native (by Shopify).
  • React Native Gesture Handler - native touches and gesture system for React Native.

Native libraries

In order to use them, you will need to run yarn prebuild command to generate ios/ and android/ folders with native code.

  • MMKV - efficient, small mobile key-value storage framework developed by WeChat. ~30x faster than AsyncStorage! Available only within Expo dev clients. Instructions on installation could be found here.
  • Fast Image - performant React Native image component.

Extra helpful libraries

  • Release It - automate versioning and publishing of your app.

Useful services/methods

  • navio - a service that exposes all navigation methods of Navio instance.
  • translate - a service that brings an easy integration of localization for an app by using i18n-js and expo-localization.
  • api - a service where API-related methods are located.
  • onStart - a service where you can write your own logic when app is launched. For example, you can increment number of appLaunches there.

Design system

This starter is using RN UI lib as a design system, UI toolset and a source of ready-to-go components.

configureDesignSystem() - a method where all settings for an app's design system is taking place. You can customize colors, schemes, typegraphy, spacings, etc. Located at src/utils/designSystem.tsx.

video.MP4

Advantages

Describe app layout in one place (w/ Navio)

All setup for your screens, tabs and modals take place in one file src/screens/index.ts.

import {Navio} from 'rn-navio';

// importing screen components
import {Main} from './main';
import {Playground} from './playground';
import {Settings} from './settings';
import {Example} from './_screen-sample';

// building layout
export const navio = Navio.build({
  screens: {
    Main,
    Settings,
    Example,
    Playground: {
      component: Playground,
      options: () => ({
        title: 'Playground',
      }),
    },
  },
  stacks: {
    MainStack: ['Main', 'Example'],
    ExampleStack: ['Example'],
  },
  tabs: {
    MainTab: {
      stack: 'MainStack',
      options: {
        title: 'Home',
      },
    },
    PlaygroundTab: {
      stack: ['Playground'],
      options: () => ({
        title: 'Playground',
      }),
    },
    SettingsTab: {
      stack: ['Settings'],
      options: () => ({
        title: 'Settings',
      }),
    },
  },
  modals: {
    ExampleModal: 'ExampleStack',
  },
  root: 'Tabs',
  hooks: [useAppearance],
  options: {
    stack: screenDefaultOptions,
    tab: tabDefaultOptions,
  },
});

export const AppRoot = navio.Root;

Navigate with predictability

export const Screen = () => {
  const {navio} = useServices();

  return (
    <View>
      <Button
        label="Push Settings"
        onPress={() => {
          // Typescript and IDE will help with autocompletion
          navio.push('Settings');
        }}
      />
    </View>
  );
};

Dark mode support

You can define modes in utils/designSystem.tsx.

Samples for new screens, services, stores and components.

So you have one structure within the project. You can find them in corresponding folders. Just copy&paste it and make the necessary changes.

Enhancements

There are still some things I would like to add to the starter:

Feel free to open an issue for suggestions.

Worth checking

Other starters

  • rnn-starter - ๐Ÿคน Production-ready starter for React Native App! Powered by cli-rn, React Native Navigation, RN UI lib, Mobx, Reanimated 2, Dark Mode, Localization, Notifications, Permissions, and much more.
  • rn-starter - ๐Ÿฆ„ Production-ready starter for React Native App! Powered by cli-rn, React Navigation (v6), RN UI lib, Mobx, Reanimated 2, Dark Mode, Localization, Notifications, Permissions, and much more.

Icons have been generated with BuildIcon created by Evan Bacon.

Articles

  • "Build React Native Apps with Simplified and Predictable Navigation" - Medium, Dev.to
  • "Testing React Native apps with zero effort" - Medium, Dev.to
  • "Expo + React Native Navigation? Yes!" - Medium, Dev.to

Why

...do we need yet another starter/boilerplate? Well, I work with React Native for more than 4 years and during the time I started having my own project structure which was a good fit for almost all of the delivered apps. Also, I have come up with some custom useful services/methods which simplify usage of React Navigation and other libraries. Check out Advantages section.

License

This project is MIT licensed

myshop's People

Contributors

kamharida1 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.