-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat: Bridgeless with runtimeExecutor #5734
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
Merged
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
4f2a40d
feat: update codebase
WoLewicki ac05330
chore: bump to rc1
WoLewicki 76032a7
feat: all changes at once
WoLewicki 2414a5b
feat: compat with old arch and 73
WoLewicki 03ab7db
fix: use nativeState only if it is already available
WoLewicki 2934057
restore proper code on Android
WoLewicki 7276085
fix: inline fabric check
WoLewicki 9f784d8
restore migrated libs to example and make ts work
WoLewicki 043f74e
fix: quick fix for scrollviews
WoLewicki e5a24cf
chore: merge current main
WoLewicki 4725d56
feat: merge changes from other PRs
WoLewicki d28993e
Fixes for Reanimated with Bridgeless (#5807)
tjzel 9e49b4d
mergele main
tjzel 83f4df6
cleanup pt1
tjzel c2ee572
cleanup pt2
tjzel f9da12f
cleanup pt3
tjzel e555ab1
cleanup pt4
tjzel 2efade7
use type RuntimeExecutor
tjzel aad5cc7
backwards compat and review changes
tjzel 2293683
include utility for CI
tjzel 890cbf2
formatting
tjzel 0baf837
dedupe code
tjzel fcd9081
dont bump locks and add endif comment
tjzel fa78d67
throw if no FabricUIManager
tjzel ffb7412
restore JSScheduler.cpp
tjzel e92e530
review changes
tjzel 683363a
review
tjzel 3f3ae7f
Merge branch 'main' into @wolewicki/bridgeless-mode-with-runtime-exec…
tjzel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,12 +1,30 @@ | ||
| #include "JSScheduler.h" | ||
|
|
||
| #include <utility> | ||
| using namespace facebook; | ||
| using namespace react; | ||
|
|
||
| namespace reanimated { | ||
| JSScheduler::JSScheduler( | ||
| jsi::Runtime &rnRuntime, | ||
| const std::shared_ptr<CallInvoker> &jsCallInvoker) | ||
| : rnRuntime_(rnRuntime), | ||
| jsCallInvoker_(jsCallInvoker), | ||
| scheduleOnJS([&](Job job) { | ||
| jsCallInvoker_->invokeAsync( | ||
| [job = std::move(job), &rt = rnRuntime_] { job(rt); }); | ||
| }) {} | ||
tjzel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| void JSScheduler::scheduleOnJS(std::function<void(jsi::Runtime &rt)> job) { | ||
| jsCallInvoker_->invokeAsync( | ||
| [job = std::move(job), &rt = rnRuntime_] { job(rt); }); | ||
| } | ||
| #if REACT_NATIVE_MINOR_VERSION >= 74 && defined(RCT_NEW_ARCH_ENABLED) | ||
| // With `runtimeExecutor`. | ||
| JSScheduler::JSScheduler( | ||
| jsi::Runtime &rnRuntime, | ||
| RuntimeExecutor runtimeExecutor) | ||
| : rnRuntime_(rnRuntime), | ||
| runtimeExecutor_(runtimeExecutor), | ||
| scheduleOnJS([&](Job job) { | ||
| runtimeExecutor_( | ||
| [job = std::move(job)](jsi::Runtime &runtime) { job(runtime); }); | ||
| }) {} | ||
| #endif // REACT_NATIVE_MINOR_VERSION >= 74 && defined(RCT_NEW_ARCH_ENABLED | ||
|
|
||
| } // namespace reanimated | ||
This file contains hidden or 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 |
|---|---|---|
| @@ -1,25 +1,42 @@ | ||
| #pragma once | ||
|
|
||
| #include <ReactCommon/CallInvoker.h> | ||
| #include <ReactCommon/RuntimeExecutor.h> | ||
WoLewicki marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| #include <jsi/jsi.h> | ||
|
|
||
| #include <memory> | ||
| #include <utility> | ||
|
|
||
| using namespace facebook; | ||
| using namespace react; | ||
|
|
||
| using Job = std::function<void(jsi::Runtime &rt)>; | ||
|
|
||
| namespace reanimated { | ||
|
|
||
| class JSScheduler { | ||
| public: | ||
| // With `jsCallInvoker`. | ||
| explicit JSScheduler( | ||
| jsi::Runtime &rnRuntime, | ||
| const std::shared_ptr<CallInvoker> &jsCallInvoker); | ||
|
|
||
| #if REACT_NATIVE_MINOR_VERSION >= 74 && defined(RCT_NEW_ARCH_ENABLED) | ||
| // With `runtimeExecutor`. | ||
| explicit JSScheduler( | ||
| jsi::Runtime &rnRuntime, | ||
| const std::shared_ptr<facebook::react::CallInvoker> &jsCallInvoker) | ||
| : rnRuntime_(rnRuntime), jsCallInvoker_(jsCallInvoker) {} | ||
| void scheduleOnJS(std::function<void(jsi::Runtime &rt)> job); | ||
| RuntimeExecutor runtimeExecutor); | ||
| #endif // REACT_NATIVE_MINOR_VERSION >= 74 && defined(RCT_NEW_ARCH_ENABLED | ||
|
|
||
| protected: | ||
| jsi::Runtime &rnRuntime_; | ||
| const std::shared_ptr<facebook::react::CallInvoker> jsCallInvoker_; | ||
| const std::shared_ptr<CallInvoker> jsCallInvoker_ = nullptr; | ||
| #if REACT_NATIVE_MINOR_VERSION >= 74 && defined(RCT_NEW_ARCH_ENABLED) | ||
| RuntimeExecutor runtimeExecutor_ = nullptr; | ||
| #endif // REACT_NATIVE_MINOR_VERSION >= 74 && defined(RCT_NEW_ARCH_ENABLED | ||
|
|
||
| public: | ||
| const std::function<void(Job)> scheduleOnJS = nullptr; | ||
| }; | ||
|
|
||
| } // namespace reanimated | ||
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -30,7 +30,7 @@ - (NSURL *)bundleURL | |
|
|
||
| - (BOOL)bridgelessEnabled | ||
| { | ||
| return NO; | ||
| return YES; | ||
| } | ||
|
|
||
| @end | ||
This file contains hidden or 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 hidden or 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 hidden or 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
File renamed without changes.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.