FormidableLabs / eslint-plugin-react-native-a11y

React Native specific accessibility linting rules.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`react-native-a11y/has-valid-accessibility-state` crashes when destructuring within prop.

jaworek opened this issue · comments

When accessibilityState prop is defined as an inline object with destructured object within it, this rule crashes.

accessibilityState={{ ...accessibilityState, disabled }}

Here's the error message:
photo_2022-09-27_12-09-56

I was able to find a workaround by defining it first as a separate variable and then passing it to prop.

const newAccessibilityState = { ...accessibilityState, disabled };

...

accessibilityState={newAccessibilityState}