I have a React-Native application. I made an alternative view for one screen for the case when VoiceOver accessibility feature is enabled. I made this using AccessibilityInfo. But I can't figure out how to check if Switch Control accessibility feature is enabled. Is it possible? Thanks.
I created a Native Module according to this doc:
https://facebook.github.io/react-native/docs/native-modules-ios
#import "RNAccessibilityManager.h"
#import <UIKit/UIKit.h>
@interface RNAccessibilityManager ()
@end
@implementation RNAccessibilityManager
RCT_EXPORT_MODULE();
RCT_EXPORT_METHOD(getCurrentSwitchControlState:(RCTResponseSenderBlock)callback)
{
callback(@[@(UIAccessibilityIsSwitchControlRunning())]);
}
@end
Linked it manually and used like this:
import RNAccessibilityManager from 'react-native-accessibility-manager'
RNAccessibilityManager.getCurrentSwitchControlState((isEnabled) => {
this.setState({
switchControlEnabled: isEnabled,
});
});