mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Use context from view when resolving platform color if activity doesn't exist
Summary: There are cases where the activity may not exist (such as for VRShell panel apps). In this case we will search for a view associated with a PropsAnimatedNode to get the context. Changelog: [Internal][Fixed] - Use context from view when resolving platform color if activity doesn't exist Reviewed By: javache Differential Revision: D34022882 fbshipit-source-id: c316935af1034ea770f3ef9334f77d6dc783fb27
This commit is contained in:
committed by
Facebook GitHub Bot
parent
cd79317672
commit
1a044123fc
@@ -7,12 +7,14 @@
|
||||
|
||||
package com.facebook.react.animated;
|
||||
|
||||
import android.view.View;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
|
||||
import com.facebook.react.bridge.JavaOnlyMap;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.bridge.ReadableMapKeySetIterator;
|
||||
import com.facebook.react.bridge.UIManager;
|
||||
import com.facebook.react.uimanager.IllegalViewOperationException;
|
||||
import com.facebook.react.uimanager.common.UIManagerType;
|
||||
import com.facebook.react.uimanager.common.ViewUtil;
|
||||
import java.util.HashMap;
|
||||
@@ -116,6 +118,16 @@ import java.util.Map;
|
||||
mUIManager.synchronouslyUpdateViewOnUIThread(mConnectedViewTag, mPropMap);
|
||||
}
|
||||
|
||||
public View getConnectedView() {
|
||||
try {
|
||||
return mUIManager.resolveView(mConnectedViewTag);
|
||||
} catch (IllegalViewOperationException ex) {
|
||||
// resolveView throws an {@link IllegalViewOperationException} when the view doesn't exist
|
||||
// (this can happen if the surface is being deallocated).
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String prettyPrint() {
|
||||
return "PropsAnimatedNode["
|
||||
+ mTag
|
||||
|
||||
Reference in New Issue
Block a user