rax-navigation

1.0.0 • Public • Published

rax-navigation npm

Install

npm install --save rax-navigation

Usage

import {render, createElement, Component} from 'rax';
import {StackNavigator} from 'rax-navigation';
import Button from 'rax-button';
 
class MainScreen extends Component {
  static navigationOptions = {
    title: 'Welcome'
  };
  render() {
    const { navigate } = this.props.navigation;
    return (
      <Button
        title="Go to Jane's profile"
        onPress={() => {
          navigate('Profile', { name: 'Jane' })
        }}
      />
    );
  }
}
 
class ProfileScreen extends Component {
  static navigationOptions = {
    title: ({state}) => state.params.name,
    header: false
  };
  render() {
    const { goBack } = this.props.navigation;
    return (
      <Button
        title="Go back"
        onPress={() => goBack()}
      />
    );
  }
}
 
const BasicApp = StackNavigator({
  Main: {screen: MainScreen, path: '/'},
  Profile: {screen: ProfileScreen, path: '/profile'},
});
 
render(<BasicApp />);

Package Sidebar

Install

npm i rax-navigation

Weekly Downloads

6

Version

1.0.0

License

BSD-3-Clause

Unpacked Size

3.01 MB

Total Files

39

Last publish

Collaborators

  • huxiaoqi
  • wintercn
  • yacheng
  • yuanyan
  • zeroling