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

Turbomodule + Bridgeless support #602

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

sektr63a
Copy link

This PR converts Native module to Turbomodule
Also updates Example project.

Yasha33

This comment was marked as outdated.

@hyochan hyochan added 🚽 migration Activities due to changes in framework 🧊 breaking Something breaks labels Jun 9, 2024
@hyochan
Copy link
Owner

hyochan commented Jun 9, 2024

Wow this is huge 😅 Let me come back soon to review this.

@hyochan hyochan force-pushed the turbomodule-support branch 2 times, most recently from 7b53063 to b77f4d6 Compare June 11, 2024 08:51
Copy link
Owner

@hyochan hyochan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2024-06-12 at 12 49 12 AM

@sektr63a I am having issue testing this PR. I've posted the detailed error logs below. Could you kindly guide me how to test your PR? I hope I can ship your hard work 🙏

Also would it be possible to upgrade the example project to react-native 0.74.2 and not rc version?

Thank you so much again for your effort!

Error Logs

Auto-linking React Native modules for target `rnaudiorecorderplayer`: RNAudioRecorderPlayer and rn-fetch-blob
Framework build type is static library
[Codegen] Adding script_phases to React-Codegen.
[Codegen] Generating ./build/generated/ios/React-Codegen.podspec.json

[!] Invalid `Podfile` file: [!] /Users/hyo/.nvm/versions/node/v20.13.1/bin/node ./../node_modules/react-native/scripts/generate-codegen-artifacts.js -p /Users/hyo/Github/hyochan/react-native-audio-recorder-player/Example/ios/.. -o /Users/hyo/Github/hyochan/react-native-audio-recorder-player/Example/ios -t ios

[Codegen] Analyzing /Users/hyo/Github/hyochan/react-native-audio-recorder-player/Example/package.json
[Codegen] Searching for codegen-enabled libraries in the app.
[Codegen] The "codegenConfig" field is not defined in package.json. Assuming there is nothing to generate at the app level.
[Codegen] Searching for codegen-enabled libraries in the project dependencies.
[Codegen] Found react-native
[Codegen] Found react-native-audio-recorder-player


[Codegen] >>>>> Searching for codegen-enabled libraries in react-native.config.js
[Codegen] Processing FBReactNativeSpec
[Codegen] Searching for podspec in the project dependencies.
[Codegen] Processing rncore
[Codegen] Searching for podspec in the project dependencies.
[Codegen] Processing RNAudioRecorderPlayerSpec
[Codegen] Searching for podspec in the project dependencies.
[Codegen] Supported Apple platforms: ios for RNAudioRecorderPlayerSpec
[Codegen] Done.
UnsupportedGenericParserError: Module NativeAudioRecorderPlayer: Unrecognized generic type 'AudioSet' in NativeModule spec.
    at translateTypeReferenceAnnotation (/Users/hyo/Github/hyochan/react-native-audio-recorder-player/Example/node_modules/@react-native/codegen/lib/parsers/typescript/modules/index.js:148:15)
    at translateTypeAnnotation (/Users/hyo/Github/hyochan/react-native-audio-recorder-player/Example/node_modules/@react-native/codegen/lib/parsers/typescript/modules/index.js:222:14)
    at /Users/hyo/Github/hyochan/react-native-audio-recorder-player/Example/node_modules/@react-native/codegen/lib/parsers/parsers-commons.js:373:11
    at guard (/Users/hyo/Github/hyochan/react-native-audio-recorder-player/Example/node_modules/@react-native/codegen/lib/parsers/utils.js:26:14)
    at translateFunctionTypeAnnotation (/Users/hyo/Github/hyochan/react-native-audio-recorder-player/Example/node_modules/@react-native/codegen/lib/parsers/parsers-commons.js:367:25)
    at buildPropertySchema (/Users/hyo/Github/hyochan/react-native-audio-recorder-player/Example/node_modules/@react-native/codegen/lib/parsers/parsers-commons.js:484:7)
    at /Users/hyo/Github/hyochan/react-native-audio-recorder-player/Example/node_modules/@react-native/codegen/lib/parsers/parsers-commons.js:705:24
    at guard (/Users/hyo/Github/hyochan/react-native-audio-recorder-player/Example/node_modules/@react-native/codegen/lib/parsers/utils.js:26:14)
    at /Users/hyo/Github/hyochan/react-native-audio-recorder-player/Example/node_modules/@react-native/codegen/lib/parsers/parsers-commons.js:702:14
    at Array.map (<anonymous>) {
  nodes: [
    Node {
      type: 'TSTypeReference',
      start: 426,
      end: 434,
      loc: [SourceLocation],
      typeName: [Node]
    }
  ]
}
.

 #  from /Users/hyo/Github/hyochan/react-native-audio-recorder-player/Example/ios/Podfile:20
 #  -------------------------------------------
 #  
 >    use_react_native!(
 #      :path => config[:reactNativePath],
 #  -------------------------------------------

[!] [Codegen] warn: using experimental new codegen integration

What I did

  1. Install with yarn from root of the project.
  2. Navigate to Example and install packages with yarn.
  3. Run yarn ios (Also tried pod update && pod install).

@hyochan hyochan requested a review from Yasha33 June 17, 2024 17:03
@sektr63a
Copy link
Author

sektr63a commented Jun 27, 2024

Hello @hyochan

I've just investigated the issue you faced. The main problem is with the types you added:
The AudioSet type contains an enum, which is not supported by codegen.
The same applies to the Record type.

There is some useful article about codegen type mapping.
https://github.com/reactwg/react-native-new-architecture/blob/main/docs/appendix.md#iii-typescript-to-native-type-mapping

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧊 breaking Something breaks 🚽 migration Activities due to changes in framework
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants