Description
React Native Codegen 0.86.0 always emits a States.cpp translation unit, but GenerateStateCpp.js currently renders no state definitions (StateTemplate returns an empty string). For component libraries whose generated state source has no other definitions, Xcode 26.4.1 libtool reports the compiled object as symbol-less.
Environment
- @react-native/codegen: 0.86.0
- React Native: 0.86.0
- Xcode: 26.4.1
- SDK: iOS simulator
- configuration: Release, new architecture
Reproduction
Generate component code for libraries such as rnscreens or safeareacontext, then build the generated ReactCodegen target in Release. The generated source contains only the header include and empty namespace.
libtool: warning: States-89020dfa9f92f64072c3fa149a6beab6.o has no symbols
libtool: warning: States-07dedd22012e4ff4426f2b40f6fb19ed.o has no symbols
Verified source-level fix
Have GenerateStateCpp emit a unique external-linkage function based on the sanitized library name, for example:
extern "C" void RnscreensStatesLinkerAnchor() {}
A regenerated Release object then exposes _RnscreensStatesLinkerAnchor in nm -g, and libtool no longer reports an empty object. This fixes the source without warning flags, suppression, or log filtering.
Description
React Native Codegen 0.86.0 always emits a
States.cpptranslation unit, butGenerateStateCpp.jscurrently renders no state definitions (StateTemplatereturns an empty string). For component libraries whose generated state source has no other definitions, Xcode 26.4.1 libtool reports the compiled object as symbol-less.Environment
Reproduction
Generate component code for libraries such as
rnscreensorsafeareacontext, then build the generatedReactCodegentarget in Release. The generated source contains only the header include and empty namespace.Verified source-level fix
Have
GenerateStateCppemit a unique external-linkage function based on the sanitized library name, for example:A regenerated Release object then exposes
_RnscreensStatesLinkerAnchorinnm -g, and libtool no longer reports an empty object. This fixes the source without warning flags, suppression, or log filtering.