Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with any custom components aliased as Image #92

Open
FrederickEngelhardt opened this issue Apr 17, 2020 · 2 comments
Open

Error with any custom components aliased as Image #92

FrederickEngelhardt opened this issue Apr 17, 2020 · 2 comments

Comments

@FrederickEngelhardt
Copy link
Contributor

FrederickEngelhardt commented Apr 17, 2020

When importing the component under an alias of Image or a named export { Image } I get the following error. Looks like the Eslint rule is looking for any component named Image and applying this rule. Is it possible to get the eslint rule to only apply to Images imported directly from react-native?

Found an element which will be inverted. Add the accessibilityIgnoresInvertColors propeslint(react-native-a11y/has-valid-accessibility-ignores-invert-colors)

Code:
Image.tsx

import React from 'react'
import { Image as RNImage, ImageProps } from 'react-native'

const Image = (props: ImageProps) => (
  <RNImage accessibilityIgnoresInvertColors source={props.source} />
)

export default Image

And example area you would have an error
App.tsx

import Image from 'components/Image'
const App = () => <Image source={FILE} /> // this will error saying you are not providing accessibilityIgnoresInvertColors for the image.
@FrederickEngelhardt
Copy link
Contributor Author

PR incoming to add a filter to imports to verify that Image comes from react-native.

@steffenkleinle
Copy link

Hey, thank you for your work! Is there any chance this could still be merged/fixed? We were thinking of adding these rules to our linting, but as we are using styled-components, the rules don't really work as they should :/
Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants