react-native
react-native copied to clipboard
[0.76][iOS][Codegen] Fabric Native Component from website has a bug
trafficstars
Description
Currently codegen generates RCTThirdPartyFabricComponents wrappers with references to the Fabric Components. If these components are inlined in your application, they fail to build (as the they're linked in the Pods and not the App, so can't find the symbols). You'll see an error similar to this (except your component class will be missing):
Undefined symbols for architecture arm64:
"_CustomWebViewCls", referenced from:
_RCTThirdPartyFabricComponentsProvider in libReact-RCTFabric.a[41](RCTThirdPartyFabricComponentsProvider.o)
ld: symbol(s) not found for architecture arm64
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
We're expecting a fix to ship in 0.76.1 (#47176), but leaving this issue here as a placeholder until that's the case.
Appendix:
See commented out lines, which you'll have to do until the fix ships.
/*
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by GenerateRCTThirdPartyFabricComponentsProviderH
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wreturn-type-c-linkage"
#import <React/RCTComponentViewProtocol.h>
#ifdef __cplusplus
extern "C" {
#endif
Class<RCTComponentViewProtocol> RCTThirdPartyFabricComponentsProvider(const char *name);
#if RCT_NEW_ARCH_ENABLED
#ifndef RCT_DYNAMIC_FRAMEWORKS
//Class<RCTComponentViewProtocol> CustomWebViewCls(void) __attribute__((used)); // 0
#endif
#endif
#ifdef __cplusplus
}
#endif
#pragma GCC diagnostic pop
and
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by GenerateRCTThirdPartyFabricComponentsProviderCpp
*/
// OSS-compatibility layer
#import "RCTThirdPartyFabricComponentsProvider.h"
#import <string>
#import <unordered_map>
Class<RCTComponentViewProtocol> RCTThirdPartyFabricComponentsProvider(const char *name) {
static std::unordered_map<std::string, Class (*)(void)> sFabricComponentsClassMap = {
#if RCT_NEW_ARCH_ENABLED
#ifndef RCT_DYNAMIC_FRAMEWORKS
// {"CustomWebView", CustomWebViewCls}, // 0
#endif
#endif
};
auto p = sFabricComponentsClassMap.find(name);
if (p != sFabricComponentsClassMap.end()) {
auto classFunc = p->second;
return classFunc();
}
return nil;
}
Steps to reproduce
N/A
React Native Version
0.76.0
Affected Platforms
Runtime - iOS, Build - MacOS
Output of npx react-native info
N/A
Stacktrace or Logs
N/A
Reproducer
https://github.com/cipolleschi/InAppComponent