mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Migrate com.facebook.react.views.text.ReactTextUpdate to Kotlin (#47553)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/47553 As per title. Changelog: [Internal] Reviewed By: javache Differential Revision: D65598615 fbshipit-source-id: c4f0e137e3ff350b263f5ce11dd61b78a5be9894
This commit is contained in:
committed by
Facebook GitHub Bot
parent
594c9d9a46
commit
a78a5af657
@@ -7329,21 +7329,27 @@ public class com/facebook/react/views/text/ReactTextShadowNode : com/facebook/re
|
||||
public fun setShouldNotifyOnTextLayout (Z)V
|
||||
}
|
||||
|
||||
public class com/facebook/react/views/text/ReactTextUpdate {
|
||||
public final class com/facebook/react/views/text/ReactTextUpdate {
|
||||
public static final field Companion Lcom/facebook/react/views/text/ReactTextUpdate$Companion;
|
||||
public fun <init> (Landroid/text/Spannable;IZFFFFI)V
|
||||
public fun <init> (Landroid/text/Spannable;IZFFFFIII)V
|
||||
public fun <init> (Landroid/text/Spannable;IZIII)V
|
||||
public static fun buildReactTextUpdateFromState (Landroid/text/Spannable;IIII)Lcom/facebook/react/views/text/ReactTextUpdate;
|
||||
public fun containsImages ()Z
|
||||
public fun getJsEventCounter ()I
|
||||
public fun getJustificationMode ()I
|
||||
public fun getPaddingBottom ()F
|
||||
public fun getPaddingLeft ()F
|
||||
public fun getPaddingRight ()F
|
||||
public fun getPaddingTop ()F
|
||||
public fun getText ()Landroid/text/Spannable;
|
||||
public fun getTextAlign ()I
|
||||
public fun getTextBreakStrategy ()I
|
||||
public static final fun buildReactTextUpdateFromState (Landroid/text/Spannable;IIII)Lcom/facebook/react/views/text/ReactTextUpdate;
|
||||
public final fun containsImages ()Z
|
||||
public final fun getContainsImages ()Z
|
||||
public final fun getJsEventCounter ()I
|
||||
public final fun getJustificationMode ()I
|
||||
public final fun getPaddingBottom ()F
|
||||
public final fun getPaddingLeft ()F
|
||||
public final fun getPaddingRight ()F
|
||||
public final fun getPaddingTop ()F
|
||||
public final fun getText ()Landroid/text/Spannable;
|
||||
public final fun getTextAlign ()I
|
||||
public final fun getTextBreakStrategy ()I
|
||||
}
|
||||
|
||||
public final class com/facebook/react/views/text/ReactTextUpdate$Companion {
|
||||
public final fun buildReactTextUpdateFromState (Landroid/text/Spannable;IIII)Lcom/facebook/react/views/text/ReactTextUpdate;
|
||||
}
|
||||
|
||||
public class com/facebook/react/views/text/ReactTextView : androidx/appcompat/widget/AppCompatTextView, com/facebook/react/uimanager/ReactCompoundView {
|
||||
|
||||
-153
@@ -1,153 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react.views.text;
|
||||
|
||||
import android.text.Layout;
|
||||
import android.text.Spannable;
|
||||
import com.facebook.react.common.ReactConstants;
|
||||
|
||||
/**
|
||||
* Class that contains the data needed for a text update. Used by both <Text/> and <TextInput/>
|
||||
* VisibleForTesting from {@link TextInputEventsTestCase}.
|
||||
*/
|
||||
public class ReactTextUpdate {
|
||||
|
||||
private final Spannable mText;
|
||||
private final int mJsEventCounter;
|
||||
private final boolean mContainsImages;
|
||||
private final float mPaddingLeft;
|
||||
private final float mPaddingTop;
|
||||
private final float mPaddingRight;
|
||||
private final float mPaddingBottom;
|
||||
private final int mTextAlign;
|
||||
private final int mTextBreakStrategy;
|
||||
private final int mJustificationMode;
|
||||
|
||||
/**
|
||||
* @deprecated Use a non-deprecated constructor for ReactTextUpdate instead. This one remains
|
||||
* because it's being used by a unit test that isn't currently open source.
|
||||
*/
|
||||
@Deprecated
|
||||
public ReactTextUpdate(
|
||||
Spannable text,
|
||||
int jsEventCounter,
|
||||
boolean containsImages,
|
||||
float paddingStart,
|
||||
float paddingTop,
|
||||
float paddingEnd,
|
||||
float paddingBottom,
|
||||
int textAlign) {
|
||||
this(
|
||||
text,
|
||||
jsEventCounter,
|
||||
containsImages,
|
||||
paddingStart,
|
||||
paddingTop,
|
||||
paddingEnd,
|
||||
paddingBottom,
|
||||
textAlign,
|
||||
Layout.BREAK_STRATEGY_HIGH_QUALITY,
|
||||
Layout.JUSTIFICATION_MODE_NONE);
|
||||
}
|
||||
|
||||
public ReactTextUpdate(
|
||||
Spannable text,
|
||||
int jsEventCounter,
|
||||
boolean containsImages,
|
||||
int textAlign,
|
||||
int textBreakStrategy,
|
||||
int justificationMode) {
|
||||
this(
|
||||
text,
|
||||
jsEventCounter,
|
||||
containsImages,
|
||||
ReactConstants.UNSET,
|
||||
ReactConstants.UNSET,
|
||||
ReactConstants.UNSET,
|
||||
ReactConstants.UNSET,
|
||||
textAlign,
|
||||
textBreakStrategy,
|
||||
justificationMode);
|
||||
}
|
||||
|
||||
public ReactTextUpdate(
|
||||
Spannable text,
|
||||
int jsEventCounter,
|
||||
boolean containsImages,
|
||||
float paddingStart,
|
||||
float paddingTop,
|
||||
float paddingEnd,
|
||||
float paddingBottom,
|
||||
int textAlign,
|
||||
int textBreakStrategy,
|
||||
int justificationMode) {
|
||||
mText = text;
|
||||
mJsEventCounter = jsEventCounter;
|
||||
mContainsImages = containsImages;
|
||||
mPaddingLeft = paddingStart;
|
||||
mPaddingTop = paddingTop;
|
||||
mPaddingRight = paddingEnd;
|
||||
mPaddingBottom = paddingBottom;
|
||||
mTextAlign = textAlign;
|
||||
mTextBreakStrategy = textBreakStrategy;
|
||||
mJustificationMode = justificationMode;
|
||||
}
|
||||
|
||||
public static ReactTextUpdate buildReactTextUpdateFromState(
|
||||
Spannable text,
|
||||
int jsEventCounter,
|
||||
int textAlign,
|
||||
int textBreakStrategy,
|
||||
int justificationMode) {
|
||||
|
||||
ReactTextUpdate reactTextUpdate =
|
||||
new ReactTextUpdate(
|
||||
text, jsEventCounter, false, textAlign, textBreakStrategy, justificationMode);
|
||||
return reactTextUpdate;
|
||||
}
|
||||
|
||||
public Spannable getText() {
|
||||
return mText;
|
||||
}
|
||||
|
||||
public int getJsEventCounter() {
|
||||
return mJsEventCounter;
|
||||
}
|
||||
|
||||
public boolean containsImages() {
|
||||
return mContainsImages;
|
||||
}
|
||||
|
||||
public float getPaddingLeft() {
|
||||
return mPaddingLeft;
|
||||
}
|
||||
|
||||
public float getPaddingTop() {
|
||||
return mPaddingTop;
|
||||
}
|
||||
|
||||
public float getPaddingRight() {
|
||||
return mPaddingRight;
|
||||
}
|
||||
|
||||
public float getPaddingBottom() {
|
||||
return mPaddingBottom;
|
||||
}
|
||||
|
||||
public int getTextAlign() {
|
||||
return mTextAlign;
|
||||
}
|
||||
|
||||
public int getTextBreakStrategy() {
|
||||
return mTextBreakStrategy;
|
||||
}
|
||||
|
||||
public int getJustificationMode() {
|
||||
return mJustificationMode;
|
||||
}
|
||||
}
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react.views.text
|
||||
|
||||
import android.text.Layout
|
||||
import android.text.Spannable
|
||||
import com.facebook.react.common.ReactConstants
|
||||
|
||||
/**
|
||||
* Class that contains the data needed for a text update. Used by both <Text/> and <TextInput/>
|
||||
* VisibleForTesting from [TextInputEventsTestCase].
|
||||
*/
|
||||
public class ReactTextUpdate(
|
||||
public val text: Spannable,
|
||||
public val jsEventCounter: Int,
|
||||
public val containsImages: Boolean,
|
||||
public val paddingLeft: Float,
|
||||
public val paddingTop: Float,
|
||||
public val paddingRight: Float,
|
||||
public val paddingBottom: Float,
|
||||
public val textAlign: Int,
|
||||
public val textBreakStrategy: Int,
|
||||
public val justificationMode: Int
|
||||
) {
|
||||
|
||||
/**
|
||||
* @deprecated Use a non-deprecated constructor for ReactTextUpdate instead. This one remains
|
||||
* because it's being used by a unit test that isn't currently open source.
|
||||
*/
|
||||
public constructor(
|
||||
text: Spannable,
|
||||
jsEventCounter: Int,
|
||||
containsImages: Boolean,
|
||||
paddingStart: Float,
|
||||
paddingTop: Float,
|
||||
paddingEnd: Float,
|
||||
paddingBottom: Float,
|
||||
textAlign: Int
|
||||
) : this(
|
||||
text,
|
||||
jsEventCounter,
|
||||
containsImages,
|
||||
paddingStart,
|
||||
paddingTop,
|
||||
paddingEnd,
|
||||
paddingBottom,
|
||||
textAlign,
|
||||
Layout.BREAK_STRATEGY_HIGH_QUALITY,
|
||||
Layout.JUSTIFICATION_MODE_NONE)
|
||||
|
||||
public constructor(
|
||||
text: Spannable,
|
||||
jsEventCounter: Int,
|
||||
containsImages: Boolean,
|
||||
textAlign: Int,
|
||||
textBreakStrategy: Int,
|
||||
justificationMode: Int
|
||||
) : this(
|
||||
text,
|
||||
jsEventCounter,
|
||||
containsImages,
|
||||
ReactConstants.UNSET.toFloat(),
|
||||
ReactConstants.UNSET.toFloat(),
|
||||
ReactConstants.UNSET.toFloat(),
|
||||
ReactConstants.UNSET.toFloat(),
|
||||
textAlign,
|
||||
textBreakStrategy,
|
||||
justificationMode)
|
||||
|
||||
@Deprecated(
|
||||
"This is just for backwards compatibility and will be removed some time in the future",
|
||||
ReplaceWith("containsImages"))
|
||||
public fun containsImages(): Boolean = containsImages
|
||||
|
||||
public companion object {
|
||||
@JvmStatic
|
||||
public fun buildReactTextUpdateFromState(
|
||||
text: Spannable,
|
||||
jsEventCounter: Int,
|
||||
textAlign: Int,
|
||||
textBreakStrategy: Int,
|
||||
justificationMode: Int
|
||||
): ReactTextUpdate =
|
||||
ReactTextUpdate(
|
||||
text, jsEventCounter, false, textAlign, textBreakStrategy, justificationMode)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user