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

[ISSUE_5032][ANDROID] fix Error: Missing Realm constructor. When New Architecture is enabled #5683

Merged
merged 3 commits into from
Apr 3, 2023

Conversation

zabutok
Copy link
Contributor

@zabutok zabutok commented Apr 1, 2023

What, How & Why?

This closes #5032.

☑️ ToDos

  • 📝 Changelog entry
  • 🚦 Tests

*fix Error: Missing Realm constructor. When New Architecture is enabled
@cla-bot
Copy link

cla-bot bot commented Apr 1, 2023

Realm welcomes all contributions! The only requirement we have is that, like many other projects, we need to have a Contributor License Agreement (CLA) in place before we can accept any external code. Our own CLA is a modified version of the Apache Software Foundation’s CLA. Our records show that CLA has not been signed by @zabutok. Please submit your CLA electronically using our Google form so we can accept your submissions. After signing the CLA you can recheck this PR with a @cla-bot check comment. The GitHub usernames you file there will need to match that of your Pull Requests. If you have any questions or cannot file the CLA electronically, make a comment here and we will be happy to help you out.

@zabutok
Copy link
Contributor Author

zabutok commented Apr 1, 2023

@cla-bot check

@cla-bot cla-bot bot added the cla: yes label Apr 1, 2023
@cla-bot
Copy link

cla-bot bot commented Apr 1, 2023

The cla-bot has been summoned, and re-checked this pull request!

@kraenhansen
Copy link
Member

kraenhansen commented Apr 2, 2023

Thanks for your contribution. We want to support building with the new architecture enabled, but we also want to support building with it disabled. Specifically I want us to adopt the multi sourceset approach outlined in this tutorial: https://github.com/react-native-community/RNNewArchitectureLibraries/tree/feat/back-turbomodule#android-sourceset

I suppose a follow-up question is: Does this support both new architecture enabled and disabled?

@zabutok
Copy link
Contributor Author

zabutok commented Apr 2, 2023

@kraenhansen From my side I can confirm what is works for both flags when architecture enabled and disabled. Also I am not so good in new realm implementation but as I can understood realm can't be used without turbo modules with Hermes. At least it is not so easy. In my own project it works for both implementation.

Comment on lines 45 to 48
Class<? extends NativeModule>[] moduleList =
new Class[] {
RealmReactModule.class, RealmReactModule.class,
};
Copy link
Member

Choose a reason for hiding this comment

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

Seems a bit complicated to use an array and loop, since we only have one module class? Is this code copied from somewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not copied but i was trying to reproduce react-native-reanimated implementation because their implementation works pretty well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually yes I think I can simplify it

@zabutok zabutok requested a review from kraenhansen April 3, 2023 19:51
@kraenhansen
Copy link
Member

I've verified this works both with the new architecture enabled and disabled.
Thanks a lot for your contribution @zabutok!

@kraenhansen kraenhansen merged commit 7da21e6 into realm:main Apr 3, 2023
@kraenhansen
Copy link
Member

We just released this as v12.0.0-alpha.2.
Thanks again for your contribution.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error: Missing Realm constructor. When New Architecture is enabled
2 participants