react-native icon indicating copy to clipboard operation
react-native copied to clipboard

[0.76][iOS][Codegen] Fabric Native Component from website has a bug

Open blakef opened this issue 1 year ago • 7 comments

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

Screenshots and Videos

CleanShot 2024-10-23 at 08 59 15@2x

blakef avatar Oct 23 '24 16:10 blakef

:warning: Missing Reproducible Example
:information_source: We could not detect a reproducible example in your issue report. Please provide either:
  • If your bug is UI related: a Snack
  • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.

react-native-bot avatar Oct 23 '24 16:10 react-native-bot

:warning: Missing Reproducible Example
:information_source: We could not detect a reproducible example in your issue report. Please provide either:

react-native-bot avatar Oct 23 '24 16:10 react-native-bot

@blakef Is this already picked by someone and is being tracked in some PR?

shubhamguptadream11 avatar Oct 23 '24 16:10 shubhamguptadream11

Updated to reference the PR: #47176

blakef avatar Oct 23 '24 16:10 blakef

After updating my app, the RCTThirdPartyComponentsProvider issue has been resolved as it's no longer present. However, I'm still encountering a few other issues that appear to be related. Any insights or suggestions would be appreciated.

Undefined symbols for architecture arm64:
  "facebook::react::SwitchProps::SwitchProps(facebook::react::PropsParserContext const&, facebook::react::SwitchProps const&, facebook::react::RawProps const&)", referenced from:
      void facebook::react::RawPropsParser::prepare<facebook::react::SwitchProps>() in libReact-RCTFabric.a[37](RCTSwitchComponentView.o)
      std::__1::__shared_ptr_emplace<facebook::react::SwitchProps, std::__1::allocator<facebook::react::SwitchProps>>::__shared_ptr_emplace[abi:ne180100]<facebook::react::PropsParserContext const&, facebook::react::SwitchProps const&, facebook::react::RawProps const&, std::__1::allocator<facebook::react::SwitchProps>, 0>(std::__1::allocator<facebook::react::SwitchProps>, facebook::react::PropsParserContext const&, facebook::react::SwitchProps const&, facebook::react::RawProps const&) in libReact-RCTFabric.a[37](RCTSwitchComponentView.o)
  "facebook::react::SafeAreaViewProps::SafeAreaViewProps(facebook::react::PropsParserContext const&, facebook::react::SafeAreaViewProps const&, facebook::react::RawProps const&)", referenced from:
      void facebook::react::RawPropsParser::prepare<facebook::react::SafeAreaViewProps>() in libReact-RCTFabric.a[29](RCTSafeAreaViewComponentView.o)
      std::__1::__shared_ptr_emplace<facebook::react::SafeAreaViewProps, std::__1::allocator<facebook::react::SafeAreaViewProps>>::__shared_ptr_emplace[abi:ne180100]<facebook::react::PropsParserContext const&, facebook::react::SafeAreaViewProps const&, facebook::react::RawProps const&, std::__1::allocator<facebook::react::SafeAreaViewProps>, 0>(std::__1::allocator<facebook::react::SafeAreaViewProps>, facebook::react::PropsParserContext const&, facebook::react::SafeAreaViewProps const&, facebook::react::RawProps const&) in libReact-RCTFabric.a[29](RCTSafeAreaViewComponentView.o)
  "facebook::react::ModalHostViewProps::ModalHostViewProps(facebook::react::PropsParserContext const&, facebook::react::ModalHostViewProps const&, facebook::react::RawProps const&)", referenced from:
      void facebook::react::RawPropsParser::prepare<facebook::react::ModalHostViewProps>() in libReact-RCTFabric.a[21](RCTModalHostViewComponentView.o)
      std::__1::__shared_ptr_emplace<facebook::react::ModalHostViewProps, std::__1::allocator<facebook::react::ModalHostViewProps>>::__shared_ptr_emplace[abi:ne180100]<facebook::react::PropsParserContext const&, facebook::react::ModalHostViewProps const&, facebook::react::RawProps const&, std::__1::allocator<facebook::react::ModalHostViewProps>, 0>(std::__1::allocator<facebook::react::ModalHostViewProps>, facebook::react::PropsParserContext const&, facebook::react::ModalHostViewProps const&, facebook::react::RawProps const&) in libReact-RCTFabric.a[21](RCTModalHostViewComponentView.o)
  "facebook::react::InputAccessoryProps::InputAccessoryProps(facebook::react::PropsParserContext const&, facebook::react::InputAccessoryProps const&, facebook::react::RawProps const&)", referenced from:
      void facebook::react::RawPropsParser::prepare<facebook::react::InputAccessoryProps>() in libReact-RCTFabric.a[16](RCTInputAccessoryComponentView.o)
      std::__1::__shared_ptr_emplace<facebook::react::InputAccessoryProps, std::__1::allocator<facebook::react::InputAccessoryProps>>::__shared_ptr_emplace[abi:ne180100]<facebook::react::PropsParserContext const&, facebook::react::InputAccessoryProps const&, facebook::react::RawProps const&, std::__1::allocator<facebook::react::InputAccessoryProps>, 0>(std::__1::allocator<facebook::react::InputAccessoryProps>, facebook::react::PropsParserContext const&, facebook::react::InputAccessoryProps const&, facebook::react::RawProps const&) in libReact-RCTFabric.a[16](RCTInputAccessoryComponentView.o)
  "facebook::react::SwitchComponentName", referenced from:
      +[RCTSwitchComponentView componentDescriptorProvider] in libReact-RCTFabric.a[37](RCTSwitchComponentView.o)
      facebook::react::ConcreteComponentDescriptor<facebook::react::ConcreteViewShadowNode<&facebook::react::SwitchComponentName, facebook::react::SwitchProps, facebook::react::SwitchEventEmitter, facebook::react::SwitchState, false>>::getComponentHandle() const in libReact-RCTFabric.a[37](RCTSwitchComponentView.o)
      facebook::react::ConcreteComponentDescriptor<facebook::react::ConcreteViewShadowNode<&facebook::react::SwitchComponentName, facebook::react::SwitchProps, facebook::react::SwitchEventEmitter, facebook::react::SwitchState, false>>::getComponentName() const in libReact-RCTFabric.a[37](RCTSwitchComponentView.o)
  "facebook::react::DebuggingOverlayProps::DebuggingOverlayProps(facebook::react::PropsParserContext const&, facebook::react::DebuggingOverlayProps const&, facebook::react::RawProps const&)", referenced from:
      void facebook::react::RawPropsParser::prepare<facebook::react::DebuggingOverlayProps>() in libReact-RCTFabric.a[8](RCTDebuggingOverlayComponentView.o)
      std::__1::__shared_ptr_emplace<facebook::react::DebuggingOverlayProps, std::__1::allocator<facebook::react::DebuggingOverlayProps>>::__shared_ptr_emplace[abi:ne180100]<facebook::react::PropsParserContext const&, facebook::react::DebuggingOverlayProps const&, facebook::react::RawProps const&, std::__1::allocator<facebook::react::DebuggingOverlayProps>, 0>(std::__1::allocator<facebook::react::DebuggingOverlayProps>, facebook::react::PropsParserContext const&, facebook::react::DebuggingOverlayProps const&, facebook::react::RawProps const&) in libReact-RCTFabric.a[8](RCTDebuggingOverlayComponentView.o)
  "facebook::react::PullToRefreshViewProps::PullToRefreshViewProps(facebook::react::PropsParserContext const&, facebook::react::PullToRefreshViewProps const&, facebook::react::RawProps const&)", referenced from:
      void facebook::react::RawPropsParser::prepare<facebook::react::PullToRefreshViewProps>() in libReact-RCTFabric.a[26](RCTPullToRefreshViewComponentView.o)
      std::__1::__shared_ptr_emplace<facebook::react::PullToRefreshViewProps, std::__1::allocator<facebook::react::PullToRefreshViewProps>>::__shared_ptr_emplace[abi:ne180100]<facebook::react::PropsParserContext const&, facebook::react::PullToRefreshViewProps const&, facebook::react::RawProps const&, std::__1::allocator<facebook::react::PullToRefreshViewProps>, 0>(std::__1::allocator<facebook::react::PullToRefreshViewProps>, facebook::react::PropsParserContext const&, facebook::react::PullToRefreshViewProps const&, facebook::react::RawProps const&) in libReact-RCTFabric.a[26](RCTPullToRefreshViewComponentView.o)
  "facebook::react::ActivityIndicatorViewProps::ActivityIndicatorViewProps(facebook::react::PropsParserContext const&, facebook::react::ActivityIndicatorViewProps const&, facebook::react::RawProps const&)", referenced from:
      void facebook::react::RawPropsParser::prepare<facebook::react::ActivityIndicatorViewProps>() in libReact-RCTFabric.a[4](RCTActivityIndicatorViewComponentView.o)
      std::__1::__shared_ptr_emplace<facebook::react::ActivityIndicatorViewProps, std::__1::allocator<facebook::react::ActivityIndicatorViewProps>>::__shared_ptr_emplace[abi:ne180100]<facebook::react::PropsParserContext const&, facebook::react::ActivityIndicatorViewProps const&, facebook::react::RawProps const&, std::__1::allocator<facebook::react::ActivityIndicatorViewProps>, 0>(std::__1::allocator<facebook::react::ActivityIndicatorViewProps>, facebook::react::PropsParserContext const&, facebook::react::ActivityIndicatorViewProps const&, facebook::react::RawProps const&) in libReact-RCTFabric.a[4](RCTActivityIndicatorViewComponentView.o)
  "facebook::react::UnimplementedNativeViewProps::UnimplementedNativeViewProps(facebook::react::PropsParserContext const&, facebook::react::UnimplementedNativeViewProps const&, facebook::react::RawProps const&)", referenced from:
      void facebook::react::RawPropsParser::prepare<facebook::react::UnimplementedNativeViewProps>() in libReact-RCTFabric.a[40](RCTUnimplementedNativeComponentView.o)
      std::__1::__shared_ptr_emplace<facebook::react::UnimplementedNativeViewProps, std::__1::allocator<facebook::react::UnimplementedNativeViewProps>>::__shared_ptr_emplace[abi:ne180100]<facebook::react::PropsParserContext const&, facebook::react::UnimplementedNativeViewProps const&, facebook::react::RawProps const&, std::__1::allocator<facebook::react::UnimplementedNativeViewProps>, 0>(std::__1::allocator<facebook::react::UnimplementedNativeViewProps>, facebook::react::PropsParserContext const&, facebook::react::UnimplementedNativeViewProps const&, facebook::react::RawProps const&) in libReact-RCTFabric.a[40](RCTUnimplementedNativeComponentView.o)
  "facebook::react::DebuggingOverlayComponentName", referenced from:
      +[RCTDebuggingOverlayComponentView componentDescriptorProvider] in libReact-RCTFabric.a[8](RCTDebuggingOverlayComponentView.o)
      facebook::react::ConcreteComponentDescriptor<facebook::react::ConcreteViewShadowNode<&facebook::react::DebuggingOverlayComponentName, facebook::react::DebuggingOverlayProps, facebook::react::DebuggingOverlayEventEmitter, facebook::react::DebuggingOverlayState, false>>::getComponentHandle() const in libReact-RCTFabric.a[8](RCTDebuggingOverlayComponentView.o)
      facebook::react::ConcreteComponentDescriptor<facebook::react::ConcreteViewShadowNode<&facebook::react::DebuggingOverlayComponentName, facebook::react::DebuggingOverlayProps, facebook::react::DebuggingOverlayEventEmitter, facebook::react::DebuggingOverlayState, false>>::getComponentName() const in libReact-RCTFabric.a[8](RCTDebuggingOverlayComponentView.o)
  "facebook::react::PullToRefreshViewComponentName", referenced from:
      +[RCTPullToRefreshViewComponentView componentDescriptorProvider] in libReact-RCTFabric.a[26](RCTPullToRefreshViewComponentView.o)
      facebook::react::ConcreteComponentDescriptor<facebook::react::ConcreteViewShadowNode<&facebook::react::PullToRefreshViewComponentName, facebook::react::PullToRefreshViewProps, facebook::react::PullToRefreshViewEventEmitter, facebook::react::PullToRefreshViewState, false>>::getComponentHandle() const in libReact-RCTFabric.a[26](RCTPullToRefreshViewComponentView.o)
      facebook::react::ConcreteComponentDescriptor<facebook::react::ConcreteViewShadowNode<&facebook::react::PullToRefreshViewComponentName, facebook::react::PullToRefreshViewProps, facebook::react::PullToRefreshViewEventEmitter, facebook::react::PullToRefreshViewState, false>>::getComponentName() const in libReact-RCTFabric.a[26](RCTPullToRefreshViewComponentView.o)
  "facebook::react::ActivityIndicatorViewComponentName", referenced from:
      +[RCTActivityIndicatorViewComponentView componentDescriptorProvider] in libReact-RCTFabric.a[4](RCTActivityIndicatorViewComponentView.o)
      facebook::react::ConcreteComponentDescriptor<facebook::react::ConcreteViewShadowNode<&facebook::react::ActivityIndicatorViewComponentName, facebook::react::ActivityIndicatorViewProps, facebook::react::ActivityIndicatorViewEventEmitter, facebook::react::ActivityIndicatorViewState, false>>::getComponentHandle() const in libReact-RCTFabric.a[4](RCTActivityIndicatorViewComponentView.o)
      facebook::react::ConcreteComponentDescriptor<facebook::react::ConcreteViewShadowNode<&facebook::react::ActivityIndicatorViewComponentName, facebook::react::ActivityIndicatorViewProps, facebook::react::ActivityIndicatorViewEventEmitter, facebook::react::ActivityIndicatorViewState, false>>::getComponentName() const in libReact-RCTFabric.a[4](RCTActivityIndicatorViewComponentView.o)
  "facebook::react::UnimplementedNativeViewComponentName", referenced from:
      +[RCTUnimplementedNativeComponentView componentDescriptorProvider] in libReact-RCTFabric.a[40](RCTUnimplementedNativeComponentView.o)
      facebook::react::ConcreteComponentDescriptor<facebook::react::ConcreteViewShadowNode<&facebook::react::UnimplementedNativeViewComponentName, facebook::react::UnimplementedNativeViewProps, facebook::react::UnimplementedNativeViewEventEmitter, facebook::react::UnimplementedNativeViewState, false>>::getComponentHandle() const in libReact-RCTFabric.a[40](RCTUnimplementedNativeComponentView.o)
      facebook::react::ConcreteComponentDescriptor<facebook::react::ConcreteViewShadowNode<&facebook::react::UnimplementedNativeViewComponentName, facebook::react::UnimplementedNativeViewProps, facebook::react::UnimplementedNativeViewEventEmitter, facebook::react::UnimplementedNativeViewState, false>>::getComponentName() const in libReact-RCTFabric.a[40](RCTUnimplementedNativeComponentView.o)
  "facebook::react::SwitchEventEmitter::onChange(facebook::react::SwitchEventEmitter::OnChange) const", referenced from:
      -[RCTSwitchComponentView onChange:] in libReact-RCTFabric.a[37](RCTSwitchComponentView.o)
  "facebook::react::ModalHostViewEventEmitter::onOrientationChange(facebook::react::ModalHostViewEventEmitter::OnOrientationChange) const", referenced from:
      -[RCTModalHostViewComponentView boundsDidChange:] in libReact-RCTFabric.a[21](RCTModalHostViewComponentView.o)
  "facebook::react::ModalHostViewEventEmitter::onShow(facebook::react::ModalHostViewEventEmitter::OnShow) const", referenced from:
      ___60-[RCTModalHostViewComponentView ensurePresentedOnlyIfNeeded]_block_invoke in libReact-RCTFabric.a[21](RCTModalHostViewComponentView.o)
  "facebook::react::ModalHostViewEventEmitter::onDismiss(facebook::react::ModalHostViewEventEmitter::OnDismiss) const", referenced from:
      ___60-[RCTModalHostViewComponentView ensurePresentedOnlyIfNeeded]_block_invoke.1 in libReact-RCTFabric.a[21](RCTModalHostViewComponentView.o)
  "facebook::react::PullToRefreshViewEventEmitter::onRefresh(facebook::react::PullToRefreshViewEventEmitter::OnRefresh) const", referenced from:
      -[RCTPullToRefreshViewComponentView handleUIControlEventValueChanged] in libReact-RCTFabric.a[26](RCTPullToRefreshViewComponentView.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Setting arm64 as an excluded architecture resolves the issue during development, but it causes problems when I try to create a release build (archive). Any suggestions on how to address this?

I'm using version v0.75.3

joaoveronezi avatar Jan 08 '25 17:01 joaoveronezi

@joaoveronezi Facing Similar issue while migrating to 0.79.2. IS there a fix ?

JatinDream11 avatar May 23 '25 04:05 JatinDream11

@JatinDream11 I was installing the pods using the flag use_frameworks!, I removed it and worked.

joaoveronezi avatar May 23 '25 14:05 joaoveronezi