Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/scatterlab/allowed-tarball-diff.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,34 @@ React/Fabric/Surface/RCTFabricSurface.mm
React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm
React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm
React/Tests/Mounting/RCTViewComponentViewTests.mm

# Text drawn at the old pixel density after a density change without Activity recreation
# (configChanges="density"): ParagraphShadowNode only refreshed its state when the
# attributed string changed, so a mounted TextView kept the spannable built for the old
# density (font px) and was clipped by its new frame. Cherry-pick of upstream
# https://github.com/react/react-native/pull/59049 (d026c0fa9a5), with the
# fixTextLayoutOnPixelDensityChange flag defaulting to true in this fork. The rest are
# the feature-flag files that scripts/featureflags regenerates for the new flag.
# C++ and Kotlin reach the app only through this fork's Android prebuilt release.
ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt
ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt
ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt
ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt
ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt
ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt
ReactAndroid/src/main/jni/react/fabric/FabricMountingManager.cpp
ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp
ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h
ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp
ReactCommon/react/featureflags/ReactNativeFeatureFlags.h
ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp
ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h
ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h
ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h
ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h
ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp
ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h
ReactCommon/react/renderer/components/text/ParagraphShadowNode.cpp
ReactCommon/react/renderer/textlayoutmanager/TextLayoutManagerExtended.h
src/private/featureflags/ReactNativeFeatureFlags.js
src/private/featureflags/specs/NativeReactNativeFeatureFlags.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<<de19deb8eaa373fc2048f5a9453674b7>>
* @generated SignedSource<<80a8e945ebe4470504021817cc87947c>>
*/

/**
Expand Down Expand Up @@ -360,6 +360,12 @@ public object ReactNativeFeatureFlags {
@JvmStatic
public fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean = accessor.fixMappingOfEventPrioritiesBetweenFabricAndReact()

/**
* 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.
*/
@JvmStatic
public fun fixTextLayoutOnPixelDensityChange(): Boolean = accessor.fixTextLayoutOnPixelDensityChange()

/**
* Fix flex basis computation to not apply FitContent constraint in the main axis for non-measure container nodes, preventing unnecessary re-measurement in scroll containers.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<<a1c52a57a980eaab23d92416340a6734>>
* @generated SignedSource<<19a76fd469ed11d02237972bc3cf66a9>>
*/

/**
Expand Down Expand Up @@ -75,6 +75,7 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
private var enableVirtualViewContainerStateExperimentalCache: Boolean? = null
private var fixDifferentiatorParentTagForUnflattenCaseCache: Boolean? = null
private var fixMappingOfEventPrioritiesBetweenFabricAndReactCache: Boolean? = null
private var fixTextLayoutOnPixelDensityChangeCache: Boolean? = null
private var fixYogaFlexBasisFitContentInMainAxisCache: Boolean? = null
private var fuseboxAssertSingleHostStateCache: Boolean? = null
private var fuseboxEnabledReleaseCache: Boolean? = null
Expand Down Expand Up @@ -603,6 +604,15 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
return cached
}

override fun fixTextLayoutOnPixelDensityChange(): Boolean {
var cached = fixTextLayoutOnPixelDensityChangeCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.fixTextLayoutOnPixelDensityChange()
fixTextLayoutOnPixelDensityChangeCache = cached
}
return cached
}

override fun fixYogaFlexBasisFitContentInMainAxis(): Boolean {
var cached = fixYogaFlexBasisFitContentInMainAxisCache
if (cached == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<<8a0d1f134b175ada7550499896c09203>>
* @generated SignedSource<<df2e6fda76cc33aac852a8ade67ccb95>>
*/

/**
Expand Down Expand Up @@ -138,6 +138,8 @@ public object ReactNativeFeatureFlagsCxxInterop {

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

@DoNotStrip @JvmStatic public external fun fixTextLayoutOnPixelDensityChange(): Boolean

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

@DoNotStrip @JvmStatic public external fun fuseboxAssertSingleHostState(): Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<<891abee69433c105d062b45ed357fd5c>>
* @generated SignedSource<<0d916d6e0246ea50d0db911febf3ed23>>
*/

