1.0.1 • Published 8 years ago

react-native-image-header v1.0.1

Weekly downloads
20
License
ISC
Repository
github
Last release
8 years ago

react-native-image-header

A cool scrollable header for react-native

react-native-circular-action-menu demo

Installation

npm i react-native-image-header --save

Usage

First, require it from your app's JavaScript files with:

import ImageHeader from 'react-native-image-header';
ImageHeader

ImageHeader component is the main component which wraps everything and provides a couple of props (see Config below).

Example

The following example can be found in Example/Example.js.

import React from 'react';
import {
  View,
  Text,
  Dimensions,
  Image,
  StyleSheet,
  TouchableOpacity
} from 'react-native';
import ImageHeader from '../ImageHeader';

const styles = StyleSheet.create({
  userImage: {
    width: 50,
    height: 50,
    marginHorizontal: 15
  },
  foregroundContainer: {
    width: Dimensions.get('window').width,
    height: 140,
    flex: 1,
    flexDirection: 'row',
    alignItems: 'center'
  },
  logoutButton: {
    position: 'absolute',
    top: 60,
    right: 15
  }
});

const backgroundImage = require('./backgroundImage.png');
const donaldDuck = require('./donaldduck.png');

const Example = () => {
  return (
    <ImageHeader
      backgroundImage={backgroundImage}
      headerChildren={
        <View style={styles.foregroundContainer}>
          <Image
            source={donaldDuck}
            style={styles.userImage}
            resizeMode="contain"
          />
          <View style={{ backgroundColor: 'transparent' }}>
            <Text style={{ color: '#FFF', fontSize: 23 }}>Donald Duck</Text>
            <Text style={{ color: '#FFF', fontSize: 20 }}>d.duck</Text>
          </View>
          <View style={styles.logoutButton}>
            <TouchableOpacity>
              <Text style={{ color: '#FFF', fontSize: 17 }}>Logout</Text>
            </TouchableOpacity>
          </View>
        </View>
      }
    >
      <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center', height: 600 }}>
        <Text>Content</Text>
      </View>
    </ImageHeader>
  )
};

Configuration

ImageHeader:
PropertyTypeDefaultDescription
backgroundImagenumbernullbackground image for the header
maxHeightnumber125max height of the header
minHeightnumber80min height of the header
titleScalenumber0.8affects what the headerChildren scales down to
childrennode/nodesnullcontent for the actual view below the header.
headerChildrennode/nodesnullcontent that is seen in the header.
statusBarThemestringdefaultmust be default or light-content
titleTranslateYnumber-35affects the translate of the headerChildren as the view is being scrolled up
childrenBackgroundColorstring"#FFF"background color of the content below the header.
1.0.1

8 years ago

1.0.0

8 years ago

0.0.11

8 years ago

0.0.10

8 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago