diff --git a/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java b/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java index 0f52b73..0b295d8 100644 --- a/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java +++ b/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java @@ -38,7 +38,7 @@ import com.facebook.react.uimanager.common.ViewUtil; import java.util.ArrayList; import java.util.List; import java.util.Queue; -import java.util.concurrent.ConcurrentLinkedQueue; +import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.atomic.AtomicReference; /** @@ -151,7 +151,7 @@ public class NativeAnimatedModule extends NativeAnimatedModuleSpec } private class ConcurrentOperationQueue { - private final Queue mQueue = new ConcurrentLinkedQueue<>(); + private final Queue mQueue = new LinkedBlockingQueue<>(); @Nullable private UIThreadOperation mPeekedOperation = null; @AnyThread diff --git a/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedNodesManager.java b/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedNodesManager.java index bb626be..49785c8 100644 --- a/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedNodesManager.java +++ b/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedNodesManager.java @@ -250,8 +250,8 @@ public class NativeAnimatedNodesManager implements EventDispatcherListener { int animationId, int animatedNodeTag, ReadableMap animationConfig, Callback endCallback) { AnimatedNode node = mAnimatedNodes.get(animatedNodeTag); if (node == null) { - throw new JSApplicationIllegalArgumentException( - "startAnimatingNode: Animated node [" + animatedNodeTag + "] does not exist"); + FLog.e(TAG, "startAnimatingNode: Animated node [" + animatedNodeTag + "] does not exist"); + return; } if (!(node instanceof ValueAnimatedNode)) { throw new JSApplicationIllegalArgumentException( @@ -356,19 +356,23 @@ public class NativeAnimatedNodesManager implements EventDispatcherListener { @UiThread public void connectAnimatedNodes(int parentNodeTag, int childNodeTag) { AnimatedNode parentNode = mAnimatedNodes.get(parentNodeTag); + if (parentNode == null) { - throw new JSApplicationIllegalArgumentException( + FLog.e(TAG, "connectAnimatedNodes: Animated node with tag (parent) [" + parentNodeTag + "] does not exist"); + return; } AnimatedNode childNode = mAnimatedNodes.get(childNodeTag); if (childNode == null) { - throw new JSApplicationIllegalArgumentException( + FLog.e(TAG, "connectAnimatedNodes: Animated node with tag (child) [" + childNodeTag + "] does not exist"); + return; } + parentNode.addChild(childNode); mUpdatedNodes.put(childNodeTag, childNode); } diff --git a/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/StyleAnimatedNode.java b/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/StyleAnimatedNode.java index 68ef6a4..d1d0144 100644 --- a/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/StyleAnimatedNode.java +++ b/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/StyleAnimatedNode.java @@ -7,6 +7,7 @@ package com.facebook.react.animated; +import com.facebook.common.logging.FLog; import androidx.annotation.Nullable; import com.facebook.react.bridge.JavaOnlyMap; import com.facebook.react.bridge.ReadableMap; @@ -19,6 +20,8 @@ import java.util.Map; */ /*package*/ class StyleAnimatedNode extends AnimatedNode { + private static final String TAG = "StyleAnimatedNode"; + private final NativeAnimatedNodesManager mNativeAnimatedNodesManager; private final Map mPropMapping; @@ -38,7 +41,8 @@ import java.util.Map; for (Map.Entry entry : mPropMapping.entrySet()) { @Nullable AnimatedNode node = mNativeAnimatedNodesManager.getNodeById(entry.getValue()); if (node == null) { - throw new IllegalArgumentException("Mapped style node does not exists"); + FLog.e(TAG, "Mapped style node does not exists"); + continue; } else if (node instanceof TransformAnimatedNode) { ((TransformAnimatedNode) node).collectViewUpdates(propsMap); } else if (node instanceof ValueAnimatedNode) { diff --git a/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/TransformAnimatedNode.java b/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/TransformAnimatedNode.java index 8b3ec59..767e822 100644 --- a/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/TransformAnimatedNode.java +++ b/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/TransformAnimatedNode.java @@ -7,6 +7,7 @@ package com.facebook.react.animated; +import com.facebook.common.logging.FLog; import com.facebook.react.bridge.JavaOnlyArray; import com.facebook.react.bridge.JavaOnlyMap; import com.facebook.react.bridge.ReadableArray; @@ -20,6 +21,8 @@ import java.util.List; */ /* package */ class TransformAnimatedNode extends AnimatedNode { + private static final String TAG = "TransformAnimatedNode"; + private class TransformConfig { public String mProperty; } @@ -66,7 +69,8 @@ import java.util.List; int nodeTag = ((AnimatedTransformConfig) transformConfig).mNodeTag; AnimatedNode node = mNativeAnimatedNodesManager.getNodeById(nodeTag); if (node == null) { - throw new IllegalArgumentException("Mapped style node does not exists"); + FLog.e(TAG, "Mapped style node does not exists"); + continue; } else if (node instanceof ValueAnimatedNode) { value = ((ValueAnimatedNode) node).getValue(); } else { diff --git a/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountItemDispatcher.java b/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountItemDispatcher.java index a14cc85..1ef6fe2 100644 --- a/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountItemDispatcher.java +++ b/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountItemDispatcher.java @@ -32,7 +32,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Queue; -import java.util.concurrent.ConcurrentLinkedQueue; +import java.util.concurrent.LinkedBlockingQueue; public class MountItemDispatcher { @@ -44,15 +44,15 @@ public class MountItemDispatcher { private final ItemDispatchListener mItemDispatchListener; @NonNull - private final ConcurrentLinkedQueue mViewCommandMountItems = - new ConcurrentLinkedQueue<>(); + private final LinkedBlockingQueue mViewCommandMountItems = + new LinkedBlockingQueue<>(); @NonNull - private final ConcurrentLinkedQueue mMountItems = new ConcurrentLinkedQueue<>(); + private final LinkedBlockingQueue mMountItems = new LinkedBlockingQueue<>(); @NonNull - private final ConcurrentLinkedQueue mPreMountItems = - new ConcurrentLinkedQueue<>(); + private final LinkedBlockingQueue mPreMountItems = + new LinkedBlockingQueue<>(); private boolean mInDispatch = false; private int mReDispatchCounter = 0; @@ -354,7 +354,7 @@ public class MountItemDispatcher { @Nullable private static List drainConcurrentItemQueue( - ConcurrentLinkedQueue queue) { + LinkedBlockingQueue queue) { if (queue.isEmpty()) { return null; } diff --git a/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/SurfaceMountingManager.java b/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/SurfaceMountingManager.java index 804a77a..b4c6f00 100644 --- a/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/SurfaceMountingManager.java +++ b/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/SurfaceMountingManager.java @@ -56,7 +56,7 @@ import java.util.Queue; import java.util.Set; import java.util.Stack; import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentLinkedQueue; +import java.util.concurrent.LinkedBlockingQueue; import javax.annotation.Nullable; public class SurfaceMountingManager { @@ -72,7 +72,7 @@ public class SurfaceMountingManager { // These are all non-null, until StopSurface is called private ConcurrentHashMap mTagToViewState = new ConcurrentHashMap<>(); // any thread - private ConcurrentLinkedQueue mOnViewAttachItems = new ConcurrentLinkedQueue<>(); + private LinkedBlockingQueue mOnViewAttachItems = new LinkedBlockingQueue<>(); private JSResponderHandler mJSResponderHandler; private ViewManagerRegistry mViewManagerRegistry; private RootViewManager mRootViewManager;