Suppress spurious warning about RCTCxxModule (#19880)

Summary:
<!--
  Required: Write your motivation here.
  If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
-->

On a relatively stock / default setup of RN on iOS you'll see the warning "Class RCTCxxModule was not exported. Did you forget to use RCT_EXPORT_MODULE()?" pop up on every launch. This change resolves that issue.

Fixes #14806 .

This supersedes PR #19794 .

Try a fresh project by following the RN iOS tutorial, and observe that there are no more warnings after making this change.

[IOS] [MINOR] [CxxBridge] - Fix "Class RCTCxxModule was not exported"
Closes https://github.com/facebook/react-native/pull/19880

Differential Revision: D8653809

Pulled By: hramos

fbshipit-source-id: c48529c2d74ddd40a90bc0e06e405078e25b72e3
This commit is contained in:
Douglas 2018-06-26 17:38:09 -07:00 committed by Facebook Github Bot
parent bfea0e5524
commit 569061dd83
1 changed files with 3 additions and 0 deletions

View File

@ -106,6 +106,9 @@ void RCTVerifyAllModulesExported(NSArray *extraModules)
for (unsigned int i = 0; i < classCount; i++) { for (unsigned int i = 0; i < classCount; i++) {
Class cls = classes[i]; Class cls = classes[i];
if (strncmp(class_getName(cls), "RCTCxxModule", strlen("RCTCxxModule")) == 0) {
continue;
}
Class superclass = cls; Class superclass = cls;
while (superclass) { while (superclass) {
if (class_conformsToProtocol(superclass, @protocol(RCTBridgeModule))) { if (class_conformsToProtocol(superclass, @protocol(RCTBridgeModule))) {