• Stars
    star
    494
  • Rank 86,267 (Top 2 %)
  • Language
    JavaScript
  • Created over 8 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An Android app to demonstrate react-native-material-design

React Native Material Design Demo App [Android]

This repository contains a React Native project, implementing the react-native-material-design package.

View it online here! (Credits to Appetize for free hosting).

Please submit all issues to react-native-material-design.

Installation

Development

  1. Clone this repo.
  2. Run npm install.
  3. Ensure a device, or emulated Android image is connected (adb devices).
  4. Run react-native run-android.

If running on a device, run adb reverse tcp:8081 tcp:8081.

APK

To download the production/release APK, click here

Can I use this as a base project?

Of course. Please remember though it is not a "fit all" solution and you'll need to configure it for your own project needs.

To change the name of the project, edit android/app/src/res/values/strings.xml. To change the launcher icon of the project, change all of the ic_launcher.png icons within android/app/src/res/mipmap-XXXX/.

How it works

This Android only demo app has been designed to be as minimal and basic as possible, to avoid confusion.

Key points:

  • It's only working on Android for now.
  • Alt is used as a light weight flux implementation to handle application state.
  • A custom Navigate class has been made to handle route navigation. It's a wrapper around the native 'Navigator' API, and does not force any set ways of working - see below for more information.
  • Some aspects are dependant on React's context.

Each scene is located within ./src/scenes, while the Toolbar is global to the entire app and is located within ./src/components. The main entry point of the app is within index.android.js, here the app undergoes a few cycles of component mounting, wrapping the scenes within a Navigator, which is wrapped within a DrawerLayoutAndroid.

The refs for the drawer and navigator are created as application context, and are available when needed throughout the app. The navigator context however is an implementation of a custom Navigate class found in ./src/utils/Navigate, which allows for navigation around the app, and 'down' children components.

Navigate

The Navigate class needs to be instantiated on application boot, with a reference to React's Navigator API passed. An example of this can be found here.

Once instantiated, the class exposes a few methods to help with simple app navigation. First however, we must define our routes. The class looks for a routes.js file in the root of the src directory.

The class also handles hardwareBackPress events correctly, only exiting the app if we're on a parent route. Otherwise, it calls the back() method.

Routes

This is a simple object based pattern of components and their children, an example of which can be found here.

Top level objects are considered to be the "parent" scenes of your app, and are defined by object keys. Each object should contain a name and a component property. See below example.

Basic Routes Config Example
export default {

    parent: {
        title: 'Parent Scene',
        component: require('./scenes/SomeParentScene').default
    }

}

You can have as many parent key objects as you like.

If you wish to define some children of this route, simply add a children object, with the same pattern as above. See below example.

Advanced Routes Config Example
export default {

    parent: {
        title: 'Parent Scene',
        initialRoute: true, // this route will be show on app start
        component: require('./scenes/SomeParentScene').default,

        children: {
            child: {
                title: 'Child Scene',
                component: require('./scenes/SomeChildScene').default,
            }
        }
    },
    'Another Parent': { // can be called anything
        // title: 'Another Parent', // title is optional, defaults to the parent object key name 'Another Parent'
        component: require('./scenes/AnotherParentScene').default,

        children: {
            'Another Child': { // can be called anything
                // title: 'Another Child', // title is optional, will default to the parent object key name 'Another Child'
                component: require('./scenes/SomeOtherChildScene').default,
            },
            'Yet Another Child': { // can be called anything
                component: require('./scenes/SomeOtherChildScene').default,
            }
        }
    }

}

You can have as many children, and children of children as you like.

API

static getInitialRoute([optional] defaultRoute, [optional] routesConfig)
  • defaultRoute: Specify a parent route to return. By default however this will look for the first parent on your routes config with initialRoute: true, else, if no initial route specified it'll just return the first parent route.
  • routesConfig: Specify the routes config. This is not required if you have a routes.js file setup in /src.

Can be called without class instantiation, and is used to get an initial starting route to show initially.

This is handy for configuring initial routes, for example here.

Navigate.getInitialRoute('parent');

Optionally you can pass in the routes yourself via Navigate.getInitialRoute('parent', { ...some routes });

This can only be used with parent routes.

to(path, title, props)

Used to directly access any route from any location.

Navigate.to('root.child', 'Custom Title', { some: 'prop' });

