Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Libraries/Components/ScrollView/ScrollViewStickyHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class ScrollViewStickyHeader extends React.Component<Props, State> {
// Fabric Detection
// eslint-disable-next-line dot-notation
const isFabric = !!(
this._ref && this._ref['_internalInstanceHandle']?.stateNode?.canonical
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll have to revert this. As I've learned from @TheSavior our babel transform has issues with _ prefixed properties

this._ref && this._ref._internalInstanceHandle?.stateNode?.canonical
);

// Initially and in the case of updated props or layout, we
Expand Down
62 changes: 62 additions & 0 deletions RNTester/js/examples/Accessibility/AccessibilityExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,62 @@ class AnnounceForAccessibility extends React.Component<{}> {
}
}

class DisplayOptionsStatusExample extends React.Component<{}> {
render() {
return (
<View>
<DisplayOptionStatusExample
optionName={'Bold Text'}
optionChecker={AccessibilityInfo.isBoldTextEnabled}
notification={'boldTextChanged'}
/>
<DisplayOptionStatusExample
optionName={'Grayscale'}
optionChecker={AccessibilityInfo.isGrayscaleEnabled}
notification={'grayscaleChanged'}
/>
<DisplayOptionStatusExample
optionName={'Invert Colors'}
optionChecker={AccessibilityInfo.isInvertColorsEnabled}
notification={'invertColorsChanged'}
/>
<DisplayOptionStatusExample
optionName={'Reduce Motion'}
optionChecker={AccessibilityInfo.isReduceMotionEnabled}
notification={'reduceMotionChanged'}
/>
<DisplayOptionStatusExample
optionName={'Reduce Transparency'}
optionChecker={AccessibilityInfo.isReduceTransparencyEnabled}
notification={'reduceTransparencyChanged'}
/>
</View>
);
}
}

function DisplayOptionStatusExample({optionName, optionChecker, notification}) {
const [statusEnabled, setStatusEnabled] = React.useState(false);
React.useEffect(() => {
AccessibilityInfo.addEventListener(notification, setStatusEnabled);
optionChecker().then(isEnabled => {
setStatusEnabled(isEnabled);
});
return function cleanup() {
AccessibilityInfo.removeEventListener(notification, setStatusEnabled);
};
}, [optionChecker, notification]);
return (
<View>
<Text>
{optionName}
{' is '}
{statusEnabled ? 'enabled' : 'disabled'}.
</Text>
</View>
);
}

exports.title = 'Accessibility';
exports.description = 'Examples of using Accessibility APIs.';
exports.examples = [
Expand Down Expand Up @@ -783,6 +839,12 @@ exports.examples = [
return <ScreenReaderStatusExample />;
},
},
{
title: 'Check if the display options are enabled',
render(): React.Element<typeof DisplayOptionsStatusExample> {
return <DisplayOptionsStatusExample />;
},
},
{
title: 'Check if the screen reader announces',
render(): React.Element<typeof AnnounceForAccessibility> {
Expand Down