Skip to content

Commit

Permalink
chore: Aggregate commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tjzel committed Nov 7, 2024
1 parent 208a96d commit cf77574
Show file tree
Hide file tree
Showing 36 changed files with 258 additions and 1,136 deletions.
1 change: 1 addition & 0 deletions apps/macos-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"eslint": "^8.57.0",
"jest": "^29.6.3",
"prettier": "^3.3.3",
"react-native-macos-init": "^2.1.3",
"react-test-renderer": "18.2.0",
"typescript": "~5.3.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class ReanimatedCommitHook : public UIManagerCommitHook {

~ReanimatedCommitHook() noexcept override;

#if REACT_NATIVE_MINOR_VERSION >= 73
void commitHookWasRegistered(UIManager const &) noexcept override {}

void commitHookWasUnregistered(UIManager const &) noexcept override {}
Expand All @@ -30,17 +29,6 @@ class ReanimatedCommitHook : public UIManagerCommitHook {
ShadowTree const &shadowTree,
RootShadowNode::Shared const &oldRootShadowNode,
RootShadowNode::Unshared const &newRootShadowNode) noexcept override;
#else
void commitHookWasRegistered(UIManager const &) const noexcept override {}

void commitHookWasUnregistered(UIManager const &) const noexcept override {}

RootShadowNode::Unshared shadowTreeWillCommit(
ShadowTree const &shadowTree,
RootShadowNode::Shared const &oldRootShadowNode,
RootShadowNode::Unshared const &newRootShadowNode)
const noexcept override;
#endif

private:
std::shared_ptr<PropsRegistry> propsRegistry_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
#include <react/renderer/scheduler/Scheduler.h>
#include <react/renderer/uimanager/UIManagerBinding.h>
#include <react/renderer/uimanager/primitives.h>
#if REACT_NATIVE_MINOR_VERSION >= 73
#include <react/utils/CoreFeatures.h>
#endif // REACT_NATIVE_MINOR_VERSION
#endif // RCT_NEW_ARCH_ENABLED

#include <functional>
Expand All @@ -48,10 +46,10 @@

using namespace facebook;

#if REACT_NATIVE_MINOR_VERSION == 73 && defined(RCT_NEW_ARCH_ENABLED)
#ifdef RCT_NEW_ARCH_ENABLED
// Android can't find the definition of this static field
bool CoreFeatures::useNativeState;
#endif
#endif // RCT_NEW_ARCH_ENABLED

namespace reanimated {

Expand Down Expand Up @@ -617,13 +615,8 @@ bool NativeReanimatedModule::handleRawEvent(
eventType = "on" + eventType.substr(3);
}
jsi::Runtime &rt = uiWorkletRuntime_->getJSIRuntime();
#if REACT_NATIVE_MINOR_VERSION >= 73
const auto &eventPayload = rawEvent.eventPayload;
jsi::Value payload = eventPayload->asJSIValue(rt);
#else
const auto &payloadFactory = rawEvent.payloadFactory;
jsi::Value payload = payloadFactory(rt);
#endif

auto res = handleEvent(eventType, tag, std::move(payload), currentTime);
// TODO: we should call performOperations conditionally if event is handled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,26 +179,16 @@ class ShareableObject : public Shareable {
public:
ShareableObject(jsi::Runtime &rt, const jsi::Object &object);

#if defined(USE_HERMES) || REACT_NATIVE_MINOR_VERSION >= 74
#define SUPPORTS_NATIVE_STATE 1
#else
#define SUPPORTS_NATIVE_STATE 0
#endif

#if SUPPORTS_NATIVE_STATE
ShareableObject(
jsi::Runtime &rt,
const jsi::Object &object,
const jsi::Value &nativeStateSource);
#endif // SUPPORTS_NATIVE_STATE

jsi::Value toJSValue(jsi::Runtime &rt) override;

protected:
std::vector<std::pair<std::string, std::shared_ptr<Shareable>>> data_;
#if SUPPORTS_NATIVE_STATE
std::shared_ptr<jsi::NativeState> nativeState_;
#endif // SUPPORTS_NATIVE_STATE
};

