Skip to content

Commit 22f89e4

Browse files
authored
fix: accessibilityIgnoresInvertColors prop not recognised when using TypeScript (#666)
- in testing [eslint-plugin-react-native-a11y](https://github.com/FormidableLabs/eslint-plugin-react-native-a11y) with `react-native-fast-image`, I noticed that a11y props such as `accessibilityIgnoresInvertColors` are missing from FastImage's TypeScript definitions - in theory the "proper" fix for this would be to make `FastImageProps` extend `ImagePropsBase` from React Native, because ultimately FastImage [spreads Props down](https://github.com/DylanVann/react-native-fast-image/blob/master/src/index.tsx#L150-L160) to React Native's Image component (including a11y props) - attempting this "proper" fix proved problematic in practice due to incompatibilities between the two interfaces - instead rather than extending the entirety of `ImagePropsBase` (which itself extends `AccessibilityProps`) we can resolve this by simply also extending `AccessibilityProps`
1 parent 184eecb commit 22f89e4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/index.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
ShadowStyleIOS,
1111
StyleProp,
1212
TransformsStyle,
13+
AccessibilityProps,
1314
} from 'react-native'
1415

1516
const FastImageViewNativeModule = NativeModules.FastImageView
@@ -78,7 +79,7 @@ export interface ImageStyle extends FlexStyle, TransformsStyle, ShadowStyleIOS {
7879
opacity?: number
7980
}
8081

81-
export interface FastImageProps {
82+
export interface FastImageProps extends AccessibilityProps {
8283
source: Source | number
8384
resizeMode?: ResizeMode
8485
fallback?: boolean

0 commit comments

Comments
 (0)