Skip to content

Add fabric on Android - #402

Merged
okwasniewski merged 14 commits into
chore/fabric-migrationfrom
chore/fabric-android
Aug 4, 2022
Merged

Add fabric on Android#402
okwasniewski merged 14 commits into
chore/fabric-migrationfrom
chore/fabric-android

Conversation

@okwasniewski

@okwasniewskiokwasniewski commented Jul 25, 2022

Copy link
Copy Markdown
Contributor

Summary:

  • Configure gradle files
  • Implement / extend the generated native interfaces
  • Ensure backwards compatibility by splitting implementations into two folders.

Used examples / references:

Test Plan:

  • Setup fabric example to test the app using RN 0.70 RC

Test plan for RN <0.70:

  1. Set newArchEnabled to true inside example/android/gradle.properties
  2. Add this line in example/android/app/src/main/jni/Android.mk file.
+ include $(NODE_MODULES_DIR)/@react-native-community/slider/android/build/generated/source/codegen/jni/Android.mk
include $(CLEAR_VARS)

In the same file above, go to the LOCAL_SHARED_LIBRARIES setting and add the following line:

 libreact_codegen_rncore \
+ libreact_codegen_ReactSlider \
libreact_debug \
  1. Update example/android/app/src/main/jni/MainComponentsRegistry.cpp
#include <react/renderer/components/rncore/ComponentDescriptors.h>+ #include <react/renderer/components/ReactSlider/ComponentDescriptors.h>
...
MainComponentsRegistry::sharedProviderRegistry() {
auto providerRegistry = CoreComponentsRegistry::sharedProviderRegistry();
// Custom Fabric Components go here. You can register custom
// components coming from your App or from 3rd party libraries here.
//
// providerRegistry->add(concreteComponentDescriptorProvider<
// AocViewerComponentDescriptor>());
+ providerRegistry->add(concreteComponentDescriptorProvider<RNCSliderComponentDescriptor>());
return providerRegistry;
}

Then, to launch the project run:

npm run install && npm run example-android

@okwasniewski

Copy link
Copy Markdown
ContributorAuthor

This PR is part of #380 - linking this to the issue.

@okwasniewski
okwasniewski marked this pull request as ready for review July 26, 2022 08:00
@okwasniewski
okwasniewski changed the base branch from chore/fabric-migration to chore/fabric-setupJuly 26, 2022 08:59
@okwasniewski
okwasniewskiforce-pushed the chore/fabric-android branch 5 times, most recently from 3f4c0b1 to cf24a40CompareJuly 29, 2022 08:44
@okwasniewski
okwasniewski changed the base branch from chore/fabric-setup to chore/fabric-migrationAugust 2, 2022 18:11

@BartoszKlonowskiBartoszKlonowski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I left some very minor comments, but it's totally well done!
Thank you! 👍

Comment threadpackage/android/build.gradle
Comment threadpackage/android/build.gradle Outdated
Comment threadpackage/src/Slider.js
inverted?: WithDefault<boolean, false>,
vertical?: ?boolean,
tapToSeek?: ?boolean,
tapToSeek?: WithDefault<boolean, false>,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍

@okwasniewski
okwasniewski merged commit 51bc969 into chore/fabric-migrationAug 4, 2022
@okwasniewskiokwasniewski mentioned this pull request Aug 4, 2022
okwasniewski added a commit that referenced this pull request Aug 8, 2022
* Add fabric on iOS (#400)
* Update podspec file for fabric
* Define codegen spec & move import to separate file
* Add codegenConfig in package.json
* Update podspec to detect .mm files
* Change spec types to floats
* Implement fabric component with props updating
* Re-order functions, add accessibilityIncrements prop
* Clean up imports, remove comment
* Sort out props updating, remove unused functions
* Add event handling
* Add tapToSeek implementation
* Fix tapToSeek
* Handle images using bridge
* Add missing typedef
* Verify the build for new arch with GH Actions
* Save new-arch Pods under new-arch cache key
* Use Podfile.lock with old arch and regenerate for new one
* Correct path for new arch Podfile.lock creation
* Disable flipper in Podfile
* Install pods with new arch flag
* Fix tapToSeek on iOS
* Allow value property to be controlled
* Generate project.pbxproj for new arch
* Separate npm & pods step in CI
* Change step names, fix cache keys
* Remove pods cache
* Run npm install if cache was not found
* Run build using xcodebuild
* Fix: Pods-related error after using Pods from cache (#407)
* Bring back Pods to cache
* Use new-arch string in key for new arch cache
* Try to reinstall pods instead of creating new
* Separate deps installation between two caches
* Rename Pods reinstall step
* Remove explicit folly version, default to old arch
* Add clean scripts in example for codegen cleanup
* Change CI step names
* Remove isFabricEnabled
This check is no longer needed.
Co-authored-by: BartoszKlonowski <Bartosz.Klonowski@callstack.com>
* Add fabric on Android (#402)
* Configure build.gradle
* Update libraryName on android
* Create ReactSlider shared implementation
* Split implementations into oldarch and newarch
* Dispatch events
* Cleanup eventDispatcher
* Make oldarch implementation use shared code
* Add defaults to js spec
* Clean up newarch ReactSliderManager
* Reorder props to fix disabled state
* Handle TestID setter
* Move ReactSliderShadowNode to shared implementation
* Share getExportedCustomDirectEventTypeConstants
* Remove comments, add empty line
Sign up for freeto 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.

3 participants

@okwasniewski@thymikee@BartoszKlonowski