Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No matching function for call to 'fromRawValue' #35054

Closed
kalyantm opened this issue Oct 22, 2022 · 13 comments
Closed

No matching function for call to 'fromRawValue' #35054

kalyantm opened this issue Oct 22, 2022 · 13 comments
Labels
Needs: Triage 🔍 Stale There has been a lack of activity on this issue and it may be closed soon. Tech: Codegen Related to react-native-codegen Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules)

Comments

@kalyantm
Copy link

kalyantm commented Oct 22, 2022

Description

I'm trying to build a fabric native react component, and I'm following the steps as outlined here: https://reactnative.dev/docs/next/the-new-architecture/pillars-fabric-components

When I use codegen to generate the props from my MyCustomCompNativeComponent.tsx, I use the following props:

export interface NativeProps extends ViewProps {
  text: string;
  title: string;
  actions: ReadonlyArray<Readonly<{id: string; actionName: string}>>;
}

Everything goes as expected - except on the last step, when I actually build the project on Xcode, i get an error in React-Codegen:
No matching function for call to 'fromRawValue' (check attached screenshot)

I think this happens when codegen is trying to generate the props for the native side, and the array of objects in the actions prop is not getting converted as expected - which leads me to believe if that's the right way to mention a prop that is an array of objects

I know this is the case because if I comment out / remove that prop, everything works as expected

So it basically boils down to - Am I misunderstanding how to specify a prop of type "array of objects" to codegen?

Version

0.70.2

Output of npx react-native info

    OS: macOS 12.3
    CPU: (10) arm64 Apple M1 Pro
    Memory: 228.14 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.17.0 - /usr/local/bin/node
    Yarn: 1.22.18 - /opt/local/bin/yarn
    npm: 7.0.15 - ~/.nvm/versions/node/v15.4.0/bin/npm
    Watchman: 2022.10.03.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
    Android SDK:
      Android NDK: 24.0.8215888
  IDEs:
    Android Studio: 2021.1 AI-211.7628.21.2111.8309675
    Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.16.1 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.1.0 => 18.1.0
    react-native: 0.70.2 => 0.70.2
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps to reproduce

Snack, code example, screenshot, or link to a repository

https://github.com/kalyantm/test-app

@kalyantm kalyantm added Needs: Triage 🔍 Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules) labels Oct 22, 2022
@cortinico cortinico added the Tech: Codegen Related to react-native-codegen label Oct 24, 2022
@cortinico
Copy link
Contributor

So it basically boils down to - Am I misunderstanding how to specify a prop of type "array of objects" to codegen?

cc @cipolleschi

@cipolleschi
Copy link
Contributor

Hi @kalyantm!
The solution to this should be to create a named type for the <action, id> object.

Something like

interface Action {
  id: string;
  action: string;
}

And then use it like:

  //.. other props..
  actions: readonlyArray<Action>

Can you try something like this and tell me if it works?

Thank you so much!

@kalyantm
Copy link
Author

@cipolleschi Nope, did not work, i get an error when i run RCT_NEW_ARCH_ENABLED=1 arch=-x86_64 npx pod-install

/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:238
      throw new Error(`Unknown prop type for "${name}": ${type}`);
      ^

Error: Unknown prop type for "actions": TSInterfaceDeclaration
    at getTypeAnnotationForArray (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:238:13)
    at getTypeAnnotation (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:278:20)
    at buildPropSchema (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:585:21)
    at /Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:638:14
    at Array.map (<anonymous>)
    at getProps (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:637:6)
    at buildComponentSchema (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/components/index.js:237:17)
    at buildSchema (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/index.js:146:34)
    at Object.parseFile (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/index.js:185:10)
    at files.reduce.modules (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/cli/combine/combine-js-to-schema.js:76:30)
Error: Command failed: node /Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/cli/combine/combine-js-to-schema-cli.js /var/folders/r1/cf_8l8n95sn_0p7fsswk4fww0000gn/T/RNMenuSpecs1zfbvv/schema.json /Users/kalyantm/menu-app/MenuApp/node_modules/rn-menu/js
/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:238
      throw new Error(`Unknown prop type for "${name}": ${type}`);
      ^

