1 #pragma once
2 
3 #include <fbjni/fbjni.h>
4 #include <jsi/jsi.h>
5 #include <memory>
6 #include "JNIHelper.h"
7 
8 namespace reanimated {
9 
10 using namespace facebook::jni;
11 using namespace facebook;
12 
13 class LayoutAnimations : public jni::HybridClass<LayoutAnimations> {
14  public:
15   static auto constexpr kJavaDescriptor =
16       "Labi48_0_0/com/swmansion/reanimated/layoutReanimation/LayoutAnimations;";
17   static jni::local_ref<jhybriddata> initHybrid(
18       jni::alias_ref<jhybridobject> jThis);
19   static void registerNatives();
20 
21   void startAnimationForTag(
22       int tag,
23       alias_ref<JString> type,
24       alias_ref<JMap<jstring, jstring>> values);
25   void removeConfigForTag(int tag);
26   bool isLayoutAnimationEnabled();
27 
28   void setWeakUIRuntime(std::weak_ptr<jsi::Runtime> wrt);
29 
30   void notifyAboutProgress(const jsi::Value &progress, int tag);
31   void notifyAboutEnd(int tag, int cancelled);
32 
33  private:
34   friend HybridBase;
35   jni::global_ref<LayoutAnimations::javaobject> javaPart_;
36   std::weak_ptr<jsi::Runtime> weakUIRuntime;
37 
38   explicit LayoutAnimations(
39       jni::alias_ref<LayoutAnimations::jhybridobject> jThis);
40 };
41 
42 }; // namespace reanimated
43