Skip to main content
Version: 0.7.x

useAMAContext

Returns the AMAProvider context values.

Usage

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

const {
isReduceTransparencyEnabled: boolean,
isBoldTextEnabled: boolean,
isGrayscaleEnabled: boolean,
isInvertColorsEnabled: boolean,
isReduceMotionEnabled: boolean,
isScreenReaderEnabled: boolean,
reactNavigationScreenOptions: {
animationEnabled: boolean;
animation: 'default' | 'fade';
}
} = useAMAContext();

isReduceTransparencyEnabled
iOS

Is true if the user switched on the accessibility setting: Reduce Transparency.

isBoldTextEnabled
iOS

Is true if the user switched on the accessibility setting: Bold Text.

isGrayscaleEnabled
iOS

Is true if the user switched on the accessibility setting: Grayscale.

isInvertColorsEnabled
iOS

Is true if the user switched on the accessibility setting: Invert colors.

isReduceMotionEnabled

Is true if the user switched on the accessibility setting: Reduce motion on iOS or switches off the Animations on Android.

note

On Android, this option relies on a custom code as the react-native one only detects if the "Transition Animation Scale" in "Developer options" is "Animation off".

isScreenReaderEnabled

Is true if the user is using a screen reader, like VoiceOver or Talkback.

reactNavigationScreenOptions

Returns an object to be used for the React Navigation screenOptions prop. It's an object containing the following values:

animationEnabled: boolean;
animation: 'default' | 'fade';

Example

const { reactNavigationScreenOptions } = useAMAContext();

return (
<NavigationContainer>
<Stack.Navigator
screenOptions={reactNavigationScreenOptions}>
{/* ... */}
</Stack.Navigator>
</NavigationContainer>
)