Using AccessibilityInfo with SDK 33

I’m working on my first React Native app and I want to use the AccessibilityInfo API as described in the expo documentation here: https://docs.expo.io/versions/v33.0.0/react-native/accessibilityinfo/

The example on that page is straight forward but there’s one thing missing: where do I import AccessibilityInfo from? My IDE autocomplete suggests to import {AccessibilityInfo} from "react-native-web"; but that seems wrong because I understand that react-native-web is to help bring react-native features into a web app.

So instead I do import {AccessibilityInfo} from "react-native";

But when I try to do the following in my component:

componentDidMount () {
    AccessibilityInfo.isScreenReaderEnabled().then( (screenReaderEnabled) => {
        console.log(screenReaderEnabled);
    });
}

I get a “TypeError: _reactNative.AccessibilityInfo.isScreenReaderEnabled is not a function”.

According to my IDE’s autocomplete, the AccessibilityInfo module only has the following methods: addEventListener , announceForAccessibilty , fetch , removeEventListener , setAccessibilityFocus . But according to the expo documentation linked above, I should have other methods such as isScreenReaderEnabled .

My only guess is that I’m not importing the correct module. But I didn’t find anything interesting while googling around. So can anyone point me in the right direction to help me solve that problem?

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.