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

Cannot init reanimated in iOS share extension #6861

Open
MaxAst opened this issue Dec 30, 2024 · 2 comments
Open

Cannot init reanimated in iOS share extension #6861

MaxAst opened this issue Dec 30, 2024 · 2 comments
Labels
Platform: iOS This issue is specific to iOS Repro provided A reproduction with a snippet of code, snack or repo is provided

Comments

@MaxAst
Copy link

MaxAst commented Dec 30, 2024

Description

Hey there! I'm the author of expo-share-extension and I'm currently in the process of getting it ready to run on bridgeless on the new architecture. I managed to get it working with plain react native, but when I use reanimated in the share extension view, I get the following error:

(NOBRIDGE) ERROR  ReanimatedError: [Reanimated] Native part of Reanimated doesn't seem to be initialized.
See https://docs.swmansion.com/react-native-reanimated/docs/guides/troubleshooting#native-part-of-reanimated-doesnt-seem-to-be-initialized for more details.

when I run pod install, I can see from the logs that the reanimated pod gets installed successfully for the share extension target, so I don't think it's an installation/linking issue. I assume there's something I need to add to the ShareExtensionViewController, which sets up react native inside the share extension's UIViewController?

Steps to reproduce

  1. git clone [email protected]:MaxAst/expo-share-extension.git
  2. git checkout fix/monorepo-support
  3. npm install
  4. npm run build
  5. npm ruin build plugin
  6. cd examples/basic
  7. npm install
  8. npm run prebuild
  9. npm run ios
  10. navigate to Safari on the Simulator and open a random webpage
  11. press on Safari's share icon in the bottom
  12. select the basic example app's icon in the share menu
  13. wait for metro to bundle index.share.js and you should see the above error in the console

Snack or a link to a repository

https://github.com/MaxAst/expo-share-extension/tree/fix/monorepo-support/examples/basic

Reanimated version

3.16.6

React Native version

0.76.5

Platforms

iOS

JavaScript runtime

Hermes

Workflow

Expo Dev Client

Architecture

Fabric (New Architecture)

Build type

Debug app & dev bundle

Device

iOS simulator

Device model

No response

Acknowledgements

Yes

@github-actions github-actions bot added Repro provided A reproduction with a snippet of code, snack or repo is provided Platform: iOS This issue is specific to iOS labels Dec 30, 2024
@MaxAst
Copy link
Author

MaxAst commented Jan 18, 2025

@tomekzaw any pointers would be really helpful! I already have a react native app running in a swift view controller using new arch and bridgeless mode. An example of how to initialize reanimated would be really great, right now it's a bit of a blackbox and there's nothing about it in the docs

@tomekzaw
Copy link
Member

@MaxAst You'll need to call ReanimatedTurboModule.installTurboModule(); which injects global.__reanimatedModuleProxy. Please check out this part of the code:

if (global.__reanimatedModuleProxy === undefined) {
ReanimatedTurboModule?.installTurboModule();
}
if (global.__reanimatedModuleProxy === undefined) {
throw new ReanimatedError(
`Native part of Reanimated doesn't seem to be initialized.
See https://docs.swmansion.com/react-native-reanimated/docs/guides/troubleshooting#native-part-of-reanimated-doesnt-seem-to-be-initialized for more details.`
);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: iOS This issue is specific to iOS Repro provided A reproduction with a snippet of code, snack or repo is provided
Projects
None yet
Development

No branches or pull requests

2 participants