React-native-tab-view: Invalid prop `accessibilityRole` of value `tab` supplied to `TouchableOpacity`

Created on 23 Jan 2020  Â·  20Comments  Â·  Source: satya164/react-native-tab-view

Current behaviour

The use of TabBarItem is throwing:

Failed prop type: Invalid prop `accessibilityRole` of value `tab` supplied to `TouchableOpacity`, expected one of 
["none","button","link","search","image","keyboardkey","text","adjustable","imagebutton","header","summary"]

Expected behaviour

The correct display of the MaterialTopTabNavigator.

Code sample

https://github.com/react-native-community/react-native-tab-view/blob/c762699b01c34adcd80b4761e120ebe0573ba649/src/TabBarItem.tsx#L220

Screenshots (if applicable)

Screen Shot 2020-01-23 at 2 24 36 PM
Screen Shot 2020-01-23 at 2 24 52 PM

What have you tried

I can't find a way to overwrite that prop.

Your Environment

| software | version
| ---------------------------- | -------
| android | 24
| ios | 13.3
| react-native | expo 35, react-native 0.59
| react-navigation-tabs | 2.6.2
| react-native-gesture-handler | 1.3.0
| react-native-reanimated | 1~.2.0
| node | 12.13.1
| npm or yarn | 6.12.1

bug

Most helpful comment

I hack this around installing the dependency directly at 2.11.0.

All 20 comments

I hack this around installing the dependency directly at 2.11.0.

same issue

Please upgrade your React Native version.

I hack this around installing the dependency directly at 2.11.0.

save my day :)

Also facing the same issue in RN 0.59.0.

Is it possible to make it work without downgrading react-native-tab-view.

@satya164 it would be useful to have React Native version compatibility information in the README.

PR welcome to add it

I hack this around installing the dependency directly at 2.11.0.

sorry what you mean by that?

I hack this around installing the dependency directly at 2.11.0.

sorry what you mean by that?

Installing the dependency directly at 2.11.0 fixed my issue.

What I think was happening was that one of my dependencies has as a dependency on this library, but with a bad model version that was installing an incompatible code with my current setup. So that update should have been a major, or the dependency should have specified the correct model version. (By model version, I mean the ~, or ^, etc). I hope I made myself clear.

It is not the first time something crash in my projects because of one transitive update.

@satya164 is there any way backwards compatibility for this prop can be added for RN < 0.60?

same issue. And 2.11.0 doesn't show anything~

I hack this around installing the dependency directly at 2.11.0.

Thanks this worked for me :)

which component should be 2.11.0 ?

Having this same issue with the following environment:

  • "react-native": "https://github.com/expo/react-native/archive/sdk-35.0.0.tar.gz",
  • "react-native-bpk-component-touchable-native-feedback": "^3.0.0",
  • "react-native-gesture-handler": "1.3",
  • "react-native-reanimated": "1.2",
  • "react-native-safe-area-context": "~0.3.6",
  • "react-native-screens": "~1.0.0-alpha.23",
  • "react-native-web": "^0.11.7",
  • "react-navigation": "^4.0.10",
  • "react-navigation-stack": "^2.0.16",
  • "react-navigation-tabs": "^2.8.7"

Also not sure which dependency should be 2.11.0 ... I've tried setting the following dependencies to 2.11.0, without success:

  • react-navigation
  • react-native-tab-view

@satya164 I think you can look into it? provide backward compatibility ?
You're just breaking many projects

I hack this around installing the dependency directly at 2.11.0.
can you explain that ?

I hack this around installing the dependency directly at 2.11.0.

sorry what you mean by that?

Installing the dependency directly at 2.11.0 fixed my issue.

What I think was happening was that one of my dependencies has as a dependency on this library, but with a bad model version that was installing an incompatible code with my current setup. So that update should have been a major, or the dependency should have specified the correct model version. (By model version, I mean the ~, or ^, etc). I hope I made myself clear.

It is not the first time something crash in my projects because of one transitive update.

Can you specify exactly what you updated ?

Go to node_modules -> react-natie-tab-view -> lib -> module
Change 'accessibilityRole' value to 'none' in 'TabBarItem.js' and 'TabBar.js'
Solved for me.

Have the same issue, the only way it got solved was manually changing the lines described by Magudeshwaran on May 23,

the lines 156 on TabBarItem.js and 241 on TabBar.js

This is not the better solution but it works

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ashusdn picture ashusdn  Â·  4Comments

chen504554911 picture chen504554911  Â·  3Comments

jasonkw9 picture jasonkw9  Â·  3Comments

compojoom picture compojoom  Â·  4Comments

itzsaga picture itzsaga  Â·  3Comments