Skip to content

Commit

Permalink
fix: accessibilityIgnoresInvertColors prop not recognised when using …
Browse files Browse the repository at this point in the history
…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`
  • Loading branch information
jpdriver authored Jul 17, 2020
1 parent 184eecb commit 22f89e4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
ShadowStyleIOS,
StyleProp,
TransformsStyle,
AccessibilityProps,
} from 'react-native'

const FastImageViewNativeModule = NativeModules.FastImageView
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 22f89e4

Please sign in to comment.