Skip to content

Commit a898883

Browse files
authored
Merge pull request #32 from bamlab/fix-issues
Fix issues
2 parents 0766d13 + d11f219 commit a898883

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+1015
-8798
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
# fallback to using the latest cache if no exact match is found
2727
- v1-dependencies-
2828

29-
- run: yarn install && cd example && yarn install && cd ..
29+
- run: yarn install
3030

3131
- save_cache:
3232
paths:

.eslintignore

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1 @@
11
**/node_modules
2-
**/android
3-
**/ios
4-
**/vendors
5-
**/coverage
6-
**/flow-coverage

.eslintrc

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,7 @@
11
{
2-
"extends": [
3-
"react-app",
4-
"prettier",
5-
"prettier/flowtype",
6-
"prettier/react"
7-
],
8-
"plugins": [
9-
"flowtype",
10-
"react",
11-
"prettier"
12-
],
13-
"globals": {
14-
"__DEV__": true
15-
},
2+
"extends": ["bambi/native"],
163
"rules": {
17-
"no-use-before-define": 0,
18-
"no-unused-vars": "error",
19-
"prettier/prettier": [
20-
"error",
21-
{
22-
"trailingComma": "es5",
23-
"singleQuote": true,
24-
"printWidth": 100
25-
}
26-
]
4+
"prettier/prettier": "error",
5+
"flowtype/type-id-match": [0, ""],
276
}
287
}

.flowconfig

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,16 @@
1212
; For RN Apps installed via npm, "Libraries" folder is inside
1313
; "node_modules/react-native" but in the source repo it is in the root
1414
.*/Libraries/react-native/React.js
15-
.*/Libraries/react-native/ReactNative.js
1615

17-
.*/node_modules/react-navigation
18-
19-
; Do not remove all example to have react-native
20-
.*/example/.*
16+
; Ignore metro
17+
.*/node_modules/metro/.*
2118

2219
[include]
2320

2421
[libs]
25-
example/node_modules/react-native/Libraries/react-native/react-native-interface.js
26-
example/node_modules/react-native/flow
22+
node_modules/react-native/Libraries/react-native/react-native-interface.js
23+
node_modules/react-native/flow/
24+
node_modules/react-native/flow-github/
2725
flow/
2826

2927
[options]
@@ -35,18 +33,23 @@ munge_underscores=true
3533

3634
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
3735

36+
module.file_ext=.js
37+
module.file_ext=.jsx
38+
module.file_ext=.json
39+
module.file_ext=.native.js
40+
3841
suppress_type=$FlowIssue
3942
suppress_type=$FlowFixMe
4043
suppress_type=$FlowFixMeProps
4144
suppress_type=$FlowFixMeState
4245
suppress_type=$FixMe
4346

