Skip to content

Commit

Permalink
Merge pull request #438 from thymikee/feat/accessible-pagination
Browse files Browse the repository at this point in the history
feat: add accessibilityLabel to Pagination
  • Loading branch information
Benoît Delmaire authored Dec 11, 2018
2 parents 85b7e68 + 2e070e2 commit 85980e5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/carousel/Carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export default class Carousel extends Component {
this._scrollOffsetRef = null;
this._onScrollTriggered = true; // used when momentum is enabled to prevent an issue with edges items
this._lastScrollDate = 0; // used to work around a FlatList bug
this._scrollEnabled = props.scrollEnabled === false ? false : true;
this._scrollEnabled = props.scrollEnabled !== false;

this._initPositionsAndInterpolators = this._initPositionsAndInterpolators.bind(this);
this._renderItem = this._renderItem.bind(this);
Expand Down
12 changes: 9 additions & 3 deletions src/pagination/Pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ export default class Pagination extends PureComponent {
inactiveDotStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,
renderDots: PropTypes.func,
tappableDots: PropTypes.bool,
vertical: PropTypes.bool
vertical: PropTypes.bool,
accessibilityLabel: PropTypes.string
};

static defaultProps = {
Expand Down Expand Up @@ -123,7 +124,7 @@ export default class Pagination extends PureComponent {
}

render () {
const { dotsLength, containerStyle, vertical } = this.props;
const { dotsLength, containerStyle, vertical, accessibilityLabel } = this.props;

if (!dotsLength || dotsLength < 2) {
return false;
Expand All @@ -139,7 +140,12 @@ export default class Pagination extends PureComponent {
];

return (
<View pointerEvents={'box-none'} style={style}>
<View
pointerEvents={'box-none'}
style={style}
accessible={!!accessibilityLabel}
accessibilityLabel={accessibilityLabel}
>
{ this.dots }
</View>
);
Expand Down
1 change: 1 addition & 0 deletions src/pagination/PaginationDot.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ export default class PaginationDot extends PureComponent {

return (
<TouchableOpacity
accessible={false}
style={dotContainerStyle}
activeOpacity={tappable ? activeOpacity : 1}
onPress={onPress}
Expand Down

0 comments on commit 85980e5

Please sign in to comment.