/**
Expand Down Expand Up @@ -133,6 +133,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi

override fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean = false

override fun fixTextLayoutOnPixelDensityChange(): Boolean = true

override fun fixYogaFlexBasisFitContentInMainAxis(): Boolean = false

override fun fuseboxAssertSingleHostState(): Boolean = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<<4c62625780d9f767714f8481c7496342>>
* @generated SignedSource<<2d8e8042d1e9f8247349b6fc1d8dddc0>>
*/

/**
Expand Down Expand Up @@ -79,6 +79,7 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
private var enableVirtualViewContainerStateExperimentalCache: Boolean? = null
private var fixDifferentiatorParentTagForUnflattenCaseCache: Boolean? = null
private var fixMappingOfEventPrioritiesBetweenFabricAndReactCache: Boolean? = null
private var fixTextLayoutOnPixelDensityChangeCache: Boolean? = null
private var fixYogaFlexBasisFitContentInMainAxisCache: Boolean? = null
private var fuseboxAssertSingleHostStateCache: Boolean? = null
private var fuseboxEnabledReleaseCache: Boolean? = null
Expand Down Expand Up @@ -662,6 +663,16 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
return cached
}

override fun fixTextLayoutOnPixelDensityChange(): Boolean {
var cached = fixTextLayoutOnPixelDensityChangeCache
if (cached == null) {
cached = currentProvider.fixTextLayoutOnPixelDensityChange()
accessedFeatureFlags.add("fixTextLayoutOnPixelDensityChange")
fixTextLayoutOnPixelDensityChangeCache = cached
}
return cached
}

override fun fixYogaFlexBasisFitContentInMainAxis(): Boolean {
var cached = fixYogaFlexBasisFitContentInMainAxisCache
if (cached == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<<e991f910f4be27f532c6b81c436bcdf1>>
* @generated SignedSource<<0e01e023588d5a3ef183b7142d4df0f8>>
*/

/**
Expand Down Expand Up @@ -133,6 +133,8 @@ public interface ReactNativeFeatureFlagsProvider {

@DoNotStrip public fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean

@DoNotStrip public fun fixTextLayoutOnPixelDensityChange(): Boolean

@DoNotStrip public fun fixYogaFlexBasisFitContentInMainAxis(): Boolean

@DoNotStrip public fun fuseboxAssertSingleHostState(): Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,8 @@ void FabricMountingManager::executeMount(

bool maintainMutationOrder =
ReactNativeFeatureFlags::disableMountItemReorderingAndroid();
bool updateViewsOnDensityChange =
ReactNativeFeatureFlags::fixTextLayoutOnPixelDensityChange();

auto revisionNumber = telemetry.getRevisionNumber();

Expand Down Expand Up @@ -680,12 +682,19 @@ void FabricMountingManager::executeMount(
CppMountItem::UpdateStateMountItem(newChildShadowView));
}

bool pointScaleChanged = updateViewsOnDensityChange &&
oldChildShadowView.layoutMetrics.pointScaleFactor !=
newChildShadowView.layoutMetrics.pointScaleFactor;

// Padding: padding mountItems must be executed before layout props
// are updated in the view. This is necessary to ensure that events
// (resulting from layout changes) are dispatched with the correct
// padding information.
if (oldChildShadowView.layoutMetrics.contentInsets !=
newChildShadowView.layoutMetrics.contentInsets) {
newChildShadowView.layoutMetrics.contentInsets ||
(pointScaleChanged &&
newChildShadowView.layoutMetrics.contentInsets !=
EdgeInsets::ZERO)) {
(maintainMutationOrder ? cppCommonMountItems
: cppUpdatePaddingMountItems)
.push_back(
Expand All @@ -705,8 +714,11 @@ void FabricMountingManager::executeMount(
// children of the current view. The layout of current view may not
// change, and we separate this part from layout mount items to not
// pack too much data there.
if ((oldChildShadowView.layoutMetrics.overflowInset !=
newChildShadowView.layoutMetrics.overflowInset)) {
if (oldChildShadowView.layoutMetrics.overflowInset !=
newChildShadowView.layoutMetrics.overflowInset ||
(pointScaleChanged &&
newChildShadowView.layoutMetrics.overflowInset !=
EdgeInsets::ZERO)) {
(maintainMutationOrder ? cppCommonMountItems
: cppUpdateOverflowInsetMountItems)
.push_back(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<<dc98fadf7aac306d7cdb4f5ab511f690>>
* @generated SignedSource<<db858dfe6d039f7e6a46b619285f504c>>
*/

