Protected member is not accessible, React Native functions
WebStorm 2018.1
Build #WS-181.4203.535, built on March 22, 2018
JRE: 1.8.0_152-release-1136-b20 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.13.2
Issue:
After updating to WebStorm 2018.1 all usages of setState() and forceUpdate() inside of a React Native project prompt the 'protected member is not accessible' warning.
Occurrences:
This issue persists both when the state is previously defined in the constructor, and when initially setting the state. All instances of setState() reflect this warning.
All calls to forceUpdate() prompt the warning.
Attempted Resolution:
Invalidate caches | Restart
Please sign in to leave a comment.
Please provide code snippets/files I can use to recreate the issue
I am getting the same error in all files, after upgrading.
can't recreate using similar syntax:
what react-native version do you use? Can you recreate the issue using the basic React Native project created via File | New | Project...?
Elena,
I am able to recreate using a new project. Additionally I created the test project on another system to rule out local settings.
Test Project:
Current Project:
Yep, was able to recreate it as well, tried on a fresh computer at work. I was on react native 0.52.0 or something, and we upgraded our react and react native to latest version, issue persists.
This is really throwing us off seeing so many warnings. How do we temporarily disable this warning until a fix is out, or we resolve what the actual problem is?
Vfrolov,
If you would like to disable the protected member warnings it can be disabled in the inspection preferences.
Preferences -> Editor -> Inspections -> Javascript -> General
uncheck '@private and @protected members accessibility'
thanks, recreated with most recent react-native+react; logged as https://youtrack.jetbrains.com/issue/WEB-32186, please follow it for updates