/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
'use strict';
const React = require('react');
const {
StyleSheet,
Text,
View,
TouchableWithoutFeedback,
} = require('react-native');
const RNTesterBlock = require('./RNTesterBlock');
const RNTesterPage = require('./RNTesterPage');
const importantForAccessibilityValues = [
'auto',
'yes',
'no',
'no-hide-descendants',
];
class AccessibilityAndroidExample extends React.Component {
state = {
count: 0,
backgroundImportantForAcc: 0,
forgroundImportantForAcc: 0,
};
_addOne = () => {
this.setState({
count: ++this.state.count,
});
};
_changeBackgroundImportantForAcc = () => {
this.setState({
backgroundImportantForAcc: (this.state.backgroundImportantForAcc + 1) % 4,
});
};
_changeForgroundImportantForAcc = () => {
this.setState({
forgroundImportantForAcc: (this.state.forgroundImportantForAcc + 1) % 4,
});
};
render() {
return (
Click me
Clicked {this.state.count} times
Hello
world
Change importantForAccessibility for background layout.
Background layout importantForAccessibility
{
importantForAccessibilityValues[
this.state.backgroundImportantForAcc
]
}
Change importantForAccessibility for forground layout.
Forground layout importantForAccessibility
{
importantForAccessibilityValues[
this.state.forgroundImportantForAcc
]
}
);
}
}
const styles = StyleSheet.create({
embedded: {
backgroundColor: 'yellow',
padding: 10,
},
container: {
flex: 1,
backgroundColor: 'white',
padding: 10,
height: 150,
},
});
exports.title = 'AccessibilityAndroid';
exports.description = 'Android specific Accessibility APIs.';
exports.examples = [
{
title: 'Accessibility elements',
render(): React.Element {
return ;
},
},
];