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

Add testID and AccessibilityLabel for automation #159

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# This project is a fork of the project: [react-native-actionsheet](https://github.com/beefe/react-native-actionsheet) . With the changes to accept test id props for your automation. I open a pr to put this in the original lib, but I had no response, follow the link to see the pr: https://github.com/beefe/react-native-actionsheet/pull/159/files

# react-native-actionsheet
Cross platform ActionSheet. This component implements a custom ActionSheet and provides the same way to drawing it on the defferent platforms(iOS and Android). Actually, In order to keep the best effect, it still uses the ActionSheetIOS on iOS.

Expand All @@ -17,7 +19,7 @@ Cross platform ActionSheet. This component implements a custom ActionSheet and
## Install

```
npm install react-native-actionsheet --save
npm i @henriquealbertbill/react-native-actionsheet
```

## Usage
Expand All @@ -39,6 +41,8 @@ class Demo extends React.Component {
options={['Apple', 'Banana', 'cancel']}
cancelButtonIndex={2}
destructiveButtonIndex={1}
testID={'testIdNameHere'}
accessibilityLabel={'accessibilityLabelNameHere'}
onPress={(index) => { /* do something */ }}
/>
</View>
Expand All @@ -53,7 +57,7 @@ class Demo extends React.Component {
so you can customize option and title

```js
import { ActionSheetCustom as ActionSheet } from 'react-native-actionsheet'
import { ActionSheetCustom as ActionSheet } from '@henriquealbertbill/react-native-actionsheet'

const options = [
'Cancel',
Expand Down Expand Up @@ -167,4 +171,16 @@ https://github.com/beefe/react-native-actionsheet/blob/master/lib/options.js
<td></td>
<td>{}</td>
</tr>
<tr>
<td>testID</td>
<td></td>
<td>PropTypes.string or PropTypes.element</td>
<td></td>
</tr>
<tr>
<td>accessibilityLabel</td>
<td></td>
<td>PropTypes.string or PropTypes.element</td>
<td></td>
</tr>
</table>
3 changes: 3 additions & 0 deletions lib/ActionSheetCustom.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ class ActionSheet extends React.Component {
return (
<TouchableHighlight
key={index}
accessible={true}
accessibilityLabel={title}
testID={title}
activeOpacity={1}
underlayColor={buttonUnderlayColor}
style={buttonBoxStyle}
Expand Down