Skip to main content

AMAProvider

You must include the provider in your app because it stores information about various accessibility services. This information is essential for the internal functioning of the library's packages and hooks. The provider manages the failure message that appears when AMA accessibility fails1.

Usage

import { AMAProvider } from 'react-native-ama';

const App = () => {
return (
<AMAProvider>
<YourApp />
</AMAProvider>
);
};

Context Values

packages/core/src/components/AMAProvider.tsx
export type AMAContextValue = {
isBoldTextEnabled: boolean,
isScreenReaderEnabled: boolean,
isGrayscaleEnabled: boolean,
isInvertColorsEnabled: boolean,
isReduceMotionEnabled: boolean,
isReduceTransparencyEnabled: boolean,
reactNavigationScreenOptions: {
animationEnabled: boolean,
animation: 'default' | 'fade',
},
trackError: (id: string) => void, // dev mode only
removeError: (id: string) => void, // dev mode only
};

Check useAMAContext for more info.

Dev mode only!

The trackError and removeError functions are available only when the DEV flag is true. These functions are stripped from the production code!


  1. This only in dev mode