Skip to content
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

Remove unused reference to runtime from requestRender method #6953

Merged
merged 4 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -519,9 +519,7 @@ void ReanimatedModuleProxy::requestAnimationFrame(
void ReanimatedModuleProxy::maybeRequestRender() {
if (!renderRequested_) {
renderRequested_ = true;
jsi::Runtime &uiRuntime =
workletsModuleProxy_->getUIWorkletRuntime()->getJSIRuntime();
requestRender_(onRenderCallback_, uiRuntime);
requestRender_(onRenderCallback_);
}
}

Expand Down Expand Up @@ -767,18 +765,11 @@ void ReanimatedModuleProxy::cssLoopCallback(const double /*timestampMs*/) {
|| updatesRegistryManager_->hasPropsToRevert()
#endif // ANDROID
) {
jsi::Runtime &rt =
workletsModuleProxy_->getUIWorkletRuntime()->getJSIRuntime();
requestRender_(
[weakThis = weak_from_this()](const double newTimestampMs) {
auto strongThis = weakThis.lock();
if (!strongThis) {
return;
}

strongThis->cssLoopCallback(newTimestampMs);
},
rt);
requestRender_([weakThis = weak_from_this()](const double newTimestampMs) {
if (auto strongThis = weakThis.lock()) {
strongThis->cssLoopCallback(newTimestampMs);
}
});
} else {
cssLoopRunning_ = false;
}
Expand All @@ -797,20 +788,11 @@ void ReanimatedModuleProxy::maybeRunCSSLoop() {
if (!strongThis) {
return;
}

jsi::Runtime &rt =
strongThis->workletsModuleProxy_->getUIWorkletRuntime()
->getJSIRuntime();
strongThis->requestRender_(
[weakThis](const double timestampMs) {
auto strongThis = weakThis.lock();
if (!strongThis) {
return;
}

strongThis->cssLoopCallback(timestampMs);
},
rt);
strongThis->requestRender_([weakThis](const double timestampMs) {
if (auto strongThis = weakThis.lock()) {
strongThis->cssLoopCallback(timestampMs);
}
});
});
}

Expand Down Expand Up @@ -918,18 +900,11 @@ void ReanimatedModuleProxy::performOperations() {
}

void ReanimatedModuleProxy::requestFlushRegistry() {
jsi::Runtime &rt =
workletsModuleProxy_->getUIWorkletRuntime()->getJSIRuntime();
requestRender_(
[weakThis = weak_from_this()](double time) {
auto strongThis = weakThis.lock();
if (!strongThis) {
return;
}

strongThis->shouldFlushRegistry_ = true;
},
rt);
requestRender_([weakThis = weak_from_this()](double time) {
piaskowyk marked this conversation as resolved.
Show resolved Hide resolved
if (auto strongThis = weakThis.lock()) {
strongThis->shouldFlushRegistry_ = true;
}
});
}

void ReanimatedModuleProxy::commitUpdates(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ using ObtainPropFunction =
#endif // RCT_NEW_ARCH_ENABLED

using RequestRenderFunction =
std::function<void(std::function<void(const double)>, jsi::Runtime &)>;
std::function<void(std::function<void(const double)>)>;
using GetAnimationTimestampFunction = std::function<double(void)>;

using ProgressLayoutAnimationFunction =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,7 @@ void NativeProxy::registerNatives() {
makeNativeMethod("invalidateCpp", NativeProxy::invalidateCpp)});
}

void NativeProxy::requestRender(
std::function<void(double)> onRender,
jsi::Runtime &) {
void NativeProxy::requestRender(std::function<void(double)> onRender) {
static const auto method =
getJniMethod<void(AnimationFrameCallback::javaobject)>("requestRender");
method(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ class NativeProxy : public jni::HybridClass<NativeProxy>,
const int emitterReactTag);
void performOperations();
bool getIsReducedMotion();
void requestRender(std::function<void(double)> onRender, jsi::Runtime &rt);
void requestRender(std::function<void(double)> onRender);
void registerEventHandler();
void maybeFlushUIUpdatesQueue();
void setGestureState(int handlerTag, int newState);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,15 @@ SetGestureStateFunction makeSetGestureStateFunctionBridgeless(RCTModuleRegistry

RequestRenderFunction makeRequestRender(REANodesManager *nodesManager)
{
auto requestRender = [nodesManager](std::function<void(double)> onRender, jsi::Runtime &rt) {
auto requestRender = [nodesManager](std::function<void(double)> onRender) {
[nodesManager postOnAnimation:^(READisplayLink *displayLink) {
#if !TARGET_OS_OSX
auto targetTimestamp = displayLink.targetTimestamp;
#else
// TODO macOS targetTimestamp isn't available on macOS
auto targetTimestamp = displayLink.timestamp + displayLink.duration;
#endif
double frameTimestamp =

(targetTimestamp) * 1000;
const double frameTimestamp = targetTimestamp * 1000;
piaskowyk marked this conversation as resolved.
Show resolved Hide resolved
onRender(frameTimestamp);
}];
};
Expand Down
Loading