RCTCxxModule incorrectly flagged as not exported module by RCTVerifyAllModulesExported
See original GitHub issueIs this a bug report?
Yes
Have you read the Bugs section of the Contributing to React Native Guide?
Yes
Environment
react-native -v
: 0.45.1 / cli 2.0.1node -v
: v7.9.0npm -v
: 5.0.3yarn --version
(if you use Yarn): 0.24.6
Then, specify:
- Target Platform: iOS
- Development Operating System: macOS Sierra
- Build tools: any supported Xcode version, any supported iOS version
Steps to Reproduce
- Execute
react-native init testproject
- Open the Xcode project and hit run
Expected Behavior
No warnings should be logged to the Xcode console since we have the default setup.
Actual Behavior
In the Xcode log there is a warning about the RCTCxxModule
not being exported:
2017-07-03 11:09:47.963 [warn][tid:main][RCTBridge.m:114] Class RCTCxxModule was not exported. Did you forget to use RCT_EXPORT_MODULE()?
2017-07-03 11:09:47.963285+0200 testproject[467:119661] Class RCTCxxModule was not exported. Did you forget to use RCT_EXPORT_MODULE()?
Reproducible Demo
Any newly created React-Native project using the CxxBridge has this issue.
Possible solution
The RCTVerifyAllModulesExported
function uses the objc_copyClassList
which also reports the RCTCxxModule
. This triggers the warning that this module is not exported, but since the RCTCxxModule
is merely a base class that can be used by real module implementation this is a false positive.
A possible solution would be to make an exception in RCTVerifyAllModulesExported
for the RCTCxxModule
so it will not be checked and the warning will not be produced.
Note: The warning will disappear when you create a module that subclasses RCTCxxModule
since there is a check in place for that scenario. As long as there is no subclass yet this warning will pop up.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:66
- Comments:28 (2 by maintainers)
Top GitHub Comments
this issue puzzle me a lot. My project ran smoothly days before, however this issue happens today, and this issue appears in every project inited by react-native-cli without any modification .
I solved this by making sure that
NSAppTrasnportSecurity
key in my info.plist had the correct values: