1.0.1 • Published 3 years ago

@syahiidkamil/react-native-header-zoom-scroll v1.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

@syahiidkamil/react-native-header-zoom-scroll

this is a lib forked from https://github.com/thanhvd152/react-native-header-zoom-scroll

Easily create ScrollView with Animation zoom header, with lots of customization

Features

  • Smooth animation
  • Custom background header
  • Custom small header
  • Transparent small header

Setup

This library is available on npm, install it with: npm i @syahiidkamil/react-native-header-zoom-scroll or yarn add @syahiidkamil/react-native-header-zoom-scroll.

Usage

import React from 'react';
import type { Node } from 'react';
import {
  SafeAreaView,
  Text,
  Image
} from 'react-native';
import ScrollZoomHeader from 'react-native-header-zoom-scroll';
import { View } from 'react-native';

const App: () => Node = () => {


  return (
    <SafeAreaView >
      <ScrollZoomHeader
        showsVerticalScrollIndicator={false}
        smallHeaderHeight={
          60
        }
        contentSmallHeader={<View style={{
          flex: 1
        }}>
          <Text style={{ color: '#fff', fontWeight: '600', marginLeft: 10 }}>CUSTOM SMALL HEADER</Text>
        </View>}
        headerComponent={
          <View>
            <Text style={{ color: '#fff', fontWeight: '600', marginLeft: 10 }}>CUSTOM  HEADER COMPONENT</Text>

          </View>
        }
        headerHeight={300}
        backgroundHeaderComponent={
          <Image
            source={{ uri: 'https://i.9mobi.vn/cf/images/2015/03/nkk/hinh-dep-12.jpg' }}
            style={{
              width: '100%',
              height: '100%'
            }}
          />
        }
      >
        <Text style={{ fontWeight: '600', marginLeft: 10 }}>CONTENT</Text>

        <View style={{
          height: 1000,
        }} />

      </ScrollZoomHeader>
    </SafeAreaView>
  );
};

export default App;

Available props

NameTypeDefaultDescription
headerComponentJSXAttributenullComponent inside Header
headerHeightnumber0Height of big header
backgroundHeaderComponentJSXAttribute.nullBackground of header Image,View ...
smallHeaderHeightnumber0Height of small header
contentSmallHeaderJSXAttributenullcontent of small header
fadeSmallHeaderboolfalseanimation fade smallHeader when scroll
statusBarBackgroundstringtransparentBackground statusbar
statusBarCurrentHeightnumber0Android status bar height (StatusBar.currentHeight)
scrollViewRefRefundefinedAndroid status bar height (StatusBar.currentHeight)