{"id":13989965,"url":"https://github.com/invertase/react-native-material-design-demo","last_synced_at":"2025-04-04T18:09:57.368Z","repository":{"id":3084685,"uuid":"48385549","full_name":"invertase/react-native-material-design-demo","owner":"invertase","description":"An Android app to demonstrate react-native-material-design","archived":false,"fork":false,"pushed_at":"2022-06-05T14:47:25.000Z","size":11175,"stargazers_count":494,"open_issues_count":4,"forks_count":194,"subscribers_count":22,"default_branch":"master","last_synced_at":"2025-03-30T22:51:36.605Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/invertase.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-21T17:41:19.000Z","updated_at":"2024-12-11T15:38:50.000Z","dependencies_parsed_at":"2022-08-26T13:30:31.767Z","dependency_job_id":null,"html_url":"https://github.com/invertase/react-native-material-design-demo","commit_stats":null,"previous_names":["react-native-material-design/demo-app"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/invertase%2Freact-native-material-design-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/invertase%2Freact-native-material-design-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/invertase%2Freact-native-material-design-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/invertase%2Freact-native-material-design-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/invertase","download_url":"https://codeload.github.com/invertase/react-native-material-design-demo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247226215,"owners_count":20904465,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-09T13:02:12.563Z","updated_at":"2025-04-04T18:09:57.337Z","avatar_url":"https://github.com/invertase.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# React Native Material Design Demo App [Android]\n\nThis repository contains a React Native project, implementing the [react-native-material-design](https://github.com/react-native-material-design/react-native-material-design) package.\n\nView it online [here](https://appetize.io/app/hyp1m20y515c16cj5yw2karcjg)! (Credits to Appetize for free hosting).\n\n\u003e Please submit all issues to [react-native-material-design](https://github.com/react-native-material-design/react-native-material-design/issues).\n\n## Installation\n\n### Development\n\n1. Clone this repo.\n2. Run `npm install`.\n3. Ensure a device, or emulated Android image is connected (`adb devices`).\n4. Run `react-native run-android`.\n\n\u003e If running on a device, run `adb reverse tcp:8081 tcp:8081`.\n\n### APK\n\nTo download the production/release APK, click [here](https://github.com/react-native-material-design/demo-app/raw/master/app-release.apk)\n\n## Can I use this as a base project?\n\nOf course. Please remember though it is not a \"fit all\" solution and you'll need to configure it for your own project needs.\n\nTo change the name of the project, edit `android/app/src/res/values/strings.xml`.\nTo change the launcher icon of the project, change all of the `ic_launcher.png` icons within `android/app/src/res/mipmap-XXXX/`.\n\n## How it works\n\nThis Android only demo app has been designed to be as minimal and basic as possible, to avoid confusion.\n\nKey points:\n- It's only working on Android for now.\n- [Alt](http://alt.js.org) is used as a light weight flux implementation to handle application state.\n- 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.\n- Some aspects are dependant on React's [context](https://facebook.github.io/react/docs/context.html).\n\nEach 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`,\nhere the app undergoes a few cycles of component mounting, wrapping the scenes within a [`Navigator`](https://facebook.github.io/react-native/docs/navigator.html), which is wrapped within a [DrawerLayoutAndroid](https://facebook.github.io/react-native/docs/drawerlayoutandroid.html#content).\n\nThe 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\nfound in `./src/utils/Navigate`, which allows for navigation around the app, and 'down' children components.\n\n### Navigate\n\nThe 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](https://github.com/react-native-material-design/demo-app/blob/master/index.android.js#L39).\n\nOnce 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.\n\nThe class also handles `hardwareBackPress` events correctly, only exiting the app if we're on a parent route. Otherwise, it calls the `back()` method.\n\n#### Routes\n\nThis is a simple object based pattern of components and their children, an example of which can be found [here](https://github.com/react-native-material-design/demo-app/blob/master/src/routes.js).\n\nTop 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.\n\n##### Basic Routes Config Example\n\n```javascript\nexport default {\n\n    parent: {\n        title: 'Parent Scene',\n        component: require('./scenes/SomeParentScene').default\n    }\n\n}\n```\n\nYou can have as many parent key objects as you like.\n\nIf you wish to define some children of this route, simply add a `children` object, with the same pattern as above. See below example.\n\n##### Advanced Routes Config Example\n\n```javascript\nexport default {\n\n    parent: {\n        title: 'Parent Scene',\n        initialRoute: true, // this route will be show on app start\n        component: require('./scenes/SomeParentScene').default,\n\n        children: {\n            child: {\n                title: 'Child Scene',\n                component: require('./scenes/SomeChildScene').default,\n            }\n        }\n    },\n    'Another Parent': { // can be called anything\n        // title: 'Another Parent', // title is optional, defaults to the parent object key name 'Another Parent'\n        component: require('./scenes/AnotherParentScene').default,\n\n        children: {\n            'Another Child': { // can be called anything\n                // title: 'Another Child', // title is optional, will default to the parent object key name 'Another Child'\n                component: require('./scenes/SomeOtherChildScene').default,\n            },\n            'Yet Another Child': { // can be called anything\n                component: require('./scenes/SomeOtherChildScene').default,\n            }\n        }\n    }\n\n}\n```\n\nYou can have as many children, and children of children as you like.\n\n#### API\n\n##### `static getInitialRoute([optional] defaultRoute, [optional] routesConfig)`\n\n - **defaultRoute**: Specify a parent route to return. By default however this will look for the first parent on your routes config with\n  `initialRoute: true`, else, if no initial route specified it'll just return the first parent route. \n - **routesConfig**: Specify the routes config. This is not required if you have a `routes.js` file setup in `/src`.\n\nCan be called without class instantiation, and is used to get an initial starting route to show initially. \n\nThis is handy for configuring initial routes, for example [here](https://github.com/react-native-material-design/demo-app/blob/master/index.android.js#L62).\n\n```javascript\nNavigate.getInitialRoute('parent');\n```\n\nOptionally you can pass in the routes yourself via `Navigate.getInitialRoute('parent', { ...some routes });`\n\n\u003e This can only be used with parent routes.\n\n##### `to(path, title, props)`\n\nUsed to directly access any route from any location.\n\n```javascript\nNavigate.to('root.child', 'Custom Title', { some: 'prop' });\n```\n\n`path`: \u003cstring\u003e Required path to a route.\n`title`: \u003cstring\u003e Optional title to use for the route. If left blank, the title/route name from the `routes.js` file will be used.\n`props`: \u003cobject\u003e Option object of props to pass to the next scene.\n\n##### `back(title, props)`\n\nUsed when going to the parent of the current route.\n\n```javascript\nNavigate.back('Custom Title', { some: 'prop' });\n```\n\n`title`: \u003cstring\u003e Optional title to use for the route. If left blank, the title/route name from the `routes.js` file will be used.\n`props`: \u003cobject\u003e Option object of props to pass to the parent scene.\n\n##### `forward(path, title, props)`\n\nUsed when going to a child of the current route.\n\n```javascript\n// Assuming the current route is \"root\":\nNavigate.forward('child', 'Custom Title', { some: 'prop' });\nNavigate.forward(null, 'Custom Title', { some: 'prop' });\n```\n\n`path`: \u003cstring\u003e Optional path to a child route. If no path is supplied, the first child of the parent defined in `routes.js` will be used.\n`title`: \u003cstring\u003e Optional name to use for the route. If left blank, the title/route name from the `routes.js` file will be used.\n`props`: \u003cobject\u003e Option object of props to pass to the next scene.\n\n##### `isChild`\n\nAn exposed boolean value on the class updated on route change if applicable.\n\nIf `true`, the current route is a child.\nIf `false`,  the current route has no parent.\n\n##### `currentRoute`\n\nAn exposed object which is updated on route change, containing the values of the current route.\n\n##### `navigator`\n\nThe initial reference to the `Navigator` API.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finvertase%2Freact-native-material-design-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finvertase%2Freact-native-material-design-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finvertase%2Freact-native-material-design-demo/lists"}