Giter Club home page Giter Club logo

react-native-image-header-scroll-view's Introduction

react-native-image-header-scroll-view

badge

A ScrollView-like component that:

  • Has a fixed image header
  • Keep the image as a nav bar
  • Works on iOS and Android

Breaking changes

Version 1.0.0

/!\ Warning /!\ The lib has been upgraded to match with new React and React Native standards (hooks, deprecated methods, etc...). The version 1.0.0 may contain some bugs or regressions. Ping me in issues if you notice a bad behaviour of the upgraded lib on your project. I advice you to update the lib in a separate commit to roll back if necessary. However the lib should work for most of cases, so don't be scared to update the lib. It is a first step to improve the lib in the future, so please be understanding 😇

Installation

$ npm install react-native-image-header-scroll-view --save

Demo

react-native-image-header-scroll-view demo android|react-native-image-header-scroll-view demo ios

You can find this example code here : https://github.com/bamlab/react-native-image-header-scroll-view-example/blob/master/src/Pages/TvShow.js

Basic Usage

import { ImageHeaderScrollView, TriggeringView } from 'react-native-image-header-scroll-view';

// Inside of a component's render() method:
render() {
  return (
    <ImageHeaderScrollView
      maxHeight={200}
      minHeight={MIN_HEIGHT}
      headerImage={require("../../assets/NZ.jpg")}
      renderForeground={() => (
        <View style={{ height: 150, justifyContent: "center", alignItems: "center" }} >
          <TouchableOpacity onPress={() => console.log("tap!!")}>
            <Text style={{ backgroundColor: "transparent" }}>Tap Me!</Text>
          </TouchableOpacity>
        </View>
      )}
    >
      <View style={{ height: 1000 }}>
        <TriggeringView onHide={() => console.log("text hidden")}>
          <Text>Scroll Me!</Text>
        </TriggeringView>
      </View>
    </ImageHeaderScrollView>
  );
}

Result :

Basic Usage

You can find examples in a dedicated repository.

Usage (API)

All of the properties of ScrollView are supported. Please refer to the ScrollView documentation for more detail.

The ImageHeaderScrollView handle also the following props. None is required :

Header

Property Type Default  Description Example
renderHeader function  Empty view Function which return the component to use as header. It can return background image for example. example
headerImage Image source Props (object or number)  undefined Shortcut for renderHeader={() => <Image source={this.props.headerImage} style={{ height: this.props.maxHeight, width: Dimensions.get('window').width }} />} example
maxHeight number 125 Max height for the header example
minHeight number 80 Min height for the header (in navbar mode) example
minOverlayOpacity number 0 Opacity of a black overlay on the header before any scroll example
maxOverlayOpacity number 0.3 Opacity of a black overlay on the header when in navbar mode example
overlayColor string black Color of the overlay on the header example
useNativeDriver boolean false Use native driver for the animation for performance improvement. A few props are unsupported at the moment if useNativeDriver=true (onScroll, ScrollComponent, renderTouchableFixedForeground) -
headerContainerStyle Object undefined Optional styles to be passed to the container of the header component
disableHeaderGrow boolean undefined Disable to grow effect on the header

Foreground

Property Type Default  Description Example
renderForeground function Empty view Function which return the component to use at foreground. The component is render in front of the header and scroll with the ScrollView. It can return a title for example. example
renderFixedForeground function Empty view Function which return the component to use as fixed foreground. The component is displayed with the header but not affected by the overlay. example
foregroundExtrapolate string clamp Optional prop that allows override extrapolate mode for foreground. Use null to allow extrapolation, which is usefull for using foreground as bottom title -
foregroundParallaxRatio number 1 Ration for parallax effect of foreground when scrolling. If 2, the header goes up two times faster than the scroll example
fadeOutForeground bool false If set, add a fade out effect on the foreground when scroll up example
renderTouchableFixedForeground function Empty view Same as renderFixedForeground but allow to use touchable in it. Can cause performances issues on Android example
fixedForegroundContainerStyles Object undefined Optional styles to be passed to the container of the fixed foreground component

Mixed

Property Type Default  Description Example
ScrollViewComponent Component  ScrollView The component to be used for scrolling. Can be any component with an onScroll props (ie. ListView, FlatList, SectionList or ScrollView) example
scrollViewBackgroundColor string  white Background color of the scrollView content example