/**
Expand Down Expand Up @@ -369,6 +369,12 @@ class ReactNativeFeatureFlagsJavaProvider
return method(javaProvider_);
}

bool fixTextLayoutOnPixelDensityChange() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("fixTextLayoutOnPixelDensityChange");
return method(javaProvider_);
}

bool fixYogaFlexBasisFitContentInMainAxis() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("fixYogaFlexBasisFitContentInMainAxis");
Expand Down Expand Up @@ -840,6 +846,11 @@ bool JReactNativeFeatureFlagsCxxInterop::fixMappingOfEventPrioritiesBetweenFabri
return ReactNativeFeatureFlags::fixMappingOfEventPrioritiesBetweenFabricAndReact();
}

bool JReactNativeFeatureFlagsCxxInterop::fixTextLayoutOnPixelDensityChange(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::fixTextLayoutOnPixelDensityChange();
}

bool JReactNativeFeatureFlagsCxxInterop::fixYogaFlexBasisFitContentInMainAxis(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::fixYogaFlexBasisFitContentInMainAxis();
Expand Down Expand Up @@ -1196,6 +1207,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
makeNativeMethod(
"fixMappingOfEventPrioritiesBetweenFabricAndReact",
JReactNativeFeatureFlagsCxxInterop::fixMappingOfEventPrioritiesBetweenFabricAndReact),
makeNativeMethod(
"fixTextLayoutOnPixelDensityChange",
JReactNativeFeatureFlagsCxxInterop::fixTextLayoutOnPixelDensityChange),
makeNativeMethod(
"fixYogaFlexBasisFitContentInMainAxis",
JReactNativeFeatureFlagsCxxInterop::fixYogaFlexBasisFitContentInMainAxis),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<<c17b71e1b754ff1773bb370681de06e4>>
* @generated SignedSource<<f2d3027d440f567e61e29edcea36d774>>
*/

/**
Expand Down Expand Up @@ -195,6 +195,9 @@ class JReactNativeFeatureFlagsCxxInterop
static bool fixMappingOfEventPrioritiesBetweenFabricAndReact(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);

static bool fixTextLayoutOnPixelDensityChange(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);

static bool fixYogaFlexBasisFitContentInMainAxis(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<<023b0be9315450130aac118c65ac53eb>>
* @generated SignedSource<<2ef644a2ee5ef69c8ac3cc18d81c772e>>
*/

/**
Expand Down Expand Up @@ -246,6 +246,10 @@ bool ReactNativeFeatureFlags::fixMappingOfEventPrioritiesBetweenFabricAndReact()
return getAccessor().fixMappingOfEventPrioritiesBetweenFabricAndReact();
}

bool ReactNativeFeatureFlags::fixTextLayoutOnPixelDensityChange() {
return getAccessor().fixTextLayoutOnPixelDensityChange();
}

bool ReactNativeFeatureFlags::fixYogaFlexBasisFitContentInMainAxis() {
return getAccessor().fixYogaFlexBasisFitContentInMainAxis();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<<0537b7ab2bf0250ddd0cfaec6c52111b>>
* @generated SignedSource<<4028be781b8063c4e4bbdf36fbb1a061>>
*/

/**
Expand Down Expand Up @@ -316,6 +316,11 @@ class ReactNativeFeatureFlags {
*/
RN_EXPORT static bool fixMappingOfEventPrioritiesBetweenFabricAndReact();

/**
* 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.
*/
RN_EXPORT static bool fixTextLayoutOnPixelDensityChange();

/**
* Fix flex basis computation to not apply FitContent constraint in the main axis for non-measure container nodes, preventing unnecessary re-measurement in scroll containers.
*/
Expand Down
Loading