Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ void UIRuntimeDecorator::decorate(
const ProgressLayoutAnimationFunction progressLayoutAnimation,
const EndLayoutAnimationFunction endLayoutAnimation,
const MaybeFlushUIUpdatesQueueFunction maybeFlushUIUpdatesQueue) {
uiRuntime.global().setProperty(uiRuntime, "_UI", true);

#ifdef RCT_NEW_ARCH_ENABLED
jsi_utils::installJsiFunction(uiRuntime, "_updatePropsFabric", updateProps);
jsi_utils::installJsiFunction(
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-reanimated/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
"axios": "^1.7.4",
"babel-eslint": "^10.1.0",
"babel-plugin-module-resolver": "^5.0.0",
"clang-format-node": "^1.2.4",
"clang-format-node": "^1.3.1",
"code-tag": "^1.1.0",
"cspell": "^8.8.0",
"eslint": "^8.57.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <worklets/NativeModules/WorkletsModuleProxy.h>
#include <worklets/SharedItems/Shareables.h>
#include <worklets/Tools/Defs.h>
#include <worklets/WorkletRuntime/UIRuntimeDecorator.h>

#ifdef __ANDROID__
#include <fbjni/fbjni.h>
Expand Down Expand Up @@ -37,7 +38,9 @@ WorkletsModuleProxy::WorkletsModuleProxy(
jsScheduler,
"Reanimated UI runtime",
true /* supportsLocking */,
valueUnpackerCode_)) {}
valueUnpackerCode_)) {
UIRuntimeDecorator::decorate(uiWorkletRuntime_->getJSIRuntime());
}

WorkletsModuleProxy::~WorkletsModuleProxy() {
jsQueue_->quitSynchronous();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include <worklets/Tools/ReanimatedJSIUtils.h>
#include <worklets/WorkletRuntime/UIRuntimeDecorator.h>

using facebook::jsi::Runtime;

namespace worklets {

void UIRuntimeDecorator::decorate(Runtime &uiRuntime) {
uiRuntime.global().setProperty(uiRuntime, "_UI", true);

// TODO: Without the following you can't do `runOnUI` since the
// queue is not established. Decide if it should be here or in
// Reanimated.
// jsi_utils::installJsiFunction(
// uiRuntime, "_maybeFlushUIUpdatesQueue", maybeFlushUIUpdatesQueue);
}

} // namespace worklets
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#pragma once

#include <jsi/jsi.h>

namespace worklets {

class UIRuntimeDecorator {
public:
static void decorate(facebook::jsi::Runtime &uiRuntime);
};

} // namespace worklets
6 changes: 5 additions & 1 deletion packages/react-native-worklets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
"description": "The React Native multithreading library",
"scripts": {
"build": "bob build",
"format": "yarn format:js",
"format": "yarn format:js && yarn format:common",
"format:js": "prettier --write --list-different src",
"format:common": "find Common -iname \"*.h\" -o -iname \"*.cpp\" | xargs clang-format -i",
"lint": "yarn lint:js",
"lint:js": "eslint src && yarn prettier --check src",
"type:check": "yarn tsc --noEmit",
Expand Down Expand Up @@ -87,5 +88,8 @@
"android": {
"javaPackageName": "com.swmansion.worklets"
}
},
"dependencies": {
"clang-format-node": "^1.3.1"
}
}
27 changes: 21 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8538,13 +8538,15 @@ __metadata:
languageName: node
linkType: hard

"clang-format-node@npm:^1.2.4":
version: 1.2.4
resolution: "clang-format-node@npm:1.2.4"
"clang-format-node@npm:^1.3.1":
version: 1.3.1
resolution: "clang-format-node@npm:1.3.1"
dependencies:
shx: "npm:^0.3.4"
bin:
clang-format: build/cli.js
clang-format-node: build/cli.js
checksum: 10/e28c6c123217c3821a6077e13884e7496474a5ad97965a0ac085939eb4d3346b15a5a78d7320c301238e074edb79578c99d5a322e2ef422154a7e310edf448bb
checksum: 10/242ccb38e24efafadd84fa3e8e3f2b79cc9ecc447f9b3d33774e898f3f7476bfb02dfee32835a30f887586597e8fd41592e99fd7939278a3dcc078aa859b559b
languageName: node
linkType: hard

Expand Down Expand Up @@ -16165,7 +16167,7 @@ __metadata:
languageName: node
linkType: hard

"minimist@npm:^1.2.0, minimist@npm:^1.2.5, minimist@npm:^1.2.6, minimist@npm:^1.2.8":
"minimist@npm:^1.2.0, minimist@npm:^1.2.3, minimist@npm:^1.2.5, minimist@npm:^1.2.6, minimist@npm:^1.2.8":
version: 1.2.8
resolution: "minimist@npm:1.2.8"
checksum: 10/908491b6cc15a6c440ba5b22780a0ba89b9810e1aea684e253e43c4e3b8d56ec1dcdd7ea96dde119c29df59c936cde16062159eae4225c691e19c70b432b6e6f
Expand Down Expand Up @@ -18070,7 +18072,7 @@ __metadata:
axios: "npm:^1.7.4"
babel-eslint: "npm:^10.1.0"
babel-plugin-module-resolver: "npm:^5.0.0"
clang-format-node: "npm:^1.2.4"
clang-format-node: "npm:^1.3.1"
code-tag: "npm:^1.1.0"
convert-source-map: "npm:^2.0.0"
cspell: "npm:^8.8.0"
Expand Down Expand Up @@ -18192,6 +18194,7 @@ __metadata:
"@types/jest": "npm:^29.5.5"
"@types/react": "npm:^18.2.44"
"@typescript-eslint/eslint-plugin": "npm:^6.19.0"
clang-format-node: "npm:^1.3.1"
eslint: "npm:^8.57.0"
eslint-plugin-reanimated: "workspace:*"
madge: "npm:^5.0.1"
Expand Down Expand Up @@ -19421,6 +19424,18 @@ __metadata:
languageName: node
linkType: hard

"shx@npm:^0.3.4":
version: 0.3.4
resolution: "shx@npm:0.3.4"
dependencies:
minimist: "npm:^1.2.3"
shelljs: "npm:^0.8.5"
bin:
shx: lib/cli.js
checksum: 10/5271b60f7e322540799102ad6935121f10c857a995a1321357a7bffd1628674a4758a602153dc5cc126d8dc94d3489586587d3dee54dc3cac0222ca08a78e33a
languageName: node
linkType: hard

"side-channel@npm:^1.0.4, side-channel@npm:^1.0.6":
version: 1.0.6
resolution: "side-channel@npm:1.0.6"
Expand Down
Loading