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`
This commit is contained in:
JP 2020-07-17 06:15:49 +01:00 committed by GitHub
parent 184eecb121
commit 22f89e43a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -10,6 +10,7 @@ import {
ShadowStyleIOS,
StyleProp,
TransformsStyle,
AccessibilityProps,
} from 'react-native'
const FastImageViewNativeModule = NativeModules.FastImageView
@ -78,7 +79,7 @@ export interface ImageStyle extends FlexStyle, TransformsStyle, ShadowStyleIOS {
opacity?: number
}
export interface FastImageProps {
export interface FastImageProps extends AccessibilityProps {
source: Source | number
resizeMode?: ResizeMode
fallback?: boolean