Skip to content

Commit f03f09f

Browse files
authored
Add fixTextInlineViewLineHeight feature flag (#59420)
Summary: Add a feature flag for supporting inline views in Text when line height is set. Changelog: [Internal] Reviewed By: Abbondanzo Differential Revision: D126795867 Pull Request resolved: #59420
1 parent 3846064 commit f03f09f

22 files changed

Lines changed: 181 additions & 58 deletions

‎packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<6b457b1b41a17fa2065720edc82939e3>>
7+
* @generated SignedSource<<61e45cda49df36384f8e5a8bfb4383bd>>
88
*/
99

1010
/**
@@ -402,6 +402,12 @@ public object ReactNativeFeatureFlags {
402402
@JvmStatic
403403
public fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean = accessor.fixMappingOfEventPrioritiesBetweenFabricAndReact()
404404

405+
/**
406+
* Grows lines of text with `lineHeight` to fit taller inline views instead of letting them overflow, keeps lines after an inline view at `lineHeight` on Android, and aligns inline views with the text baseline on iOS.
407+
*/
408+
@JvmStatic
409+
public fun fixTextInlineViewLineHeight(): Boolean = accessor.fixTextInlineViewLineHeight()
410+
405411
/**
406412
* Re-measures text and re-sends padding and overflow insets to mounted views when the pixel density changes, so text and padded views do not keep sizes from the old density.
407413
*/

‎packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<0fdae97a0b469d01bad69d0d05c79121>>
7+
* @generated SignedSource<<bebf813dbbb44aa0a3c5ef7390d728e7>>
88
*/
99

1010
/**
@@ -82,6 +82,7 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
8282
private var enableVirtualViewContainerStateExperimentalCache: Boolean? = null
8383
private var fixBorderlessRippleAndroidCache: Boolean? = null
8484
private var fixMappingOfEventPrioritiesBetweenFabricAndReactCache: Boolean? = null
85+
private var fixTextInlineViewLineHeightCache: Boolean? = null
8586
private var fixTextLayoutOnPixelDensityChangeCache: Boolean? = null
8687
private var fixYogaFlexBasisFitContentInMainAxisCache: Boolean? = null
8788
private var fuseboxAssertSingleHostStateCache: Boolean? = null
@@ -677,6 +678,15 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
677678
return cached
678679
}
679680

681+
override fun fixTextInlineViewLineHeight(): Boolean {
682+
var cached = fixTextInlineViewLineHeightCache
683+
if (cached == null) {
684+
cached = ReactNativeFeatureFlagsCxxInterop.fixTextInlineViewLineHeight()
685+
fixTextInlineViewLineHeightCache = cached
686+
}
687+
return cached
688+
}
689+
680690
override fun fixTextLayoutOnPixelDensityChange(): Boolean {
681691
var cached = fixTextLayoutOnPixelDensityChangeCache
682692
if (cached == null) {

‎packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<e7d0d9416b8e1fa2a9f6246050cc06b0>>
7+
* @generated SignedSource<<344b249380585d494460c5e17e73e06f>>
88
*/
99

1010
/**
@@ -152,6 +152,8 @@ public object ReactNativeFeatureFlagsCxxInterop {
152152

153153
@DoNotStrip @JvmStatic public external fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean
154154

155+
@DoNotStrip @JvmStatic public external fun fixTextInlineViewLineHeight(): Boolean
156+
155157
@DoNotStrip @JvmStatic public external fun fixTextLayoutOnPixelDensityChange(): Boolean
156158

157159
@DoNotStrip @JvmStatic public external fun fixYogaFlexBasisFitContentInMainAxis(): Boolean

‎packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<e844f0dd0aa8fd1d9d2d12344c9f977a>>
7+
* @generated SignedSource<<8d78035933e7e32cceb8968564726198>>
88
*/
99

1010
/**
@@ -147,6 +147,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
147147

148148
override fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean = false
149149

150+
override fun fixTextInlineViewLineHeight(): Boolean = false
151+
150152
override fun fixTextLayoutOnPixelDensityChange(): Boolean = false
151153

152154
override fun fixYogaFlexBasisFitContentInMainAxis(): Boolean = false

‎packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<17a4a2a29b0480e06ed3e8ed71fd908f>>
7+
* @generated SignedSource<<fe195f00b14e21b85f26c043014c1b01>>
88
*/
99

1010
/**
@@ -86,6 +86,7 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
8686
private var enableVirtualViewContainerStateExperimentalCache: Boolean? = null
8787
private var fixBorderlessRippleAndroidCache: Boolean? = null
8888
private var fixMappingOfEventPrioritiesBetweenFabricAndReactCache: Boolean? = null
89+
private var fixTextInlineViewLineHeightCache: Boolean? = null
8990
private var fixTextLayoutOnPixelDensityChangeCache: Boolean? = null
9091
private var fixYogaFlexBasisFitContentInMainAxisCache: Boolean? = null
9192
private var fuseboxAssertSingleHostStateCache: Boolean? = null
@@ -743,6 +744,16 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
743744
return cached
744745
}
745746

747+
override fun fixTextInlineViewLineHeight(): Boolean {
748+
var cached = fixTextInlineViewLineHeightCache
749+
if (cached == null) {
750+
cached = currentProvider.fixTextInlineViewLineHeight()
751+
accessedFeatureFlags.add("fixTextInlineViewLineHeight")
752+
fixTextInlineViewLineHeightCache = cached
753+
}
754+
return cached
755+
}
756+
746757
override fun fixTextLayoutOnPixelDensityChange(): Boolean {
747758
var cached = fixTextLayoutOnPixelDensityChangeCache
748759
if (cached == null) {

‎packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsOverrides_RNOSS_Canary_Android.kt‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<1c1713da2868b9ceb7acc91ecb0c2f28>>
7+
* @generated SignedSource<<b1c2d06f2a2dbcfcb3efcead6da64e30>>
88
*/
99

1010
/**
@@ -35,6 +35,8 @@ public open class ReactNativeFeatureFlagsOverrides_RNOSS_Canary_Android : ReactN
3535

3636
override fun fixBorderlessRippleAndroid(): Boolean = true
3737

38+
override fun fixTextInlineViewLineHeight(): Boolean = true
39+
3840
override fun useNativeViewConfigsInBridgelessMode(): Boolean = true
3941

4042
override fun useTurboModuleInterop(): Boolean = true

‎packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<3c3e22fe0cffa5498750e91ad05df9a8>>
7+
* @generated SignedSource<<ee3f736a54539b92f30c4ad0fb832ab0>>
88
*/
99

1010
/**
@@ -147,6 +147,8 @@ public interface ReactNativeFeatureFlagsProvider {
147147

148148
@DoNotStrip public fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean
149149

150+
@DoNotStrip public fun fixTextInlineViewLineHeight(): Boolean
151+
150152
@DoNotStrip public fun fixTextLayoutOnPixelDensityChange(): Boolean
151153

152154
@DoNotStrip public fun fixYogaFlexBasisFitContentInMainAxis(): Boolean

‎packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<f9c238d577cf696d9baed365741d3d5a>>
7+
* @generated SignedSource<<abeca27da02154e1702b07403ab8a08f>>
88
*/
99

1010
/**
@@ -411,6 +411,12 @@ class ReactNativeFeatureFlagsJavaProvider
411411
return method(javaProvider_);
412412
}
413413

414+
bool fixTextInlineViewLineHeight() override {
415+
static const auto method =
416+
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("fixTextInlineViewLineHeight");
417+
return method(javaProvider_);
418+
}
419+
414420
bool fixTextLayoutOnPixelDensityChange() override {
415421
static const auto method =
416422
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("fixTextLayoutOnPixelDensityChange");
@@ -941,6 +947,11 @@ bool JReactNativeFeatureFlagsCxxInterop::fixMappingOfEventPrioritiesBetweenFabri
941947
return ReactNativeFeatureFlags::fixMappingOfEventPrioritiesBetweenFabricAndReact();
942948
}
943949

950+
bool JReactNativeFeatureFlagsCxxInterop::fixTextInlineViewLineHeight(
951+
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
952+
return ReactNativeFeatureFlags::fixTextInlineViewLineHeight();
953+
}
954+
944955
bool JReactNativeFeatureFlagsCxxInterop::fixTextLayoutOnPixelDensityChange(
945956
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
946957
return ReactNativeFeatureFlags::fixTextLayoutOnPixelDensityChange();
@@ -1338,6 +1349,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
13381349
makeNativeMethod(
13391350
"fixMappingOfEventPrioritiesBetweenFabricAndReact",
13401351
JReactNativeFeatureFlagsCxxInterop::fixMappingOfEventPrioritiesBetweenFabricAndReact),
1352+
makeNativeMethod(
1353+
"fixTextInlineViewLineHeight",
1354+
JReactNativeFeatureFlagsCxxInterop::fixTextInlineViewLineHeight),
13411355
makeNativeMethod(
13421356
"fixTextLayoutOnPixelDensityChange",
13431357
JReactNativeFeatureFlagsCxxInterop::fixTextLayoutOnPixelDensityChange),

‎packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<8d25ec35055628073cf8cd61f8cc838e>>
7+
* @generated SignedSource<<4573a4a09291bdc6d00a958d3e54a94a>>
88
*/
99

1010
/**
@@ -216,6 +216,9 @@ class JReactNativeFeatureFlagsCxxInterop
216216
static bool fixMappingOfEventPrioritiesBetweenFabricAndReact(
217217
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
218218

219+
static bool fixTextInlineViewLineHeight(
220+
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
221+
219222
static bool fixTextLayoutOnPixelDensityChange(
220223
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
221224

‎packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<e9243c6d351c49208f0cdac358527d43>>
7+
* @generated SignedSource<<7f3861dc19829017df54ce8408ab1a9c>>
88
*/
99

1010
/**
@@ -274,6 +274,10 @@ bool ReactNativeFeatureFlags::fixMappingOfEventPrioritiesBetweenFabricAndReact()
274274
return getAccessor().fixMappingOfEventPrioritiesBetweenFabricAndReact();
275275
}
276276

277+
bool ReactNativeFeatureFlags::fixTextInlineViewLineHeight() {
278+
return getAccessor().fixTextInlineViewLineHeight();
279+
}
280+
277281
bool ReactNativeFeatureFlags::fixTextLayoutOnPixelDensityChange() {
278282
return getAccessor().fixTextLayoutOnPixelDensityChange();
279283
}

0 commit comments

Comments
 (0)