@react-native-gpui/reanimated 0.0.0-stage → 4.7.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/LICENSE +21 -0
- package/README.md +26 -2
- package/desktop/CMakeLists.txt +116 -0
- package/desktop/cpp/GPUIReanimatedModule.cpp +169 -0
- package/desktop/patches/react-native-reanimated-4.7.1.patch +407 -0
- package/package.json +40 -4
- package/react-native.config.js +10 -0
- package/src/NativeReanimatedModule.ts +8 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@react-native-gpui/reanimated` are listed here. Each version's section becomes the notes of its GitHub release.
|
|
4
|
+
|
|
5
|
+
## 4.7.0-alpha.1 - 2026-11-12
|
|
6
|
+
|
|
7
|
+
- CSS transitions and animations now run: the registries' updates are applied after every frame, as the display link does on iOS, where before nothing applied them and a transition or keyframe animation never changed what was painted. Needs a prebuilt runtime built with the change.
|
|
8
|
+
|
|
9
|
+
## 4.7.0-alpha.0 - 2026-11-01
|
|
10
|
+
|
|
11
|
+
- First release, for `react-native-reanimated` 4.7.x with Worklets 0.13.x.
|
|
12
|
+
- Animations, layout animations and CSS animations on desktop.
|
|
13
|
+
- Works with the npm release of `react-native-reanimated`: the C++ fixes it needs for MSVC and Linux are applied to a copy in the build directory. UI props update synchronously on Linux, as on iOS.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Streetwriters
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @react-native-gpui/reanimated
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Adapter for [`react-native-reanimated`](https://github.com/software-mansion/react-native-reanimated) (MIT): runs animations, layout animations and CSS animations on the desktop renderer.
|
|
4
|
+
|
|
5
|
+
Part of [react-native-gpui](https://github.com/streetwriters/react-native-gpui), React Native for macOS, Windows and Linux.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
Install it next to `react-native-reanimated`:
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npm install react-native-reanimated@4.7.x @react-native-gpui/reanimated
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Reanimated needs Worklets, so install `react-native-worklets@0.13.x` and [`@react-native-gpui/worklets`](https://www.npmjs.com/package/@react-native-gpui/worklets) too.
|
|
16
|
+
|
|
17
|
+
Install the regular npm release of `react-native-reanimated`. Its C++ needs small fixes to build with MSVC and on Linux; this package applies them to a copy in the desktop build directory and never changes `node_modules`.
|
|
18
|
+
|
|
19
|
+
Keep using `react-native-reanimated` as you do on iOS and Android; its JavaScript API is unchanged. Autolinking builds the desktop side when the app is built.
|
|
20
|
+
|
|
21
|
+
## Documentation
|
|
22
|
+
|
|
23
|
+
[Supported libraries](https://streetwriters.github.io/react-native-gpui/docs/supported-libraries)
|
|
24
|
+
|
|
25
|
+
## License
|
|
26
|
+
|
|
27
|
+
MIT. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
if(NOT RN_GPUI_PROJECT_ROOT)
|
|
2
|
+
message(FATAL_ERROR
|
|
3
|
+
"@react-native-gpui/reanimated was added by the platform; RN_GPUI_PROJECT_ROOT must be set by its build.rs")
|
|
4
|
+
endif()
|
|
5
|
+
set(_gpui_app_root "${RN_GPUI_PROJECT_ROOT}")
|
|
6
|
+
find_program(_gpui_node node REQUIRED)
|
|
7
|
+
execute_process(
|
|
8
|
+
COMMAND "${_gpui_node}" -e "process.stdout.write(require.resolve('react-native-reanimated/package.json', {paths: [process.argv[1]]}))" "${_gpui_app_root}"
|
|
9
|
+
RESULT_VARIABLE _reanimated_resolve_result
|
|
10
|
+
OUTPUT_VARIABLE _reanimated_package_json
|
|
11
|
+
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
12
|
+
if(NOT _reanimated_resolve_result EQUAL 0 OR NOT EXISTS "${_reanimated_package_json}")
|
|
13
|
+
message(FATAL_ERROR "react-native-reanimated could not be resolved from ${_gpui_app_root}")
|
|
14
|
+
endif()
|
|
15
|
+
get_filename_component(_reanimated_root "${_reanimated_package_json}" DIRECTORY)
|
|
16
|
+
execute_process(
|
|
17
|
+
COMMAND "${_gpui_node}" -e "process.stdout.write(require.resolve('react-native/package.json', {paths: [process.argv[1]]}))" "${_gpui_app_root}"
|
|
18
|
+
RESULT_VARIABLE _react_native_resolve_result
|
|
19
|
+
OUTPUT_VARIABLE _react_native_package_json
|
|
20
|
+
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
21
|
+
if(NOT _react_native_resolve_result EQUAL 0 OR NOT EXISTS "${_react_native_package_json}")
|
|
22
|
+
message(FATAL_ERROR "react-native could not be resolved from ${_gpui_app_root}")
|
|
23
|
+
endif()
|
|
24
|
+
get_filename_component(_react_native_root "${_react_native_package_json}" DIRECTORY)
|
|
25
|
+
execute_process(
|
|
26
|
+
COMMAND "${_gpui_node}" -e "process.stdout.write(require.resolve('react-native-worklets/package.json', {paths: [process.argv[1]]}))" "${_gpui_app_root}"
|
|
27
|
+
RESULT_VARIABLE _worklets_resolve_result
|
|
28
|
+
OUTPUT_VARIABLE _worklets_package_json
|
|
29
|
+
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
30
|
+
if(NOT _worklets_resolve_result EQUAL 0 OR NOT EXISTS "${_worklets_package_json}")
|
|
31
|
+
message(FATAL_ERROR "react-native-worklets could not be resolved from ${_gpui_app_root}")
|
|
32
|
+
endif()
|
|
33
|
+
get_filename_component(_worklets_root "${_worklets_package_json}" DIRECTORY)
|
|
34
|
+
set(_reanimated_common "${_reanimated_root}/Common/cpp")
|
|
35
|
+
set(_worklets_common "${_worklets_root}/Common/cpp")
|
|
36
|
+
if(NOT EXISTS "${_reanimated_common}/reanimated/NativeModules/ReanimatedModuleProxy.h")
|
|
37
|
+
message(FATAL_ERROR "react-native-reanimated 4.7.x was not found in ${_gpui_app_root} or any ancestor node_modules directory")
|
|
38
|
+
endif()
|
|
39
|
+
execute_process(
|
|
40
|
+
COMMAND "${_gpui_node}" -e "process.stdout.write(require.resolve('@react-native-gpui/worklets/package.json', {paths: [process.argv[1]]}))" "${_gpui_app_root}"
|
|
41
|
+
RESULT_VARIABLE _gpui_worklets_resolve_result
|
|
42
|
+
OUTPUT_VARIABLE _gpui_worklets_package_json
|
|
43
|
+
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
44
|
+
if(NOT _gpui_worklets_resolve_result EQUAL 0 OR NOT EXISTS "${_gpui_worklets_package_json}")
|
|
45
|
+
message(FATAL_ERROR "@react-native-gpui/worklets could not be resolved from ${_gpui_app_root}")
|
|
46
|
+
endif()
|
|
47
|
+
get_filename_component(_gpui_worklets_root "${_gpui_worklets_package_json}" DIRECTORY)
|
|
48
|
+
if(NOT EXISTS "${_worklets_common}/worklets/Compat/StableApi.h")
|
|
49
|
+
message(FATAL_ERROR "react-native-worklets 0.13.x is required by GPUI Reanimated")
|
|
50
|
+
endif()
|
|
51
|
+
|
|
52
|
+
# Upstream's C++ does not build with MSVC or on Linux as published; compile
|
|
53
|
+
# patched copies in the build tree and leave node_modules untouched. Worklets
|
|
54
|
+
# is patched here too because Reanimated includes its headers.
|
|
55
|
+
set(_reanimated_patch "${CMAKE_CURRENT_LIST_DIR}/patches/react-native-reanimated-4.7.1.patch")
|
|
56
|
+
set(_worklets_patch "${_gpui_worklets_root}/desktop/patches/react-native-worklets-0.13.0.patch")
|
|
57
|
+
foreach(_patched reanimated worklets)
|
|
58
|
+
execute_process(
|
|
59
|
+
COMMAND "${_gpui_node}" "${_gpui_worklets_root}/desktop/patch-sources.mjs"
|
|
60
|
+
"${_${_patched}_root}" "${_${_patched}_patch}"
|
|
61
|
+
"${CMAKE_BINARY_DIR}/rn-gpui-patched/react-native-${_patched}"
|
|
62
|
+
RESULT_VARIABLE _patch_result
|
|
63
|
+
OUTPUT_VARIABLE _${_patched}_common
|
|
64
|
+
ERROR_VARIABLE _patch_error
|
|
65
|
+
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
66
|
+
if(NOT _patch_result EQUAL 0)
|
|
67
|
+
message(FATAL_ERROR "${_patch_error}")
|
|
68
|
+
endif()
|
|
69
|
+
endforeach()
|
|
70
|
+
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
|
|
71
|
+
"${_reanimated_patch}" "${_worklets_patch}"
|
|
72
|
+
"${_reanimated_package_json}" "${_worklets_package_json}")
|
|
73
|
+
|
|
74
|
+
# Match the static feature-flag definition normally supplied by Reanimated's
|
|
75
|
+
# CocoaPods/Gradle builds. Without this, FeatureFlags.h silently treats every
|
|
76
|
+
# flag as false, including defaults which change how animated props are
|
|
77
|
+
# committed through Fabric.
|
|
78
|
+
execute_process(
|
|
79
|
+
COMMAND "${_gpui_node}" -e
|
|
80
|
+
"const fs=require('fs'); const flags=JSON.parse(fs.readFileSync(process.argv[1],'utf8')); const app=JSON.parse(fs.readFileSync(process.argv[2],'utf8')); Object.assign(flags, app.reanimated?.staticFeatureFlags ?? {}); if(process.platform==='darwin' && !Object.hasOwn(app.reanimated?.staticFeatureFlags ?? {}, 'IOS_SYNCHRONOUSLY_UPDATE_UI_PROPS')) flags.IOS_SYNCHRONOUSLY_UPDATE_UI_PROPS=true; if(process.platform==='linux' && !Object.hasOwn(app.reanimated?.staticFeatureFlags ?? {}, 'LINUX_SYNCHRONOUSLY_UPDATE_UI_PROPS')) flags.LINUX_SYNCHRONOUSLY_UPDATE_UI_PROPS=true; process.stdout.write(Object.entries(flags).map(([key,value])=>'['+key+':'+value+']').join(''));"
|
|
81
|
+
"${_reanimated_root}/src/featureFlags/staticFlags.json"
|
|
82
|
+
"${_gpui_app_root}/package.json"
|
|
83
|
+
RESULT_VARIABLE _reanimated_flags_result
|
|
84
|
+
OUTPUT_VARIABLE _reanimated_feature_flags
|
|
85
|
+
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
86
|
+
)
|
|
87
|
+
if(NOT _reanimated_flags_result EQUAL 0 OR _reanimated_feature_flags STREQUAL "")
|
|
88
|
+
message(FATAL_ERROR "Failed to load Reanimated static feature flags for GPUI")
|
|
89
|
+
endif()
|
|
90
|
+
|
|
91
|
+
execute_process(
|
|
92
|
+
COMMAND "${_gpui_node}" "${_react_native_root}/scripts/generate-codegen-artifacts.js"
|
|
93
|
+
--path "${_gpui_app_root}"
|
|
94
|
+
--targetPlatform ios
|
|
95
|
+
--outputPath "${_gpui_app_root}/desktop/build/codegen"
|
|
96
|
+
--source app
|
|
97
|
+
RESULT_VARIABLE _reanimated_codegen_result
|
|
98
|
+
)
|
|
99
|
+
if(NOT _reanimated_codegen_result EQUAL 0)
|
|
100
|
+
message(FATAL_ERROR "React Native codegen failed while configuring GPUI Reanimated")
|
|
101
|
+
endif()
|
|
102
|
+
set(_rn_codegen "${_gpui_app_root}/desktop/build/codegen/build/generated/ios/ReactCodegen")
|
|
103
|
+
|
|
104
|
+
file(GLOB_RECURSE _reanimated_sources CONFIGURE_DEPENDS "${_reanimated_common}/reanimated/*.cpp")
|
|
105
|
+
set_property(GLOBAL APPEND PROPERTY RN_GPUI_APP_CPP_SOURCES
|
|
106
|
+
${_reanimated_sources}
|
|
107
|
+
"${CMAKE_CURRENT_LIST_DIR}/cpp/GPUIReanimatedModule.cpp")
|
|
108
|
+
set_property(GLOBAL APPEND PROPERTY RN_GPUI_APP_CPP_INCLUDE_DIRS
|
|
109
|
+
"${_reanimated_common}"
|
|
110
|
+
"${_reanimated_root}"
|
|
111
|
+
"${_worklets_common}"
|
|
112
|
+
"${_rn_codegen}"
|
|
113
|
+
"${_gpui_worklets_root}/desktop/cpp")
|
|
114
|
+
set_property(GLOBAL APPEND PROPERTY RN_GPUI_APP_CPP_DEFINITIONS
|
|
115
|
+
"REANIMATED_VERSION=4.7.1"
|
|
116
|
+
"REANIMATED_FEATURE_FLAGS=\"${_reanimated_feature_flags}\"")
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
#include "GPUIWorkletsModule.h"
|
|
2
|
+
#include "GpuiHost.h"
|
|
3
|
+
|
|
4
|
+
#include <GPUIReanimatedSpec.h>
|
|
5
|
+
#include <reanimated/NativeModules/ReanimatedModuleProxy.h>
|
|
6
|
+
#include <reanimated/RuntimeDecorators/RNRuntimeDecorator.h>
|
|
7
|
+
#include <reanimated/Tools/PlatformDepMethodsHolder.h>
|
|
8
|
+
#include <worklets/Compat/StableApi.h>
|
|
9
|
+
|
|
10
|
+
#include <glog/logging.h>
|
|
11
|
+
|
|
12
|
+
#include <atomic>
|
|
13
|
+
#include <chrono>
|
|
14
|
+
#include <cstdint>
|
|
15
|
+
#include <cstdlib>
|
|
16
|
+
#include <memory>
|
|
17
|
+
#include <utility>
|
|
18
|
+
|
|
19
|
+
namespace {
|
|
20
|
+
bool animationTracingEnabled() {
|
|
21
|
+
static const bool enabled = std::getenv("RN_GPUI_DEBUG_ANIMATION") != nullptr;
|
|
22
|
+
return enabled;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
using facebook::jsi::Runtime;
|
|
26
|
+
using reanimated::PlatformDepMethodsHolder;
|
|
27
|
+
using reanimated::ReanimatedModuleProxy;
|
|
28
|
+
|
|
29
|
+
PlatformDepMethodsHolder platformMethods(
|
|
30
|
+
const std::shared_ptr<std::weak_ptr<ReanimatedModuleProxy>>& proxyHolder) {
|
|
31
|
+
PlatformDepMethodsHolder methods;
|
|
32
|
+
methods.requestRender = [](std::function<void(const double)> callback) {
|
|
33
|
+
static std::atomic<uint64_t> requests{0};
|
|
34
|
+
const auto count = ++requests;
|
|
35
|
+
if (animationTracingEnabled() && (count <= 5 || count % 60 == 0)) {
|
|
36
|
+
LOG(INFO) << "[gpui-reanimated] requestRender count=" << count;
|
|
37
|
+
}
|
|
38
|
+
auto module = gpui_worklets::currentModule();
|
|
39
|
+
if (module)
|
|
40
|
+
module->requestAnimationFrame(std::move(callback));
|
|
41
|
+
};
|
|
42
|
+
methods.synchronouslyUpdateUIPropsFunction = [](const int tag,
|
|
43
|
+
const folly::dynamic& props) {
|
|
44
|
+
rngpui::gpui_synchronously_update_props(tag, props);
|
|
45
|
+
};
|
|
46
|
+
methods.getAnimationTimestamp = [] {
|
|
47
|
+
return std::chrono::duration<double, std::milli>(
|
|
48
|
+
std::chrono::steady_clock::now().time_since_epoch())
|
|
49
|
+
.count();
|
|
50
|
+
};
|
|
51
|
+
methods.registerSensor =
|
|
52
|
+
[](int, int, int, std::function<void(double[], int)>) { return 0; };
|
|
53
|
+
methods.unregisterSensor = [](int) {};
|
|
54
|
+
methods.setGestureStateFunction = [](int, int) {};
|
|
55
|
+
methods.maybeFlushUIUpdatesQueueFunction = [proxyHolder] {
|
|
56
|
+
if (auto proxy = proxyHolder->lock()) {
|
|
57
|
+
proxy->performOperations();
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
methods.attachPseudoSelector = [](facebook::react::Tag,
|
|
61
|
+
reanimated::PseudoSelector,
|
|
62
|
+
std::function<void(bool)> callback) {
|
|
63
|
+
if (callback)
|
|
64
|
+
callback(false);
|
|
65
|
+
};
|
|
66
|
+
methods.detachPseudoSelector = [](facebook::react::Tag,
|
|
67
|
+
reanimated::PseudoSelector) {};
|
|
68
|
+
#if defined(__APPLE__)
|
|
69
|
+
methods.forceScreenSnapshotFunction = [](facebook::react::Tag) {
|
|
70
|
+
return false;
|
|
71
|
+
};
|
|
72
|
+
methods.readMountedViewPropsFunction =
|
|
73
|
+
[](facebook::react::Tag) -> facebook::react::Props::Shared {
|
|
74
|
+
return nullptr;
|
|
75
|
+
};
|
|
76
|
+
#endif
|
|
77
|
+
return methods;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
class Module final
|
|
81
|
+
: public facebook::react::NativeReanimatedModuleSpec<Module> {
|
|
82
|
+
public:
|
|
83
|
+
explicit Module(std::shared_ptr<facebook::react::CallInvoker> jsInvoker)
|
|
84
|
+
: NativeReanimatedModuleSpec(std::move(jsInvoker)) {}
|
|
85
|
+
|
|
86
|
+
bool installTurboModule(Runtime& runtime) {
|
|
87
|
+
if (proxy_)
|
|
88
|
+
return true;
|
|
89
|
+
auto worklets = gpui_worklets::currentModule();
|
|
90
|
+
auto uiManager = rngpui::get_gpui_ui_manager();
|
|
91
|
+
if (!worklets || !worklets->uiRuntime() || !worklets->uiScheduler() ||
|
|
92
|
+
!uiManager) {
|
|
93
|
+
throw facebook::jsi::JSError(
|
|
94
|
+
runtime, "GPUI Reanimated requires initialized Worklets and Fabric");
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// The platform flush callback is constructed before the proxy exists.
|
|
98
|
+
// Retain only a weak reference so the decorated UI runtime cannot keep
|
|
99
|
+
// the module alive after React Native tears it down.
|
|
100
|
+
auto proxyHolder = std::make_shared<std::weak_ptr<ReanimatedModuleProxy>>();
|
|
101
|
+
auto methods = platformMethods(proxyHolder);
|
|
102
|
+
proxy_ = std::make_shared<ReanimatedModuleProxy>(
|
|
103
|
+
worklets->uiRuntime(),
|
|
104
|
+
worklets->uiScheduler(),
|
|
105
|
+
runtime,
|
|
106
|
+
jsInvoker_,
|
|
107
|
+
methods,
|
|
108
|
+
false);
|
|
109
|
+
*proxyHolder = proxy_;
|
|
110
|
+
// The platform runs the registries' pending updates after each frame's
|
|
111
|
+
// animation callbacks, which is what applies a CSS transition or animation.
|
|
112
|
+
worklets->setAfterFrame(
|
|
113
|
+
[weak = std::weak_ptr<ReanimatedModuleProxy>(proxy_)] {
|
|
114
|
+
if (auto proxy = weak.lock()) {
|
|
115
|
+
proxy->performOperations();
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
proxy_->init(methods);
|
|
119
|
+
proxy_->initializeFabric(uiManager);
|
|
120
|
+
LOG(INFO) << "[gpui-reanimated] module proxy initialized";
|
|
121
|
+
auto& uiRuntime =
|
|
122
|
+
worklets::getJSIRuntimeFromWorkletRuntime(worklets->uiRuntime());
|
|
123
|
+
reanimated::RNRuntimeDecorator::decorate(runtime, uiRuntime, proxy_);
|
|
124
|
+
std::weak_ptr<ReanimatedModuleProxy> weakProxy = proxy_;
|
|
125
|
+
eventListener_ = std::make_shared<const facebook::react::EventListener>(
|
|
126
|
+
[weakProxy](const facebook::react::RawEvent& event) {
|
|
127
|
+
auto proxy = weakProxy.lock();
|
|
128
|
+
if (!proxy)
|
|
129
|
+
return false;
|
|
130
|
+
const auto timestamp =
|
|
131
|
+
std::chrono::duration<double, std::milli>(
|
|
132
|
+
std::chrono::steady_clock::now().time_since_epoch())
|
|
133
|
+
.count();
|
|
134
|
+
static std::atomic<uint64_t> events{0};
|
|
135
|
+
const auto count = ++events;
|
|
136
|
+
if (animationTracingEnabled() &&
|
|
137
|
+
event.type.find("GestureHandler") != std::string::npos) {
|
|
138
|
+
const auto* target = event.eventTarget.get();
|
|
139
|
+
const auto tag = target ? target->getTag() : -1;
|
|
140
|
+
auto eventName = event.type;
|
|
141
|
+
if (eventName.rfind("top", 0) == 0) {
|
|
142
|
+
eventName = "on" + eventName.substr(3);
|
|
143
|
+
}
|
|
144
|
+
LOG(INFO) << "[gpui-reanimated] gesture lookup type=" << eventName
|
|
145
|
+
<< " tag=" << tag << " waiting="
|
|
146
|
+
<< proxy->isAnyHandlerWaitingForEvent(eventName, tag);
|
|
147
|
+
}
|
|
148
|
+
if (animationTracingEnabled() &&
|
|
149
|
+
(count <= 10 ||
|
|
150
|
+
event.type.find("GestureHandler") != std::string::npos)) {
|
|
151
|
+
LOG(INFO) << "[gpui-reanimated] raw event count=" << count
|
|
152
|
+
<< " type=" << event.type;
|
|
153
|
+
}
|
|
154
|
+
return proxy->handleRawEvent(event, timestamp);
|
|
155
|
+
});
|
|
156
|
+
rngpui::register_gpui_event_listener(eventListener_);
|
|
157
|
+
return true;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
std::shared_ptr<ReanimatedModuleProxy> proxy_;
|
|
161
|
+
std::shared_ptr<const facebook::react::EventListener> eventListener_;
|
|
162
|
+
};
|
|
163
|
+
} // namespace
|
|
164
|
+
|
|
165
|
+
std::shared_ptr<facebook::react::TurboModule> create_gpui_reanimated_module(
|
|
166
|
+
const std::string& name,
|
|
167
|
+
std::shared_ptr<facebook::react::CallInvoker> jsInvoker) {
|
|
168
|
+
return rngpui::provideTurboModule<Module>(name, std::move(jsInvoker));
|
|
169
|
+
}
|
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
--- a/reanimated/CSS/common/filters/FilterOp.cpp
|
|
2
|
+
+++ b/reanimated/CSS/common/filters/FilterOp.cpp
|
|
3
|
+
@@ -1,6 +1,7 @@
|
|
4
|
+
#include <reanimated/CSS/common/filters/FilterOp.h>
|
|
5
|
+
|
|
6
|
+
#include <array>
|
|
7
|
+
+#include <stdexcept>
|
|
8
|
+
#include <string>
|
|
9
|
+
#include <unordered_map>
|
|
10
|
+
|
|
11
|
+
--- a/reanimated/CSS/common/transforms/TransformMatrix2D.cpp
|
|
12
|
+
+++ b/reanimated/CSS/common/transforms/TransformMatrix2D.cpp
|
|
13
|
+
@@ -1,6 +1,7 @@
|
|
14
|
+
#include <reanimated/CSS/common/transforms/TransformMatrix2D.h>
|
|
15
|
+
|
|
16
|
+
#include <cmath>
|
|
17
|
+
+#include <stdexcept>
|
|
18
|
+
|
|
19
|
+
namespace reanimated::css {
|
|
20
|
+
|
|
21
|
+
--- a/reanimated/CSS/common/transforms/TransformMatrix3D.cpp
|
|
22
|
+
+++ b/reanimated/CSS/common/transforms/TransformMatrix3D.cpp
|
|
23
|
+
@@ -1,6 +1,8 @@
|
|
24
|
+
#include <reanimated/CSS/common/transforms/TransformMatrix3D.h>
|
|
25
|
+
#include <reanimated/CSS/interpolation/transforms/TransformOperation.h>
|
|
26
|
+
|
|
27
|
+
+#include <cmath>
|
|
28
|
+
+#include <stdexcept>
|
|
29
|
+
#include <string>
|
|
30
|
+
|
|
31
|
+
namespace reanimated::css {
|
|
32
|
+
--- a/reanimated/CSS/common/transforms/TransformOp.cpp
|
|
33
|
+
+++ b/reanimated/CSS/common/transforms/TransformOp.cpp
|
|
34
|
+
@@ -1,6 +1,7 @@
|
|
35
|
+
#include <reanimated/CSS/common/transforms/TransformOp.h>
|
|
36
|
+
|
|
37
|
+
#include <array>
|
|
38
|
+
+#include <stdexcept>
|
|
39
|
+
#include <string>
|
|
40
|
+
#include <unordered_map>
|
|
41
|
+
|
|
42
|
+
--- a/reanimated/CSS/common/transforms/vectors.cpp
|
|
43
|
+
+++ b/reanimated/CSS/common/transforms/vectors.cpp
|
|
44
|
+
@@ -1,4 +1,5 @@
|
|
45
|
+
#include <reanimated/CSS/common/transforms/vectors.h>
|
|
46
|
+
+#include <cmath>
|
|
47
|
+
|
|
48
|
+
namespace reanimated::css {
|
|
49
|
+
|
|
50
|
+
--- a/reanimated/CSS/common/values/CSSAngle.cpp
|
|
51
|
+
+++ b/reanimated/CSS/common/values/CSSAngle.cpp
|
|
52
|
+
@@ -2,6 +2,7 @@
|
|
53
|
+
|
|
54
|
+
#include <iomanip>
|
|
55
|
+
#include <regex>
|
|
56
|
+
+#include <stdexcept>
|
|
57
|
+
#include <string>
|
|
58
|
+
#include <unordered_map>
|
|
59
|
+
|
|
60
|
+
--- a/reanimated/CSS/common/values/CSSColor.cpp
|
|
61
|
+
+++ b/reanimated/CSS/common/values/CSSColor.cpp
|
|
62
|
+
@@ -4,6 +4,7 @@
|
|
63
|
+
|
|
64
|
+
#include <utility>
|
|
65
|
+
|
|
66
|
+
+#include <cmath>
|
|
67
|
+
#include <string>
|
|
68
|
+
|
|
69
|
+
namespace reanimated::css {
|
|
70
|
+
--- a/reanimated/CSS/common/values/CSSLength.cpp
|
|
71
|
+
+++ b/reanimated/CSS/common/values/CSSLength.cpp
|
|
72
|
+
@@ -1,6 +1,7 @@
|
|
73
|
+
#include <reanimated/CSS/common/values/CSSLength.h>
|
|
74
|
+
#include <reanimated/CSS/misc/ViewStylesRepository.h>
|
|
75
|
+
|
|
76
|
+
+#include <stdexcept>
|
|
77
|
+
#include <string>
|
|
78
|
+
|
|
79
|
+
namespace reanimated::css {
|
|
80
|
+
--- a/reanimated/CSS/common/values/CSSValueVariant.cpp
|
|
81
|
+
+++ b/reanimated/CSS/common/values/CSSValueVariant.cpp
|
|
82
|
+
@@ -14,6 +14,7 @@
|
|
83
|
+
#include <reanimated/CSS/svg/values/SVGStrokeDashArray.h>
|
|
84
|
+
#include <reanimated/Compat/WorkletsApi.h>
|
|
85
|
+
|
|
86
|
+
+#include <stdexcept>
|
|
87
|
+
#include <string>
|
|
88
|
+
#include <utility>
|
|
89
|
+
#include <vector>
|
|
90
|
+
--- a/reanimated/CSS/configs/CSSAnimationConfig.cpp
|
|
91
|
+
+++ b/reanimated/CSS/configs/CSSAnimationConfig.cpp
|
|
92
|
+
@@ -1,6 +1,7 @@
|
|
93
|
+
#include <reanimated/CSS/configs/CSSAnimationConfig.h>
|
|
94
|
+
|
|
95
|
+
#include <memory>
|
|
96
|
+
+#include <stdexcept>
|
|
97
|
+
#include <string>
|
|
98
|
+
#include <unordered_map>
|
|
99
|
+
#include <utility>
|
|
100
|
+
--- a/reanimated/CSS/easing/EasingFunctions.cpp
|
|
101
|
+
+++ b/reanimated/CSS/easing/EasingFunctions.cpp
|
|
102
|
+
@@ -1,5 +1,6 @@
|
|
103
|
+
#include <reanimated/CSS/easing/EasingFunctions.h>
|
|
104
|
+
|
|
105
|
+
+#include <stdexcept>
|
|
106
|
+
#include <string>
|
|
107
|
+
#include <unordered_map>
|
|
108
|
+
#include <vector>
|
|
109
|
+
--- a/reanimated/CSS/interpolation/InterpolatorFactory.cpp
|
|
110
|
+
+++ b/reanimated/CSS/interpolation/InterpolatorFactory.cpp
|
|
111
|
+
@@ -27,7 +27,7 @@
|
|
112
|
+
// Helper private type just for a default value
|
|
113
|
+
struct EmptyObjectValue : public CSSValue {
|
|
114
|
+
folly::dynamic toDynamic() const override {
|
|
115
|
+
- return folly::dynamic::object;
|
|
116
|
+
+ return folly::dynamic::object();
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
std::string toString() const override {
|
|
120
|
+
@@ -53,7 +53,7 @@
|
|
121
|
+
// Helper private type just for a default value
|
|
122
|
+
struct EmptyArrayValue : public CSSValue {
|
|
123
|
+
folly::dynamic toDynamic() const override {
|
|
124
|
+
- return folly::dynamic::array;
|
|
125
|
+
+ return folly::dynamic::array();
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
std::string toString() const override {
|
|
129
|
+
--- a/reanimated/CSS/interpolation/InterpolatorFactory.h
|
|
130
|
+
+++ b/reanimated/CSS/interpolation/InterpolatorFactory.h
|
|
131
|
+
@@ -14,6 +14,7 @@
|
|
132
|
+
#include <reanimated/CSS/interpolation/values/SimpleValueInterpolator.h>
|
|
133
|
+
|
|
134
|
+
#include <memory>
|
|
135
|
+
+#include <stdexcept>
|
|
136
|
+
#include <string>
|
|
137
|
+
#include <unordered_map>
|
|
138
|
+
#include <utility>
|
|
139
|
+
--- a/reanimated/CSS/interpolation/PropertyInterpolator.cpp
|
|
140
|
+
+++ b/reanimated/CSS/interpolation/PropertyInterpolator.cpp
|
|
141
|
+
@@ -2,6 +2,7 @@
|
|
142
|
+
#include <reanimated/Compat/WorkletsApi.h>
|
|
143
|
+
|
|
144
|
+
#include <memory>
|
|
145
|
+
+#include <stdexcept>
|
|
146
|
+
#include <string>
|
|
147
|
+
#include <utility>
|
|
148
|
+
#include <variant>
|
|
149
|
+
--- a/reanimated/CSS/interpolation/filters/FilterOperation.cpp
|
|
150
|
+
+++ b/reanimated/CSS/interpolation/filters/FilterOperation.cpp
|
|
151
|
+
@@ -15,6 +15,7 @@
|
|
152
|
+
#include <reanimated/CSS/interpolation/filters/operations/saturate.h>
|
|
153
|
+
#include <reanimated/CSS/interpolation/filters/operations/sepia.h>
|
|
154
|
+
|
|
155
|
+
+#include <stdexcept>
|
|
156
|
+
#include <utility>
|
|
157
|
+
|
|
158
|
+
namespace reanimated::css {
|
|
159
|
+
--- a/reanimated/CSS/interpolation/transforms/TransformOperation.cpp
|
|
160
|
+
+++ b/reanimated/CSS/interpolation/transforms/TransformOperation.cpp
|
|
161
|
+
@@ -13,6 +13,7 @@
|
|
162
|
+
#include <reanimated/CSS/interpolation/transforms/operations/skew.h>
|
|
163
|
+
#include <reanimated/CSS/interpolation/transforms/operations/translate.h>
|
|
164
|
+
|
|
165
|
+
+#include <stdexcept>
|
|
166
|
+
#include <utility>
|
|
167
|
+
|
|
168
|
+
namespace reanimated::css {
|
|
169
|
+
--- a/reanimated/CSS/interpolation/transforms/TransformOperationInterpolator.cpp
|
|
170
|
+
+++ b/reanimated/CSS/interpolation/transforms/TransformOperationInterpolator.cpp
|
|
171
|
+
@@ -7,21 +7,10 @@
|
|
172
|
+
|
|
173
|
+
#include <cmath>
|
|
174
|
+
#include <limits>
|
|
175
|
+
+#include <stdexcept>
|
|
176
|
+
#include <utility>
|
|
177
|
+
|
|
178
|
+
namespace reanimated::css {
|
|
179
|
+
-
|
|
180
|
+
-// Base implementation for simple operations
|
|
181
|
+
-template <typename TOperation>
|
|
182
|
+
-std::unique_ptr<StyleOperation> TransformOperationInterpolator<TOperation>::interpolate(
|
|
183
|
+
- double progress,
|
|
184
|
+
- const std::shared_ptr<StyleOperation> &from,
|
|
185
|
+
- const std::shared_ptr<StyleOperation> &to,
|
|
186
|
+
- const StyleOperationsInterpolationContext & /* context */) const {
|
|
187
|
+
- const auto &fromOp = *std::static_pointer_cast<TOperation>(from);
|
|
188
|
+
- const auto &toOp = *std::static_pointer_cast<TOperation>(to);
|
|
189
|
+
- return std::make_unique<TOperation>(fromOp.value.interpolate(progress, toOp.value));
|
|
190
|
+
-}
|
|
191
|
+
|
|
192
|
+
// Specialization for PerspectiveOperation
|
|
193
|
+
TransformOperationInterpolator<PerspectiveOperation>::TransformOperationInterpolator(
|
|
194
|
+
--- a/reanimated/CSS/interpolation/transforms/TransformOperationInterpolator.h
|
|
195
|
+
+++ b/reanimated/CSS/interpolation/transforms/TransformOperationInterpolator.h
|
|
196
|
+
@@ -15,11 +15,18 @@
|
|
197
|
+
public:
|
|
198
|
+
using StyleOperationInterpolator::StyleOperationInterpolator;
|
|
199
|
+
|
|
200
|
+
+ // Defined in the class body: MSVC rejects an out-of-line definition of the
|
|
201
|
+
+ // primary template member next to the constrained partial specialization
|
|
202
|
+
+ // below (C3855).
|
|
203
|
+
std::unique_ptr<StyleOperation> interpolate(
|
|
204
|
+
double progress,
|
|
205
|
+
const std::shared_ptr<StyleOperation> &from,
|
|
206
|
+
const std::shared_ptr<StyleOperation> &to,
|
|
207
|
+
- const StyleOperationsInterpolationContext &context) const override;
|
|
208
|
+
+ const StyleOperationsInterpolationContext & /* context */) const override {
|
|
209
|
+
+ const auto &fromOp = *std::static_pointer_cast<TOperation>(from);
|
|
210
|
+
+ const auto &toOp = *std::static_pointer_cast<TOperation>(to);
|
|
211
|
+
+ return std::make_unique<TOperation>(fromOp.value.interpolate(progress, toOp.value));
|
|
212
|
+
+ }
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
// Specialization for PerspectiveOperation
|
|
216
|
+
--- a/reanimated/CSS/interpolation/transforms/operations/matrix.cpp
|
|
217
|
+
+++ b/reanimated/CSS/interpolation/transforms/operations/matrix.cpp
|
|
218
|
+
@@ -3,6 +3,7 @@
|
|
219
|
+
|
|
220
|
+
#include <deque>
|
|
221
|
+
#include <memory>
|
|
222
|
+
+#include <stdexcept>
|
|
223
|
+
#include <utility>
|
|
224
|
+
|
|
225
|
+
namespace reanimated::css {
|
|
226
|
+
--- a/reanimated/CSS/interpolation/transforms/operations/translate.cpp
|
|
227
|
+
+++ b/reanimated/CSS/interpolation/transforms/operations/translate.cpp
|
|
228
|
+
@@ -3,6 +3,7 @@
|
|
229
|
+
#include <reanimated/CSS/interpolation/transforms/operations/translate.h>
|
|
230
|
+
|
|
231
|
+
#include <memory>
|
|
232
|
+
+#include <stdexcept>
|
|
233
|
+
#include <string>
|
|
234
|
+
|
|
235
|
+
namespace reanimated::css {
|
|
236
|
+
--- a/reanimated/CSS/interpolation/values/SimpleValueInterpolator.cpp
|
|
237
|
+
+++ b/reanimated/CSS/interpolation/values/SimpleValueInterpolator.cpp
|
|
238
|
+
@@ -18,6 +18,7 @@
|
|
239
|
+
#include <reanimated/CSS/svg/values/SVGStrokeDashArray.h>
|
|
240
|
+
|
|
241
|
+
#include <memory>
|
|
242
|
+
+#include <stdexcept>
|
|
243
|
+
|
|
244
|
+
namespace reanimated::css {
|
|
245
|
+
|
|
246
|
+
--- a/reanimated/CSS/misc/ViewStylesRepository.cpp
|
|
247
|
+
+++ b/reanimated/CSS/misc/ViewStylesRepository.cpp
|
|
248
|
+
@@ -2,6 +2,7 @@
|
|
249
|
+
#include <reanimated/Tools/FeatureFlags.h>
|
|
250
|
+
|
|
251
|
+
#include <memory>
|
|
252
|
+
+#include <stdexcept>
|
|
253
|
+
#include <string>
|
|
254
|
+
#include <variant>
|
|
255
|
+
|
|
256
|
+
--- a/reanimated/CSS/registries/CSSAnimationsRegistry.cpp
|
|
257
|
+
+++ b/reanimated/CSS/registries/CSSAnimationsRegistry.cpp
|
|
258
|
+
@@ -4,6 +4,7 @@
|
|
259
|
+
#include <react/debug/react_native_assert.h>
|
|
260
|
+
|
|
261
|
+
#include <memory>
|
|
262
|
+
+#include <stdexcept>
|
|
263
|
+
#include <string>
|
|
264
|
+
#include <unordered_map>
|
|
265
|
+
#include <utility>
|
|
266
|
+
--- a/reanimated/CSS/svg/values/SVGPath.cpp
|
|
267
|
+
+++ b/reanimated/CSS/svg/values/SVGPath.cpp
|
|
268
|
+
@@ -7,6 +7,7 @@
|
|
269
|
+
#include <functional>
|
|
270
|
+
#include <optional>
|
|
271
|
+
#include <regex>
|
|
272
|
+
+#include <stdexcept>
|
|
273
|
+
#include <string>
|
|
274
|
+
|
|
275
|
+
namespace reanimated::css {
|
|
276
|
+
--- a/reanimated/CSS/svg/values/SVGStops.cpp
|
|
277
|
+
+++ b/reanimated/CSS/svg/values/SVGStops.cpp
|
|
278
|
+
@@ -2,6 +2,7 @@
|
|
279
|
+
#include <reanimated/CSS/svg/values/SVGStops.h>
|
|
280
|
+
|
|
281
|
+
#include <algorithm>
|
|
282
|
+
+#include <cmath>
|
|
283
|
+
#include <cstddef>
|
|
284
|
+
#include <functional>
|
|
285
|
+
#include <optional>
|
|
286
|
+
--- a/reanimated/CSS/utils/interpolators.cpp
|
|
287
|
+
+++ b/reanimated/CSS/utils/interpolators.cpp
|
|
288
|
+
@@ -1,6 +1,7 @@
|
|
289
|
+
#include <reanimated/CSS/utils/interpolators.h>
|
|
290
|
+
|
|
291
|
+
#include <memory>
|
|
292
|
+
+#include <stdexcept>
|
|
293
|
+
#include <string>
|
|
294
|
+
|
|
295
|
+
namespace reanimated::css {
|
|
296
|
+
--- a/reanimated/Fabric/updates/UpdatesRegistryManager.cpp
|
|
297
|
+
+++ b/reanimated/Fabric/updates/UpdatesRegistryManager.cpp
|
|
298
|
+
@@ -4,6 +4,7 @@
|
|
299
|
+
#include <react/debug/react_native_assert.h>
|
|
300
|
+
|
|
301
|
+
#include <memory>
|
|
302
|
+
+#include <stdexcept>
|
|
303
|
+
#include <utility>
|
|
304
|
+
#include <vector>
|
|
305
|
+
|
|
306
|
+
--- a/reanimated/LayoutAnimations/LayoutAnimationsManager.cpp
|
|
307
|
+
+++ b/reanimated/LayoutAnimations/LayoutAnimationsManager.cpp
|
|
308
|
+
@@ -3,6 +3,7 @@
|
|
309
|
+
#include <react/debug/react_native_assert.h>
|
|
310
|
+
|
|
311
|
+
#include <memory>
|
|
312
|
+
+#include <stdexcept>
|
|
313
|
+
#include <unordered_map>
|
|
314
|
+
#include <utility>
|
|
315
|
+
#include <vector>
|
|
316
|
+
--- a/reanimated/NativeModules/ReanimatedModuleProxy.cpp
|
|
317
|
+
+++ b/reanimated/NativeModules/ReanimatedModuleProxy.cpp
|
|
318
|
+
@@ -30,6 +30,7 @@
|
|
319
|
+
#include <algorithm>
|
|
320
|
+
#include <functional>
|
|
321
|
+
#include <memory>
|
|
322
|
+
+#include <stdexcept>
|
|
323
|
+
#include <string>
|
|
324
|
+
#include <unordered_map>
|
|
325
|
+
#include <unordered_set>
|
|
326
|
+
@@ -72,6 +73,10 @@
|
|
327
|
+
constexpr bool shouldUseSynchronousUpdatesInPerformOperations() {
|
|
328
|
+
return StaticFeatureFlags::getFlag("IOS_SYNCHRONOUSLY_UPDATE_UI_PROPS");
|
|
329
|
+
}
|
|
330
|
+
+#elif defined(__linux__)
|
|
331
|
+
+constexpr bool shouldUseSynchronousUpdatesInPerformOperations() {
|
|
332
|
+
+ return StaticFeatureFlags::getFlag("LINUX_SYNCHRONOUSLY_UPDATE_UI_PROPS");
|
|
333
|
+
+}
|
|
334
|
+
#else
|
|
335
|
+
constexpr bool shouldUseSynchronousUpdatesInPerformOperations() {
|
|
336
|
+
return false;
|
|
337
|
+
@@ -1089,11 +1094,11 @@
|
|
338
|
+
}
|
|
339
|
+
#endif // ANDROID
|
|
340
|
+
|
|
341
|
+
-#if __APPLE__
|
|
342
|
+
+#ifndef ANDROID
|
|
343
|
+
for (const auto &[shadowNodeFamily, props] : synchronousUpdatesBatch) {
|
|
344
|
+
synchronouslyUpdateUIPropsFunction_(shadowNodeFamily->getTag(), props);
|
|
345
|
+
}
|
|
346
|
+
-#endif // __APPLE__
|
|
347
|
+
+#endif // ANDROID
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
void ReanimatedModuleProxy::requestFlushRegistry() {
|
|
351
|
+
--- a/reanimated/Tools/FeatureFlags.h
|
|
352
|
+
+++ b/reanimated/Tools/FeatureFlags.h
|
|
353
|
+
@@ -1,5 +1,6 @@
|
|
354
|
+
#pragma once
|
|
355
|
+
#include <mutex>
|
|
356
|
+
+#include <stdexcept>
|
|
357
|
+
#include <string>
|
|
358
|
+
#include <unordered_map>
|
|
359
|
+
|
|
360
|
+
--- a/reanimated/Tools/PlatformDepMethodsHolder.h
|
|
361
|
+
+++ b/reanimated/Tools/PlatformDepMethodsHolder.h
|
|
362
|
+
@@ -9,7 +9,9 @@
|
|
363
|
+
#include <react/renderer/core/Props.h>
|
|
364
|
+
#include <react/renderer/core/ReactPrimitives.h>
|
|
365
|
+
|
|
366
|
+
+#include <functional>
|
|
367
|
+
#include <memory>
|
|
368
|
+
+#include <optional>
|
|
369
|
+
#include <string>
|
|
370
|
+
#include <utility>
|
|
371
|
+
#include <vector>
|
|
372
|
+
@@ -32,7 +34,7 @@
|
|
373
|
+
using RequestRenderFunction = std::function<void(std::function<void(const double)>)>;
|
|
374
|
+
#ifdef ANDROID
|
|
375
|
+
using SynchronouslyUpdateUIPropsFunction = std::function<void(const std::vector<int> &, const std::vector<double> &)>;
|
|
376
|
+
-#elif __APPLE__
|
|
377
|
+
+#else
|
|
378
|
+
using SynchronouslyUpdateUIPropsFunction = std::function<void(const int, const folly::dynamic &)>;
|
|
379
|
+
#endif // ANDROID
|
|
380
|
+
using PreserveMountedTagsFunction = std::function<std::optional<std::unique_ptr<int[]>>(std::vector<int> &)>;
|
|
381
|
+
--- a/reanimated/Tools/SingleInstanceChecker.h
|
|
382
|
+
+++ b/reanimated/Tools/SingleInstanceChecker.h
|
|
383
|
+
@@ -4,7 +4,9 @@
|
|
384
|
+
|
|
385
|
+
#include <react/debug/react_native_assert.h>
|
|
386
|
+
|
|
387
|
+
+#ifndef _MSC_VER
|
|
388
|
+
#include <cxxabi.h>
|
|
389
|
+
+#endif
|
|
390
|
+
|
|
391
|
+
#include <atomic>
|
|
392
|
+
#include <cassert>
|
|
393
|
+
@@ -51,10 +53,14 @@
|
|
394
|
+
|
|
395
|
+
template <class T>
|
|
396
|
+
SingleInstanceChecker<T>::SingleInstanceChecker() {
|
|
397
|
+
+#ifdef _MSC_VER
|
|
398
|
+
+ std::string className = typeid(T).name();
|
|
399
|
+
+#else
|
|
400
|
+
int status = 0;
|
|
401
|
+
char *demangled = __cxxabiv1::__cxa_demangle(typeid(T).name(), nullptr, nullptr, &status);
|
|
402
|
+
std::string className = (status == 0 && demangled != nullptr) ? demangled : typeid(T).name();
|
|
403
|
+
std::free(demangled);
|
|
404
|
+
+#endif
|
|
405
|
+
|
|
406
|
+
// React Native can spawn up to two instances of a Native Module at the same
|
|
407
|
+
// time. This happens during a reload when a new instance of React Native is
|
package/package.json
CHANGED
|
@@ -1,6 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native-gpui/reanimated",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "4.7.0-alpha.1",
|
|
4
|
+
"description": "Adapter for react-native-reanimated (MIT): runs animations, layout animations and CSS animations on the desktop renderer",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/streetwriters/react-native-gpui-modules.git",
|
|
9
|
+
"directory": "modules/reanimated"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/streetwriters/react-native-gpui-modules/tree/main/modules/reanimated#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/streetwriters/react-native-gpui-modules/issues"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"desktop",
|
|
17
|
+
"react-native.config.js",
|
|
18
|
+
"src",
|
|
19
|
+
"README.md",
|
|
20
|
+
"LICENSE",
|
|
21
|
+
"CHANGELOG.md",
|
|
22
|
+
"!**/*.test.js",
|
|
23
|
+
"!**/*.test.mjs",
|
|
24
|
+
"!**/*.test.ts",
|
|
25
|
+
"!**/*.test.cjs"
|
|
26
|
+
],
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"react-native": "0.87.x",
|
|
29
|
+
"react-native-reanimated": "4.7.x",
|
|
30
|
+
"react-native-worklets": "0.13.x",
|
|
31
|
+
"@react-native-gpui/worklets": "0.13.0-alpha.1"
|
|
32
|
+
},
|
|
33
|
+
"codegenConfig": {
|
|
34
|
+
"name": "GPUIReanimatedSpec",
|
|
35
|
+
"type": "modules",
|
|
36
|
+
"jsSrcsDir": "src"
|
|
37
|
+
},
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public",
|
|
40
|
+
"tag": "latest"
|
|
41
|
+
}
|
|
42
|
+
}
|