path: Required path to a route. title: Optional title to use for the route. If left blank, the title/route name from the routes.js file will be used. props: Option object of props to pass to the next scene.

back(title, props)

Used when going to the parent of the current route.

Navigate.back('Custom Title', { some: 'prop' });

title: Optional title to use for the route. If left blank, the title/route name from the routes.js file will be used. props: Option object of props to pass to the parent scene.

forward(path, title, props)

Used when going to a child of the current route.

// Assuming the current route is "root":
Navigate.forward('child', 'Custom Title', { some: 'prop' });
Navigate.forward(null, 'Custom Title', { some: 'prop' });

path: Optional path to a child route. If no path is supplied, the first child of the parent defined in routes.js will be used. title: Optional name to use for the route. If left blank, the title/route name from the routes.js file will be used. props: Option object of props to pass to the next scene.

isChild

An exposed boolean value on the class updated on route change if applicable.

If true, the current route is a child. If false, the current route has no parent.

currentRoute

An exposed object which is updated on route change, containing the values of the current route.

navigator

The initial reference to the Navigator API.

More Repositories

1

react-native-firebase

πŸ”₯ A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
JavaScript
11,434
star
2

rdash-angular

AngularJS implementation of the RDash admin dashboard theme
HTML
4,691
star
3

react-native-material-design

React Native UI Components for Material Design
JavaScript
3,155
star
4

notifee

βš›οΈ A feature rich notifications library for React Native.
TypeScript
1,712
star
5

react-native-apple-authentication

A React Native library providing support for Apple Authentication on iOS and Android.
JavaScript
1,338
star
6

react-native-firebase-starter

DEPRECATED: For RNFB v5 only.
JavaScript
1,170
star
7

melos

πŸŒ‹ A tool for managing Dart projects with multiple packages. With IntelliJ and Vscode IDE support. Supports automated versioning, changelogs & publishing via Conventional Commits.
Dart
1,034
star
8

react-native-google-mobile-ads

React Native Google Mobile Ads enables you to monetize your app with AdMob.
TypeScript
609
star
9

react-native-notifee

Moved to https://github.com/invertase/notifee
TypeScript
467
star
10

docs.page

Instant Open Source docs with zero configuration.
TypeScript
424
star
11

stripe-firebase-extensions

Repository of Firebase Extensions built by Stripe.
TypeScript
418
star
12

firestore-ios-sdk-frameworks

⚑ Precompiled Firestore iOS SDKs extracted from the Firebase iOS SDK repository release downloads for faster build times.
Ruby
402
star
13

react-query-firebase

React Query hooks for managing asynchronous operations with Firebase. Supports Authentication, Analytics, Firestore & Realtime Database.
TypeScript
367
star
14

denque

The fastest javascript implementation of a double-ended queue. Used by the official Redis, MongoDB, MariaDB & MySQL libraries for Node.js and many other libraries.
JavaScript
347
star
15

zapp.run

Zapp! A free online sandbox environment for building Flutter applications in the browser.
Dart
309
star
16

spec

βœ… A streamlined testing framework for Dart & Flutter.
Dart
303
star
17

dart_edge

Run Dart on the Edge - supporting Vercel & Cloudflare Workers (more coming soon).
Dart
302
star
18

dart_custom_lint

πŸ’‘ Easily write powerful Dart & Flutter lint rules for your projects or for users of your packages.
Dart
269
star
19

angular-toasty

A simple standalone AngularJS module with extensive features that provides growl-style alerts and messages for your app!
CSS
255
star
20

react-native-firebase-docs

DEPRECATED: For RNFB v5 only.
189
star
21

github-action-dart-analyzer

A GitHub action to run Dart analyzer with annotation support.
TypeScript
168
star
22

flutterfire_cli

A CLI to help with using FlutterFire in your Flutter applications.
Dart
160
star
23

react-native-firebase-authentication-example

An example React Native Firebase application integrating authentication.
TypeScript
138
star
24

conference-app

Dart
116
star
25

dart_firebase_admin

πŸ”₯ A Firebase Admin SDK for Dart.
Dart
103
star
26

jet

✈️ Test your React Native modules e2e; mock-free and native testing code free.
JavaScript
98
star
27

globe

🌎 The global deployment platform for Dart & Flutter applications.
Dart
98
star
28

react-native-gradle-plugin

