Skip to content

Commit

Permalink
Add setFeatureFlag method (#5422)
Browse files Browse the repository at this point in the history
## Summary

In Fabric version 0.73, this flag is necessary. Without it, all
animations won't work properly since our animation logic heavily relies
on the commit and mount hooks.
  • Loading branch information
piaskowyk authored Nov 28, 2023
1 parent 5918b08 commit 01d03bc
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 5 deletions.
9 changes: 9 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,15 @@ android {
} else {
srcDirs += "src/reactNativeVersionPatch/ReanimatedUIManager/latest"
}

// ReactFeatureFlags
if (IS_NEW_ARCHITECTURE_ENABLED) {
if (REACT_NATIVE_MINOR_VERSION <= 72) {
srcDirs += "src/reactNativeVersionPatch/ReactFeatureFlagsWrapper/72"
} else {
srcDirs += "src/reactNativeVersionPatch/ReactFeatureFlagsWrapper/latest"
}
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.swmansion.reanimated;

import android.util.Log;

import com.facebook.jni.HybridData;
import com.facebook.proguard.annotations.DoNotStrip;
import com.facebook.react.bridge.ReactApplicationContext;
Expand All @@ -10,12 +8,10 @@
import com.facebook.react.turbomodule.core.CallInvokerHolderImpl;
import com.facebook.react.uimanager.UIManagerHelper;
import com.facebook.react.uimanager.common.UIManagerType;
import com.swmansion.reanimated.layoutReanimation.AnimationsManager;
import com.swmansion.reanimated.layoutReanimation.LayoutAnimations;
import com.swmansion.reanimated.layoutReanimation.NativeMethodsHolder;
import com.swmansion.reanimated.nativeProxy.NativeProxyCommon;

import java.lang.ref.WeakReference;
import java.util.HashMap;

public class NativeProxy extends NativeProxyCommon {
Expand All @@ -25,7 +21,7 @@ public class NativeProxy extends NativeProxyCommon {

public NativeProxy(ReactApplicationContext context) {
super(context);

ReactFeatureFlagsWrapper.enableMountHooks();
CallInvokerHolderImpl holder =
(CallInvokerHolderImpl) context.getCatalystInstance().getJSCallInvokerHolder();

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.swmansion.reanimated;

public class ReactFeatureFlagsWrapper {

public static void enableMountHooks() {
// no-op
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.swmansion.reanimated;

import com.facebook.react.config.ReactFeatureFlags;

public class ReactFeatureFlagsWrapper {

public static void enableMountHooks() {
ReactFeatureFlags.enableMountHooks = true;
}

}

0 comments on commit 01d03bc

Please sign in to comment.