35
35
import com .facebook .infer .annotation .Nullsafe ;
36
36
import com .facebook .react .bridge .Arguments ;
37
37
import com .facebook .react .bridge .ReactContext ;
38
- import com .facebook .react .bridge .WritableArray ;
39
38
import com .facebook .react .bridge .WritableMap ;
40
39
import com .facebook .react .common .ReactConstants ;
41
40
import com .facebook .react .common .build .ReactBuildConfig ;
57
56
import com .facebook .react .views .text .internal .span .TextInlineImageSpan ;
58
57
import com .facebook .react .views .text .internal .span .TextInlineViewPlaceholderSpan ;
59
58
import com .facebook .yoga .YogaMeasureMode ;
60
- import java .util .ArrayList ;
61
- import java .util .Collections ;
62
- import java .util .Comparator ;
63
59
64
60
@ Nullsafe (Nullsafe .Mode .LOCAL )
65
61
public class ReactTextView extends AppCompatTextView implements ReactCompoundView {
@@ -78,7 +74,6 @@ public class ReactTextView extends AppCompatTextView implements ReactCompoundVie
78
74
private float mMinimumFontSize ;
79
75
private float mLetterSpacing ;
80
76
private int mLinkifyMaskType ;
81
- private boolean mNotifyOnInlineViewLayout ;
82
77
private boolean mTextIsSelectable ;
83
78
private boolean mShouldAdjustSpannableFontSize ;
84
79
private Overflow mOverflow = Overflow .VISIBLE ;
@@ -99,7 +94,6 @@ private void initView() {
99
94
mNumberOfLines = ViewDefaults .NUMBER_OF_LINES ;
100
95
mAdjustsFontSizeToFit = false ;
101
96
mLinkifyMaskType = 0 ;
102
- mNotifyOnInlineViewLayout = false ;
103
97
mTextIsSelectable = false ;
104
98
mShouldAdjustSpannableFontSize = false ;
105
99
mEllipsizeLocation = TextUtils .TruncateAt .END ;
@@ -235,8 +229,6 @@ protected void onLayout(
235
229
236
230
TextInlineViewPlaceholderSpan [] placeholders =
237
231
text .getSpans (0 , text .length (), TextInlineViewPlaceholderSpan .class );
238
- ArrayList inlineViewInfoArray =
239
- mNotifyOnInlineViewLayout ? new ArrayList (placeholders .length ) : null ;
240
232
int textViewWidth = textViewRight - textViewLeft ;
241
233
int textViewHeight = textViewBottom - textViewTop ;
242
234
@@ -264,10 +256,6 @@ protected void onLayout(
264
256
// loop when called on a character that appears after the ellipsis. Avoid this bug by
265
257
// special casing the character truncation case.
266
258
child .setVisibility (View .GONE );
267
- if (mNotifyOnInlineViewLayout ) {
268
- Assertions .assertNotNull (inlineViewInfoArray )
269
- .add (inlineViewJson (View .GONE , start , -1 , -1 , -1 , -1 ));
270
- }
271
259
} else {
272
260
int width = placeholder .getWidth ();
273
261
int height = placeholder .getHeight ();
@@ -341,38 +329,8 @@ protected void onLayout(
341
329
int layoutRight = left + width ;
342
330
int layoutBottom = top + height ;
343
331
344
- // Keep these parameters in sync with what goes into `inlineViewInfoArray`.
345
332
child .setVisibility (layoutVisibility );
346
333
child .layout (layoutLeft , layoutTop , layoutRight , layoutBottom );
347
- if (mNotifyOnInlineViewLayout ) {
348
- Assertions .assertNotNull (inlineViewInfoArray )
349
- .add (
350
- inlineViewJson (
351
- layoutVisibility , start , layoutLeft , layoutTop , layoutRight , layoutBottom ));
352
- }
353
- }
354
- }
355
-
356
- if (mNotifyOnInlineViewLayout ) {
357
- Collections .sort (
358
- inlineViewInfoArray ,
359
- new Comparator () {
360
- @ Override
361
- public int compare (Object o1 , Object o2 ) {
362
- WritableMap m1 = (WritableMap ) o1 ;
363
- WritableMap m2 = (WritableMap ) o2 ;
364
- return m1 .getInt ("index" ) - m2 .getInt ("index" );
365
- }
366
- });
367
- WritableArray inlineViewInfoArray2 = Arguments .createArray ();
368
- for (Object item : Assertions .assertNotNull (inlineViewInfoArray )) {
369
- inlineViewInfoArray2 .pushMap ((WritableMap ) item );
370
- }
371
-
372
- WritableMap event = Arguments .createMap ();
373
- event .putArray ("inlineViews" , inlineViewInfoArray2 );
374
- if (uiManager != null ) {
375
- uiManager .receiveEvent (reactTag , "topInlineViewLayout" , event );
376
334
}
377
335
}
378
336
}
@@ -696,10 +654,6 @@ public void setEllipsizeLocation(@Nullable TextUtils.TruncateAt ellipsizeLocatio
696
654
mEllipsizeLocation = ellipsizeLocation ;
697
655
}
698
656
699
- public void setNotifyOnInlineViewLayout (boolean notifyOnInlineViewLayout ) {
700
- mNotifyOnInlineViewLayout = notifyOnInlineViewLayout ;
701
- }
702
-
703
657
public void updateView () {
704
658
@ Nullable
705
659
TextUtils .TruncateAt ellipsizeLocation =
0 commit comments