A gradle plugin for React Native Android that simplifies and standardises build configurations (such as dependency versioning) for Projects & React Native modules.
Groovy
62
star
29

dart_docker

πŸ‹ A Dart client for the Docker API via local unix socket.
Dart
41
star
30

flutter_desktop_webview_auth

WebView OAuth flows for desktop flutter apps
C++
31
star
31

dart_firebase_apis

πŸ”₯ Generated Firebase APIs for Dart. Additionally Includes private and unlisted APIs.
Dart
29
star
32

firebase-extensions

A collection of Firebase Extensions built by Invertase.
TypeScript
29
star
33

puppeteer-pool

Flexible Puppeteer Browser instance resource pooling.
JavaScript
28
star
34

deeps

Performant utilities to manage deeply nested objects. get, set, flatten, diff etc.
JavaScript
26
star
35

nodejs-paddle-sdk

A fully typed Node.js library for integration with Paddle.
TypeScript
26
star
36

samples

Collection of samples from our projects and tutorials.
Dart
20
star
37

dart-cli-utilities

βš’οΈ A monorepo containing a collection of packages that provide useful functionality for building CLI applications in Dart.
Dart
20
star
38

cluster-key-slot

Generates CRC hashes for strings - for use by Node Redis clients to determine key slots.
JavaScript
17
star
39

react-native-firebase-workshop-app

Showcasing React Native + Firebase
TypeScript
13
star
40

sails-firebase-auth

A SailsJS v1 JSON starter api with Firebase token authentication.
JavaScript
10
star
41

crc16

Native node addon to calculate CRC16 values.
C++
10
star
42

firebase-firestore-fields

Convert Firebase Cloud Firestore fields into a usable JavaScript format
JavaScript
10
star
43

react-native-auto-link-example

Init a React Native project with auto-linking πŸ”₯
Objective-C
10
star
44

react-native-template

Generic template for Invertase React Native projects
Objective-C
10
star
45

remix-firebase-storage-file-handler

An upload handler for Remix using Firebase Storage
TypeScript
8
star
46

a2a

Async await to Array -> `const [error, value] = await A2A(fooPromise());`
JavaScript
7
star
47

nodejs-google-java-format

Node.js repackaging of Google's native `google-java-format` tool.
JavaScript
7
star
48

dart_globe_examples

Repository containing various Dart examples for Globe.
6
star
49

nx-dart

A Nx plugin, that adds support for developing Dart and Flutter packages in a Nx workspace.
TypeScript
6
star
50

babel-preset-react-native-syntax

πŸ“¦Babel preset providing syntax only plugins used by babel-preset-react-native - supports React Native ^0.56.0.
JavaScript
5
star
51

firebase-relationship

A simple Firebase Realtime Database relationship manager.
JavaScript
5
star
52

firebase-extension-utilities

TypeScript
4
star
53

sails-ioredis

Redis adapter for waterline with sentinel and cluster support support (ioredis)
JavaScript
4
star
54

tutorials

πŸŽ“ A collection of open-source tutorials by us and the open-source community covering topics such as React Native and Firebase.
4
star
55

balanced-employee-ip-agreement

An English law and Open Source friendly Balanced Employee IP Agreement - providing a balanced approach to assigning control of intellectual property (IP) created by UK company employees. See releases for PDF/MD files
4
star
56

flutterfire_ui

Dart
3
star
57

redis-writable

Fast conversion of commands and args to redis protocol writables.
JavaScript
3
star
58

wtfork

Subscribe to and publish events between parent and child node processes using the standard node event emitter api or call parent methods directly from the child process and vice versa.
JavaScript
3
star
59

firebase-functions-python-old

[WIP] Firebase SDK for Cloud Functions and Python.
Python
3
star
60

llm-gcp

Python
3
star
61

extensions-quickstart-js

Firebase Extensions quick start examples
TypeScript
3
star
62

firebase_performance_flutter_example

Testing
Dart
2
star
63

meta

General guidelines and documentation for the Invertase GitHub org.
1
star
64

ios-sdk-10-issues

iOS SDK 10 Firebase Storage issues
Objective-C
1
star
65

react-custom-event

React hook for window CustomEvent
JavaScript
1
star
66

docker-react-native-firebase-android

Dockerfile
1
star
67

oss-discord-community

Nothing to see here.
1
star
68

.github

Default community health files for Invertase.
1
star