From 22f89e43a422150412924da9fd0f3eca7dd77cfa Mon Sep 17 00:00:00 2001 From: JP Date: Fri, 17 Jul 2020 06:15:49 +0100 Subject: [PATCH] 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` --- src/index.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/index.tsx b/src/index.tsx index 53627b7..4734a78 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -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