Skip to content

Commit 44ec630

Browse files
author
yuji
committed
fixes #4 thaks @subpublicanders
1 parent 70c351a commit 44ec630

File tree

3 files changed

+32
-19
lines changed

3 files changed

+32
-19
lines changed

README.md

+24-11
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,15 @@
66

77
The best Swiper component for React Native.
88

9-
## Feature
9+
## Feature & TODO
10+
11+
- [ ] More switch effects
12+
13+
- [ ] Unit tests
14+
15+
- [ ] Check typo
16+
17+
- [ ] Optimal performance when `<Image />` re-render
1018

1119
- [x] Infinite loop
1220

@@ -24,21 +32,21 @@ The best Swiper component for React Native.
2432

2533
- [x] Autoplay
2634

27-
## Changelogs & TODO
35+
- [x] Custom pagination style
2836

29-
- [ ] More switch effects
37+
## Changelogs
3038

31-
- [ ] Unit tests
39+
- **[v1.1.0]**
3240

33-
- [ ] Check typo
41+
+ [5de06a7](https://github.com/leecade/react-native-swiper/commit/5de06a7aa86318ad38720728022b80e5cf98a2ab) New prop: `renderPagination`. (thanks [@aksonov](https://github.com/aksonov))
3442

35-
- [ ] Optimal performance when `<Image />` re-render
43+
- **[v1.0.4]**
3644

37-
- [ ] Making the `width` / `height` optional prop, use `measure` function instead
45+
+ [21cb373](https://github.com/leecade/react-native-swiper/commit/21cb3732578588f9d47ee7ddda541577ad691970) fixes [#2](https://github.com/leecade/react-native-swiper/issues/2) Solve the problem of installation. (thanks [@jamwaffles](https://github.com/jamwaffles))
3846

39-
- [x] **[v1.0.3]** fixes [#1](https://github.com/leecade/react-native-swiper/issues/1) Two 'horizontal' in propTypes. (thanks [@MacyzZ](https://github.com/MacyzZ))
47+
- [v1.0.3]
4048

41-
- [x] **[v1.0.4]** fixes [#2](https://github.com/leecade/react-native-swiper/issues/2) Solve the problem of installation. (thanks [@jamwaffles](https://github.com/jamwaffles))
49+
+ [0f796f3](https://github.com/leecade/react-native-swiper/commit/0f796f3557b5aeb1772573cd7ecae2e835bccc0b) fixes [#1](https://github.com/leecade/react-native-swiper/issues/1) Two 'horizontal' in propTypes. (thanks [@MacyzZ](https://github.com/MacyzZ))
4250

4351
## Show Cases
4452

@@ -52,6 +60,10 @@ The best Swiper component for React Native.
5260

5361
![](http://i.imgur.com/hP3f3oO.gif =300x)
5462

63+
### [examples/swiper_number.js](https://github.com/leecade/react-native-swiper/blob/master/examples/examples/swiper_number.js)
64+
65+
![](http://i.imgur.com/0rqESVb.gif =300x)
66+
5567
### [examples/phone.js](https://github.com/leecade/react-native-swiper/blob/master/examples/examples/phone.js)
5668

5769
![](http://i.imgur.com/c1BhjZm.gif =300x)
@@ -165,8 +177,9 @@ AppRegistry.registerComponent('swiper', () => swiper)
165177
| :------------ |:---------------:| :---------------:| :-----|
166178
| showsPagination | true | `bool` | Set to `true` make pagination visible. |
167179
| paginationStyle | {...} | `style` | Custom styles will merge with the default styles. |
168-
| dot | `<View style={{backgroundColor:'rgba(0,0,0,.2)', width: 8, height: 8,borderRadius: 4, marginLeft: 3, marginRight: 3, marginTop: 3, marginBottom: 3,}} />` | `element` | Allow custom the dot element |
169-
| activeDot | `<View style={{backgroundColor: '#007aff', width: 8, height: 8, borderRadius: 4, marginLeft: 3, marginRight: 3, marginTop: 3, marginBottom: 3,}} />` | `element` | Allow custom the active-dot element |
180+
| renderPagination | - | `function` | Complete control how to render pagination with two params (`index`, `total`) ref to `this.state.index` / `this.state.total`, For example: show numbers instead of dots. |
181+
| dot | `<View style={{backgroundColor:'rgba(0,0,0,.2)', width: 8, height: 8,borderRadius: 4, marginLeft: 3, marginRight: 3, marginTop: 3, marginBottom: 3,}} />` | `element` | Allow custom the dot element. |
182+
| activeDot | `<View style={{backgroundColor: '#007aff', width: 8, height: 8, borderRadius: 4, marginLeft: 3, marginRight: 3, marginTop: 3, marginBottom: 3,}} />` | `element` | Allow custom the active-dot element. |
170183

171184
#### Autoplay
172185

dist/index.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -406,15 +406,15 @@ exports['default'] = _React$StyleSheet$Text$View$ScrollView$TouchableOpacity2['d
406406
}] },
407407
_React$StyleSheet$Text$View$ScrollView$TouchableOpacity2['default'].createElement(
408408
_React$StyleSheet$Text$View$ScrollView$TouchableOpacity.ScrollView,
409-
_extends({ ref: 'scrollView',
409+
_extends({ ref: 'scrollView'
410+
}, props, {
410411
contentContainerStyle: [styles.wrapper, props.style],
411412
contentOffset: initOffset,
412-
key: key,
413-
onMomentumScrollEnd: this.onScrollEnd
414-
}, props),
413+
onMomentumScrollEnd: this.onScrollEnd,
414+
key: key }),
415415
pages
416416
),
417-
props.showsPagination && (props.renderPagination ? this.props.renderPagination(state.index, state.total) : this.renderPagination()),
417+
props.showsPagination && (props.renderPagination ? this.props.renderPagination.call(this, state.index, state.total) : this.renderPagination()),
418418
this.renderTitle(),
419419
this.props.showsButtons && this.renderButtons()
420420
);

src/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -383,15 +383,15 @@ export default React.createClass({
383383
height: state.height
384384
}]}>
385385
<ScrollView ref="scrollView"
386+
{...props}
386387
contentContainerStyle={[styles.wrapper, props.style]}
387388
contentOffset={initOffset}
388-
key={key}
389389
onMomentumScrollEnd={this.onScrollEnd}
390-
{...props}>
390+
key={key}>
391391
{pages}
392392
</ScrollView>
393393
{props.showsPagination && (props.renderPagination
394-
? this.props.renderPagination(state.index, state.total)
394+
? this.props.renderPagination.call(this, state.index, state.total)
395395
: this.renderPagination())}
396396
{this.renderTitle()}
397397
{this.props.showsButtons && this.renderButtons()}

0 commit comments

Comments
 (0)