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

Add Fabric support #493

Merged
merged 13 commits into from
Nov 3, 2022
Merged

Conversation

gispada
Copy link
Contributor

@gispada gispada commented Sep 18, 2022

Closes #487

The goal of this PR is to add Fabric support, while keeping the library compatible with the old architecture.

I've also updated several packages, including of course React and React Native. The example app has been updated as well, even though the segmented control used there does not yet support Fabric.

The majority of the work is done, I am testing my changes. I think it's ready to be merged now, status changed to Ready for review.

Feedback is welcome, especially from the library maintainers, and also from everybody that is willing to test this migration.

@gispada gispada marked this pull request as ready for review September 23, 2022 06:44
@Titozzz
Copy link
Collaborator

Titozzz commented Oct 6, 2022

This actually looks good, I'll share it with some Meta devs to get more feedback, but well done. 🥳

Copy link

@WoLewicki WoLewicki left a comment

Choose a reason for hiding this comment

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

I added some comments. It looks good overall 🎉

@@ -133,8 +143,8 @@ dependencies {

if (isNewArchitectureEnabled()) {

Choose a reason for hiding this comment

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

Is it if still necessary if you target the newest RN version with your library?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My goal was to treat the new architecture as opt-in. Maybe removing this check here does not cause any trouble, but I'd keep it for safety.

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Lines removed; I moved javaPackageName to Codegen config in package.json.

@@ -0,0 +1,72 @@
#ifdef RCT_NEW_ARCH_ENABLED

Choose a reason for hiding this comment

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

Do you need to separate this to another component? Maybe it would be easier for BlurView to extend RCTViewComponentView on new arch and UIView on old arch and make it implement the needed methods on new arch? Or am I missing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Deleted the extra BlurViewComponentView and used #ifdef guards in the original BlurView.

@@ -0,0 +1,15 @@
#ifdef RCT_NEW_ARCH_ENABLED

Choose a reason for hiding this comment

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

Same here as for BlurView, since VibrancyView would still inherit from BlurView, which would inherit from RCTViewComponentView, it would work correctly then. It's done this way e.g. in react-native-svg for all components: https://github.com/react-native-svg/react-native-svg/blob/f49728d783c952a97c29a8bdb3b4ad688fca2330/apple/RNSVGNode.h and e.g.: https://github.com/react-native-svg/react-native-svg/blob/f49728d783c952a97c29a8bdb3b4ad688fca2330/apple/Elements/RNSVGDefs.mm

Copy link
Contributor Author

@gispada gispada Oct 9, 2022

Choose a reason for hiding this comment

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

Deleted the extra VibrancyViewComponentView; now it's directly inheriting from BlurView. I also removed the updateProps method, as it's the same as the one BlurView implements.

@gispada
Copy link
Contributor Author

gispada commented Oct 9, 2022

Thanks for the review @WoLewicki. I refactored the code based on your comments.

@EkaterinaMozheiko
Copy link

Hi! First of all, thank you @gispada for this work! I'm wondering when this branch is going to be merged :) I checked it in my project, everything works fine.

@Titozzz Titozzz merged commit e38cf5d into Kureev:master Nov 3, 2022
Titozzz pushed a commit that referenced this pull request Nov 3, 2022
* build(deps): update react-native

* feat: codegen setup for BlurView component

* feat: add basic Fabric component for BlurView (iOS)

* feat(iOS): implement updateProps Fabric method

* feat(iOS): migrate VibrancyView

* feat(Android): add code for new and old architecture

* chore: update dependencies and example app

* fix(iOS): interface VibrancyViewComponentView

* refactor: separate codegen specs by platform

* refactor: rename Android component file to avoid a bug in Codegen

* refactor: delete/rename files

* refactor: conditionally include Fabric code in the original views

* refactor: remove unnecessary code in build.gradle
priemskiyyy added a commit to priemskiyyy/react-native-blur that referenced this pull request Sep 25, 2023
* added mavenCentral() for gradle builds (Kureev#418)

* refactor: typescript, hooks, build.gradle & podspec fixes and moved t…

* chore: update Readme.md to reflect new maintainer

* feat: update android blurview to 2.0.2 (Kureev#478)

* feat: extend android properties (Kureev#481)

* refactor: migrate example app to use RNTA (Kureev#484)

* fix(android): build issue on compileSdkVersion < 31 (Kureev#485)

* chore: release 4.2.0

* feat: Add Fabric support (Kureev#493)

* chore: release 4.3.0

* chore: update README.md (Kureev#494)

* New "transparent" blurType that turns every blurEffectView subview ba…

* Add "transparent" blur type to README.md, BlurView.ios.tsx and BlurVi…

* Fix blurType in VibrancyViewNativeComponent.ts

* feat(iOS): transparent blur type

* Merge branch 'master' into pr/513
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Fabric
4 participants