Skip to content

Commit

Permalink
[android][go] fix broken reanimated layout animation (expo#21579)
Browse files Browse the repository at this point in the history
# Why

fixes expo#21505

# How

reanimated 2.14 requires to use the `ReanimatedUIManagerFactory.create()` for uimanager binding: https://github.com/software-mansion/react-native-reanimated/blob/fa5dc5271f49895339e0669b4f10d111e1c64e34/android/src/main/java/com/swmansion/reanimated/ReanimatedPackage.java#L76

# Test Plan

versioned android expo go + ncl reanimated
  • Loading branch information
Kudo authored Mar 8, 2023
1 parent 38082a2 commit 43d4996
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import com.facebook.react.uimanager.UIManagerModule
import com.facebook.react.uimanager.ViewManager
import com.facebook.systrace.Systrace
import com.swmansion.reanimated.ReanimatedModule
import com.swmansion.reanimated.ReanimatedUIManagerFactory
import expo.modules.manifests.core.Manifest
import host.exp.exponent.experience.ReactNativeActivity
import host.exp.exponent.kernel.KernelConstants
Expand Down Expand Up @@ -113,7 +114,7 @@ class ExpoTurboPackage(
Systrace.beginSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "createUIManagerModule")
val minTimeLeftInFrameForNonBatchedOperationMs = -1
return try {
ReanimatedUIManager(
ReanimatedUIManagerFactory.create(
reactContext,
reactInstanceManager.getOrCreateViewManagers(reactContext),
minTimeLeftInFrameForNonBatchedOperationMs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

public class ReanimatedUIManagerFactory {

static UIManagerModule create(ReactApplicationContext reactContext, List<ViewManager> viewManagers, int minTimeLeftInFrameForNonBatchedOperationMs) {
public static UIManagerModule create(ReactApplicationContext reactContext, List<ViewManager> viewManagers, int minTimeLeftInFrameForNonBatchedOperationMs) {
ViewManagerRegistry viewManagerRegistry = new ViewManagerRegistry(viewManagers);

UIManagerModule uiManagerModule =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

public class ReanimatedUIManagerFactory {

static UIManagerModule create(ReactApplicationContext reactContext, List<ViewManager> viewManagers, int minTimeLeftInFrameForNonBatchedOperationMs) {
public static UIManagerModule create(ReactApplicationContext reactContext, List<ViewManager> viewManagers, int minTimeLeftInFrameForNonBatchedOperationMs) {
ViewManagerRegistry viewManagerRegistry = new ViewManagerRegistry(viewManagers);

UIManagerModule uiManagerModule =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import abi48_0_0.com.facebook.react.module.model.ReactModuleInfoProvider
import abi48_0_0.com.facebook.react.modules.intent.IntentModule
import abi48_0_0.com.facebook.react.turbomodule.core.interfaces.TurboModule
import abi48_0_0.com.facebook.react.uimanager.ReanimatedUIManager
import abi48_0_0.com.swmansion.reanimated.ReanimatedUIManagerFactory
import abi48_0_0.com.facebook.react.uimanager.UIManagerModule
import abi48_0_0.com.facebook.react.uimanager.ViewManager
import abi48_0_0.com.facebook.systrace.Systrace
Expand Down Expand Up @@ -113,7 +114,7 @@ class ExpoTurboPackage(
Systrace.beginSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "createUIManagerModule")
val minTimeLeftInFrameForNonBatchedOperationMs = -1
return try {
ReanimatedUIManager(
ReanimatedUIManagerFactory.create(
reactContext,
reactInstanceManager.getOrCreateViewManagers(reactContext),
minTimeLeftInFrameForNonBatchedOperationMs
Expand Down
6 changes: 6 additions & 0 deletions tools/src/vendoring/config/expoGoConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,12 @@ const config: VendoringTargetConfig = {
find: /"\$\{BUILD_DIR\}\/.+\/libhermes\.so"/g,
replaceWith: `hermes-engine::libhermes`,
},
{
// expose `ReanimatedUIManagerFactory.create` publicly
paths: 'ReanimatedUIManagerFactory.java',
find: /((?<!public )static UIManagerModule create\()/g,
replaceWith: 'public $1',
},
],
},
},
Expand Down

0 comments on commit 43d4996

Please sign in to comment.