Skip to content

Commit 6114f86

Browse files
sherginfacebook-github-bot
authored andcommitted
Restructured inheritance around ReactTextViewManager and co.
Summary: Abstract class `ReactBaseTextShadowNode` was decoupled from `ReactTextShadowNode` to separate two goals/roles: * `ReactBaseTextShadowNode` represents spanned `<Text>` nodes, which can bear text attributes (both `RCTText` and `RCTVirtualText`); * `ReactTextShadowNode` represents anchor `<Text>` view in Yoga terms, which can bear layout attributes (`RCTText` and `RCTTextInput`). `ReactVirtualTextShadowNode` now inherits `ReactBaseTextShadowNode`. The same architectural changes was applited to view managers. Why? * This is just a better architecture which represents the nature of this objects. * Bunch of "negative" logic which turn off excessive features for some suclasses was removed. * Memory efficiency. * Now we can improve `<TextInput>` component using right inheritance. Yay! Reviewed By: achen1 Differential Revision: D5715830 fbshipit-source-id: ecc0764a03b5b7586fe77ad31f149cd840f4da41
1 parent 80027ce commit 6114f86

File tree

9 files changed

+720
-646
lines changed

9 files changed

+720
-646
lines changed

ReactAndroid/src/main/java/com/facebook/react/flat/RCTTextInput.java

+7-9
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,15 @@
99

1010
package com.facebook.react.flat;
1111

12-
import javax.annotation.Nullable;
12+
import static com.facebook.react.views.text.ReactRawTextShadowNode.PROP_TEXT;
13+
import static com.facebook.react.views.text.ReactTextShadowNode.UNSET;
1314

1415
import android.annotation.TargetApi;
1516
import android.os.Build;
1617
import android.text.SpannableStringBuilder;
1718
import android.util.TypedValue;
1819
import android.view.ViewGroup;
1920
import android.widget.EditText;
20-
21-
import com.facebook.yoga.YogaMeasureMode;
22-
import com.facebook.yoga.YogaMeasureFunction;
23-
import com.facebook.yoga.YogaNode;
24-
import com.facebook.yoga.YogaMeasureOutput;
2521
import com.facebook.infer.annotation.Assertions;
2622
import com.facebook.react.uimanager.PixelUtil;
2723
import com.facebook.react.uimanager.Spacing;
@@ -32,9 +28,11 @@
3228
import com.facebook.react.uimanager.annotations.ReactProp;
3329
import com.facebook.react.views.text.ReactTextUpdate;
3430
import com.facebook.react.views.view.MeasureUtil;
35-
36-
import static com.facebook.react.views.text.ReactTextShadowNode.PROP_TEXT;
37-
import static com.facebook.react.views.text.ReactTextShadowNode.UNSET;
31+
import com.facebook.yoga.YogaMeasureFunction;
32+
import com.facebook.yoga.YogaMeasureMode;
33+
import com.facebook.yoga.YogaMeasureOutput;
34+
import com.facebook.yoga.YogaNode;
35+
import javax.annotation.Nullable;
3836

3937
public class RCTTextInput extends RCTVirtualText implements AndroidView, YogaMeasureFunction {
4038

0 commit comments

Comments
 (0)