-
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Description Added basic support for new (fabric) architecture. ## Motivation and Context The reason of prioritising a fabric adoption is an ability to perform sync communication between Native and JS thread. Especially it may become handy during the implementation of interactive keyboard on Android. Current implementation allows to use both (old - paper, and new - fabric) architectures. Unfortunately, it seems like Swift is not supported in new arch, so I had to rewrite some files to ObjC. I hope at some point of time we will bring it back to Swift. > For fabric adoption I used this [repo](https://github.com/software-mansion-labs/appjs-2022-workshops-fabric) as an example of how to add a basic support. ## Changelog ### CI - added `cpplint` as C++ codebase most likely will be increased over development iterations; ### JS - which exposes `isFabricEnabled` and `isTurboModuleEnabled` variables; - added View/Modules specification for new arch; ### iOS - changed files extension from `.m` to `.mm` to support C++; - added fabric support; ### Android - added fabric support; ## How Has This Been Tested? Tested manually on: - iPhone 11 (iOS 15.5, simulator); - Pixel 3 (API 32, emulator). ## Checklist - [x] CI successfully passed
- Loading branch information
1 parent
11201cd
commit f6b1fa0
Showing
49 changed files
with
990 additions
and
219 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Verify C++ | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- '.github/workflows/validate-cpp.yml' | ||
- 'android/src/main/**' | ||
pull_request: | ||
paths: | ||
- '.github/workflows/validate-cpp.yml' | ||
- 'android/src/main/**' | ||
|
||
jobs: | ||
lint: | ||
name: cpplint | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [3.7] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install cpplint | ||
- name: Run cpplint | ||
run: cpplint --linelength=230 --filter=-legal/copyright,-readability/todo,-build/namespaces,-whitespace/comments,-build/c++11,-runtime/int,-runtime/references --quiet --recursive android/src/main/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...src/fabric/java/com/reactnativekeyboardcontroller/KeyboardControllerComponentsRegistry.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.reactnativekeyboardcontroller | ||
|
||
import com.facebook.jni.HybridData | ||
import com.facebook.proguard.annotations.DoNotStrip | ||
import com.facebook.react.fabric.ComponentFactory | ||
import com.facebook.soloader.SoLoader | ||
|
||
@DoNotStrip | ||
class KeyboardControllerComponentsRegistry @DoNotStrip private constructor(componentFactory: ComponentFactory) { | ||
companion object { | ||
@DoNotStrip | ||
fun register(componentFactory: ComponentFactory): KeyboardControllerComponentsRegistry { | ||
return KeyboardControllerComponentsRegistry(componentFactory) | ||
} | ||
|
||
init { | ||
SoLoader.loadLibrary("fabricjni") | ||
SoLoader.loadLibrary("reactnativekeyboardcontroller_modules") | ||
} | ||
} | ||
|
||
@DoNotStrip | ||
private val mHybridData: HybridData | ||
|
||
@DoNotStrip | ||
private external fun initHybrid(componentFactory: ComponentFactory): HybridData | ||
|
||
init { | ||
mHybridData = initHybrid(componentFactory) | ||
} | ||
} |
Oops, something went wrong.