Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add accessibilityLabel to Pagination #438

Merged
merged 2 commits into from
Dec 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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