raininfall.rax-navigation

0.2.13 • 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},
  Profile: {screen: ProfileScreen},
});

render(<BasicApp />);

Package Sidebar

Install

npm i raininfall.rax-navigation

Weekly Downloads

1

Version

0.2.13

License

BSD-3-Clause

Last publish

Collaborators

  • raininfall