1.1.1 • Published 10 years ago

rn-navigation v1.1.1

Weekly downloads
24
License
MIT
Repository
github
Last release
10 years ago

RN-Navigation CircleCI npm version

NPM

inspired by react-native-router-flux,yet another router for react-native,built on new NavigationExperimental API,easy to migrate with redux and other flux-like framework

Install

npm install rn-navigation --save

then you need link the dependenices

react-native link react-native-vector-icons

Useage

in your entry point (etc: index.ios.js),define your own routes by Scene component,and wrap all of routes with Router component

class Index extends React.Component{
    render(){
        const sceneProps = {
            //scene props what you like to pass into scene components
        }
        return (
            <View style={{flex:1}}>
                <Router initialSceneKey="tabs" sceneProps={sceneProps} 
                navigationState={this.props.navigationState} dispatch={this.props.dispatch}>
                    <Scene tabbar={true} key="tabs" name="tabs">
                        <Scene key="tab_1" name="tab_1" title="topic" iconName="coffee">
                            <Scene key="topics" component={Topics}/>
                            <Scenen key="topic" component={Topic}/>
                        </Scene>
                        <Scene key="tab_2" name="tab_2" title="collect" iconName="bookmark">
                            <Scenen key="collect" component={Collect}/>
                        </Scene>
                        <Scene key="tab_3" name="tab_3" title="message" iconName="envelope">
                            <Scenen key="message" component={Message}/>
                        </Scene>
                        <Scene key="tab_4" name="tab_4" title="about" iconName="user">
                            <Scenen key="about" component={About}/>
                        </Scene>
                    </Scene>
                </Router>
            </View>
        )
    }
}

then create your own redux store

import {routerReducer} from "rn-navigation"

const rootReducer = combineReducers({routerReducer})

connect(state=>({
    navigationState:state.navigationState
}))(Index)

in scene component you can navigate to next,or go back to prev

this.props.navigationActions.pushScene("topic")
this.props.navigationActions.popScene()

just simple and easy,more instructions refer to API,or 中文文档

Todo

  • fix some unknow bugs
  • add more api documents

License

MIT License

1.1.1

10 years ago

1.1.0

10 years ago

1.0.20

10 years ago

1.0.19

10 years ago

1.0.18

10 years ago

1.0.17

10 years ago

1.0.16

10 years ago

1.0.15

10 years ago

1.0.13

10 years ago

1.0.12

10 years ago

1.0.11

10 years ago

1.0.10

10 years ago

1.0.9

10 years ago

1.0.8

10 years ago

1.0.7

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago