From d5a84b55c30d6c170c1e93d36a07dfc45dee54b9 Mon Sep 17 00:00:00 2001 From: SJLIM Date: Sun, 31 May 2026 02:00:30 +0900 Subject: [PATCH] fix(text): support start and end text alignment --- .../Components/TextInput/TextInput.d.ts | 4 +- .../Components/TextInput/TextInput.flow.js | 4 +- .../Libraries/StyleSheet/StyleSheetTypes.d.ts | 10 ++++- .../Libraries/StyleSheet/StyleSheetTypes.js | 9 ++++- .../react-native/React/Base/RCTConvert.mm | 2 + .../Tests/Text/RCTAttributedTextUtilsTest.mm | 37 +++++++++++++++++++ .../react/views/text/TextAttributeProps.kt | 2 + .../react/views/text/TextLayoutManager.kt | 2 +- .../views/textinput/ReactTextInputManager.kt | 2 + .../views/text/TextAttributePropsTest.kt | 37 +++++++++++++++++++ .../textinput/ReactTextInputPropertyTest.kt | 12 ++++++ .../renderer/attributedstring/conversions.h | 10 ++++- .../renderer/attributedstring/primitives.h | 4 +- .../text/tests/BaseTextShadowNodeTest.cpp | 16 ++++++++ .../RCTAttributedTextUtils.mm | 30 +++++++++++---- .../RCTTextPrimitivesConversions.h | 4 ++ packages/react-native/ReactNativeApi.d.ts | 27 +++++++++----- .../types/__typetests__/index.tsx | 4 ++ .../api-snapshots/ReactAndroidDebugCxx.api | 2 + .../api-snapshots/ReactAndroidNewarchCxx.api | 2 + .../api-snapshots/ReactAndroidReleaseCxx.api | 2 + .../api-snapshots/ReactAppleDebugCxx.api | 2 + .../api-snapshots/ReactAppleNewarchCxx.api | 2 + .../api-snapshots/ReactAppleReleaseCxx.api | 2 + .../api-snapshots/ReactCommonDebugCxx.api | 2 + .../api-snapshots/ReactCommonNewarchCxx.api | 2 + .../api-snapshots/ReactCommonReleaseCxx.api | 2 + 27 files changed, 207 insertions(+), 27 deletions(-) create mode 100644 packages/react-native/ReactAndroid/src/test/java/com/facebook/react/views/text/TextAttributePropsTest.kt diff --git a/packages/react-native/Libraries/Components/TextInput/TextInput.d.ts b/packages/react-native/Libraries/Components/TextInput/TextInput.d.ts index 97535f6cf82..f8da58ee419 100644 --- a/packages/react-native/Libraries/Components/TextInput/TextInput.d.ts +++ b/packages/react-native/Libraries/Components/TextInput/TextInput.d.ts @@ -972,9 +972,9 @@ export interface TextInputProps style?: StyleProp | undefined; /** - * Align the input text to the left, center, or right sides of the input field. + * Align the input text to the left, center, right, start, or end side of the input field. */ - textAlign?: 'left' | 'center' | 'right' | undefined; + textAlign?: 'left' | 'center' | 'right' | 'start' | 'end' | undefined; /** * Used to locate this view in end-to-end tests diff --git a/packages/react-native/Libraries/Components/TextInput/TextInput.flow.js b/packages/react-native/Libraries/Components/TextInput/TextInput.flow.js index d65f8a2cd86..59c1955c417 100644 --- a/packages/react-native/Libraries/Components/TextInput/TextInput.flow.js +++ b/packages/react-native/Libraries/Components/TextInput/TextInput.flow.js @@ -1051,9 +1051,9 @@ type TextInputBaseProps = Readonly<{ value?: ?Stringish, /** - * Align the input text to the left, center, or right sides of the input field. + * Align the input text to the left, center, right, start, or end side of the input field. */ - textAlign?: ?('left' | 'center' | 'right'), + textAlign?: ?('left' | 'center' | 'right' | 'start' | 'end'), }>; /** @build-types emit-as-interface Uniwind compatibility */ diff --git a/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.d.ts b/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.d.ts index a55578a4a90..22b1383cedb 100644 --- a/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.d.ts +++ b/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.d.ts @@ -633,7 +633,15 @@ export interface TextStyle extends TextStyleIOS, TextStyleAndroid, ViewStyle { | undefined; letterSpacing?: number | undefined; lineHeight?: number | undefined; - textAlign?: 'auto' | 'left' | 'right' | 'center' | 'justify' | undefined; + textAlign?: + | 'auto' + | 'left' + | 'right' + | 'center' + | 'justify' + | 'start' + | 'end' + | undefined; textDecorationLine?: | 'none' | 'underline' diff --git a/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js b/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js index dfc047579ff..1e0ca502c12 100644 --- a/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js +++ b/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js @@ -1010,7 +1010,14 @@ type ____TextStyle_InternalBase = Readonly<{ textShadowColor?: ____ColorValue_Internal, letterSpacing?: number, lineHeight?: number, - textAlign?: 'auto' | 'left' | 'right' | 'center' | 'justify', + textAlign?: + | 'auto' + | 'left' + | 'right' + | 'center' + | 'justify' + | 'start' + | 'end', textAlignVertical?: 'auto' | 'top' | 'bottom' | 'center', includeFontPadding?: boolean, textDecorationLine?: diff --git a/packages/react-native/React/Base/RCTConvert.mm b/packages/react-native/React/Base/RCTConvert.mm index 9400163dd81..9b7dd699ce6 100644 --- a/packages/react-native/React/Base/RCTConvert.mm +++ b/packages/react-native/React/Base/RCTConvert.mm @@ -316,6 +316,8 @@ + (NSLocale *)NSLocale:(id)json NSTextAlignment, (@{ @"auto" : @(NSTextAlignmentNatural), + @"start" : @(NSTextAlignmentLeft), + @"end" : @(NSTextAlignmentRight), @"left" : @(NSTextAlignmentLeft), @"center" : @(NSTextAlignmentCenter), @"right" : @(NSTextAlignmentRight), diff --git a/packages/react-native/React/Tests/Text/RCTAttributedTextUtilsTest.mm b/packages/react-native/React/Tests/Text/RCTAttributedTextUtilsTest.mm index 6a6ddb3be62..6db07643956 100644 --- a/packages/react-native/React/Tests/Text/RCTAttributedTextUtilsTest.mm +++ b/packages/react-native/React/Tests/Text/RCTAttributedTextUtilsTest.mm @@ -10,6 +10,9 @@ #import +#include +#include + using namespace facebook::react; @interface RCTAttributedTextUtilsTest : XCTestCase @@ -18,6 +21,40 @@ @interface RCTAttributedTextUtilsTest : XCTestCase @implementation RCTAttributedTextUtilsTest +static NSTextAlignment NSTextAlignmentFromTextAlign( + NSString *textAlign, + LayoutDirection layoutDirection) +{ + ContextContainer contextContainer{}; + PropsParserContext parserContext{-1, contextContainer}; + TextAlignment textAlignment = TextAlignment::Natural; + fromRawValue(parserContext, RawValue{folly::dynamic{textAlign.UTF8String}}, textAlignment); + + TextAttributes textAttributes; + textAttributes.alignment = textAlignment; + textAttributes.layoutDirection = layoutDirection; + + NSDictionary *attributes = RCTNSTextAttributesFromTextAttributes(textAttributes); + NSParagraphStyle *paragraphStyle = attributes[NSParagraphStyleAttributeName]; + return paragraphStyle.alignment; +} + +- (void)testTextAlignmentStartAndEndResolveWithLayoutDirection +{ + XCTAssertEqual( + NSTextAlignmentFromTextAlign(@"start", LayoutDirection::LeftToRight), + NSTextAlignmentLeft); + XCTAssertEqual( + NSTextAlignmentFromTextAlign(@"start", LayoutDirection::RightToLeft), + NSTextAlignmentRight); + XCTAssertEqual( + NSTextAlignmentFromTextAlign(@"end", LayoutDirection::LeftToRight), + NSTextAlignmentRight); + XCTAssertEqual( + NSTextAlignmentFromTextAlign(@"end", LayoutDirection::RightToLeft), + NSTextAlignmentLeft); +} + - (void)testSamenessOfEmptyAttributedStrings { NSAttributedString *attributedString1 = [[NSAttributedString alloc] initWithString:@""]; diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.kt index 7ebe3263307..d09559fa08c 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.kt @@ -527,6 +527,8 @@ public class TextAttributeProps private constructor() { "justify" -> Gravity.LEFT null, "auto" -> Gravity.NO_GRAVITY + "start" -> if (isRTL) Gravity.RIGHT else Gravity.LEFT + "end" -> if (isRTL) Gravity.LEFT else Gravity.RIGHT "left" -> if (isRTL) Gravity.RIGHT else Gravity.LEFT "right" -> if (isRTL) Gravity.LEFT else Gravity.RIGHT "center" -> Gravity.CENTER_HORIZONTAL diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.kt index 4a900ffcf71..bad515126ba 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.kt @@ -210,7 +210,7 @@ internal object TextLayoutManager { if (alignmentAttr == "center") { alignment = Layout.Alignment.ALIGN_CENTER - } else if (alignmentAttr == "right") { + } else if (alignmentAttr == "right" || alignmentAttr == "end") { alignment = if (swapNormalAndOpposite) Layout.Alignment.ALIGN_NORMAL else Layout.Alignment.ALIGN_OPPOSITE diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.kt index 9e40dbe5e69..d08046548a5 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.kt @@ -557,6 +557,8 @@ public open class ReactTextInputManager public constructor() : when (textAlign) { null, "auto" -> view.gravityHorizontal = Gravity.NO_GRAVITY + "start" -> view.gravityHorizontal = Gravity.START + "end" -> view.gravityHorizontal = Gravity.END "left" -> view.gravityHorizontal = Gravity.LEFT "right" -> view.gravityHorizontal = Gravity.RIGHT "center" -> view.gravityHorizontal = Gravity.CENTER_HORIZONTAL diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/views/text/TextAttributePropsTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/views/text/TextAttributePropsTest.kt new file mode 100644 index 00000000000..0b63ff69a2a --- /dev/null +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/views/text/TextAttributePropsTest.kt @@ -0,0 +1,37 @@ +/* + * 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.view.Gravity +import com.facebook.react.bridge.JavaOnlyMap +import com.facebook.react.uimanager.ReactStylesDiffMap +import org.assertj.core.api.Assertions.assertThat +import org.junit.Test + +class TextAttributePropsTest { + + @Test + fun textAlignStartUsesStartSide() { + assertThat(textAlignment("start", isRTL = false)).isEqualTo(Gravity.LEFT) + assertThat(textAlignment("start", isRTL = true)).isEqualTo(Gravity.RIGHT) + } + + @Test + fun textAlignEndUsesEndSide() { + assertThat(textAlignment("end", isRTL = false)).isEqualTo(Gravity.RIGHT) + assertThat(textAlignment("end", isRTL = true)).isEqualTo(Gravity.LEFT) + } + + private fun textAlignment(textAlign: String, isRTL: Boolean): Int { + return TextAttributeProps.getTextAlignment( + ReactStylesDiffMap(JavaOnlyMap.of("textAlign", textAlign)), + isRTL, + Gravity.CENTER_HORIZONTAL, + ) + } +} diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/views/textinput/ReactTextInputPropertyTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/views/textinput/ReactTextInputPropertyTest.kt index 2aabc6ed3a9..5d5009ea0be 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/views/textinput/ReactTextInputPropertyTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/views/textinput/ReactTextInputPropertyTest.kt @@ -438,6 +438,18 @@ class ReactTextInputPropertyTest { assertThat(view.gravity and Gravity.HORIZONTAL_GRAVITY_MASK) .isEqualTo(Gravity.CENTER_HORIZONTAL) + manager.updateProperties(view, buildStyles("textAlign", "start")) + assertThat( + view.gravity and + (Gravity.HORIZONTAL_GRAVITY_MASK or Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK)) + .isEqualTo(Gravity.START) + + manager.updateProperties(view, buildStyles("textAlign", "end")) + assertThat( + view.gravity and + (Gravity.HORIZONTAL_GRAVITY_MASK or Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK)) + .isEqualTo(Gravity.END) + manager.updateProperties(view, buildStyles("textAlign", null)) assertThat(view.gravity and Gravity.HORIZONTAL_GRAVITY_MASK).isEqualTo(defaultHorizontalGravity) diff --git a/packages/react-native/ReactCommon/react/renderer/attributedstring/conversions.h b/packages/react-native/ReactCommon/react/renderer/attributedstring/conversions.h index b8e8f79d9b8..235e966ae13 100644 --- a/packages/react-native/ReactCommon/react/renderer/attributedstring/conversions.h +++ b/packages/react-native/ReactCommon/react/renderer/attributedstring/conversions.h @@ -629,8 +629,12 @@ inline void fromRawValue(const PropsParserContext &context, const RawValue &valu react_native_expect(value.hasType()); if (value.hasType()) { auto string = (std::string)value; - if (string == "auto" || string == "start") { + if (string == "auto") { result = TextAlignment::Natural; + } else if (string == "start") { + result = TextAlignment::Start; + } else if (string == "end") { + result = TextAlignment::End; } else if (string == "left") { result = TextAlignment::Left; } else if (string == "center") { @@ -665,6 +669,10 @@ inline std::string toString(const TextAlignment &textAlignment) return "right"; case TextAlignment::Justified: return "justified"; + case TextAlignment::Start: + return "start"; + case TextAlignment::End: + return "end"; } LOG(ERROR) << "Unsupported TextAlignment value"; diff --git a/packages/react-native/ReactCommon/react/renderer/attributedstring/primitives.h b/packages/react-native/ReactCommon/react/renderer/attributedstring/primitives.h index 459bbcf632c..37ad9265edc 100644 --- a/packages/react-native/ReactCommon/react/renderer/attributedstring/primitives.h +++ b/packages/react-native/ReactCommon/react/renderer/attributedstring/primitives.h @@ -97,7 +97,9 @@ enum class TextAlignment { Left, // Visually left aligned. Center, // Visually centered. Right, // Visually right aligned. - Justified // Fully-justified. The last line in a paragraph is natural-aligned. + Justified, // Fully-justified. The last line in a paragraph is natural-aligned. + Start, // Aligned to the start side of the paragraph direction. + End // Aligned to the end side of the paragraph direction. }; enum class TextAlignmentVertical { diff --git a/packages/react-native/ReactCommon/react/renderer/components/text/tests/BaseTextShadowNodeTest.cpp b/packages/react-native/ReactCommon/react/renderer/components/text/tests/BaseTextShadowNodeTest.cpp index 5ac6bc433d9..ff39802b356 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/text/tests/BaseTextShadowNodeTest.cpp +++ b/packages/react-native/ReactCommon/react/renderer/components/text/tests/BaseTextShadowNodeTest.cpp @@ -9,6 +9,8 @@ #include #include +#include +#include #include #include @@ -22,8 +24,22 @@ Element rawTextElement(const char* text) { return Element().props(rawTextProps); } +std::string roundTripTextAlignment(const char* textAlignment) { + ContextContainer contextContainer{}; + PropsParserContext parserContext{-1, contextContainer}; + TextAlignment result = TextAlignment::Natural; + fromRawValue( + parserContext, RawValue{folly::dynamic{textAlignment}}, result); + return toString(result); +} + } // namespace +TEST(BaseTextShadowNodeTest, textAlignmentStartAndEndRoundTrip) { + EXPECT_EQ(roundTripTextAlignment("start"), "start"); + EXPECT_EQ(roundTripTextAlignment("end"), "end"); +} + TEST(BaseTextShadowNodeTest, fragmentsWithDifferentAttributes) { ContextContainer contextContainer{}; PropsParserContext parserContext{-1, contextContainer}; diff --git a/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm b/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm index f96a0494000..6c7f56ba69e 100644 --- a/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm +++ b/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm @@ -18,6 +18,25 @@ using namespace facebook::react; +inline static TextAlignment RCTResolveTextAlignment( + TextAlignment textAlignment, + LayoutDirection layoutDirection) +{ + const bool isRTL = layoutDirection == LayoutDirection::RightToLeft; + switch (textAlignment) { + case TextAlignment::Start: + return isRTL ? TextAlignment::Right : TextAlignment::Left; + case TextAlignment::End: + return isRTL ? TextAlignment::Left : TextAlignment::Right; + case TextAlignment::Right: + return isRTL ? TextAlignment::Left : TextAlignment::Right; + case TextAlignment::Left: + return isRTL ? TextAlignment::Right : TextAlignment::Left; + default: + return textAlignment; + } +} + inline static UIFontWeight RCTUIFontWeightFromInteger(NSInteger fontWeight) { assert(fontWeight > 50); @@ -196,14 +215,9 @@ inline static CGFloat RCTEffectiveFontSizeMultiplierFromTextAttributes(const Tex NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new]; BOOL isParagraphStyleUsed = NO; if (textAttributes.alignment.has_value()) { - TextAlignment textAlignment = textAttributes.alignment.value_or(TextAlignment::Natural); - if (textAttributes.layoutDirection.value_or(LayoutDirection::LeftToRight) == LayoutDirection::RightToLeft) { - if (textAlignment == TextAlignment::Right) { - textAlignment = TextAlignment::Left; - } else if (textAlignment == TextAlignment::Left) { - textAlignment = TextAlignment::Right; - } - } + TextAlignment textAlignment = RCTResolveTextAlignment( + textAttributes.alignment.value_or(TextAlignment::Natural), + textAttributes.layoutDirection.value_or(LayoutDirection::LeftToRight)); paragraphStyle.alignment = RCTNSTextAlignmentFromTextAlignment(textAlignment); isParagraphStyleUsed = YES; diff --git a/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextPrimitivesConversions.h b/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextPrimitivesConversions.h index 0ec5e4c5c77..e2609f6fa5e 100644 --- a/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextPrimitivesConversions.h +++ b/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextPrimitivesConversions.h @@ -24,6 +24,10 @@ inline static NSTextAlignment RCTNSTextAlignmentFromTextAlignment(facebook::reac return NSTextAlignmentCenter; case facebook::react::TextAlignment::Justified: return NSTextAlignmentJustified; + case facebook::react::TextAlignment::Start: + return NSTextAlignmentNatural; + case facebook::react::TextAlignment::End: + return NSTextAlignmentRight; } } diff --git a/packages/react-native/ReactNativeApi.d.ts b/packages/react-native/ReactNativeApi.d.ts index 48505ca1b82..3f1b0c0f201 100644 --- a/packages/react-native/ReactNativeApi.d.ts +++ b/packages/react-native/ReactNativeApi.d.ts @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<<41a1a826b9b5c267d47fdb9c109c1bbe>> * * This file was generated by scripts/js-api/build-types/index.js. */ @@ -805,7 +805,14 @@ declare type ____TextStyle_InternalBase = { readonly includeFontPadding?: boolean readonly letterSpacing?: number readonly lineHeight?: number - readonly textAlign?: "auto" | "center" | "justify" | "left" | "right" + readonly textAlign?: + | "auto" + | "center" + | "end" + | "justify" + | "left" + | "right" + | "start" readonly textAlignVertical?: "auto" | "bottom" | "center" | "top" readonly textDecorationColor?: ____ColorValue_Internal readonly textDecorationLine?: @@ -5124,7 +5131,7 @@ declare type TextInputBaseProps = { readonly selectTextOnFocus?: boolean readonly style?: TextStyleProp readonly submitBehavior?: SubmitBehavior - readonly textAlign?: "center" | "left" | "right" + readonly textAlign?: "center" | "end" | "left" | "right" | "start" readonly value?: string } declare type TextInputBlurEvent = BlurEvent @@ -5859,7 +5866,7 @@ export { AlertOptions, // a0cdac0f AlertType, // 5ab91217 AndroidKeyboardEvent, // e03becc8 - Animated, // b23fe360 + Animated, // 7575db53 AppConfig, // 35c0ca70 AppRegistry, // ce465c83 AppState, // 12012be5 @@ -6077,7 +6084,7 @@ export { StatusBarProps, // b72a9127 StatusBarStyle, // 78f53eea StyleProp, // fa0e9b4a - StyleSheet, // fc631571 + StyleSheet, // e356641c SubmitBehavior, // c4ddf490 Switch, // 135ac108 SwitchChangeEvent, // 899635b1 @@ -6087,9 +6094,9 @@ export { TVViewPropsIOS, // 330ce7b5 TargetedEvent, // 16e98910 TaskProvider, // 266dedf2 - Text, // 2cf03c50 + Text, // 35b608a2 TextContentType, // 239b3ecc - TextInput, // 772bbb29 + TextInput, // aeae26e6 TextInputAndroidProps, // 3f09ce49 TextInputChangeEvent, // f55eef98 TextInputContentSizeChangeEvent, // a27cd32a @@ -6098,13 +6105,13 @@ export { TextInputIOSProps, // 0d05a855 TextInputInstance, // 5a0c0e0d TextInputKeyPressEvent, // 546c5d07 - TextInputProps, // cf23de8e + TextInputProps, // 178fe9d9 TextInputSelectionChangeEvent, // e58f2abc TextInputSubmitEditingEvent, // 6bcb2aa5 TextInstance, // 05463a96 TextLayoutEvent, // 3f54186f - TextProps, // 5d931082 - TextStyle, // fe84eb23 + TextProps, // 8c99d886 + TextStyle, // 34238f34 ToastAndroid, // 88a8969a Touchable, // b280637f TouchableHighlight, // 7e5ec9c5 diff --git a/packages/react-native/types/__typetests__/index.tsx b/packages/react-native/types/__typetests__/index.tsx index 7f372d745c1..cf51b4c8f77 100644 --- a/packages/react-native/types/__typetests__/index.tsx +++ b/packages/react-native/types/__typetests__/index.tsx @@ -232,6 +232,10 @@ const viewStyle: StyleProp = { }; const textStyle: StyleProp = { fontSize: 20, + textAlign: 'start', +}; +const endAlignedTextStyle: StyleProp = { + textAlign: 'end', }; const imageStyle: StyleProp = { resizeMode: 'contain', diff --git a/scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api b/scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api index cfe0cb56238..abb4d9679ad 100644 --- a/scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api @@ -6543,10 +6543,12 @@ enum facebook::react::SubmitBehavior { enum facebook::react::TextAlignment { Center, + End, Justified, Left, Natural, Right, + Start, } enum facebook::react::TextAlignmentVertical { diff --git a/scripts/cxx-api/api-snapshots/ReactAndroidNewarchCxx.api b/scripts/cxx-api/api-snapshots/ReactAndroidNewarchCxx.api index 3432343ed07..de314cb86e8 100644 --- a/scripts/cxx-api/api-snapshots/ReactAndroidNewarchCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAndroidNewarchCxx.api @@ -6369,10 +6369,12 @@ enum facebook::react::SubmitBehavior { enum facebook::react::TextAlignment { Center, + End, Justified, Left, Natural, Right, + Start, } enum facebook::react::TextAlignmentVertical { diff --git a/scripts/cxx-api/api-snapshots/ReactAndroidReleaseCxx.api b/scripts/cxx-api/api-snapshots/ReactAndroidReleaseCxx.api index d46afaf86d4..f4c19575eb2 100644 --- a/scripts/cxx-api/api-snapshots/ReactAndroidReleaseCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAndroidReleaseCxx.api @@ -6534,10 +6534,12 @@ enum facebook::react::SubmitBehavior { enum facebook::react::TextAlignment { Center, + End, Justified, Left, Natural, Right, + Start, } enum facebook::react::TextAlignmentVertical { diff --git a/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api index 34fb35faf45..0df1b7771d4 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api @@ -8726,10 +8726,12 @@ enum facebook::react::SubmitBehavior { enum facebook::react::TextAlignment { Center, + End, Justified, Left, Natural, Right, + Start, } enum facebook::react::TextAlignmentVertical { diff --git a/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api index 7f341310bcb..1ab227a4ff7 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api @@ -8580,10 +8580,12 @@ enum facebook::react::SubmitBehavior { enum facebook::react::TextAlignment { Center, + End, Justified, Left, Natural, Right, + Start, } enum facebook::react::TextAlignmentVertical { diff --git a/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api index b20a27166d5..77e4e762614 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api @@ -8717,10 +8717,12 @@ enum facebook::react::SubmitBehavior { enum facebook::react::TextAlignment { Center, + End, Justified, Left, Natural, Right, + Start, } enum facebook::react::TextAlignmentVertical { diff --git a/scripts/cxx-api/api-snapshots/ReactCommonDebugCxx.api b/scripts/cxx-api/api-snapshots/ReactCommonDebugCxx.api index c3586f5df4c..c96c79da935 100644 --- a/scripts/cxx-api/api-snapshots/ReactCommonDebugCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactCommonDebugCxx.api @@ -4879,10 +4879,12 @@ enum facebook::react::SubmitBehavior { enum facebook::react::TextAlignment { Center, + End, Justified, Left, Natural, Right, + Start, } enum facebook::react::TextAlignmentVertical { diff --git a/scripts/cxx-api/api-snapshots/ReactCommonNewarchCxx.api b/scripts/cxx-api/api-snapshots/ReactCommonNewarchCxx.api index 70992106bd8..1c67902ca8a 100644 --- a/scripts/cxx-api/api-snapshots/ReactCommonNewarchCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactCommonNewarchCxx.api @@ -4745,10 +4745,12 @@ enum facebook::react::SubmitBehavior { enum facebook::react::TextAlignment { Center, + End, Justified, Left, Natural, Right, + Start, } enum facebook::react::TextAlignmentVertical { diff --git a/scripts/cxx-api/api-snapshots/ReactCommonReleaseCxx.api b/scripts/cxx-api/api-snapshots/ReactCommonReleaseCxx.api index 18bb4baca12..0c10050e16e 100644 --- a/scripts/cxx-api/api-snapshots/ReactCommonReleaseCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactCommonReleaseCxx.api @@ -4870,10 +4870,12 @@ enum facebook::react::SubmitBehavior { enum facebook::react::TextAlignment { Center, + End, Justified, Left, Natural, Right, + Start, } enum facebook::react::TextAlignmentVertical {