Giter Club home page Giter Club logo

sticky-parallax-header's Introduction

Stickyheader.js


Brought with  ❤️ by   Netguru logo

Introduction

Stickyheader.js is a simple React Native library, enabling to create a fully custom header for your iOS and Android apps.

Preview

Features

Stickyheader.js ships with 3 different use cases for sticky headers and a possibility to create fully custom header!
Tabbed Header Avatar Header Details Header
Tabbed Header Gif Avatar Header Gif Details Header Gif

In Use

Predefined headers can be accessed through headerType="HeaderName" property, each header can be configured according to your demands using the wide amount of properties. You can change all of them, or use it right out of the box with as little changes as possible to use it for your needs

This is how you can add them in your app:

import React from 'react'
import StickyParallaxHeader from 'react-native-sticky-parallax-header'

const TestScreen = () => (
  <>
    <StickyParallaxHeader headerType="TabbedHeader" />
    {/* <StickyParallaxHeader headerType="AvatarHeader" /> */}
    {/* <StickyParallaxHeader headerType="DetailsHeader" /> */}
  </>
)

export default TestScreen

Below are examples of those components and description of the props they are accepting.

Tabbed Header

Tabbed Header Gif

Property Type Optional Default Description
backgroundColor string Yes #1ca75d Header background color
headerHeight number Yes ifIphoneX(92, constants.responsiveHeight(13)) Sets height of folded header
backgroundImage number Yes null Sets header background image
title string Yes "Mornin' Mark! \nReady for a quiz?" Sets header title
bounces bool Yes true Bounces on swiping up
snapToEdge bool Yes true Boolean to fire the function for snap To Edge
renderBody func Yes title => <RenderContent title={title} /> Function that renders body of the header (can be empty)
tabs arrayOf(shape({})) Yes [{title: 'Popular',content: <RenderContent title="Popular Quizes" />},...] Array with tabs names and content
logo func Yes require('../../assets/images/logo.png') Set header logo
logoStyle style Yes { height: 24, width: 142 } Set header logo style
logoContainerStyle style Yes { width: '100%', paddingHorizontal: 24, paddingTop: Platform.select({ ios: ifIphoneX(50, 40), android: 55 }), flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center'} Set header logo container style
logoResizeMode "contain", "cover", "stretch", "center", "repeat" Yes "contain" Set header logo resize mode
foregroundImage oneOfType([object, number]) Yes Set image in the foreground
titleStyle Text.propTypes.style Yes Set style for text in foreground
tabText Text.propTypes.style Yes {fontSize: 16, lineHeight: 20, paddingHorizontal: 12, paddingVertical: 8, color: colors.white} Set inactive tab style
tabTextActiveStyle Text.propTypes.style Yes {fontSize: 16, lineHeight: 20, paddingHorizontal: 12, paddingVertical: 8, color: colors.white} Set active tab stylee
tabTextContainerStyle ViewPropTypes.style Yes {backgroundColor: colors.transparent, borderRadius: 18} Set inactive tab container style
tabTextContainerActiveStyle ViewPropTypes.style Yes {backgroundColor: colors.darkMint} Set active tab container style
tabWrapperStyle ViewPropTypes.style Yes {paddingVertical: 12} Set single tab container style
tabsContainerStyle ViewPropTypes.style Yes Set whole tab bar container style
header func Yes Fuction that renders custom header
scrollEvent func Yes Scroll event to apply custom animations

Check how to customise Tabbed Header example

Details Header

Details Header Gif

Property Type Optional Default Description
leftTopIconOnPress func Yes () => {} Define action on left top button press
rightTopIconOnPress func Yes () => {} Define action on right top button press
leftTopIcon number Yes require('../../assets/icons/iconCloseWhite.png') Set icon for left top button
rightTopIcon number Yes require('../../assets/icons/Icon-Menu.png') Set icon for right top button
backgroundColor string Yes #1ca75d Header background color
headerHeight number Yes ifIphoneX(92, constants.responsiveHeight(13)) Sets height of folded header
backgroundImage number Yes null Sets header background image
tag string Yes "Product Designer" Sets header tag name
title string Yes "Design System" Sets header title
image number Yes require('../../assets/images/photosPortraitBrandon.png') Sets header image
renderBody func Yes title => <RenderContent title={title} /> Function that renders body of the header (can be empty)
bounces bool Yes true Bounces on swiping up
snapToEdge bool Yes true Boolean to fire the function for snap To Edge
hasBorderRadius bool Yes true Adds radius to header's left bottom border
iconNumber number Yes 10 Set amount of cards shown on icon

Avatar Header

Avatar Header Gif

Property Type Optional Default Description
leftTopIconOnPress func Yes () => {} Define action on left top button press
rightTopIconOnPress func Yes () => {} Define action on right top button press
leftTopIcon number Yes require('../../assets/icons/iconCloseWhite.png') Set icon for left top button
rightTopIcon number Yes require('../../assets/icons/Icon-Menu.png') Set icon for right top button
backgroundColor string Yes #1ca75d Header background color
headerHeight number Yes ifIphoneX(92, constants.responsiveHeight(13)) Sets height of folded header
backgroundImage number Yes null Sets header background image
title string Yes "Brandon Sets header title
subtitle string Yes "Coffee buff. Web enthusiast. Unapologetic student. Gamer. Avid organizer." Sets description(subtitle) section
image number Yes require('../../assets/images/photosPortraitBrandon.png') Sets header image
renderBody func Yes title => <RenderContent title={title} /> Function that renders body of the header (can be empty)
bounces bool Yes true Bounces on swiping up
snapToEdge bool Yes true Boolean to fire the function for snap To Edge
hasBorderRadius bool Yes true Adds radius to header's left bottom border
parallaxHeight number Yes Set parallax header height
transparentHeader bool Yes false Set header transparency to render custom header
snapStartThreshold number Yes Set start value Threshold of snap
snapStopThreshold number Yes Set stop value Threshold of snap
snapValue number Yes Set value where header is closed

Custom Header

Custom header props and example

Getting Started

Prerequisites

Installation

For React Native >= 0.60.0 use version 0.0.60 and above, for previous React Native versions use 0.0.59

Installation for React Native >= 0.60.0

Add latest package version

$ yarn add react-native-sticky-parallax-header

Installation for React Native < 0.60.0

Installation steps for React Native < 0.60.0

Contributing

Contributing guidelines

Contributors

License

The gem is available as open source under the terms of the MIT License.

sticky-parallax-header's People

Contributors

idaszakdaniel avatar karniej avatar kolkol69 avatar pwysowski avatar maciejbudzinsking avatar davidwico avatar netgurusupporter avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.