├── .npmignore ├── Example ├── .watchmanconfig ├── .gitattributes ├── index.ios.js ├── index.android.js ├── .babelrc ├── app.json ├── android │ ├── settings.gradle │ ├── 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 │ │ │ │ │ └── navigators │ │ │ │ │ ├── MainActivity.java │ │ │ │ │ └── MainApplication.java │ │ │ │ └── AndroidManifest.xml │ │ ├── BUCK │ │ ├── proguard-rules.pro │ │ └── build.gradle │ ├── keystores │ │ ├── debug.keystore.properties │ │ └── BUCK │ ├── build.gradle │ ├── gradle.properties │ ├── gradlew.bat │ └── gradlew ├── .buckconfig ├── screens │ ├── Home │ │ ├── Recent.js │ │ ├── Starred.js │ │ ├── Notification.js │ │ └── Desktop.js │ ├── Settings.js │ ├── Document.js │ ├── Root.js │ ├── Home.js │ └── Move.js ├── __tests__ │ ├── index.ios.js │ └── index.android.js ├── main.js ├── ios │ ├── navigators │ │ ├── AppDelegate.h │ │ ├── main.m │ │ ├── Images.xcassets │ │ │ └── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ ├── AppDelegate.m │ │ ├── Info.plist │ │ └── Base.lproj │ │ │ └── LaunchScreen.xib │ ├── navigatorsTests │ │ ├── Info.plist │ │ └── navigatorsTests.m │ ├── navigators-tvOSTests │ │ └── Info.plist │ ├── navigators-tvOS │ │ └── Info.plist │ └── navigators.xcodeproj │ │ ├── xcshareddata │ │ └── xcschemes │ │ │ ├── navigators.xcscheme │ │ │ └── navigators-tvOS.xcscheme │ │ └── project.pbxproj ├── package.json ├── .gitignore ├── components │ └── Folder.js └── .flowconfig ├── .eslintignore ├── src ├── react-navigation.web.js ├── NavigationActions.js ├── createNavigationContainer.js ├── views │ ├── Header │ │ └── Header.js │ ├── CardStack │ │ ├── Transitioner.js │ │ ├── CardStackTransitioner.js │ │ └── CardStack.js │ └── ScenesReducer.js ├── routers │ ├── TabRouter.js │ ├── createConfigGetter.js │ └── StackRouter.js ├── navigators │ ├── TabNavigator.js │ └── StackNavigator.js └── react-navigation.js ├── .editorconfig ├── .gitattributes ├── .gitignore ├── package.json ├── LICENSE ├── README.md └── .eslintrc /.npmignore: -------------------------------------------------------------------------------- 1 | Example/ 2 | -------------------------------------------------------------------------------- /Example/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /Example/.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | -------------------------------------------------------------------------------- /Example/index.ios.js: -------------------------------------------------------------------------------- 1 | import './main'; 2 | -------------------------------------------------------------------------------- /Example/index.android.js: -------------------------------------------------------------------------------- 1 | import './main'; 2 | -------------------------------------------------------------------------------- /Example/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["react-native"] 3 | } 4 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | **/node_modules/ 2 | android/ 3 | Example/android/ 4 | -------------------------------------------------------------------------------- /src/react-navigation.web.js: -------------------------------------------------------------------------------- 1 | module.exports = require('react-navigation'); 2 | -------------------------------------------------------------------------------- /Example/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "navigators", 3 | "displayName": "navigators" 4 | } -------------------------------------------------------------------------------- /Example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'navigators' 2 | 3 | include ':app' 4 | -------------------------------------------------------------------------------- /Example/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | navigators 3 | 4 | -------------------------------------------------------------------------------- /Example/.buckconfig: -------------------------------------------------------------------------------- 1 | 2 | [android] 3 | target = Google Inc.:Google APIs:23 4 | 5 | [maven_repositories] 6 | central = https://repo1.maven.org/maven2 7 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shimohq/shimo-navigation/HEAD/Example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shimohq/shimo-navigation/HEAD/Example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shimohq/shimo-navigation/HEAD/Example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shimohq/shimo-navigation/HEAD/Example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Example/android/keystores/BUCK: -------------------------------------------------------------------------------- 1 | keystore( 2 | name = "debug", 3 | properties = "debug.keystore.properties", 4 | store = "debug.keystore", 5 | visibility = [ 6 | "PUBLIC", 7 | ], 8 | ) 9 | -------------------------------------------------------------------------------- /Example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: http://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | # Unix-style newlines with a newline ending every file 7 | [*] 8 | charset = utf-8 9 | end_of_line = lf 10 | indent_style = space 11 | indent_size = 4 12 | trim_trailing_whitespace = true 13 | insert_final_newline = true 14 | -------------------------------------------------------------------------------- /Example/screens/Home/Recent.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { View, Text, StyleSheet } from 'react-native'; 3 | 4 | export default class extends Component { 5 | render() { 6 | return ( 7 | 8 | Recent 9 | 10 | ); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Example/screens/Home/Starred.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { View, Text, StyleSheet } from 'react-native'; 3 | 4 | export default class extends Component { 5 | render() { 6 | return ( 7 | 8 | Starred 9 | 10 | ); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Example/screens/Settings.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { View, Text, StyleSheet } from 'react-native'; 3 | 4 | export default class extends Component { 5 | render() { 6 | return ( 7 | 8 | Settings 9 | 10 | ); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Example/__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 | -------------------------------------------------------------------------------- /Example/screens/Home/Notification.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { View, Text, StyleSheet } from 'react-native'; 3 | 4 | export default class extends Component { 5 | render() { 6 | return ( 7 | 8 | Notification 9 | 10 | ); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Example/__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 | -------------------------------------------------------------------------------- /Example/main.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { AppRegistry } from 'react-native'; 3 | import Root from './screens/Root'; 4 | 5 | 6 | class App extends Component { 7 | render() { 8 | return ( 9 | 12 | ); 13 | } 14 | } 15 | 16 | AppRegistry.registerComponent('navigators', () => App); 17 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /Example/screens/Document.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { View, Text, StyleSheet } from 'react-native'; 3 | 4 | export default class extends Component { 5 | static navigationOptions = { 6 | mode: 'card', 7 | gesturesEnabled: false 8 | }; 9 | 10 | render() { 11 | 12 | return ( 13 | 14 | Document 15 | 16 | ); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Example/android/app/src/main/java/com/navigators/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.navigators; 2 | 3 | import com.facebook.react.ReactActivity; 4 | 5 | public class MainActivity extends ReactActivity { 6 | 7 | /** 8 | * Returns the name of the main component registered from JavaScript. 9 | * This is used to schedule rendering of the component. 10 | */ 11 | @Override 12 | protected String getMainComponentName() { 13 | return "navigators"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/NavigationActions.js: -------------------------------------------------------------------------------- 1 | const NavigationActions = require('react-navigation').NavigationActions; 2 | 3 | 4 | const REMOVE = 'Navigation/REMOVE'; 5 | const REPLACE = 'Navigation/REPLACE'; 6 | 7 | const createAction = (type) => (payload) => ({ 8 | type, 9 | ...payload, 10 | }); 11 | 12 | const remove = createAction(REMOVE); 13 | const replace = createAction(REPLACE); 14 | 15 | export default { 16 | ...NavigationActions, 17 | REMOVE, 18 | remove, 19 | REPLACE, 20 | replace 21 | } 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | *.pbxuser 8 | !default.pbxuser 9 | *.mode1v3 10 | !default.mode1v3 11 | *.mode2v3 12 | !default.mode2v3 13 | *.perspectivev3 14 | !default.perspectivev3 15 | xcuserdata 16 | *.xccheckout 17 | *.moved-aside 18 | DerivedData 19 | *.hmap 20 | *.ipa 21 | gradle 22 | project.xcworkspace 23 | 24 | # Android/IJ 25 | # 26 | .idea 27 | .gradle 28 | local.properties 29 | build 30 | 31 | # node.js 32 | # 33 | node_modules 34 | npm-debug.log 35 | 36 | 37 | # webstorm 38 | # 39 | *.iml 40 | -------------------------------------------------------------------------------- /Example/ios/navigators/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 | -------------------------------------------------------------------------------- /Example/screens/Root.js: -------------------------------------------------------------------------------- 1 | import { StackNavigator } from 'shimo-navigation'; 2 | 3 | export default StackNavigator({ 4 | '/': { 5 | getScreen: () => require('./Home').default 6 | }, 7 | '/move': { 8 | getScreen: () => require('./Move').default 9 | }, 10 | '/document': { 11 | getScreen: () => require('./Document').default, 12 | path: 'document/:guid' 13 | }, 14 | '/settings': { 15 | getScreen: () => require('./Settings').default 16 | } 17 | }, { 18 | headerMode: 'screen', 19 | initialRouteName: '/', 20 | mode: 'modal' 21 | }); -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "shimo-navigation", 3 | "version": "0.0.45", 4 | "main": "./src/react-navigation", 5 | "description": "石墨文档 React Native App 导航系统(based on react-navigation)", 6 | "repository": { 7 | "type": "git", 8 | "url": "https://github.com/shimohq/shimo-navigation" 9 | }, 10 | "license": "MIT", 11 | "dependencies": { 12 | "react-navigation": "1.0.0-beta.13" 13 | }, 14 | "keywords": [ 15 | "react-component", 16 | "react-native", 17 | "react-navigation" 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /Example/ios/navigators/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 | -------------------------------------------------------------------------------- /Example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "navigators", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "start": "node node_modules/react-native/local-cli/cli.js start", 7 | "test": "jest" 8 | }, 9 | "dependencies": { 10 | "react": "16.0.0-alpha.12", 11 | "react-native": "0.46.1", 12 | "shimo-navigation": "../" 13 | }, 14 | "devDependencies": { 15 | "babel-jest": "20.0.3", 16 | "babel-preset-react-native": "2.1.0", 17 | "jest": "20.0.4", 18 | "react-test-renderer": "16.0.0-alpha.12" 19 | }, 20 | "jest": { 21 | "preset": "react-native" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Example/screens/Home.js: -------------------------------------------------------------------------------- 1 | import { TabNavigator } from 'shimo-navigation'; 2 | 3 | export default TabNavigator({ 4 | notification: { 5 | getScreen: () => require('./Home/Notification').default 6 | }, 7 | desktop: { 8 | screen: require('./Home/Desktop').default 9 | }, 10 | recent: { 11 | getScreen: () => require('./Home/Recent').default 12 | }, 13 | starred: { 14 | getScreen: () => require('./Home/Starred').default 15 | } 16 | }, { 17 | lazy: true, 18 | order: ['notification', 'desktop', 'recent', 'starred'], 19 | initialRouteName: 'desktop', 20 | tabBarOptions: { 21 | getScreen: '#e91e63' 22 | }, 23 | }); 24 | -------------------------------------------------------------------------------- /Example/screens/Home/Desktop.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { View, Text, StyleSheet } from 'react-native'; 3 | import { StackNavigator } from 'shimo-navigation'; 4 | 5 | const Desktop = StackNavigator({ 6 | '/desktop/index': { 7 | getScreen: () => require('../../components/Folder').default 8 | }, 9 | '/desktop/folder': { 10 | getScreen: () => require('../../components/Folder').default 11 | } 12 | }, { 13 | initialRouteName: '/desktop/index', 14 | initialRouteParams: { 15 | guid: -1 16 | }, 17 | mode: 'card' 18 | }); 19 | 20 | Desktop.navigationOptions = { 21 | header: null 22 | }; 23 | 24 | export default Desktop; -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/ios/navigators/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 | } -------------------------------------------------------------------------------- /Example/ios/navigatorsTests/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 | -------------------------------------------------------------------------------- /src/createNavigationContainer.js: -------------------------------------------------------------------------------- 1 | import { createNavigationContainer } from 'react-navigation'; 2 | 3 | export default function(Component) { 4 | const NavigationContainer = createNavigationContainer(Component); 5 | 6 | return class extends NavigationContainer { 7 | _nav = null; 8 | 9 | // dispatch synchronously 10 | dispatch = (action) => { 11 | if (!this._isStateful()) { 12 | return false; 13 | } 14 | 15 | if (!this._nav) { 16 | this._nav = this.state.nav; 17 | } 18 | 19 | const nav = Component.router.getStateForAction(action, this._nav); 20 | 21 | if (nav && nav !== this._nav) { 22 | this.setState({ nav }, () => 23 | this._onNavigationStateChange(this._nav, nav, action) 24 | ); 25 | this._nav = nav; 26 | return true; 27 | } 28 | return false; 29 | }; 30 | }; 31 | } 32 | -------------------------------------------------------------------------------- /Example/ios/navigators-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 | -------------------------------------------------------------------------------- /src/views/Header/Header.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Header from 'react-navigation/src/views/Header/Header'; 3 | 4 | import { Platform } from 'react-native'; 5 | import HeaderStyleInterpolator from 'react-navigation/src/views/Header/HeaderStyleInterpolator'; 6 | 7 | export default class extends Header { 8 | _renderTitle(props, options) { 9 | const style = {}; 10 | const details = this.props.getScreenDetails(props.scene); 11 | const { titleCenter } = details.options; 12 | 13 | if (Platform.OS === 'android' && !titleCenter) { 14 | if (!options.hasLeftComponent) { 15 | style.left = 0; 16 | } 17 | if (!options.hasRightComponent) { 18 | style.right = 0; 19 | } 20 | } 21 | 22 | return this._renderSubView( 23 | { ...props, style }, 24 | 'title', 25 | this._renderTitleComponent, 26 | HeaderStyleInterpolator.forCenter 27 | ); 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/.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 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015 shimo 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | -------------------------------------------------------------------------------- /src/routers/TabRouter.js: -------------------------------------------------------------------------------- 1 | import { TabRouter } from 'react-navigation'; 2 | import createConfigGetter from './createConfigGetter'; 3 | 4 | export default (routeConfigs, stackConfig) => { 5 | const router = TabRouter(routeConfigs, stackConfig); 6 | 7 | router.getScreenOptions = createConfigGetter( 8 | routeConfigs, 9 | stackConfig.navigationOptions 10 | ); 11 | 12 | getStateForAction = router.getStateForAction; 13 | 14 | router.getStateForAction = function (action, inputState) { 15 | const state = getStateForAction(action, inputState); 16 | if (!inputState) { 17 | const routes = state.routes.map((route) => { 18 | const { routeName } = route; 19 | const getDefaultParams = routeConfigs[routeName].getDefaultParams; 20 | 21 | return { 22 | ...route, 23 | params: getDefaultParams ? { 24 | ...getDefaultParams(), 25 | ...route.params 26 | } : route.params 27 | } 28 | }); 29 | return { 30 | ...state, 31 | routes 32 | } 33 | } else { 34 | return state; 35 | } 36 | 37 | } 38 | 39 | return router; 40 | } 41 | -------------------------------------------------------------------------------- /Example/android/app/src/main/java/com/navigators/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.navigators; 2 | 3 | import android.app.Application; 4 | 5 | import com.facebook.react.ReactApplication; 6 | import com.facebook.react.ReactNativeHost; 7 | import com.facebook.react.ReactPackage; 8 | import com.facebook.react.shell.MainReactPackage; 9 | import com.facebook.soloader.SoLoader; 10 | 11 | import java.util.Arrays; 12 | import java.util.List; 13 | 14 | public class MainApplication extends Application implements ReactApplication { 15 | 16 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { 17 | @Override 18 | public boolean getUseDeveloperSupport() { 19 | return BuildConfig.DEBUG; 20 | } 21 | 22 | @Override 23 | protected List getPackages() { 24 | return Arrays.asList( 25 | new MainReactPackage() 26 | ); 27 | } 28 | }; 29 | 30 | @Override 31 | public ReactNativeHost getReactNativeHost() { 32 | return mReactNativeHost; 33 | } 34 | 35 | @Override 36 | public void onCreate() { 37 | super.onCreate(); 38 | SoLoader.init(this, /* native exopackage */ false); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 12 | 13 | 19 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Example/components/Folder.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { View, Text, StyleSheet, Button } from 'react-native'; 3 | 4 | const styles = StyleSheet.create({ 5 | container: { 6 | flex: 1, 7 | alignItems: 'center', 8 | justifyContent: 'center' 9 | } 10 | }); 11 | 12 | export default class extends Component { 13 | static navigationOptions = ({ navigation: { state }, screenProps }) => { 14 | return { 15 | title: state.routeName === '/desktop/index' ? 'desktop' : `GUID: ${state.params.guid}` 16 | }; 17 | }; 18 | 19 | static screenKey = (routeName, params) => `${routeName}/${params.guid}`; 20 | 21 | render() { 22 | const { navigation } = this.props; 23 | const { guid } = navigation.state.params; 24 | 25 | return ( 26 | 27 |