Skip to content

Commit

Permalink
fix setNativeProps crash
Browse files Browse the repository at this point in the history
Summary:
setNativeProps ends up calling UIManager.updateView which fails to find the view tag in the Paper UIManager and crashes.

This diff simply checks if the tag is managed by fabric, and calls `fabricUIManager.synchronouslyUpdateViewOnUIThread` if it is.

Not the ideal fix, but it generally works (js-driven animations work as well as in Paper) and it's better than crashing or not working at all.

Reviewed By: JoshuaGross

Differential Revision: D14414523

fbshipit-source-id: 0acd404f55094f8ce8eda39cb87ab58c727fb068
  • Loading branch information
sahrens authored and facebook-github-bot committed Mar 25, 2019
1 parent 45b9b65 commit d9eae2a
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -472,8 +472,13 @@ public void updateView(int tag, String className, ReadableMap props) {
FLog.d(ReactConstants.TAG, message);
PrinterHolder.getPrinter().logMessage(ReactDebugOverlayTags.UI_MANAGER, message);
}

mUIImplementation.updateView(tag, className, props);
int uiManagerType = ViewUtil.getUIManagerType(tag);
if (uiManagerType == FABRIC) {
UIManager fabricUIManager = UIManagerHelper.getUIManager(getReactApplicationContext(), uiManagerType);
fabricUIManager.synchronouslyUpdateViewOnUIThread(tag, props);
} else {
mUIImplementation.updateView(tag, className, props);
}
}

/**
Expand Down

0 comments on commit d9eae2a

Please sign in to comment.