├── .watchmanconfig ├── .gitattributes ├── index.ios.js ├── index.android.js ├── .babelrc ├── src ├── global │ ├── TabBar │ │ ├── index.js │ │ └── Main │ │ │ ├── index.ios.js │ │ │ └── index.android.js │ ├── NavBar │ │ ├── index.js │ │ └── Default │ │ │ ├── index.android.js │ │ │ └── index.ios.js │ ├── NavButtons │ │ ├── index.js │ │ ├── WithSideMenu │ │ │ └── index.js │ │ └── Login │ │ │ └── index.js │ └── Constants │ │ ├── Colors.js │ │ ├── Images.js │ │ ├── index.js │ │ ├── Screens.js │ │ └── Global.js ├── stores │ ├── models │ │ ├── index.js │ │ └── Account.js │ ├── Counter.js │ ├── App.js │ ├── index.js │ └── Account.js ├── app.js ├── utils │ └── MobxRnnProvider.js └── screens │ ├── index.js │ ├── components │ └── Counter.js │ ├── PushedScreen │ └── index.js │ ├── Drawer │ └── index.js │ ├── SecondTab │ └── index.js │ ├── FirstTab │ └── index.js │ └── LoginScreen │ └── index.js ├── img ├── one@2x.ios.png ├── one@4x.android.png ├── navicon_menu@2x.png └── one_selected@2x.png ├── app.json ├── .buckconfig ├── android ├── app │ ├── src │ │ └── main │ │ │ ├── res │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ └── styles.xml │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ └── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── java │ │ │ └── com │ │ │ │ └── reactnativenavigationmobxboilerplate │ │ │ │ ├── MainActivity.java │ │ │ │ └── MainApplication.java │ │ │ └── AndroidManifest.xml │ ├── BUCK │ ├── proguard-rules.pro │ └── build.gradle ├── keystores │ ├── debug.keystore.properties │ └── BUCK ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── settings.gradle ├── build.gradle ├── gradle.properties ├── gradlew.bat └── gradlew ├── __tests__ ├── index.ios.js └── index.android.js ├── ios ├── ReactNativeNavigationMobxBoilerplate │ ├── AppDelegate.h │ ├── main.m │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ ├── AppDelegate.m │ └── Base.lproj │ │ └── LaunchScreen.xib ├── ReactNativeNavigationMobxBoilerplateTests │ ├── Info.plist │ └── ReactNativeNavigationMobxBoilerplateTests.m ├── ReactNativeNavigationMobxBoilerplate-tvOSTests │ └── Info.plist ├── ReactNativeNavigationMobxBoilerplate-tvOS │ └── Info.plist └── ReactNativeNavigationMobxBoilerplate.xcodeproj │ ├── xcshareddata │ └── xcschemes │ │ ├── ReactNativeNavigationMobxBoilerplate.xcscheme │ │ └── ReactNativeNavigationMobxBoilerplate-tvOS.xcscheme │ └── project.pbxproj ├── package.json ├── .gitignore ├── .flowconfig └── README.md /.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | -------------------------------------------------------------------------------- /index.ios.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | import App from './src/app'; 4 | -------------------------------------------------------------------------------- /index.android.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | import App from './src/app'; 4 | -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["react-native", "react-native-stage-0/decorator-support"], 3 | } 4 | -------------------------------------------------------------------------------- /src/global/TabBar/index.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | import Main from './Main'; 4 | 5 | export default { 6 | Main, 7 | } 8 | -------------------------------------------------------------------------------- /img/one@2x.ios.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/starters-dev/react-native-navigation-mobx-boilerplate/HEAD/img/one@2x.ios.png -------------------------------------------------------------------------------- /src/global/NavBar/index.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | import Default from './Default'; 4 | 5 | export default { 6 | Default, 7 | } 8 | -------------------------------------------------------------------------------- /src/stores/models/index.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | import Account from './Account'; 4 | 5 | export default { 6 | Account, 7 | } 8 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ReactNativeNavigationMobxBoilerplate", 3 | "displayName": "ReactNativeNavigationMobxBoilerplate" 4 | } -------------------------------------------------------------------------------- /img/one@4x.android.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/starters-dev/react-native-navigation-mobx-boilerplate/HEAD/img/one@4x.android.png -------------------------------------------------------------------------------- /img/navicon_menu@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/starters-dev/react-native-navigation-mobx-boilerplate/HEAD/img/navicon_menu@2x.png -------------------------------------------------------------------------------- /img/one_selected@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/starters-dev/react-native-navigation-mobx-boilerplate/HEAD/img/one_selected@2x.png -------------------------------------------------------------------------------- /.buckconfig: -------------------------------------------------------------------------------- 1 | 2 | [android] 3 | target = Google Inc.:Google APIs:23 4 | 5 | [maven_repositories] 6 | central = https://repo1.maven.org/maven2 7 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | React Native Navigation Mobx Boilerplate 3 | 4 | -------------------------------------------------------------------------------- /android/keystores/debug.keystore.properties: -------------------------------------------------------------------------------- 1 | key.store=debug.keystore 2 | key.alias=androiddebugkey 3 | key.store.password=android 4 | key.alias.password=android 5 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/starters-dev/react-native-navigation-mobx-boilerplate/HEAD/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/starters-dev/react-native-navigation-mobx-boilerplate/HEAD/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/starters-dev/react-native-navigation-mobx-boilerplate/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/starters-dev/react-native-navigation-mobx-boilerplate/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/starters-dev/react-native-navigation-mobx-boilerplate/HEAD/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/keystores/BUCK: -------------------------------------------------------------------------------- 1 | keystore( 2 | name = "debug", 3 | properties = "debug.keystore.properties", 4 | store = "debug.keystore", 5 | visibility = [ 6 | "PUBLIC", 7 | ], 8 | ) 9 | -------------------------------------------------------------------------------- /src/global/NavButtons/index.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | import Login from './Login'; 4 | import WithSideMenu from './WithSideMenu'; 5 | 6 | export default { 7 | WithSideMenu, 8 | Login, 9 | } 10 | -------------------------------------------------------------------------------- /src/global/Constants/Colors.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | const tintColor = '#007aff'; 4 | 5 | export default { 6 | tintColor, 7 | backgroundColor : '#ffffff', 8 | blackColor : '#222222', 9 | statusBarColor : 'light', 10 | } 11 | -------------------------------------------------------------------------------- /src/global/TabBar/Main/index.ios.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | import Constants from '../../Constants'; 4 | 5 | export default { 6 | tabBarButtonColor : '#007aff', 7 | tabBarBackgroundColor : '#ffffff', 8 | tabBarTranslucent : false, 9 | } 10 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/global/Constants/Images.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | export default { 4 | TAB_1 : require('../../../img/one.png'), 5 | TAB_1_selected : require('../../../img/one_selected.png'), 6 | 7 | SIDE_MENU : require('../../../img/navicon_menu.png'), 8 | } 9 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip 6 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'ReactNativeNavigationMobxBoilerplate' 2 | 3 | include ':app' 4 | 5 | include ':react-native-navigation' 6 | project(':react-native-navigation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-navigation/android/app/') 7 | -------------------------------------------------------------------------------- /src/global/Constants/index.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | import Screens from './Screens'; 4 | import Images from './Images'; 5 | import Colors from './Colors'; 6 | import Global from './Global'; 7 | 8 | export default { 9 | Screens, 10 | Images, 11 | Colors, 12 | Global, 13 | } 14 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/reactnativenavigationmobxboilerplate/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.reactnativenavigationmobxboilerplate; 2 | 3 | // import com.facebook.react.ReactActivity; 4 | import com.reactnativenavigation.controllers.SplashActivity; 5 | 6 | public class MainActivity extends SplashActivity { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /src/app.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | import Provider from './utils/MobxRnnProvider'; 4 | import Stores from './stores'; 5 | import Constants from './global/Constants'; 6 | 7 | import { registerScreens } from './screens'; 8 | registerScreens(Stores, Provider); 9 | 10 | Constants.Global.startTabBasedApp() 11 | -------------------------------------------------------------------------------- /src/stores/Counter.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | import { observable, action } from 'mobx'; 4 | 5 | class Store { 6 | @observable count = 0; 7 | 8 | @action onPlus() { 9 | this.count += 1; 10 | } 11 | 12 | @action onMinus() { 13 | this.count -= 1; 14 | } 15 | 16 | } 17 | 18 | export default new Store(); 19 | -------------------------------------------------------------------------------- /src/global/NavButtons/WithSideMenu/index.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | import Constants from '../../Constants'; 4 | import Stores from '../../../stores'; 5 | 6 | export default { 7 | leftButtons: Stores.App.isAndroid ? [{ id:'sideMenu' }] : [{ 8 | id : 'menu', 9 | icon : Constants.Images.SIDE_MENU, 10 | }], 11 | } 12 | -------------------------------------------------------------------------------- /__tests__/index.ios.js: -------------------------------------------------------------------------------- 1 | import 'react-native'; 2 | import React from 'react'; 3 | import Index from '../index.ios.js'; 4 | 5 | // Note: test renderer must be required after react-native. 6 | import renderer from 'react-test-renderer'; 7 | 8 | it('renders correctly', () => { 9 | const tree = renderer.create( 10 | 11 | ); 12 | }); 13 | -------------------------------------------------------------------------------- /src/global/TabBar/Main/index.android.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | import Constants from '../../Constants'; 4 | 5 | export default { 6 | tabBarButtonColor : '#007aff', 7 | tabBarSelectedButtonColor : '#007aff', 8 | tabBarBackgroundColor : '#ffffff', 9 | tabBarTranslucent : false, 10 | forceTitlesDisplay : true, 11 | } 12 | -------------------------------------------------------------------------------- /__tests__/index.android.js: -------------------------------------------------------------------------------- 1 | import 'react-native'; 2 | import React from 'react'; 3 | import Index from '../index.android.js'; 4 | 5 | // Note: test renderer must be required after react-native. 6 | import renderer from 'react-test-renderer'; 7 | 8 | it('renders correctly', () => { 9 | const tree = renderer.create( 10 | 11 | ); 12 | }); 13 | -------------------------------------------------------------------------------- /src/stores/models/Account.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | import { observable, computed } from 'mobx'; 4 | import { persist } from 'mobx-persist'; 5 | 6 | class Account { 7 | @persist @observable username = 'username' 8 | @persist @observable password = 'password' // of course, you should not store password as a plain text :) 9 | } 10 | 11 | export default Account; 12 | -------------------------------------------------------------------------------- /src/stores/App.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | import { Platform } from 'react-native'; 4 | import { observable, action } from 'mobx'; 5 | 6 | class Store { 7 | @observable rootNavigator = null; // so we can nagigate from DRAWER 8 | 9 | @observable isAndroid = Platform.OS === 'android'; 10 | @observable isIOS = Platform.OS === 'ios'; 11 | } 12 | 13 | export default new Store(); 14 | -------------------------------------------------------------------------------- /src/global/NavButtons/Login/index.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | import Constants from '../../Constants'; 4 | import Stores from '../../../stores'; 5 | 6 | export default { 7 | leftButtons: Stores.App.isAndroid ? [{ id:'cancel' }] : [{ 8 | id : 'cancel', 9 | title : 'Cancel', 10 | }], 11 | 12 | // rightButtons: [{ 13 | // id : '...', 14 | // title : '...', 15 | // }], 16 | } 17 | -------------------------------------------------------------------------------- /src/stores/index.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | import { create } from 'mobx-persist'; 4 | import { AsyncStorage } from 'react-native'; 5 | 6 | import App from './App'; 7 | import Account from './Account'; 8 | import Counter from './Counter'; 9 | 10 | const hydrate = create({ storage: AsyncStorage }); 11 | 12 | const stores = { 13 | App, 14 | Account, 15 | Counter, 16 | } 17 | 18 | // you can hydrate stores here with mobx-persist 19 | hydrate('Account', stores.Account); 20 | 21 | export default { 22 | ...stores 23 | }; 24 | -------------------------------------------------------------------------------- /ios/ReactNativeNavigationMobxBoilerplate/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | @interface AppDelegate : UIResponder 13 | 14 | @property (nonatomic, strong) UIWindow *window; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /src/global/NavBar/Default/index.android.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | import Constants from '../../Constants'; 4 | 5 | // [more info] - https://wix.github.io/react-native-navigation/#/styling-the-navigator 6 | export default { 7 | navBarTextColor : Constants.Colors.mainColor, 8 | statusBarColor : Constants.Colors.tintColor, 9 | navBarButtonColor : Constants.Colors.tintColor, 10 | navBarBackgroundColor : Constants.Colors.backgroundColor, 11 | screenBackgroundColor : Constants.Colors.backgroundColor, 12 | statusBarColor : Constants.Colors.tintColor, 13 | } 14 | -------------------------------------------------------------------------------- /ios/ReactNativeNavigationMobxBoilerplate/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import "AppDelegate.h" 13 | 14 | int main(int argc, char * argv[]) { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/global/NavBar/Default/index.ios.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | import Constants from '../../Constants'; 4 | 5 | // [more info] - https://wix.github.io/react-native-navigation/#/styling-the-navigator 6 | export default { 7 | navBarTextColor : Constants.Colors.blackColor, 8 | navBarBackgroundColor : Constants.Colors.backgroundColor, 9 | navBarButtonColor : Constants.Colors.tintColor, 10 | screenBackgroundColor : Constants.Colors.backgroundColor, 11 | 12 | // statusBarTextColorScheme : Constants.Colors.statusBarColor, // make sure that in Xcode > project > Info.plist, the property View controller-based status bar appearance is set to YES 13 | } 14 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:2.2.3' 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | mavenLocal() 18 | jcenter() 19 | maven { 20 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 21 | url "$rootDir/../node_modules/react-native/android" 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ios/ReactNativeNavigationMobxBoilerplate/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /src/global/Constants/Screens.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | import Images from './Images'; 4 | 5 | export default { 6 | LOGIN_SCREEN: { 7 | screen : 'app.LoginScreen', 8 | title : 'Login', 9 | }, 10 | PUSHED_SCREEN: { 11 | screen : 'app.PushedScreen', 12 | title : 'Pushed Screen', 13 | }, 14 | DRAWER: { 15 | screen : 'app.DrawerScreen', 16 | }, 17 | 18 | FIRST_TAB: { 19 | screen : 'app.FirstTabScreen', 20 | title : 'First Tab', 21 | label : 'First Tab', 22 | icon : Images.TAB_1, 23 | selectedIcon : Images.TAB_1_selected, 24 | }, 25 | SECOND_TAB: { 26 | screen : 'app.SecondTabScreen', 27 | title : 'Second Tab', 28 | label : 'Second Tab', 29 | icon : Images.TAB_1, 30 | selectedIcon : Images.TAB_1_selected, 31 | }, 32 | } 33 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ReactNativeNavigationMobxBoilerplate", 3 | "version": "0.0.2", 4 | "private": true, 5 | "scripts": { 6 | "start": "node node_modules/react-native/local-cli/cli.js start", 7 | "test": "jest" 8 | }, 9 | "dependencies": { 10 | "babel-preset-react-native-stage-0": "^1.0.1", 11 | "mobx": "3.1.15", 12 | "mobx-persist": "^0.3.3", 13 | "mobx-react": "4.2.1", 14 | "react": "16.0.0-alpha.12", 15 | "react-native": "0.46.1", 16 | "react-native-navigation": "1.1.134" 17 | }, 18 | "devDependencies": { 19 | "babel-jest": "19.0.0", 20 | "flow-bin": "^0.47.0", 21 | "jest": "19.0.2", 22 | "react-test-renderer": "16.0.0-alpha.6" 23 | }, 24 | "jest": { 25 | "preset": "react-native" 26 | }, 27 | "description": "React Native (RNN+MobX) boilerplate", 28 | "author": "Batyr Kanzitdinov " 29 | } 30 | -------------------------------------------------------------------------------- /ios/ReactNativeNavigationMobxBoilerplateTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /ios/ReactNativeNavigationMobxBoilerplate-tvOSTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | android.useDeprecatedNdk=true 21 | -------------------------------------------------------------------------------- /src/stores/Account.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | import { observable, action } from 'mobx'; 4 | import { persist } from 'mobx-persist'; 5 | 6 | import Models from './models'; 7 | 8 | class Store { 9 | @persist('object', Models.Account) @observable current = new Models.Account 10 | @persist @observable authorized = false; 11 | 12 | @action login = (username: string, password: string) => { 13 | return new Promise((resolve, reject) => { 14 | if (username && password) { 15 | this.authorized = true; 16 | this.current = { username, password }; 17 | resolve({ message: 'success' }); 18 | } else { 19 | reject({ message: 'Something is wrong with input data :(' }); 20 | } 21 | }); 22 | } 23 | 24 | @action logout = () => { 25 | return new Promise((resolve, reject) => { 26 | this.authorized = false; 27 | this.current = {}; 28 | 29 | resolve(); 30 | }); 31 | } 32 | } 33 | 34 | export default new Store(); 35 | -------------------------------------------------------------------------------- /src/utils/MobxRnnProvider.js: -------------------------------------------------------------------------------- 1 | // Thanks to github/@megahertz - https://gist.github.com/megahertz/3aad3adafa0f7d212b81f5e371863637 2 | 3 | import { Provider } from 'mobx-react/native'; 4 | 5 | const SPECIAL_REACT_KEYS = { children: true, key: true, ref: true }; 6 | 7 | export default class MobxRnnProvider extends Provider { 8 | props: { 9 | store: Object 10 | }; 11 | 12 | context: { 13 | mobxStores: Object 14 | }; 15 | 16 | getChildContext() { 17 | const stores = {}; 18 | 19 | // inherit stores 20 | const baseStores = this.context.mobxStores; 21 | if (baseStores) { 22 | for (let key in baseStores) { 23 | stores[key] = baseStores[key]; 24 | } 25 | } 26 | 27 | // add own stores 28 | for (let key in this.props.store) { 29 | if (!SPECIAL_REACT_KEYS[key]) { 30 | stores[key] = this.props.store[key]; 31 | } 32 | } 33 | 34 | return { 35 | mobxStores: stores 36 | }; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/screens/index.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | import { Navigation } from 'react-native-navigation'; 4 | 5 | import Constants from '../global/Constants'; 6 | 7 | import FirstTab from './FirstTab'; 8 | import SecondTab from './SecondTab'; 9 | import Drawer from './Drawer'; 10 | import PushedScreen from './PushedScreen'; 11 | import LoginScreen from './LoginScreen'; 12 | 13 | export function registerScreens(store: {}, Provider: {}) { 14 | Navigation.registerComponent(Constants.Screens.FIRST_TAB.screen, () => FirstTab, store, Provider); 15 | Navigation.registerComponent(Constants.Screens.SECOND_TAB.screen, () => SecondTab, store, Provider); 16 | 17 | Navigation.registerComponent(Constants.Screens.DRAWER.screen, () => Drawer, store, Provider); 18 | Navigation.registerComponent(Constants.Screens.PUSHED_SCREEN.screen, () => PushedScreen, store, Provider); 19 | Navigation.registerComponent(Constants.Screens.LOGIN_SCREEN.screen, () => LoginScreen, store, Provider); 20 | } 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | project.xcworkspace 24 | 25 | # Android/IntelliJ 26 | # 27 | build/ 28 | .idea 29 | .gradle 30 | local.properties 31 | *.iml 32 | 33 | # node.js 34 | # 35 | node_modules/ 36 | npm-debug.log 37 | yarn-error.log 38 | 39 | # BUCK 40 | buck-out/ 41 | \.buckd/ 42 | *.keystore 43 | 44 | # fastlane 45 | # 46 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 47 | # screenshots whenever they are needed. 48 | # For more information about the recommended setup visit: 49 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 50 | 51 | fastlane/report.xml 52 | fastlane/Preview.html 53 | fastlane/screenshots 54 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/reactnativenavigationmobxboilerplate/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.reactnativenavigationmobxboilerplate; 2 | 3 | import android.app.Application; 4 | import android.support.annotation.Nullable; 5 | 6 | import com.facebook.react.ReactApplication; 7 | import com.facebook.react.ReactNativeHost; 8 | import com.facebook.react.ReactPackage; 9 | import com.facebook.react.shell.MainReactPackage; 10 | import com.facebook.soloader.SoLoader; 11 | 12 | import java.util.Arrays; 13 | import java.util.List; 14 | 15 | import com.reactnativenavigation.NavigationApplication; 16 | 17 | public class MainApplication extends NavigationApplication { 18 | 19 | @Override 20 | public boolean isDebug() { 21 | return BuildConfig.DEBUG; 22 | } 23 | 24 | @Nullable 25 | @Override 26 | public List createAdditionalReactPackages() { 27 | return null; 28 | } 29 | 30 | @Override 31 | public void onCreate() { 32 | super.onCreate(); 33 | SoLoader.init(this, /* native exopackage */ false); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/screens/components/Counter.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | import React, { Component } from 'react'; 4 | import { 5 | AppRegistry, 6 | StyleSheet, 7 | Text, 8 | View, 9 | Button, 10 | } from 'react-native'; 11 | 12 | export default class Counter extends Component { 13 | render() { 14 | const { count, onPlus, onMinus } = this.props; 15 | 16 | return ( 17 | 18 |