Skip to content

Commit

Permalink
Fix incorrect cast in RemoveDeleteTree (#43018)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #43018

Assuming that if View is a ViewGroup, its ViewManager is a ViewGroupManager is incorrect. Custom ViewManagers may use ViewGroups internally to represent complex views exposed to JS.

Type-check the ViewManager instead to avoid the crash seen in T178300877

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D53586565

fbshipit-source-id: 49408098cebc7f76d8be0e585187ba9b6ca52049
  • Loading branch information
javache authored and facebook-github-bot committed Feb 15, 2024
1 parent 5a5c9eb commit 53e3f36
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1432,8 +1432,9 @@ public void doFrameGuarded(long frameTimeNanos) {
ViewState thisViewState = getNullableViewState(reactTag);
if (thisViewState != null) {
View thisView = thisViewState.mView;
if (thisView instanceof ViewGroup) {
IViewGroupManager viewManager = getViewGroupManager(thisViewState);
ViewManager thisViewManager = thisViewState.mViewManager;
if (thisViewManager instanceof IViewGroupManager) {
IViewGroupManager viewManager = (IViewGroupManager) thisViewManager;

// Children are managed by React Native if both of the following are true:
// 1) There are 1 or more children of this View, which must be a ViewGroup
Expand Down

0 comments on commit 53e3f36

Please sign in to comment.