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
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<<dbc8dd1b5f401a0517830ef76e147839>>
* @generated SignedSource<<6ee52545e85d6c96c00087c3dd3d2b91>>
*/

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

/**
* When enabled, inline text with a button role produces a ClickableSpan (like a link).
*/
@JvmStatic
public fun enableInteractiveInlineButtons(): Boolean = accessor.enableInteractiveInlineButtons()

/**
* This is to fix the issue with interop view manager where component descriptor lookup is causing ViewManager to preload.
*/
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<<666ccc72b92cb71cee62acb9d338903f>>
* @generated SignedSource<<650b684ffd6117e349156de6598035e3>>
*/

/**
Expand Down Expand Up @@ -60,6 +60,7 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
private var enableImperativeEventsCache: Boolean? = null
private var enableImperativeFocusCache: Boolean? = null
private var enableInteractableResponderViewsCache: Boolean? = null
private var enableInteractiveInlineButtonsCache: Boolean? = null
private var enableInteropViewManagerClassLookUpOptimizationIOSCache: Boolean? = null
private var enableIntersectionObserverByDefaultCache: Boolean? = null
private var enableKeyEventsCache: Boolean? = null
Expand Down Expand Up @@ -484,6 +485,15 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
return cached
}

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

override fun enableInteropViewManagerClassLookUpOptimizationIOS(): Boolean {
var cached = enableInteropViewManagerClassLookUpOptimizationIOSCache
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<<62e104bae80f5d1b4bc66fbe5b1682aa>>
* @generated SignedSource<<511d3d1110dd38f9dae019b4cc26000b>>
*/

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

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

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

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

@DoNotStrip @JvmStatic public external fun enableIntersectionObserverByDefault(): 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<<aa0b238667f02be74c01551236c7ffbe>>
* @generated SignedSource<<48d155fc648fd425ad85f950771c122c>>
*/

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

override fun enableInteractableResponderViews(): Boolean = false

override fun enableInteractiveInlineButtons(): Boolean = false

override fun enableInteropViewManagerClassLookUpOptimizationIOS(): Boolean = false

override fun enableIntersectionObserverByDefault(): 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<<b74a60f5a53f535e7d93ded619b7bc77>>
* @generated SignedSource<<755f4d7a47ce52392948a9c60f73afa6>>
*/

/**
Expand Down Expand Up @@ -64,6 +64,7 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
private var enableImperativeEventsCache: Boolean? = null
private var enableImperativeFocusCache: Boolean? = null
private var enableInteractableResponderViewsCache: Boolean? = null
private var enableInteractiveInlineButtonsCache: Boolean? = null
private var enableInteropViewManagerClassLookUpOptimizationIOSCache: Boolean? = null
private var enableIntersectionObserverByDefaultCache: Boolean? = null
private var enableKeyEventsCache: Boolean? = null
Expand Down Expand Up @@ -528,6 +529,16 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
return cached
}

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

override fun enableInteropViewManagerClassLookUpOptimizationIOS(): Boolean {
var cached = enableInteropViewManagerClassLookUpOptimizationIOSCache
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<<ded38341408b1822c0ee29736c8d7309>>
* @generated SignedSource<<43bf244bab835c8890910c4e3d00bdec>>
*/

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

@DoNotStrip public fun enableInteractableResponderViews(): Boolean

@DoNotStrip public fun enableInteractiveInlineButtons(): Boolean

@DoNotStrip public fun enableInteropViewManagerClassLookUpOptimizationIOS(): Boolean

@DoNotStrip public fun enableIntersectionObserverByDefault(): Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,21 @@ internal object TextLayoutManager {
}
}

private fun isInlineInteractiveRole(
role: ReactAccessibilityDelegate.Role?,
accessibilityRole: ReactAccessibilityDelegate.AccessibilityRole?,
): Boolean {
val effectiveRole =
if (role != null) ReactAccessibilityDelegate.AccessibilityRole.fromRole(role)
else accessibilityRole
return when (effectiveRole) {
ReactAccessibilityDelegate.AccessibilityRole.LINK -> true
ReactAccessibilityDelegate.AccessibilityRole.BUTTON ->
ReactNativeFeatureFlags.enableInteractiveInlineButtons()
else -> false
}
}

@OptIn(UnstableReactNativeAPI::class)
private fun buildSpannableFromFragments(
assets: AssetManager,
Expand Down Expand Up @@ -353,13 +368,7 @@ internal object TextLayoutManager {
),
)
} else if (end >= start) {
val roleIsLink =
if (textAttributes.role != null)
(textAttributes.role == ReactAccessibilityDelegate.Role.LINK)
else
(textAttributes.accessibilityRole ==
ReactAccessibilityDelegate.AccessibilityRole.LINK)
if (roleIsLink) {
if (isInlineInteractiveRole(textAttributes.role, textAttributes.accessibilityRole)) {
if (ReactNativeFeatureFlags.enablePreparedTextLayout()) {
ops.add(SetSpanOperation(start, end, ReactLinkSpan(i)))
} else {
Expand Down Expand Up @@ -591,14 +600,7 @@ internal object TextLayoutManager {
spanFlags,
)
} else {
val roleIsLink =
if (fragment.props.role != null)
(fragment.props.role == ReactAccessibilityDelegate.Role.LINK)
else
(fragment.props.accessibilityRole ==
ReactAccessibilityDelegate.AccessibilityRole.LINK)

if (roleIsLink) {
if (isInlineInteractiveRole(fragment.props.role, fragment.props.accessibilityRole)) {
if (ReactNativeFeatureFlags.enablePreparedTextLayout()) {
spannable.setSpan(ReactLinkSpan(i), start, end, spanFlags)
} else {
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<<927c12777b5682e200477286b49fa8dd>>
* @generated SignedSource<<26984d266b1f68d96ace6c23903b9d4a>>
*/

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

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

bool enableInteropViewManagerClassLookUpOptimizationIOS() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableInteropViewManagerClassLookUpOptimizationIOS");
Expand Down Expand Up @@ -861,6 +867,11 @@ bool JReactNativeFeatureFlagsCxxInterop::enableInteractableResponderViews(
return ReactNativeFeatureFlags::enableInteractableResponderViews();
}

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

bool JReactNativeFeatureFlagsCxxInterop::enableInteropViewManagerClassLookUpOptimizationIOS(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::enableInteropViewManagerClassLookUpOptimizationIOS();
Expand Down Expand Up @@ -1327,6 +1338,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
makeNativeMethod(
"enableInteractableResponderViews",
JReactNativeFeatureFlagsCxxInterop::enableInteractableResponderViews),
makeNativeMethod(
"enableInteractiveInlineButtons",
JReactNativeFeatureFlagsCxxInterop::enableInteractiveInlineButtons),
makeNativeMethod(
"enableInteropViewManagerClassLookUpOptimizationIOS",
JReactNativeFeatureFlagsCxxInterop::enableInteropViewManagerClassLookUpOptimizationIOS),
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<<079a6bc867f6eeace870efaf80e20f75>>
* @generated SignedSource<<f363974d68125d206d18589632a4d717>>
*/

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

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

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

Expand Down
Loading
Loading