44-
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(5[0-3]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
45-
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(5[0-3]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
47+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
48+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
4649
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
4750
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
4851

4952
unsafe.enable_getters_and_setters=true
5053

5154
[version]
52-
^0.53.0
55+
^0.61.0

.prettierrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"trailingComma": "es5",
3+
"singleQuote": true,
4+
"bracketSpacing": true,
5+
"tabWidth": 2,
6+
"printWidth": 100
7+
}

README.md

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ render() {
2828
<HeaderImageScrollView
2929
maxHeight={200}
3030
minHeight={MIN_HEIGHT}
31-
renderHeader={() => (
32-
<Image source={require('../assets/NZ.jpg')} style={styles.image} />
33-
)}
31+
headerImage={require('../../assets/NZ.jpg')}
3432
>
3533
<View style={{ height: 1000 }}>
3634
<TriggeringView onHide={() => console.log('text hidden')} >
@@ -42,6 +40,8 @@ render() {
4240
}
4341
```
4442

43+
You can find examples in a [dedicated repository](https://github.com/bamlab/react-native-image-header-scroll-view-example).
44+
4545
## Usage (API)
4646

4747
All of the properties of `ScrollView` are supported. Please refer to the
@@ -50,31 +50,41 @@ All of the properties of `ScrollView` are supported. Please refer to the
5050
The `HeaderImageScrollView` handle also the following props. None is required :
5151

5252
### Header
53-
| Property | Type | Default | Description |
53+
54+
| Property | Type | Default | Description | Example |
5455
| -------- | ---- | ------- | ----------- |
55-
| `renderHeader` | `function` | Empty view | Function which return the component to use as header. It can return background image for example. |
56-
| `maxHeight` | `number` | `80` | Max height for the header |
57-
| `minHeight` | `number` | `125` | Min height for the header (in navbar mode) |
58-
| `minOverlayOpacity` | `number` | `0` | Opacity of a black overlay on the header before any scroll |
59-
| `maxOverlayOpacity` | `number` | `0.3` | Opacity of a black overlay on the header when in navbar mode |
60-
| `overlayColor` | `string` | `black` | Color of the overlay on the header |
56+
| `renderHeader` | `function` | Empty view | Function which return the component to use as header. It can return background image for example. | [example](https://github.com/bamlab/react-native-image-header-scroll-view-example/blob/3b9d2d0d7f71c6bf877e2d10cc65c9ab7e1b484d/src/Pages/PullToRefresh.js#L37) |
57+
| `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](https://github.com/bamlab/react-native-image-header-scroll-view-example/blob/master/src/Pages/BasicUsage.js#L26) |
58+
| `maxHeight` | `number` | `80` | Max height for the header | [example](https://github.com/bamlab/react-native-image-header-scroll-view-example/blob/master/src/Pages/BasicUsage.js#L24) |
59+
| `minHeight` | `number` | `125` | Min height for the header (in navbar mode) | [example](https://github.com/bamlab/react-native-image-header-scroll-view-example/blob/master/src/Pages/BasicUsage.js#L24) |
60+
| `minOverlayOpacity` | `number` | `0` | Opacity of a black overlay on the header before any scroll | [example](https://github.com/bamlab/react-native-image-header-scroll-view-example/blob/3b9d2d0d7f71c6bf877e2d10cc65c9ab7e1b484d/src/Pages/TvShow.js#L96) |
61+
| `maxOverlayOpacity` | `number` | `0.3` | Opacity of a black overlay on the header when in navbar mode | [example](https://github.com/bamlab/react-native-image-header-scroll-view-example/blob/3b9d2d0d7f71c6bf877e2d10cc65c9ab7e1b484d/src/Pages/TvShow.js#L96) |
62+
| `overlayColor` | `string` | `black` | Color of the overlay on the header | [example](https://github.com/bamlab/react-native-image-header-scroll-view-example/blob/master/src/Pages/Colors.js#L16) |
63+
6164

6265

6366
### Foreground
6467

6568
| Property | Type | Default | Description |
6669
| -------- | ---- | ------- | ----------- |
67-
| `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.|
68-
| `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.|
69-
| `foregroundParallaxRatio` | `number` | `1` | Ration for parallax effect of foreground when scrolling. If 2, the header goes up two times faster than the scroll |
70-
| `fadeOutForeground` | `bool` | `false` | If set, add a fade out effect on the foreground when scroll up |
71-
| `renderTouchableFixedForeground` | `function` | Empty view | Same as `renderFixedForeground` but allow to use touchable in it. [*Can cause performances issues on Android*](https://github.com/bamlab/react-native-image-header-scroll-view/issues/6)|
70+
| `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](https://github.com/bamlab/react-native-image-header-scroll-view-example/blob/master/src/Pages/TvShow.js#L112) |
71+
| `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](https://github.com/bamlab/react-native-image-header-scroll-view-example/blob/3b9d2d0d7f71c6bf877e2d10cc65c9ab7e1b484d/src/Pages/TvShow.js#L100) |
72+
| `foregroundParallaxRatio` | `number` | `1` | Ration for parallax effect of foreground when scrolling. If 2, the header goes up two times faster than the scroll | [example](https://github.com/bamlab/react-native-image-header-scroll-view-example/blob/master/src/Pages/Colors.js#L23) |
73+
| `fadeOutForeground` | `bool` | `false` | If set, add a fade out effect on the foreground when scroll up | [example](https://github.com/bamlab/react-native-image-header-scroll-view-example/blob/master/src/Pages/Colors.js#L13) |
74+
| `renderTouchableFixedForeground` | `function` | Empty view | Same as `renderFixedForeground` but allow to use touchable in it. [*Can cause performances issues on Android*](https://github.com/bamlab/react-native-image-header-scroll-view/issues/6)| [example](https://github.com/bamlab/react-native-image-header-scroll-view-example/blob/master/src/Pages/PullToRefresh.js#L45) |
75+
76+
### Mixed
77+
78+
| Property | Type | Default | Description |
79+
| -------- | ---- | ------- | ----------- |
80+
| `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](https://github.com/bamlab/react-native-image-header-scroll-view-example/blob/master/src/Pages/Avignon.js#L34) |
81+
| `scrollViewBackgroundColor` | `string` | `white` | Background color of the scrollView content | [example](https://github.com/bamlab/react-native-image-header-scroll-view-example/blob/master/src/Pages/PullToRefresh.js#L52) |
7282

7383

7484
### TriggeringView
7585

7686
The module also export a TriggeringView component. It is a simple view witch accept callback called when it disappear
77-
or appear at the top of the ImageHeaderScrollView
87+
or appear at the top of the ImageHeaderScrollView. You can see [an exemple in the dedicated repository](https://www.youtube.com/watch?v=PsgxTiif0w8&index=17&list=UUwi4cpbdkeuyYD8lDo3Z6qA).
7888

7989
All of the properties of `View` are supported.
8090

example/.babelrc

Lines changed: 0 additions & 3 deletions
This file was deleted.

example/.buckconfig

Lines changed: 0 additions & 6 deletions
This file was deleted.

example/.eslintignore

Lines changed: 0 additions & 6 deletions
This file was deleted.

example/.eslintrc

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)