Getting started
AMA stands for Accessible Mobile App and contains a set of accessible components and hooks to simplify the building of accessible apps.
Installation
Install react-native-ama using either yarn
or npm
:
- npm
- Yarn
npm install --save-dev react-native-ama
yarn add --dev react-native-ama
Dependencies
Some component relies on react-native-reanimated and/or react-native-gesture-handler, so these other dependencies should also be installed.
- npm
- Yarn
npm install --save-dev react-native-reanimated
npm install --save-dev react-native-gesture-handler
npm install --save-dev wcag-color
cd ios
pod install
yarn add --dev react-native-reanimated
yarn add --dev react-native-gesture-handler
yarn add --dev wcag-color
cd ios
pod install
Config File
The installation command should have automatically generated the ama.rules.json
file. If not:
echo "{}" >> ama.rules.json
cd node_modules/react-native-ama
ln -s ../../ama.rules.json .
Jest
When running a test, if jest fails with the following error:
Cannot find module './../../ama.rules.json' from 'node_modules/react-native-ama/dist/commonjs/internal/logger.js'
add those lines to the .jest.config.js
file:
jest.mock('react-native-ama/dist/commonjs/internal/logger.js', () => {
return {
getContrastCheckerMaxDepth: () => 5,
};
});