1.0.7 • Published 6 years ago

react-native-animated-header v1.0.7

Weekly downloads
75
License
ISC
Repository
github
Last release
6 years ago

Version NPM

react-native-animated-form

Collapsing toolbar for Android and iOS

Installation

npm install --save react-native-animated-header
or
yarn add react-native-animated-header

Demo

Android Android iOS iOS iPhone X iPhoneX(https://raw.githubusercontent.com/maphongba008/react-native-animated-header/master/demo/ipx.gif)

Usage

import React, { Component } from 'react';
import { Text, View, ScrollView } from 'react-native';
import { Icon } from 'native-base';
import AnimatedHeader from 'react-native-animated-header';
import Bg from './assets/bg.jpg';

getListItems = count => {
  const items = [];
  let i = 0;

  while (i < count) {
    i++;
    items.push(
      <View key={i} style={{ backgroundColor: i % 2 === 0 ? '#eee5ff' : '#ceebfd', height: 64 }}>
        <Text style={{ color: '#999' }}>{`List Item ${i}`}</Text>
      </View>
    );
  }

  return items;
};

export default class App extends Component {

  render() {
    return (
      <AnimatedHeader 
        style={{flex: 1 }}
        backText='Back'
        title='Happy coding'
        renderLeft={() => (<Icon name='arrow-back' style={{ marginLeft: 20 }} />)}
        renderRight={() => (<Icon name='add' style={{ marginRight: 20 }} />)}
        backStyle={{ marginLeft: 10 }}
        backTextStyle={{fontSize: 14, color: '#000'}}
        titleStyle={{ fontSize: 22, left: 20, bottom: 20, color: '#000' }}
        headerMaxHeight={200}
        imageSource={Bg}
        toolbarColor='#FFF'
        disabled={false}
      >
        <ScrollView>
          {getListItems(20)}
        </ScrollView>
      </AnimatedHeader>
    );
  }
  }

Properties

namedescriptiontypeisOptionaldefault
backTextBack text, leave it empty to hideStringYesundefined
titleHeader titleStringYesundefined
renderLeftTo render icon on the leftFunctionYesundefined
renderRightTo render icon on the rightFunctionYesundefined
backStyleStyle of back containerObjectYes{ marginLeft: 10 }
backTextStyleStyle of back textObjectYes{ fontSize: 16 }
titleStyleStyle of title, use left and bottom for positioning the textObjectYes{ fontSize: 20, left: 40, bottom: 30 }
toolbarColorToolbar background colorStringYes#FFF
headerMaxHeightHeight of header when expandedNumberYes200
disabledDo not allow header to collapseBooleanYesfalse
noBorderHide header separatorBooleanYesfalse
imageSourceImage background for headerImageYesundefined
parallaxUse parallax effectBooleanYesfalse

Warning

AnimatedHeader only accept 1 child, ScrollView or FlatList

Copyright and License

MIT License

Copyright (c) 2018 maphongba008

1.0.7

6 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago