question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Typescript warning: Property 'accessibilityStates' is missing in type (...)

See original GitHub issue

Current behaviour

I’m using React Native Paper with typescript. I’ve just updated all my plugins to their latest version and I’m getting the following error for most of the RNP components:

Property 'accessibilityStates' is missing in type (...)

Expected behaviour

Typing and props should not show warnings

Code sample

<Appbar.Header
  style={[styles.header]}
  statusBarHeight={StatusBar.currentHeight}
>
  <Appbar.Action icon="menu" onPress={navigation.toggleDrawer} />
  <View style={styles.headerContent}>
    <Searchbar
      autoCapitalize="none"
      autoCorrect={false}
      placeholder="Search"
      onChangeText={setQuery}
      ref={inputRef}
      value={query}
      style={styles.headerSearchBar}
      inputStyle={styles.headerSearchInput}
    />
  </View>
  <Appbar.Action icon="tune" onPress={toggleFilters} />
</Appbar.Header>

or

<Text style={styles.catCardTitle}>whatever</Text>

Screenshots (if applicable)

image image

What have you tried

Your Environment

Not using expo, all of my plugins are their latest version at the time of writing this.

  "dependencies": {
    "@react-native-community/async-storage": "^1.10.0",
    "@react-native-community/masked-view": "^0.1.10",
    "@react-navigation/drawer": "^5.8.1",
    "@react-navigation/native": "^5.5.0",
    "@types/color": "^3.0.1",
    "@types/react-native-vector-icons": "^6.4.5",
    "axios": "^0.19.2",
    "color": "^3.1.2",
    "immutability-helper": "^3.1.1",
    "lodash-es": "^4.17.15",
    "qs": "^6.9.4",
    "react": "16.13.1",
    "react-native": "0.62.2",
    "react-native-animatable": "^1.3.3",
    "react-native-background-timer": "^2.2.0",
    "react-native-gesture-handler": "^1.6.1",
    "react-native-keyboard-aware-scroll-view": "^0.9.1",
    "react-native-maps": "0.27.1",
    "react-native-modal": "^11.5.6",
    "react-native-paper": "^3.10.1",
    "react-native-reanimated": "^1.8.0",
    "react-native-safe-area-context": "^3.0.2",
    "react-native-screens": "^2.7.0",
    "react-native-side-menu": "^1.1.3",
    "react-native-spinkit": "^1.5.0",
    "react-native-vector-icons": "^6.6.0",
    "react-redux": "^7.2.0",
    "redux": "^4.0.5",
    "redux-axios-middleware": "^4.0.1",
    "redux-thunk": "^2.3.0",
    "reselect": "^4.0.0"
  },
  "devDependencies": {
    "@babel/core": "^7.10.2",
    "@babel/runtime": "^7.10.2",
    "@react-native-community/eslint-config": "^1.1.0",
    "@types/jest": "^25.2.1",
    "@types/lodash-es": "^4.17.3",
    "@types/qs": "^6.9.2",
    "@types/react-native": "^0.62.12",
    "@types/react-native-autocomplete-input": "^4.0.1",
    "@types/react-redux": "^7.1.8",
    "@types/react-test-renderer": "16.9.2",
    "@typescript-eslint/eslint-plugin": "^3.1.0",
    "@typescript-eslint/parser": "^3.1.0",
    "babel-jest": "^26.0.1",
    "eslint": "^7.0.0",
    "eslint-config-airbnb-typescript": "^7.2.1",
    "eslint-config-prettier": "^6.11.0",
    "eslint-plugin-import": "^2.20.2",
    "eslint-plugin-jsx-a11y": "^6.2.3",
    "eslint-plugin-prettier": "^3.1.3",
    "eslint-plugin-react": "^7.19.0",
    "eslint-plugin-react-hooks": "^4.0.4",
    "jest": "^26.0.1",
    "prettier": "^2.0.5",
    "react-test-renderer": "16.13.1",
    "typescript": "^3.8.3"
  },

node -v: v13.8.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:24 (4 by maintainers)

github_iconTop GitHub Comments

13reactions
hamidfzmcommented, Jun 3, 2020

@raajnadar According to this commit https://github.com/DefinitelyTyped/DefinitelyTyped/commit/ec53e42ae41f202f1f83bea94126a717a1848414#diff-7c5007b14419e07403a6a320e5b22742 accessibilityStates is removed from react-native types 20 days ago.

A workaround for this issue is using older versions like "@types/react-native": "0.62.2". But I think react-native-paper should also update their typescript definitions.

12reactions
zholmes1commented, Jun 26, 2020

Upgrading to "react-native-paper": "4.0.0-alpha.1" fixed this issue for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Property is missing in type error - reactjs - Stack Overflow
I am having an issue with working through a demo React project. Most of the issues stem from me trying to implement it...
Read more >
Accessibility - React Native
Describes the current state of a component to the user of an assistive technology. accessibilityState is an object. It contains the following ...
Read more >
TypeScript React Cheat Sheet - SaltyCrane
This is a list of TypeScript types generated from the declaration files for react , react-dom , react-native and other libraries in ...
Read more >
react-native | Yarn - Package Manager
Learn once, write anywhere: Build mobile apps with React. React Native is released under the MIT license. Current CircleCI build status.
Read more >
Queries | React Native Testing Library - Open Source
This is useful for asserting an element that is not present. ... with following properties that you may be interested in: type ReactTestInstance...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found