class ShareableHostObject : public Shareable {
Expand Down Expand Up @@ -234,19 +224,11 @@ class ShareableHostFunction : public Shareable {

class ShareableArrayBuffer : public Shareable {
public:
ShareableArrayBuffer(
jsi::Runtime &rt,
#if REACT_NATIVE_MINOR_VERSION >= 72
const jsi::ArrayBuffer &arrayBuffer
#else
jsi::ArrayBuffer arrayBuffer
#endif
)
ShareableArrayBuffer(jsi::Runtime &rt, const jsi::ArrayBuffer &arrayBuffer)
: Shareable(ArrayBufferType),
data_(
arrayBuffer.data(rt),
arrayBuffer.data(rt) + arrayBuffer.size(rt)) {
}
arrayBuffer.data(rt) + arrayBuffer.size(rt)) {}

jsi::Value toJSValue(jsi::Runtime &rt) override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ JSScheduler::JSScheduler(
rnRuntime_(rnRuntime),
jsCallInvoker_(jsCallInvoker) {}

#if REACT_NATIVE_MINOR_VERSION >= 74 && defined(RCT_NEW_ARCH_ENABLED)
#ifdef RCT_NEW_ARCH_ENABLED
// With `runtimeExecutor`.
JSScheduler::JSScheduler(
jsi::Runtime &rnRuntime,
Expand All @@ -28,7 +28,7 @@ JSScheduler::JSScheduler(
}),
rnRuntime_(rnRuntime),
runtimeExecutor_(runtimeExecutor) {}
#endif // REACT_NATIVE_MINOR_VERSION >= 74 && defined(RCT_NEW_ARCH_ENABLED
#endif // RCT_NEW_ARCH_ENABLED

const std::shared_ptr<CallInvoker> JSScheduler::getJSCallInvoker() const {
assert(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@ class JSScheduler {
jsi::Runtime &rnRuntime,
const std::shared_ptr<CallInvoker> &jsCallInvoker);

#if REACT_NATIVE_MINOR_VERSION >= 74 && defined(RCT_NEW_ARCH_ENABLED)
#ifdef RCT_NEW_ARCH_ENABLED
// With `runtimeExecutor`.
explicit JSScheduler(
jsi::Runtime &rnRuntime,
RuntimeExecutor runtimeExecutor);
#endif // REACT_NATIVE_MINOR_VERSION >= 74 && defined(RCT_NEW_ARCH_ENABLED
#endif // RCT_NEW_ARCH_ENABLED

const std::function<void(Job)> scheduleOnJS = nullptr;
const std::shared_ptr<CallInvoker> getJSCallInvoker() const;

protected:
jsi::Runtime &rnRuntime_;
#if REACT_NATIVE_MINOR_VERSION >= 74 && defined(RCT_NEW_ARCH_ENABLED)
#ifdef RCT_NEW_ARCH_ENABLED
RuntimeExecutor runtimeExecutor_ = nullptr;
#endif // REACT_NATIVE_MINOR_VERSION >= 74 && defined(RCT_NEW_ARCH_ENABLED
#endif // RCT_NEW_ARCH_ENABLED
const std::shared_ptr<CallInvoker> jsCallInvoker_ = nullptr;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ namespace worklets {
using namespace facebook;
using namespace react;
#if HERMES_ENABLE_DEBUGGER
#if REACT_NATIVE_MINOR_VERSION >= 73
using namespace facebook::hermes::inspector_modern;
#else
using namespace facebook::hermes::inspector;
#endif
#endif // HERMES_ENABLE_DEBUGGER

#if HERMES_ENABLE_DEBUGGER
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,15 @@
#endif

#if HERMES_ENABLE_DEBUGGER
#if REACT_NATIVE_MINOR_VERSION >= 73
#include <hermes/inspector-modern/chrome/Registration.h>
#else
#include <hermes/inspector/RuntimeAdapter.h>
#include <hermes/inspector/chrome/Registration.h>
#endif
#endif // HERMES_ENABLE_DEBUGGER

namespace worklets {

using namespace facebook;
using namespace react;
#if HERMES_ENABLE_DEBUGGER
#if REACT_NATIVE_MINOR_VERSION >= 73
using namespace facebook::hermes::inspector_modern;
#else
using namespace facebook::hermes::inspector;
#endif
#endif // HERMES_ENABLE_DEBUGGER

// ReentrancyCheck is copied from React Native
Expand Down
54 changes: 0 additions & 54 deletions packages/react-native-reanimated/__typetests__/72plus/index.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function InlineStylesTest() {
}

function InlineStylesTest4() {
const sv = useSharedValue(true);
const sv = useSharedValue('0');
// @ts-expect-error properly detects illegal type
return <Animated.View style={{ width: sv }} />;
}
Expand All @@ -55,7 +55,7 @@ function InlineStylesTest() {
}

function InlineStylesTest6() {
const sv = useSharedValue({ width: true });
const sv = useSharedValue({ width: '0' });
// @ts-expect-error properly detects illegal type
return <Animated.View style={sv} />;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function UseAnimatedStyleTest() {
}

function UseAnimatedStyleTest2() {
const sv = useSharedValue(true);
const sv = useSharedValue('0');
// @ts-expect-error properly detects illegal type
const animatedStyle = useAnimatedStyle(() => {
return {
Expand All @@ -36,7 +36,7 @@ function UseAnimatedStyleTest() {
}

function UseAnimatedStyleTest4() {
const sv = useSharedValue({ width: true });
const sv = useSharedValue({ width: '0' });
// @ts-expect-error properly detects illegal type
const animatedStyle = useAnimatedStyle(() => {
return sv.value;
Expand Down
Loading

0 comments on commit cf77574

Please sign in to comment.