Error: Unknown prop type for "actions": TSInterfaceDeclaration
    at getTypeAnnotationForArray (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:238:13)
    at getTypeAnnotation (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:278:20)
    at buildPropSchema (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:585:21)
    at /Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:638:14
    at Array.map (<anonymous>)
    at getProps (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:637:6)
    at buildComponentSchema (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/components/index.js:237:17)
    at buildSchema (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/index.js:146:34)
    at Object.parseFile (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/index.js:185:10)
    at files.reduce.modules (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/cli/combine/combine-js-to-schema.js:76:30)

    at checkExecSyncError (node:child_process:841:11)
    at execSync (node:child_process:912:15)
    at executeNodeScript (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native/scripts/codegen/generate-artifacts-executor.js:38:3)
    at generateSchema (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native/scripts/codegen/generate-artifacts-executor.js:314:3)
    at /Users/kalyantm/menu-app/MenuApp/node_modules/react-native/scripts/codegen/generate-artifacts-executor.js:373:26
    at Array.forEach (<anonymous>)
    at generateNativeCodegenFiles (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native/scripts/codegen/generate-artifacts-executor.js:362:13)
    at Object.execute (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native/scripts/codegen/generate-artifacts-executor.js:532:5)
    at Object.<anonymous> (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native/scripts/generate-artifacts.js:64:10) {
  status: 1,
  signal: null,
  output: [
    null,
    <Buffer >,
    <Buffer 2f 55 73 65 72 73 2f 6b 61 6c 79 61 6e 74 6d 2f 6d 65 6e 75 2d 61 70 70 2f 4d 65 6e 75 41 70 70 2f 6e 6f 64 65 5f 6d 6f 64 75 6c 65 73 2f 72 65 61 63 ... 1479 more bytes>
  ],
  pid: 64913,
  stdout: <Buffer >,
  stderr: <Buffer 2f 55 73 65 72 73 2f 6b 61 6c 79 61 6e 74 6d 2f 6d 65 6e 75 2d 61 70 70 2f 4d 65 6e 75 41 70 70 2f 6e 6f 64 65 5f 6d 6f 64 75 6c 65 73 2f 72 65 61 63 ... 1479 more bytes>
}
.

 #  from /Users/kalyantm/menu-app/MenuApp/ios/Podfile:13
 #  -------------------------------------------
 #
 >    use_react_native!(
 #      :path => config[:reactNativePath],
 #  -------------------------------------------
Couldn't install Pods. Updating the Pods project and trying again...
> pod install --repo-update
Auto-linking React Native module for target `MenuApp`: rn-menu
[Codegen] Adding script_phases to React-Codegen.
[Codegen] Generating ./build/generated/ios/React-Codegen.podspec.json

[!] Invalid `Podfile` file: [!] /usr/local/bin/node ./../node_modules/react-native/scripts/generate-artifacts.js -p /Users/kalyantm/menu-app/MenuApp/ios/.. -o /Users/kalyantm/menu-app/MenuApp/ios -e true -c

[Codegen] Processing react-native core libraries
[Codegen] Found react-native


[Codegen] >>>>> Searching for codegen-enabled libraries in /Users/kalyantm/menu-app/MenuApp/node_modules
[Codegen] Found rn-menu


[Codegen] >>>>> Searching for codegen-enabled libraries in react-native.config.js


[Codegen] >>>>> Searching for codegen-enabled libraries in the app


[Codegen] >>>>> Processing FBReactNativeSpec
[Codegen] Generated schema: /var/folders/r1/cf_8l8n95sn_0p7fsswk4fww0000gn/T/FBReactNativeSpecAqWwh7/schema.json
[Codegen] Generated artifacts: /Users/kalyantm/menu-app/MenuApp/ios/build/generated/ios


[Codegen] >>>>> Processing rncore
[Codegen] Generated schema: /var/folders/r1/cf_8l8n95sn_0p7fsswk4fww0000gn/T/rncorehLX969/schema.json
[Codegen] Generated artifacts: /Users/kalyantm/menu-app/MenuApp/ios/build/generated/ios


[Codegen] >>>>> Processing RNMenuSpecs


[Codegen] Done.
/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:238
      throw new Error(`Unknown prop type for "${name}": ${type}`);
      ^

Error: Unknown prop type for "actions": TSInterfaceDeclaration
    at getTypeAnnotationForArray (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:238:13)
    at getTypeAnnotation (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:278:20)
    at buildPropSchema (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:585:21)
    at /Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:638:14
    at Array.map (<anonymous>)
    at getProps (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:637:6)
    at buildComponentSchema (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/components/index.js:237:17)
    at buildSchema (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/index.js:146:34)
    at Object.parseFile (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/index.js:185:10)
    at files.reduce.modules (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/cli/combine/combine-js-to-schema.js:76:30)
Error: Command failed: node /Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/cli/combine/combine-js-to-schema-cli.js /var/folders/r1/cf_8l8n95sn_0p7fsswk4fww0000gn/T/RNMenuSpecsyryKQh/schema.json /Users/kalyantm/menu-app/MenuApp/node_modules/rn-menu/js
/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:238
      throw new Error(`Unknown prop type for "${name}": ${type}`);
      ^

Error: Unknown prop type for "actions": TSInterfaceDeclaration
    at getTypeAnnotationForArray (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:238:13)
    at getTypeAnnotation (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:278:20)
    at buildPropSchema (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:585:21)
    at /Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:638:14
    at Array.map (<anonymous>)
    at getProps (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:637:6)
    at buildComponentSchema (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/components/index.js:237:17)
    at buildSchema (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/index.js:146:34)
    at Object.parseFile (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/index.js:185:10)
    at files.reduce.modules (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/cli/combine/combine-js-to-schema.js:76:30)

    at checkExecSyncError (node:child_process:841:11)
    at execSync (node:child_process:912:15)
    at executeNodeScript (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native/scripts/codegen/generate-artifacts-executor.js:38:3)
    at generateSchema (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native/scripts/codegen/generate-artifacts-executor.js:314:3)
    at /Users/kalyantm/menu-app/MenuApp/node_modules/react-native/scripts/codegen/generate-artifacts-executor.js:373:26
    at Array.forEach (<anonymous>)
    at generateNativeCodegenFiles (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native/scripts/codegen/generate-artifacts-executor.js:362:13)
    at Object.execute (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native/scripts/codegen/generate-artifacts-executor.js:532:5)
    at Object.<anonymous> (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native/scripts/generate-artifacts.js:64:10) {
  status: 1,
  signal: null,
  output: [
    null,
    <Buffer >,
    <Buffer 2f 55 73 65 72 73 2f 6b 61 6c 79 61 6e 74 6d 2f 6d 65 6e 75 2d 61 70 70 2f 4d 65 6e 75 41 70 70 2f 6e 6f 64 65 5f 6d 6f 64 75 6c 65 73 2f 72 65 61 63 ... 1479 more bytes>
  ],
  pid: 64946,
  stdout: <Buffer >,
  stderr: <Buffer 2f 55 73 65 72 73 2f 6b 61 6c 79 61 6e 74 6d 2f 6d 65 6e 75 2d 61 70 70 2f 4d 65 6e 75 41 70 70 2f 6e 6f 64 65 5f 6d 6f 64 75 6c 65 73 2f 72 65 61 63 ... 1479 more bytes>
}
.

 #  from /Users/kalyantm/menu-app/MenuApp/ios/Podfile:13
 #  -------------------------------------------
 #
 >    use_react_native!(
 #      :path => config[:reactNativePath],
 #  -------------------------------------------
Couldn't install Pods. Updating the Pods project and trying again...
Command `pod install` failed.
└─ Cause: Invalid `Podfile` file: [!] /usr/local/bin/node ./../node_modules/react-native/scripts/generate-artifacts.js -p /Users/kalyantm/menu-app/MenuApp/ios/.. -o /Users/kalyantm/menu-app/MenuApp/ios -e true -c

[Codegen] Processing react-native core libraries
[Codegen] Found react-native


[Codegen] >>>>> Searching for codegen-enabled libraries in /Users/kalyantm/menu-app/MenuApp/node_modules
[Codegen] Found rn-menu


[Codegen] >>>>> Searching for codegen-enabled libraries in react-native.config.js


[Codegen] >>>>> Searching for codegen-enabled libraries in the app


[Codegen] >>>>> Processing FBReactNativeSpec
[Codegen] Generated schema: /var/folders/r1/cf_8l8n95sn_0p7fsswk4fww0000gn/T/FBReactNativeSpecAqWwh7/schema.json
[Codegen] Generated artifacts: /Users/kalyantm/menu-app/MenuApp/ios/build/generated/ios


[Codegen] >>>>> Processing rncore
[Codegen] Generated schema: /var/folders/r1/cf_8l8n95sn_0p7fsswk4fww0000gn/T/rncorehLX969/schema.json
[Codegen] Generated artifacts: /Users/kalyantm/menu-app/MenuApp/ios/build/generated/ios


[Codegen] >>>>> Processing RNMenuSpecs


[Codegen] Done.
/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:238
      throw new Error(`Unknown prop type for "${name}": ${type}`);
      ^

Error: Unknown prop type for "actions": TSInterfaceDeclaration
    at getTypeAnnotationForArray (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:238:13)
    at getTypeAnnotation (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:278:20)
    at buildPropSchema (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:585:21)
    at /Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:638:14
    at Array.map (<anonymous>)
    at getProps (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:637:6)
    at buildComponentSchema (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/components/index.js:237:17)
    at buildSchema (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/index.js:146:34)
    at Object.parseFile (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/index.js:185:10)
    at files.reduce.modules (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/cli/combine/combine-js-to-schema.js:76:30)
Error: Command failed: node /Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/cli/combine/combine-js-to-schema-cli.js /var/folders/r1/cf_8l8n95sn_0p7fsswk4fww0000gn/T/RNMenuSpecsyryKQh/schema.json /Users/kalyantm/menu-app/MenuApp/node_modules/rn-menu/js
/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:238
      throw new Error(`Unknown prop type for "${name}": ${type}`);
      ^

Error: Unknown prop type for "actions": TSInterfaceDeclaration
    at getTypeAnnotationForArray (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:238:13)
    at getTypeAnnotation (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:278:20)
    at buildPropSchema (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:585:21)
    at /Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:638:14
    at Array.map (<anonymous>)
    at getProps (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:637:6)
    at buildComponentSchema (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/components/index.js:237:17)
    at buildSchema (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/index.js:146:34)
    at Object.parseFile (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/parsers/typescript/index.js:185:10)
    at files.reduce.modules (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native-codegen/lib/cli/combine/combine-js-to-schema.js:76:30)

    at checkExecSyncError (node:child_process:841:11)
    at execSync (node:child_process:912:15)
    at executeNodeScript (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native/scripts/codegen/generate-artifacts-executor.js:38:3)
    at generateSchema (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native/scripts/codegen/generate-artifacts-executor.js:314:3)
    at /Users/kalyantm/menu-app/MenuApp/node_modules/react-native/scripts/codegen/generate-artifacts-executor.js:373:26
    at Array.forEach (<anonymous>)
    at generateNativeCodegenFiles (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native/scripts/codegen/generate-artifacts-executor.js:362:13)
    at Object.execute (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native/scripts/codegen/generate-artifacts-executor.js:532:5)
    at Object.<anonymous> (/Users/kalyantm/menu-app/MenuApp/node_modules/react-native/scripts/generate-artifacts.js:64:10) {
  status: 1,
  signal: null,
  output: [
    null,
    <Buffer >,
    <Buffer 2f 55 73 65 72 73 2f 6b 61 6c 79 61 6e 74 6d 2f 6d 65 6e 75 2d 61 70 70 2f 4d 65 6e 75 41 70 70 2f 6e 6f 64 65 5f 6d 6f 64 75 6c 65 73 2f 72 65 61 63 ... 1479 more bytes>
  ],
  pid: 64946,
  stdout: <Buffer >,
  stderr: <Buffer 2f 55 73 65 72 73 2f 6b 61 6c 79 61 6e 74 6d 2f 6d 65 6e 75 2d 61 70 70 2f 4d 65 6e 75 41 70 70 2f 6e 6f 64 65 5f 6d 6f 64 75 6c 65 73 2f 72 65 61 63 ... 1479 more bytes>
}
.

 #  from /Users/kalyantm/menu-app/MenuApp/ios/Podfile:13
 #  -------------------------------------------
 #
 >    use_react_native!(
 #      :path => config[:reactNativePath],
 #  -------------------------------------------

@kalyantm
Copy link
Author

@cipolleschi However, it does build if I define it like this:

type Action = Readonly<{
  identifier: string;
  title: string;
}>;

export interface NativeProps extends ViewProps {
  // other props
  actions?: ReadonlyArray<Action>;
}

But this again, leads to the same error in XCode:

Screenshot 2022-10-25 at 10 50 35 AM

@cipolleschi
Copy link
Contributor

Hum... That's weird, this should actually work.
I'll try to have a look at it today. Thank you for providing the sample repo!

@cipolleschi
Copy link
Contributor

I think I found the problem, @kalyantm.
I think that the codegen is missing this header:
#include <react/renderer/core/propsConversions.h> when it generates those nested structures. When I add it, it builds.

Could you try to add that header to the Props.h file in the React-Codegen/react/renderer/components/RNMenuSpecs Development Pods and see if it works at runtime too (I don't have an app set up to work with this component)?

If we confirm that this is the problem, we can fix it in the Codegen for everyone!
Thank you so much!

@cipolleschi
Copy link
Contributor

cipolleschi commented Oct 25, 2022

It puzzles me because here headers share a completely similar setup and the maintainer said that they are working... 🤔

but he is also testing against 0.69... although, I'm not aware of any changes on the Codegen related to this behavior...

@kalyantm
Copy link
Author

@cipolleschi Yup, including that header fixed it for me!

cipolleschi added a commit to cipolleschi/react-native that referenced this issue Oct 25, 2022
Summary:
Generated props with custom structs generates implement their own version of `fromRawProps` in the header file, which has to invoke `fromRawProps` in the framework which is not available.

This Diff adds the missing header in the generated `Props.h` file and updates the tests.

This should also fix [this issue] facebook#35054.

## Changelog:
[General][Fixed] - Add missing header in the Codegen for props with object types.

Differential Revision: D40674432

fbshipit-source-id: c18ea0941c252acfb9d42ef240940fccab2231a1
@kalyantm
Copy link
Author

@cipolleschi Is this merged in? I still have to manually add this in everytime I build 😅

@cipolleschi
Copy link
Contributor

cipolleschi commented Jan 25, 2023

No, unfortunately, it has not been merged, as the problem is more vicious than expected. We have other reports of this problem and I'm planning to fix it properly as soon as I have some time.

@cipolleschi
Copy link
Contributor

This commit a00cea4 may fix the problem.

Would you mind try it locally and let me know if it works? We may be able to cherry pick it for 0.71.3 if that's the case.

@github-actions
Copy link

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Jul 30, 2023
@cipolleschi
Copy link
Contributor

Fix shipped in 0.72

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Triage 🔍 Stale There has been a lack of activity on this issue and it may be closed soon. Tech: Codegen Related to react-native-codegen Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules)
Projects
None yet
Development

No branches or pull requests

3 participants