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

rn-header

v1.3.0

Published

A header to use in apps

Downloads

7

Readme

RN-Header

Can Use the header as a stand alone header, or a scroll away header.

You must have react-native-vector-icons installed and linked for this to display icons on the header. Can also display text on the sides of header

Uses Font Awesome icons as the icon source

npm install react-native-vector-icons --save
react-native link react-native-vector-icons
npm install rn-header --save
  • To use as a scroll away header takes a little work to set up.
  • import Animated from react-native
  • Add an Animated.Value to the constructor. Need a scrollY so the Header can respond properly
  • Can use with Listview or ScrollView.
  • SET UP THE ONSCROLL PROP TO MATCH THIS EXAMPLE
  • If you don't use scrollEventThrottle you're gonna have a bad time...mmmm-kay??
  • just copy/paste this example and you'll get the hang of it 🤓
  • When using as a scroll away header, wrap whatever content you want to stay within the <Header> </Header> tags. When using as a stand alone Header, just use as <Header/>

If you do not want the header to scroll away, do not supply the header with the scrollY

gif

'use strict'

import React, { Component } from 'react';
import {
View,
Text,
ScrollView,
Animated
} from 'react-native';

import Header from 'rn-header';


export default class Example extends Component {
 constructor(){
   super();
   this.scrollY = new Animated.Value(0)
 };


 render(){
   let things = ['Watch','The','Header','Scroll','Away','As','I','Move'].map((opt,i) => {
     return(
       <View
         key={i}
         style={{
           marginTop:60,
           backgroundColor:'deeppink',
           paddingLeft:20
         }}>
         <Text style={{fontSize:33}}>{opt}</Text>
       </View>
     )
   });
   return(
     <View style={{
       flex:1,
       backgroundColor:'yellow'
     }}>
       <Header
         scrollY={this.scrollY}
         backgroundColor={'blue'}
         height={60}
         centerText={'Scroll Away'}
         rightIconProps={{
           name:'cogs',
           size:25,
           color:'white'
         }}
         onRightPress={
           () => console.log('Stuff')
          }
         centerTextProps={{
           fontSize:20,
           color:'white',
           fontWeight:'500'
         }}>

         <View style={{
           height:200,
           backgroundColor:'red',
           alignItems:'center',
           justifyContent:'center'
         }}>
           <Text style={{
             color:'white',
             fontSize:23,
             textAlign: 'center'
           }}>Watch me stay after the header goes away!</Text>
         </View>
       </Header>

       <ScrollView
         scrollEventThrottle={16}
         onScroll={
           // this maps the onScroll event to the scrollY variable declared in the constructor.  Now the header has a reference to the scrolling and can respond properly
           Animated.event(
           [{nativeEvent: {contentOffset: {y:  this.scrollY }}}]
           )
         }

         {things}
       </ScrollView>
     </View>
   )
 };

};

All props

| Prop | Type | Description | Required | | --- | --- | --- | --- | | backgroundColor | string | backgroundColor of the Header | YES | | height | number | height of the Header | YES | | centerText | string | Text to display in the center | no| | centerTextProps | Text Props | any valid Text props | no | | onCenterPress | function | what to do on center press....like scroll to top or show a pop-up | no | | onRightPress | function | what to do on right press | no | | onLeftPress | function | what to do on right press | no | | leftTextProps | Text Props | any valid Text Props | no | | leftIconProps | Icon Props | any valid Icon Props | no | | rightTextProps | Text Props | any valid Text Props | no | | rightIconProps | Icon Props | any valid Icon props | no |