Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,8 @@ - (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection
{
[super traitCollectionDidChange:previousTraitCollection];

if (facebook::react::ReactNativeFeatureFlags::enableFontScaleChangesUpdatingLayout() &&
UITraitCollection.currentTraitCollection.preferredContentSizeCategory !=
previousTraitCollection.preferredContentSizeCategory) {
if (UITraitCollection.currentTraitCollection.preferredContentSizeCategory !=
previousTraitCollection.preferredContentSizeCategory) {
const auto &newTextInputProps = static_cast<const TextInputProps &>(*_props);
_backedTextInputView.defaultTextAttributes =
RCTNSTextAttributesFromTextAttributes(newTextInputProps.getEffectiveTextAttributes(RCTFontSizeMultiplier()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,7 @@ private void init() {
setRootViewTag(ReactRootViewTagGenerator.getNextRootViewTag());
setClipChildren(false);

if (ReactNativeFeatureFlags.enableFontScaleChangesUpdatingLayout()) {
DisplayMetricsHolder.initDisplayMetrics(getContext().getApplicationContext());
}
DisplayMetricsHolder.initDisplayMetrics(getContext().getApplicationContext());
}

@Override
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<<f8fad51e8b31224b04d7933da8affb3a>>
* @generated SignedSource<<a18d5e11b135adb39833faab7246bfb2>>
*/

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

/**
* Enables font scale changes updating layout for measurable nodes.
*/
@JvmStatic
public fun enableFontScaleChangesUpdatingLayout(): Boolean = accessor.enableFontScaleChangesUpdatingLayout()

/**
* Adjusts iOS Text drawing frames for compressed explicit line heights.
*/
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<<846a8685f662d66dbcdaa4324c772d51>>
* @generated SignedSource<<d998658c398d775075210b0ab6cbd930>>
*/

/**
Expand Down Expand Up @@ -50,7 +50,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
private var enableFabricLogsCache: Boolean? = null
private var enableFlexboxAutoMinSizeInStrictModeCache: Boolean? = null
private var enableFollowUpMountItemDispatchAndroidCache: Boolean? = null
private var enableFontScaleChangesUpdatingLayoutCache: Boolean? = null
private var enableIOSCompressedTextFrameAdjustmentCache: Boolean? = null
private var enableIOSTextBaselineOffsetPerLineCache: Boolean? = null
private var enableIOSViewClipToPaddingBoxCache: Boolean? = null
Expand Down Expand Up @@ -388,15 +387,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
return cached
}

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

override fun enableIOSCompressedTextFrameAdjustment(): Boolean {
var cached = enableIOSCompressedTextFrameAdjustmentCache
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<<9ccf3958e1db2db295ba73dc371b5185>>
* @generated SignedSource<<c1526d329986be4e0e06003fb8d46258>>
*/

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

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

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

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

@DoNotStrip @JvmStatic public external fun enableIOSTextBaselineOffsetPerLine(): 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<<0a04c5e0a0b418f2efd4b253646ae7c1>>
* @generated SignedSource<<331904bfe83edd5fbc3b659be444b4a0>>
*/

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

override fun enableFollowUpMountItemDispatchAndroid(): Boolean = false

override fun enableFontScaleChangesUpdatingLayout(): Boolean = true

override fun enableIOSCompressedTextFrameAdjustment(): Boolean = false

override fun enableIOSTextBaselineOffsetPerLine(): Boolean = false
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<<861063ef7d217992d3cecd410e25d885>>
* @generated SignedSource<<703e33de05bdcde18640067698775cdb>>
*/

/**
Expand Down Expand Up @@ -54,7 +54,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
private var enableFabricLogsCache: Boolean? = null
private var enableFlexboxAutoMinSizeInStrictModeCache: Boolean? = null
private var enableFollowUpMountItemDispatchAndroidCache: Boolean? = null
private var enableFontScaleChangesUpdatingLayoutCache: Boolean? = null
private var enableIOSCompressedTextFrameAdjustmentCache: Boolean? = null
private var enableIOSTextBaselineOffsetPerLineCache: Boolean? = null
private var enableIOSViewClipToPaddingBoxCache: Boolean? = null
Expand Down Expand Up @@ -422,16 +421,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
return cached
}

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

override fun enableIOSCompressedTextFrameAdjustment(): Boolean {
var cached = enableIOSCompressedTextFrameAdjustmentCache
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<<5fa21c808df68be4c007469040fbca2a>>
* @generated SignedSource<<da027cfa0206527bfa4db3fa529839e3>>
*/

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

@DoNotStrip public fun enableFollowUpMountItemDispatchAndroid(): Boolean

@DoNotStrip public fun enableFontScaleChangesUpdatingLayout(): Boolean

@DoNotStrip public fun enableIOSCompressedTextFrameAdjustment(): Boolean

@DoNotStrip public fun enableIOSTextBaselineOffsetPerLine(): Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -733,15 +733,13 @@ public class ReactHostImpl(
override fun onConfigurationChanged(context: Context) {
val currentReactContext = this.currentReactContext
if (currentReactContext != null) {
if (ReactNativeFeatureFlags.enableFontScaleChangesUpdatingLayout()) {
val previousFontScale = PixelUtil.toPixelFromSP(1.0)
DisplayMetricsHolder.initDisplayMetrics(currentReactContext)
val newFontScale = PixelUtil.toPixelFromSP(1.0)

if (previousFontScale != newFontScale) {
synchronized(attachedSurfaces) {
attachedSurfaces.forEach { surface -> surface.view?.requestLayout() }
}
val previousFontScale = PixelUtil.toPixelFromSP(1.0)
DisplayMetricsHolder.initDisplayMetrics(currentReactContext)
val newFontScale = PixelUtil.toPixelFromSP(1.0)

if (previousFontScale != newFontScale) {
synchronized(attachedSurfaces) {
attachedSurfaces.forEach { surface -> surface.view?.requestLayout() }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import com.facebook.react.common.annotations.VisibleForTesting
import com.facebook.react.fabric.SurfaceHandlerBinding
import com.facebook.react.interfaces.TaskInterface
import com.facebook.react.interfaces.fabric.ReactSurface
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags
import com.facebook.react.modules.i18nmanager.I18nUtil
import com.facebook.react.runtime.internal.bolts.Task
import com.facebook.react.uimanager.events.EventDispatcher
Expand Down Expand Up @@ -216,10 +215,7 @@ internal constructor(

private fun isRTL(context: Context): Boolean = I18nUtil.instance.isRTL(context)

private fun getFontScale(context: Context): Float =
if (ReactNativeFeatureFlags.enableFontScaleChangesUpdatingLayout())
context.resources.configuration.fontScale
else 1f
private fun getFontScale(context: Context): Float = context.resources.configuration.fontScale

private fun doRTLSwap(context: Context): Boolean =
I18nUtil.instance.doLeftAndRightSwapInRTL(context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1048,10 +1048,7 @@ public open class ReactEditText public constructor(context: Context) : AppCompat
public override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)

if (
ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() &&
ReactNativeFeatureFlags.enableFontScaleChangesUpdatingLayout()
) {
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture()) {
applyTextAttributes()
}
}
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<<7e430d5b575ea983d53ecde87c4dc9f0>>
* @generated SignedSource<<02bae939bf76d168cd5c1911f6f85272>>
*/

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

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

bool enableIOSCompressedTextFrameAdjustment() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableIOSCompressedTextFrameAdjustment");
Expand Down Expand Up @@ -775,11 +769,6 @@ bool JReactNativeFeatureFlagsCxxInterop::enableFollowUpMountItemDispatchAndroid(
return ReactNativeFeatureFlags::enableFollowUpMountItemDispatchAndroid();
}

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

bool JReactNativeFeatureFlagsCxxInterop::enableIOSCompressedTextFrameAdjustment(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::enableIOSCompressedTextFrameAdjustment();
Expand Down Expand Up @@ -1231,9 +1220,6 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
makeNativeMethod(
"enableFollowUpMountItemDispatchAndroid",
JReactNativeFeatureFlagsCxxInterop::enableFollowUpMountItemDispatchAndroid),
makeNativeMethod(
"enableFontScaleChangesUpdatingLayout",
JReactNativeFeatureFlagsCxxInterop::enableFontScaleChangesUpdatingLayout),
makeNativeMethod(
"enableIOSCompressedTextFrameAdjustment",
JReactNativeFeatureFlagsCxxInterop::enableIOSCompressedTextFrameAdjustment),
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<<6b96c286c25d3c9fcb66d39d67092787>>
* @generated SignedSource<<d31b05c82d4357d2066387ed5f9e516d>>
*/

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

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

static bool enableIOSCompressedTextFrameAdjustment(
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<<493a51a28c2f55411c5c5aea374638d1>>
* @generated SignedSource<<0ebd37962690c8c130f173a4e02b3431>>
*/

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

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

bool ReactNativeFeatureFlags::enableIOSCompressedTextFrameAdjustment() {
return getAccessor().enableIOSCompressedTextFrameAdjustment();
}
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<<2d7aa66f222fa01d4cc93c7d5ef2fdb7>>
* @generated SignedSource<<7085da13d979f0747b42c6c1b99a5f4c>>
*/

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

/**
* Enables font scale changes updating layout for measurable nodes.
*/
RN_EXPORT static bool enableFontScaleChangesUpdatingLayout();

/**
* Adjusts iOS Text drawing frames for compressed explicit line heights.
*/
Expand Down
Loading
Loading