Skip to content
Open
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
6 changes: 6 additions & 0 deletions packages/react-native/Libraries/Image/ImageBackground.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,26 @@ class ImageBackground extends React.Component<ImageBackgroundProps> {
imageStyle,
imageRef,
importantForAccessibility,
'aria-hidden': ariaHidden,
accessibilityElementsHidden,
...props
} = this.props;

// $FlowFixMe[underconstrained-implicit-instantiation]
const flattenedStyle = flattenStyle(style);
return (
<View
accessibilityElementsHidden={accessibilityElementsHidden}
accessibilityIgnoresInvertColors={true}
aria-hidden={ariaHidden}
importantForAccessibility={importantForAccessibility}
style={style}
ref={this._captureRef}>
{/* $FlowFixMe[incompatible-use] */}
<Image
{...props}
accessibilityElementsHidden={accessibilityElementsHidden}
aria-hidden={ariaHidden}
importantForAccessibility={importantForAccessibility}
style={[
StyleSheet.absoluteFill,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,32 @@ describe('<ImageBackground>', () => {
);
});
});

describe('aria-hidden', () => {
it('is set on both the wrapper `View` and the inner `Image`', () => {
const root = Fantom.createRoot();

Fantom.runTask(() => {
root.render(
<ImageBackground
aria-hidden={true}
style={{width: 150, height: 50}}
source={{uri: 'foo-bar.jpg'}}
/>,
);
});

expect(
root
.getRenderedOutput({props: ['importantForAccessibility']})
.toJSX(),
).toEqual(
<rn-view importantForAccessibility="no-hide-descendants">
<rn-image importantForAccessibility="no-hide-descendants" />
</rn-view>,
);
});
});
});

describe('ref', () => {
Expand Down
Loading