Skip to content

Commit

Permalink
TextInput: don't call Paper UIManager setViewLocalData in Fabric
Browse files Browse the repository at this point in the history
Summary:
In Paper this call causes Yoga to remeasure the tree. We don't need to do this in Fabric, and all the data contained in `ReactTextInputLocalData` is already set on the underlying EditText View.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D18870491

fbshipit-source-id: a982a708b810d45f70ad4981a963bb4ae798c83c
  • Loading branch information
JoshuaGross authored and facebook-github-bot committed Dec 7, 2019
1 parent 7cfabf4 commit 2ee1171
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -593,11 +593,19 @@ private void onContentSizeChange() {
setIntrinsicContentSize();
}

// TODO T58784068: delete this method
private void setIntrinsicContentSize() {
ReactContext reactContext = (ReactContext) getContext();
UIManagerModule uiManager = reactContext.getNativeModule(UIManagerModule.class);
final ReactTextInputLocalData localData = new ReactTextInputLocalData(this);
uiManager.setViewLocalData(getId(), localData);
// This serves as a check for whether we're running under Paper or Fabric.
// By the time this is called, in Fabric we will have a state
// wrapper 100% of the time.
// Since the LocalData object is constructed by getting values from the underlying EditText
// view, we don't need to construct one or apply it at all - it provides no use in Fabric.
if (mStateWrapper == null) {
ReactContext reactContext = (ReactContext) getContext();
final ReactTextInputLocalData localData = new ReactTextInputLocalData(this);
UIManagerModule uiManager = reactContext.getNativeModule(UIManagerModule.class);
uiManager.setViewLocalData(getId(), localData);
}
}

/* package */ void setGravityHorizontal(int gravityHorizontal) {
Expand Down

0 comments on commit 2ee1171

Please sign in to comment.