Skip to content

Commit 77ea107

Browse files
committed
Add API documentation
1 parent f7216b7 commit 77ea107

File tree

9 files changed

+31
-11
lines changed

9 files changed

+31
-11
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,26 @@ render() {
4343
All of the properties of `ScrollView` are supported. Please refer to the
4444
[`ScrollView` documentation](https://facebook.github.io/react-native/docs/scrollview.html) for more detail.
4545

46+
The `HeaderImageScrollView` handle also the following props. None is required :
47+
48+
### Header
49+
| Property | Type | Default | Description |
50+
| -------- | ---- | ------- | ----------- |
51+
| `renderHeader` | `function` | Empty view | Function which return the component to use as header. It can return background image for example. |
52+
| `maxHeight` | `number` | `80` | Max height for the header |
53+
| `minHeight` | `number` | `125` | Min height for the header (in navbar mode) |
54+
| `minOverlayOpacity` | `number` | `0` | Opacity of a black overlay on the header before any scroll |
55+
| `maxOverlayOpacity` | `number` | `0.3` | Opacity of a black overlay on the header when in navbar mode |
56+
57+
58+
### Foreground
59+
60+
| Property | Type | Default | Description |
61+
| -------- | ---- | ------- | ----------- |
62+
| `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.|
63+
| `foregroundParallaxRatio` | `number` | `1` | Ration for parallax effect of foreground when scrolling. If 2, the header goes up two times faster than the scroll |
64+
| `fadeOutForeground` | `bool` | `false` | If set, add a fade out effect on the foreground when scroll up |
65+
4666
## Other open-source modules by the folks at [BAM](http://github.com/bamlab)
4767

4868
* [generator-rn-toolbox](https://github.com/bamlab/generator-rn-toolbox)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/index.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -144,28 +144,28 @@ class ImageHeaderScrollView extends Component {
144144
}
145145

146146
ImageHeaderScrollView.propTypes = {
147-
renderHeader: React.PropTypes.func,
148-
renderForeground: React.PropTypes.func,
149-
maxHeight: React.PropTypes.number,
150-
minHeight: React.PropTypes.number,
151147
children: React.PropTypes.node || React.PropTypes.nodes,
152-
maxOverlayOpacity: React.PropTypes.number,
153-
minOverlayOpacity: React.PropTypes.number,
154148
childrenStyle: View.propTypes.style,
155-
foregroundParallaxRatio: React.PropTypes.number,
156149
fadeOutForeground: React.PropTypes.bool,
150+
foregroundParallaxRatio: React.PropTypes.number,
151+
maxHeight: React.PropTypes.number,
152+
maxOverlayOpacity: React.PropTypes.number,
153+
minHeight: React.PropTypes.number,
154+
minOverlayOpacity: React.PropTypes.number,
155+
renderForeground: React.PropTypes.func,
156+
renderHeader: React.PropTypes.func,
157157
...ScrollView.propTypes,
158158
};
159159

160160
ImageHeaderScrollView.defaultProps = {
161+
fadeOutForeground: false,
162+
foregroundParallaxRatio: 1,
161163
maxHeight: 125,
162-
minHeight: 80,
163164
maxOverlayOpacity: 0.3,
165+
minHeight: 80,
164166
minOverlayOpacity: 0,
165-
renderHeader: () => <View />,
166167
renderForeground: () => <View />,
167-
foregroundParallaxRatio: 1,
168-
fadeOutForeground: false,
168+
renderHeader: () => <View />,
169169
};
170170

171171
export default ImageHeaderScrollView;

0 commit comments

Comments
 (0)