mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
remove enable_shared_from_this from AnimatedModule (#51606)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/51606 changelog: [internal] When native module is destroyed, ui queue is also torn down. this helps with C++ binary size a little bit Reviewed By: rshest Differential Revision: D75149437 fbshipit-source-id: 1df061db26b4fb5026114e00bbc6846bf38d83a9
This commit is contained in:
committed by
Facebook GitHub Bot
parent
c653eea19d
commit
53b232fd5f
@@ -79,20 +79,17 @@ void AnimatedModule::getValue(
|
||||
void AnimatedModule::startListeningToAnimatedNodeValue(
|
||||
jsi::Runtime& /*rt*/,
|
||||
Tag tag) {
|
||||
addOperation([tag, weakThis = weak_from_this()](
|
||||
NativeAnimatedNodesManager& nodesManager) {
|
||||
addOperation([tag, this](NativeAnimatedNodesManager& nodesManager) {
|
||||
nodesManager.startListeningToAnimatedNodeValue(
|
||||
tag, [weakThis, tag](double value) {
|
||||
if (auto strongThis = weakThis.lock()) {
|
||||
strongThis->emitDeviceEvent(
|
||||
"onAnimatedValueUpdate",
|
||||
[tag, value](jsi::Runtime& rt, std::vector<jsi::Value>& args) {
|
||||
auto arg = jsi::Object(rt);
|
||||
arg.setProperty(rt, "tag", jsi::Value(tag));
|
||||
arg.setProperty(rt, "value", jsi::Value(value));
|
||||
args.emplace_back(rt, arg);
|
||||
});
|
||||
}
|
||||
tag, [this, tag](double value) {
|
||||
emitDeviceEvent(
|
||||
"onAnimatedValueUpdate",
|
||||
[tag, value](jsi::Runtime& rt, std::vector<jsi::Value>& args) {
|
||||
auto arg = jsi::Object(rt);
|
||||
arg.setProperty(rt, "tag", jsi::Value(tag));
|
||||
arg.setProperty(rt, "value", jsi::Value(value));
|
||||
args.emplace_back(rt, arg);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
namespace facebook::react {
|
||||
|
||||
class AnimatedModule : public NativeAnimatedModuleCxxSpec<AnimatedModule>,
|
||||
public std::enable_shared_from_this<AnimatedModule>,
|
||||
public TurboModuleWithJSIBindings {
|
||||
using Operation =
|
||||
std::function<void(NativeAnimatedNodesManager& nodesManager)>;
|
||||
|
||||
Reference in New Issue
Block a user