not get any warning
YOEL311 opened this issue · comments
I installed the library according to the instructions
But I do not get any warning about TouchableOpacity
What should I do?
eslintrc.js
module.exports = {
root: true,
extends: ['@react-native-community', 'plugin:react-native-a11y/ios'],
};
package.json
{
"name": "reduxTs",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx"
},
"dependencies": {
"@reduxjs/toolkit": "^1.5.0",
"react": "16.13.1",
"react-native": "0.63.4",
"react-native-fingerprint-scanner": "^6.0.0",
"react-native-touch-id": "^4.4.1",
"react-redux": "^7.2.2",
"redux-thunk": "^2.3.0"
},
"devDependencies": {
"@babel/core": "^7.8.4",
"@babel/runtime": "^7.8.4",
"@react-native-community/eslint-config": "^1.1.0",
"@types/jest": "^25.2.3",
"@types/react-native": "^0.63.2",
"@types/react-redux": "^7.1.16",
"@types/react-test-renderer": "^16.9.2",
"babel-jest": "^25.1.0",
"babel-plugin-module-resolver": "^4.1.0",
"eslint": "^7.20.0",
"eslint-config-airbnb": "^18.2.1",
"eslint-config-prettier": "^7.2.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-react": "^7.22.0",
"eslint-plugin-react-native-a11y": "^2.0.4",
"jest": "^25.1.0",
"metro-react-native-babel-preset": "^0.59.0",
"prettier": "^2.2.1",
"react-test-renderer": "16.13.1",
"typesafe-actions": "^5.1.0",
"typescript": "^3.8.3"
},
"jest": {
"preset": "react-native",
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
]
}
}
hey @YOEL311 -- please can you provide an example of your component where you would expect to see an error, or maybe a reproduction on CodeSandbox? thanks
Well, It's very easy to reproduce.
Here is the repo with the bug (or I forgot something / did not read docs well):
https://github.com/majirosstefan/accesibility-label-not-working
I also tried eslint to downgrade eslint to version 6.5.0 - still not working. I pushed the version with downgraded Eslint 6.5 into branch "eslint-6.5.0" in the same repository.
Any ideas, how I can solve this?
After downgrading to 1.3.0, and using eslint ^6.5.1 it works as expected. (example for reproducing this was also pushed into a branch called 1.3.0-lib in the same repo).
I also needed to edit eslintrc.js file:
module.exports = {
root: true,
extends: ['@react-native-community', 'plugin:react-native-a11y/recommended'],
// I needed to use "recommended" instead of "all"
};
Update: Actually, no, still not working, I have just read console.logs from this (previous) step wrong.
Any updates / tips / hints, guys?
Just to save few minutes to somebody else, I have figured it out - you need to add accessibilityLabel manually, then linting works - it says you are missing some additional props. (My expectation was that it works on all TouchableOpacity / Pressable, TouchableHiglights, etc by default).
Same here, I expected that it would show a warning if there weren't any accessibility properties. But as @majirosstefan mentioned, the warning only appears after you add an accessibilityLabel
property
thanks all for sharing the updates here! 🙇🏻♂️
this is our current intended behaviour -- this library will validate and ensure correct usage of a11y props when they are in use, but it doesn't force you to implement the props every single time you use a <Touchable*/>
or <Pressable />
component.