npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-sk-navigator

v1.0.2

Published

Component wraps Navigator, easy to push and easy to render different type of navigation bar

Downloads

13

Readme

react-native-sk-navigator

##What is it

react-native-sk-navigator is a component wraps Navigator, supports:

1 Delegate Navigator

you can define it just like Navigator, by using Navigator's properties and methods

2 Be compatible with NavigatorIOS's api


this.props.navigator.push({
  type: 'simple',
  component: LoginModal,
  passProps: passProps,
  leftButtonIcon: require('image!left_button'),
  onLeftButtonPress: () => this.props.navigator.pop(),
  rightButtonIcon: require('image!right_button'),
  onRightButtonPress: () => console.log('test')
  sceneConfig: {
    ...Navigator.SceneConfigs.VerticalDownSwipeJump,
    gestures: null,
    defaultTransitionVelocity: 10,
  }
});

3 Supports 3 types of navigation bar:

3.1 none: no navigation bar.

3.2 simple: navigation bar has only left button which go back.

3.3 default: navigation bar has title, left button and right button.

3.4 transparent: same with 'default', and its background is transparent.

##How to use it

  1. npm install react-native-sk-navigator@latest --save

  2. Write this in index.ios.js / index.android.js


'use strict';
import React, {
  AppRegistry,
  StyleSheet,
  Text,
  View,
  TouchableHighlight,
  AlertIOS,
  Dimensions,
} from 'react-native';


var {SKNavigator} = require('react-native-sk-navigator');

// descript each type of navigation bar
var descriptions = {
  none: 'no navigation bar',
  simple: 'navigation bar has only left button which go back',
  default: 'navigation bar has title, left button and right button',
  transparent: 'navigation bar has title, left button and right button, \n and its background is transparent'
};

var Page = React.createClass({
  render() {
    return (
      <View style={styles.page}>
        {/* type */}
        <Text style={styles.title}>{'NavBar type: ' + this.props.type}</Text>
        {/* descript type */}
        <Text style={styles.desc}>{descriptions[this.props.type]}</Text>
        {/* back button */}
        <TouchableHighlight
          style={[styles.button, styles.goback]}
          underlayColor='#c8c7cc'
          onPress={() => this.props.navigator.pop()}
        >
          <Text>go back</Text>
        </TouchableHighlight>
      </View>
    );
  }
});


var Home = React.createClass({
  // push a new page and show different navigation bar according to type
  showPage(type){
    this.props.navigator.push({
      type: type, // none / simple / default / transparent
      title: 'NavBar type: ' + type,
      component: Page,
      passProps: {
        navigator: this.props.navigator,
        type: type
      },
      leftButtonIcon:require('./img/nav_left.png'),
      // leftButtonTitle: 'back',
      onLeftButtonPress: () => this.props.navigator.pop(),
      // rightButtonIcon:require('./img/nav_right.png'),
      rightButtonTitle: 'submit',
      onRightButtonPress: () => AlertIOS.alert('Submit', 'Are you want to submit?', [{text: 'yes'}]),
    });
  },

  renderButton(type, i){
    return (
      <TouchableHighlight
        key={i}
        style={styles.button}
        underlayColor='#c8c7cc'
        onPress={() => this.showPage(type)}
      >
        <Text>{type}</Text>
      </TouchableHighlight>
    )
  },

  render() {
    var types = ['none', 'simple', 'default', 'transparent'];
    return (
      <View style={styles.container}>
        {types.map(this.renderButton)}
      </View>
    );
  }
});

var test = React.createClass({
  render() {
    return (
      <SKNavigator
        initialRoute={{
           component: Home,
           title: 'Home',
           type: 'none',
           passProps: {
           }
         }}/>
    );
  }
});

var styles = {
  container: {
    flex: 1,
    backgroundColor: '#FFF',
    justifyContent: 'space-around',
    alignItems: 'center',
  },
  page:{
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
  },
  button: {
    width: 100,
    height: 40,
    borderRadius: 5,
    backgroundColor: 'yellow',
    justifyContent: 'center',
    alignItems: 'center',
  },
  title: {
    fontSize: 18,
    fontWeight: 'bold'
  },
  desc: {
    fontSize: 14,
    color: 'green',
  },
  goback: {
    marginTop: 10
  }
};

AppRegistry.registerComponent('test', () => test);

##SKNavigator's properties

Any Navigator property

##SKNavigator's methods

Any Navigator method

##Route's properties

| Prop | Description | Default | |---|---|---| |component|Component to render in the next scense. |None| |passProps|Properties which will be passed to component. |None| |title|Title in the middle of navigation bar. |None| |leftButtonTitle|Title of left button. |None| |leftButtonIcon|Icon of left button. |None| |onLeftButtonPress|Callback when left button pressed. |None| |rightButtonTitle|Title of right button. |None| |rightButtonIcon|Icon of right button. |None| |onRightButtonPress|Callback when left button pressed. |None|