Skip to content

Commit 85980e5

Browse files
author
Benoît Delmaire
authored
Merge pull request #438 from thymikee/feat/accessible-pagination
feat: add accessibilityLabel to Pagination
2 parents 85b7e68 + 2e070e2 commit 85980e5

3 files changed

Lines changed: 11 additions & 4 deletions

File tree

src/carousel/Carousel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export default class Carousel extends Component {
126126
this._scrollOffsetRef = null;
127127
this._onScrollTriggered = true; // used when momentum is enabled to prevent an issue with edges items
128128
this._lastScrollDate = 0; // used to work around a FlatList bug
129-
this._scrollEnabled = props.scrollEnabled === false ? false : true;
129+
this._scrollEnabled = props.scrollEnabled !== false;
130130

131131
this._initPositionsAndInterpolators = this._initPositionsAndInterpolators.bind(this);
132132
this._renderItem = this._renderItem.bind(this);

src/pagination/Pagination.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ export default class Pagination extends PureComponent {
2626
inactiveDotStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,
2727
renderDots: PropTypes.func,
2828
tappableDots: PropTypes.bool,
29-
vertical: PropTypes.bool
29+
vertical: PropTypes.bool,
30+
accessibilityLabel: PropTypes.string
3031
};
3132

3233
static defaultProps = {
@@ -123,7 +124,7 @@ export default class Pagination extends PureComponent {
123124
}
124125

125126
render () {
126-
const { dotsLength, containerStyle, vertical } = this.props;
127+
const { dotsLength, containerStyle, vertical, accessibilityLabel } = this.props;
127128

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

141142
return (
142-
<View pointerEvents={'box-none'} style={style}>
143+
<View
144+
pointerEvents={'box-none'}
145+
style={style}
146+
accessible={!!accessibilityLabel}
147+
accessibilityLabel={accessibilityLabel}
148+
>
143149
{ this.dots }
144150
</View>
145151
);

src/pagination/PaginationDot.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ export default class PaginationDot extends PureComponent {
133133

134134
return (
135135
<TouchableOpacity
136+
accessible={false}
136137
style={dotContainerStyle}
137138
activeOpacity={tappable ? activeOpacity : 1}
138139
onPress={onPress}

0 commit comments

Comments
 (0)