TriggeringView

The module also export a TriggeringView component. It is a spy View you put on the page that will can call various callback during the scroll. It accept callback called when it disappear or appear at the top of the ImageHeaderScrollView. You can see an exemple in the dedicated repository.

All of the properties of View are supported.

Property Type Description
onBeginHidden function  Called when the component start to be hidden at the top of the scroll view.
onHide function  Called when the component is not displayed any more after scroll up
onBeginDisplayed function  Called when the component begin to be displayed again after scroll down
onDisplay function  Called when the component finished to be displayed again.
onTouchTop function  Called when the Top of the component touch the Top of the ScrollView. (onDisplay + onBeginHidden)
onTouchBottom function  Called when the Bottom of the component touch the Top of the ScrollView. (onHide + onBeginDisplayed)

FAQ

How to remove the black image overlay

Just set the maxOverlayOpacity to 0.

<ImageHeaderScrollView
  minOverlayOpacity={0}
  maxOverlayOpacity={0}
  {/* ... */}
/>

How to remove the image zomming on scroll down

You have two solutions :

  1. You can use the disableHeaderGrow props. It will keep the ios elastic scroll effect.
  2. You can also use the bounces={false} props from the scroll view.

Results :

disableHeaderGrow bounces={false}
react-native-image-header-scroll-view demo disableHeaderGrow react-native-image-header-scroll-view demo bounces

Contributing

All contributions are welcomed, that might be either adding new features, doing some refaco of the exisiting code or fixing bugs.

