Fabric: Use state in Paragraph component

Summary:
All props to Eric Lewis! cc ericlewis

This revert of revert of land of changes originally published in #24873 (with some slight fixes). The change removes usage of LocalData from the `<Text>` component.

After this change we only have ---one (maybe two)--- three components left using LocalData.

Reviewed By: mdvacca

Differential Revision: D15962376

fbshipit-source-id: 19f41109ce9d71ce30d618a45eb2b547a11f29a2
This commit is contained in:
Valentin Shergin
2019-07-07 22:46:21 -07:00
committed by Facebook Github Bot
parent 71f0079809
commit 06ce568155
13 changed files with 132 additions and 177 deletions
@@ -15,6 +15,7 @@ import com.facebook.react.common.annotations.VisibleForTesting;
import com.facebook.react.module.annotations.ReactModule;
import com.facebook.react.uimanager.IViewManagerWithChildren;
import com.facebook.react.uimanager.ReactStylesDiffMap;
import com.facebook.react.uimanager.StateWrapper;
import com.facebook.react.uimanager.ThemedReactContext;
import com.facebook.yoga.YogaMeasureMode;
import java.util.Map;
@@ -72,9 +73,9 @@ public class ReactTextViewManager
}
@Override
public Object updateLocalData(
ReactTextView view, ReactStylesDiffMap props, ReactStylesDiffMap localData) {
ReadableMap attributedString = localData.getMap("attributedString");
public Object updateState(
ReactTextView view, ReactStylesDiffMap props, StateWrapper stateWrapper) {
ReadableMap attributedString = stateWrapper.getState().getMap("attributedString");
Spannable spanned =
TextLayoutManager.getOrCreateSpannableForText(view.getContext(), attributedString);