mirror of
https://github.com/status-im/react-native.git
synced 2025-02-27 00:20:31 +00:00
Avoid app crashing when a StackOverflowError is thrown when rendering deep RN view hierarcy
Reviewed By: achen1 Differential Revision: D7400906 fbshipit-source-id: faaf701a88440f89390518f00e6a35f19e9203db
This commit is contained in:
parent
4906f8d28c
commit
d58ba8242b
@ -21,6 +21,7 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.Animation;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.common.annotations.VisibleForTesting;
|
||||
import com.facebook.react.modules.i18nmanager.I18nUtil;
|
||||
import com.facebook.react.touch.OnInterceptTouchEventListener;
|
||||
@ -667,11 +668,16 @@ public class ReactViewGroup extends ViewGroup implements
|
||||
RootView rootView = RootViewUtil.getRootView(ReactViewGroup.this);
|
||||
if (rootView != null) {
|
||||
rootView.handleException(e);
|
||||
} else {
|
||||
if (getContext() instanceof ReactContext) {
|
||||
ReactContext reactContext = (ReactContext) getContext();
|
||||
reactContext.handleException(new IllegalViewOperationException("StackOverflowException", this, e));
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void dispatchOverflowDraw(Canvas canvas) {
|
||||
if (mOverflow != null) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user