How to contribute

  1. Fork the project & clone locally. Follow the initial setup here.
  2. Create a branch, naming it either a feature or bug: git checkout -b feature/that-new-feature or bug/fixing-that-bug
  3. Code and commit your changes. Write a good commit message. Best would be to use git commitizen
  4. Test your changes in the example
  • launch the Expo project: cd example && yarn start && cd ..
  • compile typescript to lib folder : `yarn tsc --noEmit``
  • watch your feature/fix in your simulator
  1. Push to the branch: git push origin feature/that-new-feature
  2. Create a pull request for your branch 🎉

Other open-source modules by the folks at BAM

react-native-image-header-scroll-view's People

Contributors

almouro avatar brunocascio avatar cstranex avatar darekg11 avatar devadattas avatar jr-k avatar michelbb avatar nhacsam avatar rostislav-simonik avatar sahith02 avatar spoutnik97 avatar sungsong88 avatar timomeh avatar tychota avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-native-image-header-scroll-view's Issues

React Native onScrollBeginDrag not very responsive to the scroll

I want the opacity to go to 0 as I start to scroll down and the opposite as I scroll up. My code currently achieves a similar effect, but not as responsive. First, it goes to opacity: 1 abruptly, not gradually, and 2) the change happens late no matter how much I change the inputRange.

    const [inputAnimation] = useState(new Animated.Value(0))
    const inputInterpolate = inputAnimation.interpolate({
        inputRange: [0, 10],
        outputRange: [1, 0]
    })

    const animatedInputStyles = {
        opacity: inputInterpolate
    }

return (
        <View
            style={[styles.upperContainer]}
        >
            <View style={styles.textInputContainer}>
                <Animated.View style={animatedInputStyles}>
                    <TextInput
                        style={styles.textInput}
                        onChangeText={text => onChangeText(text)}
                        value={value}
                    />
                </Animated.View>
            </View>
        </View>
        <HeaderImageScrollView
            contentContainerStyle={styles.container}
            maxHeight={400}
            minHeight={0}
            onScrollBeginDrag={Animated.event([
                {
                    nativeEvent: {
                        contentOffset: {
                            y: inputAnimation
                        }
                    }
                }
            ])}
        >
        </HeaderImageScrollView>
)

How do I make the opacity animation more responsive?

Improve Readme

1. Put a gif for basic usage

In https://github.com/bamlab/react-native-image-header-scroll-view#basic-usage, there is no gif so the user looks at demo gif which is not related

2. Triggering view

When reading the commentary I did not understand what is happening and why this is for.

Maybe a schematic of how the view is used like this:

image

and an small sentence about why : "triggering view is a spy view you put on the page that will can call various callback during the scroll" or something like this.

Dynamic max header height?

Hi there, this component works great but we have one issue with it: our app supports multiple languages and some of them need different max header heights to fit the header content. Would be nice to be able to grow the header if the content inside pushes its boundaries

Header image has no parallax effect

The foreground image sits still and has no parallax effect. I want to move header image slowly as well until it is fixed as header. How can I do that?

See the video here The image doesn't move up slowly as the contents below it moves upward.

<HeaderImageScrollView
	maxHeight={200}
	minHeight={50}
	minOverlayOpacity={0}
	maxOverlayOpacity={0.3}
	overlayColor="#0000ff"
	overScrollMode="always"
	fadeOutForeground={true}
	renderFixedForeground={() => (
		<View style={{}}>
			<Text style={{}}>Title</Text>
		</View>
	)}
	headerImage={require('.././img.jpg')}
	foregroundParallaxRatio={3}
>
	<View >
		<View style={{ height: 100, backgroundColor: '#4CAF50' }} />
		<View style={{ height: 100, backgroundColor: '#F44336' }} />
		<View style={{ height: 100, backgroundColor: '#009688' }} />
		<View style={{ height: 100, backgroundColor: '#03A9F4' }} />
		<View style={{ height: 100, backgroundColor: '#FF9800' }} />
		<View style={{ height: 100, backgroundColor: '#673AB7' }} />
		<View style={{ height: 100, backgroundColor: '#795548' }} />
		<View style={{ height: 100, backgroundColor: '#FFEB3B' }} />
	</View>
</HeaderImageScrollView>

phone rotation problems

on rotating the phone these problems appear:

  1. image won't resize to fit the full width.
  2. if the nav title is visible and you rotate the phone it will stay and won't animate to hidden anymore.

Cannot tap element on renderHeader

I made a Header using react native-base library to control better the Left and Right position. By doing this, the onPress function inside a Button (again, from native base) doesn't do anything

<HeaderScrolLView
    renderHeader={() => (
        <Header>
            <Left>
                <Button onPress={() => this.someFunction(someProps) >
                    <Icon name='arrow-back' />
                </Button>
            </Left>
        </Header>
    )}
>
{ . . . }
</HeaderScrollView>

Add placeholder for the header image

I've used a server data to load an image. It shows blank for a moment. How can I add the placeholder image here?

<HeaderImageScrollView
headerImage={{uri: ('http://zzz.com/' + this.state.img)}}
>
	<Text style={styles.title}>The Village Cafe</Text>
	
</HeaderImageScrollView>

Unable to use Carousel component in renderHeader prop

Hi There,

I want to customise renderHeader prop by passing carousel component.
renderHeader={() => <View style={{width: '100%', height:'100%', backgroundColor:'#2E343D'}}> <Carousel ref={(c) => { this._carousel = c; }} data={this.state.entries} renderItem={this._renderItem} sliderWidth={Dimensions.get('window').width} itemWidth={Dimensions.get('window').width} onSnapToItem={(index) => this.setState({ activeSlide: index }) } /> </View>}

But the horizontal scroll doesn't work in it. However if pass the same carousel component in renderForeground prop then it works.

Could you please advice on it?

No Text Appears

Hello, i'm trying to use the header scroll but the header is not rendering anything, I can change the Heights, Overlays and the headerContainerStyle, but when i try to put some text in the renderForeground it doesn't show or renderFixedForeground, what am I missing?

{
"react": "16.6.3",
"react-native": "0.58.4"
}

<HeaderScrollView 
  bounces={false}
  minHeight={80}
  maxHeight={300}
  minOverlayOpacity={0}
  maxOverlayOpacity={0}
  headerContainerStyle={{backgroundColor: '#F4511E'}}               
  renderForeground={() => {
    <View style={{ height: 150, justifyContent: "center", alignItems: "center" }} >
      <TouchableOpacity onPress={() => console.log("tap!!")}>
        <Text style={{ backgroundColor: "transparent" }}>Tap Me!</Text>
      </TouchableOpacity>
    </View>
  }}
>
   {this.props.children}
</HeaderScrollView>

Combining with KeyboardAvoidingView

This component works great out of the box, however, I've added a form below the header and wrapped a KeyboardAvoidingView (behavior="position") around that. This works, but the header stays in place instead of moving with the rest of the view. Some ideas on how to make those compatible would be welcome.

Touchable renderHeader

I was hoping to customize the header... maybe have a few buttons.
But the touches don't seem to persist on the renderHeader section, is there a possible workaround for that.

how to Nest a TabView ?

I am trying to use react-native-tab-view
inside the ImageHeaderScrollView component but couldn't ..
I can see that one of that components props is ScrollViewComponent of type ScrollView,
But still couldn't do it ,

screen that I am working on
41195647_607836186285132_7756739532468256768_n

TabView to nest in ImageHeaderScrollView
41177727_733386980386783_7244506953764831232_n

Cannot tap element on renderFixedForeground

Hi, tanks for this amazing component.
I'm having an issue tapping on a button inside the renderFixedForeground.
When I scroll down and the header collapses, it works perfectly.

In the following example you can see that the button is not tappable until you scroll all the way down.
Thanks in advance.

import React, { Component } from 'react';
import {
  AppRegistry,
  StyleSheet,
  Text,
  View,
  Image,
  Button
} from 'react-native';
import HeaderImageScrollView, { TriggeringView } from 'react-native-image-header-scroll-view';

export default class imageScroll extends Component {
  render() {
    return (
      <HeaderImageScrollView
        maxHeight={200}
        minHeight={58}
      
        renderFixedForeground={() => {
          return(
          <View style={styles.header}>
            <Button title="TEST" onPress={() => console.log('tap!!')}/>
          </View>)
           
        }}
        renderHeader={() => (
          <Image source={require('./photo.jpg')} style={styles.image} />
        )}
      >
        <View style={{ height: 1000 }}>
          <TriggeringView onHide={() => console.log('text hidden')} >
            <Text>Scroll Me!</Text>
            
          </TriggeringView>
        </View>
      </HeaderImageScrollView>
    );
  }
}

const styles = StyleSheet.create({
  header :{
        flex: 1,
        height: 56,
        padding: 10,
        position: 'absolute',
        top: 0,
        left: 0,
        right: 0,
        justifyContent: 'center',
  }
});

AppRegistry.registerComponent('imageScroll', () => imageScroll);

npm out of sync

Hello, it appears that the latest version on npm is 0.5.2, which has problems with React 16. I noticed it's been fixed here in the repo in version 0.6.2. Could someone update the package on npm for me?

Thanks in advance!

I also noticed that ImageHeaderScrollView.js is still importing PropTypes from prop-types even though it's not being used, and is not a dependency in package.json, so it's likely to cause some troubles :)

Scrolling trigger

Is it possible that we can somehow make the scrolling happen even if you swipe on the header? In my app I have it so the image is 80% and the content is 20%, and most people naturally try to swipe up on the middle of the page.

ios-TriggeringView nested FlatList

TriggeringView nested FlatList,Two scrolling conflicts.If you touch FlatList block,your react-native-image-header-scroll-view doesn't work.How to solve it.

Is it possible to enable grow effect on android?

Thank you for this awesome package.

It works well on IOS, but i found that there is no Grow effect on Android. Is it because of React Native restrictions about ScrollView behaviour on Android?
Is it possible to enable grow effect on android somehow?

Thanks in advance

TriggeringView not calling functions

TriggeringView onHide and onDisplay are not being called as described in the documentation.

<View style={{flex: 1}}>
    <HeaderImageScrollView
        maxHeight={150}
        minHeight={60}
        maxOverlayOpacity={1}
        minOverlayOpacity={0}
        overlayColor={'#f4f4f4'}
        foregroundParallaxRatio={1}
        fadeOutForeground
        renderHeader={() => (
            <View style={{flex: 1, justifyContent: 'center', alignItems: 'center', paddingTop: 10, backgroundColor: 'blue'}}>
                <Text>MAIN HEADER</Text>
            </View>
        )}
        renderFixedForeground={() => (
            <Animatable.View style={{flex: 1, height: 60}} ref={fixedForegroundView => {this.fixedForegroundView = fixedForegroundView;}}>
                <Text style={{backgroundColor:'red', height: 60}}>SCROLLED HEADER</Text>
            </Animatable.View>
        )}>
        <View style={{flex: 1, height: 600, paddingVertical: 15, backgroundColor:'yellow'}}>
            <TriggeringView
                onHide={() => this.fixedForegroundView.fadeInUp(200)}
                onDisplay={() => this.fixedForegroundView.fadeOut(100)}>
                <View style={{flex: 1}}>
                    <Text>MAIN CONTENT</Text>
                </View>
            </TriggeringView>
        </View>
    </HeaderImageScrollView>
</View>
"react": "^16.2.0",
"react-native": "0.49.5",
"react-native-image-header-scroll-view": "^0.7.0",

TriggeringView doesn't update threshold if renderHeader() component updates its height

Hey, first of all, thank you for this amazing work!

I'm using it in a special scenario where the header component height is calculated dynamically (using react-native-auto-height-image).

This would be my code:

import React, {Component} from "react";
import {Text, View} from "react-native";

import AutoHeightImage from 'react-native-auto-height-image';
import HeaderImageScrollView, {TriggeringView} from 'react-native-image-header-scroll-view';

const DEFAULT_HEADER_HEIGHT = 500;

export default class WallScreen extends Component {

    componentWillMount() {
        this._setHeaderHeight(DEFAULT_HEADER_HEIGHT);
    }

    render() {

        return (
            <View style={styles.container}>

                <HeaderImageScrollView
                    maxHeight={this.props.headerHeight} // Prop coming from redux state.
                    minHeight={0}
                    fadeOutForeground={true}
                    renderHeader={this._renderHeader.bind(this)}
                >

                    <TriggeringView
                        onHide={this._onHide.bind(this)}
                        onDisplay={this._onDisplay.bind(this)}
                    >
                    </TriggeringView>

                    <Text>
                        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aliquam asperiores at commodi cumque
                        dolor dolorum, ea eaque est excepturi nam, perferendis perspiciatis, porro! A illo ipsa itaque
                        quae rerum unde?
                    </Text>

                </HeaderImageScrollView>

            </View>
        );

    }

    _setHeaderHeight(height){
        // Here I would dispatch the redux action to update 'headerHeight'.
    }

    _renderHeader() {
        return (
            <View>
                <AutoHeightImage
                    width={360} // Hardcoded, not important for this example
                    imageURL='https://example.com'
                    onHeightChange={this._setHeaderHeight.bind(this)}
                />
            </View>
        );
    }

    _onHide() {
        console.log('On hide called');
    }

    _onDisplay() {
        console.log('On display called')
    }

}

Until now, all great! All the layout works great out of the box and my code updates the header height correctly!

BUT the problem comes with TriggeringView.
As you can see, the header height is initialized at 500. Well, as I update the headerHeight prop via redux, TriggeringView will still trigger the onHide and onDisplay callbacks using the 500 initial height.

I took a look at the source and saw that the triggering threshold is based in the initialPageY property, and this property is calculated in the onLayout hook.
So the problem is this that hook is not triggered when the header height changes.

PS: I fixed this adding a new dynamicHeaderHeight prop to HeaderScrollView. Will submit a PR today!

Thanks!

It is possible to pass other libraries for loading images

For example, I want to change the navita library of react native to download the images and be able to pass a library like:
https://github.com/DylanVann/react-native-fast-image

and to be able to put a preload:
https://github.com/oblador/react-native-image-progress

For if not lose the effect of interpolation of the image when it is mobilized.
since the properties to be able to make a custom headerRender are not exported or propagated to the renderHeader function.

Typo in declaration file

Hello, you have a small typo in declaration file at 36:32

in interface HeaderImageScrollViewProps
foregroundExtrapolate: ?string;

I found one more :)

interface SourceObjectProps at 10:21

uri?: string,

Transparent background

Is there a way to make the foreground have transparent background?
I want to have a list of cards floating above the header, but my content always have a white background and I haven't found any way to remove it.

Not rendering

Hi, I was using the 0.6version and it was working fine, although sometimes the component was not rendering but only seldom. Then I upgraded Android Studio and compiled a release apk and it was not working anymore. Went back to dev mode and still not working. Upgraded to latest version .8something just now and still not rendering. The component is showing in dev tools. I am using Android 5.0 on a Note3, RN 0.50, react 16.0.0-alpha.12. Haven t tested on a newer device yet. Any idea what is happening? I am out of options. Thanks!

PS. I also excluded all other components to make sure there is no conflict or so.

border radius not working

i've tried both border Bottom Left and Right Radius inside the HeaderImageScrollView, but still no result, i tested this on default navigation options on different headers and everything working fine, but this specific header scroll is having issues, i've tried inside a view, outside the headerimagescrollview, inside contentContainerStyle, inside style={} with a custom stylesheet, and nothing, i don't want to drop this awesome header and start all over again on a different component just because the radius is not showing, i've already spent an entire day figuring this out

TriggeringView on Android

Apparently exactly the same code for the TriggeringView doesnt work properly on an Android.

Here is the code:

<TriggeringView
    onHide={() => alert("Hide")}
    onBeginDisplayed={() => alert("Show")}
>
<View style={{ flex: 1 }}>
<Text>Show and hide me</Text>
</View>
</TriggeringView>

The exact same code works just fine on iOS.

和react-navigation的TabNavigator一起使用

你好,感谢你制作了这么棒的组件
问题:
我想把这项目和react-navigationTabNavigator一起使用
类似效果:
debug
我实现的效果:
debug
具体实现(重现):
链接
想要得到的帮助:
我的疑问来自于我的实现的TabNavigator不可以向下滑动,希望能告诉我是否可以这样使用

Prevent FixedForeground scaling

Currently, if the scroll view is at the top when user tries to scroll to the top again the image will scale with the FixedForeground element. Can I disable the scaling for the FixedForeground element? So only the background image is scaled

performance while scrolling - android

Hey, i do have a major performance issue on android while scrolling in header.

Are there any restrictions what content should be after the TriggeringView ?

How to custom Image and text bar header?

How are you, Nhacsam?

I have to create animation header like this.
https://cdn.dribbble.com/users/194567/screenshots/1716385/movie_animation_phone2.gif

I have installed react-native-image-header-scroll-view npm package.
This is my code:

render() {
	return (
			<HeaderImageScrollView
				maxHeight={200}
				minHeight={HEADER_MIN_HEIGHT}
				minOverlayOpacity={0}
				maxOverlayOpacity={0}
				bounces={false}
				headerImage={require("../../../assets/drawer-cover.png")}
				renderForeground={() => (
					<View style={{ height: 150, justifyContent: "center", alignItems: "center" }} >
						<TouchableOpacity onPress={() => console.log("tap!!")}>
							<Text style={{ backgroundColor: "transparent" }}>Tap Me!</Text>
						</TouchableOpacity>
					</View>
				)}
				>
				<View style={{ height: 1000 }}>
					<TriggeringView onHide={() => console.log("text hidden")}>
						<Text>Scroll Me!</Text>
					</TriggeringView>
					<Text>Teenage Mutant Ninja Tutles(2014)</Text>
				</View>
				
			</HeaderImageScrollView>

	);
}

Is it possible to implement my animation by using your component?
If yes, could you please tell me how can I write code to get same animation of my thought?
I am looking forward to hearing good news from you :)

Thanks

Height of the ScrollView and of its content is broken

The layout is broken to a point where unfortunately I can't use the package (at least with a flexible height of the ScrollView).

  1. The height of the HeaderImageScrollView is the available space, plus the current height of the header.
  2. On Android, the ScrollView content has a height content_height - (current height of the header). So if the content is smaller than the header, it isn't visible at all. If the content is taller than the header, it is visible, but minus the height of the header.
    I'm not quite sure if that's the whole story, but it's everything I could inspect. I can't wrap my head completely around it.

Here's is a screenshot of three views, each with a height of 100 and a header-height of 150, in iOS. (The header is the transparent thing above the colored views)

image

Here's the same on Android.

image

The render function is pretty straight forward:

      <View style={{ flex: 1 }}>
        <HeaderImageScrollView
          maxHeight={150}
          minHeight={80}
          renderHeader={this._renderTitleBackground}
          renderForeground={this._renderTitleForeground}
          renderFixedForeground={this._renderStickyHeader}
          fadeOutForeground
        >
          <View style={{ height: 100, backgroundColor: 'blue' }} />
          <View style={{ height: 100, backgroundColor: 'red' }} />
          <View style={{ height: 100, backgroundColor: 'green' }} />
        </HeaderImageScrollView>
      </View>

Typescript definitions for this library

Hi, I was wondering if you guys are interested in type definitions for this library. I would gladly contribute to it as I can see you have some sort of definitions already in the readme file.

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.