├── .watchmanconfig
├── .gitattributes
├── .babelrc
├── reduxNavigation
├── Constants
│ ├── index.js
│ └── actionType.js
├── Actions
│ ├── Chat
│ │ └── index.js
│ ├── People
│ │ └── index.js
│ ├── Setting
│ │ └── index.js
│ ├── Home
│ │ └── index.js
│ └── Counter
│ │ └── index.js
├── Reducers
│ ├── Chat
│ │ └── index.js
│ ├── People
│ │ └── index.js
│ ├── Setting
│ │ └── index.js
│ ├── index.js
│ ├── Home
│ │ ├── index.js
│ │ ├── home2.js
│ │ ├── home.js
│ │ └── counter.js
│ └── Navigator
│ │ └── index.js
├── Store
│ └── index.js
├── Components
│ ├── Chat
│ │ └── Chat.js
│ ├── People
│ │ └── People.js
│ ├── Setting
│ │ └── Setting.js
│ └── Home
│ │ ├── Home.js
│ │ └── Counter.js
├── index.js
└── Configs
│ ├── StackNavigator.js
│ └── TabNavigator.js
├── app.json
├── 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
│ │ │ ├── assets
│ │ │ └── fonts
│ │ │ │ ├── Entypo.ttf
│ │ │ │ ├── Feather.ttf
│ │ │ │ ├── Zocial.ttf
│ │ │ │ ├── EvilIcons.ttf
│ │ │ │ ├── Foundation.ttf
│ │ │ │ ├── Ionicons.ttf
│ │ │ │ ├── Octicons.ttf
│ │ │ │ ├── FontAwesome.ttf
│ │ │ │ ├── MaterialIcons.ttf
│ │ │ │ ├── SimpleLineIcons.ttf
│ │ │ │ └── MaterialCommunityIcons.ttf
│ │ │ ├── java
│ │ │ └── com
│ │ │ │ └── reactnavigationdemo
│ │ │ │ ├── MainActivity.java
│ │ │ │ └── MainApplication.java
│ │ │ └── AndroidManifest.xml
│ ├── BUCK
│ ├── proguard-rules.pro
│ └── build.gradle
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── keystores
│ ├── debug.keystore.properties
│ └── BUCK
├── settings.gradle
├── build.gradle
├── gradle.properties
├── gradlew.bat
└── gradlew
├── index.js
├── .buckconfig
├── __tests__
└── App.js
├── plainNavigation
├── Components
│ ├── Home
│ │ ├── Home2.js
│ │ ├── HookTabBar.js
│ │ ├── Badge.js
│ │ ├── Back1.js
│ │ ├── Back2.js
│ │ ├── Home3.js
│ │ ├── Home7.js
│ │ ├── Home6.js
│ │ ├── Home4.js
│ │ ├── Back3.js
│ │ ├── Home5.js
│ │ └── Home.js
│ ├── People
│ │ └── People.js
│ ├── Chat
│ │ └── Chat.js
│ └── Setting
│ │ ├── Setting2.js
│ │ ├── Setting3.js
│ │ └── Setting.js
├── TabNavigator
│ └── index.js
└── StackNavigator
│ └── index.js
├── src
├── SampleText.js
├── TabsInDrawer.js
├── Drawer.js
├── SimpleStack.js
├── ModalStack.js
├── StacksOverTabs.js
├── SimpleTabs.js
├── CustomTabs.js
├── StacksInTabs.js
├── CustomTransitioner.js
└── App.js
├── ios
├── reactNavigationDemo
│ ├── AppDelegate.h
│ ├── main.m
│ ├── Images.xcassets
│ │ └── AppIcon.appiconset
│ │ │ └── Contents.json
│ ├── AppDelegate.m
│ ├── Info.plist
│ └── Base.lproj
│ │ └── LaunchScreen.xib
├── reactNavigationDemoTests
│ ├── Info.plist
│ └── reactNavigationDemoTests.m
├── reactNavigationDemo-tvOSTests
│ └── Info.plist
├── reactNavigationDemo-tvOS
│ └── Info.plist
└── reactNavigationDemo.xcodeproj
│ └── xcshareddata
│ └── xcschemes
│ ├── reactNavigationDemo.xcscheme
│ └── reactNavigationDemo-tvOS.xcscheme
├── package.json
├── .gitignore
├── LICENSE
├── App.js
├── .flowconfig
└── README.md
/.watchmanconfig:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.pbxproj -text
2 |
--------------------------------------------------------------------------------
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["react-native"]
3 | }
4 |
--------------------------------------------------------------------------------
/reduxNavigation/Constants/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by guangqiang on 2017/12/1.
3 | */
4 |
--------------------------------------------------------------------------------
/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "reactNavigationDemo",
3 | "displayName": "reactNavigationDemo"
4 | }
--------------------------------------------------------------------------------
/reduxNavigation/Actions/Chat/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by guangqiang on 2017/12/1.
3 | */
4 |
--------------------------------------------------------------------------------
/reduxNavigation/Actions/People/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by guangqiang on 2017/12/1.
3 | */
4 |
--------------------------------------------------------------------------------
/reduxNavigation/Reducers/Chat/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by guangqiang on 2017/12/1.
3 | */
4 |
--------------------------------------------------------------------------------
/reduxNavigation/Actions/Setting/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by guangqiang on 2017/12/1.
3 | */
4 |
--------------------------------------------------------------------------------
/reduxNavigation/Reducers/People/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by guangqiang on 2017/12/1.
3 | */
4 |
--------------------------------------------------------------------------------
/reduxNavigation/Reducers/Setting/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by guangqiang on 2017/12/1.
3 | */
4 |
--------------------------------------------------------------------------------
/android/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | reactNavigationDemo
3 |
4 |
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | import { AppRegistry } from 'react-native'
2 | import App from './App'
3 | AppRegistry.registerComponent('reactNavigationDemo', () => App)
--------------------------------------------------------------------------------
/.buckconfig:
--------------------------------------------------------------------------------
1 |
2 | [android]
3 | target = Google Inc.:Google APIs:23
4 |
5 | [maven_repositories]
6 | central = https://repo1.maven.org/maven2
7 |
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guangqiang-liu/react-navigation-demo/HEAD/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/android/app/src/main/assets/fonts/Entypo.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guangqiang-liu/react-navigation-demo/HEAD/android/app/src/main/assets/fonts/Entypo.ttf
--------------------------------------------------------------------------------
/android/app/src/main/assets/fonts/Feather.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guangqiang-liu/react-navigation-demo/HEAD/android/app/src/main/assets/fonts/Feather.ttf
--------------------------------------------------------------------------------
/android/app/src/main/assets/fonts/Zocial.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guangqiang-liu/react-navigation-demo/HEAD/android/app/src/main/assets/fonts/Zocial.ttf
--------------------------------------------------------------------------------
/android/app/src/main/assets/fonts/EvilIcons.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guangqiang-liu/react-navigation-demo/HEAD/android/app/src/main/assets/fonts/EvilIcons.ttf
--------------------------------------------------------------------------------
/android/app/src/main/assets/fonts/Foundation.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guangqiang-liu/react-navigation-demo/HEAD/android/app/src/main/assets/fonts/Foundation.ttf
--------------------------------------------------------------------------------
/android/app/src/main/assets/fonts/Ionicons.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guangqiang-liu/react-navigation-demo/HEAD/android/app/src/main/assets/fonts/Ionicons.ttf
--------------------------------------------------------------------------------
/android/app/src/main/assets/fonts/Octicons.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guangqiang-liu/react-navigation-demo/HEAD/android/app/src/main/assets/fonts/Octicons.ttf
--------------------------------------------------------------------------------
/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/app/src/main/assets/fonts/FontAwesome.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guangqiang-liu/react-navigation-demo/HEAD/android/app/src/main/assets/fonts/FontAwesome.ttf
--------------------------------------------------------------------------------
/android/app/src/main/assets/fonts/MaterialIcons.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guangqiang-liu/react-navigation-demo/HEAD/android/app/src/main/assets/fonts/MaterialIcons.ttf
--------------------------------------------------------------------------------
/android/app/src/main/assets/fonts/SimpleLineIcons.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guangqiang-liu/react-navigation-demo/HEAD/android/app/src/main/assets/fonts/SimpleLineIcons.ttf
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guangqiang-liu/react-navigation-demo/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/guangqiang-liu/react-navigation-demo/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/guangqiang-liu/react-navigation-demo/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/guangqiang-liu/react-navigation-demo/HEAD/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/assets/fonts/MaterialCommunityIcons.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guangqiang-liu/react-navigation-demo/HEAD/android/app/src/main/assets/fonts/MaterialCommunityIcons.ttf
--------------------------------------------------------------------------------
/android/keystores/BUCK:
--------------------------------------------------------------------------------
1 | keystore(
2 | name = "debug",
3 | properties = "debug.keystore.properties",
4 | store = "debug.keystore",
5 | visibility = [
6 | "PUBLIC",
7 | ],
8 | )
9 |
--------------------------------------------------------------------------------
/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
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 = 'reactNavigationDemo'
2 | include ':react-native-vector-icons'
3 | project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')
4 |
5 | include ':app'
6 |
--------------------------------------------------------------------------------
/reduxNavigation/Constants/actionType.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by guangqiang on 2017/12/1.
3 | */
4 |
5 | const actionType = {
6 | CHANGE_HOME_STATEVALUE: 'CHANGE_HOME_STATEVALUE',
7 | INCREASE: 'INCREASE',
8 | DECREASE: 'DECREASE'
9 | }
10 |
11 | export {actionType}
--------------------------------------------------------------------------------
/reduxNavigation/Actions/Home/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by guangqiang on 2017/12/1.
3 | */
4 | import {actionType} from '../../Constants/actionType'
5 | const changeStateValue = val => ({
6 | type: actionType.CHANGE_HOME_STATEVALUE,
7 | val
8 | }
9 | )
10 |
11 | export {changeStateValue}
--------------------------------------------------------------------------------
/reduxNavigation/Reducers/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by guangqiang on 2017/12/1.
3 | */
4 | import {combineReducers} from 'redux'
5 | import navigator from './Navigator'
6 | import home from './Home'
7 |
8 | const rootReducers = combineReducers({
9 | navigator,
10 | home
11 | })
12 |
13 | export default rootReducers
--------------------------------------------------------------------------------
/__tests__/App.js:
--------------------------------------------------------------------------------
1 | import 'react-native';
2 | import React from 'react';
3 | import App from '../App';
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 |
--------------------------------------------------------------------------------
/reduxNavigation/Reducers/Home/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by guangqiang on 2017/12/1.
3 | */
4 | import {combineReducers} from 'redux'
5 | import home from './home'
6 | import home2 from './home2'
7 | import counter from './counter'
8 | const reducers = combineReducers({
9 | home,
10 | home2,
11 | counter
12 | })
13 |
14 | export default reducers
--------------------------------------------------------------------------------
/reduxNavigation/Actions/Counter/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by guangqiang on 2017/12/2.
3 | */
4 | import {actionType} from '../../Constants/actionType'
5 |
6 | const increaseAction = value => ({
7 | type: actionType.INCREASE,
8 | val: value
9 | })
10 |
11 | const decreaseAction = value => ({
12 | type: actionType.DECREASE,
13 | val: value
14 | })
15 |
16 | export {increaseAction, decreaseAction}
--------------------------------------------------------------------------------
/plainNavigation/Components/Home/Home2.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by guangqiang on 2017/12/1.
3 | */
4 | import React, {Component} from 'react'
5 | import { Text, View} from 'react-native'
6 | export default class Home2 extends Component {
7 |
8 | render() {
9 | return (
10 |
11 | Home2
12 |
13 | )
14 | }
15 | }
--------------------------------------------------------------------------------
/reduxNavigation/Store/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by guangqiang on 2017/12/1.
3 | */
4 | import {createStore, applyMiddleware} from 'redux'
5 | import logger from 'redux-logger'
6 | import reducers from '../Reducers'
7 |
8 | const middlewares = []
9 |
10 | if (process.env.NODE_ENV === 'development') {
11 | middlewares.push(logger)
12 | }
13 |
14 | const store = createStore(reducers, applyMiddleware(...middlewares))
15 |
16 | export {store}
--------------------------------------------------------------------------------
/plainNavigation/Components/Home/HookTabBar.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by guangqiang on 2018/5/26.
3 | */
4 | import React, {Component} from 'react'
5 | import { Text, View} from 'react-native'
6 | export default class HookTabBar extends Component {
7 |
8 | render() {
9 | return (
10 |
11 | Hook TabBar的点击事件,请点击Chat Tab已做参考
12 |
13 | )
14 | }
15 | }
--------------------------------------------------------------------------------
/plainNavigation/Components/People/People.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by guangqiang on 2017/12/1.
3 | */
4 | import React, {Component} from 'react'
5 | import { Text, View} from 'react-native'
6 |
7 | class People extends Component {
8 |
9 | static navigationOptions = {
10 | title: 'People', // 固定标题
11 | }
12 | render() {
13 | return (
14 |
15 | People
16 |
17 | )
18 | }
19 | }
20 |
21 | export default People
--------------------------------------------------------------------------------
/reduxNavigation/Reducers/Navigator/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by guangqiang on 2017/12/1.
3 | */
4 | import { NavigationActions } from 'react-navigation'
5 | import Navigator from '../../Configs/StackNavigator'
6 |
7 | const initialState = Navigator.router.getStateForAction(NavigationActions.init())
8 |
9 | export default (state = initialState, actions) => {
10 | const nextState = Navigator.router.getStateForAction(actions, state)
11 | return nextState || state
12 | }
--------------------------------------------------------------------------------
/android/app/src/main/java/com/reactnavigationdemo/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.reactnavigationdemo;
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 "reactNavigationDemo";
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/plainNavigation/Components/Chat/Chat.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by guangqiang on 2017/12/1.
3 | */
4 | import React, {Component} from 'react'
5 | import {
6 | StyleSheet,
7 | Text,
8 | View,
9 | Image
10 | } from 'react-native'
11 |
12 | class Chat extends Component {
13 |
14 | static navigationOptions = {
15 | title: 'Chat', // 固定标题
16 | }
17 | render() {
18 | return (
19 |
20 | Chat
21 |
22 | )
23 | }
24 | }
25 |
26 | export default Chat
--------------------------------------------------------------------------------
/reduxNavigation/Reducers/Home/home2.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by guangqiang on 2017/12/2.
3 | */
4 | import { actionType } from '../../Constants/actionType'
5 |
6 | const initialState = {
7 | mainText: 'Start Here'
8 | }
9 |
10 | export default (state = initialState, action) => {
11 | switch (action.type) {
12 | case actionType.SUBMIT_NEW_TEXT:
13 | return {
14 | ...state,
15 | mainText: action.text
16 | }
17 | break
18 | default:
19 | return state
20 | }
21 | }
--------------------------------------------------------------------------------
/reduxNavigation/Reducers/Home/home.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by guangqiang on 2017/12/2.
3 | */
4 | import { actionType } from '../../Constants/actionType'
5 |
6 | const initialState = {
7 | homeState: '这是reducer中初始的值'
8 | }
9 |
10 | export default (state = initialState, action) => {
11 | switch (action.type) {
12 | case actionType.CHANGE_HOME_STATEVALUE:
13 | return {
14 | ...state,
15 | homeState: action.val
16 | }
17 | break
18 | default:
19 | return state
20 | }
21 | }
--------------------------------------------------------------------------------
/plainNavigation/Components/Home/Badge.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by guangqiang on 2018/5/26.
3 | */
4 | import React, {Component} from 'react'
5 | import { Text, View} from 'react-native'
6 | import {Button} from 'react-native-elements'
7 | export default class badge extends Component {
8 |
9 | render() {
10 | return (
11 |
12 | 实现在TabBar Item上自定义badge,我们可以参照示例中的People Tab的实现方式
13 |
14 | )
15 | }
16 | }
--------------------------------------------------------------------------------
/src/SampleText.js:
--------------------------------------------------------------------------------
1 | /* @flow */
2 |
3 | import React from 'react';
4 |
5 | import { StyleSheet, Text } from 'react-native';
6 |
7 | /**
8 | * Used across examples as a screen placeholder.
9 | */
10 | import type { ChildrenArray } from 'react';
11 |
12 | const SampleText = ({ children }: { children?: ChildrenArray<*> }) => (
13 | {children}
14 | );
15 |
16 | export default SampleText;
17 |
18 | const styles = StyleSheet.create({
19 | sampleText: {
20 | margin: 14,
21 | },
22 | });
23 |
--------------------------------------------------------------------------------
/ios/reactNavigationDemo/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 |
--------------------------------------------------------------------------------
/plainNavigation/Components/Setting/Setting2.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by guangqiang on 2017/12/1.
3 | */
4 | import React, {Component} from 'react'
5 | import { Text, View} from 'react-native'
6 | import {Button} from 'react-native-elements'
7 | export default class Setting2 extends Component {
8 |
9 | render() {
10 | const {navigate} = this.props.navigation
11 | return (
12 |
13 | Setting2
14 |
19 | )
20 | }
21 | }
--------------------------------------------------------------------------------
/plainNavigation/Components/Setting/Setting3.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by guangqiang on 2017/12/1.
3 | */
4 | import React, {Component} from 'react'
5 | import { Text, View} from 'react-native'
6 | import {Button} from 'react-native-elements'
7 | export default class Setting3 extends Component {
8 |
9 | render() {
10 | const {navigate} = this.props.navigation
11 | return (
12 |
13 | Setting3
14 |
19 | )
20 | }
21 | }
--------------------------------------------------------------------------------
/ios/reactNavigationDemo/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 |
--------------------------------------------------------------------------------
/reduxNavigation/Reducers/Home/counter.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by guangqiang on 2017/12/2.
3 | */
4 | import { actionType } from '../../Constants/actionType'
5 |
6 | const initialState = {
7 | counterValue: 0
8 | }
9 |
10 | export default (state = initialState, action) => {
11 | switch (action.type) {
12 | case actionType.INCREASE:
13 | return {
14 | ...state,
15 | counterValue: state.counterValue + 1
16 | }
17 | break
18 | case actionType.DECREASE:
19 | return {
20 | ...state,
21 | counterValue: state.counterValue - 1
22 | }
23 | break
24 | default:
25 | return state
26 | }
27 | }
--------------------------------------------------------------------------------
/reduxNavigation/Components/Chat/Chat.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by guangqiang on 2017/12/1.
3 | */
4 | import React, {Component} from 'react'
5 | import {
6 | StyleSheet,
7 | Text,
8 | View,
9 | Image
10 | } from 'react-native'
11 | import {connect} from 'react-redux'
12 |
13 | class Chat extends Component {
14 |
15 | componentDidMount() {
16 | const {params} = this.props.navigation.state
17 | }
18 |
19 | render() {
20 | return (
21 |
22 | Chat
23 |
24 | )
25 | }
26 | }
27 |
28 | const mapStateToProps = state => ({
29 | mainText: ''
30 | })
31 |
32 | export default connect(mapStateToProps)(Chat)
--------------------------------------------------------------------------------
/reduxNavigation/Components/People/People.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by guangqiang on 2017/12/1.
3 | */
4 | import React, {Component} from 'react'
5 | import {
6 | StyleSheet,
7 | Text,
8 | View,
9 | Image
10 | } from 'react-native'
11 | import {connect} from 'react-redux'
12 |
13 | class People extends Component {
14 |
15 | componentDidMount() {
16 | const {params} = this.props.navigation.state
17 | }
18 |
19 | render() {
20 | return (
21 |
22 | People
23 |
24 | )
25 | }
26 | }
27 |
28 |
29 | const mapStateToProps = state => ({
30 | mainText: ''
31 | })
32 |
33 | export default connect(mapStateToProps)(People)
--------------------------------------------------------------------------------
/reduxNavigation/Components/Setting/Setting.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by guangqiang on 2017/12/1.
3 | */
4 | import React, {Component} from 'react'
5 | import {
6 | StyleSheet,
7 | Text,
8 | View,
9 | Image
10 | } from 'react-native'
11 | import {connect} from 'react-redux'
12 |
13 | class Setting extends Component {
14 |
15 | componentDidMount() {
16 | const {params} = this.props.navigation.state
17 | }
18 |
19 | render() {
20 | return (
21 |
22 | Setting
23 |
24 | )
25 | }
26 | }
27 |
28 | const mapStateToProps = state => ({
29 | mainText: ''
30 | })
31 |
32 | export default connect(mapStateToProps)(Setting)
--------------------------------------------------------------------------------
/plainNavigation/Components/Setting/Setting.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by guangqiang on 2017/12/1.
3 | */
4 | import React, {Component} from 'react'
5 | import { Text, View} from 'react-native'
6 | import {Button} from 'react-native-elements'
7 | class Setting extends Component {
8 |
9 | static navigationOptions = {
10 | title: 'Setting', // 固定标题
11 | }
12 | render() {
13 | const {navigate} = this.props.navigation
14 | return (
15 |
16 | Setting
17 |
22 | )
23 | }
24 | }
25 |
26 |
27 | export default Setting
--------------------------------------------------------------------------------
/reduxNavigation/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by guangqiang on 2017/12/1.
3 | */
4 | import React from 'react'
5 | import {addNavigationHelpers} from 'react-navigation'
6 | import {Provider, connect} from 'react-redux'
7 | import {store} from './Store'
8 | import Navigator from './Configs/StackNavigator'
9 |
10 | const App =({dispatch, nav}) => (
11 |
14 | )
15 |
16 | const mapStateToProps = state => ({
17 | nav: state.navigator
18 | })
19 |
20 | const Navigation = connect(mapStateToProps)(App)
21 |
22 | export default InitApp = () => (
23 |
24 |
25 |
26 | )
--------------------------------------------------------------------------------
/plainNavigation/Components/Home/Back1.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by guangqiang on 2018/5/26.
3 | */
4 | import React, {Component} from 'react'
5 | import { Text, View} from 'react-native'
6 | import {Button} from 'react-native-elements'
7 |
8 | export default class HookTabBar extends Component {
9 |
10 | render() {
11 | const {navigate} = this.props.navigation
12 | return (
13 |
14 | 这是测试pop事件中的第一个页面
15 |
21 | )
22 | }
23 | }
--------------------------------------------------------------------------------
/plainNavigation/Components/Home/Back2.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by guangqiang on 2018/5/26.
3 | */
4 | import React, {Component} from 'react'
5 | import { Text, View} from 'react-native'
6 | import {Button} from 'react-native-elements'
7 |
8 | export default class HookTabBar extends Component {
9 |
10 | render() {
11 | const {navigate} = this.props.navigation
12 | return (
13 |
14 | 这是测试pop事件中的第二个页面
15 |
21 | )
22 | }
23 | }
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/plainNavigation/Components/Home/Home3.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by guangqiang on 2017/12/2.
3 | */
4 | import React, {Component} from 'react'
5 | import { Text, View} from 'react-native'
6 | import {Button} from 'react-native-elements'
7 | export default class Home3 extends Component {
8 |
9 | render() {
10 | const {navigate} = this.props.navigation
11 | return (
12 |
13 | Home3
14 | {`Home界面传递的参数为:${this.props.navigation.state.params.id}`}
15 |
21 | )
22 | }
23 | }
--------------------------------------------------------------------------------
/ios/reactNavigationDemo/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 | }
--------------------------------------------------------------------------------
/plainNavigation/Components/Home/Home7.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by guangqiang on 2017/12/2.
3 | */
4 | import React, {Component} from 'react'
5 | import { Text, View} from 'react-native'
6 | import {Button} from 'react-native-elements'
7 | export default class Home7 extends Component {
8 |
9 | static navigationOptions = ({navigation, screenProps}) => ({
10 | title: navigation.state.params.title,
11 | headerRight: (
12 |